id
int32 0
12.9k
| code
sequencelengths 2
264k
|
---|---|
6,300 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfigurationWorkingCopy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaMainTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"JavaUILabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"ISharedImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaUI",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ArrayContentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"ListDialog",
";",
"public",
"abstract",
"class",
"AbstractGroovyLauncherTab",
"extends",
"JavaMainTab",
"{",
"protected",
"void",
"handleSearchButtonSelected",
"(",
")",
"{",
"IJavaProject",
"javaProject",
"=",
"getJavaProject",
"(",
")",
";",
"try",
"{",
"final",
"List",
"<",
"IType",
">",
"availableClasses",
"=",
"findAllRunnableTypes",
"(",
"javaProject",
")",
";",
"if",
"(",
"availableClasses",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"MessageDialog",
".",
"openWarning",
"(",
"getShell",
"(",
")",
",",
"\"\"",
",",
"\"\"",
")",
";",
"return",
";",
"}",
"ListDialog",
"dialog",
"=",
"new",
"ListDialog",
"(",
"getShell",
"(",
")",
")",
";",
"dialog",
".",
"setBlockOnOpen",
"(",
"true",
")",
";",
"dialog",
".",
"setMessage",
"(",
"\"\"",
")",
";",
"dialog",
".",
"setTitle",
"(",
"\"\"",
")",
";",
"dialog",
".",
"setContentProvider",
"(",
"new",
"ArrayContentProvider",
"(",
")",
")",
";",
"dialog",
".",
"setLabelProvider",
"(",
"new",
"JavaUILabelProvider",
"(",
")",
")",
";",
"dialog",
".",
"setInput",
"(",
"availableClasses",
".",
"toArray",
"(",
"new",
"IType",
"[",
"availableClasses",
".",
"size",
"(",
")",
"]",
")",
")",
";",
"if",
"(",
"dialog",
".",
"open",
"(",
")",
"==",
"Window",
".",
"CANCEL",
")",
"{",
"return",
";",
"}",
"Object",
"[",
"]",
"results",
"=",
"dialog",
".",
"getResult",
"(",
")",
";",
"if",
"(",
"results",
"==",
"null",
"||",
"results",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"results",
"[",
"0",
"]",
"instanceof",
"IType",
")",
"{",
"fMainText",
".",
"setText",
"(",
"(",
"(",
"IType",
")",
"results",
"[",
"0",
"]",
")",
".",
"getFullyQualifiedName",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"javaProject",
",",
"e",
")",
";",
"}",
"}",
"protected",
"abstract",
"List",
"<",
"IType",
">",
"findAllRunnableTypes",
"(",
"IJavaProject",
"javaProject",
")",
"throws",
"JavaModelException",
";",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"\"Groovy",
"Main\"",
";",
"}",
"public",
"Image",
"getImage",
"(",
")",
"{",
"return",
"JavaUI",
".",
"getSharedImages",
"(",
")",
".",
"getImage",
"(",
"ISharedImages",
".",
"IMG_OBJS_CLASS",
")",
";",
"}",
"public",
"void",
"activated",
"(",
"ILaunchConfigurationWorkingCopy",
"workingCopy",
")",
"{",
"super",
".",
"activated",
"(",
"workingCopy",
")",
";",
"}",
"}",
"</s>"
] |
6,301 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"activator",
".",
"GroovyActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"compiler",
".",
"CompilerUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"FileLocator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"variables",
".",
"IDynamicVariable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"variables",
".",
"IDynamicVariableResolver",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"Bundle",
";",
"public",
"class",
"GroovyHomeVariableResolver",
"implements",
"IDynamicVariableResolver",
"{",
"public",
"String",
"resolveValue",
"(",
"IDynamicVariable",
"variable",
",",
"String",
"argument",
")",
"throws",
"CoreException",
"{",
"Bundle",
"activeGroovyBundle",
"=",
"CompilerUtils",
".",
"getActiveGroovyBundle",
"(",
")",
";",
"Enumeration",
"entries",
"=",
"activeGroovyBundle",
".",
"findEntries",
"(",
"\"\"",
",",
"\"conf\"",
",",
"false",
")",
";",
"if",
"(",
"entries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"URL",
"entry",
"=",
"(",
"URL",
")",
"entries",
".",
"nextElement",
"(",
")",
";",
"try",
"{",
"String",
"file",
"=",
"FileLocator",
".",
"resolve",
"(",
"entry",
")",
".",
"getFile",
"(",
")",
";",
"if",
"(",
"file",
".",
"endsWith",
"(",
"\"conf/\"",
")",
")",
"{",
"file",
"=",
"file",
".",
"substring",
"(",
"0",
",",
"file",
".",
"length",
"(",
")",
"-",
"\"conf/\"",
".",
"length",
"(",
")",
")",
";",
"}",
"return",
"file",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CoreException",
"(",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"GroovyActivator",
".",
"PLUGIN_ID",
",",
"\"\"",
",",
"e",
")",
")",
";",
"}",
"}",
"return",
"\"/\"",
";",
"}",
"}",
"</s>"
] |
6,302 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfigurationType",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ILaunchShortcut",
";",
"public",
"class",
"GroovyScriptLaunchShortcut",
"extends",
"AbstractGroovyLaunchShortcut",
"{",
"public",
"static",
"final",
"String",
"GROOVY_SCRIPT_LAUNCH_CONFIG_ID",
"=",
"\"\"",
";",
"@",
"Override",
"public",
"ILaunchConfigurationType",
"getGroovyLaunchConfigType",
"(",
")",
"{",
"return",
"getLaunchManager",
"(",
")",
".",
"getLaunchConfigurationType",
"(",
"GROOVY_SCRIPT_LAUNCH_CONFIG_ID",
")",
";",
"}",
"@",
"Override",
"protected",
"String",
"applicationOrConsole",
"(",
")",
"{",
"return",
"\"script\"",
";",
"}",
"@",
"Override",
"protected",
"String",
"classToRun",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"boolean",
"canLaunchWithNoType",
"(",
")",
"{",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
6,303 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"regex",
".",
"Matcher",
";",
"import",
"java",
".",
"util",
".",
"regex",
".",
"Pattern",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"console",
".",
"FileLink",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"console",
".",
"IConsole",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"console",
".",
"IConsoleLineTracker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"Dialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredContentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"Viewer",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"ConsolePlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IHyperlink",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"ListDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"model",
".",
"WorkbenchLabelProvider",
";",
"public",
"class",
"GroovyConsoleLineTracker",
"implements",
"IConsoleLineTracker",
"{",
"public",
"class",
"AmbiguousFileLink",
"extends",
"FileLink",
"implements",
"IHyperlink",
"{",
"IFile",
"[",
"]",
"files",
";",
"boolean",
"fileChosen",
"=",
"false",
";",
"public",
"AmbiguousFileLink",
"(",
"IFile",
"[",
"]",
"files",
",",
"String",
"editorId",
",",
"int",
"fileOffset",
",",
"int",
"fileLength",
",",
"int",
"fileLineNumber",
")",
"{",
"super",
"(",
"null",
",",
"editorId",
",",
"fileOffset",
",",
"fileLength",
",",
"fileLineNumber",
")",
";",
"this",
".",
"files",
"=",
"files",
";",
"}",
"@",
"Override",
"public",
"void",
"linkActivated",
"(",
")",
"{",
"if",
"(",
"!",
"fileChosen",
")",
"{",
"IFile",
"file",
"=",
"chooseFile",
"(",
"files",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"fileChosen",
"=",
"true",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"FileLink",
".",
"class",
",",
"\"fFile\"",
",",
"this",
",",
"file",
")",
";",
"}",
"}",
"if",
"(",
"fileChosen",
")",
"{",
"super",
".",
"linkActivated",
"(",
")",
";",
"}",
"}",
"}",
"public",
"class",
"FileContentProvider",
"implements",
"IStructuredContentProvider",
"{",
"public",
"Object",
"[",
"]",
"getElements",
"(",
"Object",
"inputElement",
")",
"{",
"IFile",
"[",
"]",
"files",
"=",
"(",
"IFile",
"[",
"]",
")",
"inputElement",
";",
"Object",
"[",
"]",
"out",
"=",
"new",
"Object",
"[",
"files",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"out",
".",
"length",
";",
"i",
"++",
")",
"{",
"out",
"[",
"i",
"]",
"=",
"files",
"[",
"i",
"]",
";",
"}",
"return",
"out",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"}",
"public",
"void",
"inputChanged",
"(",
"Viewer",
"viewer",
",",
"Object",
"oldInput",
",",
"Object",
"newInput",
")",
"{",
"}",
"}",
"private",
"IConsole",
"console",
";",
"private",
"final",
"static",
"Pattern",
"linePattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"\"",
")",
";",
"public",
"void",
"init",
"(",
"IConsole",
"console",
")",
"{",
"this",
".",
"console",
"=",
"console",
";",
"}",
"public",
"void",
"lineAppended",
"(",
"IRegion",
"line",
")",
"{",
"if",
"(",
"console",
"==",
"null",
")",
"return",
";",
"int",
"lineOffset",
"=",
"line",
".",
"getOffset",
"(",
")",
";",
"int",
"lineLength",
"=",
"line",
".",
"getLength",
"(",
")",
";",
"try",
"{",
"String",
"consoleLine",
"=",
"console",
".",
"getDocument",
"(",
")",
".",
"get",
"(",
"lineOffset",
",",
"lineLength",
")",
";",
"GroovyPlugin",
".",
"trace",
"(",
"consoleLine",
")",
";",
"Matcher",
"m",
"=",
"linePattern",
".",
"matcher",
"(",
"consoleLine",
")",
";",
"String",
"groovyFileName",
"=",
"null",
";",
"int",
"lineNumber",
"=",
"-",
"1",
";",
"int",
"openParenIndexAt",
"=",
"-",
"1",
";",
"int",
"closeParenIndexAt",
"=",
"-",
"1",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"GroovyCore",
".",
"trace",
"(",
"\"match:",
"\"",
"+",
"m",
")",
";",
"consoleLine",
"=",
"m",
".",
"group",
"(",
"0",
")",
";",
"openParenIndexAt",
"=",
"consoleLine",
".",
"indexOf",
"(",
"\"(\"",
")",
";",
"if",
"(",
"openParenIndexAt",
">=",
"0",
")",
"{",
"int",
"end",
"=",
"consoleLine",
".",
"indexOf",
"(",
"\".groovy\"",
")",
";",
"if",
"(",
"end",
"==",
"-",
"1",
"||",
"(",
"openParenIndexAt",
"+",
"1",
")",
">=",
"end",
")",
"{",
"return",
";",
"}",
"String",
"groovyClassName",
"=",
"consoleLine",
".",
"substring",
"(",
"openParenIndexAt",
"+",
"1",
",",
"end",
")",
";",
"int",
"classIndex",
"=",
"consoleLine",
".",
"indexOf",
"(",
"groovyClassName",
")",
";",
"int",
"start",
"=",
"3",
";",
"if",
"(",
"classIndex",
"<",
"start",
"||",
"classIndex",
">=",
"consoleLine",
".",
"length",
"(",
")",
")",
"{",
"return",
";",
"}",
"String",
"groovyFilePath",
"=",
"consoleLine",
".",
"substring",
"(",
"start",
",",
"classIndex",
")",
".",
"trim",
"(",
")",
".",
"replace",
"(",
"'.'",
",",
"'/'",
")",
";",
"groovyFileName",
"=",
"groovyFilePath",
"+",
"groovyClassName",
"+",
"\".groovy\"",
";",
"int",
"colonIndex",
"=",
"consoleLine",
".",
"indexOf",
"(",
"\":\"",
")",
";",
"closeParenIndexAt",
"=",
"consoleLine",
".",
"lastIndexOf",
"(",
"\")\"",
")",
";",
"if",
"(",
"colonIndex",
">",
"0",
")",
"{",
"lineNumber",
"=",
"Integer",
".",
"parseInt",
"(",
"consoleLine",
".",
"substring",
"(",
"colonIndex",
"+",
"1",
",",
"closeParenIndexAt",
")",
")",
";",
"}",
"GroovyPlugin",
".",
"trace",
"(",
"\"groovyFile=\"",
"+",
"groovyFileName",
"+",
"\"",
"lineNumber:\"",
"+",
"lineNumber",
")",
";",
"}",
"if",
"(",
"groovyFileName",
"!=",
"null",
")",
"{",
"IFile",
"[",
"]",
"file",
"=",
"searchForFileInLaunchConfig",
"(",
"groovyFileName",
")",
";",
"if",
"(",
"file",
".",
"length",
"==",
"1",
")",
"{",
"IHyperlink",
"link",
"=",
"new",
"FileLink",
"(",
"file",
"[",
"0",
"]",
",",
"GroovyEditor",
".",
"EDITOR_ID",
",",
"-",
"1",
",",
"-",
"1",
",",
"lineNumber",
")",
";",
"console",
".",
"addLink",
"(",
"link",
",",
"lineOffset",
"+",
"openParenIndexAt",
"+",
"1",
",",
"closeParenIndexAt",
"-",
"openParenIndexAt",
"-",
"1",
")",
";",
"}",
"else",
"if",
"(",
"file",
".",
"length",
">",
"1",
")",
"{",
"IHyperlink",
"link",
"=",
"new",
"AmbiguousFileLink",
"(",
"file",
",",
"GroovyEditor",
".",
"EDITOR_ID",
",",
"-",
"1",
",",
"-",
"1",
",",
"lineNumber",
")",
";",
"console",
".",
"addLink",
"(",
"link",
",",
"lineOffset",
"+",
"openParenIndexAt",
"+",
"1",
",",
"closeParenIndexAt",
"-",
"openParenIndexAt",
"-",
"1",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyPlugin",
".",
"trace",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"private",
"IFile",
"[",
"]",
"searchForFileInLaunchConfig",
"(",
"String",
"groovyFileName",
")",
"throws",
"JavaModelException",
"{",
"List",
"<",
"IFile",
">",
"files",
"=",
"new",
"LinkedList",
"<",
"IFile",
">",
"(",
")",
";",
"IJavaProject",
"[",
"]",
"projects",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
".",
"getJavaProjects",
"(",
")",
";",
"for",
"(",
"IJavaProject",
"javaProject",
":",
"projects",
")",
"{",
"if",
"(",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"javaProject",
".",
"getProject",
"(",
")",
")",
")",
"{",
"for",
"(",
"IPackageFragmentRoot",
"root",
":",
"javaProject",
".",
"getAllPackageFragmentRoots",
"(",
")",
")",
"{",
"if",
"(",
"root",
".",
"getKind",
"(",
")",
"==",
"IPackageFragmentRoot",
".",
"K_SOURCE",
")",
"{",
"IResource",
"resource",
"=",
"root",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
".",
"isAccessible",
"(",
")",
"&&",
"resource",
".",
"getType",
"(",
")",
"!=",
"IResource",
".",
"FILE",
")",
"{",
"IFile",
"file",
"=",
"(",
"(",
"IContainer",
")",
"resource",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"groovyFileName",
")",
")",
";",
"if",
"(",
"file",
".",
"isAccessible",
"(",
")",
")",
"{",
"files",
".",
"add",
"(",
"file",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"return",
"files",
".",
"toArray",
"(",
"new",
"IFile",
"[",
"files",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"IFile",
"chooseFile",
"(",
"final",
"IFile",
"[",
"]",
"files",
")",
"{",
"final",
"IFile",
"[",
"]",
"result",
"=",
"new",
"IFile",
"[",
"]",
"{",
"null",
"}",
";",
"ConsolePlugin",
".",
"getStandardDisplay",
"(",
")",
".",
"syncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"final",
"ListDialog",
"dialog",
"=",
"new",
"ListDialog",
"(",
"ConsolePlugin",
".",
"getStandardDisplay",
"(",
")",
".",
"getActiveShell",
"(",
")",
")",
";",
"dialog",
".",
"setLabelProvider",
"(",
"new",
"WorkbenchLabelProvider",
"(",
")",
"{",
"@",
"Override",
"protected",
"String",
"decorateText",
"(",
"String",
"input",
",",
"Object",
"element",
")",
"{",
"return",
"(",
"(",
"IFile",
")",
"element",
")",
".",
"getFullPath",
"(",
")",
".",
"toPortableString",
"(",
")",
";",
"}",
"}",
")",
";",
"dialog",
".",
"setTitle",
"(",
"\"\"",
")",
";",
"dialog",
".",
"setInput",
"(",
"files",
")",
";",
"dialog",
".",
"setContentProvider",
"(",
"new",
"FileContentProvider",
"(",
")",
")",
";",
"dialog",
".",
"setAddCancelButton",
"(",
"true",
")",
";",
"dialog",
".",
"setMessage",
"(",
"\"\"",
")",
";",
"dialog",
".",
"setBlockOnOpen",
"(",
"true",
")",
";",
"int",
"dialogResult",
"=",
"dialog",
".",
"open",
"(",
")",
";",
"if",
"(",
"dialogResult",
"==",
"Dialog",
".",
"OK",
"&&",
"dialog",
".",
"getResult",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"result",
"[",
"0",
"]",
"=",
"(",
"IFile",
")",
"dialog",
".",
"getResult",
"(",
")",
"[",
"0",
"]",
";",
"}",
"}",
"}",
")",
";",
"return",
"result",
"[",
"0",
"]",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"console",
"=",
"null",
";",
"}",
"}",
"</s>"
] |
6,304 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"IWhitespaceDetector",
";",
"public",
"class",
"GroovyWhitespaceDetector",
"implements",
"IWhitespaceDetector",
"{",
"public",
"boolean",
"isWhitespace",
"(",
"char",
"c",
")",
"{",
"return",
"Character",
".",
"isWhitespace",
"(",
"c",
")",
";",
"}",
"}",
"</s>"
] |
6,305 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"filebuffers",
".",
"IDocumentSetupParticipant",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"JavaPartitionScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocumentExtension3",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocumentPartitioner",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"FastPartitioner",
";",
"public",
"class",
"GroovyDocumentSetupParticipant",
"implements",
"IDocumentSetupParticipant",
"{",
"public",
"GroovyDocumentSetupParticipant",
"(",
")",
"{",
"}",
"public",
"void",
"setup",
"(",
"IDocument",
"document",
")",
"{",
"setupJavaDocumentPartitioner",
"(",
"document",
",",
"JavaPartitionScanner",
".",
"JAVA_PARTITIONING",
")",
";",
"}",
"private",
"void",
"setupJavaDocumentPartitioner",
"(",
"IDocument",
"document",
",",
"String",
"partitioning",
")",
"{",
"IDocumentPartitioner",
"partitioner",
"=",
"createDocumentPartitioner",
"(",
")",
";",
"if",
"(",
"document",
"instanceof",
"IDocumentExtension3",
")",
"{",
"IDocumentExtension3",
"extension3",
"=",
"(",
"IDocumentExtension3",
")",
"document",
";",
"extension3",
".",
"setDocumentPartitioner",
"(",
"partitioning",
",",
"partitioner",
")",
";",
"}",
"else",
"{",
"document",
".",
"setDocumentPartitioner",
"(",
"partitioner",
")",
";",
"}",
"partitioner",
".",
"connect",
"(",
"document",
")",
";",
"}",
"private",
"IDocumentPartitioner",
"createDocumentPartitioner",
"(",
")",
"{",
"return",
"new",
"FastPartitioner",
"(",
"new",
"GroovyPartitionScanner",
"(",
")",
",",
"GroovyPartitionScanner",
".",
"LEGAL_CONTENT_TYPES",
")",
";",
"}",
"}",
"</s>"
] |
6,306 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"DefaultIndentLineAutoEditStrategy",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"DocumentCommand",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IAutoEditStrategy",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"public",
"class",
"GroovyMultilineStringAutoEditStrategy",
"extends",
"AbstractAutoEditStrategy",
"{",
"private",
"static",
"final",
"boolean",
"DEBUG",
"=",
"false",
";",
"private",
"IAutoEditStrategy",
"wrappee",
"=",
"new",
"DefaultIndentLineAutoEditStrategy",
"(",
")",
";",
"public",
"GroovyMultilineStringAutoEditStrategy",
"(",
"String",
"contentType",
")",
"{",
"}",
"public",
"void",
"customizeDocumentCommand",
"(",
"IDocument",
"d",
",",
"DocumentCommand",
"c",
")",
"{",
"if",
"(",
"true",
")",
"return",
";",
"if",
"(",
"c",
".",
"text",
".",
"length",
"(",
")",
">",
"2",
")",
"{",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"return",
";",
"}",
"else",
"if",
"(",
"\"{\"",
".",
"equals",
"(",
"c",
".",
"text",
")",
")",
"{",
"char",
"before",
";",
"try",
"{",
"before",
"=",
"d",
".",
"getChar",
"(",
"c",
".",
"offset",
"-",
"1",
")",
";",
"if",
"(",
"before",
"==",
"'$'",
"&&",
"!",
"findCloseBrace",
"(",
"d",
",",
"c",
".",
"offset",
")",
")",
"{",
"c",
".",
"text",
"=",
"\"{}\"",
";",
"c",
".",
"shiftsCaret",
"=",
"false",
";",
"c",
".",
"caretOffset",
"=",
"c",
".",
"offset",
"+",
"1",
";",
"}",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"}",
"}",
"wrappee",
".",
"customizeDocumentCommand",
"(",
"d",
",",
"c",
")",
";",
"}",
"private",
"boolean",
"findCloseBrace",
"(",
"IDocument",
"d",
",",
"int",
"offset",
")",
"throws",
"BadLocationException",
"{",
"int",
"line",
"=",
"d",
".",
"getLineOfOffset",
"(",
"offset",
")",
";",
"int",
"endOfLine",
"=",
"d",
".",
"getLineOffset",
"(",
"line",
")",
"+",
"d",
".",
"getLineLength",
"(",
"line",
")",
";",
"while",
"(",
"offset",
"<",
"endOfLine",
")",
"{",
"switch",
"(",
"d",
".",
"getChar",
"(",
"offset",
")",
")",
"{",
"case",
"'}'",
":",
"return",
"true",
";",
"case",
"'{'",
":",
"case",
"'\"'",
":",
"case",
"'\\''",
":",
"return",
"false",
";",
"case",
"'\\\\'",
":",
"offset",
"++",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"offset",
"++",
";",
"}",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
6,307 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"utils",
".",
"GroovyResourceUtil",
";",
"public",
"class",
"RenameToJavaAction",
"extends",
"RenameToGroovyOrJavaAction",
"{",
"public",
"static",
"String",
"COMMAND_ID",
"=",
"\"\"",
";",
"public",
"RenameToJavaAction",
"(",
")",
"{",
"super",
"(",
"GroovyResourceUtil",
".",
"JAVA",
")",
";",
"}",
"}",
"</s>"
] |
6,308 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"GroovyIndentationService",
".",
"getLineLeadingWhiteSpace",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"GroovyIndentationService",
".",
"getLineTextUpto",
";",
"import",
"java",
".",
"util",
".",
"ResourceBundle",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"GroovyIndentationService",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"ISourceViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelectionProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"IDocumentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"ITextEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"ITextEditorExtension3",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"TextEditorAction",
";",
"public",
"class",
"GroovyTabAction",
"extends",
"TextEditorAction",
"{",
"public",
"GroovyTabAction",
"(",
"ITextEditor",
"editor",
")",
"{",
"super",
"(",
"fgBundleForConstructedKeys",
",",
"\"Indent.\"",
",",
"editor",
")",
";",
"}",
"public",
"GroovyIndentationService",
"getIndentor",
"(",
")",
"{",
"return",
"GroovyIndentationService",
".",
"get",
"(",
"getJavaProject",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"!",
"isEnabled",
"(",
")",
"||",
"!",
"validateEditorInputState",
"(",
")",
")",
"return",
";",
"ITextSelection",
"selection",
"=",
"getSelection",
"(",
")",
";",
"final",
"IDocument",
"d",
"=",
"getDocument",
"(",
")",
";",
"if",
"(",
"d",
"!=",
"null",
")",
"{",
"try",
"{",
"int",
"offset",
"=",
"selection",
".",
"getOffset",
"(",
")",
";",
"Assert",
".",
"isTrue",
"(",
"selection",
".",
"getLength",
"(",
")",
"==",
"0",
")",
";",
"Assert",
".",
"isTrue",
"(",
"isInSmartTabRegion",
"(",
"d",
",",
"offset",
")",
")",
";",
"int",
"tabLine",
"=",
"d",
".",
"getLineOfOffset",
"(",
"offset",
")",
";",
"int",
"newIndentLevel",
"=",
"getIndentor",
"(",
")",
".",
"computeIndentForLine",
"(",
"d",
",",
"tabLine",
")",
";",
"String",
"lineStartText",
"=",
"getLineTextUpto",
"(",
"d",
",",
"offset",
")",
";",
"int",
"cursorIndent",
"=",
"getIndentor",
"(",
")",
".",
"indentLevel",
"(",
"lineStartText",
")",
";",
"if",
"(",
"cursorIndent",
"<",
"newIndentLevel",
")",
"{",
"String",
"leadingWhiteSpace",
"=",
"getLineLeadingWhiteSpace",
"(",
"d",
",",
"tabLine",
")",
";",
"int",
"editOffset",
"=",
"d",
".",
"getLineOffset",
"(",
"tabLine",
")",
";",
"int",
"editLength",
"=",
"leadingWhiteSpace",
".",
"length",
"(",
")",
";",
"String",
"editText",
"=",
"getIndentor",
"(",
")",
".",
"createIndentation",
"(",
"newIndentLevel",
")",
";",
"d",
".",
"replace",
"(",
"editOffset",
",",
"editLength",
",",
"editText",
")",
";",
"selectAndReveal",
"(",
"editOffset",
"+",
"editText",
".",
"length",
"(",
")",
",",
"0",
")",
";",
"}",
"else",
"{",
"String",
"editText",
"=",
"getIndentor",
"(",
")",
".",
"getTabString",
"(",
")",
";",
"d",
".",
"replace",
"(",
"offset",
",",
"0",
",",
"editText",
")",
";",
"selectAndReveal",
"(",
"offset",
"+",
"editText",
".",
"length",
"(",
")",
",",
"0",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"private",
"boolean",
"isInSmartTabRegion",
"(",
"IDocument",
"d",
",",
"int",
"offset",
")",
"throws",
"BadLocationException",
"{",
"String",
"lineStartText",
"=",
"GroovyIndentationService",
".",
"getLineTextUpto",
"(",
"d",
",",
"offset",
")",
";",
"return",
"lineStartText",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"update",
"(",
")",
"{",
"super",
".",
"update",
"(",
")",
";",
"if",
"(",
"isEnabled",
"(",
")",
")",
"setEnabled",
"(",
"canModifyEditor",
"(",
")",
"&&",
"isSmartMode",
"(",
")",
"&&",
"isValidSelection",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"isValidSelection",
"(",
")",
"{",
"ITextSelection",
"selection",
"=",
"getSelection",
"(",
")",
";",
"if",
"(",
"selection",
".",
"isEmpty",
"(",
")",
")",
"return",
"false",
";",
"int",
"offset",
"=",
"selection",
".",
"getOffset",
"(",
")",
";",
"int",
"length",
"=",
"selection",
".",
"getLength",
"(",
")",
";",
"IDocument",
"document",
"=",
"getDocument",
"(",
")",
";",
"if",
"(",
"document",
"==",
"null",
")",
"return",
"false",
";",
"try",
"{",
"IRegion",
"firstLine",
"=",
"document",
".",
"getLineInformationOfOffset",
"(",
"offset",
")",
";",
"int",
"lineOffset",
"=",
"firstLine",
".",
"getOffset",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"document",
".",
"get",
"(",
"lineOffset",
",",
"offset",
"-",
"lineOffset",
")",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
";",
"else",
"return",
"false",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isSmartMode",
"(",
")",
"{",
"ITextEditor",
"editor",
"=",
"getTextEditor",
"(",
")",
";",
"if",
"(",
"editor",
"instanceof",
"ITextEditorExtension3",
")",
"return",
"(",
"(",
"ITextEditorExtension3",
")",
"editor",
")",
".",
"getInsertMode",
"(",
")",
"==",
"ITextEditorExtension3",
".",
"SMART_INSERT",
";",
"return",
"false",
";",
"}",
"private",
"IDocument",
"getDocument",
"(",
")",
"{",
"ITextEditor",
"editor",
"=",
"getTextEditor",
"(",
")",
";",
"if",
"(",
"editor",
"!=",
"null",
")",
"{",
"IDocumentProvider",
"provider",
"=",
"editor",
".",
"getDocumentProvider",
"(",
")",
";",
"IEditorInput",
"input",
"=",
"editor",
".",
"getEditorInput",
"(",
")",
";",
"if",
"(",
"provider",
"!=",
"null",
"&&",
"input",
"!=",
"null",
")",
"return",
"provider",
".",
"getDocument",
"(",
"input",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"IJavaProject",
"getJavaProject",
"(",
")",
"{",
"ITextEditor",
"editor",
"=",
"getTextEditor",
"(",
")",
";",
"if",
"(",
"editor",
"==",
"null",
")",
"return",
"null",
";",
"ICompilationUnit",
"cu",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getWorkingCopyManager",
"(",
")",
".",
"getWorkingCopy",
"(",
"editor",
".",
"getEditorInput",
"(",
")",
")",
";",
"if",
"(",
"cu",
"==",
"null",
")",
"return",
"null",
";",
"return",
"cu",
".",
"getJavaProject",
"(",
")",
";",
"}",
"private",
"ITextSelection",
"getSelection",
"(",
")",
"{",
"ISelectionProvider",
"provider",
"=",
"getSelectionProvider",
"(",
")",
";",
"if",
"(",
"provider",
"!=",
"null",
")",
"{",
"ISelection",
"selection",
"=",
"provider",
".",
"getSelection",
"(",
")",
";",
"if",
"(",
"selection",
"instanceof",
"ITextSelection",
")",
"return",
"(",
"ITextSelection",
")",
"selection",
";",
"}",
"return",
"TextSelection",
".",
"emptySelection",
"(",
")",
";",
"}",
"private",
"ISelectionProvider",
"getSelectionProvider",
"(",
")",
"{",
"ITextEditor",
"editor",
"=",
"getTextEditor",
"(",
")",
";",
"if",
"(",
"editor",
"!=",
"null",
")",
"{",
"return",
"editor",
".",
"getSelectionProvider",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"void",
"selectAndReveal",
"(",
"int",
"newOffset",
",",
"int",
"newLength",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"newOffset",
">=",
"0",
")",
";",
"Assert",
".",
"isTrue",
"(",
"newLength",
">=",
"0",
")",
";",
"ITextEditor",
"editor",
"=",
"getTextEditor",
"(",
")",
";",
"if",
"(",
"editor",
"instanceof",
"JavaEditor",
")",
"{",
"ISourceViewer",
"viewer",
"=",
"(",
"(",
"JavaEditor",
")",
"editor",
")",
".",
"getViewer",
"(",
")",
";",
"if",
"(",
"viewer",
"!=",
"null",
")",
"{",
"viewer",
".",
"setSelectedRange",
"(",
"newOffset",
",",
"newLength",
")",
";",
"}",
"}",
"else",
"{",
"getTextEditor",
"(",
")",
".",
"selectAndReveal",
"(",
"newOffset",
",",
"newLength",
")",
";",
"}",
"}",
"private",
"static",
"final",
"String",
"BUNDLE_FOR_CONSTRUCTED_KEYS",
"=",
"\"\"",
";",
"private",
"static",
"ResourceBundle",
"fgBundleForConstructedKeys",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"BUNDLE_FOR_CONSTRUCTED_KEYS",
")",
";",
"}",
"</s>"
] |
6,309 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"extract",
".",
"ExtractGroovyLocalRefactoring",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"ui",
".",
"extract",
".",
"ExtractLocalWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"ActionUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"UserInterfaceStarter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"ExtractTempAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"refactoring",
".",
"RefactoringSaveHelper",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"public",
"class",
"GroovyExtractLocalAction",
"extends",
"ExtractTempAction",
"{",
"private",
"final",
"GroovyEditor",
"fEditor",
";",
"public",
"GroovyExtractLocalAction",
"(",
"GroovyEditor",
"editor",
")",
"{",
"super",
"(",
"editor",
")",
";",
"this",
".",
"fEditor",
"=",
"editor",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"ITextSelection",
"selection",
")",
"{",
"if",
"(",
"!",
"ActionUtil",
".",
"isEditable",
"(",
"fEditor",
")",
")",
"{",
"return",
";",
"}",
"ExtractGroovyLocalRefactoring",
"refactoring",
"=",
"new",
"ExtractGroovyLocalRefactoring",
"(",
"fEditor",
".",
"getGroovyCompilationUnit",
"(",
")",
",",
"selection",
".",
"getOffset",
"(",
")",
",",
"selection",
".",
"getLength",
"(",
")",
")",
";",
"ExtractLocalWizard",
"wizard",
"=",
"new",
"ExtractLocalWizard",
"(",
"refactoring",
")",
";",
"UserInterfaceStarter",
"starter",
"=",
"new",
"UserInterfaceStarter",
"(",
")",
";",
"starter",
".",
"initialize",
"(",
"wizard",
")",
";",
"Shell",
"shell",
"=",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
";",
"try",
"{",
"starter",
".",
"activate",
"(",
"refactoring",
",",
"shell",
",",
"RefactoringSaveHelper",
".",
"SAVE_REFACTORING",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"Exception",
"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,310 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"fragments",
".",
"IASTFragment",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"Region",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"selection",
".",
"FindSurroundingNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"selectionactions",
".",
"SelectionHistory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"SelectionDispatchAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextSelection",
";",
"public",
"class",
"ExpandSelectionAction",
"extends",
"SelectionDispatchAction",
"{",
"private",
"GroovyEditor",
"editor",
";",
"private",
"SelectionHistory",
"history",
";",
"public",
"ExpandSelectionAction",
"(",
"GroovyEditor",
"editor",
",",
"SelectionHistory",
"history",
")",
"{",
"super",
"(",
"editor",
".",
"getEditorSite",
"(",
")",
")",
";",
"this",
".",
"editor",
"=",
"editor",
";",
"this",
".",
"history",
"=",
"history",
";",
"setText",
"(",
"\"\"",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"ITextSelection",
"currentSelection",
")",
"{",
"if",
"(",
"currentSelection",
"!=",
"null",
"&&",
"editor",
"!=",
"null",
")",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"editor",
".",
"getGroovyCompilationUnit",
"(",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"ModuleNode",
"node",
"=",
"unit",
".",
"getModuleNode",
"(",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"FindSurroundingNode",
"finder",
"=",
"new",
"FindSurroundingNode",
"(",
"new",
"Region",
"(",
"currentSelection",
".",
"getOffset",
"(",
")",
",",
"currentSelection",
".",
"getLength",
"(",
")",
")",
")",
";",
"IASTFragment",
"result",
"=",
"finder",
".",
"doVisitSurroundingNode",
"(",
"node",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"TextSelection",
"newSelection",
"=",
"new",
"TextSelection",
"(",
"result",
".",
"getStart",
"(",
")",
",",
"result",
".",
"getLength",
"(",
")",
")",
";",
"if",
"(",
"!",
"newSelection",
".",
"equals",
"(",
"currentSelection",
")",
")",
"{",
"history",
".",
"remember",
"(",
"new",
"SourceRange",
"(",
"currentSelection",
".",
"getOffset",
"(",
")",
",",
"currentSelection",
".",
"getLength",
"(",
")",
")",
")",
";",
"try",
"{",
"history",
".",
"ignoreSelectionChanges",
"(",
")",
";",
"editor",
".",
"selectAndReveal",
"(",
"result",
".",
"getStart",
"(",
")",
",",
"result",
".",
"getLength",
"(",
")",
")",
";",
"}",
"finally",
"{",
"history",
".",
"listenToSelectionChanges",
"(",
")",
";",
"}",
"}",
"editor",
".",
"getSelectionProvider",
"(",
")",
".",
"setSelection",
"(",
"newSelection",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"</s>"
] |
6,311 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"extract",
".",
"ConvertGroovyLocalToFieldRefactoring",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"ActionUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"PromoteTempWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"RefactoringMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"actions",
".",
"RefactoringStarter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"ConvertLocalToFieldAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"refactoring",
".",
"RefactoringSaveHelper",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"public",
"class",
"GroovyConvertLocalToFieldAction",
"extends",
"ConvertLocalToFieldAction",
"{",
"private",
"final",
"GroovyEditor",
"fEditor",
";",
"public",
"GroovyConvertLocalToFieldAction",
"(",
"GroovyEditor",
"editor",
")",
"{",
"super",
"(",
"editor",
")",
";",
"this",
".",
"fEditor",
"=",
"editor",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"ITextSelection",
"selection",
")",
"{",
"if",
"(",
"!",
"ActionUtil",
".",
"isEditable",
"(",
"fEditor",
")",
")",
"return",
";",
"ConvertGroovyLocalToFieldRefactoring",
"refactoring",
"=",
"new",
"ConvertGroovyLocalToFieldRefactoring",
"(",
"fEditor",
".",
"getGroovyCompilationUnit",
"(",
")",
",",
"selection",
".",
"getOffset",
"(",
")",
",",
"selection",
".",
"getLength",
"(",
")",
")",
";",
"new",
"RefactoringStarter",
"(",
")",
".",
"activate",
"(",
"new",
"PromoteTempWizard",
"(",
"refactoring",
")",
",",
"getShell",
"(",
")",
",",
"RefactoringMessages",
".",
"ConvertLocalToField_title",
",",
"RefactoringSaveHelper",
".",
"SAVE_NOTHING",
")",
";",
"}",
"}",
"</s>"
] |
6,312 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"utils",
".",
"GroovyResourceUtil",
";",
"public",
"class",
"RenameToGroovyAction",
"extends",
"RenameToGroovyOrJavaAction",
"{",
"public",
"static",
"String",
"COMMAND_ID",
"=",
"\"\"",
";",
"public",
"RenameToGroovyAction",
"(",
")",
"{",
"super",
"(",
"GroovyResourceUtil",
".",
"GROOVY",
")",
";",
"}",
"}",
"</s>"
] |
6,313 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"utils",
".",
"GroovyResourceUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdaptable",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchWindow",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchWindowActionDelegate",
";",
"public",
"abstract",
"class",
"RenameToGroovyOrJavaAction",
"implements",
"IWorkbenchWindowActionDelegate",
"{",
"private",
"ISelection",
"selection",
";",
"private",
"String",
"javaOrGroovy",
";",
"public",
"RenameToGroovyOrJavaAction",
"(",
"String",
"javaOrGroovy",
")",
"{",
"this",
".",
"javaOrGroovy",
"=",
"javaOrGroovy",
";",
"}",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"GroovyResourceUtil",
".",
"renameFile",
"(",
"javaOrGroovy",
",",
"getResources",
"(",
"(",
"IStructuredSelection",
")",
"selection",
")",
")",
";",
"}",
"}",
"protected",
"List",
"<",
"IResource",
">",
"getResources",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"List",
"<",
"IResource",
">",
"resources",
"=",
"new",
"ArrayList",
"<",
"IResource",
">",
"(",
")",
";",
"if",
"(",
"selection",
"!=",
"null",
")",
"{",
"for",
"(",
"Iterator",
"<",
"?",
">",
"iter",
"=",
"selection",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Object",
"object",
"=",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"IAdaptable",
")",
"{",
"IResource",
"file",
"=",
"(",
"IResource",
")",
"(",
"(",
"IAdaptable",
")",
"object",
")",
".",
"getAdapter",
"(",
"IResource",
".",
"class",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"if",
"(",
"file",
".",
"getType",
"(",
")",
"!=",
"IResource",
".",
"FILE",
")",
"{",
"continue",
";",
"}",
"resources",
".",
"add",
"(",
"file",
")",
";",
"}",
"}",
"}",
"}",
"return",
"resources",
";",
"}",
"public",
"void",
"selectionChanged",
"(",
"IAction",
"action",
",",
"ISelection",
"selection",
")",
"{",
"this",
".",
"selection",
"=",
"selection",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"selection",
"=",
"null",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbenchWindow",
"window",
")",
"{",
"}",
"}",
"</s>"
] |
6,314 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"search",
".",
"GroovyOccurrencesFinder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"search",
".",
"FindOccurrencesEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"IEditorStatusLine",
";",
"public",
"class",
"FindOccurrencesAction",
"implements",
"IEditorActionDelegate",
"{",
"private",
"GroovyEditor",
"editor",
";",
"private",
"TextSelection",
"sel",
";",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"if",
"(",
"editor",
"==",
"null",
"||",
"sel",
"==",
"null",
")",
"{",
"return",
";",
"}",
"ISelection",
"editorSel",
"=",
"editor",
".",
"getSelectionProvider",
"(",
")",
".",
"getSelection",
"(",
")",
";",
"if",
"(",
"editorSel",
"instanceof",
"TextSelection",
")",
"{",
"sel",
"=",
"(",
"TextSelection",
")",
"editorSel",
";",
"}",
"FindOccurrencesEngine",
"engine",
"=",
"FindOccurrencesEngine",
".",
"create",
"(",
"new",
"GroovyOccurrencesFinder",
"(",
")",
")",
";",
"try",
"{",
"String",
"result",
"=",
"engine",
".",
"run",
"(",
"editor",
".",
"getGroovyCompilationUnit",
"(",
")",
",",
"sel",
".",
"getOffset",
"(",
")",
",",
"sel",
".",
"getLength",
"(",
")",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"showMessage",
"(",
"getShell",
"(",
")",
",",
"result",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"private",
"Shell",
"getShell",
"(",
")",
"{",
"if",
"(",
"editor",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"editor",
".",
"getSite",
"(",
")",
".",
"getShell",
"(",
")",
";",
"}",
"public",
"void",
"selectionChanged",
"(",
"IAction",
"action",
",",
"ISelection",
"selection",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"TextSelection",
")",
"{",
"sel",
"=",
"(",
"TextSelection",
")",
"selection",
";",
"}",
"else",
"{",
"sel",
"=",
"null",
";",
"}",
"}",
"public",
"void",
"setActiveEditor",
"(",
"IAction",
"action",
",",
"IEditorPart",
"targetEditor",
")",
"{",
"if",
"(",
"targetEditor",
"instanceof",
"GroovyEditor",
")",
"{",
"editor",
"=",
"(",
"GroovyEditor",
")",
"targetEditor",
";",
"}",
"else",
"{",
"editor",
"=",
"null",
";",
"}",
"}",
"private",
"void",
"showMessage",
"(",
"Shell",
"shell",
",",
"String",
"msg",
")",
"{",
"IEditorStatusLine",
"statusLine",
"=",
"(",
"IEditorStatusLine",
")",
"editor",
".",
"getAdapter",
"(",
"IEditorStatusLine",
".",
"class",
")",
";",
"if",
"(",
"statusLine",
"!=",
"null",
")",
"{",
"statusLine",
".",
"setMessage",
"(",
"true",
",",
"msg",
",",
"null",
")",
";",
"}",
"if",
"(",
"shell",
"!=",
"null",
")",
"{",
"shell",
".",
"getDisplay",
"(",
")",
".",
"beep",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,315 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"extract",
".",
"ExtractGroovyConstantRefactoring",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"ActionUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"ExtractConstantWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"RefactoringMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"actions",
".",
"RefactoringStarter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"ExtractConstantAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"refactoring",
".",
"RefactoringSaveHelper",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"public",
"class",
"GroovyExtractConstantAction",
"extends",
"ExtractConstantAction",
"{",
"private",
"final",
"GroovyEditor",
"fEditor",
";",
"public",
"GroovyExtractConstantAction",
"(",
"GroovyEditor",
"editor",
")",
"{",
"super",
"(",
"editor",
")",
";",
"this",
".",
"fEditor",
"=",
"editor",
";",
"}",
"public",
"void",
"run",
"(",
"ITextSelection",
"selection",
")",
"{",
"if",
"(",
"!",
"ActionUtil",
".",
"isEditable",
"(",
"fEditor",
")",
")",
"return",
";",
"ExtractGroovyConstantRefactoring",
"refactoring",
"=",
"new",
"ExtractGroovyConstantRefactoring",
"(",
"fEditor",
".",
"getGroovyCompilationUnit",
"(",
")",
",",
"selection",
".",
"getOffset",
"(",
")",
",",
"selection",
".",
"getLength",
"(",
")",
")",
";",
"new",
"RefactoringStarter",
"(",
")",
".",
"activate",
"(",
"new",
"ExtractConstantWizard",
"(",
"refactoring",
")",
",",
"getShell",
"(",
")",
",",
"RefactoringMessages",
".",
"ExtractConstantAction_extract_constant",
",",
"RefactoringSaveHelper",
".",
"SAVE_NOTHING",
")",
";",
"}",
"}",
"</s>"
] |
6,316 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"extract",
".",
"ExtractGroovyMethodRefactoring",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"ui",
".",
"extract",
".",
"ExtractMethodRefactoringWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"ActionUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"UserInterfaceStarter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"ExtractMethodAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"refactoring",
".",
"RefactoringSaveHelper",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"public",
"class",
"GroovyExtractMethodAction",
"extends",
"ExtractMethodAction",
"{",
"private",
"final",
"GroovyEditor",
"fEditor",
";",
"public",
"GroovyExtractMethodAction",
"(",
"GroovyEditor",
"editor",
")",
"{",
"super",
"(",
"editor",
")",
";",
"this",
".",
"fEditor",
"=",
"editor",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"ITextSelection",
"selection",
")",
"{",
"if",
"(",
"!",
"ActionUtil",
".",
"isEditable",
"(",
"fEditor",
")",
")",
"{",
"return",
";",
"}",
"RefactoringStatus",
"status",
"=",
"new",
"RefactoringStatus",
"(",
")",
";",
"ExtractGroovyMethodRefactoring",
"refactoring",
"=",
"new",
"ExtractGroovyMethodRefactoring",
"(",
"fEditor",
".",
"getGroovyCompilationUnit",
"(",
")",
",",
"selection",
".",
"getOffset",
"(",
")",
",",
"selection",
".",
"getLength",
"(",
")",
",",
"status",
")",
";",
"ExtractMethodRefactoringWizard",
"wizard",
"=",
"new",
"ExtractMethodRefactoringWizard",
"(",
"refactoring",
")",
";",
"UserInterfaceStarter",
"starter",
"=",
"new",
"UserInterfaceStarter",
"(",
")",
";",
"starter",
".",
"initialize",
"(",
"wizard",
")",
";",
"Shell",
"shell",
"=",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
";",
"try",
"{",
"starter",
".",
"activate",
"(",
"refactoring",
",",
"shell",
",",
"RefactoringSaveHelper",
".",
"SAVE_REFACTORING",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"Exception",
"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,317 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
";",
"public",
"interface",
"IGroovyEditorActionDefinitionIds",
"{",
"public",
"static",
"final",
"String",
"GROOVY_RENAME_ACTION",
"=",
"\"\"",
";",
"}",
"</s>"
] |
6,318 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_DEFAULT_COLOR",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
";",
"import",
"static",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"JavaColorManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferenceConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"IPropertyChangeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"PropertyChangeEvent",
";",
"public",
"class",
"GroovyColorManager",
"extends",
"JavaColorManager",
"{",
"private",
"ColorPreferencesChangeListener",
"changeListener",
";",
"private",
"class",
"ColorPreferencesChangeListener",
"implements",
"IPropertyChangeListener",
"{",
"public",
"void",
"propertyChange",
"(",
"PropertyChangeEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getProperty",
"(",
")",
".",
"startsWith",
"(",
"GROOVY_EDITOR_HIGHLIGHT",
")",
"&&",
"!",
"(",
"event",
".",
"getProperty",
"(",
")",
".",
"endsWith",
"(",
"GROOVY_EDITOR_BOLD_SUFFIX",
")",
")",
")",
"{",
"if",
"(",
"event",
".",
"getNewValue",
"(",
")",
"!=",
"event",
".",
"getOldValue",
"(",
")",
")",
"{",
"unbindColor",
"(",
"event",
".",
"getProperty",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"public",
"GroovyColorManager",
"(",
")",
"{",
"super",
"(",
")",
";",
"changeListener",
"=",
"new",
"ColorPreferencesChangeListener",
"(",
")",
";",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
".",
"addPropertyChangeListener",
"(",
"changeListener",
")",
";",
"initialize",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"dispose",
"(",
")",
"{",
"super",
".",
"dispose",
"(",
")",
";",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
".",
"removePropertyChangeListener",
"(",
"changeListener",
")",
";",
"}",
"public",
"void",
"initialize",
"(",
")",
"{",
"bindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
")",
")",
";",
"bindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
")",
")",
";",
"bindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
")",
")",
";",
"bindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
")",
")",
";",
"bindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
")",
")",
";",
"bindColor",
"(",
"GROOVY_EDITOR_DEFAULT_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_DEFAULT_COLOR",
")",
")",
";",
"bindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
")",
")",
";",
"bindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
")",
")",
";",
"bindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
")",
")",
";",
"bindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
",",
"PreferenceConverter",
".",
"getColor",
"(",
"getGroovyPreferenceStore",
"(",
")",
",",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
")",
")",
";",
"}",
"public",
"void",
"uninitialize",
"(",
")",
"{",
"unbindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
")",
";",
"unbindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
")",
";",
"unbindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
")",
";",
"unbindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
")",
";",
"unbindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
")",
";",
"unbindColor",
"(",
"GROOVY_EDITOR_DEFAULT_COLOR",
")",
";",
"unbindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
")",
";",
"unbindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
")",
";",
"unbindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
")",
";",
"unbindColor",
"(",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
")",
";",
"}",
"private",
"IPreferenceStore",
"getGroovyPreferenceStore",
"(",
")",
"{",
"return",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,319 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Stack",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"ExpandSelectionAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"GroovyConvertLocalToFieldAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"GroovyExtractConstantAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"GroovyExtractLocalAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"GroovyExtractMethodAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"GroovyTabAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"IGroovyEditorActionDefinitionIds",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"GroovySemanticReconciler",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"GroovyOutlinePage",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OutlineExtenderRegistry",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"FormatAllGroovyAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"FormatGroovyAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"FormatKind",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"GroovyRenameAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"OrganizeGroovyImportsAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"search",
".",
"GroovyOccurrencesFinder",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"decorators",
".",
"GroovyImageDecorator",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IConfigurationElement",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IImportDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"BreakpointMarkerUpdater",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"IJavaHelpContextIds",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"AllCleanUpsAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"CleanUpAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"CompilationUnitEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaOutlinePage",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaSourceViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"selectionactions",
".",
"SelectionHistory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"selectionactions",
".",
"StructureSelectionAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"search",
".",
"IOccurrencesFinder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"search",
".",
"IOccurrencesFinder",
".",
"OccurrenceLocation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"JavaHeuristicScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"JavaPartitionScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"JavaWordFinder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"Symbols",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"IJavaReconcilingListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"AddGetterSetterAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"GenerateActionGroup",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"IJavaEditorActionDefinitionIds",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"RefactorActionGroup",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"SelectionDispatchAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IJavaPartitions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"JavaSourceViewerConfiguration",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadPositionCategoryException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"DocumentEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocumentExtension",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocumentExtension4",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocumentListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IPositionUpdater",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ISelectionValidator",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextViewerExtension",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITypedRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Region",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextUtilities",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"ILinkedModeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedModeModel",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedModeUI",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedModeUI",
".",
"ExitFlags",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedModeUI",
".",
"IExitPolicy",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedPosition",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedPositionGroup",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"Annotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"IAnnotationModel",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"IAnnotationModelExtension",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"ISourceViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"PropertyChangeEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelectionChangedListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"VerifyKeyListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"VerifyEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"part",
".",
"FileEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"AbstractMarkerAnnotationModel",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"ChainedPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"IDocumentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"link",
".",
"EditorLinkedModeUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"views",
".",
"contentoutline",
".",
"IContentOutlinePage",
";",
"public",
"class",
"GroovyEditor",
"extends",
"CompilationUnitEditor",
"{",
"private",
"static",
"final",
"String",
"INDENT_ON_TAB",
"=",
"\"IndentOnTab\"",
";",
"public",
"static",
"final",
"String",
"EDITOR_ID",
"=",
"\"\"",
";",
"private",
"static",
"class",
"GroovyExclusivePositionUpdater",
"implements",
"IPositionUpdater",
"{",
"private",
"final",
"String",
"fCategory",
";",
"public",
"GroovyExclusivePositionUpdater",
"(",
"String",
"category",
")",
"{",
"fCategory",
"=",
"category",
";",
"}",
"public",
"void",
"update",
"(",
"DocumentEvent",
"event",
")",
"{",
"int",
"eventOffset",
"=",
"event",
".",
"getOffset",
"(",
")",
";",
"int",
"eventOldLength",
"=",
"event",
".",
"getLength",
"(",
")",
";",
"int",
"eventNewLength",
"=",
"event",
".",
"getText",
"(",
")",
"==",
"null",
"?",
"0",
":",
"event",
".",
"getText",
"(",
")",
".",
"length",
"(",
")",
";",
"int",
"deltaLength",
"=",
"eventNewLength",
"-",
"eventOldLength",
";",
"try",
"{",
"Position",
"[",
"]",
"positions",
"=",
"event",
".",
"getDocument",
"(",
")",
".",
"getPositions",
"(",
"fCategory",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"positions",
".",
"length",
";",
"i",
"++",
")",
"{",
"Position",
"position",
"=",
"positions",
"[",
"i",
"]",
";",
"if",
"(",
"position",
".",
"isDeleted",
"(",
")",
")",
"continue",
";",
"int",
"offset",
"=",
"position",
".",
"getOffset",
"(",
")",
";",
"int",
"length",
"=",
"position",
".",
"getLength",
"(",
")",
";",
"int",
"end",
"=",
"offset",
"+",
"length",
";",
"if",
"(",
"offset",
">=",
"eventOffset",
"+",
"eventOldLength",
")",
"position",
".",
"setOffset",
"(",
"offset",
"+",
"deltaLength",
")",
";",
"else",
"if",
"(",
"end",
"<=",
"eventOffset",
")",
"{",
"}",
"else",
"if",
"(",
"offset",
"<=",
"eventOffset",
"&&",
"end",
">=",
"eventOffset",
"+",
"eventOldLength",
")",
"{",
"position",
".",
"setLength",
"(",
"length",
"+",
"deltaLength",
")",
";",
"}",
"else",
"if",
"(",
"offset",
"<",
"eventOffset",
")",
"{",
"int",
"newEnd",
"=",
"eventOffset",
";",
"position",
".",
"setLength",
"(",
"newEnd",
"-",
"offset",
")",
";",
"}",
"else",
"if",
"(",
"end",
">",
"eventOffset",
"+",
"eventOldLength",
")",
"{",
"int",
"newOffset",
"=",
"eventOffset",
"+",
"eventNewLength",
";",
"position",
".",
"setOffset",
"(",
"newOffset",
")",
";",
"position",
".",
"setLength",
"(",
"end",
"-",
"newOffset",
")",
";",
"}",
"else",
"{",
"position",
".",
"delete",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"}",
"}",
"}",
"private",
"class",
"GroovyExitPolicy",
"implements",
"IExitPolicy",
"{",
"final",
"char",
"fExitCharacter",
";",
"final",
"char",
"fEscapeCharacter",
";",
"final",
"Stack",
"<",
"GroovyBracketLevel",
">",
"fStack",
";",
"final",
"int",
"fSize",
";",
"public",
"GroovyExitPolicy",
"(",
"char",
"exitCharacter",
",",
"char",
"escapeCharacter",
",",
"Stack",
"<",
"GroovyBracketLevel",
">",
"stack",
")",
"{",
"fExitCharacter",
"=",
"exitCharacter",
";",
"fEscapeCharacter",
"=",
"escapeCharacter",
";",
"fStack",
"=",
"stack",
";",
"fSize",
"=",
"fStack",
".",
"size",
"(",
")",
";",
"}",
"public",
"ExitFlags",
"doExit",
"(",
"LinkedModeModel",
"model",
",",
"VerifyEvent",
"event",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"fSize",
"==",
"fStack",
".",
"size",
"(",
")",
"&&",
"!",
"isMasked",
"(",
"offset",
")",
")",
"{",
"if",
"(",
"event",
".",
"character",
"==",
"fExitCharacter",
")",
"{",
"GroovyBracketLevel",
"level",
"=",
"fStack",
".",
"peek",
"(",
")",
";",
"if",
"(",
"level",
".",
"fFirstPosition",
".",
"offset",
">",
"offset",
"||",
"level",
".",
"fSecondPosition",
".",
"offset",
"<",
"offset",
")",
"return",
"null",
";",
"if",
"(",
"level",
".",
"fSecondPosition",
".",
"offset",
"==",
"offset",
"&&",
"length",
"==",
"0",
")",
"return",
"new",
"ExitFlags",
"(",
"ILinkedModeListener",
".",
"UPDATE_CARET",
",",
"false",
")",
";",
"}",
"if",
"(",
"event",
".",
"character",
"==",
"SWT",
".",
"CR",
"&&",
"offset",
">",
"0",
")",
"{",
"IDocument",
"document",
"=",
"getSourceViewer",
"(",
")",
".",
"getDocument",
"(",
")",
";",
"try",
"{",
"if",
"(",
"document",
".",
"getChar",
"(",
"offset",
"-",
"1",
")",
"==",
"'{'",
")",
"return",
"new",
"ExitFlags",
"(",
"ILinkedModeListener",
".",
"EXIT_ALL",
",",
"true",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"boolean",
"isMasked",
"(",
"int",
"offset",
")",
"{",
"IDocument",
"document",
"=",
"getSourceViewer",
"(",
")",
".",
"getDocument",
"(",
")",
";",
"try",
"{",
"return",
"fEscapeCharacter",
"==",
"document",
".",
"getChar",
"(",
"offset",
"-",
"1",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"}",
"return",
"false",
";",
"}",
"}",
"private",
"static",
"class",
"GroovyBracketLevel",
"{",
"LinkedModeUI",
"fUI",
";",
"Position",
"fFirstPosition",
";",
"Position",
"fSecondPosition",
";",
"}",
"private",
"class",
"GroovyBracketInserter",
"implements",
"VerifyKeyListener",
",",
"ILinkedModeListener",
"{",
"private",
"boolean",
"fCloseBrackets",
"=",
"true",
";",
"private",
"boolean",
"fCloseBraces",
"=",
"true",
";",
"private",
"boolean",
"fCloseStrings",
"=",
"true",
";",
"private",
"boolean",
"fCloseAngularBrackets",
"=",
"true",
";",
"private",
"final",
"String",
"CATEGORY",
"=",
"toString",
"(",
")",
";",
"private",
"final",
"IPositionUpdater",
"fUpdater",
"=",
"new",
"GroovyExclusivePositionUpdater",
"(",
"CATEGORY",
")",
";",
"private",
"final",
"Stack",
"<",
"GroovyBracketLevel",
">",
"fBracketLevelStack",
"=",
"new",
"Stack",
"<",
"GroovyBracketLevel",
">",
"(",
")",
";",
"public",
"void",
"setCloseBracketsEnabled",
"(",
"boolean",
"enabled",
")",
"{",
"fCloseBrackets",
"=",
"enabled",
";",
"}",
"public",
"void",
"setCloseStringsEnabled",
"(",
"boolean",
"enabled",
")",
"{",
"fCloseStrings",
"=",
"enabled",
";",
"}",
"public",
"void",
"setCloseBracesEnabled",
"(",
"boolean",
"enabled",
")",
"{",
"fCloseBraces",
"=",
"enabled",
";",
"}",
"public",
"void",
"setCloseAngularBracketsEnabled",
"(",
"boolean",
"enabled",
")",
"{",
"fCloseAngularBrackets",
"=",
"enabled",
";",
"}",
"private",
"boolean",
"isAngularIntroducer",
"(",
"String",
"identifier",
")",
"{",
"return",
"identifier",
".",
"length",
"(",
")",
">",
"0",
"&&",
"(",
"Character",
".",
"isUpperCase",
"(",
"identifier",
".",
"charAt",
"(",
"0",
")",
")",
"||",
"identifier",
".",
"startsWith",
"(",
"\"final\"",
")",
"||",
"identifier",
".",
"startsWith",
"(",
"\"public\"",
")",
"||",
"identifier",
".",
"startsWith",
"(",
"\"public\"",
")",
"||",
"identifier",
".",
"startsWith",
"(",
"\"protected\"",
")",
"||",
"identifier",
".",
"startsWith",
"(",
"\"private\"",
")",
")",
";",
"}",
"private",
"boolean",
"isMultilineSelection",
"(",
")",
"{",
"ISelection",
"selection",
"=",
"getSelectionProvider",
"(",
")",
".",
"getSelection",
"(",
")",
";",
"if",
"(",
"selection",
"instanceof",
"ITextSelection",
")",
"{",
"ITextSelection",
"ts",
"=",
"(",
"ITextSelection",
")",
"selection",
";",
"return",
"ts",
".",
"getStartLine",
"(",
")",
"!=",
"ts",
".",
"getEndLine",
"(",
")",
";",
"}",
"return",
"false",
";",
"}",
"public",
"void",
"verifyKey",
"(",
"VerifyEvent",
"event",
")",
"{",
"if",
"(",
"!",
"event",
".",
"doit",
"||",
"getInsertMode",
"(",
")",
"!=",
"SMART_INSERT",
"||",
"isBlockSelectionModeEnabled",
"(",
")",
"&&",
"isMultilineSelection",
"(",
")",
")",
"return",
";",
"switch",
"(",
"event",
".",
"character",
")",
"{",
"case",
"'('",
":",
"case",
"'<'",
":",
"case",
"'['",
":",
"case",
"'\\''",
":",
"case",
"'\\\"'",
":",
"case",
"'{'",
":",
"break",
";",
"default",
":",
"return",
";",
"}",
"final",
"ISourceViewer",
"sourceViewer",
"=",
"getSourceViewer",
"(",
")",
";",
"IDocument",
"document",
"=",
"sourceViewer",
".",
"getDocument",
"(",
")",
";",
"final",
"Point",
"selection",
"=",
"sourceViewer",
".",
"getSelectedRange",
"(",
")",
";",
"int",
"offset",
"=",
"selection",
".",
"x",
";",
"final",
"int",
"length",
"=",
"selection",
".",
"y",
";",
"try",
"{",
"IRegion",
"startLine",
"=",
"document",
".",
"getLineInformationOfOffset",
"(",
"offset",
")",
";",
"IRegion",
"endLine",
"=",
"document",
".",
"getLineInformationOfOffset",
"(",
"offset",
"+",
"length",
")",
";",
"JavaHeuristicScanner",
"scanner",
"=",
"new",
"JavaHeuristicScanner",
"(",
"document",
")",
";",
"int",
"nextToken",
"=",
"scanner",
".",
"nextToken",
"(",
"offset",
"+",
"length",
",",
"endLine",
".",
"getOffset",
"(",
")",
"+",
"endLine",
".",
"getLength",
"(",
")",
")",
";",
"String",
"next",
"=",
"nextToken",
"==",
"Symbols",
".",
"TokenEOF",
"?",
"null",
":",
"document",
".",
"get",
"(",
"offset",
",",
"scanner",
".",
"getPosition",
"(",
")",
"-",
"offset",
")",
".",
"trim",
"(",
")",
";",
"int",
"prevToken",
"=",
"scanner",
".",
"previousToken",
"(",
"offset",
"-",
"1",
",",
"startLine",
".",
"getOffset",
"(",
")",
")",
";",
"int",
"prevTokenOffset",
"=",
"scanner",
".",
"getPosition",
"(",
")",
"+",
"1",
";",
"String",
"previous",
"=",
"prevToken",
"==",
"Symbols",
".",
"TokenEOF",
"?",
"null",
":",
"document",
".",
"get",
"(",
"prevTokenOffset",
",",
"offset",
"-",
"prevTokenOffset",
")",
".",
"trim",
"(",
")",
";",
"switch",
"(",
"event",
".",
"character",
")",
"{",
"case",
"'('",
":",
"if",
"(",
"!",
"fCloseBrackets",
"||",
"nextToken",
"==",
"Symbols",
".",
"TokenLPAREN",
"||",
"nextToken",
"==",
"Symbols",
".",
"TokenIDENT",
"||",
"next",
"!=",
"null",
"&&",
"next",
".",
"length",
"(",
")",
">",
"1",
")",
"return",
";",
"break",
";",
"case",
"'<'",
":",
"if",
"(",
"!",
"(",
"fCloseAngularBrackets",
"&&",
"fCloseBrackets",
")",
"||",
"nextToken",
"==",
"Symbols",
".",
"TokenLESSTHAN",
"||",
"prevToken",
"!=",
"Symbols",
".",
"TokenLBRACE",
"&&",
"prevToken",
"!=",
"Symbols",
".",
"TokenRBRACE",
"&&",
"prevToken",
"!=",
"Symbols",
".",
"TokenSEMICOLON",
"&&",
"prevToken",
"!=",
"Symbols",
".",
"TokenSYNCHRONIZED",
"&&",
"prevToken",
"!=",
"Symbols",
".",
"TokenSTATIC",
"&&",
"(",
"prevToken",
"!=",
"Symbols",
".",
"TokenIDENT",
"||",
"!",
"isAngularIntroducer",
"(",
"previous",
")",
")",
"&&",
"prevToken",
"!=",
"Symbols",
".",
"TokenEOF",
")",
"return",
";",
"break",
";",
"case",
"'['",
":",
"if",
"(",
"!",
"fCloseBrackets",
"||",
"nextToken",
"==",
"Symbols",
".",
"TokenIDENT",
"||",
"next",
"!=",
"null",
"&&",
"next",
".",
"length",
"(",
")",
">",
"1",
")",
"return",
";",
"break",
";",
"case",
"'\\''",
":",
"case",
"'\"'",
":",
"if",
"(",
"!",
"fCloseStrings",
"||",
"nextToken",
"==",
"Symbols",
".",
"TokenIDENT",
"||",
"next",
"!=",
"null",
"&&",
"next",
".",
"length",
"(",
")",
">",
"1",
")",
"return",
";",
"break",
";",
"case",
"'{'",
":",
"if",
"(",
"!",
"fCloseBraces",
"||",
"nextToken",
"==",
"Symbols",
".",
"TokenIDENT",
"||",
"next",
"!=",
"null",
"&&",
"next",
".",
"length",
"(",
")",
">",
"1",
")",
"return",
";",
"break",
";",
"default",
":",
"return",
";",
"}",
"ITypedRegion",
"partition",
"=",
"TextUtilities",
".",
"getPartition",
"(",
"document",
",",
"IJavaPartitions",
".",
"JAVA_PARTITIONING",
",",
"offset",
",",
"true",
")",
";",
"if",
"(",
"event",
".",
"character",
"!=",
"'{'",
"&&",
"!",
"IDocument",
".",
"DEFAULT_CONTENT_TYPE",
".",
"equals",
"(",
"partition",
".",
"getType",
"(",
")",
")",
"&&",
"!",
"shouldCloseTripleQuotes",
"(",
"document",
",",
"offset",
",",
"partition",
",",
"getPeerCharacter",
"(",
"event",
".",
"character",
")",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"event",
".",
"character",
"==",
"'{'",
"&&",
"!",
"shouldCloseCurly",
"(",
"document",
",",
"offset",
",",
"partition",
",",
"getPeerCharacter",
"(",
"event",
".",
"character",
")",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"validateEditorInputState",
"(",
")",
")",
"return",
";",
"final",
"char",
"character",
"=",
"event",
".",
"character",
";",
"final",
"char",
"closingCharacter",
"=",
"getPeerCharacter",
"(",
"character",
")",
";",
"final",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"character",
")",
";",
"buffer",
".",
"append",
"(",
"closingCharacter",
")",
";",
"int",
"insertedLength",
"=",
"1",
";",
"if",
"(",
"fCloseStrings",
"&&",
"offset",
">",
"1",
")",
"{",
"String",
"start",
"=",
"document",
".",
"get",
"(",
"offset",
"-",
"2",
",",
"2",
")",
";",
"boolean",
"doit",
"=",
"false",
";",
"if",
"(",
"event",
".",
"character",
"==",
"closingCharacter",
")",
"{",
"doit",
"=",
"start",
".",
"equals",
"(",
"Character",
".",
"toString",
"(",
"closingCharacter",
")",
"+",
"closingCharacter",
")",
";",
"}",
"if",
"(",
"doit",
")",
"{",
"buffer",
".",
"append",
"(",
"closingCharacter",
")",
";",
"insertedLength",
"++",
";",
"insertedLength",
"++",
";",
"if",
"(",
"offset",
">",
"2",
"&&",
"document",
".",
"getChar",
"(",
"offset",
"-",
"3",
")",
"==",
"closingCharacter",
")",
"{",
"offset",
"--",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"closingCharacter",
")",
";",
"}",
"}",
"}",
"document",
".",
"replace",
"(",
"offset",
",",
"length",
",",
"buffer",
".",
"toString",
"(",
")",
")",
";",
"GroovyBracketLevel",
"level",
"=",
"new",
"GroovyBracketLevel",
"(",
")",
";",
"fBracketLevelStack",
".",
"push",
"(",
"level",
")",
";",
"LinkedPositionGroup",
"group",
"=",
"new",
"LinkedPositionGroup",
"(",
")",
";",
"group",
".",
"addPosition",
"(",
"new",
"LinkedPosition",
"(",
"document",
",",
"offset",
"+",
"insertedLength",
",",
"0",
",",
"LinkedPositionGroup",
".",
"NO_STOP",
")",
")",
";",
"LinkedModeModel",
"model",
"=",
"new",
"LinkedModeModel",
"(",
")",
";",
"model",
".",
"addLinkingListener",
"(",
"this",
")",
";",
"model",
".",
"addGroup",
"(",
"group",
")",
";",
"model",
".",
"forceInstall",
"(",
")",
";",
"if",
"(",
"fBracketLevelStack",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"document",
".",
"addPositionCategory",
"(",
"CATEGORY",
")",
";",
"document",
".",
"addPositionUpdater",
"(",
"fUpdater",
")",
";",
"}",
"level",
".",
"fFirstPosition",
"=",
"new",
"Position",
"(",
"offset",
",",
"1",
")",
";",
"level",
".",
"fSecondPosition",
"=",
"new",
"Position",
"(",
"offset",
"+",
"insertedLength",
",",
"1",
")",
";",
"document",
".",
"addPosition",
"(",
"CATEGORY",
",",
"level",
".",
"fFirstPosition",
")",
";",
"document",
".",
"addPosition",
"(",
"CATEGORY",
",",
"level",
".",
"fSecondPosition",
")",
";",
"level",
".",
"fUI",
"=",
"new",
"EditorLinkedModeUI",
"(",
"model",
",",
"sourceViewer",
")",
";",
"level",
".",
"fUI",
".",
"setSimpleMode",
"(",
"true",
")",
";",
"level",
".",
"fUI",
".",
"setExitPolicy",
"(",
"new",
"GroovyExitPolicy",
"(",
"closingCharacter",
",",
"getEscapeCharacter",
"(",
"closingCharacter",
")",
",",
"fBracketLevelStack",
")",
")",
";",
"level",
".",
"fUI",
".",
"setExitPosition",
"(",
"sourceViewer",
",",
"offset",
"+",
"1",
"+",
"insertedLength",
",",
"0",
",",
"Integer",
".",
"MAX_VALUE",
")",
";",
"level",
".",
"fUI",
".",
"setCyclingMode",
"(",
"LinkedModeUI",
".",
"CYCLE_NEVER",
")",
";",
"level",
".",
"fUI",
".",
"enter",
"(",
")",
";",
"IRegion",
"newSelection",
"=",
"level",
".",
"fUI",
".",
"getSelectedRegion",
"(",
")",
";",
"sourceViewer",
".",
"setSelectedRange",
"(",
"newSelection",
".",
"getOffset",
"(",
")",
"-",
"insertedLength",
"+",
"1",
",",
"newSelection",
".",
"getLength",
"(",
")",
")",
";",
"event",
".",
"doit",
"=",
"false",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"private",
"boolean",
"shouldCloseCurly",
"(",
"IDocument",
"document",
",",
"int",
"offset",
",",
"ITypedRegion",
"partition",
",",
"char",
"peer",
")",
"throws",
"BadLocationException",
"{",
"if",
"(",
"offset",
"<",
"2",
"||",
"!",
"(",
"JavaPartitionScanner",
".",
"JAVA_STRING",
".",
"equals",
"(",
"partition",
".",
"getType",
"(",
")",
")",
"||",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
".",
"equals",
"(",
"partition",
".",
"getType",
"(",
")",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"char",
"maybeOpen",
"=",
"document",
".",
"getChar",
"(",
"offset",
"-",
"1",
")",
";",
"if",
"(",
"maybeOpen",
"!=",
"'$'",
")",
"{",
"return",
"false",
";",
"}",
"char",
"maybeNext",
"=",
"document",
".",
"getChar",
"(",
"offset",
")",
";",
"return",
"Character",
".",
"isWhitespace",
"(",
"maybeNext",
")",
"||",
"maybeNext",
"==",
"'\\\"'",
"||",
"maybeNext",
"==",
"'\\''",
";",
"}",
"private",
"boolean",
"shouldCloseTripleQuotes",
"(",
"IDocument",
"document",
",",
"int",
"offset",
",",
"ITypedRegion",
"partition",
",",
"char",
"quote",
")",
"throws",
"BadLocationException",
"{",
"if",
"(",
"offset",
"<",
"3",
"||",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
".",
"equals",
"(",
"partition",
".",
"getType",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"String",
"maybequotes",
"=",
"document",
".",
"get",
"(",
"offset",
"-",
"3",
",",
"3",
")",
";",
"return",
"maybequotes",
".",
"equals",
"(",
"Character",
".",
"toString",
"(",
"quote",
")",
"+",
"quote",
"+",
"quote",
")",
";",
"}",
"public",
"void",
"left",
"(",
"LinkedModeModel",
"environment",
",",
"int",
"flags",
")",
"{",
"final",
"GroovyBracketLevel",
"level",
"=",
"fBracketLevelStack",
".",
"pop",
"(",
")",
";",
"if",
"(",
"flags",
"!=",
"ILinkedModeListener",
".",
"EXTERNAL_MODIFICATION",
")",
"return",
";",
"final",
"ISourceViewer",
"sourceViewer",
"=",
"getSourceViewer",
"(",
")",
";",
"final",
"IDocument",
"document",
"=",
"sourceViewer",
".",
"getDocument",
"(",
")",
";",
"if",
"(",
"document",
"instanceof",
"IDocumentExtension",
")",
"{",
"IDocumentExtension",
"extension",
"=",
"(",
"IDocumentExtension",
")",
"document",
";",
"extension",
".",
"registerPostNotificationReplace",
"(",
"null",
",",
"new",
"IDocumentExtension",
".",
"IReplace",
"(",
")",
"{",
"public",
"void",
"perform",
"(",
"IDocument",
"d",
",",
"IDocumentListener",
"owner",
")",
"{",
"if",
"(",
"(",
"level",
".",
"fFirstPosition",
".",
"isDeleted",
"||",
"level",
".",
"fFirstPosition",
".",
"length",
"==",
"0",
")",
"&&",
"!",
"level",
".",
"fSecondPosition",
".",
"isDeleted",
"&&",
"level",
".",
"fSecondPosition",
".",
"offset",
"==",
"level",
".",
"fFirstPosition",
".",
"offset",
")",
"{",
"try",
"{",
"document",
".",
"replace",
"(",
"level",
".",
"fSecondPosition",
".",
"offset",
",",
"level",
".",
"fSecondPosition",
".",
"length",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"if",
"(",
"fBracketLevelStack",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"document",
".",
"removePositionUpdater",
"(",
"fUpdater",
")",
";",
"try",
"{",
"document",
".",
"removePositionCategory",
"(",
"CATEGORY",
")",
";",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"}",
"}",
"public",
"void",
"suspend",
"(",
"LinkedModeModel",
"environment",
")",
"{",
"}",
"public",
"void",
"resume",
"(",
"LinkedModeModel",
"environment",
",",
"int",
"flags",
")",
"{",
"}",
"}",
"private",
"GroovyImageDecorator",
"decorator",
"=",
"new",
"GroovyImageDecorator",
"(",
")",
";",
"private",
"GroovySemanticReconciler",
"semanticReconciler",
";",
"private",
"final",
"GroovyBracketInserter",
"groovyBracketInserter",
"=",
"new",
"GroovyBracketInserter",
"(",
")",
";",
"public",
"GroovyEditor",
"(",
")",
"{",
"super",
"(",
")",
";",
"setRulerContextMenuId",
"(",
"\"\"",
")",
";",
"setEditorContextMenuId",
"(",
"\"\"",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setPreferenceStore",
"(",
"IPreferenceStore",
"store",
")",
"{",
"ChainedPreferenceStore",
"newStore",
"=",
"new",
"ChainedPreferenceStore",
"(",
"new",
"IPreferenceStore",
"[",
"]",
"{",
"store",
",",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
"}",
")",
";",
"super",
".",
"setPreferenceStore",
"(",
"newStore",
")",
";",
"setSourceViewerConfiguration",
"(",
"createJavaSourceViewerConfiguration",
"(",
")",
")",
";",
"}",
"public",
"GroovyConfiguration",
"getGroovyConfiguration",
"(",
")",
"{",
"return",
"(",
"GroovyConfiguration",
")",
"getSourceViewerConfiguration",
"(",
")",
";",
"}",
"private",
"void",
"installGroovySemanticHighlighting",
"(",
")",
"{",
"try",
"{",
"fSemanticManager",
".",
"uninstall",
"(",
")",
";",
"semanticReconciler",
"=",
"new",
"GroovySemanticReconciler",
"(",
")",
";",
"semanticReconciler",
".",
"install",
"(",
"this",
",",
"(",
"JavaSourceViewer",
")",
"this",
".",
"getSourceViewer",
"(",
")",
")",
";",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"CompilationUnitEditor",
".",
"class",
",",
"\"\"",
",",
"new",
"Class",
"[",
"]",
"{",
"IJavaReconcilingListener",
".",
"class",
"}",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"semanticReconciler",
"}",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"private",
"void",
"uninstallGroovySemanticHighlighting",
"(",
")",
"{",
"if",
"(",
"semanticHighlightingInstalled",
"(",
")",
")",
"{",
"try",
"{",
"semanticReconciler",
".",
"uninstall",
"(",
")",
";",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"CompilationUnitEditor",
".",
"class",
",",
"\"\"",
",",
"new",
"Class",
"[",
"]",
"{",
"IJavaReconcilingListener",
".",
"class",
"}",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"semanticReconciler",
"}",
")",
";",
"semanticReconciler",
"=",
"null",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"private",
"boolean",
"semanticHighlightingInstalled",
"(",
")",
"{",
"return",
"semanticReconciler",
"!=",
"null",
";",
"}",
"@",
"Override",
"public",
"void",
"dispose",
"(",
")",
"{",
"super",
".",
"dispose",
"(",
")",
";",
"uninstallGroovySemanticHighlighting",
"(",
")",
";",
"ISourceViewer",
"sourceViewer",
"=",
"getSourceViewer",
"(",
")",
";",
"if",
"(",
"sourceViewer",
"instanceof",
"ITextViewerExtension",
")",
"{",
"(",
"(",
"ITextViewerExtension",
")",
"sourceViewer",
")",
".",
"removeVerifyKeyListener",
"(",
"groovyBracketInserter",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"IEditorInput",
"getEditorInput",
"(",
")",
"{",
"return",
"super",
".",
"getEditorInput",
"(",
")",
";",
"}",
"public",
"int",
"getCaretOffset",
"(",
")",
"{",
"ISourceViewer",
"viewer",
"=",
"getSourceViewer",
"(",
")",
";",
"return",
"viewer",
".",
"getTextWidget",
"(",
")",
".",
"getCaretOffset",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Image",
"getTitleImage",
"(",
")",
"{",
"Object",
"element",
"=",
"getEditorInput",
"(",
")",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"element",
"=",
"getEditorInput",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"Image",
"image",
"=",
"decorator",
".",
"decorateImage",
"(",
"null",
",",
"element",
")",
";",
"return",
"image",
"!=",
"null",
"?",
"image",
":",
"super",
".",
"getTitleImage",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setSelection",
"(",
"ISourceReference",
"reference",
",",
"boolean",
"moveCursor",
")",
"{",
"super",
".",
"setSelection",
"(",
"reference",
",",
"moveCursor",
")",
";",
"try",
"{",
"if",
"(",
"reference",
"instanceof",
"IImportDeclaration",
"&&",
"moveCursor",
")",
"{",
"int",
"offset",
";",
"int",
"length",
";",
"ISourceRange",
"range",
"=",
"(",
"(",
"ISourceReference",
")",
"reference",
")",
".",
"getSourceRange",
"(",
")",
";",
"String",
"content",
"=",
"reference",
".",
"getSource",
"(",
")",
";",
"if",
"(",
"content",
"!=",
"null",
")",
"{",
"int",
"start",
"=",
"Math",
".",
"max",
"(",
"content",
".",
"indexOf",
"(",
"\"import\"",
")",
"+",
"6",
",",
"7",
")",
";",
"while",
"(",
"start",
"<",
"content",
".",
"length",
"(",
")",
"&&",
"content",
".",
"charAt",
"(",
"start",
")",
"==",
"'",
"'",
")",
"start",
"++",
";",
"int",
"end",
"=",
"content",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
";",
"do",
"{",
"end",
"--",
";",
"}",
"while",
"(",
"end",
">=",
"0",
"&&",
"(",
"content",
".",
"charAt",
"(",
"end",
")",
"==",
"'",
"'",
"||",
"content",
".",
"charAt",
"(",
"end",
")",
"==",
"';'",
")",
")",
";",
"offset",
"=",
"range",
".",
"getOffset",
"(",
")",
"+",
"start",
";",
"length",
"=",
"end",
"-",
"start",
"+",
"1",
";",
"int",
"docLength",
"=",
"(",
"(",
"IImportDeclaration",
")",
"reference",
")",
".",
"getOpenable",
"(",
")",
".",
"getBuffer",
"(",
")",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"docLength",
"<",
"offset",
"+",
"length",
")",
"{",
"offset",
"=",
"docLength",
";",
"}",
"}",
"else",
"{",
"offset",
"=",
"range",
".",
"getOffset",
"(",
")",
"+",
"1",
";",
"length",
"=",
"range",
".",
"getLength",
"(",
")",
"-",
"2",
";",
"}",
"if",
"(",
"offset",
">",
"-",
"1",
"&&",
"length",
">",
"0",
")",
"{",
"try",
"{",
"getSourceViewer",
"(",
")",
".",
"getTextWidget",
"(",
")",
".",
"setRedraw",
"(",
"false",
")",
";",
"getSourceViewer",
"(",
")",
".",
"revealRange",
"(",
"offset",
",",
"length",
")",
";",
"getSourceViewer",
"(",
")",
".",
"setSelectedRange",
"(",
"offset",
",",
"length",
")",
";",
"}",
"finally",
"{",
"getSourceViewer",
"(",
")",
".",
"getTextWidget",
"(",
")",
".",
"setRedraw",
"(",
"true",
")",
";",
"}",
"markInNavigationHistory",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"@",
"Override",
"protected",
"void",
"createActions",
"(",
")",
"{",
"super",
".",
"createActions",
"(",
")",
";",
"GenerateActionGroup",
"group",
"=",
"getGenerateActionGroup",
"(",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"GenerateActionGroup",
".",
"class",
",",
"\"\"",
",",
"group",
",",
"new",
"OrganizeGroovyImportsAction",
"(",
"this",
")",
")",
";",
"IAction",
"organizeImports",
"=",
"new",
"OrganizeGroovyImportsAction",
"(",
"this",
")",
";",
"organizeImports",
".",
"setActionDefinitionId",
"(",
"IJavaEditorActionDefinitionIds",
".",
"ORGANIZE_IMPORTS",
")",
";",
"setAction",
"(",
"\"\"",
",",
"organizeImports",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"GenerateActionGroup",
".",
"class",
",",
"\"fFormatAll\"",
",",
"group",
",",
"new",
"FormatAllGroovyAction",
"(",
"this",
".",
"getEditorSite",
"(",
")",
",",
"FormatKind",
".",
"FORMAT",
")",
")",
";",
"IAction",
"formatAction",
"=",
"new",
"FormatGroovyAction",
"(",
"this",
".",
"getEditorSite",
"(",
")",
",",
"FormatKind",
".",
"FORMAT",
")",
";",
"formatAction",
".",
"setActionDefinitionId",
"(",
"IJavaEditorActionDefinitionIds",
".",
"FORMAT",
")",
";",
"setAction",
"(",
"\"Format\"",
",",
"formatAction",
")",
";",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getHelpSystem",
"(",
")",
".",
"setHelp",
"(",
"formatAction",
",",
"IJavaHelpContextIds",
".",
"FORMAT_ACTION",
")",
";",
"IAction",
"indentAction",
"=",
"new",
"FormatGroovyAction",
"(",
"this",
".",
"getEditorSite",
"(",
")",
",",
"FormatKind",
".",
"INDENT_ONLY",
")",
";",
"indentAction",
".",
"setActionDefinitionId",
"(",
"IJavaEditorActionDefinitionIds",
".",
"INDENT",
")",
";",
"setAction",
"(",
"\"Indent\"",
",",
"indentAction",
")",
";",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getHelpSystem",
"(",
")",
".",
"setHelp",
"(",
"indentAction",
",",
"IJavaHelpContextIds",
".",
"INDENT_ACTION",
")",
";",
"IAction",
"indentOnTabAction",
"=",
"new",
"GroovyTabAction",
"(",
"this",
")",
";",
"setAction",
"(",
"INDENT_ON_TAB",
",",
"indentOnTabAction",
")",
";",
"markAsStateDependentAction",
"(",
"INDENT_ON_TAB",
",",
"true",
")",
";",
"markAsSelectionDependentAction",
"(",
"INDENT_ON_TAB",
",",
"true",
")",
";",
"AddGetterSetterAction",
"agsa",
"=",
"(",
"AddGetterSetterAction",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"GenerateActionGroup",
".",
"class",
",",
"\"\"",
",",
"group",
")",
";",
"if",
"(",
"agsa",
"!=",
"null",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"AddGetterSetterAction",
".",
"class",
",",
"\"fEditor\"",
",",
"agsa",
",",
"null",
")",
";",
"}",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"GenerateActionGroup",
".",
"class",
",",
"\"\"",
",",
"group",
",",
"null",
")",
";",
"AllCleanUpsAction",
"acua",
"=",
"(",
"AllCleanUpsAction",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"GenerateActionGroup",
".",
"class",
",",
"\"fCleanUp\"",
",",
"group",
")",
";",
"if",
"(",
"acua",
"!=",
"null",
")",
"{",
"acua",
".",
"dispose",
"(",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"CleanUpAction",
".",
"class",
",",
"\"fEditor\"",
",",
"acua",
",",
"null",
")",
";",
"}",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"GenerateActionGroup",
".",
"class",
",",
"\"fCleanUp\"",
",",
"group",
",",
"new",
"NoopCleanUpsAction",
"(",
"getEditorSite",
"(",
")",
")",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"fMoveAction\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"removeRefactoringAction",
"(",
"\"\"",
")",
";",
"GroovyRenameAction",
"renameAction",
"=",
"new",
"GroovyRenameAction",
"(",
"this",
")",
";",
"renameAction",
".",
"setActionDefinitionId",
"(",
"IGroovyEditorActionDefinitionIds",
".",
"GROOVY_RENAME_ACTION",
")",
";",
"setAction",
"(",
"\"\"",
",",
"renameAction",
")",
";",
"replaceRefactoringAction",
"(",
"\"\"",
",",
"renameAction",
")",
";",
"GroovyExtractConstantAction",
"extractConstantAction",
"=",
"new",
"GroovyExtractConstantAction",
"(",
"this",
")",
";",
"extractConstantAction",
".",
"setActionDefinitionId",
"(",
"IJavaEditorActionDefinitionIds",
".",
"EXTRACT_CONSTANT",
")",
";",
"setAction",
"(",
"\"\"",
",",
"extractConstantAction",
")",
";",
"replaceRefactoringAction",
"(",
"\"\"",
",",
"extractConstantAction",
")",
";",
"GroovyExtractMethodAction",
"extractMethodAction",
"=",
"new",
"GroovyExtractMethodAction",
"(",
"this",
")",
";",
"extractMethodAction",
".",
"setActionDefinitionId",
"(",
"IJavaEditorActionDefinitionIds",
".",
"EXTRACT_METHOD",
")",
";",
"setAction",
"(",
"\"\"",
",",
"extractMethodAction",
")",
";",
"replaceRefactoringAction",
"(",
"\"\"",
",",
"extractMethodAction",
")",
";",
"GroovyExtractLocalAction",
"extractLocalAction",
"=",
"new",
"GroovyExtractLocalAction",
"(",
"this",
")",
";",
"extractLocalAction",
".",
"setActionDefinitionId",
"(",
"IJavaEditorActionDefinitionIds",
".",
"EXTRACT_LOCAL_VARIABLE",
")",
";",
"setAction",
"(",
"\"\"",
",",
"extractLocalAction",
")",
";",
"replaceRefactoringAction",
"(",
"\"\"",
",",
"extractLocalAction",
")",
";",
"GroovyConvertLocalToFieldAction",
"convertLocalAction",
"=",
"new",
"GroovyConvertLocalToFieldAction",
"(",
"this",
")",
";",
"convertLocalAction",
".",
"setActionDefinitionId",
"(",
"IJavaEditorActionDefinitionIds",
".",
"PROMOTE_LOCAL_VARIABLE",
")",
";",
"setAction",
"(",
"\"\"",
",",
"convertLocalAction",
")",
";",
"replaceRefactoringAction",
"(",
"\"\"",
",",
"convertLocalAction",
")",
";",
"ExpandSelectionAction",
"selectionAction",
"=",
"new",
"ExpandSelectionAction",
"(",
"this",
",",
"(",
"SelectionHistory",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
")",
")",
";",
"selectionAction",
".",
"setActionDefinitionId",
"(",
"IJavaEditorActionDefinitionIds",
".",
"SELECT_ENCLOSING",
")",
";",
"selectionAction",
".",
"getDescription",
"(",
")",
";",
"setAction",
"(",
"StructureSelectionAction",
".",
"ENCLOSING",
",",
"selectionAction",
")",
";",
"setAction",
"(",
"StructureSelectionAction",
".",
"NEXT",
",",
"null",
")",
";",
"setAction",
"(",
"StructureSelectionAction",
".",
"PREVIOUS",
",",
"null",
")",
";",
"}",
"private",
"void",
"removeRefactoringAction",
"(",
"String",
"actionFieldName",
")",
"{",
"replaceRefactoringAction",
"(",
"actionFieldName",
",",
"null",
")",
";",
"}",
"private",
"void",
"replaceRefactoringAction",
"(",
"String",
"actionFieldName",
",",
"SelectionDispatchAction",
"newAction",
")",
"{",
"RefactorActionGroup",
"group",
"=",
"getRefactorActionGroup",
"(",
")",
";",
"ISelectionChangedListener",
"action",
"=",
"(",
"ISelectionChangedListener",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"RefactorActionGroup",
".",
"class",
",",
"actionFieldName",
",",
"group",
")",
";",
"if",
"(",
"action",
"!=",
"null",
")",
"{",
"getSite",
"(",
")",
".",
"getSelectionProvider",
"(",
")",
".",
"removeSelectionChangedListener",
"(",
"action",
")",
";",
"}",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"RefactorActionGroup",
".",
"class",
",",
"actionFieldName",
",",
"group",
",",
"newAction",
")",
";",
"}",
"private",
"IFile",
"getFile",
"(",
")",
"{",
"IEditorInput",
"input",
"=",
"getEditorInput",
"(",
")",
";",
"if",
"(",
"input",
"instanceof",
"FileEditorInput",
")",
"{",
"return",
"(",
"(",
"FileEditorInput",
")",
"input",
")",
".",
"getFile",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"GroovyCompilationUnit",
"getGroovyCompilationUnit",
"(",
")",
"{",
"ITypeRoot",
"root",
"=",
"super",
".",
"getInputJavaElement",
"(",
")",
";",
"if",
"(",
"root",
"instanceof",
"GroovyCompilationUnit",
")",
"{",
"return",
"(",
"GroovyCompilationUnit",
")",
"root",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"ModuleNode",
"getModuleNode",
"(",
")",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"return",
"unit",
".",
"getModuleNode",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"public",
"Object",
"getAdapter",
"(",
"Class",
"required",
")",
"{",
"if",
"(",
"IResource",
".",
"class",
"==",
"required",
"||",
"IFile",
".",
"class",
"==",
"required",
")",
"{",
"return",
"this",
".",
"getFile",
"(",
")",
";",
"}",
"if",
"(",
"GroovyCompilationUnit",
".",
"class",
"==",
"required",
"||",
"ICompilationUnit",
".",
"class",
"==",
"required",
"||",
"CompilationUnit",
".",
"class",
"==",
"required",
")",
"{",
"return",
"super",
".",
"getInputJavaElement",
"(",
")",
";",
"}",
"if",
"(",
"ModuleNode",
".",
"class",
"==",
"required",
")",
"{",
"return",
"this",
".",
"getModuleNode",
"(",
")",
";",
"}",
"return",
"super",
".",
"getAdapter",
"(",
"required",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"createPartControl",
"(",
"Composite",
"parent",
")",
"{",
"super",
".",
"createPartControl",
"(",
"parent",
")",
";",
"unsetJavaBreakpointUpdater",
"(",
")",
";",
"installGroovySemanticHighlighting",
"(",
")",
";",
"IPreferenceStore",
"preferenceStore",
"=",
"getPreferenceStore",
"(",
")",
";",
"boolean",
"closeBrackets",
"=",
"preferenceStore",
".",
"getBoolean",
"(",
"CLOSE_BRACKETS",
")",
";",
"boolean",
"closeStrings",
"=",
"preferenceStore",
".",
"getBoolean",
"(",
"CLOSE_STRINGS",
")",
";",
"boolean",
"closeBraces",
"=",
"preferenceStore",
".",
"getBoolean",
"(",
"CLOSE_BRACES",
")",
";",
"boolean",
"closeAngularBrackets",
"=",
"JavaCore",
".",
"VERSION_1_5",
".",
"compareTo",
"(",
"preferenceStore",
".",
"getString",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
")",
")",
"<=",
"0",
";",
"groovyBracketInserter",
".",
"setCloseBracketsEnabled",
"(",
"closeBrackets",
")",
";",
"groovyBracketInserter",
".",
"setCloseStringsEnabled",
"(",
"closeStrings",
")",
";",
"groovyBracketInserter",
".",
"setCloseAngularBracketsEnabled",
"(",
"closeAngularBrackets",
")",
";",
"groovyBracketInserter",
".",
"setCloseBracesEnabled",
"(",
"closeBraces",
")",
";",
"ISourceViewer",
"sourceViewer",
"=",
"getSourceViewer",
"(",
")",
";",
"if",
"(",
"sourceViewer",
"instanceof",
"ITextViewerExtension",
")",
"{",
"(",
"(",
"ITextViewerExtension",
")",
"sourceViewer",
")",
".",
"prependVerifyKeyListener",
"(",
"groovyBracketInserter",
")",
";",
"}",
"disableBracketInserter",
"(",
")",
";",
"}",
"private",
"void",
"disableBracketInserter",
"(",
")",
"{",
"Object",
"fBracketInserterField",
"=",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"CompilationUnitEditor",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"Class",
"<",
"?",
">",
"fBracketInserterClass",
"=",
"fBracketInserterField",
".",
"getClass",
"(",
")",
";",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"fBracketInserterClass",
",",
"\"\"",
",",
"new",
"Class",
"[",
"]",
"{",
"boolean",
".",
"class",
"}",
",",
"fBracketInserterField",
",",
"new",
"Object",
"[",
"]",
"{",
"false",
"}",
")",
";",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"fBracketInserterClass",
",",
"\"\"",
",",
"new",
"Class",
"[",
"]",
"{",
"boolean",
".",
"class",
"}",
",",
"fBracketInserterField",
",",
"new",
"Object",
"[",
"]",
"{",
"false",
"}",
")",
";",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"fBracketInserterClass",
",",
"\"\"",
",",
"new",
"Class",
"[",
"]",
"{",
"boolean",
".",
"class",
"}",
",",
"fBracketInserterField",
",",
"new",
"Object",
"[",
"]",
"{",
"false",
"}",
")",
";",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"fBracketInserterClass",
",",
"\"\"",
",",
"new",
"Class",
"[",
"]",
"{",
"boolean",
".",
"class",
"}",
",",
"fBracketInserterField",
",",
"new",
"Object",
"[",
"]",
"{",
"false",
"}",
")",
";",
"}",
"IEditorInput",
"internalInput",
";",
"@",
"Override",
"protected",
"void",
"doSetInput",
"(",
"IEditorInput",
"input",
")",
"throws",
"CoreException",
"{",
"boolean",
"wasInstalled",
"=",
"semanticHighlightingInstalled",
"(",
")",
";",
"if",
"(",
"wasInstalled",
")",
"{",
"uninstallGroovySemanticHighlighting",
"(",
")",
";",
"}",
"internalInput",
"=",
"input",
";",
"super",
".",
"doSetInput",
"(",
"input",
")",
";",
"unsetJavaBreakpointUpdater",
"(",
")",
";",
"internalInput",
"=",
"null",
";",
"if",
"(",
"wasInstalled",
")",
"{",
"installGroovySemanticHighlighting",
"(",
")",
";",
"}",
"}",
"class",
"OccurrencesFinderJob",
"extends",
"Job",
"{",
"private",
"final",
"IDocument",
"fDocument",
";",
"private",
"final",
"ISelection",
"fSelection",
";",
"private",
"final",
"ISelectionValidator",
"fPostSelectionValidator",
";",
"private",
"boolean",
"fCanceled",
"=",
"false",
";",
"private",
"final",
"OccurrenceLocation",
"[",
"]",
"fLocations",
";",
"public",
"OccurrencesFinderJob",
"(",
"IDocument",
"document",
",",
"OccurrenceLocation",
"[",
"]",
"locations",
",",
"ISelection",
"selection",
")",
"{",
"super",
"(",
"\"\"",
")",
";",
"fDocument",
"=",
"document",
";",
"fSelection",
"=",
"selection",
";",
"fLocations",
"=",
"locations",
";",
"if",
"(",
"getSelectionProvider",
"(",
")",
"instanceof",
"ISelectionValidator",
")",
"fPostSelectionValidator",
"=",
"(",
"ISelectionValidator",
")",
"getSelectionProvider",
"(",
")",
";",
"else",
"fPostSelectionValidator",
"=",
"null",
";",
"}",
"void",
"doCancel",
"(",
")",
"{",
"fCanceled",
"=",
"true",
";",
"cancel",
"(",
")",
";",
"}",
"private",
"boolean",
"isCanceled",
"(",
"IProgressMonitor",
"progressMonitor",
")",
"{",
"return",
"fCanceled",
"||",
"progressMonitor",
".",
"isCanceled",
"(",
")",
"||",
"fPostSelectionValidator",
"!=",
"null",
"&&",
"!",
"(",
"fPostSelectionValidator",
".",
"isValid",
"(",
"fSelection",
")",
"||",
"getForcedMarkOccurrencesSelection",
"(",
")",
"==",
"fSelection",
")",
"||",
"LinkedModeModel",
".",
"hasInstalledModel",
"(",
"fDocument",
")",
";",
"}",
"@",
"Override",
"public",
"IStatus",
"run",
"(",
"IProgressMonitor",
"progressMonitor",
")",
"{",
"if",
"(",
"isCanceled",
"(",
"progressMonitor",
")",
")",
"return",
"Status",
".",
"CANCEL_STATUS",
";",
"ITextViewer",
"textViewer",
"=",
"getViewer",
"(",
")",
";",
"if",
"(",
"textViewer",
"==",
"null",
")",
"return",
"Status",
".",
"CANCEL_STATUS",
";",
"IDocument",
"document",
"=",
"textViewer",
".",
"getDocument",
"(",
")",
";",
"if",
"(",
"document",
"==",
"null",
")",
"return",
"Status",
".",
"CANCEL_STATUS",
";",
"IDocumentProvider",
"documentProvider",
"=",
"getDocumentProvider",
"(",
")",
";",
"if",
"(",
"documentProvider",
"==",
"null",
")",
"return",
"Status",
".",
"CANCEL_STATUS",
";",
"IAnnotationModel",
"annotationModel",
"=",
"documentProvider",
".",
"getAnnotationModel",
"(",
"getEditorInput",
"(",
")",
")",
";",
"if",
"(",
"annotationModel",
"==",
"null",
")",
"return",
"Status",
".",
"CANCEL_STATUS",
";",
"int",
"length",
"=",
"fLocations",
".",
"length",
";",
"Map",
"annotationMap",
"=",
"new",
"HashMap",
"(",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"isCanceled",
"(",
"progressMonitor",
")",
")",
"return",
"Status",
".",
"CANCEL_STATUS",
";",
"OccurrenceLocation",
"location",
"=",
"fLocations",
"[",
"i",
"]",
";",
"Position",
"position",
"=",
"new",
"Position",
"(",
"location",
".",
"getOffset",
"(",
")",
",",
"location",
".",
"getLength",
"(",
")",
")",
";",
"String",
"description",
"=",
"location",
".",
"getDescription",
"(",
")",
";",
"String",
"annotationType",
"=",
"(",
"location",
".",
"getFlags",
"(",
")",
"==",
"IOccurrencesFinder",
".",
"F_WRITE_OCCURRENCE",
")",
"?",
"\"\"",
":",
"\"\"",
";",
"annotationMap",
".",
"put",
"(",
"new",
"Annotation",
"(",
"annotationType",
",",
"false",
",",
"description",
")",
",",
"position",
")",
";",
"}",
"if",
"(",
"isCanceled",
"(",
"progressMonitor",
")",
")",
"return",
"Status",
".",
"CANCEL_STATUS",
";",
"synchronized",
"(",
"myGetLockObject",
"(",
"annotationModel",
")",
")",
"{",
"if",
"(",
"annotationModel",
"instanceof",
"IAnnotationModelExtension",
")",
"{",
"(",
"(",
"IAnnotationModelExtension",
")",
"annotationModel",
")",
".",
"replaceAnnotations",
"(",
"getOccurrenceAnnotations",
"(",
")",
",",
"annotationMap",
")",
";",
"}",
"else",
"{",
"myRemoveOccurrenceAnnotations",
"(",
")",
";",
"Iterator",
"iter",
"=",
"annotationMap",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"mapEntry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iter",
".",
"next",
"(",
")",
";",
"annotationModel",
".",
"addAnnotation",
"(",
"(",
"Annotation",
")",
"mapEntry",
".",
"getKey",
"(",
")",
",",
"(",
"Position",
")",
"mapEntry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"setOccurrenceAnnotations",
"(",
"(",
"Annotation",
"[",
"]",
")",
"annotationMap",
".",
"keySet",
"(",
")",
".",
"toArray",
"(",
"new",
"Annotation",
"[",
"annotationMap",
".",
"keySet",
"(",
")",
".",
"size",
"(",
")",
"]",
")",
")",
";",
"}",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"}",
"private",
"OccurrencesFinderJob",
"groovyOccurrencesFinderJob",
"=",
"null",
";",
"private",
"Object",
"myGetLockObject",
"(",
"IAnnotationModel",
"model",
")",
"{",
"return",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"new",
"Class",
"[",
"]",
"{",
"IAnnotationModel",
".",
"class",
"}",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"model",
"}",
")",
";",
"}",
"private",
"void",
"myRemoveOccurrenceAnnotations",
"(",
")",
"{",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"new",
"Class",
"[",
"0",
"]",
",",
"this",
",",
"new",
"Object",
"[",
"0",
"]",
")",
";",
"}",
"private",
"void",
"setOccurrenceAnnotations",
"(",
"Annotation",
"[",
"]",
"as",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"as",
")",
";",
"}",
"private",
"void",
"setMarkOccurrenceTargetRegion",
"(",
"IRegion",
"r",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"r",
")",
";",
"}",
"private",
"void",
"setMarkOccurrenceModificationStamp",
"(",
"long",
"l",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"l",
")",
";",
"}",
"private",
"Annotation",
"[",
"]",
"getOccurrenceAnnotations",
"(",
")",
"{",
"return",
"(",
"Annotation",
"[",
"]",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"private",
"IRegion",
"getMarkOccurrenceTargetRegion",
"(",
")",
"{",
"return",
"(",
"IRegion",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"private",
"long",
"getMarkOccurrenceModificationStamp",
"(",
")",
"{",
"return",
"(",
"Long",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"private",
"boolean",
"getStickyOccurrenceAnnotations",
"(",
")",
"{",
"return",
"(",
"Boolean",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"private",
"boolean",
"getMarkOccurrenceAnnotations",
"(",
")",
"{",
"return",
"(",
"Boolean",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"private",
"ISelection",
"getForcedMarkOccurrencesSelection",
"(",
")",
"{",
"return",
"(",
"ISelection",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaEditor",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"updateOccurrenceAnnotations",
"(",
"ITextSelection",
"selection",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"astRoot",
")",
"{",
"if",
"(",
"groovyOccurrencesFinderJob",
"!=",
"null",
")",
"groovyOccurrencesFinderJob",
".",
"cancel",
"(",
")",
";",
"if",
"(",
"!",
"getMarkOccurrenceAnnotations",
"(",
")",
")",
"return",
";",
"if",
"(",
"astRoot",
"==",
"null",
"||",
"selection",
"==",
"null",
")",
"return",
";",
"IDocument",
"document",
"=",
"getSourceViewer",
"(",
")",
".",
"getDocument",
"(",
")",
";",
"if",
"(",
"document",
"==",
"null",
")",
"return",
";",
"boolean",
"hasChanged",
"=",
"false",
";",
"if",
"(",
"document",
"instanceof",
"IDocumentExtension4",
")",
"{",
"int",
"offset",
"=",
"selection",
".",
"getOffset",
"(",
")",
";",
"long",
"currentModificationStamp",
"=",
"(",
"(",
"IDocumentExtension4",
")",
"document",
")",
".",
"getModificationStamp",
"(",
")",
";",
"IRegion",
"markOccurrenceTargetRegion",
"=",
"getMarkOccurrenceTargetRegion",
"(",
")",
";",
"hasChanged",
"=",
"currentModificationStamp",
"!=",
"getMarkOccurrenceModificationStamp",
"(",
")",
";",
"if",
"(",
"markOccurrenceTargetRegion",
"!=",
"null",
"&&",
"!",
"hasChanged",
")",
"{",
"if",
"(",
"markOccurrenceTargetRegion",
".",
"getOffset",
"(",
")",
"<=",
"offset",
"&&",
"offset",
"<=",
"markOccurrenceTargetRegion",
".",
"getOffset",
"(",
")",
"+",
"markOccurrenceTargetRegion",
".",
"getLength",
"(",
")",
")",
"return",
";",
"}",
"setMarkOccurrenceTargetRegion",
"(",
"findMarkOccurrencesRegion",
"(",
"document",
",",
"offset",
")",
")",
";",
"setMarkOccurrenceModificationStamp",
"(",
"currentModificationStamp",
")",
";",
"}",
"OccurrenceLocation",
"[",
"]",
"locations",
"=",
"null",
";",
"GroovyOccurrencesFinder",
"finder",
"=",
"new",
"GroovyOccurrencesFinder",
"(",
")",
";",
"finder",
".",
"initialize",
"(",
"astRoot",
",",
"selection",
".",
"getOffset",
"(",
")",
",",
"selection",
".",
"getLength",
"(",
")",
")",
";",
"locations",
"=",
"finder",
".",
"getOccurrences",
"(",
")",
";",
"if",
"(",
"locations",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"getStickyOccurrenceAnnotations",
"(",
")",
")",
"myRemoveOccurrenceAnnotations",
"(",
")",
";",
"else",
"if",
"(",
"hasChanged",
")",
"myRemoveOccurrenceAnnotations",
"(",
")",
";",
"return",
";",
"}",
"groovyOccurrencesFinderJob",
"=",
"new",
"OccurrencesFinderJob",
"(",
"document",
",",
"locations",
",",
"selection",
")",
";",
"groovyOccurrencesFinderJob",
".",
"run",
"(",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"}",
"protected",
"IRegion",
"findMarkOccurrencesRegion",
"(",
"IDocument",
"document",
",",
"int",
"offset",
")",
"{",
"IRegion",
"word",
"=",
"JavaWordFinder",
".",
"findWord",
"(",
"document",
",",
"offset",
")",
";",
"try",
"{",
"if",
"(",
"word",
"!=",
"null",
"&&",
"word",
".",
"getLength",
"(",
")",
">",
"1",
"&&",
"document",
".",
"getChar",
"(",
"word",
".",
"getOffset",
"(",
")",
")",
"==",
"'$'",
")",
"{",
"word",
"=",
"new",
"Region",
"(",
"word",
".",
"getOffset",
"(",
")",
"+",
"1",
",",
"word",
".",
"getLength",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"}",
"return",
"word",
";",
"}",
"@",
"Override",
"protected",
"void",
"initializeKeyBindingScopes",
"(",
")",
"{",
"setKeyBindingScopes",
"(",
"new",
"String",
"[",
"]",
"{",
"\"\"",
"}",
")",
";",
"}",
"@",
"Override",
"public",
"JavaSourceViewerConfiguration",
"createJavaSourceViewerConfiguration",
"(",
")",
"{",
"GroovyTextTools",
"textTools",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getTextTools",
"(",
")",
";",
"return",
"new",
"GroovyConfiguration",
"(",
"textTools",
".",
"getColorManager",
"(",
")",
",",
"getPreferenceStore",
"(",
")",
",",
"this",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"unsetJavaBreakpointUpdater",
"(",
")",
"{",
"ISourceViewer",
"viewer",
"=",
"getSourceViewer",
"(",
")",
";",
"if",
"(",
"viewer",
"!=",
"null",
")",
"{",
"IAnnotationModel",
"model",
"=",
"viewer",
".",
"getAnnotationModel",
"(",
")",
";",
"if",
"(",
"model",
"instanceof",
"AbstractMarkerAnnotationModel",
")",
"{",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"AbstractMarkerAnnotationModel",
".",
"class",
",",
"\"\"",
",",
"new",
"Class",
"<",
"?",
">",
"[",
"0",
"]",
",",
"model",
",",
"new",
"Object",
"[",
"0",
"]",
")",
";",
"List",
"<",
"IConfigurationElement",
">",
"updaterSpecs",
"=",
"(",
"List",
"<",
"IConfigurationElement",
">",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"AbstractMarkerAnnotationModel",
".",
"class",
",",
"\"\"",
",",
"model",
")",
";",
"for",
"(",
"Iterator",
"<",
"IConfigurationElement",
">",
"specIter",
"=",
"updaterSpecs",
".",
"iterator",
"(",
")",
";",
"specIter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"IConfigurationElement",
"spec",
"=",
"specIter",
".",
"next",
"(",
")",
";",
"if",
"(",
"spec",
".",
"getAttribute",
"(",
"\"class\"",
")",
".",
"equals",
"(",
"BreakpointMarkerUpdater",
".",
"class",
".",
"getCanonicalName",
"(",
")",
")",
")",
"{",
"specIter",
".",
"remove",
"(",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"private",
"final",
"static",
"String",
"CLOSE_STRINGS",
"=",
"PreferenceConstants",
".",
"EDITOR_CLOSE_STRINGS",
";",
"private",
"final",
"static",
"String",
"CLOSE_BRACKETS",
"=",
"PreferenceConstants",
".",
"EDITOR_CLOSE_BRACKETS",
";",
"private",
"final",
"static",
"String",
"CLOSE_BRACES",
"=",
"PreferenceConstants",
".",
"EDITOR_CLOSE_BRACES",
";",
"@",
"Override",
"protected",
"void",
"handlePreferenceStoreChanged",
"(",
"PropertyChangeEvent",
"event",
")",
"{",
"super",
".",
"handlePreferenceStoreChanged",
"(",
"event",
")",
";",
"ISourceViewer",
"sv",
"=",
"getSourceViewer",
"(",
")",
";",
"if",
"(",
"sv",
"!=",
"null",
")",
"{",
"String",
"p",
"=",
"event",
".",
"getProperty",
"(",
")",
";",
"if",
"(",
"CLOSE_BRACKETS",
".",
"equals",
"(",
"p",
")",
")",
"{",
"groovyBracketInserter",
".",
"setCloseBracketsEnabled",
"(",
"getPreferenceStore",
"(",
")",
".",
"getBoolean",
"(",
"p",
")",
")",
";",
"disableBracketInserter",
"(",
")",
";",
"return",
";",
"}",
"if",
"(",
"CLOSE_STRINGS",
".",
"equals",
"(",
"p",
")",
")",
"{",
"groovyBracketInserter",
".",
"setCloseStringsEnabled",
"(",
"getPreferenceStore",
"(",
")",
".",
"getBoolean",
"(",
"p",
")",
")",
";",
"disableBracketInserter",
"(",
")",
";",
"return",
";",
"}",
"if",
"(",
"CLOSE_BRACES",
".",
"equals",
"(",
"p",
")",
")",
"{",
"groovyBracketInserter",
".",
"setCloseBracesEnabled",
"(",
"getPreferenceStore",
"(",
")",
".",
"getBoolean",
"(",
"p",
")",
")",
";",
"disableBracketInserter",
"(",
")",
";",
"return",
";",
"}",
"}",
"}",
"private",
"static",
"char",
"getEscapeCharacter",
"(",
"char",
"character",
")",
"{",
"switch",
"(",
"character",
")",
"{",
"case",
"'\"'",
":",
"case",
"'\\''",
":",
"return",
"'\\\\'",
";",
"default",
":",
"return",
"0",
";",
"}",
"}",
"private",
"static",
"char",
"getPeerCharacter",
"(",
"char",
"character",
")",
"{",
"switch",
"(",
"character",
")",
"{",
"case",
"'('",
":",
"return",
"')'",
";",
"case",
"')'",
":",
"return",
"'('",
";",
"case",
"'<'",
":",
"return",
"'>'",
";",
"case",
"'>'",
":",
"return",
"'<'",
";",
"case",
"'['",
":",
"return",
"']'",
";",
"case",
"']'",
":",
"return",
"'['",
";",
"case",
"'\"'",
":",
"return",
"character",
";",
"case",
"'\\''",
":",
"return",
"character",
";",
"case",
"'{'",
":",
"return",
"'}'",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"}",
"public",
"VerifyKeyListener",
"getGroovyBracketInserter",
"(",
")",
"{",
"return",
"groovyBracketInserter",
";",
"}",
"private",
"GroovyOutlinePage",
"page",
";",
"public",
"GroovyOutlinePage",
"getOutlinePage",
"(",
")",
"{",
"if",
"(",
"page",
"==",
"null",
")",
"{",
"IContentOutlinePage",
"outlinePage",
"=",
"(",
"IContentOutlinePage",
")",
"getAdapter",
"(",
"IContentOutlinePage",
".",
"class",
")",
";",
"if",
"(",
"outlinePage",
"instanceof",
"GroovyOutlinePage",
")",
"{",
"page",
"=",
"(",
"GroovyOutlinePage",
")",
"outlinePage",
";",
"}",
"}",
"return",
"page",
";",
"}",
"@",
"Override",
"protected",
"void",
"synchronizeOutlinePage",
"(",
"ISourceReference",
"element",
",",
"boolean",
"checkIfOutlinePageActive",
")",
"{",
"if",
"(",
"page",
"!=",
"null",
")",
"{",
"page",
".",
"refresh",
"(",
")",
";",
"}",
"super",
".",
"synchronizeOutlinePage",
"(",
"element",
",",
"checkIfOutlinePageActive",
")",
";",
"}",
"@",
"Override",
"protected",
"ISourceReference",
"computeHighlightRangeSourceReference",
"(",
")",
"{",
"return",
"page",
"!=",
"null",
"?",
"page",
".",
"getOutlineElmenetAt",
"(",
"getCaretOffset",
"(",
")",
")",
":",
"super",
".",
"computeHighlightRangeSourceReference",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"JavaOutlinePage",
"createOutlinePage",
"(",
")",
"{",
"OutlineExtenderRegistry",
"outlineExtenderRegistry",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getOutlineTools",
"(",
")",
".",
"getOutlineExtenderRegistry",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getGroovyCompilationUnit",
"(",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"page",
"=",
"outlineExtenderRegistry",
".",
"getGroovyOutlinePageForEditor",
"(",
"unit",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
",",
"fOutlinerContextMenuId",
",",
"this",
")",
";",
"if",
"(",
"page",
"!=",
"null",
")",
"{",
"page",
".",
"setInput",
"(",
"page",
".",
"getOutlineCompilationUnit",
"(",
")",
")",
";",
"return",
"page",
";",
"}",
"}",
"return",
"super",
".",
"createOutlinePage",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,320 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IAutoEditStrategy",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"public",
"abstract",
"class",
"AbstractAutoEditStrategy",
"implements",
"IAutoEditStrategy",
"{",
"protected",
"boolean",
"isNewline",
"(",
"IDocument",
"document",
",",
"String",
"text",
")",
"{",
"String",
"[",
"]",
"delimiters",
"=",
"document",
".",
"getLegalLineDelimiters",
"(",
")",
";",
"if",
"(",
"delimiters",
"!=",
"null",
")",
"for",
"(",
"String",
"nl",
":",
"delimiters",
")",
"{",
"if",
"(",
"nl",
".",
"equals",
"(",
"text",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
6,321 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightingExtenderRegistry",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"SingleTokenJavaScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"CompletionProposalCategory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"ContentAssistProcessor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"JavaAutoIndentStrategy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"JavaCompletionProcessor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"hover",
".",
"JavaInformationProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"hover",
".",
"JavadocHover",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IColorManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IJavaPartitions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"JavaSourceViewerConfiguration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"hover",
".",
"IJavaEditorTextHover",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IAutoEditStrategy",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"contentassist",
".",
"ContentAssistant",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"contentassist",
".",
"IContentAssistProcessor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"contentassist",
".",
"IContentAssistant",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"information",
".",
"IInformationPresenter",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"information",
".",
"IInformationProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"information",
".",
"InformationPresenter",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"presentation",
".",
"IPresentationReconciler",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"presentation",
".",
"PresentationReconciler",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"quickassist",
".",
"IQuickAssistAssistant",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"DefaultDamagerRepairer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"RuleBasedScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"ISourceViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"part",
".",
"FileEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"ITextEditor",
";",
"public",
"class",
"GroovyConfiguration",
"extends",
"JavaSourceViewerConfiguration",
"{",
"public",
"GroovyConfiguration",
"(",
"GroovyColorManager",
"colorManager",
",",
"IPreferenceStore",
"preferenceSource",
",",
"ITextEditor",
"editor",
")",
"{",
"super",
"(",
"colorManager",
",",
"preferenceSource",
",",
"editor",
",",
"IJavaPartitions",
".",
"JAVA_PARTITIONING",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"JavaSourceViewerConfiguration",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"createStringScanner",
"(",
"colorManager",
",",
"preferenceSource",
")",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"JavaSourceViewerConfiguration",
".",
"class",
",",
"\"fCodeScanner\"",
",",
"this",
",",
"createTagScanner",
"(",
"getProject",
"(",
")",
",",
"colorManager",
",",
"getHighlightingExtenderRegistry",
"(",
")",
")",
")",
";",
"}",
"private",
"RuleBasedScanner",
"createStringScanner",
"(",
"IColorManager",
"colorManager",
",",
"IPreferenceStore",
"store",
")",
"{",
"return",
"new",
"SingleTokenJavaScanner",
"(",
"colorManager",
",",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
")",
";",
"}",
"private",
"GroovyTagScanner",
"createTagScanner",
"(",
"IProject",
"project",
",",
"IColorManager",
"colorManager",
",",
"HighlightingExtenderRegistry",
"registry",
")",
"{",
"return",
"new",
"GroovyTagScanner",
"(",
"colorManager",
",",
"registry",
".",
"getAdditionalRulesForProject",
"(",
"project",
")",
",",
"registry",
".",
"getExtraGroovyKeywordsForProject",
"(",
"project",
")",
",",
"registry",
".",
"getExtraGJDKKeywordsForProject",
"(",
"project",
")",
")",
";",
"}",
"public",
"HighlightingExtenderRegistry",
"getHighlightingExtenderRegistry",
"(",
")",
"{",
"return",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getTextTools",
"(",
")",
".",
"getHighlightingExtenderRegistry",
"(",
")",
";",
"}",
"private",
"IProject",
"getProject",
"(",
")",
"{",
"ITextEditor",
"editor",
"=",
"getEditor",
"(",
")",
";",
"if",
"(",
"editor",
"!=",
"null",
"&&",
"editor",
"instanceof",
"GroovyEditor",
")",
"{",
"IEditorInput",
"input",
"=",
"(",
"(",
"GroovyEditor",
")",
"editor",
")",
".",
"internalInput",
";",
"if",
"(",
"input",
"instanceof",
"FileEditorInput",
")",
"{",
"IFile",
"file",
"=",
"(",
"(",
"FileEditorInput",
")",
"input",
")",
".",
"getFile",
"(",
")",
";",
"return",
"file",
".",
"getProject",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"IPresentationReconciler",
"getPresentationReconciler",
"(",
"ISourceViewer",
"sourceViewer",
")",
"{",
"PresentationReconciler",
"reconciler",
"=",
"(",
"PresentationReconciler",
")",
"super",
".",
"getPresentationReconciler",
"(",
"sourceViewer",
")",
";",
"DefaultDamagerRepairer",
"dr",
"=",
"new",
"DefaultDamagerRepairer",
"(",
"getStringScanner",
"(",
")",
")",
";",
"reconciler",
".",
"setDamager",
"(",
"dr",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"reconciler",
".",
"setRepairer",
"(",
"dr",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"return",
"reconciler",
";",
"}",
"@",
"Override",
"public",
"String",
"[",
"]",
"getConfiguredContentTypes",
"(",
"ISourceViewer",
"sourceViewer",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"IDocument",
".",
"DEFAULT_CONTENT_TYPE",
",",
"IJavaPartitions",
".",
"JAVA_DOC",
",",
"IJavaPartitions",
".",
"JAVA_MULTI_LINE_COMMENT",
",",
"IJavaPartitions",
".",
"JAVA_SINGLE_LINE_COMMENT",
",",
"IJavaPartitions",
".",
"JAVA_STRING",
",",
"IJavaPartitions",
".",
"JAVA_CHARACTER",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
"}",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"IContentAssistant",
"getContentAssistant",
"(",
"ISourceViewer",
"sourceViewer",
")",
"{",
"ContentAssistant",
"assistant",
"=",
"(",
"ContentAssistant",
")",
"super",
".",
"getContentAssistant",
"(",
"sourceViewer",
")",
";",
"ContentAssistProcessor",
"stringProcessor",
"=",
"new",
"JavaCompletionProcessor",
"(",
"getEditor",
"(",
")",
",",
"assistant",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"assistant",
".",
"setContentAssistProcessor",
"(",
"stringProcessor",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"IContentAssistProcessor",
"processor",
"=",
"assistant",
".",
"getContentAssistProcessor",
"(",
"IDocument",
".",
"DEFAULT_CONTENT_TYPE",
")",
";",
"List",
"<",
"CompletionProposalCategory",
">",
"categories",
"=",
"(",
"List",
"<",
"CompletionProposalCategory",
">",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"ContentAssistProcessor",
".",
"class",
",",
"\"fCategories\"",
",",
"processor",
")",
";",
"List",
"<",
"CompletionProposalCategory",
">",
"newCategories",
"=",
"new",
"ArrayList",
"<",
"CompletionProposalCategory",
">",
"(",
"categories",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"for",
"(",
"CompletionProposalCategory",
"category",
":",
"categories",
")",
"{",
"if",
"(",
"!",
"category",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
"&&",
"!",
"category",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
"&&",
"!",
"category",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
"&&",
"!",
"category",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"newCategories",
".",
"add",
"(",
"category",
")",
";",
"}",
"}",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"ContentAssistProcessor",
".",
"class",
",",
"\"fCategories\"",
",",
"processor",
",",
"newCategories",
")",
";",
"return",
"assistant",
";",
"}",
"@",
"Override",
"public",
"IInformationPresenter",
"getOutlinePresenter",
"(",
"ISourceViewer",
"sourceViewer",
",",
"boolean",
"doCodeResolve",
")",
"{",
"IInformationPresenter",
"presenter",
"=",
"super",
".",
"getOutlinePresenter",
"(",
"sourceViewer",
",",
"doCodeResolve",
")",
";",
"if",
"(",
"presenter",
"instanceof",
"InformationPresenter",
")",
"{",
"IInformationProvider",
"provider",
"=",
"presenter",
".",
"getInformationProvider",
"(",
"IDocument",
".",
"DEFAULT_CONTENT_TYPE",
")",
";",
"(",
"(",
"InformationPresenter",
")",
"presenter",
")",
".",
"setInformationProvider",
"(",
"provider",
",",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
")",
";",
"}",
"return",
"presenter",
";",
"}",
"@",
"Override",
"public",
"IQuickAssistAssistant",
"getQuickAssistAssistant",
"(",
"ISourceViewer",
"sourceViewer",
")",
"{",
"return",
"super",
".",
"getQuickAssistAssistant",
"(",
"sourceViewer",
")",
";",
"}",
"@",
"Override",
"public",
"IAutoEditStrategy",
"[",
"]",
"getAutoEditStrategies",
"(",
"ISourceViewer",
"sourceViewer",
",",
"String",
"contentType",
")",
"{",
"if",
"(",
"GroovyPartitionScanner",
".",
"GROOVY_MULTILINE_STRINGS",
".",
"equals",
"(",
"contentType",
")",
"||",
"IJavaPartitions",
".",
"JAVA_STRING",
".",
"equals",
"(",
"contentType",
")",
")",
"{",
"return",
"new",
"IAutoEditStrategy",
"[",
"]",
"{",
"new",
"GroovyMultilineStringAutoEditStrategy",
"(",
"contentType",
")",
"}",
";",
"}",
"IAutoEditStrategy",
"[",
"]",
"strats",
"=",
"super",
".",
"getAutoEditStrategies",
"(",
"sourceViewer",
",",
"contentType",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strats",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"strats",
"[",
"i",
"]",
"instanceof",
"JavaAutoIndentStrategy",
")",
"{",
"strats",
"[",
"i",
"]",
"=",
"new",
"GroovyAutoIndentStrategy",
"(",
"contentType",
",",
"(",
"JavaAutoIndentStrategy",
")",
"strats",
"[",
"i",
"]",
")",
";",
"}",
"}",
"return",
"strats",
";",
"}",
"@",
"Override",
"public",
"IInformationPresenter",
"getInformationPresenter",
"(",
"ISourceViewer",
"sourceViewer",
")",
"{",
"IInformationPresenter",
"informationPresenter",
"=",
"super",
".",
"getInformationPresenter",
"(",
"sourceViewer",
")",
";",
"try",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"\"\"",
")",
";",
"JavaInformationProvider",
"provider",
"=",
"(",
"JavaInformationProvider",
")",
"informationPresenter",
".",
"getInformationProvider",
"(",
"IDocument",
".",
"DEFAULT_CONTENT_TYPE",
")",
";",
"IJavaEditorTextHover",
"implementation",
"=",
"(",
"IJavaEditorTextHover",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaInformationProvider",
".",
"class",
",",
"\"\"",
",",
"provider",
")",
";",
"GroovyExtraInformationHover",
"hover",
"=",
"new",
"GroovyExtraInformationHover",
"(",
"true",
")",
";",
"hover",
".",
"setEditor",
"(",
"this",
".",
"getEditor",
"(",
")",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"clazz",
",",
"\"\"",
",",
"implementation",
",",
"hover",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"}",
"return",
"informationPresenter",
";",
"}",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"@",
"Override",
"protected",
"Map",
"getHyperlinkDetectorTargets",
"(",
"ISourceViewer",
"sourceViewer",
")",
"{",
"Map",
"targets",
"=",
"super",
".",
"getHyperlinkDetectorTargets",
"(",
"sourceViewer",
")",
";",
"targets",
".",
"put",
"(",
"\"\"",
",",
"getEditor",
"(",
")",
")",
";",
"return",
"targets",
";",
"}",
"}",
"</s>"
] |
6,322 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
".",
"OutlineExtenderRegistry",
";",
"public",
"class",
"GroovyOutlineTools",
"{",
"private",
"OutlineExtenderRegistry",
"outlineExtenderRegistry",
";",
"public",
"void",
"dispose",
"(",
")",
"{",
"outlineExtenderRegistry",
"=",
"null",
";",
"}",
"public",
"OutlineExtenderRegistry",
"getOutlineExtenderRegistry",
"(",
")",
"{",
"if",
"(",
"outlineExtenderRegistry",
"==",
"null",
")",
"{",
"outlineExtenderRegistry",
"=",
"new",
"OutlineExtenderRegistry",
"(",
")",
";",
"outlineExtenderRegistry",
".",
"initialize",
"(",
")",
";",
"}",
"return",
"outlineExtenderRegistry",
";",
"}",
"}",
"</s>"
] |
6,323 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
";",
"import",
"java",
".",
"util",
".",
"SortedSet",
";",
"import",
"java",
".",
"util",
".",
"TreeSet",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotatedNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"PropertyNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightedTypedPosition",
".",
"HighlightKind",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"ITypeRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeLookupResult",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeLookupResult",
".",
"TypeConfidence",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"public",
"class",
"SemanticHighlightingReferenceRequestor",
"extends",
"SemanticReferenceRequestor",
"implements",
"ITypeRequestor",
"{",
"SortedSet",
"<",
"HighlightedTypedPosition",
">",
"typedPosition",
"=",
"new",
"TreeSet",
"<",
"HighlightedTypedPosition",
">",
"(",
")",
";",
"final",
"char",
"[",
"]",
"contents",
";",
"public",
"SemanticHighlightingReferenceRequestor",
"(",
"char",
"[",
"]",
"contents",
")",
"{",
"this",
".",
"contents",
"=",
"contents",
";",
"}",
"public",
"VisitStatus",
"acceptASTNode",
"(",
"ASTNode",
"node",
",",
"TypeLookupResult",
"result",
",",
"IJavaElement",
"enclosingElement",
")",
"{",
"if",
"(",
"!",
"(",
"node",
"instanceof",
"AnnotatedNode",
")",
")",
"{",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"if",
"(",
"node",
".",
"getEnd",
"(",
")",
"<=",
"0",
"||",
"(",
"node",
".",
"getStart",
"(",
")",
"==",
"0",
"&&",
"node",
".",
"getEnd",
"(",
")",
"==",
"1",
")",
")",
"{",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"HighlightedTypedPosition",
"pos",
"=",
"null",
";",
"if",
"(",
"result",
".",
"confidence",
"==",
"TypeConfidence",
".",
"UNKNOWN",
"&&",
"node",
".",
"getEnd",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"isRealASTNode",
"(",
"node",
")",
")",
"{",
"Position",
"p",
"=",
"getPosition",
"(",
"node",
")",
";",
"typedPosition",
".",
"add",
"(",
"new",
"HighlightedTypedPosition",
"(",
"p",
",",
"HighlightKind",
".",
"UNKNOWN",
")",
")",
";",
"return",
"VisitStatus",
".",
"CANCEL_BRANCH",
";",
"}",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"AnnotatedNode",
"&&",
"isDeprecated",
"(",
"result",
".",
"declaration",
")",
")",
"{",
"Position",
"p",
"=",
"getPosition",
"(",
"node",
")",
";",
"pos",
"=",
"new",
"HighlightedTypedPosition",
"(",
"p",
",",
"HighlightKind",
".",
"DEPRECATED",
")",
";",
"}",
"else",
"if",
"(",
"result",
".",
"declaration",
"instanceof",
"FieldNode",
"||",
"result",
".",
"declaration",
"instanceof",
"PropertyNode",
")",
"{",
"Position",
"p",
"=",
"getPosition",
"(",
"node",
")",
";",
"if",
"(",
"isStatic",
"(",
"result",
".",
"declaration",
")",
")",
"{",
"pos",
"=",
"new",
"HighlightedTypedPosition",
"(",
"p",
",",
"HighlightKind",
".",
"STATIC_FIELD",
")",
";",
"}",
"else",
"{",
"pos",
"=",
"new",
"HighlightedTypedPosition",
"(",
"p",
",",
"HighlightKind",
".",
"FIELD",
")",
";",
"}",
"}",
"else",
"if",
"(",
"result",
".",
"declaration",
"instanceof",
"MethodNode",
")",
"{",
"Position",
"p",
"=",
"getPosition",
"(",
"node",
")",
";",
"if",
"(",
"isStatic",
"(",
"result",
".",
"declaration",
")",
")",
"{",
"pos",
"=",
"new",
"HighlightedTypedPosition",
"(",
"p",
",",
"HighlightKind",
".",
"STATIC_METHOD",
")",
";",
"}",
"else",
"{",
"pos",
"=",
"new",
"HighlightedTypedPosition",
"(",
"p",
",",
"HighlightKind",
".",
"METHOD",
")",
";",
"}",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"ConstantExpression",
"&&",
"node",
".",
"getStart",
"(",
")",
"<",
"contents",
".",
"length",
")",
"{",
"if",
"(",
"contents",
"[",
"node",
".",
"getStart",
"(",
")",
"]",
"==",
"'/'",
")",
"{",
"Position",
"p",
"=",
"getPosition",
"(",
"node",
")",
";",
"pos",
"=",
"new",
"HighlightedTypedPosition",
"(",
"p",
",",
"HighlightKind",
".",
"REGEX",
")",
";",
"}",
"else",
"if",
"(",
"isNumber",
"(",
"(",
"(",
"ConstantExpression",
")",
"node",
")",
".",
"getType",
"(",
")",
")",
")",
"{",
"Position",
"p",
"=",
"getPosition",
"(",
"node",
")",
";",
"pos",
"=",
"new",
"HighlightedTypedPosition",
"(",
"p",
",",
"HighlightKind",
".",
"NUMBER",
")",
";",
"}",
"}",
"if",
"(",
"pos",
"!=",
"null",
"&&",
"(",
"(",
"pos",
".",
"getOffset",
"(",
")",
">",
"0",
"||",
"pos",
".",
"getLength",
"(",
")",
">",
"1",
")",
"||",
"node",
"instanceof",
"Expression",
")",
")",
"{",
"typedPosition",
".",
"add",
"(",
"pos",
")",
";",
"}",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"private",
"boolean",
"isRealASTNode",
"(",
"ASTNode",
"node",
")",
"{",
"int",
"contentsLen",
"=",
"contents",
".",
"length",
";",
"String",
"text",
"=",
"node",
".",
"getText",
"(",
")",
";",
"if",
"(",
"text",
".",
"length",
"(",
")",
"!=",
"node",
".",
"getLength",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"char",
"[",
"]",
"textArr",
"=",
"text",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"node",
".",
"getStart",
"(",
")",
";",
"i",
"<",
"textArr",
".",
"length",
"&&",
"j",
"<",
"contentsLen",
";",
"i",
"++",
",",
"j",
"++",
")",
"{",
"if",
"(",
"textArr",
"[",
"i",
"]",
"!=",
"contents",
"[",
"j",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
6,324 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"IRule",
";",
"public",
"interface",
"IHighlightingExtender",
"{",
"public",
"List",
"<",
"String",
">",
"getAdditionalGroovyKeywords",
"(",
")",
";",
"public",
"List",
"<",
"String",
">",
"getAdditionalGJDKKeywords",
"(",
")",
";",
"public",
"List",
"<",
"IRule",
">",
"getAdditionalRules",
"(",
")",
";",
"}",
"</s>"
] |
6,325 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorWithRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"public",
"class",
"GatherSemanticReferences",
"{",
"private",
"final",
"GroovyCompilationUnit",
"unit",
";",
"private",
"final",
"IPreferenceStore",
"preferences",
";",
"public",
"GatherSemanticReferences",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"this",
".",
"unit",
"=",
"unit",
";",
"preferences",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"}",
"public",
"Collection",
"<",
"HighlightedTypedPosition",
">",
"findSemanticHighlightingReferences",
"(",
")",
"{",
"if",
"(",
"preferences",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"GROOVY_SEMANTIC_HIGHLIGHTING",
")",
")",
"{",
"try",
"{",
"SemanticHighlightingReferenceRequestor",
"typeRequestor",
"=",
"new",
"SemanticHighlightingReferenceRequestor",
"(",
"unit",
".",
"getContents",
"(",
")",
")",
";",
"TypeInferencingVisitorWithRequestor",
"visitor",
"=",
"new",
"TypeInferencingVisitorFactory",
"(",
")",
".",
"createVisitor",
"(",
"unit",
")",
";",
"visitor",
".",
"visitCompilationUnit",
"(",
"typeRequestor",
")",
";",
"return",
"typeRequestor",
".",
"typedPosition",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,326 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotatedNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotationNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassHelper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ImportNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"PropertyNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"StaticMethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"JDTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"ITypeRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"import",
"org",
".",
"objectweb",
".",
"asm",
".",
"Opcodes",
";",
"public",
"abstract",
"class",
"SemanticReferenceRequestor",
"implements",
"ITypeRequestor",
"{",
"protected",
"boolean",
"isNumber",
"(",
"ClassNode",
"type",
")",
"{",
"return",
"ClassHelper",
".",
"isNumberType",
"(",
"type",
")",
"||",
"type",
"==",
"ClassHelper",
".",
"BigDecimal_TYPE",
"||",
"type",
"==",
"ClassHelper",
".",
"BigInteger_TYPE",
";",
"}",
"protected",
"Position",
"getPosition",
"(",
"ASTNode",
"node",
")",
"{",
"int",
"start",
",",
"length",
";",
"if",
"(",
"node",
"instanceof",
"MethodNode",
"||",
"node",
"instanceof",
"FieldNode",
"||",
"node",
"instanceof",
"PropertyNode",
"||",
"(",
"node",
"instanceof",
"ClassNode",
"&&",
"(",
"(",
"ClassNode",
")",
"node",
")",
".",
"getNameEnd",
"(",
")",
">",
"0",
")",
")",
"{",
"AnnotatedNode",
"an",
"=",
"(",
"AnnotatedNode",
")",
"node",
";",
"start",
"=",
"an",
".",
"getNameStart",
"(",
")",
";",
"length",
"=",
"an",
".",
"getNameEnd",
"(",
")",
"-",
"start",
"+",
"1",
";",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"ImportNode",
")",
"{",
"ClassNode",
"clazz",
"=",
"(",
"(",
"ImportNode",
")",
"node",
")",
".",
"getType",
"(",
")",
";",
"start",
"=",
"clazz",
".",
"getStart",
"(",
")",
";",
"length",
"=",
"clazz",
".",
"getLength",
"(",
")",
";",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"StaticMethodCallExpression",
")",
"{",
"start",
"=",
"node",
".",
"getStart",
"(",
")",
";",
"length",
"=",
"(",
"(",
"StaticMethodCallExpression",
")",
"node",
")",
".",
"getMethod",
"(",
")",
".",
"length",
"(",
")",
";",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"MethodCallExpression",
")",
"{",
"Expression",
"e",
"=",
"(",
"(",
"MethodCallExpression",
")",
"node",
")",
".",
"getMethod",
"(",
")",
";",
"start",
"=",
"e",
".",
"getStart",
"(",
")",
";",
"length",
"=",
"e",
".",
"getLength",
"(",
")",
";",
"}",
"else",
"{",
"start",
"=",
"node",
".",
"getStart",
"(",
")",
";",
"length",
"=",
"node",
".",
"getLength",
"(",
")",
";",
"}",
"return",
"new",
"Position",
"(",
"start",
",",
"length",
")",
";",
"}",
"protected",
"boolean",
"isDeprecated",
"(",
"ASTNode",
"declaration",
")",
"{",
"if",
"(",
"declaration",
"instanceof",
"ClassNode",
")",
"{",
"declaration",
"=",
"(",
"(",
"ClassNode",
")",
"declaration",
")",
".",
"redirect",
"(",
")",
";",
"}",
"if",
"(",
"declaration",
"instanceof",
"PropertyNode",
"&&",
"(",
"(",
"PropertyNode",
")",
"declaration",
")",
".",
"getField",
"(",
")",
"!=",
"null",
")",
"{",
"declaration",
"=",
"(",
"(",
"PropertyNode",
")",
"declaration",
")",
".",
"getField",
"(",
")",
";",
"}",
"if",
"(",
"declaration",
"instanceof",
"JDTNode",
")",
"{",
"return",
"(",
"(",
"JDTNode",
")",
"declaration",
")",
".",
"isDeprecated",
"(",
")",
";",
"}",
"else",
"if",
"(",
"declaration",
"instanceof",
"ClassNode",
"||",
"declaration",
"instanceof",
"FieldNode",
"||",
"declaration",
"instanceof",
"MethodNode",
")",
"{",
"return",
"hasDeprecatedAnnotation",
"(",
"(",
"AnnotatedNode",
")",
"declaration",
")",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"hasDeprecatedAnnotation",
"(",
"AnnotatedNode",
"declaration",
")",
"{",
"if",
"(",
"isDeprecated",
"(",
"declaration",
")",
")",
"{",
"return",
"true",
";",
"}",
"List",
"<",
"AnnotationNode",
">",
"anns",
"=",
"declaration",
".",
"getAnnotations",
"(",
")",
";",
"for",
"(",
"AnnotationNode",
"ann",
":",
"anns",
")",
"{",
"if",
"(",
"ann",
".",
"getClassNode",
"(",
")",
"!=",
"null",
"&&",
"ann",
".",
"getClassNode",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isDeprecated",
"(",
"AnnotatedNode",
"declaration",
")",
"{",
"int",
"flags",
";",
"if",
"(",
"declaration",
"instanceof",
"ClassNode",
")",
"{",
"flags",
"=",
"(",
"(",
"ClassNode",
")",
"declaration",
")",
".",
"getModifiers",
"(",
")",
";",
"}",
"else",
"if",
"(",
"declaration",
"instanceof",
"MethodNode",
")",
"{",
"flags",
"=",
"(",
"(",
"MethodNode",
")",
"declaration",
")",
".",
"getModifiers",
"(",
")",
";",
"}",
"else",
"if",
"(",
"declaration",
"instanceof",
"FieldNode",
")",
"{",
"flags",
"=",
"(",
"(",
"FieldNode",
")",
"declaration",
")",
".",
"getModifiers",
"(",
")",
";",
"}",
"else",
"{",
"flags",
"=",
"0",
";",
"}",
"return",
"(",
"flags",
"&",
"Opcodes",
".",
"ACC_DEPRECATED",
")",
"!=",
"0",
";",
"}",
"protected",
"boolean",
"isStatic",
"(",
"ASTNode",
"declaration",
")",
"{",
"return",
"(",
"declaration",
"instanceof",
"MethodNode",
"&&",
"(",
"(",
"MethodNode",
")",
"declaration",
")",
".",
"isStatic",
"(",
")",
")",
"||",
"(",
"declaration",
"instanceof",
"PropertyNode",
"&&",
"(",
"(",
"PropertyNode",
")",
"declaration",
")",
".",
"isStatic",
"(",
")",
")",
"||",
"(",
"declaration",
"instanceof",
"FieldNode",
"&&",
"(",
"(",
"FieldNode",
")",
"declaration",
")",
".",
"isStatic",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,327 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"public",
"class",
"HighlightedTypedPosition",
"extends",
"Position",
"implements",
"Comparable",
"<",
"HighlightedTypedPosition",
">",
"{",
"public",
"static",
"enum",
"HighlightKind",
"{",
"DEPRECATED",
",",
"FIELD",
",",
"METHOD",
",",
"STATIC_FIELD",
",",
"STATIC_METHOD",
",",
"REGEX",
",",
"NUMBER",
",",
"UNKNOWN",
"}",
"public",
"final",
"HighlightKind",
"kind",
";",
"public",
"HighlightedTypedPosition",
"(",
"Position",
"p",
",",
"HighlightKind",
"kind",
")",
"{",
"super",
"(",
"p",
".",
"getOffset",
"(",
")",
",",
"p",
".",
"getLength",
"(",
")",
")",
";",
"this",
".",
"kind",
"=",
"kind",
";",
"}",
"public",
"HighlightedTypedPosition",
"(",
"int",
"offset",
",",
"HighlightKind",
"kind",
")",
"{",
"super",
"(",
"offset",
")",
";",
"this",
".",
"kind",
"=",
"kind",
";",
"}",
"public",
"HighlightedTypedPosition",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"HighlightKind",
"kind",
")",
"{",
"super",
"(",
"offset",
",",
"length",
")",
";",
"this",
".",
"kind",
"=",
"kind",
";",
"}",
"@",
"Override",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"this",
"==",
"obj",
")",
"return",
"true",
";",
"if",
"(",
"!",
"super",
".",
"equals",
"(",
"obj",
")",
")",
"return",
"false",
";",
"if",
"(",
"getClass",
"(",
")",
"!=",
"obj",
".",
"getClass",
"(",
")",
")",
"return",
"false",
";",
"HighlightedTypedPosition",
"other",
"=",
"(",
"HighlightedTypedPosition",
")",
"obj",
";",
"if",
"(",
"kind",
"!=",
"other",
".",
"kind",
")",
"return",
"false",
";",
"return",
"true",
";",
"}",
"@",
"Override",
"public",
"int",
"hashCode",
"(",
")",
"{",
"final",
"int",
"prime",
"=",
"31",
";",
"int",
"result",
"=",
"super",
".",
"hashCode",
"(",
")",
";",
"result",
"=",
"prime",
"*",
"result",
"+",
"(",
"(",
"kind",
"==",
"null",
")",
"?",
"0",
":",
"kind",
".",
"hashCode",
"(",
")",
")",
";",
"return",
"result",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"kind",
"+",
"\",",
"offset=\"",
"+",
"offset",
"+",
"\",",
"length=\"",
"+",
"length",
"+",
"\",",
"isDeleted=\"",
"+",
"isDeleted",
"+",
"\"]\"",
";",
"}",
"public",
"int",
"compareTo",
"(",
"HighlightedTypedPosition",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"1",
";",
"}",
"return",
"this",
".",
"offset",
"-",
"o",
".",
"offset",
";",
"}",
"}",
"</s>"
] |
6,328 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"HighlightedPosition",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"HighlightingStyle",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"SemanticHighlightingPresenter",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyColorManager",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaSourceViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"JavaPresentationReconciler",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"IJavaReconcilingListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferenceConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextAttribute",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextPresentation",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Color",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"RGB",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPartSite",
";",
"public",
"class",
"GroovySemanticReconciler",
"implements",
"IJavaReconcilingListener",
"{",
"private",
"final",
"Object",
"fReconcileLock",
"=",
"new",
"Object",
"(",
")",
";",
"private",
"GroovyEditor",
"editor",
";",
"private",
"HighlightingStyle",
"undefinedRefHighlighting",
";",
"private",
"HighlightingStyle",
"regexRefHighlighting",
";",
"private",
"HighlightingStyle",
"deprecatedRefHighlighting",
";",
"private",
"HighlightingStyle",
"fieldRefHighlighting",
";",
"private",
"HighlightingStyle",
"staticFieldRefHighlighting",
";",
"private",
"HighlightingStyle",
"methodRefHighlighting",
";",
"private",
"HighlightingStyle",
"staticMethodRefHighlighting",
";",
"private",
"HighlightingStyle",
"numberRefHighlighting",
";",
"private",
"SemanticHighlightingPresenter",
"presenter",
";",
"private",
"boolean",
"fIsReconciling",
"=",
"false",
";",
"public",
"GroovySemanticReconciler",
"(",
")",
"{",
"RGB",
"rgbString",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
")",
";",
"RGB",
"rgbNumber",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
")",
";",
"RGB",
"rgbField",
"=",
"findRGB",
"(",
"\"\"",
",",
"new",
"RGB",
"(",
"0",
",",
"0",
",",
"192",
")",
")",
";",
"RGB",
"rgbMethod",
"=",
"findRGB",
"(",
"\"\"",
",",
"new",
"RGB",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"GroovyColorManager",
"colorManager",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getTextTools",
"(",
")",
".",
"getColorManager",
"(",
")",
";",
"Color",
"regexColor",
"=",
"colorManager",
".",
"getColor",
"(",
"rgbString",
")",
";",
"Color",
"fieldColor",
"=",
"colorManager",
".",
"getColor",
"(",
"rgbField",
")",
";",
"Color",
"methodColor",
"=",
"colorManager",
".",
"getColor",
"(",
"rgbMethod",
")",
";",
"Color",
"numberColor",
"=",
"colorManager",
".",
"getColor",
"(",
"rgbNumber",
")",
";",
"undefinedRefHighlighting",
"=",
"new",
"HighlightingStyle",
"(",
"new",
"TextAttribute",
"(",
"null",
",",
"null",
",",
"TextAttribute",
".",
"UNDERLINE",
")",
",",
"true",
")",
";",
"regexRefHighlighting",
"=",
"new",
"HighlightingStyle",
"(",
"new",
"TextAttribute",
"(",
"regexColor",
",",
"null",
",",
"SWT",
".",
"ITALIC",
")",
",",
"true",
")",
";",
"numberRefHighlighting",
"=",
"new",
"HighlightingStyle",
"(",
"new",
"TextAttribute",
"(",
"numberColor",
")",
",",
"true",
")",
";",
"deprecatedRefHighlighting",
"=",
"new",
"HighlightingStyle",
"(",
"new",
"TextAttribute",
"(",
"null",
",",
"null",
",",
"TextAttribute",
".",
"STRIKETHROUGH",
")",
",",
"true",
")",
";",
"fieldRefHighlighting",
"=",
"new",
"HighlightingStyle",
"(",
"new",
"TextAttribute",
"(",
"fieldColor",
")",
",",
"true",
")",
";",
"staticFieldRefHighlighting",
"=",
"new",
"HighlightingStyle",
"(",
"new",
"TextAttribute",
"(",
"fieldColor",
",",
"null",
",",
"SWT",
".",
"ITALIC",
")",
",",
"true",
")",
";",
"methodRefHighlighting",
"=",
"new",
"HighlightingStyle",
"(",
"new",
"TextAttribute",
"(",
"methodColor",
")",
",",
"true",
")",
";",
"staticMethodRefHighlighting",
"=",
"new",
"HighlightingStyle",
"(",
"new",
"TextAttribute",
"(",
"methodColor",
",",
"null",
",",
"SWT",
".",
"ITALIC",
")",
",",
"true",
")",
";",
"}",
"private",
"static",
"RGB",
"findRGB",
"(",
"String",
"key",
",",
"RGB",
"defaultRGB",
")",
"{",
"return",
"PreferenceConverter",
".",
"getColor",
"(",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
",",
"key",
")",
";",
"}",
"public",
"void",
"install",
"(",
"GroovyEditor",
"editor",
",",
"JavaSourceViewer",
"viewer",
")",
"{",
"this",
".",
"editor",
"=",
"editor",
";",
"this",
".",
"presenter",
"=",
"new",
"SemanticHighlightingPresenter",
"(",
")",
";",
"presenter",
".",
"install",
"(",
"viewer",
",",
"(",
"JavaPresentationReconciler",
")",
"editor",
".",
"getGroovyConfiguration",
"(",
")",
".",
"getPresentationReconciler",
"(",
"viewer",
")",
")",
";",
"}",
"public",
"void",
"uninstall",
"(",
")",
"{",
"presenter",
".",
"uninstall",
"(",
")",
";",
"presenter",
"=",
"null",
";",
"editor",
"=",
"null",
";",
"}",
"public",
"void",
"aboutToBeReconciled",
"(",
")",
"{",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"reconciled",
"(",
"CompilationUnit",
"ast",
",",
"boolean",
"forced",
",",
"IProgressMonitor",
"progressMonitor",
")",
"{",
"synchronized",
"(",
"fReconcileLock",
")",
"{",
"if",
"(",
"fIsReconciling",
")",
"return",
";",
"else",
"fIsReconciling",
"=",
"true",
";",
"}",
"try",
"{",
"progressMonitor",
".",
"beginTask",
"(",
"\"\"",
",",
"100",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"editor",
".",
"getGroovyCompilationUnit",
"(",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"presenter",
".",
"setCanceled",
"(",
"progressMonitor",
".",
"isCanceled",
"(",
")",
")",
";",
"GatherSemanticReferences",
"finder",
"=",
"new",
"GatherSemanticReferences",
"(",
"unit",
")",
";",
"Collection",
"<",
"HighlightedTypedPosition",
">",
"semanticReferences",
"=",
"finder",
".",
"findSemanticHighlightingReferences",
"(",
")",
";",
"progressMonitor",
".",
"worked",
"(",
"50",
")",
";",
"List",
"<",
"HighlightedPosition",
">",
"newPositions",
"=",
"new",
"LinkedList",
"<",
"HighlightedPosition",
">",
"(",
")",
";",
"List",
"<",
"HighlightedPosition",
">",
"removedPositions",
"=",
"new",
"LinkedList",
"<",
"HighlightedPosition",
">",
"(",
")",
";",
"for",
"(",
"HighlightedPosition",
"oldPosition",
":",
"(",
"Iterable",
"<",
"HighlightedPosition",
">",
")",
"presenter",
".",
"fPositions",
")",
"{",
"if",
"(",
"oldPosition",
"!=",
"null",
")",
"{",
"removedPositions",
".",
"add",
"(",
"oldPosition",
")",
";",
"}",
"}",
"progressMonitor",
".",
"worked",
"(",
"20",
")",
";",
"List",
"<",
"HighlightedPosition",
">",
"semanticReferencesHighlighted",
"=",
"new",
"ArrayList",
"<",
"HighlightedPosition",
">",
"(",
"semanticReferences",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"HighlightedTypedPosition",
"pos",
":",
"semanticReferences",
")",
"{",
"HighlightedPosition",
"range",
"=",
"createHighlightedPosition",
"(",
"pos",
")",
";",
"maybeAddPosition",
"(",
"newPositions",
",",
"removedPositions",
",",
"range",
")",
";",
"semanticReferencesHighlighted",
".",
"add",
"(",
"range",
")",
";",
"}",
"progressMonitor",
".",
"worked",
"(",
"20",
")",
";",
"TextPresentation",
"textPresentation",
"=",
"null",
";",
"if",
"(",
"!",
"presenter",
".",
"isCanceled",
"(",
")",
")",
"{",
"textPresentation",
"=",
"presenter",
".",
"createPresentation",
"(",
"newPositions",
",",
"removedPositions",
")",
";",
"}",
"if",
"(",
"!",
"presenter",
".",
"isCanceled",
"(",
")",
")",
"{",
"updatePresentation",
"(",
"textPresentation",
",",
"newPositions",
",",
"removedPositions",
")",
";",
"}",
"progressMonitor",
".",
"worked",
"(",
"10",
")",
";",
"}",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"}",
"finally",
"{",
"synchronized",
"(",
"fReconcileLock",
")",
"{",
"fIsReconciling",
"=",
"false",
";",
"}",
"}",
"}",
"private",
"HighlightedPosition",
"createHighlightedPosition",
"(",
"HighlightedTypedPosition",
"pos",
")",
"{",
"switch",
"(",
"pos",
".",
"kind",
")",
"{",
"case",
"UNKNOWN",
":",
"return",
"new",
"HighlightedPosition",
"(",
"pos",
".",
"offset",
",",
"pos",
".",
"length",
",",
"undefinedRefHighlighting",
",",
"this",
")",
";",
"case",
"NUMBER",
":",
"return",
"new",
"HighlightedPosition",
"(",
"pos",
".",
"offset",
",",
"pos",
".",
"length",
",",
"numberRefHighlighting",
",",
"this",
")",
";",
"case",
"REGEX",
":",
"return",
"new",
"HighlightedPosition",
"(",
"pos",
".",
"offset",
",",
"pos",
".",
"length",
",",
"regexRefHighlighting",
",",
"this",
")",
";",
"case",
"DEPRECATED",
":",
"return",
"new",
"HighlightedPosition",
"(",
"pos",
".",
"offset",
",",
"pos",
".",
"length",
",",
"deprecatedRefHighlighting",
",",
"this",
")",
";",
"case",
"FIELD",
":",
"return",
"new",
"HighlightedPosition",
"(",
"pos",
".",
"offset",
",",
"pos",
".",
"length",
",",
"fieldRefHighlighting",
",",
"this",
")",
";",
"case",
"STATIC_FIELD",
":",
"return",
"new",
"HighlightedPosition",
"(",
"pos",
".",
"offset",
",",
"pos",
".",
"length",
",",
"staticFieldRefHighlighting",
",",
"this",
")",
";",
"case",
"METHOD",
":",
"return",
"new",
"HighlightedPosition",
"(",
"pos",
".",
"offset",
",",
"pos",
".",
"length",
",",
"methodRefHighlighting",
",",
"this",
")",
";",
"case",
"STATIC_METHOD",
":",
"return",
"new",
"HighlightedPosition",
"(",
"pos",
".",
"offset",
",",
"pos",
".",
"length",
",",
"staticMethodRefHighlighting",
",",
"this",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"void",
"maybeAddPosition",
"(",
"List",
"<",
"HighlightedPosition",
">",
"newPositions",
",",
"List",
"<",
"HighlightedPosition",
">",
"oldPositionsCopy",
",",
"HighlightedPosition",
"maybePosition",
")",
"{",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"Iterator",
"<",
"HighlightedPosition",
">",
"positionIter",
"=",
"oldPositionsCopy",
".",
"iterator",
"(",
")",
";",
"positionIter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"HighlightedPosition",
"oldPosition",
"=",
"positionIter",
".",
"next",
"(",
")",
";",
"if",
"(",
"oldPosition",
".",
"isEqual",
"(",
"maybePosition",
".",
"offset",
",",
"maybePosition",
".",
"length",
",",
"maybePosition",
".",
"getHighlighting",
"(",
")",
")",
")",
"{",
"positionIter",
".",
"remove",
"(",
")",
";",
"found",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"found",
")",
"{",
"newPositions",
".",
"add",
"(",
"maybePosition",
")",
";",
"}",
"}",
"private",
"void",
"updatePresentation",
"(",
"TextPresentation",
"textPresentation",
",",
"List",
"<",
"HighlightedPosition",
">",
"addedPositions",
",",
"List",
"<",
"HighlightedPosition",
">",
"removedPositions",
")",
"{",
"Runnable",
"runnable",
"=",
"presenter",
".",
"createUpdateRunnable",
"(",
"textPresentation",
",",
"addedPositions",
",",
"removedPositions",
")",
";",
"if",
"(",
"runnable",
"==",
"null",
")",
"return",
";",
"JavaEditor",
"thisEditor",
"=",
"editor",
";",
"if",
"(",
"thisEditor",
"==",
"null",
")",
"return",
";",
"IWorkbenchPartSite",
"site",
"=",
"thisEditor",
".",
"getSite",
"(",
")",
";",
"if",
"(",
"site",
"==",
"null",
")",
"return",
";",
"Shell",
"shell",
"=",
"site",
".",
"getShell",
"(",
")",
";",
"if",
"(",
"shell",
"==",
"null",
"||",
"shell",
".",
"isDisposed",
"(",
")",
")",
"return",
";",
"Display",
"display",
"=",
"shell",
".",
"getDisplay",
"(",
")",
";",
"if",
"(",
"display",
"==",
"null",
"||",
"display",
".",
"isDisposed",
"(",
")",
")",
"return",
";",
"display",
".",
"asyncExec",
"(",
"runnable",
")",
";",
"}",
"}",
"</s>"
] |
6,329 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"AbstractJavaScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"CombinedWordRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"CombinedWordRule",
".",
"WordMatcher",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"JavaWhitespaceDetector",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"JavaWordDetector",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"JavaCodeScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IColorManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"ICharacterScanner",
";",
"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",
".",
"IWordDetector",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"NumberRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"SingleLineRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"Token",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"WhitespaceRule",
";",
"public",
"class",
"GroovyTagScanner",
"extends",
"AbstractJavaScanner",
"{",
"protected",
"class",
"OperatorRule",
"implements",
"IRule",
"{",
"private",
"final",
"char",
"[",
"]",
"JAVA_OPERATORS",
"=",
"{",
"';'",
",",
"'('",
",",
"')'",
",",
"'{'",
",",
"'}'",
",",
"'.'",
",",
"'='",
",",
"'/'",
",",
"'\\\\'",
",",
"'+'",
",",
"'-'",
",",
"'*'",
",",
"'['",
",",
"']'",
",",
"'<'",
",",
"'>'",
",",
"':'",
",",
"'?'",
",",
"'!'",
",",
"','",
",",
"'|'",
",",
"'&'",
",",
"'^'",
",",
"'%'",
",",
"'~'",
"}",
";",
"private",
"final",
"IToken",
"fToken",
";",
"public",
"OperatorRule",
"(",
"IToken",
"token",
")",
"{",
"fToken",
"=",
"token",
";",
"}",
"public",
"boolean",
"isOperator",
"(",
"char",
"character",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"JAVA_OPERATORS",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"JAVA_OPERATORS",
"[",
"index",
"]",
"==",
"character",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"IToken",
"evaluate",
"(",
"ICharacterScanner",
"scanner",
")",
"{",
"int",
"character",
"=",
"scanner",
".",
"read",
"(",
")",
";",
"if",
"(",
"isOperator",
"(",
"(",
"char",
")",
"character",
")",
")",
"{",
"do",
"{",
"character",
"=",
"scanner",
".",
"read",
"(",
")",
";",
"}",
"while",
"(",
"isOperator",
"(",
"(",
"char",
")",
"character",
")",
")",
";",
"scanner",
".",
"unread",
"(",
")",
";",
"return",
"fToken",
";",
"}",
"else",
"{",
"scanner",
".",
"unread",
"(",
")",
";",
"return",
"Token",
".",
"UNDEFINED",
";",
"}",
"}",
"}",
"private",
"static",
"final",
"class",
"BracketRule",
"implements",
"IRule",
"{",
"private",
"final",
"char",
"[",
"]",
"JAVA_BRACKETS",
"=",
"{",
"'('",
",",
"')'",
",",
"'{'",
",",
"'}'",
",",
"'['",
",",
"']'",
"}",
";",
"private",
"final",
"IToken",
"fToken",
";",
"public",
"BracketRule",
"(",
"IToken",
"token",
")",
"{",
"fToken",
"=",
"token",
";",
"}",
"public",
"boolean",
"isBracket",
"(",
"char",
"character",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"JAVA_BRACKETS",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"JAVA_BRACKETS",
"[",
"index",
"]",
"==",
"character",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"IToken",
"evaluate",
"(",
"ICharacterScanner",
"scanner",
")",
"{",
"int",
"character",
"=",
"scanner",
".",
"read",
"(",
")",
";",
"if",
"(",
"isBracket",
"(",
"(",
"char",
")",
"character",
")",
")",
"{",
"do",
"{",
"character",
"=",
"scanner",
".",
"read",
"(",
")",
";",
"}",
"while",
"(",
"isBracket",
"(",
"(",
"char",
")",
"character",
")",
")",
";",
"scanner",
".",
"unread",
"(",
")",
";",
"return",
"fToken",
";",
"}",
"else",
"{",
"scanner",
".",
"unread",
"(",
")",
";",
"return",
"Token",
".",
"UNDEFINED",
";",
"}",
"}",
"}",
"private",
"static",
"class",
"AnnotationRule",
"implements",
"IRule",
"{",
"private",
"static",
"final",
"class",
"ResettableScanner",
"implements",
"ICharacterScanner",
"{",
"private",
"final",
"ICharacterScanner",
"fDelegate",
";",
"private",
"int",
"fReadCount",
";",
"public",
"ResettableScanner",
"(",
"final",
"ICharacterScanner",
"scanner",
")",
"{",
"Assert",
".",
"isNotNull",
"(",
"scanner",
")",
";",
"fDelegate",
"=",
"scanner",
";",
"mark",
"(",
")",
";",
"}",
"public",
"int",
"getColumn",
"(",
")",
"{",
"return",
"fDelegate",
".",
"getColumn",
"(",
")",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getLegalLineDelimiters",
"(",
")",
"{",
"return",
"fDelegate",
".",
"getLegalLineDelimiters",
"(",
")",
";",
"}",
"public",
"int",
"read",
"(",
")",
"{",
"int",
"ch",
"=",
"fDelegate",
".",
"read",
"(",
")",
";",
"if",
"(",
"ch",
"!=",
"ICharacterScanner",
".",
"EOF",
")",
"fReadCount",
"++",
";",
"return",
"ch",
";",
"}",
"public",
"void",
"unread",
"(",
")",
"{",
"if",
"(",
"fReadCount",
">",
"0",
")",
"fReadCount",
"--",
";",
"fDelegate",
".",
"unread",
"(",
")",
";",
"}",
"public",
"void",
"mark",
"(",
")",
"{",
"fReadCount",
"=",
"0",
";",
"}",
"public",
"void",
"reset",
"(",
")",
"{",
"while",
"(",
"fReadCount",
">",
"0",
")",
"unread",
"(",
")",
";",
"while",
"(",
"fReadCount",
"<",
"0",
")",
"read",
"(",
")",
";",
"}",
"}",
"private",
"final",
"IWhitespaceDetector",
"fWhitespaceDetector",
"=",
"new",
"JavaWhitespaceDetector",
"(",
")",
";",
"private",
"final",
"IWordDetector",
"fWordDetector",
"=",
"new",
"JavaWordDetector",
"(",
")",
";",
"private",
"final",
"IToken",
"fInterfaceToken",
";",
"private",
"final",
"IToken",
"fAnnotationToken",
";",
"public",
"AnnotationRule",
"(",
"IToken",
"interfaceToken",
",",
"Token",
"annotationToken",
")",
"{",
"fInterfaceToken",
"=",
"interfaceToken",
";",
"fAnnotationToken",
"=",
"annotationToken",
";",
"}",
"public",
"IToken",
"evaluate",
"(",
"ICharacterScanner",
"scanner",
")",
"{",
"ResettableScanner",
"resettable",
"=",
"new",
"ResettableScanner",
"(",
"scanner",
")",
";",
"if",
"(",
"resettable",
".",
"read",
"(",
")",
"==",
"'@'",
")",
"if",
"(",
"skipWhitespace",
"(",
"resettable",
")",
")",
"return",
"readAnnotation",
"(",
"resettable",
")",
";",
"resettable",
".",
"reset",
"(",
")",
";",
"return",
"Token",
".",
"UNDEFINED",
";",
"}",
"private",
"IToken",
"readAnnotation",
"(",
"ResettableScanner",
"scanner",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"!",
"readIdentifier",
"(",
"scanner",
",",
"buffer",
")",
")",
"{",
"scanner",
".",
"reset",
"(",
")",
";",
"return",
"Token",
".",
"UNDEFINED",
";",
"}",
"if",
"(",
"\"interface\"",
".",
"equals",
"(",
"buffer",
".",
"toString",
"(",
")",
")",
")",
"return",
"fInterfaceToken",
";",
"while",
"(",
"readSegment",
"(",
"new",
"ResettableScanner",
"(",
"scanner",
")",
")",
")",
"{",
"}",
"return",
"fAnnotationToken",
";",
"}",
"private",
"boolean",
"readSegment",
"(",
"ResettableScanner",
"scanner",
")",
"{",
"scanner",
".",
"mark",
"(",
")",
";",
"if",
"(",
"skipWhitespace",
"(",
"scanner",
")",
"&&",
"skipDot",
"(",
"scanner",
")",
"&&",
"skipWhitespace",
"(",
"scanner",
")",
"&&",
"readIdentifier",
"(",
"scanner",
",",
"null",
")",
")",
"return",
"true",
";",
"scanner",
".",
"reset",
"(",
")",
";",
"return",
"false",
";",
"}",
"private",
"boolean",
"skipDot",
"(",
"ICharacterScanner",
"scanner",
")",
"{",
"int",
"ch",
"=",
"scanner",
".",
"read",
"(",
")",
";",
"if",
"(",
"ch",
"==",
"'.'",
")",
"return",
"true",
";",
"scanner",
".",
"unread",
"(",
")",
";",
"return",
"false",
";",
"}",
"private",
"boolean",
"readIdentifier",
"(",
"ICharacterScanner",
"scanner",
",",
"StringBuffer",
"buffer",
")",
"{",
"int",
"ch",
"=",
"scanner",
".",
"read",
"(",
")",
";",
"boolean",
"read",
"=",
"false",
";",
"while",
"(",
"fWordDetector",
".",
"isWordPart",
"(",
"(",
"char",
")",
"ch",
")",
")",
"{",
"if",
"(",
"buffer",
"!=",
"null",
")",
"buffer",
".",
"append",
"(",
"(",
"char",
")",
"ch",
")",
";",
"ch",
"=",
"scanner",
".",
"read",
"(",
")",
";",
"read",
"=",
"true",
";",
"}",
"if",
"(",
"ch",
"!=",
"ICharacterScanner",
".",
"EOF",
")",
"scanner",
".",
"unread",
"(",
")",
";",
"return",
"read",
";",
"}",
"private",
"boolean",
"skipWhitespace",
"(",
"ICharacterScanner",
"scanner",
")",
"{",
"while",
"(",
"fWhitespaceDetector",
".",
"isWhitespace",
"(",
"(",
"char",
")",
"scanner",
".",
"read",
"(",
")",
")",
")",
"{",
"}",
"scanner",
".",
"unread",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"private",
"static",
"String",
"[",
"]",
"types",
"=",
"{",
"\"boolean\"",
",",
"\"byte\"",
",",
"\"char\"",
",",
"\"class\"",
",",
"\"double\"",
",",
"\"float\"",
",",
"\"int\"",
",",
"\"interface\"",
",",
"\"long\"",
",",
"\"short\"",
",",
"\"void\"",
"}",
";",
"private",
"static",
"String",
"[",
"]",
"keywords",
"=",
"{",
"\"abstract\"",
",",
"\"break\"",
",",
"\"case\"",
",",
"\"catch\"",
",",
"\"const\"",
",",
"\"continue\"",
",",
"\"def\"",
",",
"\"default\"",
",",
"\"do\"",
",",
"\"else\"",
",",
"\"enum\"",
",",
"\"extends\"",
",",
"\"final\"",
",",
"\"finally\"",
",",
"\"for\"",
",",
"\"goto\"",
",",
"\"if\"",
",",
"\"implements\"",
",",
"\"import\"",
",",
"\"instanceof\"",
",",
"\"interface\"",
",",
"\"native\"",
",",
"\"new\"",
",",
"\"package\"",
",",
"\"private\"",
",",
"\"protected\"",
",",
"\"public\"",
",",
"\"static\"",
",",
"\"super\"",
",",
"\"switch\"",
",",
"\"synchronized\"",
",",
"\"this\"",
",",
"\"throw\"",
",",
"\"throws\"",
",",
"\"transient\"",
",",
"\"try\"",
",",
"\"volatile\"",
",",
"\"while\"",
",",
"\"true\"",
",",
"\"false\"",
",",
"\"null\"",
",",
"\"void\"",
"}",
";",
"private",
"static",
"String",
"[",
"]",
"groovyKeywords",
"=",
"{",
"\"as\"",
",",
"\"def\"",
",",
"\"assert\"",
",",
"\"in\"",
",",
"}",
";",
"private",
"static",
"String",
"[",
"]",
"gjdkWords",
"=",
"{",
"\"abs\"",
",",
"\"any\"",
",",
"\"append\"",
",",
"\"asList\"",
",",
"\"asWritable\"",
",",
"\"call\"",
",",
"\"collect\"",
",",
"\"compareTo\"",
",",
"\"count\"",
",",
"\"div\"",
",",
"\"dump\"",
",",
"\"each\"",
",",
"\"eachByte\"",
",",
"\"eachFile\"",
",",
"\"eachLine\"",
",",
"\"every\"",
",",
"\"find\"",
",",
"\"findAll\"",
",",
"\"flatten\"",
",",
"\"getAt\"",
",",
"\"getErr\"",
",",
"\"getIn\"",
",",
"\"getOut\"",
",",
"\"getText\"",
",",
"\"grep\"",
",",
"\"immutable\"",
",",
"\"inject\"",
",",
"\"inspect\"",
",",
"\"intersect\"",
",",
"\"\"",
",",
"\"isCase\"",
",",
"\"it\"",
",",
"\"join\"",
",",
"\"leftShift\"",
",",
"\"minus\"",
",",
"\"multiply\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"newReader\"",
",",
"\"newWriter\"",
",",
"\"next\"",
",",
"\"plus\"",
",",
"\"pop\"",
",",
"\"power\"",
",",
"\"previous\"",
",",
"\"print\"",
",",
"\"println\"",
",",
"\"push\"",
",",
"\"putAt\"",
",",
"\"read\"",
",",
"\"readBytes\"",
",",
"\"readLines\"",
",",
"\"reverse\"",
",",
"\"reverseEach\"",
",",
"\"round\"",
",",
"\"size\"",
",",
"\"sort\"",
",",
"\"\"",
",",
"\"step\"",
",",
"\"subMap\"",
",",
"\"times\"",
",",
"\"toInteger\"",
",",
"\"toList\"",
",",
"\"tokenize\"",
",",
"\"upto\"",
",",
"\"use\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"withReader\"",
",",
"\"withStream\"",
",",
"\"withWriter\"",
",",
"\"\"",
",",
"\"write\"",
",",
"\"writeLine\"",
",",
"}",
";",
"private",
"static",
"final",
"String",
"RETURN",
"=",
"\"return\"",
";",
"private",
"static",
"String",
"[",
"]",
"fgTokenProperties",
"=",
"{",
"PreferenceConstants",
".",
"GROOVY_EDITOR_DEFAULT_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GROOVYKEYWORDS_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
"}",
";",
"private",
"final",
"List",
"<",
"IRule",
">",
"additionalRules",
";",
"private",
"final",
"List",
"<",
"String",
">",
"additionalGroovyKeywords",
";",
"private",
"final",
"List",
"<",
"String",
">",
"additionalGJDKWords",
";",
"@",
"Deprecated",
"public",
"GroovyTagScanner",
"(",
"IColorManager",
"manager",
")",
"{",
"this",
"(",
"manager",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}",
"@",
"Deprecated",
"public",
"GroovyTagScanner",
"(",
"IColorManager",
"manager",
",",
"List",
"<",
"IRule",
">",
"additionalRules",
",",
"List",
"<",
"String",
">",
"additionalGroovyKeywords",
")",
"{",
"this",
"(",
"manager",
",",
"additionalRules",
",",
"additionalGroovyKeywords",
",",
"null",
")",
";",
"}",
"public",
"GroovyTagScanner",
"(",
"IColorManager",
"manager",
",",
"List",
"<",
"IRule",
">",
"additionalRules",
",",
"List",
"<",
"String",
">",
"additionalGroovyKeywords",
",",
"List",
"<",
"String",
">",
"additionalGJDKKeywords",
")",
"{",
"super",
"(",
"manager",
",",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
")",
";",
"this",
".",
"additionalRules",
"=",
"additionalRules",
";",
"this",
".",
"additionalGroovyKeywords",
"=",
"additionalGroovyKeywords",
";",
"this",
".",
"additionalGJDKWords",
"=",
"additionalGJDKKeywords",
";",
"initialize",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"String",
"[",
"]",
"getTokenProperties",
"(",
")",
"{",
"return",
"fgTokenProperties",
";",
"}",
"@",
"Override",
"protected",
"List",
"<",
"IRule",
">",
"createRules",
"(",
")",
"{",
"List",
"<",
"IRule",
">",
"rules",
"=",
"new",
"ArrayList",
"<",
"IRule",
">",
"(",
")",
";",
"Token",
"token",
"=",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
")",
";",
"rules",
".",
"add",
"(",
"new",
"SingleLineRule",
"(",
"\"'\"",
",",
"\"'\"",
",",
"token",
",",
"'\\\\'",
")",
")",
";",
"rules",
".",
"add",
"(",
"new",
"WhitespaceRule",
"(",
"new",
"JavaWhitespaceDetector",
"(",
")",
")",
")",
";",
"AnnotationRule",
"atInterfaceRule",
"=",
"new",
"AnnotationRule",
"(",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
")",
",",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
")",
")",
";",
"rules",
".",
"add",
"(",
"atInterfaceRule",
")",
";",
"rules",
".",
"add",
"(",
"new",
"NumberRule",
"(",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
")",
")",
")",
";",
"JavaWordDetector",
"wordDetector",
"=",
"new",
"JavaWordDetector",
"(",
")",
";",
"token",
"=",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_DEFAULT_COLOR",
")",
";",
"CombinedWordRule",
"combinedWordRule",
"=",
"new",
"CombinedWordRule",
"(",
"wordDetector",
",",
"token",
")",
";",
"WordMatcher",
"javaKeywordsMatcher",
"=",
"new",
"WordMatcher",
"(",
")",
";",
"token",
"=",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"keywords",
".",
"length",
";",
"i",
"++",
")",
"{",
"javaKeywordsMatcher",
".",
"addWord",
"(",
"keywords",
"[",
"i",
"]",
",",
"token",
")",
";",
"}",
"combinedWordRule",
".",
"addWordMatcher",
"(",
"javaKeywordsMatcher",
")",
";",
"WordMatcher",
"javaTypesMatcher",
"=",
"new",
"WordMatcher",
"(",
")",
";",
"token",
"=",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"javaTypesMatcher",
".",
"addWord",
"(",
"types",
"[",
"i",
"]",
",",
"token",
")",
";",
"}",
"combinedWordRule",
".",
"addWordMatcher",
"(",
"javaTypesMatcher",
")",
";",
"WordMatcher",
"groovyKeywordsMatcher",
"=",
"new",
"WordMatcher",
"(",
")",
";",
"token",
"=",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GROOVYKEYWORDS_COLOR",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"groovyKeywords",
".",
"length",
";",
"i",
"++",
")",
"{",
"groovyKeywordsMatcher",
".",
"addWord",
"(",
"groovyKeywords",
"[",
"i",
"]",
",",
"token",
")",
";",
"}",
"if",
"(",
"additionalGroovyKeywords",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"additional",
":",
"additionalGroovyKeywords",
")",
"{",
"groovyKeywordsMatcher",
".",
"addWord",
"(",
"additional",
",",
"token",
")",
";",
"}",
"}",
"combinedWordRule",
".",
"addWordMatcher",
"(",
"groovyKeywordsMatcher",
")",
";",
"WordMatcher",
"gjdkWordsMatcher",
"=",
"new",
"WordMatcher",
"(",
")",
";",
"token",
"=",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"gjdkWords",
".",
"length",
";",
"i",
"++",
")",
"{",
"gjdkWordsMatcher",
".",
"addWord",
"(",
"gjdkWords",
"[",
"i",
"]",
",",
"token",
")",
";",
"}",
"if",
"(",
"additionalGJDKWords",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"additional",
":",
"additionalGJDKWords",
")",
"{",
"gjdkWordsMatcher",
".",
"addWord",
"(",
"additional",
",",
"token",
")",
";",
"}",
"}",
"combinedWordRule",
".",
"addWordMatcher",
"(",
"gjdkWordsMatcher",
")",
";",
"token",
"=",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
")",
";",
"rules",
".",
"add",
"(",
"new",
"BracketRule",
"(",
"token",
")",
")",
";",
"token",
"=",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
")",
";",
"rules",
".",
"add",
"(",
"new",
"OperatorRule",
"(",
"token",
")",
")",
";",
"CombinedWordRule",
".",
"WordMatcher",
"returnWordRule",
"=",
"new",
"CombinedWordRule",
".",
"WordMatcher",
"(",
")",
";",
"token",
"=",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
")",
";",
"returnWordRule",
".",
"addWord",
"(",
"RETURN",
",",
"token",
")",
";",
"combinedWordRule",
".",
"addWordMatcher",
"(",
"returnWordRule",
")",
";",
"rules",
".",
"add",
"(",
"combinedWordRule",
")",
";",
"if",
"(",
"additionalRules",
"!=",
"null",
")",
"{",
"rules",
".",
"addAll",
"(",
"additionalRules",
")",
";",
"}",
"setDefaultReturnToken",
"(",
"getToken",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_DEFAULT_COLOR",
")",
")",
";",
"return",
"rules",
";",
"}",
"}",
"</s>"
] |
6,330 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"SourceField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"SourceFieldElementInfo",
";",
"public",
"abstract",
"class",
"OField",
"extends",
"SourceField",
"implements",
"IOJavaElement",
"{",
"protected",
"ASTNode",
"node",
";",
"private",
"OFieldInfo",
"cachedInfo",
";",
"public",
"OField",
"(",
"JavaElement",
"parent",
",",
"ASTNode",
"node",
",",
"String",
"name",
")",
"{",
"super",
"(",
"parent",
",",
"name",
")",
";",
"this",
".",
"node",
"=",
"node",
";",
"}",
"public",
"ASTNode",
"getNode",
"(",
")",
"{",
"return",
"node",
";",
"}",
"public",
"ASTNode",
"getElementNameNode",
"(",
")",
"{",
"return",
"node",
";",
"}",
"@",
"Override",
"public",
"abstract",
"String",
"getTypeSignature",
"(",
")",
";",
"@",
"Override",
"public",
"Object",
"getElementInfo",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"cachedInfo",
"==",
"null",
")",
"{",
"cachedInfo",
"=",
"(",
"OFieldInfo",
")",
"createElementInfo",
"(",
")",
";",
"}",
"return",
"cachedInfo",
";",
"}",
"@",
"Override",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"OFieldInfo",
"(",
")",
";",
"}",
"public",
"GroovyCompilationUnit",
"getUnit",
"(",
")",
"{",
"if",
"(",
"getParent",
"(",
")",
"instanceof",
"OType",
")",
"{",
"return",
"(",
"(",
"OType",
")",
"getParent",
"(",
")",
")",
".",
"getUnit",
"(",
")",
";",
"}",
"else",
"{",
"return",
"(",
"GroovyCompilationUnit",
")",
"getParent",
"(",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"String",
"[",
"]",
"getCategories",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"NO_CATEGORIES",
";",
"}",
"public",
"class",
"OFieldInfo",
"extends",
"SourceFieldElementInfo",
"{",
"@",
"Override",
"public",
"int",
"getNameSourceStart",
"(",
")",
"{",
"return",
"getElementNameNode",
"(",
")",
".",
"getStart",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getNameSourceEnd",
"(",
")",
"{",
"ASTNode",
"elementNameNode",
"=",
"getElementNameNode",
"(",
")",
";",
"return",
"elementNameNode",
".",
"getEnd",
"(",
")",
"-",
"1",
";",
"}",
"@",
"Override",
"public",
"int",
"getDeclarationSourceStart",
"(",
")",
"{",
"return",
"node",
".",
"getStart",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getDeclarationSourceEnd",
"(",
")",
"{",
"return",
"node",
".",
"getEnd",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"ISourceRange",
"getSourceRange",
"(",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"node",
".",
"getStart",
"(",
")",
",",
"node",
".",
"getLength",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"getTypeSignature",
"(",
")",
"{",
"return",
"OField",
".",
"this",
".",
"getTypeSignature",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,331 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"IJavaHelpContextIds",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPluginImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaOutlinePage",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"SourcePositionComparator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaElementComparator",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"Action",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IMenuManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IToolBarManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ViewerFilter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"BusyIndicator",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IActionBars",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"part",
".",
"IPageSite",
";",
"public",
"class",
"GroovyOutlinePage",
"extends",
"JavaOutlinePage",
"{",
"private",
"OCompilationUnit",
"outlineUnit",
"=",
"null",
";",
"public",
"GroovyOutlinePage",
"(",
"String",
"contextMenuID",
",",
"GroovyEditor",
"editor",
",",
"OCompilationUnit",
"unit",
")",
"{",
"super",
"(",
"contextMenuID",
",",
"editor",
")",
";",
"outlineUnit",
"=",
"unit",
";",
"}",
"public",
"void",
"refresh",
"(",
")",
"{",
"initializeViewer",
"(",
")",
";",
"outlineUnit",
".",
"refresh",
"(",
")",
";",
"JavaOutlineViewer",
"outlineViewer",
"=",
"getOutlineViewer",
"(",
")",
";",
"if",
"(",
"outlineViewer",
"!=",
"null",
")",
"{",
"outlineViewer",
".",
"refresh",
"(",
")",
";",
"}",
"}",
"public",
"OCompilationUnit",
"getOutlineCompilationUnit",
"(",
")",
"{",
"return",
"outlineUnit",
";",
"}",
"@",
"Override",
"protected",
"void",
"contextMenuAboutToShow",
"(",
"IMenuManager",
"menu",
")",
"{",
"}",
"private",
"boolean",
"isInitialized",
"=",
"false",
";",
"private",
"void",
"initializeViewer",
"(",
")",
"{",
"if",
"(",
"isInitialized",
")",
"{",
"return",
";",
"}",
"IPageSite",
"site",
"=",
"getSite",
"(",
")",
";",
"if",
"(",
"site",
"!=",
"null",
")",
"{",
"IActionBars",
"actionBars",
"=",
"site",
".",
"getActionBars",
"(",
")",
";",
"if",
"(",
"actionBars",
"!=",
"null",
")",
"{",
"IToolBarManager",
"toolBarManager",
"=",
"actionBars",
".",
"getToolBarManager",
"(",
")",
";",
"if",
"(",
"toolBarManager",
"!=",
"null",
")",
"{",
"toolBarManager",
".",
"removeAll",
"(",
")",
";",
"toolBarManager",
".",
"add",
"(",
"new",
"GroovyLexicalSortingAction",
"(",
")",
")",
";",
"toolBarManager",
".",
"update",
"(",
"true",
")",
";",
"}",
"}",
"}",
"isInitialized",
"=",
"true",
";",
"}",
"@",
"Override",
"public",
"void",
"createControl",
"(",
"Composite",
"parent",
")",
"{",
"super",
".",
"createControl",
"(",
"parent",
")",
";",
"ViewerFilter",
"[",
"]",
"filters",
"=",
"getOutlineViewer",
"(",
")",
".",
"getFilters",
"(",
")",
";",
"for",
"(",
"ViewerFilter",
"filter",
":",
"filters",
")",
"{",
"if",
"(",
"filter",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
".",
"contains",
"(",
"\"\"",
")",
")",
"{",
"getOutlineViewer",
"(",
")",
".",
"removeFilter",
"(",
"filter",
")",
";",
"}",
"}",
"}",
"public",
"ISourceReference",
"getOutlineElmenetAt",
"(",
"int",
"caretOffset",
")",
"{",
"return",
"getOutlineCompilationUnit",
"(",
")",
".",
"getOutlineElementAt",
"(",
"caretOffset",
")",
";",
"}",
"public",
"class",
"GroovyLexicalSortingAction",
"extends",
"Action",
"{",
"private",
"JavaElementComparator",
"fComparator",
"=",
"new",
"JavaElementComparator",
"(",
")",
";",
"private",
"SourcePositionComparator",
"fSourcePositonComparator",
"=",
"new",
"SourcePositionComparator",
"(",
")",
";",
"public",
"GroovyLexicalSortingAction",
"(",
")",
"{",
"super",
"(",
")",
";",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getHelpSystem",
"(",
")",
".",
"setHelp",
"(",
"this",
",",
"IJavaHelpContextIds",
".",
"LEXICAL_SORTING_OUTLINE_ACTION",
")",
";",
"setText",
"(",
"\"\"",
")",
";",
"JavaPluginImages",
".",
"setLocalImageDescriptors",
"(",
"this",
",",
"\"\"",
")",
";",
"boolean",
"checked",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
".",
"getBoolean",
"(",
"\"\"",
")",
";",
"valueChanged",
"(",
"checked",
",",
"false",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"valueChanged",
"(",
"isChecked",
"(",
")",
",",
"true",
")",
";",
"}",
"private",
"void",
"valueChanged",
"(",
"final",
"boolean",
"on",
",",
"boolean",
"store",
")",
"{",
"setChecked",
"(",
"on",
")",
";",
"BusyIndicator",
".",
"showWhile",
"(",
"getOutlineViewer",
"(",
")",
".",
"getControl",
"(",
")",
".",
"getDisplay",
"(",
")",
",",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"on",
")",
"{",
"getOutlineViewer",
"(",
")",
".",
"setComparator",
"(",
"fComparator",
")",
";",
"}",
"else",
"{",
"getOutlineViewer",
"(",
")",
".",
"setComparator",
"(",
"fSourcePositonComparator",
")",
";",
"}",
"}",
"}",
")",
";",
"if",
"(",
"store",
")",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
".",
"setValue",
"(",
"\"\"",
",",
"on",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,332 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"SourceType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"SourceTypeElementInfo",
";",
"public",
"class",
"OType",
"extends",
"SourceType",
"implements",
"IOJavaElement",
"{",
"protected",
"ASTNode",
"node",
";",
"private",
"List",
"<",
"IMember",
">",
"children",
"=",
"new",
"LinkedList",
"<",
"IMember",
">",
"(",
")",
";",
"private",
"OTypeInfo",
"cachedInfo",
";",
"public",
"OType",
"(",
"IJavaElement",
"parent",
",",
"ASTNode",
"node",
",",
"String",
"name",
")",
"{",
"super",
"(",
"(",
"JavaElement",
")",
"parent",
",",
"name",
")",
";",
"this",
".",
"node",
"=",
"node",
";",
"}",
"public",
"ASTNode",
"getElementNameNode",
"(",
")",
"{",
"return",
"node",
";",
"}",
"@",
"Override",
"public",
"Object",
"getElementInfo",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"cachedInfo",
"==",
"null",
")",
"{",
"cachedInfo",
"=",
"(",
"OTypeInfo",
")",
"createElementInfo",
"(",
")",
";",
"}",
"return",
"cachedInfo",
";",
"}",
"@",
"Override",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"OTypeInfo",
"(",
")",
";",
"}",
"public",
"GroovyCompilationUnit",
"getUnit",
"(",
")",
"{",
"if",
"(",
"getParent",
"(",
")",
"instanceof",
"IType",
")",
"{",
"return",
"(",
"GroovyCompilationUnit",
")",
"(",
"(",
"IType",
")",
"getParent",
"(",
")",
")",
".",
"getTypeRoot",
"(",
")",
";",
"}",
"else",
"{",
"return",
"(",
"GroovyCompilationUnit",
")",
"getParent",
"(",
")",
";",
"}",
"}",
"public",
"ASTNode",
"getNode",
"(",
")",
"{",
"return",
"node",
";",
"}",
"@",
"Override",
"public",
"IMember",
"[",
"]",
"getChildren",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"this",
".",
"children",
".",
"toArray",
"(",
"new",
"IMember",
"[",
"]",
"{",
"}",
")",
";",
"}",
"public",
"List",
"<",
"IMember",
">",
"getChildrenList",
"(",
")",
"{",
"return",
"children",
";",
"}",
"public",
"void",
"addChild",
"(",
"IMember",
"child",
")",
"{",
"children",
".",
"add",
"(",
"child",
")",
";",
"}",
"public",
"IMember",
"getOutlineElementAt",
"(",
"int",
"caretOffset",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"hasChildren",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"for",
"(",
"IMember",
"je",
":",
"getChildren",
"(",
")",
")",
"{",
"if",
"(",
"je",
"instanceof",
"IOJavaElement",
")",
"{",
"IOJavaElement",
"m",
"=",
"(",
"IOJavaElement",
")",
"je",
";",
"ASTNode",
"n",
"=",
"m",
".",
"getNode",
"(",
")",
";",
"if",
"(",
"n",
".",
"getStart",
"(",
")",
"<=",
"caretOffset",
"&&",
"n",
".",
"getEnd",
"(",
")",
">=",
"caretOffset",
")",
"{",
"if",
"(",
"m",
"instanceof",
"OType",
")",
"{",
"return",
"(",
"(",
"OType",
")",
"je",
")",
".",
"getOutlineElementAt",
"(",
"caretOffset",
")",
";",
"}",
"else",
"{",
"return",
"(",
"IMember",
")",
"m",
";",
"}",
"}",
"}",
"else",
"{",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"this",
";",
"}",
"@",
"Override",
"public",
"String",
"[",
"]",
"getCategories",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"NO_CATEGORIES",
";",
"}",
"public",
"class",
"OTypeInfo",
"extends",
"SourceTypeElementInfo",
"{",
"@",
"Override",
"public",
"int",
"getNameSourceStart",
"(",
")",
"{",
"return",
"getElementNameNode",
"(",
")",
".",
"getStart",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getNameSourceEnd",
"(",
")",
"{",
"return",
"getElementNameNode",
"(",
")",
".",
"getEnd",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getDeclarationSourceStart",
"(",
")",
"{",
"return",
"node",
".",
"getStart",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getDeclarationSourceEnd",
"(",
")",
"{",
"return",
"node",
".",
"getEnd",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"ISourceRange",
"getSourceRange",
"(",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"node",
".",
"getStart",
"(",
")",
",",
"node",
".",
"getLength",
"(",
")",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,333 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"SourceMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"SourceMethodInfo",
";",
"public",
"abstract",
"class",
"OMethod",
"extends",
"SourceMethod",
"implements",
"IOJavaElement",
"{",
"protected",
"ASTNode",
"node",
";",
"private",
"OMethodInfo",
"cachedInfo",
";",
"public",
"OMethod",
"(",
"JavaElement",
"parent",
",",
"ASTNode",
"node",
",",
"String",
"name",
")",
"{",
"super",
"(",
"parent",
",",
"name",
",",
"null",
")",
";",
"this",
".",
"node",
"=",
"node",
";",
"}",
"public",
"ASTNode",
"getNode",
"(",
")",
"{",
"return",
"node",
";",
"}",
"public",
"ASTNode",
"getElementNameNode",
"(",
")",
"{",
"return",
"node",
";",
"}",
"public",
"abstract",
"String",
"getReturnTypeName",
"(",
")",
";",
"@",
"Override",
"public",
"Object",
"getElementInfo",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"cachedInfo",
"==",
"null",
")",
"{",
"cachedInfo",
"=",
"(",
"OMethodInfo",
")",
"createElementInfo",
"(",
")",
";",
"}",
"return",
"cachedInfo",
";",
"}",
"@",
"Override",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"OMethodInfo",
"(",
")",
";",
"}",
"public",
"GroovyCompilationUnit",
"getUnit",
"(",
")",
"{",
"ICompilationUnit",
"unit",
"=",
"(",
"ICompilationUnit",
")",
"getAncestor",
"(",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
";",
"if",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
"{",
"return",
"(",
"GroovyCompilationUnit",
")",
"unit",
";",
"}",
"else",
"{",
"Assert",
".",
"isTrue",
"(",
"false",
",",
"\"\"",
"+",
"unit",
")",
";",
"return",
"null",
";",
"}",
"}",
"@",
"Override",
"public",
"String",
"[",
"]",
"getCategories",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"NO_CATEGORIES",
";",
"}",
"public",
"class",
"OMethodInfo",
"extends",
"SourceMethodInfo",
"{",
"@",
"Override",
"public",
"int",
"getNameSourceStart",
"(",
")",
"{",
"return",
"getElementNameNode",
"(",
")",
".",
"getStart",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getNameSourceEnd",
"(",
")",
"{",
"return",
"getNameSourceStart",
"(",
")",
"+",
"getElementNameNode",
"(",
")",
".",
"getLength",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getDeclarationSourceStart",
"(",
")",
"{",
"return",
"node",
".",
"getStart",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getDeclarationSourceEnd",
"(",
")",
"{",
"return",
"node",
".",
"getEnd",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"ISourceRange",
"getSourceRange",
"(",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"node",
".",
"getStart",
"(",
")",
",",
"node",
".",
"getLength",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"char",
"[",
"]",
"getReturnTypeName",
"(",
")",
"{",
"return",
"OMethod",
".",
"this",
".",
"getReturnTypeName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,334 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"public",
"interface",
"IOutlineExtender",
"{",
"GroovyOutlinePage",
"getGroovyOutlinePageForEditor",
"(",
"String",
"contextMenuID",
",",
"GroovyEditor",
"editor",
")",
";",
"boolean",
"appliesTo",
"(",
"GroovyCompilationUnit",
"unit",
")",
";",
"}",
"</s>"
] |
6,335 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceReference",
";",
"public",
"interface",
"IOJavaElement",
"extends",
"IJavaElement",
",",
"ISourceReference",
"{",
"String",
"[",
"]",
"NO_CATEGORIES",
"=",
"new",
"String",
"[",
"0",
"]",
";",
"public",
"ASTNode",
"getNode",
"(",
")",
";",
"}",
"</s>"
] |
6,336 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassCodeVisitorSupport",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassHelper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClosureExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"DeclarationExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"TupleExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"VariableExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"BlockStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"SourceUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"public",
"class",
"GroovyScriptOutlineExtender",
"implements",
"IOutlineExtender",
"{",
"public",
"static",
"final",
"String",
"NO_STRUCTURE_FOUND",
"=",
"\"\"",
";",
"public",
"GroovyOutlinePage",
"getGroovyOutlinePageForEditor",
"(",
"String",
"contextMenuID",
",",
"GroovyEditor",
"editor",
")",
"{",
"GroovyOutlinePage",
"outlinePage",
"=",
"new",
"GroovyOutlinePage",
"(",
"contextMenuID",
",",
"editor",
",",
"new",
"GroovyScriptOCompilationUnit",
"(",
"editor",
".",
"getGroovyCompilationUnit",
"(",
")",
")",
")",
";",
"return",
"outlinePage",
";",
"}",
"public",
"boolean",
"appliesTo",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"ModuleNode",
"moduleNode",
"=",
"unit",
".",
"getModuleNode",
"(",
")",
";",
"return",
"moduleNode",
"!=",
"null",
"&&",
"moduleNode",
".",
"getClasses",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
"&&",
"moduleNode",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"0",
")",
"!=",
"null",
"&&",
"moduleNode",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"isScript",
"(",
")",
";",
"}",
"}",
"class",
"GroovyScriptOCompilationUnit",
"extends",
"OCompilationUnit",
"{",
"public",
"GroovyScriptOCompilationUnit",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"super",
"(",
"unit",
")",
";",
"}",
"@",
"Override",
"public",
"IJavaElement",
"[",
"]",
"refreshChildren",
"(",
")",
"{",
"ModuleNode",
"node",
"=",
"(",
"ModuleNode",
")",
"getNode",
"(",
")",
";",
"ClassNode",
"scriptClassDummy",
";",
"String",
"scriptName",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"scriptClassDummy",
"=",
"node",
".",
"getScriptClassDummy",
"(",
")",
";",
"if",
"(",
"scriptClassDummy",
"==",
"null",
")",
"{",
"if",
"(",
"node",
".",
"getClasses",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"scriptClassDummy",
"=",
"node",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"}",
"}",
"if",
"(",
"scriptClassDummy",
"==",
"null",
")",
"{",
"scriptName",
"=",
"\"Problem\"",
";",
"}",
"else",
"{",
"scriptName",
"=",
"scriptClassDummy",
".",
"getNameWithoutPackage",
"(",
")",
";",
"}",
"}",
"else",
"{",
"scriptName",
"=",
"null",
";",
"scriptClassDummy",
"=",
"null",
";",
"}",
"if",
"(",
"node",
"==",
"null",
"||",
"node",
".",
"encounteredUnrecoverableError",
"(",
")",
"||",
"scriptClassDummy",
"==",
"null",
")",
"{",
"return",
"new",
"IJavaElement",
"[",
"]",
"{",
"new",
"OType",
"(",
"getUnit",
"(",
")",
",",
"node",
",",
"scriptName",
"+",
"GroovyScriptOutlineExtender",
".",
"NO_STRUCTURE_FOUND",
")",
"}",
";",
"}",
"try",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"getUnit",
"(",
")",
".",
"getChildren",
"(",
")",
";",
"final",
"IType",
"scriptType",
";",
"final",
"List",
"<",
"IJavaElement",
">",
"fakeChildren",
"=",
"new",
"ArrayList",
"<",
"IJavaElement",
">",
"(",
")",
";",
"IType",
"candidate",
"=",
"null",
";",
"for",
"(",
"IJavaElement",
"elt",
":",
"children",
")",
"{",
"if",
"(",
"elt",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"scriptName",
")",
")",
"{",
"candidate",
"=",
"(",
"IType",
")",
"elt",
";",
"}",
"else",
"if",
"(",
"elt",
"instanceof",
"IJavaElement",
")",
"{",
"fakeChildren",
".",
"add",
"(",
"(",
"IJavaElement",
")",
"elt",
")",
";",
"}",
"}",
"scriptType",
"=",
"candidate",
";",
"if",
"(",
"scriptType",
"!=",
"null",
")",
"{",
"IJavaElement",
"[",
"]",
"scriptChildren",
"=",
"scriptType",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"IJavaElement",
"scriptElt",
":",
"scriptChildren",
")",
"{",
"if",
"(",
"scriptElt",
"instanceof",
"IMember",
")",
"{",
"if",
"(",
"isRunMethod",
"(",
"scriptElt",
")",
"||",
"isMainMethod",
"(",
"scriptElt",
")",
"||",
"isConstructor",
"(",
"scriptElt",
")",
")",
"{",
"continue",
";",
"}",
"fakeChildren",
".",
"add",
"(",
"(",
"IMember",
")",
"scriptElt",
")",
";",
"}",
"}",
"BlockStatement",
"block",
"=",
"node",
".",
"getStatementBlock",
"(",
")",
";",
"ClassCodeVisitorSupport",
"visitor",
"=",
"new",
"ClassCodeVisitorSupport",
"(",
")",
"{",
"@",
"Override",
"protected",
"SourceUnit",
"getSourceUnit",
"(",
")",
"{",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClosureExpression",
"(",
"ClosureExpression",
"expression",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"visitDeclarationExpression",
"(",
"DeclarationExpression",
"expression",
")",
"{",
"fakeChildren",
".",
"add",
"(",
"new",
"GroovyScriptVariable",
"(",
"(",
"JavaElement",
")",
"scriptType",
",",
"expression",
")",
")",
";",
"super",
".",
"visitDeclarationExpression",
"(",
"expression",
")",
";",
"}",
"}",
";",
"visitor",
".",
"visitBlockStatement",
"(",
"block",
")",
";",
"}",
"IJavaElement",
"[",
"]",
"fakeChildrenArr",
"=",
"fakeChildren",
".",
"toArray",
"(",
"new",
"IJavaElement",
"[",
"fakeChildren",
".",
"size",
"(",
")",
"]",
")",
";",
"sort",
"(",
"fakeChildrenArr",
")",
";",
"return",
"fakeChildrenArr",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"return",
"new",
"IJavaElement",
"[",
"]",
"{",
"new",
"OType",
"(",
"getUnit",
"(",
")",
",",
"node",
",",
"scriptName",
"+",
"\"\"",
")",
"}",
";",
"}",
"}",
"public",
"static",
"IJavaElement",
"[",
"]",
"sort",
"(",
"IJavaElement",
"[",
"]",
"elts",
")",
"{",
"Arrays",
".",
"sort",
"(",
"elts",
",",
"new",
"Comparator",
"<",
"IJavaElement",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"IJavaElement",
"e1",
",",
"IJavaElement",
"e2",
")",
"{",
"try",
"{",
"Assert",
".",
"isTrue",
"(",
"e1",
"instanceof",
"ISourceReference",
",",
"\"\"",
"+",
"e1",
")",
";",
"Assert",
".",
"isTrue",
"(",
"e2",
"instanceof",
"ISourceReference",
",",
"\"\"",
"+",
"e2",
")",
";",
"return",
"(",
"(",
"ISourceReference",
")",
"e1",
")",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
"-",
"(",
"(",
"ISourceReference",
")",
"e2",
")",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"e1",
"+",
"\"",
"and",
"\"",
"+",
"e2",
",",
"e",
")",
";",
"return",
"0",
";",
"}",
"}",
"}",
")",
";",
"return",
"elts",
";",
"}",
"private",
"boolean",
"isConstructor",
"(",
"IJavaElement",
"scriptElt",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"scriptElt",
".",
"getElementType",
"(",
")",
"!=",
"IJavaElement",
".",
"METHOD",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"(",
"IMethod",
")",
"scriptElt",
")",
".",
"isConstructor",
"(",
")",
";",
"}",
"private",
"boolean",
"isMainMethod",
"(",
"IJavaElement",
"scriptElt",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"scriptElt",
".",
"getElementType",
"(",
")",
"!=",
"IJavaElement",
".",
"METHOD",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"(",
"IMethod",
")",
"scriptElt",
")",
".",
"isMainMethod",
"(",
")",
";",
"}",
"private",
"boolean",
"isRunMethod",
"(",
"IJavaElement",
"scriptElt",
")",
"{",
"if",
"(",
"scriptElt",
".",
"getElementType",
"(",
")",
"!=",
"IJavaElement",
".",
"METHOD",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"scriptElt",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"run\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"String",
"[",
"]",
"parammeterTypes",
"=",
"(",
"(",
"IMethod",
")",
"scriptElt",
")",
".",
"getParameterTypes",
"(",
")",
";",
"return",
"parammeterTypes",
"==",
"null",
"||",
"parammeterTypes",
".",
"length",
"==",
"0",
";",
"}",
"}",
"class",
"GroovyScriptVariable",
"extends",
"OField",
"{",
"private",
"static",
"final",
"String",
"NO_NAME",
"=",
"\"no",
"name\"",
";",
"private",
"static",
"final",
"String",
"DEF_SIGNATURE",
"=",
"\"Qdef;\"",
";",
"private",
"String",
"typeSignature",
";",
"public",
"GroovyScriptVariable",
"(",
"JavaElement",
"parent",
",",
"DeclarationExpression",
"node",
")",
"{",
"super",
"(",
"parent",
",",
"node",
",",
"extractName",
"(",
"node",
")",
")",
";",
"ClassNode",
"fieldType",
"=",
"node",
".",
"getLeftExpression",
"(",
")",
".",
"getType",
"(",
")",
";",
"if",
"(",
"ClassHelper",
".",
"DYNAMIC_TYPE",
"==",
"fieldType",
")",
"{",
"typeSignature",
"=",
"DEF_SIGNATURE",
";",
"}",
"else",
"{",
"typeSignature",
"=",
"fieldType",
".",
"getNameWithoutPackage",
"(",
")",
";",
"if",
"(",
"!",
"typeSignature",
".",
"startsWith",
"(",
"\"[\"",
")",
")",
"{",
"typeSignature",
"=",
"Signature",
".",
"createTypeSignature",
"(",
"typeSignature",
",",
"false",
")",
";",
"}",
"}",
"}",
"private",
"static",
"String",
"extractName",
"(",
"DeclarationExpression",
"node",
")",
"{",
"Expression",
"leftExpression",
"=",
"node",
".",
"getLeftExpression",
"(",
")",
";",
"if",
"(",
"leftExpression",
"instanceof",
"VariableExpression",
")",
"{",
"return",
"(",
"(",
"VariableExpression",
")",
"leftExpression",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"leftExpression",
"instanceof",
"TupleExpression",
")",
"{",
"List",
"<",
"Expression",
">",
"exprs",
"=",
"(",
"(",
"TupleExpression",
")",
"leftExpression",
")",
".",
"getExpressions",
"(",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"Expression",
">",
"exprIter",
"=",
"exprs",
".",
"iterator",
"(",
")",
";",
"exprIter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Expression",
"expr",
"=",
"exprIter",
".",
"next",
"(",
")",
";",
"sb",
".",
"append",
"(",
"expr",
".",
"getText",
"(",
")",
")",
";",
"if",
"(",
"exprIter",
".",
"hasNext",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"return",
"NO_NAME",
";",
"}",
"@",
"Override",
"public",
"ASTNode",
"getElementNameNode",
"(",
")",
"{",
"DeclarationExpression",
"decl",
"=",
"(",
"DeclarationExpression",
")",
"getNode",
"(",
")",
";",
"return",
"decl",
".",
"getLeftExpression",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"getTypeSignature",
"(",
")",
"{",
"return",
"typeSignature",
";",
"}",
"}",
"</s>"
] |
6,337 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"outline",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"OpenableElementInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"PackageFragment",
";",
"public",
"abstract",
"class",
"OCompilationUnit",
"extends",
"GroovyCompilationUnit",
"implements",
"IOJavaElement",
"{",
"private",
"GroovyCompilationUnit",
"unit",
";",
"private",
"IJavaElement",
"[",
"]",
"children",
"=",
"null",
";",
"public",
"OCompilationUnit",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"super",
"(",
"(",
"PackageFragment",
")",
"unit",
".",
"getParent",
"(",
")",
",",
"unit",
".",
"getElementName",
"(",
")",
",",
"unit",
".",
"getOwner",
"(",
")",
")",
";",
"this",
".",
"unit",
"=",
"unit",
";",
"this",
".",
"owner",
"=",
"unit",
".",
"owner",
";",
"}",
"public",
"abstract",
"IJavaElement",
"[",
"]",
"refreshChildren",
"(",
")",
";",
"public",
"ISourceReference",
"getOutlineElementAt",
"(",
"int",
"caretOffset",
")",
"{",
"try",
"{",
"IJavaElement",
"elementAt",
"=",
"getElementAt",
"(",
"caretOffset",
")",
";",
"return",
"(",
"elementAt",
"instanceof",
"ISourceReference",
")",
"?",
"(",
"ISourceReference",
")",
"elementAt",
":",
"this",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"this",
";",
"}",
"}",
"public",
"ASTNode",
"getNode",
"(",
")",
"{",
"return",
"unit",
".",
"getModuleNode",
"(",
")",
";",
"}",
"protected",
"void",
"refresh",
"(",
")",
"{",
"if",
"(",
"this",
".",
"exists",
"(",
")",
")",
"{",
"this",
".",
"children",
"=",
"refreshChildren",
"(",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"{",
"if",
"(",
"children",
"==",
"null",
")",
"{",
"refresh",
"(",
")",
";",
"}",
"return",
"children",
";",
"}",
"public",
"GroovyCompilationUnit",
"getUnit",
"(",
")",
"{",
"return",
"unit",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"protected",
"boolean",
"buildStructure",
"(",
"OpenableElementInfo",
"info",
",",
"IProgressMonitor",
"pm",
",",
"Map",
"newElements",
",",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
"{",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
6,338 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"GroovyIndentationService",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"IFormatterPreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"JavaAutoIndentStrategy",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"DocumentCommand",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"public",
"class",
"GroovyAutoIndentStrategy",
"extends",
"AbstractAutoEditStrategy",
"{",
"private",
"JavaAutoIndentStrategy",
"javaStrategy",
";",
"private",
"boolean",
"closeBraces",
";",
"private",
"GroovyIndentationService",
"indentor",
";",
"public",
"GroovyAutoIndentStrategy",
"(",
"String",
"contentType",
",",
"JavaAutoIndentStrategy",
"javaStrategy",
")",
"{",
"this",
".",
"javaStrategy",
"=",
"javaStrategy",
";",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"JavaAutoIndentStrategy",
".",
"class",
",",
"\"\"",
",",
"new",
"Class",
"<",
"?",
">",
"[",
"0",
"]",
",",
"javaStrategy",
",",
"new",
"Object",
"[",
"0",
"]",
")",
";",
"this",
".",
"indentor",
"=",
"new",
"GroovyIndentationService",
"(",
"(",
"IJavaProject",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaAutoIndentStrategy",
".",
"class",
",",
"\"fProject\"",
",",
"javaStrategy",
")",
")",
";",
"this",
".",
"closeBraces",
"=",
"(",
"Boolean",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaAutoIndentStrategy",
".",
"class",
",",
"\"fCloseBrace\"",
",",
"javaStrategy",
")",
";",
"}",
"public",
"void",
"customizeDocumentCommand",
"(",
"IDocument",
"d",
",",
"DocumentCommand",
"c",
")",
"{",
"try",
"{",
"if",
"(",
"c",
".",
"doit",
"==",
"false",
")",
"return",
";",
"if",
"(",
"c",
".",
"length",
"==",
"0",
"&&",
"c",
".",
"text",
"!=",
"null",
"&&",
"isNewline",
"(",
"d",
",",
"c",
".",
"text",
")",
")",
"{",
"autoEditAfterNewline",
"(",
"d",
",",
"c",
")",
";",
"}",
"else",
"{",
"if",
"(",
"c",
".",
"text",
".",
"length",
"(",
")",
">",
"2",
")",
"{",
"smartPaste",
"(",
"d",
",",
"c",
")",
";",
"}",
"if",
"(",
"\"}\"",
".",
"equals",
"(",
"c",
".",
"text",
")",
")",
"{",
"javaStrategy",
".",
"customizeDocumentCommand",
"(",
"d",
",",
"c",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"indentor",
".",
"disposePrefs",
"(",
")",
";",
"}",
"}",
"private",
"IFormatterPreferences",
"getPrefs",
"(",
")",
"{",
"return",
"indentor",
".",
"getPrefs",
"(",
")",
";",
"}",
"private",
"void",
"smartPaste",
"(",
"IDocument",
"d",
",",
"DocumentCommand",
"c",
")",
"{",
"try",
"{",
"if",
"(",
"getPrefs",
"(",
")",
".",
"isSmartPaste",
"(",
")",
"&&",
"indentor",
".",
"isInEmptyLine",
"(",
"d",
",",
"c",
".",
"offset",
")",
")",
"{",
"int",
"pasteLine",
"=",
"d",
".",
"getLineOfOffset",
"(",
"c",
".",
"offset",
")",
";",
"IRegion",
"pasteLineRegion",
"=",
"d",
".",
"getLineInformation",
"(",
"pasteLine",
")",
";",
"Document",
"workCopy",
"=",
"new",
"Document",
"(",
"d",
".",
"get",
"(",
"0",
",",
"pasteLineRegion",
".",
"getOffset",
"(",
")",
")",
")",
";",
"workCopy",
".",
"replace",
"(",
"pasteLineRegion",
".",
"getOffset",
"(",
")",
",",
"0",
",",
"c",
".",
"text",
")",
";",
"int",
"startLine",
"=",
"workCopy",
".",
"getLineOfOffset",
"(",
"pasteLineRegion",
".",
"getOffset",
"(",
")",
")",
";",
"int",
"endLine",
"=",
"workCopy",
".",
"getLineOfOffset",
"(",
"pasteLineRegion",
".",
"getOffset",
"(",
")",
"+",
"c",
".",
"text",
".",
"length",
"(",
")",
")",
";",
"int",
"indentDiff",
"=",
"0",
";",
"boolean",
"isMultiLineComment",
"=",
"false",
";",
"boolean",
"isMultiLineString",
"=",
"false",
";",
"for",
"(",
"int",
"line",
"=",
"startLine",
";",
"line",
"<=",
"endLine",
";",
"line",
"++",
")",
"{",
"IRegion",
"lineRegion",
"=",
"workCopy",
".",
"getLineInformation",
"(",
"line",
")",
";",
"String",
"text",
"=",
"workCopy",
".",
"get",
"(",
"lineRegion",
".",
"getOffset",
"(",
")",
",",
"lineRegion",
".",
"getLength",
"(",
")",
")",
";",
"if",
"(",
"line",
"-",
"startLine",
"<",
"2",
")",
"{",
"int",
"oldIndentLevel",
"=",
"indentor",
".",
"getLineIndentLevel",
"(",
"workCopy",
",",
"line",
")",
";",
"int",
"newIndentLevel",
"=",
"indentor",
".",
"computeIndentForLine",
"(",
"workCopy",
",",
"line",
")",
";",
"if",
"(",
"isMultiLineComment",
")",
"{",
"newIndentLevel",
"++",
";",
"indentor",
".",
"fixIndentation",
"(",
"workCopy",
",",
"line",
",",
"newIndentLevel",
")",
";",
"}",
"else",
"if",
"(",
"!",
"isMultiLineString",
")",
"{",
"indentor",
".",
"fixIndentation",
"(",
"workCopy",
",",
"line",
",",
"newIndentLevel",
")",
";",
"}",
"indentDiff",
"=",
"newIndentLevel",
"-",
"oldIndentLevel",
";",
"}",
"else",
"{",
"int",
"oldIndentLevel",
"=",
"indentor",
".",
"getLineIndentLevel",
"(",
"workCopy",
",",
"line",
")",
";",
"int",
"newIndentLevel",
"=",
"oldIndentLevel",
"+",
"indentDiff",
";",
"if",
"(",
"isMultiLineComment",
")",
"{",
"indentor",
".",
"fixIndentation",
"(",
"workCopy",
",",
"line",
",",
"newIndentLevel",
")",
";",
"}",
"else",
"if",
"(",
"!",
"isMultiLineString",
")",
"{",
"indentor",
".",
"fixIndentation",
"(",
"workCopy",
",",
"line",
",",
"newIndentLevel",
")",
";",
"}",
"}",
"if",
"(",
"text",
".",
"indexOf",
"(",
"\"/*\"",
")",
"!=",
"-",
"1",
")",
"{",
"isMultiLineComment",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"text",
".",
"indexOf",
"(",
"\"*/\"",
")",
"!=",
"-",
"1",
")",
"&&",
"isMultiLineComment",
")",
"{",
"isMultiLineComment",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"text",
".",
"indexOf",
"(",
"\"\\\"\\\"\\\"\"",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"text",
".",
"indexOf",
"(",
"\"'''\"",
")",
"!=",
"-",
"1",
")",
")",
"&&",
"!",
"isMultiLineComment",
")",
"{",
"if",
"(",
"isMultiLineString",
")",
"isMultiLineString",
"=",
"false",
";",
"else",
"isMultiLineString",
"=",
"true",
";",
"}",
"}",
"int",
"workStart",
"=",
"workCopy",
".",
"getLineOffset",
"(",
"startLine",
")",
";",
"int",
"workEnd",
"=",
"workCopy",
".",
"getLineOffset",
"(",
"endLine",
")",
"+",
"workCopy",
".",
"getLineLength",
"(",
"endLine",
")",
";",
"c",
".",
"text",
"=",
"workCopy",
".",
"get",
"(",
"workStart",
",",
"workEnd",
"-",
"workStart",
")",
";",
"c",
".",
"offset",
"=",
"pasteLineRegion",
".",
"getOffset",
"(",
")",
";",
"c",
".",
"length",
"=",
"pasteLineRegion",
".",
"getLength",
"(",
")",
";",
"c",
".",
"caretOffset",
"=",
"c",
".",
"offset",
"+",
"c",
".",
"text",
".",
"length",
"(",
")",
";",
"c",
".",
"shiftsCaret",
"=",
"false",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"private",
"void",
"autoEditAfterNewline",
"(",
"IDocument",
"d",
",",
"DocumentCommand",
"c",
")",
"{",
"try",
"{",
"int",
"orgIndentLevel",
"=",
"indentor",
".",
"getIndentLevel",
"(",
"d",
",",
"c",
".",
"offset",
")",
";",
"int",
"indentLevel",
"=",
"indentor",
".",
"computeIndentAfterNewline",
"(",
"d",
",",
"c",
".",
"offset",
")",
";",
"String",
"indentation",
"=",
"indentor",
".",
"createIndentation",
"(",
"indentLevel",
")",
";",
"c",
".",
"text",
"=",
"c",
".",
"text",
"+",
"indentation",
";",
"if",
"(",
"closeBraces",
")",
"{",
"int",
"lengthToCurly",
"=",
"indentor",
".",
"lengthToNextCurly",
"(",
"d",
",",
"c",
".",
"offset",
")",
";",
"if",
"(",
"shouldInsertBrace",
"(",
"d",
",",
"c",
".",
"offset",
",",
"lengthToCurly",
">",
"0",
")",
")",
"{",
"c",
".",
"length",
"=",
"lengthToCurly",
";",
"int",
"newCaret",
"=",
"c",
".",
"offset",
"+",
"c",
".",
"text",
".",
"length",
"(",
")",
";",
"c",
".",
"text",
"=",
"c",
".",
"text",
"+",
"indentor",
".",
"newline",
"(",
"d",
")",
"+",
"indentor",
".",
"createIndentation",
"(",
"orgIndentLevel",
")",
"+",
"\"}\"",
";",
"c",
".",
"caretOffset",
"=",
"newCaret",
";",
"c",
".",
"shiftsCaret",
"=",
"false",
";",
"}",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"return",
";",
"}",
"}",
"private",
"boolean",
"shouldInsertBrace",
"(",
"IDocument",
"d",
",",
"int",
"enterPos",
",",
"boolean",
"nextTokenIsCloseBrace",
")",
"{",
"if",
"(",
"!",
"indentor",
".",
"moreOpenThanCloseBefore",
"(",
"d",
",",
"enterPos",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"nextTokenIsCloseBrace",
"||",
"indentor",
".",
"isEndOfLine",
"(",
"d",
",",
"enterPos",
")",
")",
"{",
"try",
"{",
"int",
"lineNum",
"=",
"d",
".",
"getLineOfOffset",
"(",
"enterPos",
")",
";",
"int",
"indentLevel",
"=",
"indentor",
".",
"getLineIndentLevel",
"(",
"d",
",",
"lineNum",
")",
";",
"String",
"line",
";",
"do",
"{",
"line",
"=",
"GroovyIndentationService",
".",
"getLine",
"(",
"d",
",",
"++",
"lineNum",
")",
";",
"line",
"=",
"line",
".",
"trim",
"(",
")",
";",
"}",
"while",
"(",
"line",
".",
"equals",
"(",
"\"\"",
")",
"&&",
"lineNum",
"<",
"d",
".",
"getNumberOfLines",
"(",
")",
")",
";",
"int",
"nextIndentLevel",
"=",
"indentor",
".",
"getLineIndentLevel",
"(",
"d",
",",
"lineNum",
")",
";",
"if",
"(",
"nextIndentLevel",
">",
"indentLevel",
")",
"return",
"false",
";",
"if",
"(",
"nextIndentLevel",
"<",
"indentLevel",
")",
"return",
"true",
";",
"return",
"!",
"line",
".",
"startsWith",
"(",
"\"}\"",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"</s>"
] |
6,339 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"HighlightingExtenderRegistry",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"IPartitionTokenScanner",
";",
"public",
"class",
"GroovyTextTools",
"{",
"private",
"final",
"GroovyColorManager",
"colorManager",
"=",
"new",
"GroovyColorManager",
"(",
")",
";",
"private",
"IPartitionTokenScanner",
"partitionScanner",
";",
"private",
"HighlightingExtenderRegistry",
"highlightingExtenderRegistry",
";",
"public",
"GroovyColorManager",
"getColorManager",
"(",
")",
"{",
"return",
"colorManager",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"colorManager",
".",
"dispose",
"(",
")",
";",
"highlightingExtenderRegistry",
"=",
"null",
";",
"partitionScanner",
"=",
"null",
";",
"}",
"public",
"IPartitionTokenScanner",
"getGroovyPartitionScanner",
"(",
")",
"{",
"if",
"(",
"partitionScanner",
"==",
"null",
")",
"{",
"partitionScanner",
"=",
"new",
"GroovyPartitionScanner",
"(",
")",
";",
"}",
"return",
"partitionScanner",
";",
"}",
"public",
"HighlightingExtenderRegistry",
"getHighlightingExtenderRegistry",
"(",
")",
"{",
"if",
"(",
"highlightingExtenderRegistry",
"==",
"null",
")",
"{",
"highlightingExtenderRegistry",
"=",
"new",
"HighlightingExtenderRegistry",
"(",
")",
";",
"highlightingExtenderRegistry",
".",
"initialize",
"(",
")",
";",
"}",
"return",
"highlightingExtenderRegistry",
";",
"}",
"}",
"</s>"
] |
6,340 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"java",
".",
"lang",
".",
"reflect",
".",
"InvocationTargetException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"AllCleanUpsAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"ICleanUp",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchSite",
";",
"class",
"NoopCleanUpsAction",
"extends",
"AllCleanUpsAction",
"{",
"public",
"NoopCleanUpsAction",
"(",
"IWorkbenchSite",
"site",
")",
"{",
"super",
"(",
"site",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"dispose",
"(",
")",
"{",
"}",
"@",
"Override",
"protected",
"ICleanUp",
"[",
"]",
"getCleanUps",
"(",
"ICompilationUnit",
"[",
"]",
"units",
")",
"{",
"return",
"new",
"ICleanUp",
"[",
"0",
"]",
";",
"}",
"@",
"Override",
"protected",
"void",
"performRefactoring",
"(",
"ICompilationUnit",
"[",
"]",
"cus",
",",
"ICleanUp",
"[",
"]",
"cleanUps",
")",
"throws",
"InvocationTargetException",
"{",
"}",
"@",
"Override",
"public",
"ICompilationUnit",
"[",
"]",
"getCompilationUnits",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"return",
"new",
"ICompilationUnit",
"[",
"0",
"]",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"ITextSelection",
"selection",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"selectionChanged",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"selectionChanged",
"(",
"ITextSelection",
"selection",
")",
"{",
"}",
"}",
"</s>"
] |
6,341 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassHelper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"GenericsType",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Parameter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"PropertyNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"elements",
".",
"IGroovyResolvedElement",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ContentTypeUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"JavaDebugHover",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"hover",
".",
"JavadocBrowserInformationControlInput",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"java",
".",
"hover",
".",
"JavadocHover",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"javadoc",
".",
"JavadocContentAccess2",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"public",
"class",
"GroovyExtraInformationHover",
"extends",
"JavadocHover",
"{",
"private",
"final",
"boolean",
"alwaysReturnInformation",
";",
"private",
"final",
"JavaDebugHover",
"debugHover",
";",
"public",
"GroovyExtraInformationHover",
"(",
")",
"{",
"alwaysReturnInformation",
"=",
"false",
";",
"this",
".",
"debugHover",
"=",
"new",
"JavaDebugHover",
"(",
")",
";",
"}",
"public",
"GroovyExtraInformationHover",
"(",
"boolean",
"alwaysReturnInformation",
")",
"{",
"this",
".",
"alwaysReturnInformation",
"=",
"alwaysReturnInformation",
";",
"this",
".",
"debugHover",
"=",
"new",
"JavaDebugHover",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"setEditor",
"(",
"IEditorPart",
"editor",
")",
"{",
"super",
".",
"setEditor",
"(",
"editor",
")",
";",
"debugHover",
".",
"setEditor",
"(",
"editor",
")",
";",
"}",
"@",
"Override",
"public",
"Object",
"getHoverInfo2",
"(",
"ITextViewer",
"textViewer",
",",
"IRegion",
"hoverRegion",
")",
"{",
"IEditorPart",
"editor",
"=",
"getEditor",
"(",
")",
";",
"if",
"(",
"editor",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"editor",
".",
"getEditorInput",
"(",
")",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"ContentTypeUtils",
".",
"isGroovyLikeFileName",
"(",
"file",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"alwaysReturnInformation",
")",
"{",
"Object",
"o",
"=",
"debugHover",
".",
"getHoverInfo2",
"(",
"textViewer",
",",
"hoverRegion",
")",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"return",
"null",
";",
"}",
"}",
"IJavaElement",
"[",
"]",
"elements",
"=",
"getJavaElementsAt",
"(",
"textViewer",
",",
"hoverRegion",
")",
";",
"if",
"(",
"shouldComputeHover",
"(",
"elements",
")",
")",
"{",
"return",
"computeHover",
"(",
"hoverRegion",
",",
"elements",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"private",
"boolean",
"shouldComputeHover",
"(",
"IJavaElement",
"[",
"]",
"elements",
")",
"{",
"if",
"(",
"elements",
"!=",
"null",
"&&",
"elements",
".",
"length",
"==",
"1",
")",
"{",
"if",
"(",
"alwaysReturnInformation",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"elements",
"[",
"0",
"]",
"instanceof",
"IGroovyResolvedElement",
")",
"{",
"IGroovyResolvedElement",
"resolvedElt",
"=",
"(",
"IGroovyResolvedElement",
")",
"elements",
"[",
"0",
"]",
";",
"if",
"(",
"(",
"resolvedElt",
".",
"getExtraDoc",
"(",
")",
"!=",
"null",
"&&",
"resolvedElt",
".",
"getExtraDoc",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"Object",
"computeHover",
"(",
"IRegion",
"hoverRegion",
",",
"IJavaElement",
"[",
"]",
"elements",
")",
"{",
"Object",
"hover",
";",
"hover",
"=",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"JavadocHover",
".",
"class",
",",
"\"getHoverInfo\"",
",",
"new",
"Class",
"[",
"]",
"{",
"IJavaElement",
"[",
"]",
".",
"class",
",",
"ITypeRoot",
".",
"class",
",",
"IRegion",
".",
"class",
",",
"JavadocBrowserInformationControlInput",
".",
"class",
"}",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"elements",
",",
"getEditorInputJavaElement",
"(",
")",
",",
"hoverRegion",
",",
"null",
"}",
")",
";",
"if",
"(",
"hover",
"instanceof",
"JavadocBrowserInformationControlInput",
"&&",
"elements",
"[",
"0",
"]",
"instanceof",
"IGroovyResolvedElement",
")",
"{",
"JavadocBrowserInformationControlInput",
"input",
"=",
"(",
"JavadocBrowserInformationControlInput",
")",
"hover",
";",
"hover",
"=",
"new",
"JavadocBrowserInformationControlInput",
"(",
"(",
"JavadocBrowserInformationControlInput",
")",
"input",
".",
"getPrevious",
"(",
")",
",",
"input",
".",
"getElement",
"(",
")",
",",
"wrapHTML",
"(",
"input",
",",
"(",
"IGroovyResolvedElement",
")",
"elements",
"[",
"0",
"]",
")",
",",
"input",
".",
"getLeadingImageWidth",
"(",
")",
")",
";",
"}",
"return",
"hover",
";",
"}",
"protected",
"String",
"wrapHTML",
"(",
"JavadocBrowserInformationControlInput",
"input",
",",
"IGroovyResolvedElement",
"elt",
")",
"{",
"String",
"preamble",
";",
"if",
"(",
"!",
"elt",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"elt",
".",
"getInferredElementName",
"(",
")",
")",
")",
"{",
"preamble",
"=",
"createLabel",
"(",
"elt",
".",
"getInferredElement",
"(",
")",
")",
";",
"}",
"else",
"{",
"preamble",
"=",
"\"\"",
";",
"}",
"if",
"(",
"elt",
".",
"getExtraDoc",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"wrapped",
"=",
"preamble",
"+",
"extraDocAsHtml",
"(",
"elt",
")",
"+",
"\"\"",
"+",
"input",
".",
"getHtml",
"(",
")",
";",
"return",
"wrapped",
";",
"}",
"else",
"{",
"return",
"preamble",
"+",
"input",
".",
"getHtml",
"(",
")",
";",
"}",
"}",
"protected",
"String",
"extraDocAsHtml",
"(",
"IGroovyResolvedElement",
"elt",
")",
"{",
"String",
"extraDoc",
"=",
"\"/**\"",
"+",
"elt",
".",
"getExtraDoc",
"(",
")",
"+",
"\"*/\"",
";",
"if",
"(",
"!",
"extraDoc",
".",
"startsWith",
"(",
"\"/**\"",
")",
")",
"{",
"extraDoc",
"=",
"\"/**\"",
"+",
"extraDoc",
";",
"}",
"if",
"(",
"!",
"extraDoc",
".",
"endsWith",
"(",
"\"*/\"",
")",
")",
"{",
"extraDoc",
"=",
"extraDoc",
"+",
"\"*/\"",
";",
"}",
"return",
"(",
"String",
")",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"JavadocContentAccess2",
".",
"class",
",",
"\"javadoc2HTML\"",
",",
"new",
"Class",
"[",
"]",
"{",
"IMember",
".",
"class",
",",
"String",
".",
"class",
"}",
",",
"null",
",",
"new",
"Object",
"[",
"]",
"{",
"elt",
",",
"extraDoc",
"}",
")",
";",
"}",
"private",
"String",
"createLabel",
"(",
"ASTNode",
"inferredElement",
")",
"{",
"if",
"(",
"inferredElement",
"instanceof",
"PropertyNode",
")",
"{",
"inferredElement",
"=",
"(",
"(",
"PropertyNode",
")",
"inferredElement",
")",
".",
"getField",
"(",
")",
";",
"}",
"String",
"label",
";",
"if",
"(",
"inferredElement",
"instanceof",
"ClassNode",
")",
"{",
"label",
"=",
"createClassLabel",
"(",
"(",
"ClassNode",
")",
"inferredElement",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"MethodNode",
")",
"{",
"label",
"=",
"createMethodLabel",
"(",
"(",
"MethodNode",
")",
"inferredElement",
")",
";",
"}",
"else",
"if",
"(",
"inferredElement",
"instanceof",
"FieldNode",
")",
"{",
"label",
"=",
"createFieldLabel",
"(",
"(",
"FieldNode",
")",
"inferredElement",
")",
";",
"}",
"else",
"{",
"label",
"=",
"inferredElement",
".",
"getText",
"(",
")",
";",
"}",
"return",
"\"<b>\"",
"+",
"label",
"+",
"\"</b><br>n\"",
";",
"}",
"private",
"String",
"createFieldLabel",
"(",
"FieldNode",
"node",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"createClassLabel",
"(",
"node",
".",
"getType",
"(",
")",
")",
")",
";",
"sb",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"sb",
".",
"append",
"(",
"createClassLabel",
"(",
"node",
".",
"getDeclaringClass",
"(",
")",
")",
")",
";",
"sb",
".",
"append",
"(",
"\".\"",
")",
";",
"sb",
".",
"append",
"(",
"node",
".",
"getName",
"(",
")",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"private",
"String",
"createMethodLabel",
"(",
"MethodNode",
"node",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"createClassLabel",
"(",
"node",
".",
"getReturnType",
"(",
")",
")",
")",
";",
"sb",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"sb",
".",
"append",
"(",
"createClassLabel",
"(",
"node",
".",
"getDeclaringClass",
"(",
")",
")",
")",
";",
"sb",
".",
"append",
"(",
"\".\"",
")",
";",
"sb",
".",
"append",
"(",
"node",
".",
"getName",
"(",
")",
")",
";",
"sb",
".",
"append",
"(",
"\"(\"",
")",
";",
"Parameter",
"[",
"]",
"params",
"=",
"node",
".",
"getParameters",
"(",
")",
";",
"if",
"(",
"params",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"params",
".",
"length",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"createClassLabel",
"(",
"params",
"[",
"i",
"]",
".",
"getType",
"(",
")",
")",
")",
";",
"sb",
".",
"append",
"(",
"\"",
"\"",
"+",
"params",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"i",
"<",
"params",
".",
"length",
"-",
"1",
")",
"{",
"sb",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"}",
"}",
"sb",
".",
"append",
"(",
"\")\"",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"private",
"String",
"createClassLabel",
"(",
"ClassNode",
"node",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"node",
"=",
"node",
".",
"redirect",
"(",
")",
";",
"if",
"(",
"ClassHelper",
".",
"DYNAMIC_TYPE",
"==",
"node",
")",
"{",
"return",
"\"def\"",
";",
"}",
"sb",
".",
"append",
"(",
"node",
".",
"getNameWithoutPackage",
"(",
")",
")",
";",
"GenericsType",
"[",
"]",
"genericsTypes",
"=",
"node",
".",
"getGenericsTypes",
"(",
")",
";",
"if",
"(",
"genericsTypes",
"!=",
"null",
"&&",
"genericsTypes",
".",
"length",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"\"",
"<\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"genericsTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"genericsTypes",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"i",
"<",
"genericsTypes",
".",
"length",
"-",
"1",
")",
"{",
"sb",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"}",
"sb",
".",
"append",
"(",
"\">",
"\"",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,342 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IJavaPartitions",
".",
"JAVA_CHARACTER",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IJavaPartitions",
".",
"JAVA_DOC",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IJavaPartitions",
".",
"JAVA_MULTI_LINE_COMMENT",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IJavaPartitions",
".",
"JAVA_SINGLE_LINE_COMMENT",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IJavaPartitions",
".",
"JAVA_STRING",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferenceConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextAttribute",
";",
"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",
".",
"IWordDetector",
";",
"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",
".",
"WordRule",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Color",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"RGB",
";",
"public",
"class",
"GroovyPartitionScanner",
"extends",
"RuleBasedPartitionScanner",
"{",
"public",
"final",
"static",
"String",
"GROOVY_MULTILINE_STRINGS",
"=",
"\"\"",
";",
"public",
"final",
"static",
"String",
"[",
"]",
"LEGAL_CONTENT_TYPES",
"=",
"new",
"String",
"[",
"]",
"{",
"JAVA_DOC",
",",
"JAVA_MULTI_LINE_COMMENT",
",",
"JAVA_SINGLE_LINE_COMMENT",
",",
"JAVA_STRING",
",",
"JAVA_CHARACTER",
",",
"GROOVY_MULTILINE_STRINGS",
"}",
";",
"static",
"class",
"EmptyCommentDetector",
"implements",
"IWordDetector",
"{",
"public",
"boolean",
"isWordStart",
"(",
"char",
"c",
")",
"{",
"return",
"(",
"c",
"==",
"'/'",
")",
";",
"}",
"public",
"boolean",
"isWordPart",
"(",
"char",
"c",
")",
"{",
"return",
"(",
"c",
"==",
"'*'",
"||",
"c",
"==",
"'/'",
")",
";",
"}",
"}",
"static",
"class",
"WordPredicateRule",
"extends",
"WordRule",
"implements",
"IPredicateRule",
"{",
"private",
"final",
"IToken",
"fSuccessToken",
";",
"public",
"WordPredicateRule",
"(",
"IToken",
"successToken",
")",
"{",
"super",
"(",
"new",
"EmptyCommentDetector",
"(",
")",
")",
";",
"fSuccessToken",
"=",
"successToken",
";",
"addWord",
"(",
"\"/**/\"",
",",
"fSuccessToken",
")",
";",
"}",
"public",
"IToken",
"evaluate",
"(",
"ICharacterScanner",
"scanner",
",",
"boolean",
"resume",
")",
"{",
"return",
"super",
".",
"evaluate",
"(",
"scanner",
")",
";",
"}",
"public",
"IToken",
"getSuccessToken",
"(",
")",
"{",
"return",
"fSuccessToken",
";",
"}",
"}",
"public",
"GroovyPartitionScanner",
"(",
")",
"{",
"super",
"(",
")",
";",
"List",
"<",
"IRule",
">",
"rules",
"=",
"createRules",
"(",
"false",
")",
";",
"IPredicateRule",
"[",
"]",
"result",
"=",
"new",
"IPredicateRule",
"[",
"rules",
".",
"size",
"(",
")",
"]",
";",
"rules",
".",
"toArray",
"(",
"result",
")",
";",
"setPredicateRules",
"(",
"result",
")",
";",
"}",
"public",
"static",
"List",
"<",
"IRule",
">",
"createRules",
"(",
"boolean",
"withColor",
")",
"{",
"IPreferenceStore",
"store",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"Object",
"objComment",
";",
"Object",
"objdComment",
";",
"Object",
"objmString",
";",
"Object",
"objsString",
";",
"Object",
"objsComment",
";",
"if",
"(",
"withColor",
")",
"{",
"RGB",
"rgb",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
")",
";",
"objComment",
"=",
"objmString",
"=",
"objsString",
"=",
"objsComment",
"=",
"objdComment",
"=",
"new",
"TextAttribute",
"(",
"new",
"Color",
"(",
"null",
",",
"rgb",
")",
",",
"null",
",",
"SWT",
".",
"ITALIC",
")",
";",
"}",
"else",
"{",
"objComment",
"=",
"JAVA_MULTI_LINE_COMMENT",
";",
"objmString",
"=",
"GROOVY_MULTILINE_STRINGS",
";",
"objsString",
"=",
"JAVA_STRING",
";",
"objsComment",
"=",
"JAVA_SINGLE_LINE_COMMENT",
";",
"objdComment",
"=",
"JAVA_DOC",
";",
"}",
"IToken",
"comment",
"=",
"new",
"Token",
"(",
"objComment",
")",
";",
"IToken",
"mString",
"=",
"new",
"Token",
"(",
"objmString",
")",
";",
"IToken",
"sString",
"=",
"new",
"Token",
"(",
"objsString",
")",
";",
"IToken",
"sComment",
"=",
"new",
"Token",
"(",
"objsComment",
")",
";",
"IToken",
"jdoc",
"=",
"new",
"Token",
"(",
"objdComment",
")",
";",
"List",
"<",
"IRule",
">",
"rules",
"=",
"new",
"ArrayList",
"<",
"IRule",
">",
"(",
")",
";",
"rules",
".",
"add",
"(",
"new",
"EndOfLineRule",
"(",
"\"//\"",
",",
"sComment",
")",
")",
";",
"rules",
".",
"add",
"(",
"new",
"MultiLineRule",
"(",
"\"'''\"",
",",
"\"'''\"",
",",
"mString",
")",
")",
";",
"rules",
".",
"add",
"(",
"new",
"MultiLineRule",
"(",
"\"\\\"\\\"\\\"\"",
",",
"\"\\\"\\\"\\\"\"",
",",
"mString",
")",
")",
";",
"rules",
".",
"add",
"(",
"new",
"SingleLineRule",
"(",
"\"\\\"\"",
",",
"\"\\\"\"",
",",
"sString",
",",
"'\\\\'",
")",
")",
";",
"rules",
".",
"add",
"(",
"new",
"SingleLineRule",
"(",
"\"'\"",
",",
"\"'\"",
",",
"sString",
",",
"'\\\\'",
")",
")",
";",
"if",
"(",
"store",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_SLASHY_STRINGS",
")",
")",
"{",
"rules",
".",
"add",
"(",
"new",
"MultiLineRule",
"(",
"\"$/\"",
",",
"\"/$\"",
",",
"mString",
",",
"'\\0'",
",",
"false",
")",
")",
";",
"}",
"rules",
".",
"add",
"(",
"new",
"WordPredicateRule",
"(",
"comment",
")",
")",
";",
"rules",
".",
"add",
"(",
"new",
"MultiLineRule",
"(",
"\"/**\"",
",",
"\"*/\"",
",",
"jdoc",
",",
"(",
"char",
")",
"0",
",",
"true",
")",
")",
";",
"rules",
".",
"add",
"(",
"new",
"MultiLineRule",
"(",
"\"/*\"",
",",
"\"*/\"",
",",
"comment",
",",
"(",
"char",
")",
"0",
",",
"true",
")",
")",
";",
"return",
"rules",
";",
"}",
"}",
"</s>"
] |
6,343 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"EnsureJUnitFont",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"GroovyDebugOptionsEnforcer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"GroovyJavaDebugElementAdapterFactory",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyOutlineTools",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyTextTools",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
".",
"AskToConvertLegacyProjects",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"DelegatingCleanUpPostSaveListener",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Platform",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"IJDIPreferencesConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"JDIDebugUIPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWTError",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IPageListener",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IPartService",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchWindow",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"Workbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"util",
".",
"PrefUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"plugin",
".",
"AbstractUIPlugin",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"BundleContext",
";",
"public",
"class",
"GroovyPlugin",
"extends",
"AbstractUIPlugin",
"{",
"private",
"final",
"class",
"JUnitPageListener",
"implements",
"IPageListener",
"{",
"public",
"void",
"pageOpened",
"(",
"IWorkbenchPage",
"page",
")",
"{",
"try",
"{",
"IPartService",
"service",
"=",
"(",
"IPartService",
")",
"page",
".",
"getActivePart",
"(",
")",
".",
"getSite",
"(",
")",
".",
"getService",
"(",
"IPartService",
".",
"class",
")",
";",
"service",
".",
"addPartListener",
"(",
"ensure",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"}",
"}",
"public",
"void",
"pageClosed",
"(",
"IWorkbenchPage",
"page",
")",
"{",
"try",
"{",
"IPartService",
"service",
"=",
"(",
"IPartService",
")",
"page",
".",
"getWorkbenchWindow",
"(",
")",
".",
"getService",
"(",
"IPartService",
".",
"class",
")",
";",
"service",
".",
"removePartListener",
"(",
"ensure",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"public",
"void",
"pageActivated",
"(",
"IWorkbenchPage",
"page",
")",
"{",
"}",
"}",
"private",
"static",
"GroovyPlugin",
"plugin",
";",
"static",
"boolean",
"trace",
";",
"private",
"GroovyTextTools",
"textTools",
";",
"private",
"GroovyOutlineTools",
"outlineTools",
";",
"public",
"static",
"final",
"String",
"PLUGIN_ID",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"GROOVY_TEMPLATE_CTX",
"=",
"\"\"",
";",
"private",
"EnsureJUnitFont",
"ensure",
";",
"private",
"IPageListener",
"junitListener",
";",
"private",
"boolean",
"oldPREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT",
";",
"static",
"{",
"String",
"value",
"=",
"Platform",
".",
"getDebugOption",
"(",
"\"\"",
")",
";",
"if",
"(",
"value",
"!=",
"null",
"&&",
"value",
".",
"equalsIgnoreCase",
"(",
"\"true\"",
")",
")",
"GroovyPlugin",
".",
"trace",
"=",
"true",
";",
"}",
"public",
"GroovyPlugin",
"(",
")",
"{",
"super",
"(",
")",
";",
"plugin",
"=",
"this",
";",
"}",
"public",
"static",
"GroovyPlugin",
"getDefault",
"(",
")",
"{",
"return",
"plugin",
";",
"}",
"public",
"static",
"Shell",
"getActiveWorkbenchShell",
"(",
")",
"{",
"IWorkbenchWindow",
"workBenchWindow",
"=",
"getActiveWorkbenchWindow",
"(",
")",
";",
"if",
"(",
"workBenchWindow",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Shell",
"shell",
"=",
"workBenchWindow",
".",
"getShell",
"(",
")",
";",
"if",
"(",
"shell",
"==",
"null",
")",
"{",
"shell",
"=",
"plugin",
".",
"getWorkbench",
"(",
")",
".",
"getDisplay",
"(",
")",
".",
"getActiveShell",
"(",
")",
";",
"}",
"return",
"shell",
";",
"}",
"public",
"static",
"IWorkbenchWindow",
"getActiveWorkbenchWindow",
"(",
")",
"{",
"if",
"(",
"plugin",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"IWorkbench",
"workBench",
"=",
"plugin",
".",
"getWorkbench",
"(",
")",
";",
"if",
"(",
"workBench",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"workBench",
".",
"getActiveWorkbenchWindow",
"(",
")",
";",
"}",
"public",
"void",
"logException",
"(",
"String",
"message",
",",
"Exception",
"exception",
")",
"{",
"log",
"(",
"IStatus",
".",
"ERROR",
",",
"message",
",",
"exception",
")",
";",
"}",
"public",
"void",
"logWarning",
"(",
"final",
"String",
"message",
")",
"{",
"log",
"(",
"IStatus",
".",
"WARNING",
",",
"message",
",",
"null",
")",
";",
"}",
"public",
"void",
"logTraceMessage",
"(",
"String",
"message",
")",
"{",
"log",
"(",
"IStatus",
".",
"INFO",
",",
"message",
",",
"null",
")",
";",
"}",
"private",
"void",
"log",
"(",
"int",
"severity",
",",
"String",
"message",
",",
"Exception",
"exception",
")",
"{",
"final",
"IStatus",
"status",
"=",
"new",
"Status",
"(",
"severity",
",",
"getBundle",
"(",
")",
".",
"getSymbolicName",
"(",
")",
",",
"0",
",",
"message",
",",
"exception",
")",
";",
"getLog",
"(",
")",
".",
"log",
"(",
"status",
")",
";",
"}",
"public",
"static",
"void",
"trace",
"(",
"String",
"message",
")",
"{",
"if",
"(",
"trace",
")",
"{",
"getDefault",
"(",
")",
".",
"logTraceMessage",
"(",
"\"trace:",
"\"",
"+",
"message",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"start",
"(",
"BundleContext",
"context",
")",
"throws",
"Exception",
"{",
"super",
".",
"start",
"(",
"context",
")",
";",
"textTools",
"=",
"new",
"GroovyTextTools",
"(",
")",
";",
"outlineTools",
"=",
"new",
"GroovyOutlineTools",
"(",
")",
";",
"addMonospaceFontListener",
"(",
")",
";",
"DelegatingCleanUpPostSaveListener",
".",
"installCleanUp",
"(",
")",
";",
"IPreferenceStore",
"preferenceStore",
"=",
"JDIDebugUIPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"oldPREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT",
"=",
"preferenceStore",
".",
"getBoolean",
"(",
"IJDIPreferencesConstants",
".",
"PREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT",
")",
";",
"preferenceStore",
".",
"setValue",
"(",
"IJDIPreferencesConstants",
".",
"PREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT",
",",
"false",
")",
";",
"GroovyJavaDebugElementAdapterFactory",
".",
"connect",
"(",
")",
";",
"if",
"(",
"getPreferenceStore",
"(",
")",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FORCE_DEBUG_OPTIONS_ON_STARTUP",
")",
")",
"{",
"new",
"GroovyDebugOptionsEnforcer",
"(",
")",
".",
"maybeForce",
"(",
"getPreferenceStore",
"(",
")",
")",
";",
"}",
"}",
"private",
"void",
"addMonospaceFontListener",
"(",
")",
"{",
"ensure",
"=",
"new",
"EnsureJUnitFont",
"(",
")",
";",
"junitListener",
"=",
"new",
"JUnitPageListener",
"(",
")",
";",
"try",
"{",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"addPageListener",
"(",
"junitListener",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"}",
"getPreferenceStore",
"(",
")",
".",
"addPropertyChangeListener",
"(",
"ensure",
")",
";",
"PrefUtil",
".",
"getInternalPreferenceStore",
"(",
")",
".",
"addPropertyChangeListener",
"(",
"ensure",
")",
";",
"}",
"private",
"void",
"removeMonospaceFontListener",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"isClosing",
"(",
")",
")",
"{",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"removePageListener",
"(",
"junitListener",
")",
";",
"}",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"}",
"catch",
"(",
"SWTError",
"e",
")",
"{",
"}",
"getPreferenceStore",
"(",
")",
".",
"removePropertyChangeListener",
"(",
"ensure",
")",
";",
"PrefUtil",
".",
"getInternalPreferenceStore",
"(",
")",
".",
"removePropertyChangeListener",
"(",
"ensure",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"void",
"maybeAskToConvertLegacyProjects",
"(",
")",
"{",
"AskToConvertLegacyProjects",
"ask",
"=",
"new",
"AskToConvertLegacyProjects",
"(",
")",
";",
"if",
"(",
"getPreferenceStore",
"(",
")",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"GROOVY_ASK_TO_CONVERT_LEGACY_PROJECTS",
")",
")",
"{",
"ask",
".",
"schedule",
"(",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"stop",
"(",
"BundleContext",
"context",
")",
"throws",
"Exception",
"{",
"super",
".",
"stop",
"(",
"context",
")",
";",
"textTools",
".",
"dispose",
"(",
")",
";",
"textTools",
"=",
"null",
";",
"outlineTools",
".",
"dispose",
"(",
")",
";",
"outlineTools",
"=",
"null",
";",
"DelegatingCleanUpPostSaveListener",
".",
"uninstallCleanUp",
"(",
")",
";",
"removeMonospaceFontListener",
"(",
")",
";",
"IPreferenceStore",
"preferenceStore",
"=",
"JDIDebugUIPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"preferenceStore",
".",
"setValue",
"(",
"IJDIPreferencesConstants",
".",
"PREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT",
",",
"oldPREF_ALERT_UNABLE_TO_INSTALL_BREAKPOINT",
")",
";",
"}",
"public",
"GroovyTextTools",
"getTextTools",
"(",
")",
"{",
"return",
"textTools",
";",
"}",
"public",
"GroovyOutlineTools",
"getOutlineTools",
"(",
")",
"{",
"return",
"outlineTools",
";",
"}",
"}",
"</s>"
] |
6,344 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"adapters",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdapterFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"public",
"class",
"GroovyEditorAdapterFactory",
"implements",
"IAdapterFactory",
"{",
"private",
"static",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
"=",
"new",
"Class",
"[",
"]",
"{",
"ModuleNode",
".",
"class",
"}",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Object",
"getAdapter",
"(",
"Object",
"adaptableObject",
",",
"Class",
"adapterType",
")",
"{",
"if",
"(",
"!",
"(",
"adaptableObject",
"instanceof",
"GroovyEditor",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"Object",
"adapter",
"=",
"(",
"(",
"GroovyEditor",
")",
"adaptableObject",
")",
".",
"getEditorInput",
"(",
")",
".",
"getAdapter",
"(",
"adapterType",
")",
";",
"if",
"(",
"adapter",
"!=",
"null",
")",
"return",
"adapter",
";",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"(",
"(",
"GroovyEditor",
")",
"adaptableObject",
")",
".",
"getEditorInput",
"(",
")",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"return",
"adaptFromFile",
"(",
"adapterType",
",",
"file",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"Object",
"adaptFromFile",
"(",
"Class",
"<",
"?",
">",
"adapterType",
",",
"IFile",
"file",
")",
"{",
"if",
"(",
"adapterType",
".",
"isAssignableFrom",
"(",
"ModuleNode",
".",
"class",
")",
")",
"{",
"return",
"getModuleNodeFromFile",
"(",
"file",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"static",
"ModuleNode",
"getModuleNodeFromFile",
"(",
"IFile",
"file",
")",
"{",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"if",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
"{",
"return",
"(",
"(",
"GroovyCompilationUnit",
")",
"unit",
")",
".",
"getModuleNode",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Class",
"[",
"]",
"getAdapterList",
"(",
")",
"{",
"return",
"classes",
";",
"}",
"}",
"</s>"
] |
6,345 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"adapters",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdapterFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IFileEditorInput",
";",
"public",
"class",
"GroovyIFileEditorInputAdapterFactory",
"implements",
"IAdapterFactory",
"{",
"private",
"static",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
"=",
"new",
"Class",
"[",
"]",
"{",
"ClassNode",
".",
"class",
"}",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Object",
"getAdapter",
"(",
"Object",
"adaptableObject",
",",
"Class",
"adapterType",
")",
"{",
"Object",
"returnValue",
"=",
"null",
";",
"if",
"(",
"(",
"ClassNode",
".",
"class",
".",
"equals",
"(",
"adapterType",
")",
"||",
"ClassNode",
"[",
"]",
".",
"class",
".",
"equals",
"(",
"adapterType",
")",
")",
"&&",
"adaptableObject",
"instanceof",
"IFileEditorInput",
")",
"{",
"try",
"{",
"IFileEditorInput",
"fileEditor",
"=",
"(",
"IFileEditorInput",
")",
"adaptableObject",
";",
"returnValue",
"=",
"fileEditor",
".",
"getFile",
"(",
")",
".",
"getAdapter",
"(",
"adapterType",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"ex",
")",
";",
"}",
"}",
"return",
"returnValue",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Class",
"[",
"]",
"getAdapterList",
"(",
")",
"{",
"return",
"classes",
";",
"}",
"}",
"</s>"
] |
6,346 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"filebuffers",
".",
"FileBuffers",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"filebuffers",
".",
"ITextFileBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"filebuffers",
".",
"ITextFileBufferManager",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"filebuffers",
".",
"LocationKind",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ProjectScope",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"SubProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"DefaultScope",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"InstanceScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpPreferenceUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpRefactoring",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpRefactoring",
".",
"CleanUpChange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"FixMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"refactoring",
".",
"util",
".",
"RefactoringASTParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"ActionUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"dialogs",
".",
"OptionalMessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"fix",
".",
"IMultiLineCleanUp",
".",
"MultiLineCleanUpContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"fix",
".",
"MapCleanUpOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"saveparticipant",
".",
"IPostSaveListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"preferences",
".",
"BulletListBlock",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"preferences",
".",
"SaveParticipantPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaUI",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"SharedASTProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"CleanUpContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"CleanUpOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"CleanUpRequirements",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"ICleanUp",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"Dialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"IDialogConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadPositionCategoryException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"DefaultPositionUpdater",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocumentExtension4",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Region",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"Change",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"CompositeChange",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"IRefactoringCoreStatusCodes",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"IUndoManager",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"NullChange",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"PerformChangeOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringCore",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"TextFileChange",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"ui",
".",
"refactoring",
".",
"RefactoringUI",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"TextLayout",
";",
"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",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Link",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"UndoEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"PreferencesUtil",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"class",
"CleanUpPostSaveListener",
"implements",
"IPostSaveListener",
"{",
"private",
"static",
"class",
"CleanUpSaveUndo",
"extends",
"TextFileChange",
"{",
"private",
"final",
"IFile",
"fFile",
";",
"private",
"final",
"UndoEdit",
"[",
"]",
"fUndos",
";",
"private",
"final",
"long",
"fDocumentStamp",
";",
"private",
"final",
"long",
"fFileStamp",
";",
"public",
"CleanUpSaveUndo",
"(",
"String",
"name",
",",
"IFile",
"file",
",",
"UndoEdit",
"[",
"]",
"undos",
",",
"long",
"documentStamp",
",",
"long",
"fileStamp",
")",
"{",
"super",
"(",
"name",
",",
"file",
")",
";",
"Assert",
".",
"isNotNull",
"(",
"undos",
")",
";",
"fDocumentStamp",
"=",
"documentStamp",
";",
"fFileStamp",
"=",
"fileStamp",
";",
"fFile",
"=",
"file",
";",
"fUndos",
"=",
"undos",
";",
"}",
"@",
"Override",
"public",
"final",
"boolean",
"needsSaving",
"(",
")",
"{",
"return",
"true",
";",
"}",
"@",
"Override",
"public",
"Change",
"perform",
"(",
"IProgressMonitor",
"pm",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"isValid",
"(",
"pm",
")",
".",
"hasFatalError",
"(",
")",
")",
"return",
"new",
"NullChange",
"(",
")",
";",
"if",
"(",
"pm",
"==",
"null",
")",
"pm",
"=",
"new",
"NullProgressMonitor",
"(",
")",
";",
"ITextFileBufferManager",
"manager",
"=",
"FileBuffers",
".",
"getTextFileBufferManager",
"(",
")",
";",
"pm",
".",
"beginTask",
"(",
"\"\"",
",",
"2",
")",
";",
"ITextFileBuffer",
"buffer",
"=",
"null",
";",
"try",
"{",
"manager",
".",
"connect",
"(",
"fFile",
".",
"getFullPath",
"(",
")",
",",
"LocationKind",
".",
"IFILE",
",",
"new",
"SubProgressMonitor",
"(",
"pm",
",",
"1",
")",
")",
";",
"buffer",
"=",
"manager",
".",
"getTextFileBuffer",
"(",
"fFile",
".",
"getFullPath",
"(",
")",
",",
"LocationKind",
".",
"IFILE",
")",
";",
"IDocument",
"document",
"=",
"buffer",
".",
"getDocument",
"(",
")",
";",
"long",
"oldFileValue",
"=",
"fFile",
".",
"getModificationStamp",
"(",
")",
";",
"long",
"oldDocValue",
";",
"if",
"(",
"document",
"instanceof",
"IDocumentExtension4",
")",
"{",
"oldDocValue",
"=",
"(",
"(",
"IDocumentExtension4",
")",
"document",
")",
".",
"getModificationStamp",
"(",
")",
";",
"}",
"else",
"{",
"oldDocValue",
"=",
"oldFileValue",
";",
"}",
"LinkedList",
"list",
"=",
"new",
"LinkedList",
"(",
")",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"fUndos",
".",
"length",
";",
"index",
"++",
")",
"{",
"UndoEdit",
"edit",
"=",
"fUndos",
"[",
"index",
"]",
";",
"UndoEdit",
"redo",
"=",
"edit",
".",
"apply",
"(",
"document",
",",
"TextEdit",
".",
"CREATE_UNDO",
")",
";",
"list",
".",
"addFirst",
"(",
"redo",
")",
";",
"}",
"boolean",
"stampSetted",
"=",
"false",
";",
"if",
"(",
"document",
"instanceof",
"IDocumentExtension4",
"&&",
"fDocumentStamp",
"!=",
"IDocumentExtension4",
".",
"UNKNOWN_MODIFICATION_STAMP",
")",
"{",
"try",
"{",
"(",
"(",
"IDocumentExtension4",
")",
"document",
")",
".",
"replace",
"(",
"0",
",",
"0",
",",
"\"\"",
",",
"fDocumentStamp",
")",
";",
"stampSetted",
"=",
"true",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"throw",
"wrapBadLocationException",
"(",
"e",
")",
";",
"}",
"}",
"buffer",
".",
"commit",
"(",
"pm",
",",
"false",
")",
";",
"if",
"(",
"!",
"stampSetted",
")",
"{",
"fFile",
".",
"revertModificationStamp",
"(",
"fFileStamp",
")",
";",
"}",
"return",
"new",
"CleanUpSaveUndo",
"(",
"getName",
"(",
")",
",",
"fFile",
",",
"(",
"(",
"UndoEdit",
"[",
"]",
")",
"list",
".",
"toArray",
"(",
"new",
"UndoEdit",
"[",
"list",
".",
"size",
"(",
")",
"]",
")",
")",
",",
"oldDocValue",
",",
"oldFileValue",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"throw",
"wrapBadLocationException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"buffer",
"!=",
"null",
")",
"manager",
".",
"disconnect",
"(",
"fFile",
".",
"getFullPath",
"(",
")",
",",
"LocationKind",
".",
"IFILE",
",",
"new",
"SubProgressMonitor",
"(",
"pm",
",",
"1",
")",
")",
";",
"assertDocumentGreclipse1452",
"(",
"buffer",
")",
";",
"}",
"}",
"}",
"private",
"static",
"final",
"class",
"SlowCleanUpWarningDialog",
"extends",
"OptionalMessageDialog",
"{",
"private",
"static",
"final",
"String",
"ID",
"=",
"\"\"",
";",
"private",
"final",
"String",
"fCleanUpNames",
";",
"protected",
"SlowCleanUpWarningDialog",
"(",
"Shell",
"parent",
",",
"String",
"title",
",",
"String",
"cleanUpNames",
")",
"{",
"super",
"(",
"ID",
",",
"parent",
",",
"title",
",",
"null",
",",
"null",
",",
"MessageDialog",
".",
"WARNING",
",",
"new",
"String",
"[",
"]",
"{",
"IDialogConstants",
".",
"OK_LABEL",
",",
"IDialogConstants",
".",
"CANCEL_LABEL",
"}",
",",
"0",
")",
";",
"fCleanUpNames",
"=",
"cleanUpNames",
";",
"}",
"@",
"Override",
"protected",
"Control",
"createMessageArea",
"(",
"Composite",
"parent",
")",
"{",
"initializeDialogUnits",
"(",
"parent",
")",
";",
"Composite",
"messageComposite",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"messageComposite",
".",
"setFont",
"(",
"parent",
".",
"getFont",
"(",
")",
")",
";",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
")",
";",
"layout",
".",
"numColumns",
"=",
"1",
";",
"layout",
".",
"marginHeight",
"=",
"0",
";",
"layout",
".",
"marginWidth",
"=",
"0",
";",
"layout",
".",
"verticalSpacing",
"=",
"convertVerticalDLUsToPixels",
"(",
"IDialogConstants",
".",
"VERTICAL_SPACING",
")",
";",
"layout",
".",
"horizontalSpacing",
"=",
"convertHorizontalDLUsToPixels",
"(",
"IDialogConstants",
".",
"HORIZONTAL_SPACING",
")",
";",
"messageComposite",
".",
"setLayout",
"(",
"layout",
")",
";",
"messageComposite",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"FILL",
",",
"true",
",",
"true",
")",
")",
";",
"Label",
"explain",
"=",
"new",
"Label",
"(",
"messageComposite",
",",
"SWT",
".",
"WRAP",
")",
";",
"explain",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
")",
";",
"explain",
".",
"setText",
"(",
"FixMessages",
".",
"CleanUpPostSaveListener_SlowCleanUpWarningDialog_explain",
")",
";",
"final",
"BulletListBlock",
"cleanUpListBlock",
"=",
"new",
"BulletListBlock",
"(",
"messageComposite",
",",
"SWT",
".",
"NONE",
")",
";",
"GridData",
"gridData",
"=",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"FILL",
",",
"true",
",",
"true",
")",
";",
"cleanUpListBlock",
".",
"setLayoutData",
"(",
"gridData",
")",
";",
"cleanUpListBlock",
".",
"setText",
"(",
"fCleanUpNames",
")",
";",
"TextLayout",
"textLayout",
"=",
"new",
"TextLayout",
"(",
"messageComposite",
".",
"getDisplay",
"(",
")",
")",
";",
"textLayout",
".",
"setText",
"(",
"fCleanUpNames",
")",
";",
"int",
"lineCount",
"=",
"textLayout",
".",
"getLineCount",
"(",
")",
";",
"if",
"(",
"lineCount",
"<",
"5",
")",
"gridData",
".",
"heightHint",
"=",
"textLayout",
".",
"getLineBounds",
"(",
"0",
")",
".",
"height",
"*",
"6",
";",
"textLayout",
".",
"dispose",
"(",
")",
";",
"Link",
"link",
"=",
"new",
"Link",
"(",
"messageComposite",
",",
"SWT",
".",
"NONE",
")",
";",
"link",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
")",
";",
"link",
".",
"setText",
"(",
"FixMessages",
".",
"CleanUpPostSaveListener_SlowCleanUpDialog_link",
")",
";",
"link",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"PreferencesUtil",
".",
"createPreferenceDialogOn",
"(",
"getShell",
"(",
")",
",",
"SaveParticipantPreferencePage",
".",
"PREFERENCE_PAGE_ID",
",",
"null",
",",
"null",
")",
".",
"open",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"messageComposite",
";",
"}",
"}",
"public",
"static",
"final",
"String",
"POSTSAVELISTENER_ID",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"WARNING_VALUE",
"=",
"\"warning\"",
";",
"private",
"static",
"final",
"String",
"ERROR_VALUE",
"=",
"\"error\"",
";",
"private",
"static",
"final",
"String",
"CHANGED_REGION_POSITION_CATEGORY",
"=",
"\"\"",
";",
"private",
"static",
"boolean",
"FIRST_CALL",
"=",
"false",
";",
"private",
"static",
"boolean",
"FIRST_CALL_DONE",
"=",
"false",
";",
"public",
"boolean",
"needsChangedRegions",
"(",
"ICompilationUnit",
"unit",
")",
"throws",
"CoreException",
"{",
"ICleanUp",
"[",
"]",
"cleanUps",
"=",
"getCleanUps",
"(",
"unit",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"return",
"requiresChangedRegions",
"(",
"cleanUps",
")",
";",
"}",
"public",
"void",
"saved",
"(",
"ICompilationUnit",
"unit",
",",
"IRegion",
"[",
"]",
"changedRegions",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"monitor",
"==",
"null",
")",
"monitor",
"=",
"new",
"NullProgressMonitor",
"(",
")",
";",
"monitor",
".",
"beginTask",
"(",
"getName",
"(",
")",
",",
"IProgressMonitor",
".",
"UNKNOWN",
")",
";",
"try",
"{",
"if",
"(",
"!",
"ActionUtil",
".",
"isOnBuildPath",
"(",
"unit",
")",
")",
"return",
";",
"IProject",
"proj",
"=",
"unit",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
";",
"if",
"(",
"proj",
"==",
"null",
"||",
"!",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"proj",
")",
")",
"{",
"return",
";",
"}",
"ICleanUp",
"[",
"]",
"cleanUps",
"=",
"getCleanUps",
"(",
"unit",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"long",
"oldFileValue",
"=",
"unit",
".",
"getResource",
"(",
")",
".",
"getModificationStamp",
"(",
")",
";",
"long",
"oldDocValue",
"=",
"getDocumentStamp",
"(",
"(",
"IFile",
")",
"unit",
".",
"getResource",
"(",
")",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"2",
")",
")",
";",
"CompositeChange",
"result",
"=",
"new",
"CompositeChange",
"(",
"FixMessages",
".",
"CleanUpPostSaveListener_SaveAction_ChangeName",
")",
";",
"LinkedList",
"undoEdits",
"=",
"new",
"LinkedList",
"(",
")",
";",
"if",
"(",
"FIRST_CALL",
"&&",
"!",
"FIRST_CALL_DONE",
")",
"{",
"FIRST_CALL",
"=",
"false",
";",
"FIRST_CALL_DONE",
"=",
"true",
";",
"}",
"else",
"{",
"FIRST_CALL",
"=",
"true",
";",
"}",
"HashSet",
"slowCleanUps",
";",
"if",
"(",
"FIRST_CALL_DONE",
")",
"{",
"slowCleanUps",
"=",
"new",
"HashSet",
"(",
")",
";",
"}",
"else",
"{",
"slowCleanUps",
"=",
"null",
";",
"}",
"IUndoManager",
"manager",
"=",
"RefactoringCore",
".",
"getUndoManager",
"(",
")",
";",
"boolean",
"success",
"=",
"false",
";",
"try",
"{",
"manager",
".",
"aboutToPerformChange",
"(",
"result",
")",
";",
"do",
"{",
"RefactoringStatus",
"preCondition",
"=",
"new",
"RefactoringStatus",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cleanUps",
".",
"length",
";",
"i",
"++",
")",
"{",
"RefactoringStatus",
"conditions",
"=",
"cleanUps",
"[",
"i",
"]",
".",
"checkPreConditions",
"(",
"unit",
".",
"getJavaProject",
"(",
")",
",",
"new",
"ICompilationUnit",
"[",
"]",
"{",
"unit",
"}",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"5",
")",
")",
";",
"preCondition",
".",
"merge",
"(",
"conditions",
")",
";",
"}",
"if",
"(",
"showStatus",
"(",
"preCondition",
")",
"!=",
"Window",
".",
"OK",
")",
"return",
";",
"Map",
"options",
"=",
"new",
"HashMap",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cleanUps",
".",
"length",
";",
"i",
"++",
")",
"{",
"Map",
"map",
"=",
"cleanUps",
"[",
"i",
"]",
".",
"getRequirements",
"(",
")",
".",
"getCompilerOptions",
"(",
")",
";",
"if",
"(",
"map",
"!=",
"null",
")",
"{",
"options",
".",
"putAll",
"(",
"map",
")",
";",
"}",
"}",
"CompilationUnit",
"ast",
"=",
"null",
";",
"if",
"(",
"requiresAST",
"(",
"cleanUps",
")",
")",
"{",
"ast",
"=",
"createAst",
"(",
"unit",
",",
"options",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"10",
")",
")",
";",
"}",
"CleanUpContext",
"context",
";",
"if",
"(",
"changedRegions",
"==",
"null",
")",
"{",
"context",
"=",
"new",
"CleanUpContext",
"(",
"unit",
",",
"ast",
")",
";",
"}",
"else",
"{",
"context",
"=",
"new",
"MultiLineCleanUpContext",
"(",
"unit",
",",
"ast",
",",
"changedRegions",
")",
";",
"}",
"ArrayList",
"undoneCleanUps",
"=",
"new",
"ArrayList",
"(",
")",
";",
"CleanUpChange",
"change",
"=",
"CleanUpRefactoring",
".",
"calculateChange",
"(",
"context",
",",
"cleanUps",
",",
"undoneCleanUps",
",",
"slowCleanUps",
")",
";",
"RefactoringStatus",
"postCondition",
"=",
"new",
"RefactoringStatus",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cleanUps",
".",
"length",
";",
"i",
"++",
")",
"{",
"RefactoringStatus",
"conditions",
"=",
"cleanUps",
"[",
"i",
"]",
".",
"checkPostConditions",
"(",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"postCondition",
".",
"merge",
"(",
"conditions",
")",
";",
"}",
"if",
"(",
"showStatus",
"(",
"postCondition",
")",
"!=",
"Window",
".",
"OK",
")",
"return",
";",
"cleanUps",
"=",
"(",
"ICleanUp",
"[",
"]",
")",
"undoneCleanUps",
".",
"toArray",
"(",
"new",
"ICleanUp",
"[",
"undoneCleanUps",
".",
"size",
"(",
")",
"]",
")",
";",
"if",
"(",
"change",
"!=",
"null",
")",
"{",
"result",
".",
"add",
"(",
"change",
")",
";",
"change",
".",
"setSaveMode",
"(",
"TextFileChange",
".",
"LEAVE_DIRTY",
")",
";",
"change",
".",
"initializeValidationData",
"(",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"PerformChangeOperation",
"performChangeOperation",
"=",
"RefactoringUI",
".",
"createUIAwareChangeOperation",
"(",
"change",
")",
";",
"performChangeOperation",
".",
"setSchedulingRule",
"(",
"unit",
".",
"getSchedulingRule",
"(",
")",
")",
";",
"if",
"(",
"changedRegions",
"!=",
"null",
"&&",
"changedRegions",
".",
"length",
">",
"0",
"&&",
"requiresChangedRegions",
"(",
"cleanUps",
")",
")",
"{",
"changedRegions",
"=",
"performWithChangedRegionUpdate",
"(",
"performChangeOperation",
",",
"changedRegions",
",",
"unit",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"5",
")",
")",
";",
"}",
"else",
"{",
"performChangeOperation",
".",
"run",
"(",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"5",
")",
")",
";",
"}",
"performChangeOperation",
".",
"getUndoChange",
"(",
")",
";",
"undoEdits",
".",
"addFirst",
"(",
"change",
".",
"getUndoEdit",
"(",
")",
")",
";",
"}",
"}",
"while",
"(",
"cleanUps",
".",
"length",
">",
"0",
")",
";",
"success",
"=",
"true",
";",
"}",
"finally",
"{",
"manager",
".",
"changePerformed",
"(",
"result",
",",
"success",
")",
";",
"}",
"if",
"(",
"undoEdits",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"UndoEdit",
"[",
"]",
"undoEditArray",
"=",
"(",
"UndoEdit",
"[",
"]",
")",
"undoEdits",
".",
"toArray",
"(",
"new",
"UndoEdit",
"[",
"undoEdits",
".",
"size",
"(",
")",
"]",
")",
";",
"CleanUpSaveUndo",
"undo",
"=",
"new",
"CleanUpSaveUndo",
"(",
"result",
".",
"getName",
"(",
")",
",",
"(",
"IFile",
")",
"unit",
".",
"getResource",
"(",
")",
",",
"undoEditArray",
",",
"oldDocValue",
",",
"oldFileValue",
")",
";",
"undo",
".",
"initializeValidationData",
"(",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"manager",
".",
"addUndo",
"(",
"result",
".",
"getName",
"(",
")",
",",
"undo",
")",
";",
"}",
"if",
"(",
"slowCleanUps",
"!=",
"null",
"&&",
"slowCleanUps",
".",
"size",
"(",
")",
">",
"0",
")",
"showSlowCleanUpsWarning",
"(",
"slowCleanUps",
")",
";",
"}",
"finally",
"{",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"private",
"ICleanUp",
"[",
"]",
"getCleanUps",
"(",
"IProject",
"project",
")",
"throws",
"CoreException",
"{",
"ICleanUp",
"[",
"]",
"cleanUps",
";",
"Map",
"settings",
"=",
"CleanUpPreferenceUtil",
".",
"loadSaveParticipantOptions",
"(",
"new",
"ProjectScope",
"(",
"project",
")",
")",
";",
"if",
"(",
"settings",
"==",
"null",
")",
"{",
"IEclipsePreferences",
"contextNode",
"=",
"new",
"InstanceScope",
"(",
")",
".",
"getNode",
"(",
"JavaUI",
".",
"ID_PLUGIN",
")",
";",
"String",
"id",
"=",
"contextNode",
".",
"get",
"(",
"CleanUpConstants",
".",
"CLEANUP_ON_SAVE_PROFILE",
",",
"null",
")",
";",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"id",
"=",
"new",
"DefaultScope",
"(",
")",
".",
"getNode",
"(",
"JavaUI",
".",
"ID_PLUGIN",
")",
".",
"get",
"(",
"CleanUpConstants",
".",
"CLEANUP_ON_SAVE_PROFILE",
",",
"CleanUpConstants",
".",
"DEFAULT_SAVE_PARTICIPANT_PROFILE",
")",
";",
"}",
"throw",
"new",
"CoreException",
"(",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"JavaUI",
".",
"ID_PLUGIN",
",",
"Messages",
".",
"format",
"(",
"FixMessages",
".",
"CleanUpPostSaveListener_unknown_profile_error_message",
",",
"id",
")",
")",
")",
";",
"}",
"if",
"(",
"CleanUpOptions",
".",
"TRUE",
".",
"equals",
"(",
"settings",
".",
"get",
"(",
"CleanUpConstants",
".",
"CLEANUP_ON_SAVE_ADDITIONAL_OPTIONS",
")",
")",
")",
"{",
"cleanUps",
"=",
"getCleanUps",
"(",
"settings",
",",
"null",
")",
";",
"}",
"else",
"{",
"HashMap",
"filteredSettins",
"=",
"new",
"HashMap",
"(",
")",
";",
"filteredSettins",
".",
"put",
"(",
"CleanUpConstants",
".",
"FORMAT_SOURCE_CODE",
",",
"settings",
".",
"get",
"(",
"CleanUpConstants",
".",
"FORMAT_SOURCE_CODE",
")",
")",
";",
"filteredSettins",
".",
"put",
"(",
"CleanUpConstants",
".",
"FORMAT_SOURCE_CODE_CHANGES_ONLY",
",",
"settings",
".",
"get",
"(",
"CleanUpConstants",
".",
"FORMAT_SOURCE_CODE_CHANGES_ONLY",
")",
")",
";",
"filteredSettins",
".",
"put",
"(",
"CleanUpConstants",
".",
"ORGANIZE_IMPORTS",
",",
"settings",
".",
"get",
"(",
"CleanUpConstants",
".",
"ORGANIZE_IMPORTS",
")",
")",
";",
"filteredSettins",
".",
"put",
"(",
"CleanUpConstants",
".",
"FORMAT_REMOVE_TRAILING_WHITESPACES",
",",
"settings",
".",
"get",
"(",
"CleanUpConstants",
".",
"FORMAT_REMOVE_TRAILING_WHITESPACES",
")",
")",
";",
"filteredSettins",
".",
"put",
"(",
"CleanUpConstants",
".",
"FORMAT_REMOVE_TRAILING_WHITESPACES_ALL",
",",
"settings",
".",
"get",
"(",
"CleanUpConstants",
".",
"FORMAT_REMOVE_TRAILING_WHITESPACES_ALL",
")",
")",
";",
"filteredSettins",
".",
"put",
"(",
"CleanUpConstants",
".",
"FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY",
",",
"settings",
".",
"get",
"(",
"CleanUpConstants",
".",
"FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY",
")",
")",
";",
"Set",
"ids",
"=",
"new",
"HashSet",
"(",
"2",
")",
";",
"ids",
".",
"add",
"(",
"\"\"",
")",
";",
"ids",
".",
"add",
"(",
"\"\"",
")",
";",
"cleanUps",
"=",
"getCleanUps",
"(",
"filteredSettins",
",",
"ids",
")",
";",
"}",
"return",
"cleanUps",
";",
"}",
"protected",
"ICleanUp",
"[",
"]",
"getCleanUps",
"(",
"Map",
"settings",
",",
"Set",
"ids",
")",
"{",
"ICleanUp",
"[",
"]",
"result",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getCleanUpRegistry",
"(",
")",
".",
"createCleanUps",
"(",
"ids",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"result",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
".",
"setOptions",
"(",
"new",
"MapCleanUpOptions",
"(",
"settings",
")",
")",
";",
"}",
"return",
"result",
";",
"}",
"private",
"int",
"showStatus",
"(",
"RefactoringStatus",
"status",
")",
"{",
"if",
"(",
"!",
"status",
".",
"hasError",
"(",
")",
")",
"return",
"Window",
".",
"OK",
";",
"Shell",
"shell",
"=",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
";",
"Dialog",
"dialog",
"=",
"RefactoringUI",
".",
"createRefactoringStatusDialog",
"(",
"status",
",",
"shell",
",",
"\"\"",
",",
"false",
")",
";",
"return",
"dialog",
".",
"open",
"(",
")",
";",
"}",
"private",
"long",
"getDocumentStamp",
"(",
"IFile",
"file",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"final",
"ITextFileBufferManager",
"manager",
"=",
"FileBuffers",
".",
"getTextFileBufferManager",
"(",
")",
";",
"final",
"IPath",
"path",
"=",
"file",
".",
"getFullPath",
"(",
")",
";",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"2",
")",
";",
"ITextFileBuffer",
"buffer",
"=",
"null",
";",
"try",
"{",
"manager",
".",
"connect",
"(",
"path",
",",
"LocationKind",
".",
"IFILE",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"buffer",
"=",
"manager",
".",
"getTextFileBuffer",
"(",
"path",
",",
"LocationKind",
".",
"IFILE",
")",
";",
"IDocument",
"document",
"=",
"buffer",
".",
"getDocument",
"(",
")",
";",
"if",
"(",
"document",
"instanceof",
"IDocumentExtension4",
")",
"{",
"return",
"(",
"(",
"IDocumentExtension4",
")",
"document",
")",
".",
"getModificationStamp",
"(",
")",
";",
"}",
"else",
"{",
"return",
"file",
".",
"getModificationStamp",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"buffer",
"!=",
"null",
")",
"manager",
".",
"disconnect",
"(",
"path",
",",
"LocationKind",
".",
"IFILE",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"assertDocumentGreclipse1452",
"(",
"buffer",
")",
";",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"private",
"IRegion",
"[",
"]",
"performWithChangedRegionUpdate",
"(",
"PerformChangeOperation",
"performChangeOperation",
",",
"IRegion",
"[",
"]",
"changedRegions",
",",
"ICompilationUnit",
"unit",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"final",
"ITextFileBufferManager",
"manager",
"=",
"FileBuffers",
".",
"getTextFileBufferManager",
"(",
")",
";",
"final",
"IPath",
"path",
"=",
"unit",
".",
"getResource",
"(",
")",
".",
"getFullPath",
"(",
")",
";",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"7",
")",
";",
"ITextFileBuffer",
"buffer",
"=",
"null",
";",
"try",
"{",
"manager",
".",
"connect",
"(",
"path",
",",
"LocationKind",
".",
"IFILE",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"buffer",
"=",
"manager",
".",
"getTextFileBuffer",
"(",
"path",
",",
"LocationKind",
".",
"IFILE",
")",
";",
"IDocument",
"document",
"=",
"buffer",
".",
"getDocument",
"(",
")",
";",
"document",
".",
"addPositionCategory",
"(",
"CHANGED_REGION_POSITION_CATEGORY",
")",
";",
"DefaultPositionUpdater",
"updater",
"=",
"new",
"DefaultPositionUpdater",
"(",
"CHANGED_REGION_POSITION_CATEGORY",
")",
";",
"try",
"{",
"document",
".",
"addPositionUpdater",
"(",
"updater",
")",
";",
"Position",
"[",
"]",
"positions",
"=",
"new",
"Position",
"[",
"changedRegions",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"changedRegions",
".",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"Position",
"position",
"=",
"new",
"Position",
"(",
"changedRegions",
"[",
"i",
"]",
".",
"getOffset",
"(",
")",
",",
"changedRegions",
"[",
"i",
"]",
".",
"getLength",
"(",
")",
")",
";",
"document",
".",
"addPosition",
"(",
"CHANGED_REGION_POSITION_CATEGORY",
",",
"position",
")",
";",
"positions",
"[",
"i",
"]",
"=",
"position",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"throw",
"wrapBadLocationException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"throw",
"wrapBadPositionCategoryException",
"(",
"e",
")",
";",
"}",
"}",
"performChangeOperation",
".",
"run",
"(",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"5",
")",
")",
";",
"ArrayList",
"result",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"positions",
".",
"length",
";",
"i",
"++",
")",
"{",
"Position",
"position",
"=",
"positions",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"position",
".",
"isDeleted",
"(",
")",
")",
"result",
".",
"add",
"(",
"new",
"Region",
"(",
"position",
".",
"getOffset",
"(",
")",
",",
"position",
".",
"getLength",
"(",
")",
")",
")",
";",
"}",
"return",
"(",
"IRegion",
"[",
"]",
")",
"result",
".",
"toArray",
"(",
"new",
"IRegion",
"[",
"result",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"finally",
"{",
"document",
".",
"removePositionUpdater",
"(",
"updater",
")",
";",
"try",
"{",
"document",
".",
"removePositionCategory",
"(",
"CHANGED_REGION_POSITION_CATEGORY",
")",
";",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"throw",
"wrapBadPositionCategoryException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"if",
"(",
"buffer",
"!=",
"null",
")",
"manager",
".",
"disconnect",
"(",
"path",
",",
"LocationKind",
".",
"IFILE",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"assertDocumentGreclipse1452",
"(",
"buffer",
")",
";",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"private",
"boolean",
"requiresAST",
"(",
"ICleanUp",
"[",
"]",
"cleanUps",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cleanUps",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"cleanUps",
"[",
"i",
"]",
".",
"getRequirements",
"(",
")",
".",
"requiresAST",
"(",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"requiresChangedRegions",
"(",
"ICleanUp",
"[",
"]",
"cleanUps",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cleanUps",
".",
"length",
";",
"i",
"++",
")",
"{",
"CleanUpRequirements",
"requirements",
"=",
"cleanUps",
"[",
"i",
"]",
".",
"getRequirements",
"(",
")",
";",
"if",
"(",
"requirements",
".",
"requiresChangedRegions",
"(",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"private",
"CompilationUnit",
"createAst",
"(",
"ICompilationUnit",
"unit",
",",
"Map",
"cleanUpOptions",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"IJavaProject",
"project",
"=",
"unit",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"compatibleOptions",
"(",
"project",
",",
"cleanUpOptions",
")",
")",
"{",
"CompilationUnit",
"ast",
"=",
"SharedASTProvider",
".",
"getAST",
"(",
"unit",
",",
"SharedASTProvider",
".",
"WAIT_NO",
",",
"monitor",
")",
";",
"if",
"(",
"ast",
"!=",
"null",
")",
"return",
"ast",
";",
"}",
"ASTParser",
"parser",
"=",
"CleanUpRefactoring",
".",
"createCleanUpASTParser",
"(",
")",
";",
"parser",
".",
"setSource",
"(",
"unit",
")",
";",
"Map",
"compilerOptions",
"=",
"RefactoringASTParser",
".",
"getCompilerOptions",
"(",
"unit",
".",
"getJavaProject",
"(",
")",
")",
";",
"compilerOptions",
".",
"putAll",
"(",
"cleanUpOptions",
")",
";",
"parser",
".",
"setCompilerOptions",
"(",
"compilerOptions",
")",
";",
"return",
"(",
"CompilationUnit",
")",
"parser",
".",
"createAST",
"(",
"monitor",
")",
";",
"}",
"private",
"boolean",
"compatibleOptions",
"(",
"IJavaProject",
"project",
",",
"Map",
"cleanUpOptions",
")",
"{",
"if",
"(",
"cleanUpOptions",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"true",
";",
"Map",
"projectOptions",
"=",
"project",
".",
"getOptions",
"(",
"true",
")",
";",
"for",
"(",
"Iterator",
"iterator",
"=",
"cleanUpOptions",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"String",
"key",
"=",
"(",
"String",
")",
"iterator",
".",
"next",
"(",
")",
";",
"String",
"projectOption",
"=",
"(",
"String",
")",
"projectOptions",
".",
"get",
"(",
"key",
")",
";",
"String",
"cleanUpOption",
"=",
"(",
"String",
")",
"cleanUpOptions",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"!",
"strongerEquals",
"(",
"projectOption",
",",
"cleanUpOption",
")",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"private",
"boolean",
"strongerEquals",
"(",
"String",
"projectOption",
",",
"String",
"cleanUpOption",
")",
"{",
"if",
"(",
"projectOption",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"ERROR_VALUE",
".",
"equals",
"(",
"cleanUpOption",
")",
")",
"{",
"return",
"ERROR_VALUE",
".",
"equals",
"(",
"projectOption",
")",
";",
"}",
"else",
"if",
"(",
"WARNING_VALUE",
".",
"equals",
"(",
"cleanUpOption",
")",
")",
"{",
"return",
"ERROR_VALUE",
".",
"equals",
"(",
"projectOption",
")",
"||",
"WARNING_VALUE",
".",
"equals",
"(",
"projectOption",
")",
";",
"}",
"return",
"false",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"FixMessages",
".",
"CleanUpPostSaveListener_name",
";",
"}",
"public",
"String",
"getId",
"(",
")",
"{",
"return",
"POSTSAVELISTENER_ID",
";",
"}",
"private",
"static",
"CoreException",
"wrapBadLocationException",
"(",
"BadLocationException",
"e",
")",
"{",
"String",
"message",
"=",
"e",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"message",
"==",
"null",
")",
"message",
"=",
"\"\"",
";",
"return",
"new",
"CoreException",
"(",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"JavaUI",
".",
"ID_PLUGIN",
",",
"IRefactoringCoreStatusCodes",
".",
"BAD_LOCATION",
",",
"message",
",",
"e",
")",
")",
";",
"}",
"private",
"CoreException",
"wrapBadPositionCategoryException",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"String",
"message",
"=",
"e",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"message",
"==",
"null",
")",
"message",
"=",
"\"\"",
";",
"return",
"new",
"CoreException",
"(",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"JavaUI",
".",
"ID_PLUGIN",
",",
"0",
",",
"message",
",",
"e",
")",
")",
";",
"}",
"private",
"void",
"showSlowCleanUpsWarning",
"(",
"HashSet",
"slowCleanUps",
")",
"{",
"final",
"StringBuffer",
"cleanUpNames",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"Iterator",
"iterator",
"=",
"slowCleanUps",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"ICleanUp",
"cleanUp",
"=",
"(",
"ICleanUp",
")",
"iterator",
".",
"next",
"(",
")",
";",
"String",
"[",
"]",
"descriptions",
"=",
"cleanUp",
".",
"getStepDescriptions",
"(",
")",
";",
"if",
"(",
"descriptions",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"descriptions",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"cleanUpNames",
".",
"length",
"(",
")",
">",
"0",
")",
"cleanUpNames",
".",
"append",
"(",
"'\\n'",
")",
";",
"cleanUpNames",
".",
"append",
"(",
"descriptions",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"if",
"(",
"Display",
".",
"getCurrent",
"(",
")",
"!=",
"null",
")",
"{",
"showSlowCleanUpDialog",
"(",
"cleanUpNames",
")",
";",
"}",
"else",
"{",
"Display",
".",
"getDefault",
"(",
")",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"showSlowCleanUpDialog",
"(",
"cleanUpNames",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"private",
"void",
"showSlowCleanUpDialog",
"(",
"final",
"StringBuffer",
"cleanUpNames",
")",
"{",
"if",
"(",
"OptionalMessageDialog",
".",
"isDialogEnabled",
"(",
"SlowCleanUpWarningDialog",
".",
"ID",
")",
")",
"{",
"Shell",
"shell",
"=",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
";",
"new",
"SlowCleanUpWarningDialog",
"(",
"shell",
",",
"FixMessages",
".",
"CleanUpPostSaveListener_SlowCleanUpDialog_title",
",",
"cleanUpNames",
".",
"toString",
"(",
")",
")",
".",
"open",
"(",
")",
";",
"}",
"}",
"static",
"void",
"assertDocumentGreclipse1452",
"(",
"ITextFileBuffer",
"buffer",
")",
"{",
"if",
"(",
"buffer",
"!=",
"null",
")",
"{",
"try",
"{",
"buffer",
".",
"getDocument",
"(",
")",
".",
"getPositions",
"(",
"IDocument",
".",
"DEFAULT_CATEGORY",
")",
";",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"buffer",
".",
"getLocation",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
6,347 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ContentTypeUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"saveparticipant",
".",
"IPostSaveListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"saveparticipant",
".",
"SaveParticipantDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"saveparticipant",
".",
"SaveParticipantRegistry",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"public",
"class",
"DelegatingCleanUpPostSaveListener",
"implements",
"IPostSaveListener",
"{",
"private",
"final",
"IPostSaveListener",
"jdtCleanUp",
";",
"private",
"final",
"IPostSaveListener",
"groovyCleanUp",
";",
"public",
"DelegatingCleanUpPostSaveListener",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpPostSaveListener",
"jdtCleanUp",
",",
"GroovyCleanupPostSaveListener",
"groovyCleanUp",
")",
"{",
"this",
".",
"jdtCleanUp",
"=",
"jdtCleanUp",
";",
"this",
".",
"groovyCleanUp",
"=",
"groovyCleanUp",
";",
"}",
"public",
"static",
"void",
"installCleanUp",
"(",
")",
"{",
"try",
"{",
"SaveParticipantRegistry",
"registry",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getSaveParticipantRegistry",
"(",
")",
";",
"synchronized",
"(",
"registry",
")",
"{",
"SaveParticipantDescriptor",
"descriptor",
"=",
"registry",
".",
"getSaveParticipantDescriptor",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpPostSaveListener",
".",
"POSTSAVELISTENER_ID",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpPostSaveListener",
"jdtCleanUp",
"=",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpPostSaveListener",
")",
"descriptor",
".",
"getPostSaveListener",
"(",
")",
";",
"GroovyCleanupPostSaveListener",
"groovyCleanUp",
"=",
"new",
"GroovyCleanupPostSaveListener",
"(",
")",
";",
"IPostSaveListener",
"delegatingCleanUp",
"=",
"new",
"DelegatingCleanUpPostSaveListener",
"(",
"jdtCleanUp",
",",
"groovyCleanUp",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"SaveParticipantDescriptor",
".",
"class",
",",
"\"\"",
",",
"descriptor",
",",
"delegatingCleanUp",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"ClassCastException",
")",
"{",
"if",
"(",
"e",
".",
"getStackTrace",
"(",
")",
"[",
"0",
"]",
".",
"getLineNumber",
"(",
")",
"==",
"55",
")",
"{",
"return",
";",
"}",
"}",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"public",
"static",
"void",
"uninstallCleanUp",
"(",
")",
"{",
"try",
"{",
"SaveParticipantRegistry",
"registry",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getSaveParticipantRegistry",
"(",
")",
";",
"synchronized",
"(",
"registry",
")",
"{",
"SaveParticipantDescriptor",
"descriptor",
"=",
"registry",
".",
"getSaveParticipantDescriptor",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpPostSaveListener",
".",
"POSTSAVELISTENER_ID",
")",
";",
"DelegatingCleanUpPostSaveListener",
"delegatingCleanUp",
"=",
"(",
"DelegatingCleanUpPostSaveListener",
")",
"descriptor",
".",
"getPostSaveListener",
"(",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"SaveParticipantDescriptor",
".",
"class",
",",
"\"\"",
",",
"descriptor",
",",
"delegatingCleanUp",
".",
"jdtCleanUp",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"public",
"String",
"getId",
"(",
")",
"{",
"return",
"jdtCleanUp",
".",
"getId",
"(",
")",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"jdtCleanUp",
".",
"getName",
"(",
")",
";",
"}",
"public",
"boolean",
"needsChangedRegions",
"(",
"ICompilationUnit",
"compilationUnit",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"ContentTypeUtils",
".",
"isGroovyLikeFileName",
"(",
"compilationUnit",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"return",
"groovyCleanUp",
".",
"needsChangedRegions",
"(",
"compilationUnit",
")",
";",
"}",
"else",
"{",
"return",
"jdtCleanUp",
".",
"needsChangedRegions",
"(",
"compilationUnit",
")",
";",
"}",
"}",
"public",
"void",
"saved",
"(",
"ICompilationUnit",
"compilationUnit",
",",
"IRegion",
"[",
"]",
"changedRegions",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"ContentTypeUtils",
".",
"isGroovyLikeFileName",
"(",
"compilationUnit",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"groovyCleanUp",
".",
"saved",
"(",
"compilationUnit",
",",
"changedRegions",
",",
"monitor",
")",
";",
"}",
"else",
"{",
"jdtCleanUp",
".",
"saved",
"(",
"compilationUnit",
",",
"changedRegions",
",",
"monitor",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,348 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"RenameAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"public",
"class",
"GroovyRenameAction",
"extends",
"RenameAction",
"{",
"private",
"RenameDispatcherAction",
"renameDelegate",
";",
"private",
"final",
"GroovyEditor",
"editor",
";",
"public",
"GroovyRenameAction",
"(",
"final",
"JavaEditor",
"editor",
")",
"{",
"super",
"(",
"editor",
")",
";",
"if",
"(",
"editor",
"instanceof",
"GroovyEditor",
")",
"{",
"this",
".",
"editor",
"=",
"(",
"GroovyEditor",
")",
"editor",
";",
"}",
"else",
"{",
"this",
".",
"editor",
"=",
"null",
";",
"}",
"renameDelegate",
"=",
"new",
"RenameDispatcherAction",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"ITextSelection",
"selection",
")",
"{",
"if",
"(",
"editor",
"!=",
"null",
")",
"{",
"renameDelegate",
".",
"setActiveEditor",
"(",
"this",
",",
"editor",
")",
";",
"renameDelegate",
".",
"selectionChanged",
"(",
"this",
",",
"selection",
")",
";",
"renameDelegate",
".",
"run",
"(",
"this",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"selectionChanged",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"renameDelegate",
".",
"selectionChanged",
"(",
"this",
",",
"selection",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"selectionChanged",
"(",
"ITextSelection",
"selection",
")",
"{",
"renameDelegate",
".",
"selectionChanged",
"(",
"this",
",",
"selection",
")",
";",
"}",
"}",
"</s>"
] |
6,349 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"fix",
".",
"AbstractCleanUp",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringStatus",
";",
"public",
"abstract",
"class",
"AbstractGroovyCleanUp",
"extends",
"AbstractCleanUp",
"{",
"protected",
"RefactoringStatus",
"status",
";",
"@",
"Override",
"public",
"RefactoringStatus",
"checkPreConditions",
"(",
"IJavaProject",
"project",
",",
"ICompilationUnit",
"[",
"]",
"compilationUnits",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"RefactoringStatus",
"status",
"=",
"new",
"RefactoringStatus",
"(",
")",
";",
"try",
"{",
"for",
"(",
"ICompilationUnit",
"unit",
":",
"compilationUnits",
")",
"{",
"if",
"(",
"!",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
")",
"{",
"status",
".",
"addError",
"(",
"\"\"",
"+",
"unit",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"GroovyCompilationUnit",
")",
"unit",
")",
".",
"getModuleNode",
"(",
")",
"==",
"null",
")",
"{",
"status",
".",
"addError",
"(",
"\"\"",
"+",
"unit",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"status",
".",
"addFatalError",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"status",
";",
"}",
"@",
"Override",
"public",
"RefactoringStatus",
"checkPostConditions",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"try",
"{",
"if",
"(",
"status",
"==",
"null",
"||",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"super",
".",
"checkPostConditions",
"(",
"monitor",
")",
";",
"}",
"else",
"{",
"return",
"status",
";",
"}",
"}",
"finally",
"{",
"status",
"=",
"null",
";",
"}",
"}",
"}",
"</s>"
] |
6,350 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ImportRewrite",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"CodeStyleConfiguration",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"java",
".",
"util",
".",
"SortedSet",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotatedNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotationNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassCodeVisitorSupport",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ConstructorNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"DynamicVariable",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"GenericsType",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ImportNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ImportNodeCompatibilityWrapper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Parameter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"AnnotationConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"CastExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClassExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClosureExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstructorCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"VariableExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"BlockStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"CatchStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ReturnStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"Statement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"SourceUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"TypeNameMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"JavaSearchTypeNameMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"codemanipulation",
".",
"OrganizeImportsOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"codemanipulation",
".",
"OrganizeImportsOperation",
".",
"IChooseImportQuery",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MalformedTreeException",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MultiTextEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"public",
"class",
"OrganizeGroovyImports",
"{",
"public",
"static",
"class",
"UnresolvedTypeData",
"{",
"final",
"String",
"ref",
";",
"final",
"boolean",
"isAnnotation",
";",
"final",
"List",
"<",
"TypeNameMatch",
">",
"foundInfos",
";",
"final",
"ISourceRange",
"range",
";",
"public",
"UnresolvedTypeData",
"(",
"String",
"ref",
",",
"boolean",
"annotation",
",",
"ISourceRange",
"range",
")",
"{",
"this",
".",
"ref",
"=",
"ref",
";",
"this",
".",
"isAnnotation",
"=",
"annotation",
";",
"this",
".",
"foundInfos",
"=",
"new",
"LinkedList",
"<",
"TypeNameMatch",
">",
"(",
")",
";",
"this",
".",
"range",
"=",
"range",
";",
"}",
"public",
"void",
"addInfo",
"(",
"TypeNameMatch",
"info",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"foundInfos",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"TypeNameMatch",
"curr",
"=",
"(",
"TypeNameMatch",
")",
"this",
".",
"foundInfos",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"curr",
".",
"getTypeContainerName",
"(",
")",
".",
"equals",
"(",
"info",
".",
"getTypeContainerName",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"}",
"foundInfos",
".",
"add",
"(",
"info",
")",
";",
"}",
"public",
"List",
"<",
"TypeNameMatch",
">",
"getFoundInfos",
"(",
")",
"{",
"return",
"foundInfos",
";",
"}",
"}",
"private",
"class",
"FindUnresolvedReferencesVisitor",
"extends",
"ClassCodeVisitorSupport",
"{",
"private",
"ClassNode",
"current",
";",
"@",
"Override",
"protected",
"SourceUnit",
"getSourceUnit",
"(",
")",
"{",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"void",
"visitCastExpression",
"(",
"CastExpression",
"expression",
")",
"{",
"handleType",
"(",
"expression",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"super",
".",
"visitCastExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClassExpression",
"(",
"ClassExpression",
"expression",
")",
"{",
"handleType",
"(",
"expression",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitConstructorCallExpression",
"(",
"ConstructorCallExpression",
"call",
")",
"{",
"handleType",
"(",
"call",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"super",
".",
"visitConstructorCallExpression",
"(",
"call",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitVariableExpression",
"(",
"VariableExpression",
"expression",
")",
"{",
"handleType",
"(",
"expression",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"if",
"(",
"expression",
".",
"getAccessedVariable",
"(",
")",
"instanceof",
"DynamicVariable",
")",
"{",
"handleVariableExpression",
"(",
"expression",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"visitField",
"(",
"FieldNode",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"_\"",
")",
"&&",
"!",
"node",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"$\"",
")",
")",
"{",
"handleType",
"(",
"node",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"}",
"super",
".",
"visitField",
"(",
"node",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitConstructor",
"(",
"ConstructorNode",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"isSynthetic",
"(",
")",
")",
"{",
"for",
"(",
"Parameter",
"param",
":",
"node",
".",
"getParameters",
"(",
")",
")",
"{",
"handleType",
"(",
"param",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
"super",
".",
"visitConstructor",
"(",
"node",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitMethod",
"(",
"MethodNode",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"isSynthetic",
"(",
")",
")",
"{",
"handleType",
"(",
"node",
".",
"getReturnType",
"(",
")",
",",
"false",
")",
";",
"for",
"(",
"Parameter",
"param",
":",
"node",
".",
"getParameters",
"(",
")",
")",
"{",
"handleType",
"(",
"param",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"}",
"ClassNode",
"[",
"]",
"thrownExceptions",
"=",
"node",
".",
"getExceptions",
"(",
")",
";",
"if",
"(",
"thrownExceptions",
"!=",
"null",
")",
"{",
"for",
"(",
"ClassNode",
"thrownException",
":",
"thrownExceptions",
")",
"{",
"handleType",
"(",
"thrownException",
",",
"false",
")",
";",
"}",
"}",
"}",
"super",
".",
"visitMethod",
"(",
"node",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClass",
"(",
"ClassNode",
"node",
")",
"{",
"current",
"=",
"node",
";",
"if",
"(",
"!",
"node",
".",
"isSynthetic",
"(",
")",
")",
"{",
"handleType",
"(",
"node",
".",
"getSuperClass",
"(",
")",
",",
"false",
")",
";",
"for",
"(",
"ClassNode",
"impls",
":",
"node",
".",
"getInterfaces",
"(",
")",
")",
"{",
"handleType",
"(",
"impls",
",",
"false",
")",
";",
"}",
"}",
"super",
".",
"visitClass",
"(",
"node",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClosureExpression",
"(",
"ClosureExpression",
"node",
")",
"{",
"Parameter",
"[",
"]",
"parameters",
"=",
"node",
".",
"getParameters",
"(",
")",
";",
"if",
"(",
"parameters",
"!=",
"null",
")",
"{",
"for",
"(",
"Parameter",
"param",
":",
"parameters",
")",
"{",
"handleType",
"(",
"param",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
"super",
".",
"visitClosureExpression",
"(",
"node",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitAnnotations",
"(",
"AnnotatedNode",
"node",
")",
"{",
"List",
"<",
"AnnotationNode",
">",
"annotations",
"=",
"(",
"List",
"<",
"AnnotationNode",
">",
")",
"node",
".",
"getAnnotations",
"(",
")",
";",
"if",
"(",
"annotations",
"!=",
"null",
"&&",
"!",
"annotations",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"AnnotationNode",
"an",
":",
"annotations",
")",
"{",
"if",
"(",
"an",
".",
"isBuiltIn",
"(",
")",
")",
"{",
"continue",
";",
"}",
"handleType",
"(",
"an",
".",
"getClassNode",
"(",
")",
",",
"true",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Expression",
">",
"member",
":",
"an",
".",
"getMembers",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"Expression",
"value",
"=",
"member",
".",
"getValue",
"(",
")",
";",
"value",
".",
"visit",
"(",
"this",
")",
";",
"}",
"}",
"}",
"}",
"@",
"Override",
"public",
"void",
"visitConstantExpression",
"(",
"ConstantExpression",
"node",
")",
"{",
"if",
"(",
"node",
"instanceof",
"AnnotationConstantExpression",
")",
"{",
"handleType",
"(",
"node",
".",
"getType",
"(",
")",
",",
"true",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"visitCatchStatement",
"(",
"CatchStatement",
"node",
")",
"{",
"handleType",
"(",
"node",
".",
"getVariable",
"(",
")",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"super",
".",
"visitCatchStatement",
"(",
"node",
")",
";",
"}",
"private",
"void",
"handleVariableExpression",
"(",
"VariableExpression",
"expr",
")",
"{",
"if",
"(",
"Character",
".",
"isUpperCase",
"(",
"expr",
".",
"getName",
"(",
")",
".",
"charAt",
"(",
"0",
")",
")",
"&&",
"!",
"missingTypes",
".",
"containsKey",
"(",
"expr",
".",
"getName",
"(",
")",
")",
")",
"{",
"missingTypes",
".",
"put",
"(",
"expr",
".",
"getName",
"(",
")",
",",
"new",
"UnresolvedTypeData",
"(",
"expr",
".",
"getName",
"(",
")",
",",
"false",
",",
"new",
"SourceRange",
"(",
"expr",
".",
"getStart",
"(",
")",
",",
"expr",
".",
"getEnd",
"(",
")",
"-",
"expr",
".",
"getStart",
"(",
")",
")",
")",
")",
";",
"}",
"}",
"private",
"void",
"handleType",
"(",
"ClassNode",
"node",
",",
"boolean",
"isAnnotation",
")",
"{",
"if",
"(",
"!",
"node",
".",
"isResolved",
"(",
")",
"&&",
"node",
"!=",
"current",
")",
"{",
"String",
"semiQualifiedName",
";",
"if",
"(",
"node",
".",
"isArray",
"(",
")",
")",
"{",
"semiQualifiedName",
"=",
"node",
".",
"getComponentType",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"semiQualifiedName",
"=",
"node",
".",
"getName",
"(",
")",
";",
"}",
"String",
"simpleName",
"=",
"semiQualifiedName",
".",
"split",
"(",
"\"\\\\.\"",
")",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"missingTypes",
".",
"containsKey",
"(",
"simpleName",
")",
")",
"{",
"missingTypes",
".",
"put",
"(",
"simpleName",
",",
"new",
"UnresolvedTypeData",
"(",
"simpleName",
",",
"isAnnotation",
",",
"new",
"SourceRange",
"(",
"node",
".",
"getStart",
"(",
")",
",",
"node",
".",
"getEnd",
"(",
")",
"-",
"node",
".",
"getStart",
"(",
")",
")",
")",
")",
";",
"}",
"}",
"else",
"{",
"String",
"name",
";",
"if",
"(",
"node",
".",
"isArray",
"(",
")",
")",
"{",
"name",
"=",
"node",
".",
"getComponentType",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"name",
"=",
"node",
".",
"getName",
"(",
")",
";",
"}",
"String",
"partialName",
"=",
"name",
".",
"replace",
"(",
"'$'",
",",
"'.'",
")",
";",
"int",
"innerIndex",
"=",
"name",
".",
"lastIndexOf",
"(",
"'$'",
")",
";",
"while",
"(",
"innerIndex",
">",
"-",
"1",
")",
"{",
"doNotRemoveImport",
"(",
"partialName",
")",
";",
"partialName",
"=",
"partialName",
".",
"substring",
"(",
"0",
",",
"innerIndex",
")",
";",
"innerIndex",
"=",
"name",
".",
"lastIndexOf",
"(",
"'$'",
",",
"innerIndex",
"-",
"1",
")",
";",
"}",
"doNotRemoveImport",
"(",
"partialName",
")",
";",
"}",
"if",
"(",
"node",
".",
"isUsingGenerics",
"(",
")",
"&&",
"node",
".",
"getGenericsTypes",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"GenericsType",
"gen",
":",
"node",
".",
"getGenericsTypes",
"(",
")",
")",
"{",
"if",
"(",
"gen",
".",
"getLowerBound",
"(",
")",
"!=",
"null",
")",
"{",
"handleType",
"(",
"gen",
".",
"getLowerBound",
"(",
")",
",",
"false",
")",
";",
"}",
"if",
"(",
"gen",
".",
"getUpperBounds",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"ClassNode",
"upper",
":",
"gen",
".",
"getUpperBounds",
"(",
")",
")",
"{",
"if",
"(",
"!",
"upper",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"node",
".",
"getName",
"(",
")",
")",
")",
"{",
"handleType",
"(",
"upper",
",",
"false",
")",
";",
"}",
"}",
"}",
"if",
"(",
"gen",
".",
"getType",
"(",
")",
"!=",
"null",
"&&",
"gen",
".",
"getType",
"(",
")",
".",
"getName",
"(",
")",
".",
"charAt",
"(",
"0",
")",
"!=",
"'?'",
")",
"{",
"handleType",
"(",
"gen",
".",
"getType",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
"}",
"}",
"private",
"void",
"doNotRemoveImport",
"(",
"String",
"className",
")",
"{",
"importsSlatedForRemoval",
".",
"remove",
"(",
"className",
")",
";",
"}",
"}",
"private",
"final",
"GroovyCompilationUnit",
"unit",
";",
"private",
"Map",
"<",
"String",
",",
"UnresolvedTypeData",
">",
"missingTypes",
";",
"private",
"Map",
"<",
"String",
",",
"ImportNode",
">",
"importsSlatedForRemoval",
";",
"private",
"IChooseImportQuery",
"query",
";",
"public",
"OrganizeGroovyImports",
"(",
"GroovyCompilationUnit",
"unit",
",",
"IChooseImportQuery",
"query",
")",
"{",
"this",
".",
"unit",
"=",
"unit",
";",
"this",
".",
"query",
"=",
"query",
";",
"}",
"public",
"TextEdit",
"calculateMissingImports",
"(",
")",
"{",
"ModuleNode",
"node",
"=",
"unit",
".",
"getModuleNode",
"(",
")",
";",
"if",
"(",
"node",
"==",
"null",
"||",
"node",
".",
"encounteredUnrecoverableError",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"isEmpty",
"(",
"node",
")",
")",
"{",
"return",
"new",
"MultiTextEdit",
"(",
")",
";",
"}",
"missingTypes",
"=",
"new",
"HashMap",
"<",
"String",
",",
"UnresolvedTypeData",
">",
"(",
")",
";",
"importsSlatedForRemoval",
"=",
"new",
"HashMap",
"<",
"String",
",",
"ImportNode",
">",
"(",
")",
";",
"FindUnresolvedReferencesVisitor",
"visitor",
"=",
"new",
"FindUnresolvedReferencesVisitor",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"aliases",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"try",
"{",
"SortedSet",
"<",
"ImportNode",
">",
"allImports",
"=",
"new",
"ImportNodeCompatibilityWrapper",
"(",
"node",
")",
".",
"getAllImportNodes",
"(",
")",
";",
"boolean",
"safeToReorganize",
"=",
"isSafeToReorganize",
"(",
"allImports",
")",
";",
"ImportRewrite",
"rewriter",
"=",
"CodeStyleConfiguration",
".",
"createImportRewrite",
"(",
"unit",
",",
"!",
"safeToReorganize",
")",
";",
"for",
"(",
"ImportNode",
"imp",
":",
"allImports",
")",
"{",
"String",
"fieldName",
"=",
"imp",
".",
"getFieldName",
"(",
")",
";",
"if",
"(",
"fieldName",
"==",
"null",
")",
"{",
"fieldName",
"=",
"\"*\"",
";",
"}",
"if",
"(",
"imp",
".",
"getType",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"className",
"=",
"imp",
".",
"getClassName",
"(",
")",
";",
"if",
"(",
"className",
"!=",
"null",
")",
"{",
"String",
"dottedClassName",
"=",
"className",
".",
"replace",
"(",
"'$'",
",",
"'.'",
")",
";",
"String",
"alias",
"=",
"imp",
".",
"getAlias",
"(",
")",
";",
"if",
"(",
"!",
"imp",
".",
"isStaticStar",
"(",
")",
"&&",
"!",
"imp",
".",
"isStatic",
"(",
")",
")",
"{",
"importsSlatedForRemoval",
".",
"put",
"(",
"dottedClassName",
",",
"imp",
")",
";",
"rewriter",
".",
"addImport",
"(",
"dottedClassName",
")",
";",
"if",
"(",
"isAliased",
"(",
"imp",
")",
")",
"{",
"aliases",
".",
"put",
"(",
"\"n\"",
"+",
"dottedClassName",
",",
"alias",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"safeToReorganize",
")",
"{",
"rewriter",
".",
"addStaticImport",
"(",
"dottedClassName",
",",
"fieldName",
",",
"true",
")",
";",
"}",
"if",
"(",
"isAliased",
"(",
"imp",
")",
")",
"{",
"aliases",
".",
"put",
"(",
"\"s\"",
"+",
"dottedClassName",
"+",
"\".\"",
"+",
"fieldName",
",",
"alias",
")",
";",
"if",
"(",
"imp",
".",
"isStatic",
"(",
")",
")",
"{",
"rewriter",
".",
"removeInvalidStaticAlias",
"(",
"dottedClassName",
"+",
"\".\"",
"+",
"alias",
")",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"imp",
".",
"isStatic",
"(",
")",
")",
"{",
"rewriter",
".",
"addStaticImport",
"(",
"imp",
".",
"getPackageName",
"(",
")",
".",
"replace",
"(",
"'$'",
",",
"'.'",
")",
",",
"fieldName",
",",
"true",
")",
";",
"}",
"else",
"{",
"rewriter",
".",
"addImport",
"(",
"imp",
".",
"getPackageName",
"(",
")",
"+",
"\"*\"",
")",
";",
"}",
"}",
"}",
"for",
"(",
"ClassNode",
"clazz",
":",
"(",
"Iterable",
"<",
"ClassNode",
">",
")",
"node",
".",
"getClasses",
"(",
")",
")",
"{",
"visitor",
".",
"visitClass",
"(",
"clazz",
")",
";",
"}",
"for",
"(",
"ImportNode",
"imp",
":",
"allImports",
")",
"{",
"if",
"(",
"isDefaultImport",
"(",
"imp",
")",
")",
"{",
"String",
"key",
";",
"String",
"className",
"=",
"imp",
".",
"getClassName",
"(",
")",
";",
"if",
"(",
"className",
"!=",
"null",
")",
"{",
"key",
"=",
"className",
";",
"}",
"else",
"{",
"key",
"=",
"imp",
".",
"getPackageName",
"(",
")",
";",
"if",
"(",
"key",
".",
"endsWith",
"(",
"\".\"",
")",
")",
"{",
"key",
"=",
"key",
"+",
"\"*\"",
";",
"}",
"}",
"importsSlatedForRemoval",
".",
"put",
"(",
"key",
",",
"imp",
")",
";",
"}",
"}",
"for",
"(",
"String",
"impStr",
":",
"importsSlatedForRemoval",
".",
"keySet",
"(",
")",
")",
"{",
"rewriter",
".",
"removeImport",
"(",
"impStr",
")",
";",
"}",
"IType",
"[",
"]",
"resolvedTypes",
"=",
"resolveMissingTypes",
"(",
")",
";",
"for",
"(",
"IType",
"resolved",
":",
"resolvedTypes",
")",
"{",
"rewriter",
".",
"addImport",
"(",
"resolved",
".",
"getFullyQualifiedName",
"(",
"'.'",
")",
")",
";",
"}",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"alias",
":",
"aliases",
".",
"entrySet",
"(",
")",
")",
"{",
"rewriter",
".",
"addAlias",
"(",
"alias",
".",
"getKey",
"(",
")",
",",
"alias",
".",
"getValue",
"(",
")",
")",
";",
"}",
"TextEdit",
"edit",
"=",
"rewriter",
".",
"rewriteImports",
"(",
"null",
")",
";",
"return",
"edit",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"unit",
".",
"getElementName",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"MalformedTreeException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"unit",
".",
"getElementName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"boolean",
"isSafeToReorganize",
"(",
"SortedSet",
"<",
"ImportNode",
">",
"allImports",
")",
"{",
"for",
"(",
"ImportNode",
"imp",
":",
"allImports",
")",
"{",
"if",
"(",
"imp",
".",
"getAnnotations",
"(",
")",
"!=",
"null",
"&&",
"imp",
".",
"getAnnotations",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"private",
"static",
"final",
"Set",
"<",
"String",
">",
"DEFAULT_IMPORTS",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"static",
"{",
"DEFAULT_IMPORTS",
".",
"add",
"(",
"\"java.lang.\"",
")",
";",
"DEFAULT_IMPORTS",
".",
"add",
"(",
"\"java.util.\"",
")",
";",
"DEFAULT_IMPORTS",
".",
"add",
"(",
"\"java.io.\"",
")",
";",
"DEFAULT_IMPORTS",
".",
"add",
"(",
"\"java.net.\"",
")",
";",
"DEFAULT_IMPORTS",
".",
"add",
"(",
"\"groovy.lang.\"",
")",
";",
"DEFAULT_IMPORTS",
".",
"add",
"(",
"\"groovy.util.\"",
")",
";",
"DEFAULT_IMPORTS",
".",
"add",
"(",
"\"\"",
")",
";",
"DEFAULT_IMPORTS",
".",
"add",
"(",
"\"\"",
")",
";",
"}",
"private",
"boolean",
"isDefaultImport",
"(",
"ImportNode",
"imp",
")",
"{",
"if",
"(",
"imp",
".",
"isStatic",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"imp",
".",
"getType",
"(",
")",
"!=",
"null",
"&&",
"!",
"imp",
".",
"getType",
"(",
")",
".",
"getNameWithoutPackage",
"(",
")",
".",
"equals",
"(",
"imp",
".",
"getAlias",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"String",
"pkg",
";",
"if",
"(",
"imp",
".",
"getType",
"(",
")",
"!=",
"null",
")",
"{",
"pkg",
"=",
"imp",
".",
"getType",
"(",
")",
".",
"getPackageName",
"(",
")",
";",
"if",
"(",
"pkg",
"==",
"null",
")",
"{",
"pkg",
"=",
"\".\"",
";",
"}",
"else",
"{",
"pkg",
"=",
"pkg",
"+",
"\".\"",
";",
"}",
"if",
"(",
"pkg",
".",
"equals",
"(",
"\"java.math.\"",
")",
")",
"{",
"pkg",
"=",
"imp",
".",
"getType",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"}",
"else",
"{",
"pkg",
"=",
"imp",
".",
"getPackageName",
"(",
")",
";",
"if",
"(",
"pkg",
"==",
"null",
")",
"{",
"pkg",
"=",
"\".\"",
";",
"}",
"}",
"return",
"DEFAULT_IMPORTS",
".",
"contains",
"(",
"pkg",
")",
";",
"}",
"private",
"boolean",
"isAliased",
"(",
"ImportNode",
"imp",
")",
"{",
"String",
"alias",
"=",
"imp",
".",
"getAlias",
"(",
")",
";",
"if",
"(",
"alias",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"String",
"fieldName",
"=",
"imp",
".",
"getFieldName",
"(",
")",
";",
"if",
"(",
"fieldName",
"!=",
"null",
")",
"{",
"return",
"!",
"fieldName",
".",
"equals",
"(",
"alias",
")",
";",
"}",
"String",
"className",
"=",
"imp",
".",
"getClassName",
"(",
")",
";",
"if",
"(",
"className",
"!=",
"null",
")",
"{",
"boolean",
"aliasIsSameAsClassName",
"=",
"className",
".",
"endsWith",
"(",
"alias",
")",
"&&",
"(",
"className",
".",
"length",
"(",
")",
"==",
"alias",
".",
"length",
"(",
")",
"||",
"className",
".",
"endsWith",
"(",
"\".\"",
"+",
"alias",
")",
"||",
"className",
".",
"endsWith",
"(",
"\"$\"",
"+",
"alias",
")",
")",
";",
"return",
"!",
"aliasIsSameAsClassName",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isEmpty",
"(",
"ModuleNode",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
"||",
"node",
".",
"getClasses",
"(",
")",
"==",
"null",
"||",
"(",
"node",
".",
"getClasses",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
"&&",
"node",
".",
"getImports",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"node",
".",
"getClasses",
"(",
")",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"node",
".",
"getImports",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
"&&",
"(",
"(",
"ClassNode",
")",
"node",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"isScript",
"(",
")",
")",
"{",
"if",
"(",
"(",
"node",
".",
"getStatementBlock",
"(",
")",
"==",
"null",
"||",
"node",
".",
"getStatementBlock",
"(",
")",
".",
"isEmpty",
"(",
")",
"||",
"isNullReturn",
"(",
"node",
".",
"getStatementBlock",
"(",
")",
")",
")",
"&&",
"(",
"node",
".",
"getMethods",
"(",
")",
"==",
"null",
"||",
"node",
".",
"getMethods",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isNullReturn",
"(",
"BlockStatement",
"statementBlock",
")",
"{",
"List",
"<",
"Statement",
">",
"statements",
"=",
"statementBlock",
".",
"getStatements",
"(",
")",
";",
"if",
"(",
"statements",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"statements",
".",
"get",
"(",
"0",
")",
"instanceof",
"ReturnStatement",
")",
"{",
"ReturnStatement",
"ret",
"=",
"(",
"ReturnStatement",
")",
"statements",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"ret",
".",
"getExpression",
"(",
")",
"instanceof",
"ConstantExpression",
")",
"{",
"return",
"(",
"(",
"ConstantExpression",
")",
"ret",
".",
"getExpression",
"(",
")",
")",
".",
"isNullExpression",
"(",
")",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"calculateAndApplyMissingImports",
"(",
")",
"throws",
"JavaModelException",
"{",
"TextEdit",
"edit",
"=",
"calculateMissingImports",
"(",
")",
";",
"if",
"(",
"edit",
"!=",
"null",
")",
"{",
"unit",
".",
"applyTextEdit",
"(",
"edit",
",",
"null",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"private",
"IType",
"[",
"]",
"resolveMissingTypes",
"(",
")",
"throws",
"JavaModelException",
"{",
"new",
"TypeSearch",
"(",
")",
".",
"searchForTypes",
"(",
"unit",
",",
"missingTypes",
")",
";",
"List",
"<",
"TypeNameMatch",
">",
"missingTypesNoChoiceRequired",
"=",
"new",
"ArrayList",
"<",
"TypeNameMatch",
">",
"(",
")",
";",
"List",
"<",
"TypeNameMatch",
"[",
"]",
">",
"missingTypesChoiceRequired",
"=",
"new",
"ArrayList",
"<",
"TypeNameMatch",
"[",
"]",
">",
"(",
")",
";",
"List",
"<",
"ISourceRange",
">",
"ranges",
"=",
"new",
"ArrayList",
"<",
"ISourceRange",
">",
"(",
")",
";",
"for",
"(",
"UnresolvedTypeData",
"data",
":",
"missingTypes",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"data",
".",
"foundInfos",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"missingTypesChoiceRequired",
".",
"add",
"(",
"data",
".",
"foundInfos",
".",
"toArray",
"(",
"new",
"TypeNameMatch",
"[",
"0",
"]",
")",
")",
";",
"ranges",
".",
"add",
"(",
"data",
".",
"range",
")",
";",
"}",
"else",
"if",
"(",
"data",
".",
"foundInfos",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"missingTypesNoChoiceRequired",
".",
"add",
"(",
"data",
".",
"foundInfos",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"}",
"TypeNameMatch",
"[",
"]",
"[",
"]",
"missingTypesArr",
"=",
"missingTypesChoiceRequired",
".",
"toArray",
"(",
"new",
"TypeNameMatch",
"[",
"0",
"]",
"[",
"]",
")",
";",
"TypeNameMatch",
"[",
"]",
"chosen",
";",
"if",
"(",
"missingTypesArr",
".",
"length",
">",
"0",
")",
"{",
"chosen",
"=",
"query",
".",
"chooseImports",
"(",
"missingTypesArr",
",",
"ranges",
".",
"toArray",
"(",
"new",
"ISourceRange",
"[",
"0",
"]",
")",
")",
";",
"}",
"else",
"{",
"chosen",
"=",
"new",
"TypeNameMatch",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"chosen",
"!=",
"null",
")",
"{",
"IType",
"[",
"]",
"typeMatches",
"=",
"new",
"IType",
"[",
"missingTypesNoChoiceRequired",
".",
"size",
"(",
")",
"+",
"chosen",
".",
"length",
"]",
";",
"int",
"cnt",
"=",
"0",
";",
"for",
"(",
"TypeNameMatch",
"typeNameMatch",
":",
"missingTypesNoChoiceRequired",
")",
"{",
"typeMatches",
"[",
"cnt",
"++",
"]",
"=",
"typeNameMatch",
".",
"getType",
"(",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"chosen",
".",
"length",
";",
"i",
"++",
")",
"{",
"typeMatches",
"[",
"cnt",
"++",
"]",
"=",
"(",
"(",
"JavaSearchTypeNameMatch",
")",
"chosen",
"[",
"i",
"]",
")",
".",
"getType",
"(",
")",
";",
"}",
"return",
"typeMatches",
";",
"}",
"else",
"{",
"return",
"new",
"IType",
"[",
"0",
"]",
";",
"}",
"}",
"}",
"</s>"
] |
6,351 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"DefaultGroovyFormatter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"FormatterPreferences",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"SelectionDispatchAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MalformedTreeException",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorSite",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchSite",
";",
"public",
"class",
"FormatGroovyAction",
"extends",
"SelectionDispatchAction",
"{",
"private",
"final",
"FormatKind",
"kind",
";",
"public",
"FormatGroovyAction",
"(",
"IWorkbenchSite",
"site",
",",
"FormatKind",
"kind",
")",
"{",
"super",
"(",
"site",
")",
";",
"this",
".",
"kind",
"=",
"kind",
";",
"if",
"(",
"kind",
"==",
"FormatKind",
".",
"INDENT_ONLY",
")",
"{",
"setText",
"(",
"\"Indent\"",
")",
";",
"setToolTipText",
"(",
"\"\"",
")",
";",
"setDescription",
"(",
"\"\"",
")",
";",
"}",
"else",
"if",
"(",
"kind",
"==",
"FormatKind",
".",
"FORMAT",
")",
"{",
"setText",
"(",
"\"Format\"",
")",
";",
"setToolTipText",
"(",
"\"\"",
")",
";",
"setDescription",
"(",
"\"\"",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"ITextSelection",
"selection",
")",
"{",
"if",
"(",
"!",
"(",
"getSite",
"(",
")",
"instanceof",
"IEditorSite",
")",
")",
"{",
"return",
";",
"}",
"IWorkbenchPart",
"part",
"=",
"(",
"(",
"IEditorSite",
")",
"getSite",
"(",
")",
")",
".",
"getPart",
"(",
")",
";",
"if",
"(",
"!",
"(",
"part",
"instanceof",
"GroovyEditor",
")",
")",
"{",
"return",
";",
"}",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"part",
".",
"getAdapter",
"(",
"GroovyCompilationUnit",
".",
"class",
")",
";",
"GroovyEditor",
"groovyEditor",
"=",
"(",
"GroovyEditor",
")",
"part",
";",
"IDocument",
"doc",
"=",
"groovyEditor",
".",
"getDocumentProvider",
"(",
")",
".",
"getDocument",
"(",
"groovyEditor",
".",
"getEditorInput",
"(",
")",
")",
";",
"if",
"(",
"doc",
"!=",
"null",
"&&",
"unit",
"!=",
"null",
")",
"{",
"boolean",
"isIndentOnly",
"=",
"kind",
"==",
"FormatKind",
".",
"INDENT_ONLY",
";",
"FormatterPreferences",
"preferences",
"=",
"new",
"FormatterPreferences",
"(",
"unit",
")",
";",
"DefaultGroovyFormatter",
"formatter",
"=",
"new",
"DefaultGroovyFormatter",
"(",
"selection",
",",
"doc",
",",
"preferences",
",",
"isIndentOnly",
")",
";",
"TextEdit",
"edit",
"=",
"formatter",
".",
"format",
"(",
")",
";",
"try",
"{",
"unit",
".",
"applyTextEdit",
"(",
"edit",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"}",
"catch",
"(",
"MalformedTreeException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
6,352 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"AbstractTextEditor",
";",
"public",
"interface",
"IRenameTarget",
"{",
"boolean",
"performRenameAction",
"(",
"Shell",
"shell",
",",
"AbstractTextEditor",
"editor",
",",
"boolean",
"lightweight",
")",
";",
"}",
"</s>"
] |
6,353 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"search",
".",
"GroovyOccurrencesFinder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"commands",
".",
"operations",
".",
"IOperationHistory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"commands",
".",
"operations",
".",
"IUndoContext",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"commands",
".",
"operations",
".",
"IUndoableOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"commands",
".",
"operations",
".",
"OperationHistoryFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"EditorHighlightingSynchronizer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"reorg",
".",
"RenameLinkedMode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"search",
".",
"IOccurrencesFinder",
".",
"OccurrenceLocation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"correction",
".",
"proposals",
".",
"LinkedNamesAssistProposal",
".",
"DeleteBlockingExitPolicy",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IStatusLineManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IEditingSupport",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IEditingSupportRegistry",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextViewerExtension6",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IUndoManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IUndoManagerExtension",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"ILinkedModeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedModeModel",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedModeUI",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedModeUI",
".",
"ExitFlags",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedPosition",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"link",
".",
"LinkedPositionGroup",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"ISourceViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"VerifyEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"link",
".",
"EditorLinkedModeUI",
";",
"public",
"class",
"GroovyRenameLinkedMode",
"extends",
"RenameLinkedMode",
"{",
"private",
"class",
"EditorSynchronizer",
"implements",
"ILinkedModeListener",
"{",
"public",
"void",
"left",
"(",
"LinkedModeModel",
"model",
",",
"int",
"flags",
")",
"{",
"doLinkedModeLeft",
"(",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"ILinkedModeListener",
".",
"UPDATE_CARET",
")",
"!=",
"0",
"&&",
"getJavaElement",
"(",
")",
".",
"getElementType",
"(",
")",
"!=",
"IJavaElement",
".",
"LOCAL_VARIABLE",
")",
"{",
"doDoRename",
"(",
"getShowPreview",
"(",
")",
")",
";",
"}",
"}",
"public",
"void",
"resume",
"(",
"LinkedModeModel",
"model",
",",
"int",
"flags",
")",
"{",
"}",
"public",
"void",
"suspend",
"(",
"LinkedModeModel",
"model",
")",
"{",
"}",
"}",
"private",
"class",
"ExitPolicy",
"extends",
"DeleteBlockingExitPolicy",
"{",
"public",
"ExitPolicy",
"(",
"IDocument",
"document",
")",
"{",
"super",
"(",
"document",
")",
";",
"}",
"@",
"Override",
"public",
"ExitFlags",
"doExit",
"(",
"LinkedModeModel",
"model",
",",
"VerifyEvent",
"event",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"setShowPreview",
"(",
"(",
"event",
".",
"stateMask",
"&",
"SWT",
".",
"CTRL",
")",
"!=",
"0",
"&&",
"(",
"event",
".",
"character",
"==",
"SWT",
".",
"CR",
"||",
"event",
".",
"character",
"==",
"SWT",
".",
"LF",
")",
")",
";",
"return",
"super",
".",
"doExit",
"(",
"model",
",",
"event",
",",
"offset",
",",
"length",
")",
";",
"}",
"}",
"private",
"final",
"GroovyEditor",
"editor",
";",
"public",
"GroovyRenameLinkedMode",
"(",
"IJavaElement",
"element",
",",
"GroovyEditor",
"editor",
")",
"{",
"super",
"(",
"element",
",",
"editor",
")",
";",
"this",
".",
"editor",
"=",
"editor",
";",
"}",
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"getActiveLinkedMode",
"(",
")",
"!=",
"null",
")",
"{",
"getMyActiveLinkedMode",
"(",
")",
".",
"startFullDialog",
"(",
")",
";",
"return",
";",
"}",
"ISourceViewer",
"viewer",
"=",
"editor",
".",
"getViewer",
"(",
")",
";",
"IDocument",
"document",
"=",
"viewer",
".",
"getDocument",
"(",
")",
";",
"Point",
"fOriginalSelection",
"=",
"viewer",
".",
"getSelectedRange",
"(",
")",
";",
"setOriginalSelection",
"(",
"fOriginalSelection",
")",
";",
"int",
"offset",
"=",
"fOriginalSelection",
".",
"x",
";",
"int",
"length",
"=",
"fOriginalSelection",
".",
"y",
";",
"try",
"{",
"if",
"(",
"viewer",
"instanceof",
"ITextViewerExtension6",
")",
"{",
"IUndoManager",
"undoManager",
"=",
"(",
"(",
"ITextViewerExtension6",
")",
"viewer",
")",
".",
"getUndoManager",
"(",
")",
";",
"if",
"(",
"undoManager",
"instanceof",
"IUndoManagerExtension",
")",
"{",
"IUndoManagerExtension",
"undoManagerExtension",
"=",
"(",
"IUndoManagerExtension",
")",
"undoManager",
";",
"IUndoContext",
"undoContext",
"=",
"undoManagerExtension",
".",
"getUndoContext",
"(",
")",
";",
"IOperationHistory",
"operationHistory",
"=",
"OperationHistoryFactory",
".",
"getOperationHistory",
"(",
")",
";",
"setStartingUndoOperation",
"(",
"operationHistory",
".",
"getUndoOperation",
"(",
"undoContext",
")",
")",
";",
"}",
"}",
"LinkedPositionGroup",
"fLinkedPositionGroup",
"=",
"new",
"LinkedPositionGroup",
"(",
")",
";",
"setLinkedPositionGroup",
"(",
"fLinkedPositionGroup",
")",
";",
"GroovyOccurrencesFinder",
"finder",
"=",
"new",
"GroovyOccurrencesFinder",
"(",
")",
";",
"finder",
".",
"setGroovyCompilationUnit",
"(",
"editor",
".",
"getGroovyCompilationUnit",
"(",
")",
")",
";",
"finder",
".",
"initialize",
"(",
"null",
",",
"offset",
",",
"length",
")",
";",
"ASTNode",
"nodeToLookFor",
"=",
"finder",
".",
"getNodeToLookFor",
"(",
")",
";",
"if",
"(",
"nodeToLookFor",
"==",
"null",
")",
"{",
"return",
";",
"}",
"setOriginalName",
"(",
"finder",
".",
"getElementName",
"(",
")",
")",
";",
"final",
"int",
"pos",
"=",
"nodeToLookFor",
".",
"getStart",
"(",
")",
";",
"OccurrenceLocation",
"[",
"]",
"occurrences",
"=",
"finder",
".",
"getOccurrences",
"(",
")",
";",
"if",
"(",
"occurrences",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
"int",
"nameLength",
"=",
"finder",
".",
"getElementName",
"(",
")",
".",
"length",
"(",
")",
";",
"List",
"<",
"OccurrenceLocation",
">",
"newOccurrences",
"=",
"new",
"ArrayList",
"<",
"OccurrenceLocation",
">",
"(",
"occurrences",
".",
"length",
")",
";",
"for",
"(",
"OccurrenceLocation",
"occurrence",
":",
"occurrences",
")",
"{",
"if",
"(",
"occurrence",
".",
"getLength",
"(",
")",
"==",
"nameLength",
")",
"{",
"newOccurrences",
".",
"add",
"(",
"occurrence",
")",
";",
"}",
"}",
"occurrences",
"=",
"newOccurrences",
".",
"toArray",
"(",
"new",
"OccurrenceLocation",
"[",
"0",
"]",
")",
";",
"Arrays",
".",
"sort",
"(",
"occurrences",
",",
"new",
"Comparator",
"<",
"OccurrenceLocation",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"OccurrenceLocation",
"o1",
",",
"OccurrenceLocation",
"o2",
")",
"{",
"return",
"rank",
"(",
"o1",
")",
"-",
"rank",
"(",
"o2",
")",
";",
"}",
"private",
"int",
"rank",
"(",
"OccurrenceLocation",
"o",
")",
"{",
"int",
"relativeRank",
"=",
"o",
".",
"getOffset",
"(",
")",
"+",
"o",
".",
"getLength",
"(",
")",
"-",
"pos",
";",
"if",
"(",
"relativeRank",
"<",
"0",
")",
"return",
"Integer",
".",
"MAX_VALUE",
"+",
"relativeRank",
";",
"else",
"return",
"relativeRank",
";",
"}",
"}",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"occurrences",
".",
"length",
";",
"i",
"++",
")",
"{",
"OccurrenceLocation",
"location",
"=",
"occurrences",
"[",
"i",
"]",
";",
"LinkedPosition",
"linkedPosition",
"=",
"new",
"LinkedPosition",
"(",
"document",
",",
"location",
".",
"getOffset",
"(",
")",
",",
"location",
".",
"getLength",
"(",
")",
",",
"i",
")",
";",
"if",
"(",
"i",
"==",
"0",
")",
"{",
"setNamePosition",
"(",
"linkedPosition",
")",
";",
"}",
"fLinkedPositionGroup",
".",
"addPosition",
"(",
"linkedPosition",
")",
";",
"}",
"if",
"(",
"fLinkedPositionGroup",
".",
"isEmpty",
"(",
")",
")",
"{",
"IStatusLineManager",
"status",
"=",
"getStatusLineManager",
"(",
")",
";",
"if",
"(",
"status",
"!=",
"null",
")",
"{",
"status",
".",
"setErrorMessage",
"(",
"\"\"",
")",
";",
"}",
"return",
";",
"}",
"LinkedModeModel",
"fLinkedModeModel",
"=",
"new",
"LinkedModeModel",
"(",
")",
";",
"setLinkedModeModel",
"(",
"fLinkedModeModel",
")",
";",
"fLinkedModeModel",
".",
"addGroup",
"(",
"fLinkedPositionGroup",
")",
";",
"fLinkedModeModel",
".",
"forceInstall",
"(",
")",
";",
"fLinkedModeModel",
".",
"addLinkingListener",
"(",
"new",
"EditorHighlightingSynchronizer",
"(",
"editor",
")",
")",
";",
"fLinkedModeModel",
".",
"addLinkingListener",
"(",
"new",
"EditorSynchronizer",
"(",
")",
")",
";",
"LinkedModeUI",
"ui",
"=",
"new",
"EditorLinkedModeUI",
"(",
"fLinkedModeModel",
",",
"viewer",
")",
";",
"ui",
".",
"setExitPosition",
"(",
"viewer",
",",
"offset",
",",
"0",
",",
"Integer",
".",
"MAX_VALUE",
")",
";",
"ui",
".",
"setExitPolicy",
"(",
"new",
"ExitPolicy",
"(",
"document",
")",
")",
";",
"ui",
".",
"enter",
"(",
")",
";",
"viewer",
".",
"setSelectedRange",
"(",
"fOriginalSelection",
".",
"x",
",",
"fOriginalSelection",
".",
"y",
")",
";",
"if",
"(",
"viewer",
"instanceof",
"IEditingSupportRegistry",
")",
"{",
"IEditingSupportRegistry",
"registry",
"=",
"(",
"IEditingSupportRegistry",
")",
"viewer",
";",
"registry",
".",
"register",
"(",
"getFocusEditingSupport",
"(",
")",
")",
";",
"}",
"doOpenSecondaryPopup",
"(",
")",
";",
"setActiveLinkedMode",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"private",
"void",
"setOriginalSelection",
"(",
"Point",
"p",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"p",
")",
";",
"}",
"private",
"void",
"setLinkedPositionGroup",
"(",
"LinkedPositionGroup",
"group",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"group",
")",
";",
"}",
"private",
"IEditingSupport",
"getFocusEditingSupport",
"(",
")",
"{",
"return",
"(",
"IEditingSupport",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"private",
"boolean",
"getShowPreview",
"(",
")",
"{",
"return",
"(",
"Boolean",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"fShowPreview\"",
",",
"this",
")",
";",
"}",
"private",
"IJavaElement",
"getJavaElement",
"(",
")",
"{",
"return",
"(",
"IJavaElement",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"fJavaElement\"",
",",
"this",
")",
";",
"}",
"private",
"static",
"RenameLinkedMode",
"getMyActiveLinkedMode",
"(",
")",
"{",
"return",
"(",
"RenameLinkedMode",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"null",
")",
";",
"}",
"private",
"void",
"setShowPreview",
"(",
"boolean",
"show",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"fShowPreview\"",
",",
"this",
",",
"show",
")",
";",
"}",
"private",
"void",
"setNamePosition",
"(",
"LinkedPosition",
"pos",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"pos",
")",
";",
"}",
"private",
"void",
"setStartingUndoOperation",
"(",
"IUndoableOperation",
"op",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"op",
")",
";",
"}",
"private",
"void",
"setLinkedModeModel",
"(",
"LinkedModeModel",
"model",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"model",
")",
";",
"}",
"private",
"void",
"setOriginalName",
"(",
"String",
"name",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"name",
")",
";",
"}",
"private",
"void",
"setActiveLinkedMode",
"(",
"RenameLinkedMode",
"active",
")",
"{",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"active",
")",
";",
"}",
"private",
"void",
"doOpenSecondaryPopup",
"(",
")",
"{",
"ReflectionUtils",
".",
"executeNoArgPrivateMethod",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"private",
"void",
"doLinkedModeLeft",
"(",
")",
"{",
"ReflectionUtils",
".",
"executeNoArgPrivateMethod",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"private",
"void",
"doDoRename",
"(",
"boolean",
"showPreview",
")",
"{",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"RenameLinkedMode",
".",
"class",
",",
"\"doRename\"",
",",
"new",
"Class",
"[",
"]",
"{",
"boolean",
".",
"class",
"}",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"showPreview",
"}",
")",
";",
"}",
"private",
"IStatusLineManager",
"getStatusLineManager",
"(",
")",
"{",
"if",
"(",
"editor",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"editor",
".",
"getEditorSite",
"(",
")",
".",
"getActionBars",
"(",
")",
".",
"getStatusLineManager",
"(",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"}",
"}",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
6,354 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"GroovyFormatter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"WhitespaceRemover",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"TextEditFix",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"CleanUpContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"ICleanUpFix",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"public",
"class",
"TrailingWhitespacesCleanUp",
"extends",
"AbstractGroovyCleanUp",
"{",
"@",
"Override",
"public",
"ICleanUpFix",
"createFix",
"(",
"CleanUpContext",
"context",
")",
"throws",
"CoreException",
"{",
"ICompilationUnit",
"unit",
"=",
"context",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"!",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
")",
"{",
"return",
"null",
";",
"}",
"GroovyCompilationUnit",
"gunit",
"=",
"(",
"GroovyCompilationUnit",
")",
"unit",
";",
"char",
"[",
"]",
"contents",
"=",
"gunit",
".",
"getContents",
"(",
")",
";",
"ITextSelection",
"selection",
"=",
"new",
"TextSelection",
"(",
"0",
",",
"contents",
".",
"length",
")",
";",
"IDocument",
"document",
"=",
"new",
"Document",
"(",
"new",
"String",
"(",
"contents",
")",
")",
";",
"GroovyFormatter",
"formatter",
"=",
"new",
"WhitespaceRemover",
"(",
"selection",
",",
"document",
")",
";",
"TextEdit",
"edit",
"=",
"formatter",
".",
"format",
"(",
")",
";",
"return",
"new",
"TextEditFix",
"(",
"edit",
",",
"gunit",
",",
"\"\"",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"[",
"]",
"getStepDescriptions",
"(",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"\"\"",
"}",
";",
"}",
"}",
"</s>"
] |
6,355 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"rename",
".",
"CandidateCollector",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"rename",
".",
"JavaRefactoringDispatcher",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdaptable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ILocalVariable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"refactoring",
".",
"RenameSupport",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"public",
"class",
"RenameDispatcherAction",
"extends",
"GroovyRefactoringAction",
"{",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"if",
"(",
"initRefactoring",
"(",
")",
")",
"{",
"ITextSelection",
"selection",
"=",
"getSelection",
"(",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"getUnit",
"(",
")",
";",
"CandidateCollector",
"dispatcher",
"=",
"new",
"CandidateCollector",
"(",
"unit",
",",
"selection",
")",
";",
"try",
"{",
"ISourceReference",
"target",
"=",
"dispatcher",
".",
"getRefactoringTarget",
"(",
")",
";",
"IPreferenceStore",
"store",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"boolean",
"lightweight",
"=",
"store",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"REFACTOR_LIGHTWEIGHT",
")",
";",
"if",
"(",
"runViaAdapter",
"(",
"target",
",",
"lightweight",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"target",
"instanceof",
"IMember",
"||",
"target",
"instanceof",
"ILocalVariable",
")",
"{",
"if",
"(",
"lightweight",
"&&",
"nameMatches",
"(",
"(",
"(",
"IJavaElement",
")",
"target",
")",
".",
"getElementName",
"(",
")",
",",
"unit",
",",
"selection",
")",
")",
"{",
"new",
"GroovyRenameLinkedMode",
"(",
"(",
"IJavaElement",
")",
"target",
",",
"getEditor",
"(",
")",
")",
".",
"start",
"(",
")",
";",
"}",
"else",
"{",
"openJavaRefactoringWizard",
"(",
"(",
"IJavaElement",
")",
"target",
")",
";",
"}",
"}",
"else",
"{",
"displayErrorDialog",
"(",
"\"\"",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"displayErrorDialog",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"}",
"private",
"boolean",
"nameMatches",
"(",
"String",
"elementName",
",",
"GroovyCompilationUnit",
"unit",
",",
"ITextSelection",
"selection",
")",
"{",
"char",
"[",
"]",
"contents",
"=",
"unit",
".",
"getContents",
"(",
")",
";",
"int",
"start",
"=",
"selection",
".",
"getOffset",
"(",
")",
";",
"int",
"end",
"=",
"start",
"+",
"selection",
".",
"getLength",
"(",
")",
";",
"while",
"(",
"start",
"==",
"contents",
".",
"length",
"||",
"(",
"start",
">=",
"0",
"&&",
"Character",
".",
"isJavaIdentifierPart",
"(",
"contents",
"[",
"start",
"]",
")",
")",
")",
"{",
"start",
"--",
";",
"}",
"if",
"(",
"start",
"!=",
"0",
"||",
"!",
"Character",
".",
"isJavaIdentifierPart",
"(",
"contents",
"[",
"start",
"]",
")",
")",
"{",
"start",
"++",
";",
"}",
"while",
"(",
"end",
"<",
"contents",
".",
"length",
"&&",
"Character",
".",
"isJavaIdentifierPart",
"(",
"contents",
"[",
"end",
"]",
")",
")",
"{",
"end",
"++",
";",
"}",
"if",
"(",
"end",
">",
"contents",
".",
"length",
")",
"{",
"end",
"--",
";",
"}",
"char",
"[",
"]",
"selectedText",
"=",
"CharOperation",
".",
"subarray",
"(",
"contents",
",",
"start",
",",
"end",
")",
";",
"return",
"elementName",
".",
"equals",
"(",
"String",
".",
"valueOf",
"(",
"selectedText",
")",
")",
";",
"}",
"private",
"boolean",
"runViaAdapter",
"(",
"ISourceReference",
"_target",
",",
"boolean",
"lightweight",
")",
"{",
"try",
"{",
"IRenameTarget",
"target",
"=",
"adapt",
"(",
"_target",
",",
"IRenameTarget",
".",
"class",
")",
";",
"if",
"(",
"target",
"!=",
"null",
")",
"{",
"return",
"target",
".",
"performRenameAction",
"(",
"getShell",
"(",
")",
",",
"getEditor",
"(",
")",
",",
"lightweight",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"return",
"false",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"adapt",
"(",
"Object",
"target",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"T",
"result",
";",
"if",
"(",
"target",
"instanceof",
"IAdaptable",
")",
"{",
"result",
"=",
"(",
"T",
")",
"(",
"(",
"IAdaptable",
")",
"target",
")",
".",
"getAdapter",
"(",
"clazz",
")",
";",
"}",
"else",
"{",
"result",
"=",
"null",
";",
"}",
"return",
"result",
";",
"}",
"private",
"void",
"openJavaRefactoringWizard",
"(",
"IJavaElement",
"element",
")",
"throws",
"CoreException",
"{",
"JavaRefactoringDispatcher",
"dispatcher",
"=",
"new",
"JavaRefactoringDispatcher",
"(",
"element",
")",
";",
"RenameSupport",
"refactoring",
"=",
"dispatcher",
".",
"dispatchJavaRenameRefactoring",
"(",
")",
";",
"Shell",
"shell",
"=",
"getShell",
"(",
")",
";",
"refactoring",
".",
"openDialog",
"(",
"shell",
")",
";",
"}",
"private",
"Shell",
"getShell",
"(",
")",
"{",
"return",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,356 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"fix",
".",
"CodeFormatCleanUp",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"fix",
".",
"ImportsCleanUp",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"fix",
".",
"MapCleanUpOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"saveparticipant",
".",
"IPostSaveListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"CleanUpOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"ICleanUp",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"public",
"class",
"GroovyCleanupPostSaveListener",
"extends",
"CleanUpPostSaveListener",
"implements",
"IPostSaveListener",
"{",
"@",
"Override",
"protected",
"ICleanUp",
"[",
"]",
"getCleanUps",
"(",
"Map",
"settings",
",",
"Set",
"ids",
")",
"{",
"ICleanUp",
"[",
"]",
"javaCleanUps",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getCleanUpRegistry",
"(",
")",
".",
"createCleanUps",
"(",
"ids",
")",
";",
"CleanUpOptions",
"options",
"=",
"new",
"MapCleanUpOptions",
"(",
"settings",
")",
";",
"boolean",
"doImports",
"=",
"false",
";",
"boolean",
"doFormat",
"=",
"false",
";",
"boolean",
"doIndent",
"=",
"false",
";",
"IPreferenceStore",
"groovyPreferences",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"boolean",
"doSemicolonRemoval",
"=",
"groovyPreferences",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"GROOVY_SAVE_ACTION_REMOVE_UNNECESSARY_SEMICOLONS",
")",
";",
"boolean",
"doWhitespaceRemoval",
"=",
"options",
".",
"isEnabled",
"(",
"CleanUpConstants",
".",
"FORMAT_REMOVE_TRAILING_WHITESPACES",
")",
";",
"for",
"(",
"ICleanUp",
"cleanup",
":",
"javaCleanUps",
")",
"{",
"if",
"(",
"cleanup",
"instanceof",
"ImportsCleanUp",
"&&",
"options",
".",
"isEnabled",
"(",
"CleanUpConstants",
".",
"ORGANIZE_IMPORTS",
")",
")",
"{",
"doImports",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"cleanup",
"instanceof",
"CodeFormatCleanUp",
")",
"{",
"if",
"(",
"options",
".",
"isEnabled",
"(",
"CleanUpConstants",
".",
"FORMAT_SOURCE_CODE",
")",
")",
"{",
"doFormat",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"options",
".",
"isEnabled",
"(",
"CleanUpConstants",
".",
"FORMAT_CORRECT_INDENTATION",
")",
")",
"{",
"doIndent",
"=",
"true",
";",
"}",
"}",
"}",
"List",
"<",
"ICleanUp",
">",
"groovyCleanUps",
"=",
"new",
"ArrayList",
"<",
"ICleanUp",
">",
"(",
")",
";",
"if",
"(",
"doImports",
")",
"{",
"groovyCleanUps",
".",
"add",
"(",
"new",
"GroovyImportsCleanUp",
"(",
")",
")",
";",
"}",
"if",
"(",
"doFormat",
")",
"{",
"groovyCleanUps",
".",
"add",
"(",
"new",
"GroovyCodeFormatCleanUp",
"(",
"FormatKind",
".",
"FORMAT",
")",
")",
";",
"}",
"else",
"if",
"(",
"doIndent",
")",
"{",
"groovyCleanUps",
".",
"add",
"(",
"new",
"GroovyCodeFormatCleanUp",
"(",
"FormatKind",
".",
"INDENT_ONLY",
")",
")",
";",
"}",
"if",
"(",
"doSemicolonRemoval",
")",
"{",
"groovyCleanUps",
".",
"add",
"(",
"new",
"UnnecessarySemicolonsCleanUp",
"(",
")",
")",
";",
"}",
"if",
"(",
"doWhitespaceRemoval",
")",
"{",
"groovyCleanUps",
".",
"add",
"(",
"new",
"TrailingWhitespacesCleanUp",
"(",
")",
")",
";",
"}",
"return",
"groovyCleanUps",
".",
"toArray",
"(",
"new",
"ICleanUp",
"[",
"groovyCleanUps",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"}",
"</s>"
] |
6,357 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"convert",
".",
"AssignStatementToNewLocalRefactoring",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"public",
"class",
"AssignStatementToNewLocalAction",
"extends",
"GroovyRefactoringAction",
"{",
"private",
"AssignStatementToNewLocalRefactoring",
"assignStatementRefactoring",
";",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"if",
"(",
"initRefactoring",
"(",
")",
"&&",
"assignStatementRefactoring",
".",
"isApplicable",
"(",
")",
")",
"{",
"assignStatementRefactoring",
".",
"applyRefactoring",
"(",
"getDocument",
"(",
")",
")",
";",
"Point",
"p",
"=",
"assignStatementRefactoring",
".",
"getNewSelection",
"(",
")",
";",
"getEditor",
"(",
")",
".",
"getViewer",
"(",
")",
".",
"setSelectedRange",
"(",
"p",
".",
"x",
",",
"p",
".",
"y",
")",
";",
"}",
"}",
"private",
"IDocument",
"getDocument",
"(",
")",
"{",
"return",
"getEditor",
"(",
")",
".",
"getDocumentProvider",
"(",
")",
".",
"getDocument",
"(",
"getEditor",
"(",
")",
".",
"getEditorInput",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"selectionChanged",
"(",
"IAction",
"action",
",",
"ISelection",
"selection",
")",
"{",
"super",
".",
"selectionChanged",
"(",
"action",
",",
"selection",
")",
";",
"if",
"(",
"action",
".",
"isEnabled",
"(",
")",
"&&",
"getSelection",
"(",
")",
"!=",
"null",
"&&",
"getUnit",
"(",
")",
"!=",
"null",
")",
"{",
"assignStatementRefactoring",
"=",
"new",
"AssignStatementToNewLocalRefactoring",
"(",
"getUnit",
"(",
")",
",",
"getSelection",
"(",
")",
".",
"getOffset",
"(",
")",
")",
";",
"if",
"(",
"!",
"assignStatementRefactoring",
".",
"isApplicable",
"(",
")",
")",
"{",
"action",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
6,358 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"convert",
".",
"ConvertToMethodRefactoring",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"public",
"class",
"ConvertToMethodAction",
"extends",
"GroovyRefactoringAction",
"{",
"private",
"ConvertToMethodRefactoring",
"convertToMethodRefactoring",
";",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"if",
"(",
"initRefactoring",
"(",
")",
"&&",
"convertToMethodRefactoring",
".",
"isApplicable",
"(",
")",
")",
"{",
"convertToMethodRefactoring",
".",
"applyRefactoring",
"(",
"getDocument",
"(",
")",
")",
";",
"int",
"length",
"=",
"getSelection",
"(",
")",
".",
"getLength",
"(",
")",
";",
"getEditor",
"(",
")",
".",
"getViewer",
"(",
")",
".",
"setSelectedRange",
"(",
"getSelection",
"(",
")",
".",
"getOffset",
"(",
")",
",",
"length",
">",
"1",
"?",
"length",
"-",
"1",
":",
"length",
"+",
"1",
")",
";",
"}",
"}",
"private",
"IDocument",
"getDocument",
"(",
")",
"{",
"return",
"getEditor",
"(",
")",
".",
"getDocumentProvider",
"(",
")",
".",
"getDocument",
"(",
"getEditor",
"(",
")",
".",
"getEditorInput",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"selectionChanged",
"(",
"IAction",
"action",
",",
"ISelection",
"selection",
")",
"{",
"super",
".",
"selectionChanged",
"(",
"action",
",",
"selection",
")",
";",
"if",
"(",
"action",
".",
"isEnabled",
"(",
")",
"&&",
"getSelection",
"(",
")",
"!=",
"null",
"&&",
"getUnit",
"(",
")",
"!=",
"null",
")",
"{",
"convertToMethodRefactoring",
"=",
"new",
"ConvertToMethodRefactoring",
"(",
"getUnit",
"(",
")",
",",
"getSelection",
"(",
")",
".",
"getOffset",
"(",
")",
")",
";",
"if",
"(",
"!",
"convertToMethodRefactoring",
".",
"isApplicable",
"(",
")",
")",
"{",
"action",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
6,359 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"OrganizeGroovyImports",
".",
"UnresolvedTypeData",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"TypeNameMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"codemanipulation",
".",
"OrganizeImportsOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"TypeNameMatchCollector",
";",
"public",
"class",
"TypeSearch",
"{",
"public",
"TypeSearch",
"(",
")",
"{",
"}",
"public",
"void",
"searchForTypes",
"(",
"GroovyCompilationUnit",
"unit",
",",
"Map",
"<",
"String",
",",
"OrganizeGroovyImports",
".",
"UnresolvedTypeData",
">",
"missingTypes",
")",
"throws",
"JavaModelException",
"{",
"char",
"[",
"]",
"[",
"]",
"allTypes",
"=",
"new",
"char",
"[",
"missingTypes",
".",
"size",
"(",
")",
"]",
"[",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"String",
"simpleName",
":",
"missingTypes",
".",
"keySet",
"(",
")",
")",
"{",
"allTypes",
"[",
"i",
"++",
"]",
"=",
"simpleName",
".",
"toCharArray",
"(",
")",
";",
"}",
"final",
"List",
"<",
"TypeNameMatch",
">",
"typesFound",
"=",
"new",
"ArrayList",
"<",
"TypeNameMatch",
">",
"(",
")",
";",
"TypeNameMatchCollector",
"collector",
"=",
"new",
"TypeNameMatchCollector",
"(",
"typesFound",
")",
";",
"IJavaSearchScope",
"scope",
"=",
"SearchEngine",
".",
"createJavaSearchScope",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"unit",
".",
"getJavaProject",
"(",
")",
"}",
")",
";",
"new",
"SearchEngine",
"(",
")",
".",
"searchAllTypeNames",
"(",
"null",
",",
"allTypes",
",",
"scope",
",",
"collector",
",",
"IJavaSearchConstants",
".",
"WAIT_UNTIL_READY_TO_SEARCH",
",",
"null",
")",
";",
"for",
"(",
"TypeNameMatch",
"match",
":",
"typesFound",
")",
"{",
"UnresolvedTypeData",
"data",
"=",
"missingTypes",
".",
"get",
"(",
"match",
".",
"getSimpleTypeName",
"(",
")",
")",
";",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"match",
".",
"getFullyQualifiedName",
"(",
")",
",",
"new",
"Exception",
"(",
")",
")",
";",
"continue",
";",
"}",
"if",
"(",
"isOfKind",
"(",
"match",
",",
"data",
".",
"isAnnotation",
")",
")",
"{",
"data",
".",
"addInfo",
"(",
"match",
")",
";",
"}",
"}",
"}",
"protected",
"boolean",
"isOfKind",
"(",
"TypeNameMatch",
"match",
",",
"boolean",
"isAnnotation",
")",
"{",
"return",
"isAnnotation",
"?",
"Flags",
".",
"isAnnotation",
"(",
"match",
".",
"getModifiers",
"(",
")",
")",
":",
"true",
";",
"}",
"}",
"</s>"
] |
6,360 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"public",
"enum",
"FormatKind",
"{",
"INDENT_ONLY",
",",
"FORMAT",
"}",
"</s>"
] |
6,361 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"core",
".",
"convert",
".",
"ConvertToClosureRefactoring",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"public",
"class",
"ConvertToClosureAction",
"extends",
"GroovyRefactoringAction",
"{",
"private",
"ConvertToClosureRefactoring",
"convertToClosureRefactoring",
";",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"if",
"(",
"initRefactoring",
"(",
")",
"&&",
"convertToClosureRefactoring",
".",
"isApplicable",
"(",
")",
")",
"{",
"convertToClosureRefactoring",
".",
"applyRefactoring",
"(",
"getDocument",
"(",
")",
")",
";",
"int",
"length",
"=",
"getSelection",
"(",
")",
".",
"getLength",
"(",
")",
";",
"getEditor",
"(",
")",
".",
"getViewer",
"(",
")",
".",
"setSelectedRange",
"(",
"getSelection",
"(",
")",
".",
"getOffset",
"(",
")",
",",
"length",
">",
"1",
"?",
"length",
"-",
"1",
":",
"length",
"+",
"1",
")",
";",
"}",
"}",
"private",
"IDocument",
"getDocument",
"(",
")",
"{",
"return",
"getEditor",
"(",
")",
".",
"getDocumentProvider",
"(",
")",
".",
"getDocument",
"(",
"getEditor",
"(",
")",
".",
"getEditorInput",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"selectionChanged",
"(",
"IAction",
"action",
",",
"ISelection",
"selection",
")",
"{",
"super",
".",
"selectionChanged",
"(",
"action",
",",
"selection",
")",
";",
"if",
"(",
"action",
".",
"isEnabled",
"(",
")",
"&&",
"getSelection",
"(",
")",
"!=",
"null",
"&&",
"getUnit",
"(",
")",
"!=",
"null",
")",
"{",
"convertToClosureRefactoring",
"=",
"new",
"ConvertToClosureRefactoring",
"(",
"getUnit",
"(",
")",
",",
"getSelection",
"(",
")",
".",
"getOffset",
"(",
")",
")",
";",
"if",
"(",
"!",
"convertToClosureRefactoring",
".",
"isApplicable",
"(",
")",
")",
"{",
"action",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
6,362 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"DefaultGroovyFormatter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"FormatterPreferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"IFormatterPreferences",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"TextEditFix",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"CleanUpContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"ICleanUpFix",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"public",
"class",
"GroovyCodeFormatCleanUp",
"extends",
"AbstractGroovyCleanUp",
"{",
"private",
"final",
"FormatKind",
"kind",
";",
"public",
"GroovyCodeFormatCleanUp",
"(",
"FormatKind",
"kind",
")",
"{",
"this",
".",
"kind",
"=",
"kind",
";",
"}",
"@",
"Override",
"public",
"ICleanUpFix",
"createFix",
"(",
"CleanUpContext",
"context",
")",
"throws",
"CoreException",
"{",
"ICompilationUnit",
"unit",
"=",
"context",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"!",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
")",
"{",
"return",
"null",
";",
"}",
"GroovyCompilationUnit",
"gunit",
"=",
"(",
"GroovyCompilationUnit",
")",
"unit",
";",
"char",
"[",
"]",
"contents",
"=",
"gunit",
".",
"getContents",
"(",
")",
";",
"ITextSelection",
"sel",
"=",
"new",
"TextSelection",
"(",
"0",
",",
"contents",
".",
"length",
")",
";",
"IDocument",
"doc",
"=",
"new",
"Document",
"(",
"new",
"String",
"(",
"contents",
")",
")",
";",
"boolean",
"isIndentOnly",
"=",
"kind",
"==",
"FormatKind",
".",
"INDENT_ONLY",
";",
"IFormatterPreferences",
"preferences",
"=",
"new",
"FormatterPreferences",
"(",
"gunit",
")",
";",
"DefaultGroovyFormatter",
"formatter",
"=",
"new",
"DefaultGroovyFormatter",
"(",
"sel",
",",
"doc",
",",
"preferences",
",",
"isIndentOnly",
")",
";",
"TextEdit",
"edit",
"=",
"formatter",
".",
"format",
"(",
")",
";",
"return",
"new",
"TextEditFix",
"(",
"edit",
",",
"gunit",
",",
"\"\"",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"[",
"]",
"getStepDescriptions",
"(",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"\"\"",
"}",
";",
"}",
"}",
"</s>"
] |
6,363 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"TypeNameMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"codemanipulation",
".",
"OrganizeImportsOperation",
".",
"IChooseImportQuery",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"FixMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"ImportsFix",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"ActionMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"fix",
".",
"MultiFixMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"BasicElementLabels",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"CleanUpContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"ICleanUpFix",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"RefactoringStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MultiTextEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"public",
"class",
"GroovyImportsCleanUp",
"extends",
"AbstractGroovyCleanUp",
"{",
"@",
"Override",
"public",
"ICleanUpFix",
"createFix",
"(",
"CleanUpContext",
"context",
")",
"throws",
"CoreException",
"{",
"ICompilationUnit",
"unit",
"=",
"context",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"!",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"boolean",
"hasAmbiguity",
"[",
"]",
"=",
"new",
"boolean",
"[",
"]",
"{",
"false",
"}",
";",
"IChooseImportQuery",
"query",
"=",
"new",
"IChooseImportQuery",
"(",
")",
"{",
"public",
"TypeNameMatch",
"[",
"]",
"chooseImports",
"(",
"TypeNameMatch",
"[",
"]",
"[",
"]",
"openChoices",
",",
"ISourceRange",
"[",
"]",
"ranges",
")",
"{",
"hasAmbiguity",
"[",
"0",
"]",
"=",
"true",
";",
"return",
"new",
"TypeNameMatch",
"[",
"0",
"]",
";",
"}",
"}",
";",
"OrganizeGroovyImports",
"op",
"=",
"new",
"OrganizeGroovyImports",
"(",
"(",
"GroovyCompilationUnit",
")",
"unit",
",",
"query",
")",
";",
"final",
"TextEdit",
"edit",
"=",
"op",
".",
"calculateMissingImports",
"(",
")",
";",
"if",
"(",
"status",
"==",
"null",
")",
"{",
"status",
"=",
"new",
"RefactoringStatus",
"(",
")",
";",
"}",
"if",
"(",
"hasAmbiguity",
"[",
"0",
"]",
")",
"{",
"status",
".",
"addInfo",
"(",
"Messages",
".",
"format",
"(",
"ActionMessages",
".",
"OrganizeImportsAction_multi_error_unresolvable",
",",
"getLocationString",
"(",
"unit",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"edit",
"==",
"null",
")",
"{",
"status",
".",
"addInfo",
"(",
"Messages",
".",
"format",
"(",
"ActionMessages",
".",
"OrganizeImportsAction_multi_error_parse",
",",
"getLocationString",
"(",
"unit",
")",
")",
")",
";",
"}",
"if",
"(",
"edit",
"==",
"null",
"||",
"(",
"edit",
"instanceof",
"MultiTextEdit",
"&&",
"edit",
".",
"getChildrenSize",
"(",
")",
"==",
"0",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"ImportsFix",
"(",
"edit",
",",
"unit",
",",
"FixMessages",
".",
"ImportsFix_OrganizeImports_Description",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"[",
"]",
"getStepDescriptions",
"(",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"MultiFixMessages",
".",
"ImportsCleanUp_OrganizeImports_Description",
"}",
";",
"}",
"private",
"static",
"String",
"getLocationString",
"(",
"final",
"ICompilationUnit",
"unit",
")",
"{",
"return",
"BasicElementLabels",
".",
"getPathLabel",
"(",
"unit",
".",
"getPath",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
"</s>"
] |
6,364 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"java",
".",
"lang",
".",
"reflect",
".",
"InvocationTargetException",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"CleanUpConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"ActionMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"CleanUpAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"MultiFormatAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"util",
".",
"ElementValidator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaUI",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"FormatAllAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"CleanUpOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"ICleanUp",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"ErrorDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"StructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorSite",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchSite",
";",
"public",
"class",
"FormatAllGroovyAction",
"extends",
"FormatAllAction",
"{",
"public",
"static",
"class",
"GroovyMultiFormatAction",
"extends",
"MultiFormatAction",
"{",
"final",
"FormatKind",
"kind",
";",
"public",
"GroovyMultiFormatAction",
"(",
"IWorkbenchSite",
"site",
",",
"FormatKind",
"kind",
")",
"{",
"super",
"(",
"site",
")",
";",
"this",
".",
"kind",
"=",
"kind",
";",
"}",
"private",
"void",
"showUnexpectedError",
"(",
"CoreException",
"e",
")",
"{",
"String",
"message2",
"=",
"Messages",
".",
"format",
"(",
"ActionMessages",
".",
"CleanUpAction_UnexpectedErrorMessage",
",",
"e",
".",
"getStatus",
"(",
")",
".",
"getMessage",
"(",
")",
")",
";",
"IStatus",
"status",
"=",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"JavaUI",
".",
"ID_PLUGIN",
",",
"IStatus",
".",
"ERROR",
",",
"message2",
",",
"null",
")",
";",
"ErrorDialog",
".",
"openError",
"(",
"getShell",
"(",
")",
",",
"getActionName",
"(",
")",
",",
"null",
",",
"status",
")",
";",
"}",
"private",
"void",
"run",
"(",
"ICompilationUnit",
"cu",
")",
"{",
"if",
"(",
"cu",
".",
"isReadOnly",
"(",
")",
")",
"{",
"return",
";",
"}",
"ICleanUp",
"[",
"]",
"cleanUps",
"=",
"getCleanUps",
"(",
"new",
"ICompilationUnit",
"[",
"]",
"{",
"cu",
"}",
")",
";",
"if",
"(",
"cleanUps",
"==",
"null",
")",
"return",
";",
"if",
"(",
"!",
"ElementValidator",
".",
"check",
"(",
"cu",
",",
"getShell",
"(",
")",
",",
"getActionName",
"(",
")",
",",
"true",
")",
")",
"return",
";",
"try",
"{",
"performRefactoring",
"(",
"new",
"ICompilationUnit",
"[",
"]",
"{",
"cu",
"}",
",",
"cleanUps",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"if",
"(",
"e",
".",
"getCause",
"(",
")",
"instanceof",
"CoreException",
")",
"showUnexpectedError",
"(",
"(",
"CoreException",
")",
"e",
".",
"getCause",
"(",
")",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"ICompilationUnit",
"[",
"]",
"cus",
"=",
"getCompilationUnits",
"(",
"selection",
")",
";",
"if",
"(",
"cus",
".",
"length",
"==",
"0",
")",
"{",
"MessageDialog",
".",
"openInformation",
"(",
"getShell",
"(",
")",
",",
"getActionName",
"(",
")",
",",
"ActionMessages",
".",
"CleanUpAction_EmptySelection_description",
")",
";",
"}",
"else",
"if",
"(",
"cus",
".",
"length",
"==",
"1",
")",
"{",
"run",
"(",
"cus",
"[",
"0",
"]",
")",
";",
"}",
"else",
"{",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"CleanUpAction",
".",
"class",
",",
"\"\"",
",",
"new",
"Class",
"[",
"]",
"{",
"ICompilationUnit",
".",
"class",
"}",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"cus",
"}",
")",
";",
"}",
"}",
"@",
"Override",
"protected",
"ICleanUp",
"[",
"]",
"getCleanUps",
"(",
"ICompilationUnit",
"[",
"]",
"units",
")",
"{",
"Map",
"settings",
"=",
"new",
"Hashtable",
"(",
")",
";",
"settings",
".",
"put",
"(",
"CleanUpConstants",
".",
"FORMAT_SOURCE_CODE",
",",
"CleanUpOptions",
".",
"TRUE",
")",
";",
"return",
"new",
"ICleanUp",
"[",
"]",
"{",
"new",
"GroovyCodeFormatCleanUp",
"(",
"kind",
")",
"}",
";",
"}",
"}",
"public",
"FormatAllGroovyAction",
"(",
"IWorkbenchSite",
"site",
",",
"FormatKind",
"kind",
")",
"{",
"super",
"(",
"site",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"FormatAllAction",
".",
"class",
",",
"\"\"",
",",
"this",
",",
"new",
"GroovyMultiFormatAction",
"(",
"site",
",",
"kind",
")",
")",
";",
"if",
"(",
"kind",
"==",
"FormatKind",
".",
"INDENT_ONLY",
")",
"{",
"setText",
"(",
"\"Indent\"",
")",
";",
"setToolTipText",
"(",
"\"\"",
")",
";",
"setDescription",
"(",
"\"\"",
")",
";",
"}",
"else",
"if",
"(",
"kind",
"==",
"FormatKind",
".",
"FORMAT",
")",
"{",
"setText",
"(",
"\"Format\"",
")",
";",
"setToolTipText",
"(",
"\"\"",
")",
";",
"setDescription",
"(",
"\"\"",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"ITextSelection",
"selection",
")",
"{",
"if",
"(",
"getSite",
"(",
")",
"instanceof",
"IEditorSite",
")",
"{",
"IWorkbenchPart",
"part",
"=",
"(",
"(",
"IEditorSite",
")",
"getSite",
"(",
")",
")",
".",
"getPart",
"(",
")",
";",
"if",
"(",
"part",
"instanceof",
"GroovyEditor",
")",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"part",
".",
"getAdapter",
"(",
"GroovyCompilationUnit",
".",
"class",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"super",
".",
"run",
"(",
"new",
"StructuredSelection",
"(",
"unit",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"</s>"
] |
6,365 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"java",
".",
"text",
".",
"Collator",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"TypeNameMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"codemanipulation",
".",
"OrganizeImportsOperation",
".",
"IChooseImportQuery",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"History",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"QualifiedTypeNameHistory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"actions",
".",
"ActionMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"dialogs",
".",
"MultiElementListSelectionDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"util",
".",
"TypeNameMatchLabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"BasicElementLabels",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"OrganizeImportsAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IStatusLineManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ILabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"public",
"class",
"OrganizeGroovyImportsAction",
"extends",
"OrganizeImportsAction",
"{",
"private",
"static",
"final",
"OrganizeImportComparator",
"ORGANIZE_IMPORT_COMPARATOR",
"=",
"new",
"OrganizeImportComparator",
"(",
")",
";",
"private",
"static",
"final",
"class",
"OrganizeImportComparator",
"implements",
"Comparator",
"<",
"Object",
">",
"{",
"public",
"int",
"compare",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"if",
"(",
"(",
"(",
"String",
")",
"o1",
")",
".",
"equals",
"(",
"o2",
")",
")",
"return",
"0",
";",
"History",
"history",
"=",
"QualifiedTypeNameHistory",
".",
"getDefault",
"(",
")",
";",
"int",
"pos1",
"=",
"history",
".",
"getPosition",
"(",
"o1",
")",
";",
"int",
"pos2",
"=",
"history",
".",
"getPosition",
"(",
"o2",
")",
";",
"if",
"(",
"pos1",
"==",
"pos2",
")",
"return",
"Collator",
".",
"getInstance",
"(",
")",
".",
"compare",
"(",
"o1",
",",
"o2",
")",
";",
"if",
"(",
"pos1",
">",
"pos2",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"{",
"return",
"1",
";",
"}",
"}",
"}",
"private",
"JavaEditor",
"editor",
";",
"public",
"OrganizeGroovyImportsAction",
"(",
"JavaEditor",
"editor",
")",
"{",
"super",
"(",
"editor",
")",
";",
"this",
".",
"editor",
"=",
"editor",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"ICompilationUnit",
"cu",
")",
"{",
"if",
"(",
"cu",
"instanceof",
"GroovyCompilationUnit",
")",
"{",
"try",
"{",
"boolean",
"success",
"=",
"new",
"OrganizeGroovyImports",
"(",
"(",
"GroovyCompilationUnit",
")",
"cu",
",",
"createChooseImportQuery",
"(",
"editor",
")",
")",
".",
"calculateAndApplyMissingImports",
"(",
")",
";",
"if",
"(",
"!",
"success",
")",
"{",
"IStatusLineManager",
"manager",
"=",
"getStatusLineManager",
"(",
")",
";",
"if",
"(",
"manager",
"!=",
"null",
")",
"{",
"manager",
".",
"setErrorMessage",
"(",
"Messages",
".",
"format",
"(",
"ActionMessages",
".",
"OrganizeImportsAction_multi_error_parse",
",",
"getLocationString",
"(",
"cu",
")",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"cu",
".",
"getElementName",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"super",
".",
"run",
"(",
"cu",
")",
";",
"}",
"}",
"private",
"static",
"String",
"getLocationString",
"(",
"final",
"ICompilationUnit",
"cu",
")",
"{",
"return",
"BasicElementLabels",
".",
"getPathLabel",
"(",
"cu",
".",
"getPath",
"(",
")",
",",
"false",
")",
";",
"}",
"private",
"IChooseImportQuery",
"createChooseImportQuery",
"(",
"final",
"JavaEditor",
"editor",
")",
"{",
"return",
"new",
"IChooseImportQuery",
"(",
")",
"{",
"public",
"TypeNameMatch",
"[",
"]",
"chooseImports",
"(",
"TypeNameMatch",
"[",
"]",
"[",
"]",
"openChoices",
",",
"ISourceRange",
"[",
"]",
"ranges",
")",
"{",
"return",
"doChooseImports",
"(",
"openChoices",
",",
"ranges",
",",
"editor",
")",
";",
"}",
"}",
";",
"}",
"private",
"TypeNameMatch",
"[",
"]",
"doChooseImports",
"(",
"TypeNameMatch",
"[",
"]",
"[",
"]",
"openChoices",
",",
"final",
"ISourceRange",
"[",
"]",
"ranges",
",",
"final",
"JavaEditor",
"editor",
")",
"{",
"ISelection",
"sel",
"=",
"editor",
".",
"getSelectionProvider",
"(",
")",
".",
"getSelection",
"(",
")",
";",
"TypeNameMatch",
"[",
"]",
"result",
"=",
"null",
";",
"ILabelProvider",
"labelProvider",
"=",
"new",
"TypeNameMatchLabelProvider",
"(",
"TypeNameMatchLabelProvider",
".",
"SHOW_FULLYQUALIFIED",
")",
";",
"MultiElementListSelectionDialog",
"dialog",
"=",
"new",
"MultiElementListSelectionDialog",
"(",
"getShell",
"(",
")",
",",
"labelProvider",
")",
"{",
"@",
"Override",
"protected",
"void",
"handleSelectionChanged",
"(",
")",
"{",
"super",
".",
"handleSelectionChanged",
"(",
")",
";",
"doListSelectionChanged",
"(",
"getCurrentPage",
"(",
")",
",",
"ranges",
",",
"editor",
")",
";",
"}",
"}",
";",
"dialog",
".",
"setTitle",
"(",
"ActionMessages",
".",
"OrganizeImportsAction_selectiondialog_title",
")",
";",
"dialog",
".",
"setMessage",
"(",
"ActionMessages",
".",
"OrganizeImportsAction_selectiondialog_message",
")",
";",
"dialog",
".",
"setElements",
"(",
"openChoices",
")",
";",
"dialog",
".",
"setComparator",
"(",
"ORGANIZE_IMPORT_COMPARATOR",
")",
";",
"if",
"(",
"dialog",
".",
"open",
"(",
")",
"==",
"Window",
".",
"OK",
")",
"{",
"Object",
"[",
"]",
"res",
"=",
"dialog",
".",
"getResult",
"(",
")",
";",
"result",
"=",
"new",
"TypeNameMatch",
"[",
"res",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"res",
".",
"length",
";",
"i",
"++",
")",
"{",
"Object",
"[",
"]",
"array",
"=",
"(",
"Object",
"[",
"]",
")",
"res",
"[",
"i",
"]",
";",
"if",
"(",
"array",
".",
"length",
">",
"0",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"(",
"TypeNameMatch",
")",
"array",
"[",
"0",
"]",
";",
"QualifiedTypeNameHistory",
".",
"remember",
"(",
"result",
"[",
"i",
"]",
".",
"getFullyQualifiedName",
"(",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"sel",
"instanceof",
"ITextSelection",
")",
"{",
"ITextSelection",
"textSelection",
"=",
"(",
"ITextSelection",
")",
"sel",
";",
"editor",
".",
"selectAndReveal",
"(",
"textSelection",
".",
"getOffset",
"(",
")",
",",
"textSelection",
".",
"getLength",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}",
"private",
"void",
"doListSelectionChanged",
"(",
"int",
"page",
",",
"ISourceRange",
"[",
"]",
"ranges",
",",
"JavaEditor",
"editor",
")",
"{",
"if",
"(",
"ranges",
"!=",
"null",
"&&",
"page",
">=",
"0",
"&&",
"page",
"<",
"ranges",
".",
"length",
")",
"{",
"ISourceRange",
"range",
"=",
"ranges",
"[",
"page",
"]",
";",
"editor",
".",
"selectAndReveal",
"(",
"range",
".",
"getOffset",
"(",
")",
",",
"range",
".",
"getLength",
"(",
")",
")",
";",
"}",
"}",
"private",
"IStatusLineManager",
"getStatusLineManager",
"(",
")",
"{",
"if",
"(",
"editor",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"editor",
".",
"getEditorSite",
"(",
")",
".",
"getActionBars",
"(",
")",
".",
"getStatusLineManager",
"(",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"}",
"}",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
6,366 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"ErrorDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"ui",
".",
"refactoring",
".",
"RefactoringWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchWindow",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchWindowActionDelegate",
";",
"public",
"abstract",
"class",
"GroovyRefactoringAction",
"implements",
"IWorkbenchWindowActionDelegate",
",",
"IEditorActionDelegate",
"{",
"private",
"GroovyEditor",
"editor",
";",
"private",
"ITextSelection",
"selection",
";",
"private",
"GroovyCompilationUnit",
"gcu",
";",
"protected",
"boolean",
"initRefactoring",
"(",
")",
"{",
"if",
"(",
"editor",
"==",
"null",
"||",
"selection",
"==",
"null",
"||",
"gcu",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"gcu",
"!=",
"null",
")",
"{",
"if",
"(",
"gcu",
".",
"getModuleNode",
"(",
")",
"==",
"null",
")",
"{",
"displayErrorDialog",
"(",
"\"\"",
"+",
"gcu",
".",
"getElementName",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"protected",
"void",
"displayErrorDialog",
"(",
"String",
"message",
")",
"{",
"ErrorDialog",
"error",
"=",
"new",
"ErrorDialog",
"(",
"editor",
".",
"getSite",
"(",
")",
".",
"getShell",
"(",
")",
",",
"\"\"",
",",
"message",
",",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"GroovyPlugin",
".",
"PLUGIN_ID",
",",
"message",
")",
",",
"IStatus",
".",
"ERROR",
"|",
"IStatus",
".",
"WARNING",
")",
";",
"error",
".",
"open",
"(",
")",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"editor",
"=",
"null",
";",
"gcu",
"=",
"null",
";",
"selection",
"=",
"null",
";",
"}",
"protected",
"GroovyEditor",
"getEditor",
"(",
")",
"{",
"return",
"editor",
";",
"}",
"protected",
"ITextSelection",
"getSelection",
"(",
")",
"{",
"return",
"selection",
";",
"}",
"protected",
"GroovyCompilationUnit",
"getUnit",
"(",
")",
"{",
"return",
"gcu",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbenchWindow",
"window",
")",
"{",
"}",
"public",
"void",
"selectionChanged",
"(",
"IAction",
"action",
",",
"ISelection",
"selection",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"ITextSelection",
")",
"{",
"this",
".",
"selection",
"=",
"(",
"ITextSelection",
")",
"selection",
";",
"action",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"else",
"{",
"this",
".",
"selection",
"=",
"null",
";",
"action",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"}",
"public",
"void",
"setActiveEditor",
"(",
"IAction",
"action",
",",
"IEditorPart",
"targetEditor",
")",
"{",
"if",
"(",
"targetEditor",
"instanceof",
"GroovyEditor",
")",
"{",
"this",
".",
"editor",
"=",
"(",
"GroovyEditor",
")",
"targetEditor",
";",
"this",
".",
"gcu",
"=",
"editor",
".",
"getGroovyCompilationUnit",
"(",
")",
";",
"action",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"else",
"{",
"this",
".",
"editor",
"=",
"null",
";",
"this",
".",
"gcu",
"=",
"null",
";",
"action",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"}",
"public",
"static",
"int",
"getUIFlags",
"(",
")",
"{",
"return",
"RefactoringWizard",
".",
"DIALOG_BASED_USER_INTERFACE",
"|",
"RefactoringWizard",
".",
"PREVIEW_EXPAND_FIRST_NODE",
";",
"}",
"}",
"</s>"
] |
6,367 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"GroovyFormatter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"formatter",
".",
"SemicolonRemover",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"fix",
".",
"TextEditFix",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"CleanUpContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"cleanup",
".",
"ICleanUpFix",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"public",
"class",
"UnnecessarySemicolonsCleanUp",
"extends",
"AbstractGroovyCleanUp",
"{",
"@",
"Override",
"public",
"ICleanUpFix",
"createFix",
"(",
"CleanUpContext",
"context",
")",
"throws",
"CoreException",
"{",
"ICompilationUnit",
"unit",
"=",
"context",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"!",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
")",
"{",
"return",
"null",
";",
"}",
"GroovyCompilationUnit",
"gunit",
"=",
"(",
"GroovyCompilationUnit",
")",
"unit",
";",
"char",
"[",
"]",
"contents",
"=",
"gunit",
".",
"getContents",
"(",
")",
";",
"ITextSelection",
"selection",
"=",
"new",
"TextSelection",
"(",
"0",
",",
"contents",
".",
"length",
")",
";",
"IDocument",
"document",
"=",
"new",
"Document",
"(",
"new",
"String",
"(",
"contents",
")",
")",
";",
"GroovyFormatter",
"formatter",
"=",
"new",
"SemicolonRemover",
"(",
"selection",
",",
"document",
")",
";",
"TextEdit",
"edit",
"=",
"formatter",
".",
"format",
"(",
")",
";",
"return",
"new",
"TextEditFix",
"(",
"edit",
",",
"gunit",
",",
"\"\"",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"[",
"]",
"getStepDescriptions",
"(",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"\"\"",
"}",
";",
"}",
"}",
"</s>"
] |
6,368 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"console",
";",
"import",
"java",
".",
"util",
".",
"Calendar",
";",
"import",
"java",
".",
"util",
".",
"Date",
";",
"import",
"java",
".",
"util",
".",
"GregorianCalendar",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyLogManager",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"IGroovyLogger",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"TraceCategory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IToolBarManager",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"StyledText",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PartInitException",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IConsoleConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IConsoleView",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"TextConsole",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"TextConsolePage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"TextConsoleViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"actions",
".",
"CloseConsoleAction",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"console",
".",
"ScrollLockAction",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"part",
".",
"IPageSite",
";",
"public",
"class",
"GroovyConsolePage",
"extends",
"TextConsolePage",
"implements",
"IGroovyLogger",
"{",
"private",
"ScrollLockAction",
"fScrollLockAction",
";",
"private",
"CloseConsoleAction",
"fCloseConsoleAction",
";",
"public",
"GroovyConsolePage",
"(",
"TextConsole",
"console",
",",
"IConsoleView",
"view",
")",
"{",
"super",
"(",
"console",
",",
"view",
")",
";",
"}",
"private",
"String",
"twodigit",
"(",
"int",
"i",
")",
"{",
"String",
"number",
"=",
"Integer",
".",
"toString",
"(",
"i",
")",
";",
"if",
"(",
"number",
".",
"length",
"(",
")",
"<",
"2",
")",
"{",
"return",
"new",
"StringBuffer",
"(",
"\"0\"",
")",
".",
"append",
"(",
"number",
")",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"return",
"number",
".",
"toString",
"(",
")",
";",
"}",
"}",
"public",
"void",
"log",
"(",
"final",
"TraceCategory",
"category",
",",
"String",
"message",
")",
"{",
"Calendar",
"calendar",
"=",
"GregorianCalendar",
".",
"getInstance",
"(",
")",
";",
"calendar",
".",
"setTime",
"(",
"new",
"Date",
"(",
")",
")",
";",
"StringBuffer",
"time",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"time",
".",
"append",
"(",
"twodigit",
"(",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
")",
")",
".",
"append",
"(",
"\":\"",
")",
";",
"time",
".",
"append",
"(",
"twodigit",
"(",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
")",
")",
".",
"append",
"(",
"\":\"",
")",
";",
"time",
".",
"append",
"(",
"twodigit",
"(",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
")",
")",
";",
"time",
".",
"append",
"(",
"\"",
"\"",
")",
".",
"append",
"(",
"message",
")",
".",
"append",
"(",
"\"n\"",
")",
";",
"final",
"String",
"txt",
"=",
"time",
".",
"toString",
"(",
")",
";",
"this",
".",
"getControl",
"(",
")",
".",
"getDisplay",
"(",
")",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"TextConsoleViewer",
"viewer",
"=",
"getViewer",
"(",
")",
";",
"if",
"(",
"viewer",
"!=",
"null",
")",
"{",
"StyledText",
"text",
"=",
"viewer",
".",
"getTextWidget",
"(",
")",
";",
"text",
".",
"append",
"(",
"category",
".",
"getPaddedLabel",
"(",
")",
"+",
"\"",
":",
"\"",
"+",
"txt",
")",
";",
"if",
"(",
"!",
"fScrollLockAction",
".",
"isChecked",
"(",
")",
")",
"{",
"text",
".",
"setTopIndex",
"(",
"text",
".",
"getLineCount",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"}",
"public",
"boolean",
"isCategoryEnabled",
"(",
"TraceCategory",
"category",
")",
"{",
"return",
"true",
";",
"}",
"@",
"Override",
"public",
"void",
"init",
"(",
"IPageSite",
"pageSite",
")",
"throws",
"PartInitException",
"{",
"super",
".",
"init",
"(",
"pageSite",
")",
";",
"GroovyLogManager",
".",
"manager",
".",
"addLogger",
"(",
"this",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"dispose",
"(",
")",
"{",
"super",
".",
"dispose",
"(",
")",
";",
"if",
"(",
"fScrollLockAction",
"!=",
"null",
")",
"{",
"fScrollLockAction",
".",
"dispose",
"(",
")",
";",
"fScrollLockAction",
"=",
"null",
";",
"}",
"fCloseConsoleAction",
"=",
"null",
";",
"GroovyLogManager",
".",
"manager",
".",
"removeLogger",
"(",
"this",
")",
";",
"}",
"@",
"Override",
"protected",
"TextConsoleViewer",
"createViewer",
"(",
"Composite",
"parent",
")",
"{",
"TextConsoleViewer",
"viewer",
"=",
"new",
"TextConsoleViewer",
"(",
"parent",
",",
"(",
"GroovyConsole",
")",
"getConsole",
"(",
")",
")",
";",
"viewer",
".",
"setEditable",
"(",
"false",
")",
";",
"return",
"viewer",
";",
"}",
"@",
"Override",
"protected",
"void",
"createActions",
"(",
")",
"{",
"super",
".",
"createActions",
"(",
")",
";",
"fScrollLockAction",
"=",
"new",
"ScrollLockAction",
"(",
"getConsoleView",
"(",
")",
")",
";",
"fCloseConsoleAction",
"=",
"new",
"CloseConsoleAction",
"(",
"getConsole",
"(",
")",
")",
";",
"setAutoScroll",
"(",
"!",
"fScrollLockAction",
".",
"isChecked",
"(",
")",
")",
";",
"}",
"public",
"void",
"setAutoScroll",
"(",
"boolean",
"scroll",
")",
"{",
"TextConsoleViewer",
"viewer",
"=",
"(",
"TextConsoleViewer",
")",
"getViewer",
"(",
")",
";",
"if",
"(",
"viewer",
"!=",
"null",
")",
"{",
"fScrollLockAction",
".",
"setChecked",
"(",
"!",
"scroll",
")",
";",
"}",
"}",
"@",
"Override",
"protected",
"void",
"configureToolBar",
"(",
"IToolBarManager",
"mgr",
")",
"{",
"super",
".",
"configureToolBar",
"(",
"mgr",
")",
";",
"mgr",
".",
"appendToGroup",
"(",
"IConsoleConstants",
".",
"OUTPUT_GROUP",
",",
"fScrollLockAction",
")",
";",
"mgr",
".",
"appendToGroup",
"(",
"IConsoleConstants",
".",
"LAUNCH_GROUP",
",",
"fCloseConsoleAction",
")",
";",
"}",
"}",
"</s>"
] |
6,369 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"console",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"TraceCategory",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"IDebugUIConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"ImageDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"JFaceResources",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITypedRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"FastPartitioner",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"rules",
".",
"IPredicateRule",
";",
"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",
".",
"util",
".",
"IPropertyChangeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"PropertyChangeEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"StyleRange",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Font",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IConsoleDocumentPartitioner",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IConsoleView",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"TextConsole",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"part",
".",
"IPageBookViewPage",
";",
"public",
"class",
"GroovyConsole",
"extends",
"TextConsole",
"{",
"public",
"final",
"static",
"String",
"CONSOLE_TYPE",
"=",
"\"\"",
";",
"final",
"static",
"RuleBasedPartitionScanner",
"scanner",
"=",
"new",
"RuleBasedPartitionScanner",
"(",
")",
";",
"{",
"List",
"<",
"IPredicateRule",
">",
"rules",
"=",
"new",
"ArrayList",
"<",
"IPredicateRule",
">",
"(",
"TraceCategory",
".",
"values",
"(",
")",
".",
"length",
")",
";",
"for",
"(",
"TraceCategory",
"category",
":",
"TraceCategory",
".",
"values",
"(",
")",
")",
"{",
"rules",
".",
"add",
"(",
"new",
"SingleLineRule",
"(",
"category",
".",
"getPaddedLabel",
"(",
")",
",",
"\"\"",
",",
"new",
"Token",
"(",
"category",
".",
"label",
")",
")",
")",
";",
"}",
"scanner",
".",
"setPredicateRules",
"(",
"rules",
".",
"toArray",
"(",
"new",
"IPredicateRule",
"[",
"0",
"]",
")",
")",
";",
"}",
"class",
"GroovyEventTraceConsolePartitioner",
"extends",
"FastPartitioner",
"implements",
"IConsoleDocumentPartitioner",
"{",
"public",
"GroovyEventTraceConsolePartitioner",
"(",
")",
"{",
"super",
"(",
"scanner",
",",
"TraceCategory",
".",
"stringValues",
"(",
")",
")",
";",
"getDocument",
"(",
")",
".",
"setDocumentPartitioner",
"(",
"this",
")",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
"int",
"offset",
")",
"{",
"return",
"true",
";",
"}",
"public",
"StyleRange",
"[",
"]",
"getStyleRanges",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"ITypedRegion",
"regions",
"[",
"]",
"=",
"computePartitioning",
"(",
"offset",
",",
"length",
")",
";",
"StyleRange",
"[",
"]",
"styles",
"=",
"new",
"StyleRange",
"[",
"regions",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"regions",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"TraceCategory",
".",
"CLASSPATH",
".",
"label",
".",
"equals",
"(",
"regions",
"[",
"i",
"]",
".",
"getType",
"(",
")",
")",
")",
"{",
"styles",
"[",
"i",
"]",
"=",
"new",
"StyleRange",
"(",
"offset",
",",
"length",
",",
"Display",
".",
"getDefault",
"(",
")",
".",
"getSystemColor",
"(",
"SWT",
".",
"COLOR_DARK_GREEN",
")",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"TraceCategory",
".",
"COMPILER",
".",
"label",
".",
"equals",
"(",
"regions",
"[",
"i",
"]",
".",
"getType",
"(",
")",
")",
")",
"{",
"styles",
"[",
"i",
"]",
"=",
"new",
"StyleRange",
"(",
"offset",
",",
"length",
",",
"Display",
".",
"getDefault",
"(",
")",
".",
"getSystemColor",
"(",
"SWT",
".",
"COLOR_BLUE",
")",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"TraceCategory",
".",
"DSL",
".",
"label",
".",
"equals",
"(",
"regions",
"[",
"i",
"]",
".",
"getType",
"(",
")",
")",
")",
"{",
"styles",
"[",
"i",
"]",
"=",
"new",
"StyleRange",
"(",
"offset",
",",
"length",
",",
"Display",
".",
"getDefault",
"(",
")",
".",
"getSystemColor",
"(",
"SWT",
".",
"COLOR_DARK_RED",
")",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"TraceCategory",
".",
"REFACTORING",
".",
"label",
".",
"equals",
"(",
"regions",
"[",
"i",
"]",
".",
"getType",
"(",
")",
")",
")",
"{",
"styles",
"[",
"i",
"]",
"=",
"new",
"StyleRange",
"(",
"offset",
",",
"length",
",",
"Display",
".",
"getDefault",
"(",
")",
".",
"getSystemColor",
"(",
"SWT",
".",
"COLOR_DARK_YELLOW",
")",
",",
"null",
")",
";",
"}",
"else",
"{",
"styles",
"[",
"i",
"]",
"=",
"new",
"StyleRange",
"(",
"offset",
",",
"length",
",",
"null",
",",
"null",
")",
";",
"}",
"}",
"return",
"styles",
";",
"}",
"}",
"public",
"GroovyConsole",
"(",
"String",
"name",
",",
"String",
"consoleType",
",",
"ImageDescriptor",
"imageDescriptor",
",",
"boolean",
"autoLifecycle",
")",
"{",
"super",
"(",
"name",
",",
"consoleType",
",",
"imageDescriptor",
",",
"autoLifecycle",
")",
";",
"}",
"private",
"GroovyEventTraceConsolePartitioner",
"partitioner",
"=",
"new",
"GroovyEventTraceConsolePartitioner",
"(",
")",
";",
"private",
"IPropertyChangeListener",
"propertyListener",
"=",
"new",
"IPropertyChangeListener",
"(",
")",
"{",
"public",
"void",
"propertyChange",
"(",
"PropertyChangeEvent",
"event",
")",
"{",
"String",
"property",
"=",
"event",
".",
"getProperty",
"(",
")",
";",
"if",
"(",
"property",
".",
"equals",
"(",
"IDebugUIConstants",
".",
"PREF_CONSOLE_FONT",
")",
")",
"{",
"setFont",
"(",
"JFaceResources",
".",
"getFont",
"(",
"IDebugUIConstants",
".",
"PREF_CONSOLE_FONT",
")",
")",
";",
"}",
"}",
"}",
";",
"public",
"GroovyConsole",
"(",
")",
"{",
"super",
"(",
"\"\"",
",",
"CONSOLE_TYPE",
",",
"null",
",",
"true",
")",
";",
"Font",
"font",
"=",
"JFaceResources",
".",
"getFont",
"(",
"IDebugUIConstants",
".",
"PREF_CONSOLE_FONT",
")",
";",
"setFont",
"(",
"font",
")",
";",
"partitioner",
".",
"connect",
"(",
"getDocument",
"(",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"init",
"(",
")",
"{",
"JFaceResources",
".",
"getFontRegistry",
"(",
")",
".",
"addListener",
"(",
"propertyListener",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"dispose",
"(",
")",
"{",
"JFaceResources",
".",
"getFontRegistry",
"(",
")",
".",
"removeListener",
"(",
"propertyListener",
")",
";",
"super",
".",
"dispose",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"IConsoleDocumentPartitioner",
"getPartitioner",
"(",
")",
"{",
"return",
"partitioner",
";",
"}",
"@",
"Override",
"public",
"IPageBookViewPage",
"createPage",
"(",
"IConsoleView",
"view",
")",
"{",
"return",
"new",
"GroovyConsolePage",
"(",
"this",
",",
"view",
")",
";",
"}",
"}",
"</s>"
] |
6,370 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"console",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"ConsolePlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IConsole",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IConsoleFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IConsoleListener",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"console",
".",
"IConsoleManager",
";",
"public",
"class",
"GroovyConsoleFactory",
"implements",
"IConsoleFactory",
"{",
"private",
"IConsoleManager",
"fConsoleManager",
"=",
"null",
";",
"private",
"GroovyConsole",
"fConsole",
"=",
"null",
";",
"public",
"GroovyConsoleFactory",
"(",
")",
"{",
"fConsoleManager",
"=",
"ConsolePlugin",
".",
"getDefault",
"(",
")",
".",
"getConsoleManager",
"(",
")",
";",
"fConsoleManager",
".",
"addConsoleListener",
"(",
"new",
"IConsoleListener",
"(",
")",
"{",
"public",
"void",
"consolesAdded",
"(",
"IConsole",
"[",
"]",
"consoles",
")",
"{",
"}",
"public",
"void",
"consolesRemoved",
"(",
"IConsole",
"[",
"]",
"consoles",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"consoles",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"consoles",
"[",
"i",
"]",
"==",
"fConsole",
")",
"{",
"fConsole",
"=",
"null",
";",
"}",
"}",
"}",
"}",
")",
";",
"}",
"public",
"void",
"openConsole",
"(",
")",
"{",
"if",
"(",
"fConsole",
"==",
"null",
")",
"{",
"fConsole",
"=",
"new",
"GroovyConsole",
"(",
")",
";",
"fConsoleManager",
".",
"addConsoles",
"(",
"new",
"IConsole",
"[",
"]",
"{",
"fConsole",
"}",
")",
";",
"}",
"fConsoleManager",
".",
"showConsoleView",
"(",
"fConsole",
")",
";",
"}",
"}",
"</s>"
] |
6,371 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"browse",
";",
"public",
"interface",
"IBrowseTypeHandler",
"{",
"public",
"void",
"handleTypeSelection",
"(",
"String",
"qualifiedName",
")",
";",
"}",
"</s>"
] |
6,372 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"browse",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"dialogs",
".",
"FilteredTypesSelectionDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Text",
";",
"public",
"class",
"TypeBrowseSupport",
"{",
"private",
"IJavaProject",
"project",
";",
"public",
"static",
"final",
"int",
"FLAG_INTERFACE",
"=",
"1",
"<<",
"2",
";",
"public",
"static",
"final",
"int",
"FLAG_CLASS",
"=",
"1",
"<<",
"3",
";",
"public",
"static",
"final",
"String",
"TITLE",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"MESSAGE",
"=",
"\"\"",
";",
"private",
"Shell",
"shell",
";",
"private",
"IBrowseTypeHandler",
"handler",
";",
"public",
"TypeBrowseSupport",
"(",
"Shell",
"shell",
",",
"IJavaProject",
"project",
",",
"IBrowseTypeHandler",
"handler",
")",
"{",
"this",
".",
"shell",
"=",
"shell",
";",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"handler",
"=",
"handler",
";",
"}",
"protected",
"IJavaProject",
"getJavaProject",
"(",
")",
"{",
"return",
"project",
";",
"}",
"protected",
"boolean",
"isShellValid",
"(",
")",
"{",
"return",
"shell",
"!=",
"null",
"&&",
"!",
"shell",
".",
"isDisposed",
"(",
")",
";",
"}",
"protected",
"void",
"browseButtonPressed",
"(",
"Text",
"text",
")",
"{",
"if",
"(",
"!",
"isShellValid",
"(",
")",
")",
"{",
"return",
";",
"}",
"String",
"pattern",
"=",
"text",
"!=",
"null",
"&&",
"!",
"text",
".",
"isDisposed",
"(",
")",
"?",
"text",
".",
"getText",
"(",
")",
":",
"null",
";",
"int",
"javaSearchType",
"=",
"getJavaSearchType",
"(",
")",
";",
"if",
"(",
"javaSearchType",
"==",
"-",
"1",
")",
"{",
"return",
";",
"}",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"getJavaProject",
"(",
")",
"}",
";",
"IJavaSearchScope",
"scope",
"=",
"SearchEngine",
".",
"createJavaSearchScope",
"(",
"elements",
")",
";",
"FilteredTypesSelectionDialog",
"dialog",
"=",
"new",
"FilteredTypesSelectionDialog",
"(",
"shell",
",",
"false",
",",
"null",
",",
"scope",
",",
"javaSearchType",
")",
";",
"dialog",
".",
"setTitle",
"(",
"TITLE",
")",
";",
"dialog",
".",
"setMessage",
"(",
"MESSAGE",
")",
";",
"dialog",
".",
"setInitialPattern",
"(",
"pattern",
")",
";",
"final",
"Text",
"finText",
"=",
"text",
";",
"if",
"(",
"dialog",
".",
"open",
"(",
")",
"==",
"Window",
".",
"OK",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"dialog",
".",
"getFirstResult",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"String",
"qualifiedName",
"=",
"type",
".",
"getFullyQualifiedName",
"(",
")",
";",
"finText",
".",
"setText",
"(",
"qualifiedName",
")",
";",
"if",
"(",
"handler",
"!=",
"null",
")",
"{",
"handler",
".",
"handleTypeSelection",
"(",
"finText",
".",
"getText",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"public",
"void",
"applySupport",
"(",
"Button",
"button",
",",
"Text",
"text",
")",
"{",
"final",
"Text",
"finText",
"=",
"text",
";",
"button",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"browseButtonPressed",
"(",
"finText",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"widgetDefaultSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"browseButtonPressed",
"(",
"finText",
")",
";",
"}",
"}",
")",
";",
"}",
"public",
"static",
"int",
"getJavaSearchType",
"(",
")",
"{",
"return",
"IJavaSearchConstants",
".",
"TYPE",
";",
"}",
"}",
"</s>"
] |
6,373 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"decorators",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
".",
"IPreferenceChangeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
".",
"PreferenceChangeEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"InstanceScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"Activator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ContentTypeUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ScriptFolderSelector",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"ImageDescriptorRegistry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"JavaElementImageProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"TreeHierarchyLayoutProblemsDecorator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaElementImageDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"ImageDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ILabelDecorator",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ILabelProviderListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Rectangle",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"WorkbenchPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"decorators",
".",
"DecoratorManager",
";",
"public",
"class",
"GroovyImageDecorator",
"implements",
"ILabelDecorator",
"{",
"class",
"PreferenceChangeListener",
"implements",
"IPreferenceChangeListener",
"{",
"public",
"void",
"preferenceChange",
"(",
"PreferenceChangeEvent",
"event",
")",
"{",
"scriptFolderSelector",
"=",
"new",
"ScriptFolderSelector",
"(",
"null",
")",
";",
"}",
"}",
"private",
"ImageDescriptorRegistry",
"fRegistry",
";",
"private",
"TreeHierarchyLayoutProblemsDecorator",
"problemsDecorator",
";",
"private",
"DecoratorManager",
"decman",
";",
"private",
"boolean",
"preventRecursion",
"=",
"false",
";",
"private",
"PreferenceChangeListener",
"listener",
";",
"private",
"static",
"final",
"String",
"GROOVY_NATURE",
"=",
"\"\"",
";",
"private",
"ScriptFolderSelector",
"scriptFolderSelector",
";",
"public",
"GroovyImageDecorator",
"(",
")",
"{",
"problemsDecorator",
"=",
"new",
"TreeHierarchyLayoutProblemsDecorator",
"(",
")",
";",
"decman",
"=",
"WorkbenchPlugin",
".",
"getDefault",
"(",
")",
".",
"getDecoratorManager",
"(",
")",
";",
"listener",
"=",
"new",
"PreferenceChangeListener",
"(",
")",
";",
"new",
"InstanceScope",
"(",
")",
".",
"getNode",
"(",
"Activator",
".",
"PLUGIN_ID",
")",
".",
"addPreferenceChangeListener",
"(",
"listener",
")",
";",
"scriptFolderSelector",
"=",
"new",
"ScriptFolderSelector",
"(",
"null",
")",
";",
"}",
"public",
"Image",
"decorateImage",
"(",
"Image",
"image",
",",
"Object",
"element",
")",
"{",
"if",
"(",
"preventRecursion",
")",
"{",
"return",
"null",
";",
"}",
"boolean",
"isApplicable",
"=",
"false",
";",
"if",
"(",
"element",
"instanceof",
"ICompilationUnit",
")",
"{",
"IResource",
"r",
"=",
"(",
"(",
"ICompilationUnit",
")",
"element",
")",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"ContentTypeUtils",
".",
"isGroovyLikeFileName",
"(",
"r",
".",
"getName",
"(",
")",
")",
")",
"{",
"image",
"=",
"getJavaElementImageDescriptor",
"(",
"image",
",",
"r",
")",
";",
"isApplicable",
"=",
"true",
";",
"}",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"IFile",
"&&",
"ContentTypeUtils",
".",
"isGroovyLikeFileName",
"(",
"(",
"(",
"IResource",
")",
"element",
")",
".",
"getName",
"(",
")",
")",
")",
"{",
"image",
"=",
"getJavaElementImageDescriptor",
"(",
"image",
",",
"(",
"IResource",
")",
"element",
")",
";",
"isApplicable",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"String",
")",
"{",
"image",
"=",
"getImageLabel",
"(",
"new",
"JavaElementImageDescriptor",
"(",
"GroovyPluginImages",
".",
"DESC_GROOVY_FILE",
",",
"0",
",",
"JavaElementImageProvider",
".",
"SMALL_SIZE",
")",
")",
";",
"isApplicable",
"=",
"true",
";",
"}",
"if",
"(",
"isApplicable",
")",
"{",
"preventRecursion",
"=",
"true",
";",
"try",
"{",
"image",
"=",
"problemsDecorator",
".",
"decorateImage",
"(",
"image",
",",
"element",
")",
";",
"image",
"=",
"decman",
".",
"decorateImage",
"(",
"image",
",",
"element",
")",
";",
"}",
"finally",
"{",
"preventRecursion",
"=",
"false",
";",
"}",
"return",
"image",
";",
"}",
"return",
"null",
";",
"}",
"private",
"Image",
"getJavaElementImageDescriptor",
"(",
"Image",
"image",
",",
"IResource",
"resource",
")",
"{",
"int",
"flags",
";",
"if",
"(",
"image",
"!=",
"null",
")",
"{",
"Rectangle",
"rect",
"=",
"image",
".",
"getBounds",
"(",
")",
";",
"flags",
"=",
"(",
"rect",
".",
"width",
"==",
"16",
")",
"?",
"JavaElementImageProvider",
".",
"SMALL_ICONS",
":",
"0",
";",
"}",
"else",
"{",
"flags",
"=",
"JavaElementImageProvider",
".",
"SMALL_ICONS",
";",
"}",
"Point",
"size",
"=",
"useSmallSize",
"(",
"flags",
")",
"?",
"JavaElementImageProvider",
".",
"SMALL_SIZE",
":",
"JavaElementImageProvider",
".",
"BIG_SIZE",
";",
"ImageDescriptor",
"desc",
";",
"try",
"{",
"if",
"(",
"resource",
".",
"getProject",
"(",
")",
".",
"hasNature",
"(",
"GROOVY_NATURE",
")",
")",
"{",
"if",
"(",
"scriptFolderSelector",
".",
"isScript",
"(",
"resource",
".",
"getProjectRelativePath",
"(",
")",
".",
"toPortableString",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
")",
"{",
"desc",
"=",
"GroovyPluginImages",
".",
"DESC_GROOVY_FILE_SCRIPT",
";",
"}",
"else",
"{",
"desc",
"=",
"GroovyPluginImages",
".",
"DESC_GROOVY_FILE",
";",
"}",
"}",
"else",
"{",
"desc",
"=",
"GroovyPluginImages",
".",
"DESC_GROOVY_FILE_NO_BUILD",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"desc",
"=",
"GroovyPluginImages",
".",
"DESC_GROOVY_FILE_NO_BUILD",
";",
"}",
"return",
"getImageLabel",
"(",
"new",
"JavaElementImageDescriptor",
"(",
"desc",
",",
"0",
",",
"size",
")",
")",
";",
"}",
"private",
"static",
"boolean",
"useSmallSize",
"(",
"int",
"flags",
")",
"{",
"return",
"(",
"flags",
"&",
"JavaElementImageProvider",
".",
"SMALL_ICONS",
")",
"!=",
"0",
";",
"}",
"private",
"Image",
"getImageLabel",
"(",
"ImageDescriptor",
"descriptor",
")",
"{",
"if",
"(",
"descriptor",
"==",
"null",
")",
"return",
"null",
";",
"return",
"getRegistry",
"(",
")",
".",
"get",
"(",
"descriptor",
")",
";",
"}",
"private",
"ImageDescriptorRegistry",
"getRegistry",
"(",
")",
"{",
"if",
"(",
"fRegistry",
"==",
"null",
")",
"{",
"fRegistry",
"=",
"JavaPlugin",
".",
"getImageDescriptorRegistry",
"(",
")",
";",
"}",
"return",
"fRegistry",
";",
"}",
"public",
"void",
"addListener",
"(",
"ILabelProviderListener",
"listener",
")",
"{",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"}",
"public",
"boolean",
"isLabelProperty",
"(",
"Object",
"element",
",",
"String",
"property",
")",
"{",
"return",
"false",
";",
"}",
"public",
"void",
"removeListener",
"(",
"ILabelProviderListener",
"listener",
")",
"{",
"}",
"public",
"String",
"decorateText",
"(",
"String",
"text",
",",
"Object",
"element",
")",
"{",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
6,374 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"decorators",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"ImageDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"ImageRegistry",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"Bundle",
";",
"public",
"class",
"GroovyPluginImages",
"{",
"public",
"static",
"final",
"IPath",
"ICONS_PATH",
"=",
"new",
"Path",
"(",
"\"icons\"",
")",
";",
"private",
"static",
"final",
"ImageRegistry",
"imageRegistry",
"=",
"new",
"ImageRegistry",
"(",
")",
";",
"private",
"static",
"final",
"Bundle",
"bundle",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getBundle",
"(",
")",
";",
"public",
"static",
"final",
"String",
"IMG_NEW_GROOVY_PROJECT",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"IMG_GROOVY_FILE",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"IMG_GROOVY_FILE_NO_BUILD",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"IMG_GROOVY_FILE_SCRIPT",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"IMG_GROOVY_OVERLAY",
"=",
"\"\"",
";",
"public",
"static",
"final",
"ImageDescriptor",
"DESC_NEW_GROOVY_PROJECT",
"=",
"createDescriptor",
"(",
"IMG_NEW_GROOVY_PROJECT",
")",
";",
"public",
"static",
"final",
"ImageDescriptor",
"DESC_GROOVY_FILE",
"=",
"createDescriptor",
"(",
"IMG_GROOVY_FILE",
")",
";",
"public",
"static",
"final",
"ImageDescriptor",
"DESC_GROOVY_FILE_NO_BUILD",
"=",
"createDescriptor",
"(",
"IMG_GROOVY_FILE_NO_BUILD",
")",
";",
"public",
"static",
"final",
"ImageDescriptor",
"DESC_GROOVY_FILE_SCRIPT",
"=",
"createDescriptor",
"(",
"IMG_GROOVY_FILE_SCRIPT",
")",
";",
"public",
"static",
"final",
"ImageDescriptor",
"DESC_GROOVY_OVERLAY",
"=",
"createDescriptor",
"(",
"IMG_GROOVY_OVERLAY",
")",
";",
"public",
"static",
"ImageDescriptor",
"createDescriptor",
"(",
"String",
"path",
")",
"{",
"URL",
"url",
"=",
"bundle",
".",
"getEntry",
"(",
"path",
")",
";",
"ImageDescriptor",
"descriptor",
"=",
"url",
"==",
"null",
"?",
"ImageDescriptor",
".",
"getMissingImageDescriptor",
"(",
")",
":",
"ImageDescriptor",
".",
"createFromURL",
"(",
"url",
")",
";",
"imageRegistry",
".",
"put",
"(",
"path",
",",
"descriptor",
")",
";",
"return",
"descriptor",
";",
"}",
"public",
"static",
"Image",
"get",
"(",
"String",
"key",
")",
"{",
"return",
"imageRegistry",
".",
"get",
"(",
"key",
")",
";",
"}",
"public",
"static",
"ImageDescriptor",
"getDescriptor",
"(",
"String",
"key",
")",
"{",
"return",
"imageRegistry",
".",
"getDescriptor",
"(",
"key",
")",
";",
"}",
"}",
"</s>"
] |
6,375 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"decorators",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdaptable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ContentTypeUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IDecoration",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ILabelProviderListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ILightweightLabelDecorator",
";",
"public",
"class",
"GroovyElementDecorator",
"implements",
"ILightweightLabelDecorator",
"{",
"public",
"void",
"decorate",
"(",
"Object",
"element",
",",
"IDecoration",
"decoration",
")",
"{",
"if",
"(",
"element",
"instanceof",
"IAdaptable",
")",
"{",
"IMember",
"member",
"=",
"(",
"IMember",
")",
"(",
"(",
"IAdaptable",
")",
"element",
")",
".",
"getAdapter",
"(",
"IMember",
".",
"class",
")",
";",
"if",
"(",
"member",
"!=",
"null",
")",
"{",
"try",
"{",
"ICompilationUnit",
"unit",
"=",
"member",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"IResource",
"resource",
"=",
"unit",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"ContentTypeUtils",
".",
"isGroovyLikeFileName",
"(",
"resource",
".",
"getName",
"(",
")",
")",
")",
"{",
"decoration",
".",
"addOverlay",
"(",
"GroovyPluginImages",
".",
"DESC_GROOVY_OVERLAY",
",",
"IDecoration",
".",
"BOTTOM_RIGHT",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"public",
"void",
"addListener",
"(",
"ILabelProviderListener",
"listener",
")",
"{",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"}",
"public",
"boolean",
"isLabelProperty",
"(",
"Object",
"element",
",",
"String",
"property",
")",
"{",
"return",
"false",
";",
"}",
"public",
"void",
"removeListener",
"(",
"ILabelProviderListener",
"listener",
")",
"{",
"}",
"}",
"</s>"
] |
6,376 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyProjectFacade",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"expressions",
".",
"PropertyTester",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdaptable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"GroovyResourcePropertyTester",
"extends",
"PropertyTester",
"{",
"public",
"static",
"final",
"String",
"hasMain",
"=",
"\"hasMain\"",
";",
"public",
"static",
"final",
"String",
"isScript",
"=",
"\"isScript\"",
";",
"public",
"boolean",
"test",
"(",
"Object",
"receiver",
",",
"String",
"property",
",",
"Object",
"[",
"]",
"args",
",",
"Object",
"expectedValue",
")",
"{",
"boolean",
"returnValue",
"=",
"false",
";",
"if",
"(",
"hasMain",
".",
"equals",
"(",
"property",
")",
"||",
"isScript",
".",
"equals",
"(",
"property",
")",
")",
"{",
"if",
"(",
"receiver",
"instanceof",
"IAdaptable",
")",
"{",
"try",
"{",
"ICompilationUnit",
"unit",
"=",
"(",
"ICompilationUnit",
")",
"(",
"(",
"IAdaptable",
")",
"receiver",
")",
".",
"getAdapter",
"(",
"ICompilationUnit",
".",
"class",
")",
";",
"if",
"(",
"unit",
"==",
"null",
")",
"{",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"(",
"(",
"IAdaptable",
")",
"receiver",
")",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"if",
"(",
"file",
"!=",
"null",
"&&",
"Util",
".",
"isJavaLikeFileName",
"(",
"file",
".",
"getName",
"(",
")",
")",
")",
"{",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"}",
"}",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"if",
"(",
"hasMain",
".",
"equals",
"(",
"property",
")",
"||",
"isScript",
".",
"equals",
"(",
"property",
")",
")",
"{",
"List",
"<",
"IType",
">",
"results",
"=",
"GroovyProjectFacade",
".",
"findAllRunnableTypes",
"(",
"unit",
")",
";",
"returnValue",
"=",
"results",
".",
"size",
"(",
")",
">",
"0",
";",
"}",
"}",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getStatus",
"(",
")",
"!=",
"null",
"&&",
"e",
".",
"getStatus",
"(",
")",
".",
"getCode",
"(",
")",
"!=",
"IJavaModelStatusConstants",
".",
"ELEMENT_NOT_ON_CLASSPATH",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"receiver",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"return",
"returnValue",
";",
"}",
"}",
"</s>"
] |
6,377 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"cpcontainer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"builder",
".",
"GroovyClasspathContainer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"builder",
".",
"GroovyClasspathContainerInitializer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ProjectScope",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IScopeContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPluginImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"wizards",
".",
"IClasspathContainerPage",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"wizards",
".",
"IClasspathContainerPageExtension",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"wizards",
".",
"NewElementWizardPage",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"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",
".",
"osgi",
".",
"service",
".",
"prefs",
".",
"BackingStoreException",
";",
"public",
"class",
"GroovyClasspathContainerPage",
"extends",
"NewElementWizardPage",
"implements",
"IClasspathContainerPage",
",",
"IClasspathContainerPageExtension",
"{",
"private",
"IJavaProject",
"jProject",
";",
"private",
"IEclipsePreferences",
"prefStore",
";",
"private",
"IClasspathEntry",
"containerEntryResult",
";",
"private",
"Button",
"[",
"]",
"useGroovyLib",
";",
"private",
"enum",
"UseGroovyLib",
"{",
"TRUE",
"(",
"\"true\"",
",",
"\"Yes\"",
")",
",",
"FALSE",
"(",
"\"false\"",
",",
"\"No\"",
")",
",",
"DEFAULT",
"(",
"\"default\"",
",",
"\"\"",
")",
";",
"private",
"final",
"String",
"val",
";",
"private",
"final",
"String",
"label",
";",
"private",
"UseGroovyLib",
"(",
"String",
"val",
",",
"String",
"label",
")",
"{",
"this",
".",
"val",
"=",
"val",
";",
"this",
".",
"label",
"=",
"label",
";",
"}",
"String",
"val",
"(",
")",
"{",
"return",
"val",
";",
"}",
"String",
"label",
"(",
")",
"{",
"return",
"label",
";",
"}",
"static",
"UseGroovyLib",
"fromString",
"(",
"String",
"val",
")",
"{",
"if",
"(",
"val",
".",
"equals",
"(",
"TRUE",
".",
"val",
")",
")",
"{",
"return",
"TRUE",
";",
"}",
"else",
"if",
"(",
"val",
".",
"equals",
"(",
"FALSE",
".",
"val",
")",
")",
"{",
"return",
"FALSE",
";",
"}",
"return",
"DEFAULT",
";",
"}",
"}",
"public",
"GroovyClasspathContainerPage",
"(",
")",
"{",
"super",
"(",
"\"\"",
")",
";",
"setTitle",
"(",
"\"\"",
")",
";",
"setDescription",
"(",
"\"\"",
")",
";",
"setImageDescriptor",
"(",
"JavaPluginImages",
".",
"DESC_WIZBAN_ADD_LIBRARY",
")",
";",
"}",
"private",
"UseGroovyLib",
"getPreference",
"(",
")",
"{",
"return",
"prefStore",
"!=",
"null",
"?",
"UseGroovyLib",
".",
"fromString",
"(",
"prefStore",
".",
"get",
"(",
"PreferenceConstants",
".",
"GROOVY_CLASSPATH_USE_GROOVY_LIB",
",",
"\"default\"",
")",
")",
":",
"UseGroovyLib",
".",
"DEFAULT",
";",
"}",
"public",
"boolean",
"finish",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"prefStore",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"UseGroovyLib",
"storedPreference",
"=",
"getPreference",
"(",
")",
";",
"UseGroovyLib",
"currentPreference",
"=",
"getPreferenceSelection",
"(",
")",
";",
"if",
"(",
"storedPreference",
"!=",
"currentPreference",
")",
"{",
"prefStore",
".",
"put",
"(",
"PreferenceConstants",
".",
"GROOVY_CLASSPATH_USE_GROOVY_LIB",
",",
"currentPreference",
".",
"val",
"(",
")",
")",
";",
"prefStore",
".",
"flush",
"(",
")",
";",
"}",
"refreshNow",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"GroovyRuntime",
".",
"addGroovyClasspathContainer",
"(",
"jProject",
")",
";",
"}",
"return",
"true",
";",
"}",
"private",
"UseGroovyLib",
"getPreferenceSelection",
"(",
")",
"{",
"if",
"(",
"useGroovyLib",
"[",
"0",
"]",
".",
"getSelection",
"(",
")",
")",
"{",
"return",
"(",
"UseGroovyLib",
")",
"useGroovyLib",
"[",
"0",
"]",
".",
"getData",
"(",
")",
";",
"}",
"else",
"if",
"(",
"useGroovyLib",
"[",
"1",
"]",
".",
"getSelection",
"(",
")",
")",
"{",
"return",
"(",
"UseGroovyLib",
")",
"useGroovyLib",
"[",
"1",
"]",
".",
"getData",
"(",
")",
";",
"}",
"else",
"if",
"(",
"useGroovyLib",
"[",
"2",
"]",
".",
"getSelection",
"(",
")",
")",
"{",
"return",
"(",
"UseGroovyLib",
")",
"useGroovyLib",
"[",
"2",
"]",
".",
"getData",
"(",
")",
";",
"}",
"return",
"UseGroovyLib",
".",
"DEFAULT",
";",
"}",
"private",
"void",
"refreshNow",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"jProject",
"!=",
"null",
")",
"{",
"GroovyClasspathContainerInitializer",
".",
"updateGroovyClasspathContainer",
"(",
"jProject",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"public",
"IClasspathEntry",
"getSelection",
"(",
")",
"{",
"return",
"this",
".",
"containerEntryResult",
"!=",
"null",
"?",
"this",
".",
"containerEntryResult",
":",
"JavaCore",
".",
"newContainerEntry",
"(",
"GroovyClasspathContainer",
".",
"CONTAINER_ID",
")",
";",
"}",
"public",
"void",
"setSelection",
"(",
"final",
"IClasspathEntry",
"containerEntry",
")",
"{",
"this",
".",
"containerEntryResult",
"=",
"containerEntry",
";",
"}",
"public",
"void",
"createControl",
"(",
"final",
"Composite",
"parent",
")",
"{",
"final",
"Composite",
"composite",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"composite",
".",
"setLayout",
"(",
"new",
"GridLayout",
"(",
"1",
",",
"false",
")",
")",
";",
"Label",
"should",
"=",
"new",
"Label",
"(",
"composite",
",",
"SWT",
".",
"WRAP",
")",
";",
"should",
".",
"setText",
"(",
"\"\"",
")",
";",
"useGroovyLib",
"=",
"new",
"Button",
"[",
"3",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"useGroovyLib",
".",
"length",
";",
"i",
"++",
")",
"{",
"useGroovyLib",
"[",
"i",
"]",
"=",
"new",
"Button",
"(",
"composite",
",",
"SWT",
".",
"RADIO",
")",
";",
"useGroovyLib",
"[",
"i",
"]",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
")",
";",
"useGroovyLib",
"[",
"i",
"]",
".",
"setSelection",
"(",
"getPreference",
"(",
")",
"==",
"UseGroovyLib",
".",
"values",
"(",
")",
"[",
"i",
"]",
")",
";",
"useGroovyLib",
"[",
"i",
"]",
".",
"setData",
"(",
"UseGroovyLib",
".",
"values",
"(",
")",
"[",
"i",
"]",
")",
";",
"useGroovyLib",
"[",
"i",
"]",
".",
"setText",
"(",
"UseGroovyLib",
".",
"values",
"(",
")",
"[",
"i",
"]",
".",
"label",
"(",
")",
")",
";",
"if",
"(",
"prefStore",
"==",
"null",
")",
"{",
"useGroovyLib",
"[",
"i",
"]",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"}",
"Label",
"l",
"=",
"new",
"Label",
"(",
"composite",
",",
"SWT",
".",
"NONE",
")",
";",
"l",
".",
"setText",
"(",
"\"\"",
")",
";",
"l",
"=",
"new",
"Label",
"(",
"composite",
",",
"SWT",
".",
"NONE",
")",
";",
"l",
".",
"setText",
"(",
"\"\"",
")",
";",
"setControl",
"(",
"composite",
")",
";",
"}",
"public",
"void",
"initialize",
"(",
"final",
"IJavaProject",
"project",
",",
"final",
"IClasspathEntry",
"[",
"]",
"currentEntries",
")",
"{",
"if",
"(",
"project",
"==",
"null",
")",
"{",
"return",
";",
"}",
"jProject",
"=",
"project",
";",
"prefStore",
"=",
"preferenceStore",
"(",
"jProject",
".",
"getProject",
"(",
")",
")",
";",
"}",
"private",
"IEclipsePreferences",
"preferenceStore",
"(",
"IProject",
"p",
")",
"{",
"IScopeContext",
"projectScope",
"=",
"new",
"ProjectScope",
"(",
"p",
")",
";",
"return",
"projectScope",
".",
"getNode",
"(",
"GroovyCoreActivator",
".",
"PLUGIN_ID",
")",
";",
"}",
"}",
"</s>"
] |
6,378 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"utils",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"actions",
".",
"RenameToGroovyOrJavaAction",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"resource",
".",
"RenameResourceChange",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorReference",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IFileEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PartInitException",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"ide",
".",
"IDE",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"progress",
".",
"UIJob",
";",
"public",
"class",
"GroovyResourceUtil",
"{",
"public",
"static",
"final",
"String",
"GROOVY",
"=",
"\".groovy\"",
";",
"public",
"static",
"final",
"String",
"JAVA",
"=",
"\".java\"",
";",
"private",
"GroovyResourceUtil",
"(",
")",
"{",
"}",
"public",
"static",
"IStatus",
"renameFile",
"(",
"String",
"type",
",",
"List",
"<",
"IResource",
">",
"resources",
")",
"{",
"UIJob",
"renameTo",
"=",
"new",
"RenameToGroovyOrJavaJob",
"(",
"type",
",",
"resources",
")",
";",
"renameTo",
".",
"schedule",
"(",
")",
";",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"public",
"static",
"class",
"RenameToGroovyOrJavaJob",
"extends",
"UIJob",
"{",
"private",
"List",
"<",
"IResource",
">",
"resources",
";",
"private",
"String",
"javaOrGroovy",
";",
"private",
"RenameToGroovyOrJavaJob",
"(",
"String",
"javaOrGroovy",
",",
"List",
"<",
"IResource",
">",
"resources",
")",
"{",
"super",
"(",
"getJobName",
"(",
"javaOrGroovy",
")",
")",
";",
"this",
".",
"resources",
"=",
"resources",
";",
"this",
".",
"javaOrGroovy",
"=",
"javaOrGroovy",
";",
"}",
"protected",
"static",
"String",
"getJobName",
"(",
"String",
"javaOrGroovy",
")",
"{",
"return",
"\"Rename",
"to",
"\"",
"+",
"javaOrGroovy",
";",
"}",
"@",
"Override",
"public",
"boolean",
"belongsTo",
"(",
"Object",
"family",
")",
"{",
"return",
"RenameToGroovyOrJavaAction",
".",
"class",
"==",
"family",
";",
"}",
"@",
"Override",
"public",
"IStatus",
"runInUIThread",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"Set",
"<",
"IProject",
">",
"affectedProjects",
"=",
"new",
"HashSet",
"<",
"IProject",
">",
"(",
")",
";",
"final",
"Set",
"<",
"IResource",
">",
"filesAlreadyOpened",
"=",
"new",
"HashSet",
"<",
"IResource",
">",
"(",
")",
";",
"for",
"(",
"IResource",
"resource",
":",
"resources",
")",
"{",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"if",
"(",
"resource",
".",
"getType",
"(",
")",
"!=",
"IResource",
".",
"FILE",
")",
"{",
"continue",
";",
"}",
"IDE",
".",
"saveAllEditors",
"(",
"new",
"IFile",
"[",
"]",
"{",
"(",
"IFile",
")",
"resource",
"}",
",",
"true",
")",
";",
"String",
"name",
"=",
"convertName",
"(",
"resource",
")",
";",
"RenameResourceChange",
"change",
"=",
"new",
"RenameResourceChange",
"(",
"resource",
".",
"getFullPath",
"(",
")",
",",
"name",
")",
";",
"try",
"{",
"if",
"(",
"isOpenInEditor",
"(",
"resource",
")",
")",
"{",
"filesAlreadyOpened",
".",
"add",
"(",
"resource",
")",
";",
"}",
"change",
".",
"perform",
"(",
"monitor",
")",
";",
"IProject",
"project",
"=",
"resource",
".",
"getProject",
"(",
")",
";",
"if",
"(",
"!",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"project",
")",
")",
"{",
"affectedProjects",
".",
"add",
"(",
"project",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"String",
"message",
"=",
"\"\"",
"+",
"javaOrGroovy",
"+",
"\"",
"for",
"file",
"\"",
"+",
"resource",
".",
"getName",
"(",
")",
";",
"GroovyCore",
".",
"logException",
"(",
"message",
",",
"e",
")",
";",
"return",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"GroovyPlugin",
".",
"PLUGIN_ID",
",",
"message",
",",
"e",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"affectedProjects",
".",
"isEmpty",
"(",
")",
"&&",
"javaOrGroovy",
".",
"equals",
"(",
"GROOVY",
")",
")",
"{",
"askToConvert",
"(",
"affectedProjects",
",",
"this",
".",
"getDisplay",
"(",
")",
".",
"getActiveShell",
"(",
")",
")",
";",
"}",
"reopenFiles",
"(",
"filesAlreadyOpened",
")",
";",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"protected",
"String",
"convertName",
"(",
"IResource",
"file",
")",
"{",
"String",
"name",
"=",
"file",
".",
"getName",
"(",
")",
";",
"name",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"name",
".",
"lastIndexOf",
"(",
"'.'",
")",
")",
";",
"name",
"=",
"name",
"+",
"javaOrGroovy",
";",
"return",
"name",
";",
"}",
"protected",
"void",
"reopenFiles",
"(",
"Set",
"<",
"IResource",
">",
"filesAlreadyOpened",
")",
"{",
"for",
"(",
"IResource",
"origResource",
":",
"filesAlreadyOpened",
")",
"{",
"String",
"name",
"=",
"convertName",
"(",
"origResource",
")",
";",
"IFile",
"newFile",
"=",
"origResource",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"name",
")",
")",
";",
"try",
"{",
"IDE",
".",
"openEditor",
"(",
"getWorkbenchPage",
"(",
")",
",",
"newFile",
")",
";",
"}",
"catch",
"(",
"PartInitException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"name",
"+",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"private",
"IWorkbenchPage",
"getWorkbenchPage",
"(",
")",
"{",
"return",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getWorkbenchWindows",
"(",
")",
"[",
"0",
"]",
".",
"getActivePage",
"(",
")",
";",
"}",
"protected",
"void",
"askToConvert",
"(",
"Set",
"<",
"IProject",
">",
"affectedProjects",
",",
"Shell",
"shell",
")",
"{",
"if",
"(",
"affectedProjects",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"affectedProjects",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"sb",
".",
"append",
"(",
"\"Projects",
"\"",
")",
";",
"for",
"(",
"IProject",
"project",
":",
"affectedProjects",
")",
"{",
"sb",
".",
"append",
"(",
"project",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"sb",
".",
"replace",
"(",
"sb",
".",
"length",
"(",
")",
"-",
"2",
",",
"2",
",",
"\"",
"do",
"\"",
")",
";",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"\"Project",
"\"",
")",
".",
"append",
"(",
"affectedProjects",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"\"",
"does",
"\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\"\"",
")",
";",
"boolean",
"yes",
"=",
"MessageDialog",
".",
"openQuestion",
"(",
"shell",
",",
"\"\"",
",",
"sb",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"yes",
")",
"{",
"for",
"(",
"IProject",
"project",
":",
"affectedProjects",
")",
"{",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"project",
")",
";",
"}",
"}",
"}",
"protected",
"boolean",
"isOpenInEditor",
"(",
"IResource",
"file",
")",
"{",
"try",
"{",
"IEditorReference",
"[",
"]",
"refs",
"=",
"getWorkbenchPage",
"(",
")",
".",
"getEditorReferences",
"(",
")",
";",
"for",
"(",
"IEditorReference",
"ref",
":",
"refs",
")",
"{",
"try",
"{",
"if",
"(",
"ref",
".",
"getEditorInput",
"(",
")",
"instanceof",
"IFileEditorInput",
")",
"{",
"IFileEditorInput",
"input",
"=",
"(",
"IFileEditorInput",
")",
"ref",
".",
"getEditorInput",
"(",
")",
";",
"if",
"(",
"input",
".",
"getFile",
"(",
")",
".",
"equals",
"(",
"file",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"catch",
"(",
"PartInitException",
"e",
")",
"{",
"}",
"}",
"}",
"catch",
"(",
"NullPointerException",
"npe",
")",
"{",
"}",
"catch",
"(",
"IndexOutOfBoundsException",
"e",
")",
"{",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"</s>"
] |
6,379 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"java",
".",
"util",
".",
"ResourceBundle",
";",
"public",
"class",
"Messages",
"{",
"public",
"final",
"static",
"String",
"RESOURCE_BUNDLE",
"=",
"Messages",
".",
"class",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".Messages\"",
";",
"private",
"static",
"ResourceBundle",
"resourceBundle",
"=",
"null",
";",
"private",
"static",
"boolean",
"notRead",
"=",
"true",
";",
"public",
"Messages",
"(",
")",
"{",
"}",
"public",
"static",
"ResourceBundle",
"getResourceBundle",
"(",
")",
"{",
"if",
"(",
"!",
"notRead",
")",
"return",
"resourceBundle",
";",
"notRead",
"=",
"false",
";",
"try",
"{",
"resourceBundle",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"RESOURCE_BUNDLE",
")",
";",
"return",
"resourceBundle",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"static",
"String",
"getString",
"(",
"final",
"String",
"key",
")",
"{",
"try",
"{",
"return",
"getResourceBundle",
"(",
")",
".",
"getString",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"return",
"\"!\"",
"+",
"key",
"+",
"\"!\"",
";",
"}",
"}",
"}",
"</s>"
] |
6,380 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"AbstractPreferenceInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"public",
"class",
"FormatterPreferenceInitializer",
"extends",
"AbstractPreferenceInitializer",
"{",
"@",
"Override",
"public",
"void",
"initializeDefaultPreferences",
"(",
")",
"{",
"IPreferenceStore",
"store",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_MULTILINE_INDENTATION",
",",
"PreferenceConstants",
".",
"DEFAULT_INDENT_MULTILINE",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_BRACES_START",
",",
"PreferenceConstants",
".",
"SAME",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_BRACES_END",
",",
"PreferenceConstants",
".",
"NEXT",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_MAX_LINELENGTH",
",",
"PreferenceConstants",
".",
"DEFAULT_MAX_LINE_LEN",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_LONG_LIST_LENGTH",
",",
"PreferenceConstants",
".",
"DEFAULT_LONG_LIST_LENGTH",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_REMOVE_UNNECESSARY_SEMICOLONS",
",",
"false",
")",
";",
"}",
"}",
"</s>"
] |
6,381 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"java",
".",
"net",
".",
"MalformedURLException",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"builder",
".",
"GroovyClasspathContainerInitializer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"compiler",
".",
"CompilerCheckerParticipant",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"compiler",
".",
"CompilerUtils",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"frameworkadapter",
".",
"util",
".",
"SpecifiedVersion",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ProjectScope",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IScopeContext",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"InstanceScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"Activator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"preferences",
".",
"PropertyAndPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"ErrorDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"JFaceResources",
";",
"import",
"org",
".",
"eclipse",
".",
"osgi",
".",
"framework",
".",
"internal",
".",
"core",
".",
"FrameworkProperties",
";",
"import",
"org",
".",
"eclipse",
".",
"osgi",
".",
"service",
".",
"resolver",
".",
"BundleDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"osgi",
".",
"util",
".",
"NLS",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Font",
";",
"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",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Event",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Link",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Listener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPropertyPage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PartInitException",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"browser",
".",
"IWebBrowser",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"browser",
".",
"IWorkbenchBrowserSupport",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"Workbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"browser",
".",
"WebBrowserPreference",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"browser",
".",
"WorkbenchBrowserSupport",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"ide",
".",
"IDEWorkbenchMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"ide",
".",
"actions",
".",
"OpenWorkspaceAction",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"preferences",
".",
"ScopedPreferenceStore",
";",
"import",
"org",
".",
"osgi",
".",
"service",
".",
"prefs",
".",
"BackingStoreException",
";",
"public",
"class",
"CompilerPreferencesPage",
"extends",
"PropertyAndPreferencePage",
"implements",
"IWorkbenchPreferencePage",
",",
"IWorkbenchPropertyPage",
"{",
"public",
"static",
"final",
"String",
"PROPERTY_ID",
"=",
"Activator",
".",
"USING_PROJECT_PROPERTIES",
";",
"public",
"static",
"final",
"String",
"PREFERENCES_ID",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"PROP_VM",
"=",
"\"eclipse.vm\"",
";",
"private",
"static",
"final",
"String",
"PROP_VMARGS",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"PROP_REFRESH_BUNDLES",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"PROP_COMMANDS",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"PROP_EXIT_CODE",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"PROP_EXIT_DATA",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"CMD_VMARGS",
"=",
"\"-vmargs\"",
";",
"private",
"static",
"final",
"String",
"NEW_LINE",
"=",
"\"n\"",
";",
"protected",
"final",
"SpecifiedVersion",
"activeGroovyVersion",
";",
"protected",
"SpecifiedVersion",
"currentProjectVersion",
";",
"private",
"Button",
"groovyLibButt",
";",
"private",
"ScriptFolderSelectorPreferences",
"scriptFolderSelector",
";",
"private",
"IEclipsePreferences",
"preferences",
";",
"private",
"Combo",
"compilerCombo",
";",
"private",
"Button",
"doCheckForCompilerMismatch",
";",
"public",
"CompilerPreferencesPage",
"(",
")",
"{",
"super",
"(",
")",
";",
"activeGroovyVersion",
"=",
"CompilerUtils",
".",
"getActiveGroovyVersion",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"IPreferenceStore",
"doGetPreferenceStore",
"(",
")",
"{",
"IProject",
"project",
"=",
"getProject",
"(",
")",
";",
"ScopedPreferenceStore",
"store",
";",
"if",
"(",
"project",
"==",
"null",
")",
"{",
"IScopeContext",
"scope",
"=",
"InstanceScope",
".",
"INSTANCE",
";",
"preferences",
"=",
"scope",
".",
"getNode",
"(",
"Activator",
".",
"PLUGIN_ID",
")",
";",
"store",
"=",
"new",
"ScopedPreferenceStore",
"(",
"scope",
",",
"Activator",
".",
"PLUGIN_ID",
")",
";",
"}",
"else",
"{",
"IScopeContext",
"projectScope",
"=",
"new",
"ProjectScope",
"(",
"project",
")",
";",
"preferences",
"=",
"projectScope",
".",
"getNode",
"(",
"Activator",
".",
"PLUGIN_ID",
")",
";",
"store",
"=",
"new",
"ScopedPreferenceStore",
"(",
"projectScope",
",",
"Activator",
".",
"PLUGIN_ID",
")",
";",
"}",
"return",
"store",
";",
"}",
"public",
"IEclipsePreferences",
"getPreferences",
"(",
")",
"{",
"if",
"(",
"preferences",
"==",
"null",
")",
"{",
"doGetPreferenceStore",
"(",
")",
";",
"}",
"return",
"preferences",
";",
"}",
"@",
"Override",
"protected",
"Label",
"createDescriptionLabel",
"(",
"Composite",
"parent",
")",
"{",
"if",
"(",
"isProjectPreferencePage",
"(",
")",
")",
"{",
"Composite",
"body",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
")",
";",
"layout",
".",
"marginHeight",
"=",
"0",
";",
"layout",
".",
"marginWidth",
"=",
"0",
";",
"layout",
".",
"numColumns",
"=",
"2",
";",
"body",
".",
"setLayout",
"(",
"layout",
")",
";",
"body",
".",
"setFont",
"(",
"parent",
".",
"getFont",
"(",
")",
")",
";",
"GridData",
"data",
"=",
"new",
"GridData",
"(",
"GridData",
".",
"FILL",
",",
"GridData",
".",
"FILL",
",",
"true",
",",
"true",
")",
";",
"body",
".",
"setLayoutData",
"(",
"data",
")",
";",
"createProjectCompilerSection",
"(",
"body",
")",
";",
"}",
"return",
"super",
".",
"createDescriptionLabel",
"(",
"parent",
")",
";",
"}",
"@",
"Override",
"protected",
"Control",
"createPreferenceContent",
"(",
"Composite",
"parent",
")",
"{",
"final",
"Composite",
"page",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
")",
";",
"layout",
".",
"numColumns",
"=",
"1",
";",
"layout",
".",
"marginHeight",
"=",
"0",
";",
"layout",
".",
"marginWidth",
"=",
"0",
";",
"page",
".",
"setLayout",
"(",
"layout",
")",
";",
"page",
".",
"setFont",
"(",
"parent",
".",
"getFont",
"(",
")",
")",
";",
"if",
"(",
"getElement",
"(",
")",
"==",
"null",
")",
"{",
"createWorkspaceCompilerSection",
"(",
"page",
")",
";",
"}",
"scriptFolderSelector",
"=",
"new",
"ScriptFolderSelectorPreferences",
"(",
"page",
",",
"getPreferences",
"(",
")",
",",
"getPreferenceStore",
"(",
")",
")",
";",
"scriptFolderSelector",
".",
"createListContents",
"(",
")",
";",
"if",
"(",
"getElement",
"(",
")",
"==",
"null",
")",
"{",
"createClasspathContainerSection",
"(",
"page",
")",
";",
"}",
"return",
"page",
";",
"}",
"protected",
"void",
"createClasspathContainerSection",
"(",
"final",
"Composite",
"page",
")",
"{",
"Label",
"gccLabel",
"=",
"new",
"Label",
"(",
"page",
",",
"SWT",
".",
"WRAP",
")",
";",
"gccLabel",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
")",
";",
"gccLabel",
".",
"setText",
"(",
"\"\"",
")",
";",
"gccLabel",
".",
"setFont",
"(",
"getBoldFont",
"(",
"page",
")",
")",
";",
"Composite",
"gccPage",
"=",
"new",
"Composite",
"(",
"page",
",",
"SWT",
".",
"NONE",
"|",
"SWT",
".",
"BORDER",
")",
";",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
")",
";",
"layout",
".",
"numColumns",
"=",
"1",
";",
"layout",
".",
"marginHeight",
"=",
"3",
";",
"layout",
".",
"marginWidth",
"=",
"3",
";",
"gccPage",
".",
"setLayout",
"(",
"layout",
")",
";",
"gccPage",
".",
"setFont",
"(",
"page",
".",
"getFont",
"(",
")",
")",
";",
"gccPage",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"TOP",
",",
"true",
",",
"false",
")",
")",
";",
"groovyLibButt",
"=",
"new",
"Button",
"(",
"gccPage",
",",
"SWT",
".",
"CHECK",
")",
";",
"groovyLibButt",
".",
"setText",
"(",
"\"\"",
")",
";",
"groovyLibButt",
".",
"setSelection",
"(",
"GroovyCoreActivator",
".",
"getDefault",
"(",
")",
".",
"getPreference",
"(",
"PreferenceConstants",
".",
"GROOVY_CLASSPATH_USE_GROOVY_LIB_GLOBAL",
",",
"true",
")",
")",
";",
"GridData",
"gd",
"=",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"TOP",
",",
"true",
",",
"false",
")",
";",
"gd",
".",
"widthHint",
"=",
"500",
";",
"Label",
"groovyLibLabel",
"=",
"new",
"Label",
"(",
"gccPage",
",",
"SWT",
".",
"WRAP",
")",
";",
"groovyLibLabel",
".",
"setText",
"(",
"\"\"",
"+",
"\"\"",
")",
";",
"groovyLibLabel",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"Label",
"classpathLabel",
"=",
"new",
"Label",
"(",
"gccPage",
",",
"SWT",
".",
"WRAP",
")",
";",
"classpathLabel",
".",
"setText",
"(",
"\"\"",
")",
";",
"Button",
"updateGCC",
"=",
"new",
"Button",
"(",
"gccPage",
",",
"SWT",
".",
"PUSH",
")",
";",
"updateGCC",
".",
"setText",
"(",
"\"\"",
")",
";",
"updateGCC",
".",
"addSelectionListener",
"(",
"new",
"SelectionListener",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"updateClasspathContainers",
"(",
")",
";",
"}",
"public",
"void",
"widgetDefaultSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"updateClasspathContainers",
"(",
")",
";",
"}",
"}",
")",
";",
"Label",
"classpathLabel2",
"=",
"new",
"Label",
"(",
"gccPage",
",",
"SWT",
".",
"WRAP",
")",
";",
"classpathLabel2",
".",
"setText",
"(",
"\"\"",
"+",
"\"\"",
")",
";",
"classpathLabel2",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"}",
"protected",
"void",
"createProjectCompilerSection",
"(",
"final",
"Composite",
"page",
")",
"{",
"Label",
"compilerLabel",
"=",
"new",
"Label",
"(",
"page",
",",
"SWT",
".",
"WRAP",
")",
";",
"compilerLabel",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
")",
";",
"compilerLabel",
".",
"setText",
"(",
"\"\"",
"+",
"getProject",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\":\"",
")",
";",
"compilerLabel",
".",
"setFont",
"(",
"getBoldFont",
"(",
"page",
")",
")",
";",
"compilerCombo",
"=",
"new",
"Combo",
"(",
"page",
",",
"SWT",
".",
"DROP_DOWN",
"|",
"SWT",
".",
"READ_ONLY",
")",
";",
"compilerCombo",
".",
"add",
"(",
"\"1.7\"",
")",
";",
"compilerCombo",
".",
"add",
"(",
"\"1.8\"",
")",
";",
"compilerCombo",
".",
"add",
"(",
"\"2.0\"",
")",
";",
"currentProjectVersion",
"=",
"CompilerUtils",
".",
"getCompilerLevel",
"(",
"getProject",
"(",
")",
")",
";",
"Label",
"explainLabel",
"=",
"new",
"Label",
"(",
"page",
",",
"SWT",
".",
"WRAP",
")",
";",
"explainLabel",
".",
"setText",
"(",
"\"\"",
"+",
"\"\"",
")",
";",
"GridData",
"data",
"=",
"new",
"GridData",
"(",
")",
";",
"data",
".",
"horizontalSpan",
"=",
"2",
";",
"data",
".",
"grabExcessHorizontalSpace",
"=",
"false",
";",
"explainLabel",
".",
"setLayoutData",
"(",
"data",
")",
";",
"setToProjectVersion",
"(",
")",
";",
"}",
"private",
"void",
"setToProjectVersion",
"(",
")",
"{",
"switch",
"(",
"currentProjectVersion",
")",
"{",
"case",
"_17",
":",
"compilerCombo",
".",
"select",
"(",
"0",
")",
";",
"break",
";",
"case",
"_18",
":",
"compilerCombo",
".",
"select",
"(",
"1",
")",
";",
"break",
";",
"case",
"_20",
":",
"compilerCombo",
".",
"select",
"(",
"2",
")",
";",
"break",
";",
"}",
"}",
"protected",
"void",
"createWorkspaceCompilerSection",
"(",
"final",
"Composite",
"page",
")",
"{",
"Label",
"compilerLabel",
"=",
"new",
"Label",
"(",
"page",
",",
"SWT",
".",
"WRAP",
")",
";",
"compilerLabel",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
")",
";",
"compilerLabel",
".",
"setText",
"(",
"\"\"",
")",
";",
"compilerLabel",
".",
"setFont",
"(",
"getBoldFont",
"(",
"page",
")",
")",
";",
"Composite",
"compilerPage",
"=",
"new",
"Composite",
"(",
"page",
",",
"SWT",
".",
"NONE",
"|",
"SWT",
".",
"BORDER",
")",
";",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
")",
";",
"layout",
".",
"numColumns",
"=",
"1",
";",
"layout",
".",
"marginHeight",
"=",
"3",
";",
"layout",
".",
"marginWidth",
"=",
"3",
";",
"compilerPage",
".",
"setLayout",
"(",
"layout",
")",
";",
"compilerPage",
".",
"setFont",
"(",
"page",
".",
"getFont",
"(",
")",
")",
";",
"compilerPage",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"TOP",
",",
"true",
",",
"false",
")",
")",
";",
"Label",
"compilerVersion",
"=",
"new",
"Label",
"(",
"compilerPage",
",",
"SWT",
".",
"LEFT",
"|",
"SWT",
".",
"WRAP",
")",
";",
"compilerVersion",
".",
"setText",
"(",
"\"\"",
"+",
"CompilerUtils",
".",
"getGroovyVersion",
"(",
")",
"+",
"\".\"",
")",
";",
"if",
"(",
"activeGroovyVersion",
"!=",
"SpecifiedVersion",
".",
"_17",
")",
"{",
"switchVersion",
"(",
"SpecifiedVersion",
".",
"_17",
",",
"compilerPage",
")",
";",
"}",
"if",
"(",
"activeGroovyVersion",
"!=",
"SpecifiedVersion",
".",
"_18",
")",
"{",
"switchVersion",
"(",
"SpecifiedVersion",
".",
"_18",
",",
"compilerPage",
")",
";",
"}",
"if",
"(",
"activeGroovyVersion",
"!=",
"SpecifiedVersion",
".",
"_20",
")",
"{",
"switchVersion",
"(",
"SpecifiedVersion",
".",
"_20",
",",
"compilerPage",
")",
";",
"}",
"Link",
"moreInfoLink",
"=",
"new",
"Link",
"(",
"compilerPage",
",",
"0",
")",
";",
"moreInfoLink",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
")",
";",
"moreInfoLink",
".",
"setText",
"(",
"\"\"",
"+",
"\"\"",
")",
";",
"moreInfoLink",
".",
"addListener",
"(",
"SWT",
".",
"Selection",
",",
"new",
"Listener",
"(",
")",
"{",
"public",
"void",
"handleEvent",
"(",
"Event",
"event",
")",
"{",
"openUrl",
"(",
"event",
".",
"text",
")",
";",
"}",
"}",
")",
";",
"doCheckForCompilerMismatch",
"=",
"new",
"Button",
"(",
"compilerPage",
",",
"SWT",
".",
"CHECK",
")",
";",
"doCheckForCompilerMismatch",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
")",
";",
"doCheckForCompilerMismatch",
".",
"setText",
"(",
"\"\"",
")",
";",
"doCheckForCompilerMismatch",
".",
"setSelection",
"(",
"getPreferences",
"(",
")",
".",
"getBoolean",
"(",
"Activator",
".",
"GROOVY_CHECK_FOR_COMPILER_MISMATCH",
",",
"true",
")",
")",
";",
"}",
"private",
"void",
"switchVersion",
"(",
"final",
"SpecifiedVersion",
"toVersion",
",",
"final",
"Composite",
"compilerPage",
")",
"{",
"final",
"BundleDescription",
"toBundle",
"=",
"CompilerUtils",
".",
"getBundleDescription",
"(",
"toVersion",
")",
";",
"if",
"(",
"toBundle",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Button",
"switchTo",
"=",
"new",
"Button",
"(",
"compilerPage",
",",
"SWT",
".",
"PUSH",
")",
";",
"switchTo",
".",
"setText",
"(",
"\"Switch",
"to",
"\"",
"+",
"toBundle",
".",
"getVersion",
"(",
")",
")",
";",
"switchTo",
".",
"addSelectionListener",
"(",
"new",
"SelectionListener",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"Shell",
"shell",
"=",
"compilerPage",
".",
"getShell",
"(",
")",
";",
"boolean",
"result",
"=",
"MessageDialog",
".",
"openQuestion",
"(",
"shell",
",",
"\"\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"if",
"(",
"result",
")",
"{",
"IStatus",
"status",
"=",
"CompilerUtils",
".",
"switchVersions",
"(",
"activeGroovyVersion",
",",
"toVersion",
")",
";",
"if",
"(",
"status",
"==",
"Status",
".",
"OK_STATUS",
")",
"{",
"restart",
"(",
"shell",
")",
";",
"}",
"else",
"{",
"ErrorDialog",
"error",
"=",
"new",
"ErrorDialog",
"(",
"shell",
",",
"\"\"",
",",
"\"\"",
"+",
"toBundle",
".",
"getVersion",
"(",
")",
",",
"status",
",",
"IStatus",
".",
"ERROR",
")",
";",
"error",
".",
"open",
"(",
")",
";",
"}",
"}",
"}",
"public",
"void",
"widgetDefaultSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"}",
"}",
")",
";",
"}",
"private",
"Font",
"getBoldFont",
"(",
"Composite",
"page",
")",
"{",
"return",
"JFaceResources",
".",
"getFontRegistry",
"(",
")",
".",
"getBold",
"(",
"JFaceResources",
".",
"DIALOG_FONT",
")",
";",
"}",
"protected",
"void",
"restart",
"(",
"Shell",
"shell",
")",
"{",
"String",
"command_line",
"=",
"buildCommandLine",
"(",
"shell",
")",
";",
"if",
"(",
"command_line",
"==",
"null",
")",
"{",
"return",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"command_line",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"setProperty",
"(",
"PROP_EXIT_DATA",
",",
"command_line",
")",
";",
"System",
".",
"setProperty",
"(",
"PROP_EXIT_CODE",
",",
"Integer",
".",
"toString",
"(",
"24",
")",
")",
";",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"restart",
"(",
")",
";",
"}",
"private",
"String",
"buildCommandLine",
"(",
"Shell",
"shell",
")",
"{",
"String",
"property",
"=",
"FrameworkProperties",
".",
"getProperty",
"(",
"PROP_VM",
")",
";",
"if",
"(",
"property",
"==",
"null",
")",
"{",
"MessageDialog",
".",
"openError",
"(",
"shell",
",",
"IDEWorkbenchMessages",
".",
"OpenWorkspaceAction_errorTitle",
",",
"NLS",
".",
"bind",
"(",
"IDEWorkbenchMessages",
".",
"OpenWorkspaceAction_errorMessage",
",",
"PROP_VM",
")",
")",
";",
"return",
"null",
";",
"}",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"result",
".",
"append",
"(",
"property",
")",
";",
"result",
".",
"append",
"(",
"NEW_LINE",
")",
";",
"String",
"vmargs",
"=",
"System",
".",
"getProperty",
"(",
"PROP_VMARGS",
")",
";",
"vmargs",
"=",
"vmargs",
"==",
"null",
"?",
"PROP_REFRESH_BUNDLES",
"+",
"NEW_LINE",
":",
"vmargs",
"+",
"NEW_LINE",
"+",
"PROP_REFRESH_BUNDLES",
"+",
"NEW_LINE",
";",
"result",
".",
"append",
"(",
"vmargs",
")",
";",
"property",
"=",
"System",
".",
"getProperty",
"(",
"PROP_COMMANDS",
")",
";",
"if",
"(",
"property",
"!=",
"null",
")",
"{",
"result",
".",
"append",
"(",
"property",
")",
";",
"}",
"if",
"(",
"vmargs",
"!=",
"null",
")",
"{",
"result",
".",
"append",
"(",
"CMD_VMARGS",
")",
";",
"result",
".",
"append",
"(",
"NEW_LINE",
")",
";",
"result",
".",
"append",
"(",
"vmargs",
")",
";",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"init",
"(",
"IWorkbench",
"workbench",
")",
"{",
"}",
"public",
"static",
"void",
"openUrl",
"(",
"String",
"location",
")",
"{",
"try",
"{",
"URL",
"url",
"=",
"null",
";",
"if",
"(",
"location",
"!=",
"null",
")",
"{",
"url",
"=",
"new",
"URL",
"(",
"location",
")",
";",
"}",
"if",
"(",
"WebBrowserPreference",
".",
"getBrowserChoice",
"(",
")",
"==",
"WebBrowserPreference",
".",
"EXTERNAL",
")",
"{",
"try",
"{",
"IWorkbenchBrowserSupport",
"support",
"=",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getBrowserSupport",
"(",
")",
";",
"support",
".",
"getExternalBrowser",
"(",
")",
".",
"openURL",
"(",
"url",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"IWebBrowser",
"browser",
"=",
"null",
";",
"int",
"flags",
"=",
"0",
";",
"if",
"(",
"WorkbenchBrowserSupport",
".",
"getInstance",
"(",
")",
".",
"isInternalWebBrowserAvailable",
"(",
")",
")",
"{",
"flags",
"|=",
"IWorkbenchBrowserSupport",
".",
"AS_EDITOR",
"|",
"IWorkbenchBrowserSupport",
".",
"LOCATION_BAR",
"|",
"IWorkbenchBrowserSupport",
".",
"NAVIGATION_BAR",
";",
"}",
"else",
"{",
"flags",
"|=",
"IWorkbenchBrowserSupport",
".",
"AS_EXTERNAL",
"|",
"IWorkbenchBrowserSupport",
".",
"LOCATION_BAR",
"|",
"IWorkbenchBrowserSupport",
".",
"NAVIGATION_BAR",
";",
"}",
"String",
"id",
"=",
"\"\"",
";",
"browser",
"=",
"WorkbenchBrowserSupport",
".",
"getInstance",
"(",
")",
".",
"createBrowser",
"(",
"flags",
",",
"id",
",",
"null",
",",
"null",
")",
";",
"browser",
".",
"openURL",
"(",
"url",
")",
";",
"}",
"}",
"catch",
"(",
"PartInitException",
"e",
")",
"{",
"MessageDialog",
".",
"openError",
"(",
"Display",
".",
"getDefault",
"(",
")",
".",
"getActiveShell",
"(",
")",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"MessageDialog",
".",
"openInformation",
"(",
"Display",
".",
"getDefault",
"(",
")",
".",
"getActiveShell",
"(",
")",
",",
"\"\"",
",",
"location",
")",
";",
"}",
"}",
"private",
"void",
"updateClasspathContainers",
"(",
")",
"{",
"try",
"{",
"GroovyClasspathContainerInitializer",
".",
"updateAllGroovyClasspathContainers",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"boolean",
"performOk",
"(",
")",
"{",
"applyPreferences",
"(",
")",
";",
"return",
"super",
".",
"performOk",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"performApply",
"(",
")",
"{",
"applyPreferences",
"(",
")",
";",
"super",
".",
"performApply",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"performDefaults",
"(",
")",
"{",
"super",
".",
"performDefaults",
"(",
")",
";",
"if",
"(",
"getProject",
"(",
")",
"==",
"null",
")",
"{",
"GroovyCoreActivator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"PreferenceConstants",
".",
"GROOVY_CLASSPATH_USE_GROOVY_LIB_GLOBAL",
",",
"true",
")",
";",
"}",
"else",
"{",
"enableProjectSpecificSettings",
"(",
"false",
")",
";",
"}",
"scriptFolderSelector",
".",
"restoreDefaultsPressed",
"(",
")",
";",
"if",
"(",
"compilerCombo",
"!=",
"null",
")",
"{",
"setToProjectVersion",
"(",
")",
";",
"}",
"if",
"(",
"doCheckForCompilerMismatch",
"!=",
"null",
")",
"{",
"doCheckForCompilerMismatch",
".",
"setSelection",
"(",
"true",
")",
";",
"getPreferences",
"(",
")",
".",
"putBoolean",
"(",
"Activator",
".",
"GROOVY_CHECK_FOR_COMPILER_MISMATCH",
",",
"true",
")",
";",
"}",
"}",
"private",
"void",
"applyPreferences",
"(",
")",
"{",
"if",
"(",
"getProject",
"(",
")",
"==",
"null",
")",
"{",
"GroovyCoreActivator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"PreferenceConstants",
".",
"GROOVY_CLASSPATH_USE_GROOVY_LIB_GLOBAL",
",",
"groovyLibButt",
".",
"getSelection",
"(",
")",
")",
";",
"}",
"else",
"{",
"getPreferenceStore",
"(",
")",
".",
"setValue",
"(",
"PROPERTY_ID",
",",
"useProjectSettings",
"(",
")",
")",
";",
"}",
"scriptFolderSelector",
".",
"applyPreferences",
"(",
")",
";",
"if",
"(",
"doCheckForCompilerMismatch",
"!=",
"null",
")",
"{",
"boolean",
"isSelected",
"=",
"doCheckForCompilerMismatch",
".",
"getSelection",
"(",
")",
";",
"boolean",
"currentPref",
"=",
"getPreferences",
"(",
")",
".",
"getBoolean",
"(",
"Activator",
".",
"GROOVY_CHECK_FOR_COMPILER_MISMATCH",
",",
"true",
")",
";",
"if",
"(",
"!",
"isSelected",
"&&",
"currentPref",
")",
"{",
"try",
"{",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"deleteMarkers",
"(",
"CompilerCheckerParticipant",
".",
"COMPILER_MISMATCH_PROBLEM",
",",
"true",
",",
"IResource",
".",
"DEPTH_ONE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"if",
"(",
"isSelected",
"!=",
"currentPref",
")",
"{",
"getPreferences",
"(",
")",
".",
"putBoolean",
"(",
"Activator",
".",
"GROOVY_CHECK_FOR_COMPILER_MISMATCH",
",",
"isSelected",
")",
";",
"try",
"{",
"getPreferences",
"(",
")",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"if",
"(",
"compilerCombo",
"!=",
"null",
")",
"{",
"int",
"selectedIndex",
"=",
"compilerCombo",
".",
"getSelectionIndex",
"(",
")",
";",
"SpecifiedVersion",
"selected",
";",
"switch",
"(",
"selectedIndex",
")",
"{",
"case",
"0",
":",
"selected",
"=",
"SpecifiedVersion",
".",
"_17",
";",
"break",
";",
"case",
"1",
":",
"selected",
"=",
"SpecifiedVersion",
".",
"_18",
";",
"break",
";",
"case",
"2",
":",
"selected",
"=",
"SpecifiedVersion",
".",
"_20",
";",
"break",
";",
"default",
":",
"selected",
"=",
"SpecifiedVersion",
".",
"UNSPECIFIED",
";",
"}",
"if",
"(",
"selected",
"!=",
"currentProjectVersion",
"&&",
"selected",
"!=",
"SpecifiedVersion",
".",
"UNSPECIFIED",
")",
"{",
"CompilerUtils",
".",
"setCompilerLevel",
"(",
"getProject",
"(",
")",
",",
"selected",
")",
";",
"}",
"}",
"}",
"@",
"Override",
"protected",
"boolean",
"hasProjectSpecificOptions",
"(",
"IProject",
"project",
")",
"{",
"if",
"(",
"project",
"!=",
"null",
"&&",
"project",
".",
"equals",
"(",
"getProject",
"(",
")",
")",
")",
"{",
"return",
"getPreferenceStore",
"(",
")",
".",
"getBoolean",
"(",
"PROPERTY_ID",
")",
";",
"}",
"return",
"false",
";",
"}",
"@",
"Override",
"protected",
"String",
"getPreferencePageID",
"(",
")",
"{",
"return",
"PREFERENCES_ID",
";",
"}",
"@",
"Override",
"protected",
"String",
"getPropertyPageID",
"(",
")",
"{",
"return",
"PROPERTY_ID",
";",
"}",
"}",
"</s>"
] |
6,382 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"builder",
".",
"ConvertLegacyProject",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"IDialogConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialogWithToggle",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"progress",
".",
"UIJob",
";",
"public",
"class",
"AskToConvertLegacyProjects",
"extends",
"UIJob",
"{",
"public",
"AskToConvertLegacyProjects",
"(",
")",
"{",
"super",
"(",
"\"\"",
")",
";",
"}",
"@",
"Override",
"public",
"IStatus",
"runInUIThread",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"ConvertLegacyProject",
"legacy",
"=",
"new",
"ConvertLegacyProject",
"(",
")",
";",
"if",
"(",
"legacy",
".",
"getAllOldProjects",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"Shell",
"shell",
"=",
"this",
".",
"getDisplay",
"(",
")",
".",
"getActiveShell",
"(",
")",
";",
"boolean",
"shouldDispose",
"=",
"false",
";",
"if",
"(",
"shell",
"==",
"null",
")",
"{",
"Shell",
"[",
"]",
"shells",
"=",
"this",
".",
"getDisplay",
"(",
")",
".",
"getShells",
"(",
")",
";",
"if",
"(",
"shells",
".",
"length",
">",
"0",
")",
"{",
"shell",
"=",
"shells",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"shell",
"=",
"new",
"Shell",
"(",
"this",
".",
"getDisplay",
"(",
")",
")",
";",
"shouldDispose",
"=",
"true",
";",
"}",
"}",
"IPreferenceStore",
"prefs",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"MessageDialogWithToggle",
"d",
"=",
"MessageDialogWithToggle",
".",
"openYesNoQuestion",
"(",
"shell",
",",
"\"\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
",",
"false",
",",
"prefs",
",",
"PreferenceConstants",
".",
"GROOVY_ASK_TO_CONVERT_LEGACY_PROJECTS",
")",
";",
"try",
"{",
"if",
"(",
"IDialogConstants",
".",
"YES_ID",
"==",
"d",
".",
"getReturnCode",
"(",
")",
")",
"{",
"IProject",
"[",
"]",
"projects",
"=",
"legacy",
".",
"getAllOldProjects",
"(",
")",
";",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"projects",
".",
"length",
")",
";",
"for",
"(",
"IProject",
"project",
":",
"projects",
")",
"{",
"legacy",
".",
"convertProject",
"(",
"project",
")",
";",
"monitor",
".",
"internalWorked",
"(",
"1",
")",
";",
"}",
"}",
"prefs",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_ASK_TO_CONVERT_LEGACY_PROJECTS",
",",
"!",
"d",
".",
"getToggleState",
"(",
")",
")",
";",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"GroovyPlugin",
".",
"PLUGIN_ID",
",",
"\"\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"shouldDispose",
")",
"{",
"shell",
".",
"dispose",
"(",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
6,383 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"BooleanFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IntegerFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"RadioGroupFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"PreferenceLinkArea",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"preferences",
".",
"IWorkbenchPreferenceContainer",
";",
"public",
"class",
"FormatterPreferencesPage",
"extends",
"FieldEditorOverlayPage",
"implements",
"IWorkbenchPreferencePage",
"{",
"public",
"FormatterPreferencesPage",
"(",
")",
"{",
"super",
"(",
"GRID",
")",
";",
"setPreferenceStore",
"(",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
")",
";",
"new",
"FormatterPreferenceInitializer",
"(",
")",
".",
"initializeDefaultPreferences",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"createFieldEditors",
"(",
")",
"{",
"addField",
"(",
"new",
"RadioGroupFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_BRACES_START",
",",
"\"\"",
",",
"2",
",",
"new",
"String",
"[",
"]",
"[",
"]",
"{",
"{",
"\"\"",
",",
"PreferenceConstants",
".",
"SAME",
"}",
",",
"{",
"\"\"",
",",
"PreferenceConstants",
".",
"NEXT",
"}",
"}",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"addField",
"(",
"new",
"RadioGroupFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_BRACES_END",
",",
"\"\"",
",",
"2",
",",
"new",
"String",
"[",
"]",
"[",
"]",
"{",
"{",
"\"\"",
",",
"PreferenceConstants",
".",
"SAME",
"}",
",",
"{",
"\"\"",
",",
"PreferenceConstants",
".",
"NEXT",
"}",
"}",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"IntegerFieldEditor",
"multiInd",
"=",
"new",
"IntegerFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_MULTILINE_INDENTATION",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
",",
"2",
")",
";",
"multiInd",
".",
"setValidRange",
"(",
"0",
",",
"10",
")",
";",
"addField",
"(",
"multiInd",
")",
";",
"IntegerFieldEditor",
"listLenInt",
"=",
"new",
"IntegerFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_LONG_LIST_LENGTH",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
",",
"PreferenceConstants",
".",
"DEFAULT_LONG_LIST_LENGTH",
")",
";",
"listLenInt",
".",
"setValidRange",
"(",
"0",
",",
"200",
")",
";",
"listLenInt",
".",
"getLabelControl",
"(",
"getFieldEditorParent",
"(",
")",
")",
".",
"setToolTipText",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"addField",
"(",
"listLenInt",
")",
";",
"addField",
"(",
"new",
"BooleanFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_FORMATTER_REMOVE_UNNECESSARY_SEMICOLONS",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"PreferenceLinkArea",
"area",
"=",
"new",
"PreferenceLinkArea",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"WRAP",
",",
"\"\"",
",",
"\"\"",
",",
"(",
"IWorkbenchPreferenceContainer",
")",
"getContainer",
"(",
")",
",",
"null",
")",
";",
"GridData",
"data",
"=",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"TOP",
",",
"false",
",",
"false",
")",
";",
"data",
".",
"horizontalSpan",
"=",
"2",
";",
"area",
".",
"getControl",
"(",
")",
".",
"setLayoutData",
"(",
"data",
")",
";",
"}",
"@",
"Override",
"protected",
"String",
"getPageId",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbench",
"workbench",
")",
"{",
"}",
"}",
"</s>"
] |
6,384 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ProjectScope",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdaptable",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"FieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"FieldEditorPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPersistentPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferenceDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferenceManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferenceNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"ImageDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"BusyIndicator",
";",
"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",
".",
"ui",
".",
"IWorkbenchPropertyPage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"preferences",
".",
"ScopedPreferenceStore",
";",
"public",
"abstract",
"class",
"FieldEditorOverlayPage",
"extends",
"FieldEditorPreferencePage",
"implements",
"IWorkbenchPropertyPage",
"{",
"private",
"final",
"List",
"<",
"FieldEditor",
">",
"editors",
"=",
"new",
"ArrayList",
"<",
"FieldEditor",
">",
"(",
")",
";",
"private",
"IAdaptable",
"element",
";",
"private",
"IPreferenceStore",
"overlayStore",
";",
"private",
"ImageDescriptor",
"image",
";",
"private",
"String",
"pageID",
";",
"public",
"FieldEditorOverlayPage",
"(",
"final",
"int",
"style",
")",
"{",
"super",
"(",
"style",
")",
";",
"}",
"public",
"FieldEditorOverlayPage",
"(",
"final",
"String",
"title",
",",
"final",
"int",
"style",
")",
"{",
"super",
"(",
"title",
",",
"style",
")",
";",
"}",
"public",
"FieldEditorOverlayPage",
"(",
"final",
"String",
"title",
",",
"final",
"ImageDescriptor",
"image",
",",
"final",
"int",
"style",
")",
"{",
"super",
"(",
"title",
",",
"image",
",",
"style",
")",
";",
"this",
".",
"image",
"=",
"image",
";",
"}",
"protected",
"abstract",
"String",
"getPageId",
"(",
")",
";",
"public",
"void",
"setElement",
"(",
"final",
"IAdaptable",
"element",
")",
"{",
"this",
".",
"element",
"=",
"element",
";",
"}",
"public",
"IAdaptable",
"getElement",
"(",
")",
"{",
"return",
"element",
";",
"}",
"public",
"boolean",
"isPropertyPage",
"(",
")",
"{",
"return",
"getElement",
"(",
")",
"!=",
"null",
";",
"}",
"@",
"Override",
"protected",
"void",
"addField",
"(",
"final",
"FieldEditor",
"editor",
")",
"{",
"editors",
".",
"add",
"(",
"editor",
")",
";",
"super",
".",
"addField",
"(",
"editor",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"createControl",
"(",
"final",
"Composite",
"parent",
")",
"{",
"if",
"(",
"isPropertyPage",
"(",
")",
")",
"{",
"pageID",
"=",
"getPageId",
"(",
")",
";",
"overlayStore",
"=",
"createPreferenceStore",
"(",
")",
";",
"}",
"super",
".",
"createControl",
"(",
"parent",
")",
";",
"}",
"private",
"IPreferenceStore",
"createPreferenceStore",
"(",
")",
"{",
"IProject",
"proj",
"=",
"(",
"IProject",
")",
"getElement",
"(",
")",
".",
"getAdapter",
"(",
"IProject",
".",
"class",
")",
";",
"return",
"preferenceStore",
"(",
"proj",
")",
";",
"}",
"protected",
"IPersistentPreferenceStore",
"preferenceStore",
"(",
"IProject",
"proj",
")",
"{",
"return",
"new",
"ScopedPreferenceStore",
"(",
"new",
"ProjectScope",
"(",
"proj",
")",
",",
"\"\"",
")",
";",
"}",
"@",
"Override",
"protected",
"Control",
"createContents",
"(",
"final",
"Composite",
"parent",
")",
"{",
"if",
"(",
"isPropertyPage",
"(",
")",
")",
"createSelectionGroup",
"(",
"parent",
")",
";",
"return",
"super",
".",
"createContents",
"(",
"parent",
")",
";",
"}",
"private",
"void",
"createSelectionGroup",
"(",
"final",
"Composite",
"parent",
")",
"{",
"final",
"Composite",
"comp",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"final",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
"2",
",",
"false",
")",
";",
"layout",
".",
"marginHeight",
"=",
"0",
";",
"layout",
".",
"marginWidth",
"=",
"0",
";",
"comp",
".",
"setLayout",
"(",
"layout",
")",
";",
"comp",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"GridData",
".",
"FILL_HORIZONTAL",
")",
")",
";",
"final",
"Composite",
"radioGroup",
"=",
"new",
"Composite",
"(",
"comp",
",",
"SWT",
".",
"NONE",
")",
";",
"radioGroup",
".",
"setLayout",
"(",
"new",
"GridLayout",
"(",
")",
")",
";",
"radioGroup",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"GridData",
".",
"FILL_HORIZONTAL",
")",
")",
";",
"}",
"@",
"Override",
"public",
"IPreferenceStore",
"getPreferenceStore",
"(",
")",
"{",
"if",
"(",
"isPropertyPage",
"(",
")",
")",
"return",
"overlayStore",
";",
"return",
"super",
".",
"getPreferenceStore",
"(",
")",
";",
"}",
"protected",
"void",
"configureWorkspaceSettings",
"(",
")",
"{",
"try",
"{",
"final",
"IPreferencePage",
"page",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"page",
".",
"setTitle",
"(",
"getTitle",
"(",
")",
")",
";",
"page",
".",
"setImageDescriptor",
"(",
"image",
")",
";",
"showPreferencePage",
"(",
"pageID",
",",
"page",
")",
";",
"}",
"catch",
"(",
"final",
"InstantiationException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"IllegalAccessException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"private",
"void",
"showPreferencePage",
"(",
"final",
"String",
"id",
",",
"final",
"IPreferencePage",
"page",
")",
"{",
"final",
"IPreferenceNode",
"targetNode",
"=",
"new",
"PreferenceNode",
"(",
"id",
",",
"page",
")",
";",
"final",
"PreferenceManager",
"manager",
"=",
"new",
"PreferenceManager",
"(",
")",
";",
"manager",
".",
"addToRoot",
"(",
"targetNode",
")",
";",
"final",
"PreferenceDialog",
"dialog",
"=",
"new",
"PreferenceDialog",
"(",
"getControl",
"(",
")",
".",
"getShell",
"(",
")",
",",
"manager",
")",
";",
"BusyIndicator",
".",
"showWhile",
"(",
"getControl",
"(",
")",
".",
"getDisplay",
"(",
")",
",",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"dialog",
".",
"create",
"(",
")",
";",
"dialog",
".",
"setMessage",
"(",
"targetNode",
".",
"getLabelText",
"(",
")",
")",
";",
"dialog",
".",
"open",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"</s>"
] |
6,385 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"AbstractPreferenceInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"public",
"class",
"SaveActionsPreferenceInitializer",
"extends",
"AbstractPreferenceInitializer",
"{",
"@",
"Override",
"public",
"void",
"initializeDefaultPreferences",
"(",
")",
"{",
"IPreferenceStore",
"store",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_SAVE_ACTION_REMOVE_UNNECESSARY_SEMICOLONS",
",",
"false",
")",
";",
"}",
"}",
"</s>"
] |
6,386 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"builder",
".",
"ConvertLegacyProject",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"BooleanFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"RadioGroupFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"DisposeEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"DisposeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPreferencePage",
";",
"public",
"class",
"GroovyPreferencePage",
"extends",
"FieldEditorOverlayPage",
"implements",
"IWorkbenchPreferencePage",
"{",
"private",
"final",
"class",
"MonospaceFieldEditor",
"extends",
"BooleanFieldEditor",
"{",
"Label",
"myLabel",
";",
"private",
"MonospaceFieldEditor",
"(",
")",
"{",
"super",
"(",
"PreferenceConstants",
".",
"GROOVY_JUNIT_MONOSPACE_FONT",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"Label",
"getLabelControl",
"(",
"Composite",
"parent",
")",
"{",
"if",
"(",
"myLabel",
"==",
"null",
")",
"{",
"myLabel",
"=",
"new",
"Label",
"(",
"parent",
",",
"SWT",
".",
"LEFT",
"|",
"SWT",
".",
"WRAP",
")",
";",
"myLabel",
".",
"setFont",
"(",
"parent",
".",
"getFont",
"(",
")",
")",
";",
"String",
"text",
"=",
"getLabelText",
"(",
")",
";",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"myLabel",
".",
"setText",
"(",
"text",
")",
";",
"}",
"myLabel",
".",
"addDisposeListener",
"(",
"new",
"DisposeListener",
"(",
")",
"{",
"public",
"void",
"widgetDisposed",
"(",
"DisposeEvent",
"event",
")",
"{",
"myLabel",
"=",
"null",
";",
"}",
"}",
")",
";",
"}",
"else",
"{",
"checkParent",
"(",
"myLabel",
",",
"parent",
")",
";",
"}",
"return",
"myLabel",
";",
"}",
"@",
"Override",
"protected",
"Label",
"getLabelControl",
"(",
")",
"{",
"return",
"myLabel",
";",
"}",
"}",
"public",
"GroovyPreferencePage",
"(",
")",
"{",
"super",
"(",
"GRID",
")",
";",
"setPreferenceStore",
"(",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
")",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbench",
"workbench",
")",
"{",
"}",
"@",
"Override",
"protected",
"String",
"getPageId",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"void",
"createFieldEditors",
"(",
")",
"{",
"final",
"BooleanFieldEditor",
"monospaceEditor",
"=",
"new",
"MonospaceFieldEditor",
"(",
")",
";",
"monospaceEditor",
".",
"setPreferenceStore",
"(",
"getPreferenceStore",
"(",
")",
")",
";",
"addField",
"(",
"monospaceEditor",
")",
";",
"Label",
"monoLabel",
"=",
"new",
"Label",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"LEFT",
"|",
"SWT",
".",
"WRAP",
")",
";",
"monoLabel",
".",
"setText",
"(",
"\"\"",
"+",
"\"\"",
")",
";",
"Label",
"contentAssistLabel",
"=",
"new",
"Label",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"LEFT",
"|",
"SWT",
".",
"WRAP",
")",
";",
"contentAssistLabel",
".",
"setText",
"(",
"\"\"",
")",
";",
"addField",
"(",
"new",
"BooleanFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_ASSIST_NOPARENS",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"addField",
"(",
"new",
"BooleanFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_ASSIST_BRACKETS",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"addField",
"(",
"new",
"BooleanFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_NAMED_ARGUMENTS",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"addField",
"(",
"new",
"BooleanFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_PARAMETER_GUESSING",
",",
"\"\"",
"+",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"addField",
"(",
"new",
"RadioGroupFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_DEFAULT_WORKING_DIRECTORY",
",",
"\"\"",
"+",
"\"\"",
",",
"1",
",",
"new",
"String",
"[",
"]",
"[",
"]",
"{",
"{",
"\"Project",
"home\"",
",",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_PROJECT_HOME",
"}",
",",
"{",
"\"\"",
",",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_SCRIPT_LOC",
"}",
",",
"{",
"\"Eclipse",
"home\"",
",",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_ECLIPSE_HOME",
"}",
"}",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"ConvertLegacyProject",
"convert",
"=",
"new",
"ConvertLegacyProject",
"(",
")",
";",
"final",
"IProject",
"[",
"]",
"oldProjects",
"=",
"convert",
".",
"getAllOldProjects",
"(",
")",
";",
"if",
"(",
"oldProjects",
".",
"length",
">",
"0",
")",
"{",
"Label",
"l",
"=",
"new",
"Label",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"LEFT",
"|",
"SWT",
".",
"WRAP",
")",
";",
"l",
".",
"setText",
"(",
"\"\"",
")",
";",
"final",
"List",
"oldProjectsList",
"=",
"new",
"List",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"MULTI",
"|",
"SWT",
".",
"V_SCROLL",
")",
";",
"populateProjectsList",
"(",
"oldProjectsList",
",",
"oldProjects",
")",
";",
"l",
"=",
"new",
"Label",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"LEFT",
"|",
"SWT",
".",
"WRAP",
")",
";",
"l",
".",
"setText",
"(",
"\"\"",
")",
";",
"Button",
"convertButton",
"=",
"new",
"Button",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"PUSH",
")",
";",
"convertButton",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
")",
";",
"convertButton",
".",
"setText",
"(",
"\"Convert\"",
")",
";",
"convertButton",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"convertSelectedProjects",
"(",
"oldProjectsList",
".",
"getSelection",
"(",
")",
")",
";",
"populateProjectsList",
"(",
"oldProjectsList",
",",
"new",
"ConvertLegacyProject",
"(",
")",
".",
"getAllOldProjects",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"private",
"void",
"populateProjectsList",
"(",
"final",
"List",
"oldProjectsList",
",",
"final",
"IProject",
"[",
"]",
"oldProjects",
")",
"{",
"final",
"String",
"[",
"]",
"projNames",
"=",
"new",
"String",
"[",
"oldProjects",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"oldProjects",
".",
"length",
";",
"i",
"++",
")",
"{",
"projNames",
"[",
"i",
"]",
"=",
"oldProjects",
"[",
"i",
"]",
".",
"getName",
"(",
")",
";",
"}",
"oldProjectsList",
".",
"setItems",
"(",
"projNames",
")",
";",
"}",
"protected",
"void",
"convertSelectedProjects",
"(",
"String",
"[",
"]",
"selection",
")",
"{",
"if",
"(",
"selection",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
"IProject",
"[",
"]",
"toConvert",
"=",
"new",
"IProject",
"[",
"selection",
".",
"length",
"]",
";",
"IWorkspaceRoot",
"root",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"toConvert",
".",
"length",
";",
"i",
"++",
")",
"{",
"toConvert",
"[",
"i",
"]",
"=",
"root",
".",
"getProject",
"(",
"selection",
"[",
"i",
"]",
")",
";",
"}",
"try",
"{",
"new",
"ConvertLegacyProject",
"(",
")",
".",
"convertProjects",
"(",
"toConvert",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
")",
";",
"for",
"(",
"String",
"projName",
":",
"selection",
")",
"{",
"sb",
".",
"append",
"(",
"projName",
"+",
"\"n\"",
")",
";",
"}",
"MessageDialog",
".",
"openInformation",
"(",
"getShell",
"(",
")",
",",
"\"\"",
",",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"MessageDialog",
".",
"openError",
"(",
"getShell",
"(",
")",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"}",
"@",
"Override",
"protected",
"void",
"performDefaults",
"(",
")",
"{",
"super",
".",
"performDefaults",
"(",
")",
";",
"new",
"PreferenceInitializer",
"(",
")",
".",
"reset",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,387 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"regex",
".",
"Pattern",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"GroovyDebugOptionsEnforcer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaConventions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"IInputValidator",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"InputDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"BooleanFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"ListEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"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",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"PreferenceLinkArea",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"preferences",
".",
"IWorkbenchPreferenceContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"progress",
".",
"UIJob",
";",
"public",
"class",
"DebuggerPreferencesPage",
"extends",
"FieldEditorOverlayPage",
"implements",
"IWorkbenchPreferencePage",
"{",
"final",
"static",
"Pattern",
"packagePattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"\"",
")",
";",
"private",
"class",
"PackagePrefixValidator",
"implements",
"IInputValidator",
"{",
"public",
"String",
"isValid",
"(",
"String",
"newText",
")",
"{",
"if",
"(",
"newText",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"\"\"",
";",
"IStatus",
"s",
"=",
"JavaConventions",
".",
"validatePackageName",
"(",
"newText",
",",
"CompilerOptions",
".",
"VERSION_1_3",
",",
"CompilerOptions",
".",
"VERSION_1_3",
")",
";",
"if",
"(",
"s",
".",
"getSeverity",
"(",
")",
">",
"IStatus",
".",
"OK",
")",
"{",
"return",
"s",
".",
"getMessage",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"private",
"class",
"PackageChooserListEditor",
"extends",
"ListEditor",
"{",
"public",
"PackageChooserListEditor",
"(",
"String",
"name",
",",
"String",
"labelText",
",",
"Composite",
"parent",
")",
"{",
"super",
"(",
"name",
",",
"labelText",
",",
"parent",
")",
";",
"setPreferenceStore",
"(",
"DebuggerPreferencesPage",
".",
"this",
".",
"getPreferenceStore",
"(",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"String",
"createList",
"(",
"String",
"[",
"]",
"items",
")",
"{",
"if",
"(",
"items",
"!=",
"null",
"&&",
"items",
".",
"length",
">",
"0",
")",
"{",
"Arrays",
".",
"sort",
"(",
"items",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"items",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"\",\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"items",
"[",
"i",
"]",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"public",
"Composite",
"getButtonBoxControl",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"c",
"=",
"super",
".",
"getButtonBoxControl",
"(",
"parent",
")",
";",
"getUpButton",
"(",
")",
".",
"setVisible",
"(",
"false",
")",
";",
"getDownButton",
"(",
")",
".",
"setVisible",
"(",
"false",
")",
";",
"return",
"c",
";",
"}",
"@",
"Override",
"protected",
"String",
"getNewInputObject",
"(",
")",
"{",
"InputDialog",
"dialog",
"=",
"new",
"InputDialog",
"(",
"getFieldEditorParent",
"(",
")",
".",
"getShell",
"(",
")",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"new",
"PackagePrefixValidator",
"(",
")",
")",
";",
"int",
"res",
"=",
"dialog",
".",
"open",
"(",
")",
";",
"if",
"(",
"res",
"==",
"Window",
".",
"OK",
")",
"{",
"return",
"dialog",
".",
"getValue",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"@",
"Override",
"protected",
"String",
"[",
"]",
"parseString",
"(",
"String",
"stringList",
")",
"{",
"String",
"[",
"]",
"split",
"=",
"stringList",
".",
"split",
"(",
"\",\"",
")",
";",
"Arrays",
".",
"sort",
"(",
"split",
")",
";",
"return",
"split",
";",
"}",
"}",
"private",
"boolean",
"doForceOptions",
"=",
"false",
";",
"public",
"DebuggerPreferencesPage",
"(",
")",
"{",
"super",
"(",
"GRID",
")",
";",
"setPreferenceStore",
"(",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"String",
"getPageId",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"void",
"createFieldEditors",
"(",
")",
"{",
"addField",
"(",
"new",
"BooleanFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FILTER_STACK",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"addField",
"(",
"new",
"PackageChooserListEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FILTER_LIST",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"PreferenceLinkArea",
"area",
"=",
"new",
"PreferenceLinkArea",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"WRAP",
",",
"\"\"",
",",
"\"",
"nn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"(",
"IWorkbenchPreferenceContainer",
")",
"getContainer",
"(",
")",
",",
"null",
")",
";",
"GridData",
"data",
"=",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
";",
"area",
".",
"getControl",
"(",
")",
".",
"setLayoutData",
"(",
"data",
")",
";",
"new",
"Composite",
"(",
"getFieldEditorParent",
"(",
")",
",",
"0",
")",
";",
"Button",
"forceDebugOptions",
"=",
"new",
"Button",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"PUSH",
")",
";",
"forceDebugOptions",
".",
"setText",
"(",
"\"\"",
")",
";",
"forceDebugOptions",
".",
"addSelectionListener",
"(",
"new",
"SelectionListener",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"arg0",
")",
"{",
"doForceOptions",
"=",
"true",
";",
"new",
"GroovyDebugOptionsEnforcer",
"(",
")",
".",
"force",
"(",
")",
";",
"}",
"public",
"void",
"widgetDefaultSelected",
"(",
"SelectionEvent",
"arg0",
")",
"{",
"doForceOptions",
"=",
"true",
";",
"new",
"GroovyDebugOptionsEnforcer",
"(",
")",
".",
"force",
"(",
")",
";",
"}",
"}",
")",
";",
"new",
"Composite",
"(",
"getFieldEditorParent",
"(",
")",
",",
"0",
")",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbench",
"workbench",
")",
"{",
"}",
"@",
"Override",
"public",
"boolean",
"performOk",
"(",
")",
"{",
"if",
"(",
"doForceOptions",
")",
"{",
"UIJob",
"job",
"=",
"new",
"UIJob",
"(",
"this",
".",
"getShell",
"(",
")",
".",
"getDisplay",
"(",
")",
",",
"\"\"",
")",
"{",
"@",
"Override",
"public",
"IStatus",
"runInUIThread",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"new",
"GroovyDebugOptionsEnforcer",
"(",
")",
".",
"force",
"(",
")",
";",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"}",
";",
"job",
".",
"schedule",
"(",
")",
";",
"}",
"return",
"super",
".",
"performOk",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,388 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"Activator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPluginImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"BasicElementLabels",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"ImageDescriptorRegistry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"CheckedListDialogField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"DialogField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"IDialogFieldListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"IListAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"ListDialogField",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"InputDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"BooleanFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"FieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"ImageDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"JFaceResources",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"IPropertyChangeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"PropertyChangeEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"LabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ViewerComparator",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"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",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"public",
"class",
"ScriptFolderSelectorPreferences",
"{",
"private",
"static",
"final",
"ImageDescriptor",
"DESCRIPTOR",
"=",
"JavaPluginImages",
".",
"DESC_OBJS_INCLUSION_FILTER_ATTRIB",
";",
"private",
"static",
"final",
"int",
"IDX_ADD",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"IDX_EDIT",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"IDX_REMOVE",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"IDX_CHECKALL",
"=",
"3",
";",
"private",
"static",
"final",
"int",
"IDX_UNCHECKALL",
"=",
"4",
";",
"private",
"static",
"final",
"String",
"[",
"]",
"buttonLabels",
"=",
"{",
"\"Add\"",
",",
"\"Edit\"",
",",
"\"Remove\"",
",",
"\"Check",
"all\"",
",",
"\"Uncheck",
"all\"",
"}",
";",
"private",
"static",
"class",
"ScriptLabelProvider",
"extends",
"LabelProvider",
"{",
"private",
"Image",
"fElementImage",
";",
"public",
"ScriptLabelProvider",
"(",
"ImageDescriptor",
"descriptor",
")",
"{",
"ImageDescriptorRegistry",
"registry",
"=",
"JavaPlugin",
".",
"getImageDescriptorRegistry",
"(",
")",
";",
"fElementImage",
"=",
"registry",
".",
"get",
"(",
"descriptor",
")",
";",
"}",
"@",
"Override",
"public",
"Image",
"getImage",
"(",
"Object",
"element",
")",
"{",
"return",
"fElementImage",
";",
"}",
"@",
"Override",
"public",
"String",
"getText",
"(",
"Object",
"element",
")",
"{",
"return",
"BasicElementLabels",
".",
"getFilePattern",
"(",
"(",
"String",
")",
"element",
")",
";",
"}",
"}",
"private",
"class",
"ScriptPatternAdapter",
"implements",
"IListAdapter",
",",
"IDialogFieldListener",
"{",
"public",
"void",
"customButtonPressed",
"(",
"ListDialogField",
"field",
",",
"int",
"index",
")",
"{",
"doCustomButtonPressed",
"(",
"field",
",",
"index",
")",
";",
"}",
"public",
"void",
"selectionChanged",
"(",
"ListDialogField",
"field",
")",
"{",
"doSelectionChanged",
"(",
"field",
")",
";",
"}",
"public",
"void",
"doubleClicked",
"(",
"ListDialogField",
"field",
")",
"{",
"doDoubleClicked",
"(",
"field",
")",
";",
"}",
"public",
"void",
"dialogFieldChanged",
"(",
"DialogField",
"field",
")",
"{",
"}",
"}",
"private",
"final",
"Composite",
"parent",
";",
"private",
"CheckedListDialogField",
"patternList",
";",
"private",
"BooleanFieldEditor",
"disableButton",
";",
"private",
"final",
"IEclipsePreferences",
"preferences",
";",
"private",
"final",
"IPreferenceStore",
"store",
";",
"public",
"ScriptFolderSelectorPreferences",
"(",
"Composite",
"parent",
",",
"IEclipsePreferences",
"preferences",
",",
"IPreferenceStore",
"store",
")",
"{",
"this",
".",
"parent",
"=",
"parent",
";",
"this",
".",
"preferences",
"=",
"preferences",
";",
"this",
".",
"store",
"=",
"store",
";",
"}",
"public",
"ListDialogField",
"createListContents",
"(",
")",
"{",
"Label",
"label",
"=",
"new",
"Label",
"(",
"parent",
",",
"SWT",
".",
"WRAP",
")",
";",
"label",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"LEFT",
",",
"SWT",
".",
"TOP",
",",
"false",
",",
"false",
")",
")",
";",
"label",
".",
"setText",
"(",
"\"\"",
")",
";",
"label",
".",
"setFont",
"(",
"JFaceResources",
".",
"getFontRegistry",
"(",
")",
".",
"getBold",
"(",
"JFaceResources",
".",
"DIALOG_FONT",
")",
")",
";",
"Composite",
"inner",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"BORDER",
")",
";",
"inner",
".",
"setFont",
"(",
"parent",
".",
"getFont",
"(",
")",
")",
";",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
")",
";",
"layout",
".",
"marginHeight",
"=",
"3",
";",
"layout",
".",
"marginWidth",
"=",
"3",
";",
"layout",
".",
"numColumns",
"=",
"1",
";",
"inner",
".",
"setLayout",
"(",
"layout",
")",
";",
"inner",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
",",
"true",
",",
"false",
")",
")",
";",
"disableButton",
"=",
"new",
"BooleanFieldEditor",
"(",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"\"",
",",
"BooleanFieldEditor",
".",
"DEFAULT",
",",
"inner",
")",
";",
"disableButton",
".",
"setPreferenceStore",
"(",
"store",
")",
";",
"disableButton",
".",
"load",
"(",
")",
";",
"final",
"Composite",
"innerInner",
"=",
"new",
"Composite",
"(",
"inner",
",",
"SWT",
".",
"NONE",
")",
";",
"innerInner",
".",
"setFont",
"(",
"parent",
".",
"getFont",
"(",
")",
")",
";",
"layout",
"=",
"new",
"GridLayout",
"(",
")",
";",
"layout",
".",
"marginHeight",
"=",
"3",
";",
"layout",
".",
"marginWidth",
"=",
"3",
";",
"layout",
".",
"numColumns",
"=",
"3",
";",
"innerInner",
".",
"setLayout",
"(",
"layout",
")",
";",
"innerInner",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
",",
"true",
",",
"false",
")",
")",
";",
"innerInner",
".",
"setToolTipText",
"(",
"\"\"",
")",
";",
"boolean",
"enabled",
"=",
"disableButton",
".",
"getBooleanValue",
"(",
")",
";",
"innerInner",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"disableButton",
".",
"setPropertyChangeListener",
"(",
"new",
"IPropertyChangeListener",
"(",
")",
"{",
"public",
"void",
"propertyChange",
"(",
"PropertyChangeEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getProperty",
"(",
")",
"==",
"FieldEditor",
".",
"VALUE",
")",
"{",
"Object",
"o",
"=",
"event",
".",
"getNewValue",
"(",
")",
";",
"if",
"(",
"o",
"instanceof",
"Boolean",
")",
"{",
"boolean",
"enabled",
"=",
"(",
"(",
"Boolean",
")",
"o",
")",
";",
"innerInner",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"for",
"(",
"Control",
"c",
":",
"innerInner",
".",
"getChildren",
"(",
")",
")",
"{",
"c",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"}",
"}",
"}",
"}",
"}",
")",
";",
"ScriptPatternAdapter",
"adapter",
"=",
"new",
"ScriptPatternAdapter",
"(",
")",
";",
"patternList",
"=",
"new",
"CheckedListDialogField",
"(",
"adapter",
",",
"buttonLabels",
",",
"new",
"ScriptLabelProvider",
"(",
"DESCRIPTOR",
")",
")",
";",
"patternList",
".",
"setDialogFieldListener",
"(",
"adapter",
")",
";",
"patternList",
".",
"setLabelText",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"patternList",
".",
"setRemoveButtonIndex",
"(",
"IDX_REMOVE",
")",
";",
"patternList",
".",
"enableButton",
"(",
"IDX_EDIT",
",",
"false",
")",
";",
"patternList",
".",
"setCheckAllButtonIndex",
"(",
"IDX_CHECKALL",
")",
";",
"patternList",
".",
"setUncheckAllButtonIndex",
"(",
"IDX_UNCHECKALL",
")",
";",
"patternList",
".",
"doFillIntoGrid",
"(",
"innerInner",
",",
"3",
")",
";",
"Label",
"l",
"=",
"patternList",
".",
"getLabelControl",
"(",
"innerInner",
")",
";",
"GridData",
"gd",
"=",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"TOP",
",",
"true",
",",
"false",
")",
";",
"gd",
".",
"widthHint",
"=",
"200",
";",
"l",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"resetElements",
"(",
")",
";",
"patternList",
".",
"enableButton",
"(",
"IDX_ADD",
",",
"true",
")",
";",
"patternList",
".",
"setViewerComparator",
"(",
"new",
"ViewerComparator",
"(",
")",
")",
";",
"innerInner",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"for",
"(",
"Control",
"c",
":",
"innerInner",
".",
"getChildren",
"(",
")",
")",
"{",
"c",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"}",
"return",
"patternList",
";",
"}",
"private",
"List",
"<",
"String",
">",
"findPatterns",
"(",
")",
"{",
"return",
"Activator",
".",
"getDefault",
"(",
")",
".",
"getListStringPreference",
"(",
"preferences",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
")",
";",
"}",
"protected",
"void",
"doCustomButtonPressed",
"(",
"ListDialogField",
"field",
",",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"==",
"IDX_ADD",
")",
"{",
"addEntry",
"(",
"field",
")",
";",
"}",
"else",
"if",
"(",
"index",
"==",
"IDX_EDIT",
")",
"{",
"editEntry",
"(",
"field",
")",
";",
"}",
"}",
"protected",
"void",
"doSelectionChanged",
"(",
"ListDialogField",
"field",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"String",
">",
"selected",
"=",
"field",
".",
"getSelectedElements",
"(",
")",
";",
"field",
".",
"enableButton",
"(",
"IDX_EDIT",
",",
"canEdit",
"(",
"selected",
")",
")",
";",
"}",
"protected",
"void",
"doDoubleClicked",
"(",
"ListDialogField",
"field",
")",
"{",
"editEntry",
"(",
"field",
")",
";",
"}",
"private",
"boolean",
"canEdit",
"(",
"List",
"<",
"String",
">",
"selected",
")",
"{",
"return",
"selected",
".",
"size",
"(",
")",
"==",
"1",
";",
"}",
"private",
"void",
"addEntry",
"(",
"ListDialogField",
"field",
")",
"{",
"InputDialog",
"dialog",
"=",
"createInputDialog",
"(",
"\"\"",
")",
";",
"if",
"(",
"dialog",
".",
"open",
"(",
")",
"==",
"Window",
".",
"OK",
")",
"{",
"field",
".",
"addElement",
"(",
"dialog",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"private",
"InputDialog",
"createInputDialog",
"(",
"String",
"initial",
")",
"{",
"InputDialog",
"dialog",
"=",
"new",
"InputDialog",
"(",
"parent",
".",
"getShell",
"(",
")",
",",
"\"\"",
",",
"\"\"",
",",
"initial",
",",
"null",
")",
";",
"return",
"dialog",
";",
"}",
"private",
"void",
"editEntry",
"(",
"ListDialogField",
"field",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"String",
">",
"selElements",
"=",
"field",
".",
"getSelectedElements",
"(",
")",
";",
"if",
"(",
"selElements",
".",
"size",
"(",
")",
"!=",
"1",
")",
"{",
"return",
";",
"}",
"String",
"entry",
"=",
"(",
"String",
")",
"selElements",
".",
"get",
"(",
"0",
")",
";",
"InputDialog",
"dialog",
"=",
"createInputDialog",
"(",
"entry",
")",
";",
"if",
"(",
"dialog",
".",
"open",
"(",
")",
"==",
"Window",
".",
"OK",
")",
"{",
"field",
".",
"replaceElement",
"(",
"entry",
",",
"dialog",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"applyPreferences",
"(",
")",
"{",
"disableButton",
".",
"store",
"(",
")",
";",
"List",
"<",
"String",
">",
"elts",
"=",
"patternList",
".",
"getElements",
"(",
")",
";",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"elts",
".",
"size",
"(",
")",
"*",
"2",
")",
";",
"for",
"(",
"String",
"elt",
":",
"elts",
")",
"{",
"result",
".",
"add",
"(",
"elt",
")",
";",
"result",
".",
"add",
"(",
"patternList",
".",
"isChecked",
"(",
"elt",
")",
"?",
"\"y\"",
":",
"\"n\"",
")",
";",
"}",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"preferences",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"result",
")",
";",
"}",
"public",
"void",
"restoreDefaultsPressed",
"(",
")",
"{",
"disableButton",
".",
"loadDefault",
"(",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"preferences",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
")",
";",
"resetElements",
"(",
")",
";",
"}",
"private",
"void",
"resetElements",
"(",
")",
"{",
"List",
"<",
"String",
">",
"elements",
"=",
"findPatterns",
"(",
")",
";",
"List",
"<",
"String",
">",
"filteredElements",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"elements",
".",
"size",
"(",
")",
"/",
"2",
")",
";",
"List",
"<",
"String",
">",
"checkedElements",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"elements",
".",
"size",
"(",
")",
"/",
"2",
")",
";",
"for",
"(",
"Iterator",
"<",
"String",
">",
"eltIter",
"=",
"elements",
".",
"iterator",
"(",
")",
";",
"eltIter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"String",
"elt",
"=",
"eltIter",
".",
"next",
"(",
")",
";",
"filteredElements",
".",
"add",
"(",
"elt",
")",
";",
"if",
"(",
"eltIter",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"doCopy",
"=",
"eltIter",
".",
"next",
"(",
")",
";",
"if",
"(",
"doCopy",
".",
"equals",
"(",
"\"y\"",
")",
")",
"{",
"checkedElements",
".",
"add",
"(",
"elt",
")",
";",
"}",
"}",
"}",
"patternList",
".",
"setElements",
"(",
"filteredElements",
")",
";",
"patternList",
".",
"setCheckedElements",
"(",
"checkedElements",
")",
";",
"patternList",
".",
"selectFirstElement",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,389 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"AbstractPreferenceInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"Activator",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferenceConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"RGB",
";",
"public",
"class",
"PreferenceInitializer",
"extends",
"AbstractPreferenceInitializer",
"{",
"@",
"Override",
"public",
"void",
"initializeDefaultPreferences",
"(",
")",
"{",
"IPreferenceStore",
"store",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_LOG_TRACE_MESSAGES_ENABLED",
",",
"false",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
",",
"new",
"RGB",
"(",
"102",
",",
"204",
",",
"255",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
",",
"new",
"RGB",
"(",
"151",
",",
"44",
",",
"120",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GROOVYKEYWORDS_COLOR",
",",
"new",
"RGB",
"(",
"151",
",",
"44",
",",
"120",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
",",
"new",
"RGB",
"(",
"151",
",",
"44",
",",
"120",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
",",
"new",
"RGB",
"(",
"255",
",",
"0",
",",
"204",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
",",
"new",
"RGB",
"(",
"205",
",",
"50",
",",
"0",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
",",
"new",
"RGB",
"(",
"70",
",",
"70",
",",
"70",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
",",
"new",
"RGB",
"(",
"151",
",",
"44",
",",
"120",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
",",
"new",
"RGB",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
",",
"new",
"RGB",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"PreferenceConverter",
".",
"setDefault",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_DEFAULT_COLOR",
",",
"new",
"RGB",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GROOVYKEYWORDS_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_DEFAULT_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_SLASHY_STRINGS",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_JUNIT_MONOSPACE_FONT",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_ASK_TO_CONVERT_LEGACY_PROJECTS",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_SEMANTIC_HIGHLIGHTING",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_ASSIST_NOPARENS",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_ASSIST_BRACKETS",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_NAMED_ARGUMENTS",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_PARAMETER_GUESSING",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_DEFAULT_WORKING_DIRECTORY",
",",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_PROJECT_HOME",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FILTER_STACK",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FILTER_LIST",
",",
"\"\"",
")",
";",
"store",
".",
"setDefault",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FORCE_DEBUG_OPTIONS_ON_STARTUP",
",",
"true",
")",
";",
"store",
".",
"setDefault",
"(",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
")",
";",
"store",
".",
"setDefault",
"(",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"false",
")",
";",
"store",
".",
"setDefault",
"(",
"Activator",
".",
"GROOVY_CHECK_FOR_COMPILER_MISMATCH",
",",
"true",
")",
";",
"}",
"public",
"void",
"reset",
"(",
")",
"{",
"IPreferenceStore",
"store",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_LOG_TRACE_MESSAGES_ENABLED",
",",
"false",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
",",
"new",
"RGB",
"(",
"102",
",",
"204",
",",
"255",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
",",
"new",
"RGB",
"(",
"151",
",",
"44",
",",
"120",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GROOVYKEYWORDS_COLOR",
",",
"new",
"RGB",
"(",
"151",
",",
"44",
",",
"120",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
",",
"new",
"RGB",
"(",
"151",
",",
"44",
",",
"120",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
",",
"new",
"RGB",
"(",
"255",
",",
"0",
",",
"204",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
",",
"new",
"RGB",
"(",
"205",
",",
"50",
",",
"0",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
",",
"new",
"RGB",
"(",
"70",
",",
"70",
",",
"70",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
",",
"new",
"RGB",
"(",
"151",
",",
"44",
",",
"120",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
",",
"new",
"RGB",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
",",
"new",
"RGB",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"PreferenceConverter",
".",
"setValue",
"(",
"store",
",",
"PreferenceConstants",
".",
"GROOVY_EDITOR_DEFAULT_COLOR",
",",
"new",
"RGB",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GROOVYKEYWORDS_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_DEFAULT_COLOR",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_SLASHY_STRINGS",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_JUNIT_MONOSPACE_FONT",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_ASK_TO_CONVERT_LEGACY_PROJECTS",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_SEMANTIC_HIGHLIGHTING",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_ASSIST_NOPARENS",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_ASSIST_BRACKETS",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_NAMED_ARGUMENTS",
",",
"false",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_CONTENT_PARAMETER_GUESSING",
",",
"true",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_DEFAULT_WORKING_DIRECTORY",
",",
"\"proj_home\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"true\"",
")",
";",
"GroovyCoreActivator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"PreferenceConstants",
".",
"GROOVY_CLASSPATH_USE_GROOVY_LIB_GLOBAL",
",",
"true",
")",
";",
"}",
"}",
"</s>"
] |
6,390 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"BooleanFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"FieldEditorPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPreferencePage",
";",
"public",
"class",
"SaveActionsPreferencePage",
"extends",
"FieldEditorPreferencePage",
"implements",
"IWorkbenchPreferencePage",
"{",
"public",
"SaveActionsPreferencePage",
"(",
")",
"{",
"super",
"(",
"GRID",
")",
";",
"setPreferenceStore",
"(",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"createFieldEditors",
"(",
")",
"{",
"BooleanFieldEditor",
"semicolonOption",
"=",
"new",
"BooleanFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_SAVE_ACTION_REMOVE_UNNECESSARY_SEMICOLONS",
",",
"\"\"",
",",
"getFieldEditorParent",
"(",
")",
")",
";",
"addField",
"(",
"semicolonOption",
")",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbench",
"workbench",
")",
"{",
"}",
"}",
"</s>"
] |
6,391 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyColorManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"IJavaColorConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"BooleanFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"ColorFieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"FieldEditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferenceConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"RGB",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"FillLayout",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"PreferenceLinkArea",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"preferences",
".",
"IWorkbenchPreferenceContainer",
";",
"public",
"class",
"GroovyEditorPreferencesPage",
"extends",
"FieldEditorOverlayPage",
"implements",
"IWorkbenchPreferencePage",
"{",
"class",
"SpacerFieldEditor",
"extends",
"FieldEditor",
"{",
"private",
"Label",
"spacer",
";",
"public",
"SpacerFieldEditor",
"(",
"Composite",
"parent",
")",
"{",
"spacer",
"=",
"new",
"Label",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridData",
"gd",
"=",
"new",
"GridData",
"(",
")",
";",
"spacer",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"adjustForNumColumns",
"(",
"int",
"numColumns",
")",
"{",
"(",
"(",
"GridData",
")",
"spacer",
".",
"getLayoutData",
"(",
")",
")",
".",
"horizontalSpan",
"=",
"numColumns",
";",
"}",
"@",
"Override",
"protected",
"void",
"doFillIntoGrid",
"(",
"Composite",
"parent",
",",
"int",
"numColumns",
")",
"{",
"GridData",
"gd",
"=",
"new",
"GridData",
"(",
")",
";",
"gd",
".",
"horizontalSpan",
"=",
"numColumns",
";",
"spacer",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"doLoad",
"(",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"store",
"(",
")",
"{",
"}",
"@",
"Override",
"protected",
"void",
"doLoadDefault",
"(",
")",
"{",
"}",
"@",
"Override",
"protected",
"void",
"doStore",
"(",
")",
"{",
"}",
"@",
"Override",
"public",
"int",
"getNumberOfControls",
"(",
")",
"{",
"return",
"0",
";",
"}",
"}",
"public",
"GroovyEditorPreferencesPage",
"(",
")",
"{",
"super",
"(",
"GRID",
")",
";",
"setPreferenceStore",
"(",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"createFieldEditors",
"(",
")",
"{",
"final",
"ColorFieldEditor",
"gjdkEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GJDK_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"gKeywordEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_GROOVYKEYWORDS_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"javaTypesEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVATYPES_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"javaKeywordEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_JAVAKEYWORDS_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"stringEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_STRINGS_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"bracketEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_BRACKET_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"operatorEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_OPERATOR_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"annotationEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_ANNOTATION_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"returnEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_RETURN_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"numberEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_NUMBERS_COLOR",
",",
"\"\"",
")",
";",
"final",
"ColorFieldEditor",
"defaultEditor",
"=",
"createColorEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_DEFAULT_COLOR",
",",
"\"\"",
")",
";",
"Label",
"l",
"=",
"new",
"Label",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"NONE",
")",
";",
"l",
".",
"setText",
"(",
"\"\"",
")",
";",
"Composite",
"c",
"=",
"new",
"Composite",
"(",
"getFieldEditorParent",
"(",
")",
",",
"SWT",
".",
"NONE",
"|",
"SWT",
".",
"BORDER",
")",
";",
"GridData",
"gd",
"=",
"new",
"GridData",
"(",
")",
";",
"gd",
".",
"horizontalSpan",
"=",
"2",
";",
"c",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"c",
".",
"setLayout",
"(",
"new",
"FillLayout",
"(",
"SWT",
".",
"VERTICAL",
")",
")",
";",
"addField",
"(",
"new",
"BooleanFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_SEMANTIC_HIGHLIGHTING",
",",
"\"\"",
"+",
"\"\"",
",",
"c",
")",
")",
";",
"addField",
"(",
"new",
"BooleanFieldEditor",
"(",
"PreferenceConstants",
".",
"GROOVY_EDITOR_HIGHLIGHT_SLASHY_STRINGS",
",",
"\"\"",
",",
"c",
")",
")",
";",
"PreferenceLinkArea",
"area",
"=",
"new",
"PreferenceLinkArea",
"(",
"c",
",",
"SWT",
".",
"WRAP",
",",
"\"\"",
",",
"\"",
"nn\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"(",
"IWorkbenchPreferenceContainer",
")",
"getContainer",
"(",
")",
",",
"null",
")",
";",
"area",
".",
"getControl",
"(",
")",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"Composite",
"parent",
"=",
"getFieldEditorParent",
"(",
")",
";",
"Button",
"javaColorButton",
"=",
"new",
"Button",
"(",
"parent",
",",
"SWT",
".",
"BUTTON1",
")",
";",
"javaColorButton",
".",
"setText",
"(",
"Messages",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"javaColorButton",
".",
"addSelectionListener",
"(",
"new",
"SelectionListener",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"arg0",
")",
"{",
"IPreferenceStore",
"store",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"RGB",
"rgb",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"store",
",",
"IJavaColorConstants",
".",
"JAVA_KEYWORD",
")",
";",
"gjdkEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"gKeywordEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"javaTypesEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"javaKeywordEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"rgb",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"store",
",",
"IJavaColorConstants",
".",
"JAVA_STRING",
")",
";",
"stringEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"rgb",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"store",
",",
"IJavaColorConstants",
".",
"JAVA_BRACKET",
")",
";",
"bracketEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"rgb",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"store",
",",
"IJavaColorConstants",
".",
"JAVA_OPERATOR",
")",
";",
"operatorEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"rgb",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"store",
",",
"IJavaColorConstants",
".",
"JAVA_ANNOTATION",
")",
";",
"annotationEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"rgb",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"store",
",",
"IJavaColorConstants",
".",
"JAVA_KEYWORD_RETURN",
")",
";",
"returnEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"rgb",
"=",
"PreferenceConverter",
".",
"getColor",
"(",
"store",
",",
"IJavaColorConstants",
".",
"JAVA_DEFAULT",
")",
";",
"numberEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"defaultEditor",
".",
"getColorSelector",
"(",
")",
".",
"setColorValue",
"(",
"rgb",
")",
";",
"}",
"public",
"void",
"widgetDefaultSelected",
"(",
"SelectionEvent",
"arg0",
")",
"{",
"}",
"}",
")",
";",
"}",
"private",
"ColorFieldEditor",
"createColorEditor",
"(",
"String",
"preference",
",",
"String",
"nls",
")",
"{",
"Composite",
"parent",
"=",
"getFieldEditorParent",
"(",
")",
";",
"addField",
"(",
"new",
"SpacerFieldEditor",
"(",
"parent",
")",
")",
";",
"ColorFieldEditor",
"colorFieldEditor",
"=",
"new",
"ColorFieldEditor",
"(",
"preference",
",",
"Messages",
".",
"getString",
"(",
"nls",
")",
",",
"parent",
")",
";",
"addField",
"(",
"colorFieldEditor",
")",
";",
"addField",
"(",
"new",
"BooleanFieldEditor",
"(",
"preference",
"+",
"PreferenceConstants",
".",
"GROOVY_EDITOR_BOLD_SUFFIX",
",",
"\"make",
"bold\"",
",",
"BooleanFieldEditor",
".",
"SEPARATE_LABEL",
",",
"getFieldEditorParent",
"(",
")",
")",
")",
";",
"return",
"colorFieldEditor",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbench",
"workbench",
")",
"{",
"}",
"@",
"Override",
"protected",
"String",
"getPageId",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"public",
"boolean",
"performOk",
"(",
")",
"{",
"boolean",
"success",
"=",
"super",
".",
"performOk",
"(",
")",
";",
"if",
"(",
"success",
")",
"{",
"GroovyColorManager",
"colorManager",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getTextTools",
"(",
")",
".",
"getColorManager",
"(",
")",
";",
"colorManager",
".",
"uninitialize",
"(",
")",
";",
"colorManager",
".",
"initialize",
"(",
")",
";",
"}",
"return",
"success",
";",
"}",
"}",
"</s>"
] |
6,392 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"search",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"search",
".",
"SyntheticAccessorSearchRequestor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"FieldDeclarationMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"FieldReferenceMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"LocalVariableDeclarationMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"LocalVariableReferenceMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"MethodReferenceMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchParticipant",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"JavaSearchParticipant",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"search",
".",
"JavaElementMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaElementLabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"search",
".",
"ElementQuerySpecification",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"search",
".",
"IMatchPresentation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"search",
".",
"IQueryParticipant",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"search",
".",
"ISearchRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"search",
".",
"QuerySpecification",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ILabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"search",
".",
"ui",
".",
"text",
".",
"Match",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PartInitException",
";",
"public",
"class",
"SyntheticAccessorQueryParticipant",
"implements",
"IQueryParticipant",
"{",
"class",
"UISearchRequestor",
"implements",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"search",
".",
"ISearchRequestor",
"{",
"private",
"final",
"ISearchRequestor",
"requestor",
";",
"private",
"final",
"boolean",
"targetIsGroovy",
";",
"public",
"UISearchRequestor",
"(",
"ISearchRequestor",
"requestor",
",",
"boolean",
"targetIsGroovy",
")",
"{",
"this",
".",
"requestor",
"=",
"requestor",
";",
"this",
".",
"targetIsGroovy",
"=",
"targetIsGroovy",
";",
"}",
"public",
"void",
"acceptMatch",
"(",
"SearchMatch",
"match",
")",
"{",
"IJavaElement",
"enclosingElement",
"=",
"(",
"IJavaElement",
")",
"match",
".",
"getElement",
"(",
")",
";",
"if",
"(",
"enclosingElement",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"enclosingElement",
".",
"getOpenable",
"(",
")",
"instanceof",
"GroovyCompilationUnit",
")",
"&&",
"!",
"targetIsGroovy",
")",
"{",
"return",
";",
"}",
"boolean",
"isWriteAccess",
"=",
"false",
";",
"boolean",
"isReadAccess",
"=",
"false",
";",
"if",
"(",
"match",
"instanceof",
"FieldReferenceMatch",
")",
"{",
"FieldReferenceMatch",
"fieldRef",
"=",
"(",
"(",
"FieldReferenceMatch",
")",
"match",
")",
";",
"isWriteAccess",
"=",
"fieldRef",
".",
"isWriteAccess",
"(",
")",
";",
"isReadAccess",
"=",
"fieldRef",
".",
"isReadAccess",
"(",
")",
";",
"}",
"else",
"if",
"(",
"match",
"instanceof",
"FieldDeclarationMatch",
")",
"{",
"isWriteAccess",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"match",
"instanceof",
"LocalVariableReferenceMatch",
")",
"{",
"LocalVariableReferenceMatch",
"localVarRef",
"=",
"(",
"(",
"LocalVariableReferenceMatch",
")",
"match",
")",
";",
"isWriteAccess",
"=",
"localVarRef",
".",
"isWriteAccess",
"(",
")",
";",
"isReadAccess",
"=",
"localVarRef",
".",
"isReadAccess",
"(",
")",
";",
"}",
"else",
"if",
"(",
"match",
"instanceof",
"LocalVariableDeclarationMatch",
")",
"{",
"isWriteAccess",
"=",
"true",
";",
"}",
"boolean",
"isSuperInvocation",
"=",
"false",
";",
"if",
"(",
"match",
"instanceof",
"MethodReferenceMatch",
")",
"{",
"MethodReferenceMatch",
"methodRef",
"=",
"(",
"MethodReferenceMatch",
")",
"match",
";",
"isSuperInvocation",
"=",
"methodRef",
".",
"isSuperInvocation",
"(",
")",
";",
"}",
"requestor",
".",
"reportMatch",
"(",
"createJavaElementMatch",
"(",
"enclosingElement",
",",
"match",
".",
"getRule",
"(",
")",
",",
"match",
".",
"getOffset",
"(",
")",
",",
"match",
".",
"getLength",
"(",
")",
",",
"match",
".",
"getAccuracy",
"(",
")",
",",
"isReadAccess",
",",
"isWriteAccess",
",",
"match",
".",
"isInsideDocComment",
"(",
")",
",",
"isSuperInvocation",
")",
")",
";",
"}",
"}",
"private",
"Match",
"createJavaElementMatch",
"(",
"IJavaElement",
"enclosingElement",
",",
"int",
"rule",
",",
"int",
"offset",
",",
"int",
"length",
",",
"int",
"accuracy",
",",
"boolean",
"isReadAccess",
",",
"boolean",
"isWriteAccess",
",",
"boolean",
"insideDocComment",
",",
"boolean",
"isSuperInvocation",
")",
"{",
"return",
"ReflectionUtils",
".",
"executePrivateConstructor",
"(",
"JavaElementMatch",
".",
"class",
",",
"new",
"Class",
"<",
"?",
">",
"[",
"]",
"{",
"Object",
".",
"class",
",",
"int",
".",
"class",
",",
"int",
".",
"class",
",",
"int",
".",
"class",
",",
"int",
".",
"class",
",",
"boolean",
".",
"class",
",",
"boolean",
".",
"class",
",",
"boolean",
".",
"class",
",",
"boolean",
".",
"class",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"enclosingElement",
",",
"rule",
",",
"offset",
",",
"length",
",",
"accuracy",
",",
"isReadAccess",
",",
"isWriteAccess",
",",
"insideDocComment",
",",
"isSuperInvocation",
"}",
")",
";",
"}",
"}",
"SyntheticAccessorSearchRequestor",
"accessorRequestor",
";",
"public",
"void",
"search",
"(",
"ISearchRequestor",
"requestor",
",",
"QuerySpecification",
"querySpecification",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"querySpecification",
"instanceof",
"ElementQuerySpecification",
")",
"{",
"accessorRequestor",
"=",
"new",
"SyntheticAccessorSearchRequestor",
"(",
")",
";",
"IJavaElement",
"element",
"=",
"(",
"(",
"ElementQuerySpecification",
")",
"querySpecification",
")",
".",
"getElement",
"(",
")",
";",
"accessorRequestor",
".",
"findSyntheticMatches",
"(",
"element",
",",
"querySpecification",
".",
"getLimitTo",
"(",
")",
",",
"getSearchParticipants",
"(",
")",
",",
"querySpecification",
".",
"getScope",
"(",
")",
",",
"new",
"UISearchRequestor",
"(",
"requestor",
",",
"element",
".",
"getOpenable",
"(",
")",
"instanceof",
"GroovyCompilationUnit",
")",
",",
"monitor",
")",
";",
"}",
"}",
"private",
"SearchParticipant",
"[",
"]",
"getSearchParticipants",
"(",
")",
"{",
"return",
"new",
"SearchParticipant",
"[",
"]",
"{",
"new",
"JavaSearchParticipant",
"(",
")",
"}",
";",
"}",
"public",
"int",
"estimateTicks",
"(",
"QuerySpecification",
"specification",
")",
"{",
"if",
"(",
"!",
"(",
"specification",
"instanceof",
"ElementQuerySpecification",
")",
")",
"{",
"return",
"0",
";",
"}",
"return",
"3",
";",
"}",
"public",
"IMatchPresentation",
"getUIParticipant",
"(",
")",
"{",
"return",
"new",
"IMatchPresentation",
"(",
")",
"{",
"public",
"ILabelProvider",
"createLabelProvider",
"(",
")",
"{",
"return",
"new",
"JavaElementLabelProvider",
"(",
")",
";",
"}",
"public",
"void",
"showMatch",
"(",
"Match",
"match",
",",
"int",
"currentOffset",
",",
"int",
"currentLength",
",",
"boolean",
"activate",
")",
"throws",
"PartInitException",
"{",
"}",
"}",
";",
"}",
"}",
"</s>"
] |
6,393 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"search",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotatedNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Parameter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"PropertyNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Variable",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BinaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClosureExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"DeclarationExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"StaticMethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codebrowsing",
".",
"requestor",
".",
"CodeSelectHelper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"search",
".",
"FindAllReferencesRequestor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorWithRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"search",
".",
"IOccurrencesFinder",
";",
"public",
"class",
"GroovyOccurrencesFinder",
"implements",
"IOccurrencesFinder",
"{",
"public",
"static",
"final",
"String",
"ID",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"IS_WRITEACCESS",
"=",
"\"writeAccess\"",
";",
"public",
"static",
"final",
"String",
"IS_VARIABLE",
"=",
"\"variable\"",
";",
"private",
"GroovyCompilationUnit",
"gunit",
";",
"private",
"CompilationUnit",
"cunit",
";",
"private",
"AnnotatedNode",
"nodeToLookFor",
";",
"private",
"String",
"elementName",
";",
"public",
"CompilationUnit",
"getASTRoot",
"(",
")",
"{",
"return",
"cunit",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"if",
"(",
"elementName",
"==",
"null",
")",
"{",
"elementName",
"=",
"internalGetElementName",
"(",
")",
";",
"}",
"return",
"elementName",
";",
"}",
"private",
"String",
"internalGetElementName",
"(",
")",
"{",
"if",
"(",
"nodeToLookFor",
"instanceof",
"ClassNode",
")",
"{",
"String",
"name",
"=",
"(",
"(",
"ClassNode",
")",
"nodeToLookFor",
")",
".",
"getNameWithoutPackage",
"(",
")",
";",
"int",
"lastDollar",
"=",
"name",
".",
"lastIndexOf",
"(",
"'$'",
")",
";",
"return",
"name",
".",
"substring",
"(",
"lastDollar",
"+",
"1",
")",
";",
"}",
"else",
"if",
"(",
"nodeToLookFor",
"instanceof",
"MethodNode",
")",
"{",
"return",
"(",
"(",
"MethodNode",
")",
"nodeToLookFor",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"nodeToLookFor",
"instanceof",
"FieldNode",
")",
"{",
"return",
"(",
"(",
"FieldNode",
")",
"nodeToLookFor",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"nodeToLookFor",
"instanceof",
"Variable",
")",
"{",
"return",
"(",
"(",
"Variable",
")",
"nodeToLookFor",
")",
".",
"getName",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"String",
"getID",
"(",
")",
"{",
"return",
"ID",
";",
"}",
"public",
"String",
"getJobLabel",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"OccurrenceLocation",
"[",
"]",
"getOccurrences",
"(",
")",
"{",
"Map",
"<",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
",",
"Integer",
">",
"occurences",
"=",
"internalFindOccurences",
"(",
")",
";",
"OccurrenceLocation",
"[",
"]",
"locations",
"=",
"new",
"OccurrenceLocation",
"[",
"occurences",
".",
"size",
"(",
")",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Entry",
"<",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
",",
"Integer",
">",
"entry",
":",
"occurences",
".",
"entrySet",
"(",
")",
")",
"{",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
"node",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"int",
"flag",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"OccurrenceLocation",
"occurrenceLocation",
";",
"if",
"(",
"node",
"instanceof",
"FieldNode",
")",
"{",
"FieldNode",
"c",
"=",
"(",
"FieldNode",
")",
"node",
";",
"occurrenceLocation",
"=",
"new",
"OccurrenceLocation",
"(",
"c",
".",
"getNameStart",
"(",
")",
",",
"c",
".",
"getNameEnd",
"(",
")",
"-",
"c",
".",
"getNameStart",
"(",
")",
"+",
"1",
",",
"flag",
",",
"\"\"",
"+",
"getElementName",
"(",
")",
"+",
"\"''\"",
")",
";",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"MethodNode",
")",
"{",
"MethodNode",
"c",
"=",
"(",
"MethodNode",
")",
"node",
";",
"occurrenceLocation",
"=",
"new",
"OccurrenceLocation",
"(",
"c",
".",
"getNameStart",
"(",
")",
",",
"c",
".",
"getNameEnd",
"(",
")",
"-",
"c",
".",
"getNameStart",
"(",
")",
"+",
"1",
",",
"flag",
",",
"\"\"",
"+",
"getElementName",
"(",
")",
"+",
"\"''\"",
")",
";",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"Parameter",
")",
"{",
"Parameter",
"c",
"=",
"(",
"Parameter",
")",
"node",
";",
"int",
"start",
"=",
"c",
".",
"getNameStart",
"(",
")",
";",
"int",
"length",
"=",
"c",
".",
"getNameEnd",
"(",
")",
"-",
"c",
".",
"getNameStart",
"(",
")",
";",
"occurrenceLocation",
"=",
"new",
"OccurrenceLocation",
"(",
"start",
",",
"length",
",",
"flag",
",",
"\"\"",
"+",
"getElementName",
"(",
")",
"+",
"\"''\"",
")",
";",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"ClassNode",
"&&",
"(",
"(",
"ClassNode",
")",
"node",
")",
".",
"getNameEnd",
"(",
")",
">",
"0",
")",
"{",
"ClassNode",
"c",
"=",
"(",
"ClassNode",
")",
"node",
";",
"occurrenceLocation",
"=",
"new",
"OccurrenceLocation",
"(",
"c",
".",
"getNameStart",
"(",
")",
",",
"c",
".",
"getNameEnd",
"(",
")",
"-",
"c",
".",
"getNameStart",
"(",
")",
"+",
"1",
",",
"flag",
",",
"\"\"",
"+",
"getElementName",
"(",
")",
"+",
"\"''\"",
")",
";",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"StaticMethodCallExpression",
")",
"{",
"StaticMethodCallExpression",
"smce",
"=",
"(",
"StaticMethodCallExpression",
")",
"node",
";",
"occurrenceLocation",
"=",
"new",
"OccurrenceLocation",
"(",
"smce",
".",
"getStart",
"(",
")",
",",
"Math",
".",
"min",
"(",
"smce",
".",
"getLength",
"(",
")",
",",
"smce",
".",
"getMethod",
"(",
")",
".",
"length",
"(",
")",
")",
",",
"flag",
",",
"\"\"",
"+",
"getElementName",
"(",
")",
"+",
"\"''\"",
")",
";",
"}",
"else",
"{",
"SourceRange",
"range",
"=",
"getSourceRange",
"(",
"node",
")",
";",
"occurrenceLocation",
"=",
"new",
"OccurrenceLocation",
"(",
"range",
".",
"getOffset",
"(",
")",
",",
"range",
".",
"getLength",
"(",
")",
",",
"flag",
",",
"\"\"",
"+",
"getElementName",
"(",
")",
"+",
"\"''\"",
")",
";",
"}",
"locations",
"[",
"i",
"++",
"]",
"=",
"occurrenceLocation",
";",
"}",
"return",
"locations",
";",
"}",
"private",
"SourceRange",
"getSourceRange",
"(",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
"node",
")",
"{",
"if",
"(",
"node",
"instanceof",
"ClassNode",
")",
"{",
"String",
"semiQualifiedName",
"=",
"(",
"(",
"ClassNode",
")",
"node",
")",
".",
"getNameWithoutPackage",
"(",
")",
";",
"if",
"(",
"semiQualifiedName",
".",
"contains",
"(",
"\"$\"",
")",
")",
"{",
"String",
"name",
"=",
"getElementName",
"(",
")",
";",
"if",
"(",
"name",
".",
"length",
"(",
")",
"<",
"node",
".",
"getLength",
"(",
")",
"-",
"1",
")",
"{",
"int",
"simpleNameStart",
"=",
"semiQualifiedName",
".",
"indexOf",
"(",
"name",
")",
";",
"if",
"(",
"simpleNameStart",
">=",
"0",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"node",
".",
"getStart",
"(",
")",
"+",
"simpleNameStart",
",",
"name",
".",
"length",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"return",
"new",
"SourceRange",
"(",
"node",
".",
"getStart",
"(",
")",
",",
"node",
".",
"getLength",
"(",
")",
")",
";",
"}",
"private",
"Map",
"<",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
",",
"Integer",
">",
"internalFindOccurences",
"(",
")",
"{",
"if",
"(",
"nodeToLookFor",
"!=",
"null",
"&&",
"!",
"(",
"nodeToLookFor",
"instanceof",
"ConstantExpression",
")",
"&&",
"!",
"(",
"nodeToLookFor",
"instanceof",
"ClosureExpression",
")",
"&&",
"!",
"(",
"nodeToLookFor",
"instanceof",
"DeclarationExpression",
")",
"&&",
"!",
"(",
"nodeToLookFor",
"instanceof",
"BinaryExpression",
")",
"&&",
"!",
"(",
"nodeToLookFor",
"instanceof",
"MethodCallExpression",
")",
")",
"{",
"FindAllReferencesRequestor",
"requestor",
"=",
"new",
"FindAllReferencesRequestor",
"(",
"nodeToLookFor",
")",
";",
"TypeInferencingVisitorWithRequestor",
"visitor",
"=",
"new",
"TypeInferencingVisitorFactory",
"(",
")",
".",
"createVisitor",
"(",
"gunit",
")",
";",
"visitor",
".",
"visitCompilationUnit",
"(",
"requestor",
")",
";",
"Map",
"<",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
",",
"Integer",
">",
"occurences",
"=",
"requestor",
".",
"getReferences",
"(",
")",
";",
"return",
"occurences",
";",
"}",
"else",
"{",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"}",
"}",
"public",
"int",
"getSearchKind",
"(",
")",
"{",
"return",
"K_OCCURRENCE",
";",
"}",
"public",
"String",
"getUnformattedPluralLabel",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"String",
"getUnformattedSingularLabel",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"String",
"initialize",
"(",
"CompilationUnit",
"root",
",",
"ASTNode",
"node",
")",
"{",
"return",
"initialize",
"(",
"root",
",",
"node",
".",
"getStartPosition",
"(",
")",
",",
"node",
".",
"getLength",
"(",
")",
")",
";",
"}",
"public",
"String",
"initialize",
"(",
"CompilationUnit",
"root",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"cunit",
"=",
"root",
";",
"if",
"(",
"gunit",
"==",
"null",
")",
"{",
"ITypeRoot",
"typeRoot",
"=",
"cunit",
".",
"getTypeRoot",
"(",
")",
";",
"if",
"(",
"!",
"(",
"typeRoot",
"instanceof",
"GroovyCompilationUnit",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"gunit",
"=",
"(",
"GroovyCompilationUnit",
")",
"typeRoot",
";",
"}",
"ModuleNode",
"moduleNode",
"=",
"gunit",
".",
"getModuleNode",
"(",
")",
";",
"if",
"(",
"moduleNode",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"CodeSelectHelper",
"helper",
"=",
"new",
"CodeSelectHelper",
"(",
")",
";",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
"node",
"=",
"helper",
".",
"selectASTNode",
"(",
"gunit",
",",
"offset",
",",
"length",
")",
";",
"if",
"(",
"!",
"(",
"node",
"instanceof",
"AnnotatedNode",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"node",
"instanceof",
"PropertyNode",
")",
"{",
"PropertyNode",
"property",
"=",
"(",
"PropertyNode",
")",
"node",
";",
"node",
"=",
"property",
".",
"getField",
"(",
")",
";",
"}",
"nodeToLookFor",
"=",
"(",
"AnnotatedNode",
")",
"node",
";",
"return",
"null",
";",
"}",
"public",
"void",
"setGroovyCompilationUnit",
"(",
"GroovyCompilationUnit",
"gunit",
")",
"{",
"this",
".",
"gunit",
"=",
"gunit",
";",
"}",
"public",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
"getNodeToLookFor",
"(",
")",
"{",
"return",
"nodeToLookFor",
";",
"}",
"}",
"</s>"
] |
6,394 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"codeassist",
".",
"relevance",
".",
"RelevanceRules",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"GroovyQuickFixPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"OrganizeGroovyImports",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"OrganizeGroovyImports",
".",
"UnresolvedTypeData",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"refactoring",
".",
"actions",
".",
"TypeSearch",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"TypeNameMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"IJavaCompletionProposal",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"public",
"class",
"AddMissingGroovyImportsResolver",
"extends",
"AbstractQuickFixResolver",
"{",
"public",
"AddMissingGroovyImportsResolver",
"(",
"QuickFixProblemContext",
"problem",
")",
"{",
"super",
"(",
"problem",
")",
";",
"}",
"public",
"static",
"class",
"AddMissingImportProposal",
"extends",
"AbstractGroovyQuickFixProposal",
"{",
"private",
"IType",
"resolvedSuggestedType",
";",
"private",
"GroovyCompilationUnit",
"unit",
";",
"public",
"AddMissingImportProposal",
"(",
"IType",
"resolvedSuggestedType",
",",
"GroovyCompilationUnit",
"unit",
",",
"QuickFixProblemContext",
"problem",
",",
"int",
"relevance",
")",
"{",
"super",
"(",
"problem",
",",
"relevance",
")",
";",
"this",
".",
"resolvedSuggestedType",
"=",
"resolvedSuggestedType",
";",
"this",
".",
"unit",
"=",
"unit",
";",
"}",
"public",
"IType",
"getSuggestedJavaType",
"(",
")",
"{",
"return",
"resolvedSuggestedType",
";",
"}",
"protected",
"String",
"getImageBundleLocation",
"(",
")",
"{",
"return",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPluginImages",
".",
"IMG_OBJS_IMPDECL",
";",
"}",
"protected",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ImportRewrite",
"getImportRewrite",
"(",
")",
"{",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ImportRewrite",
"rewriter",
"=",
"null",
";",
"try",
"{",
"rewriter",
"=",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ImportRewrite",
".",
"create",
"(",
"unit",
",",
"true",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyQuickFixPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"return",
"rewriter",
";",
"}",
"public",
"void",
"apply",
"(",
"IDocument",
"document",
")",
"{",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ImportRewrite",
"rewrite",
"=",
"getImportRewrite",
"(",
")",
";",
"if",
"(",
"rewrite",
"!=",
"null",
")",
"{",
"rewrite",
".",
"addImport",
"(",
"getSuggestedJavaType",
"(",
")",
".",
"getFullyQualifiedName",
"(",
"'.'",
")",
")",
";",
"try",
"{",
"TextEdit",
"edit",
"=",
"rewrite",
".",
"rewriteImports",
"(",
"null",
")",
";",
"if",
"(",
"edit",
"!=",
"null",
")",
"{",
"unit",
".",
"applyTextEdit",
"(",
"edit",
",",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyQuickFixPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyQuickFixPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"}",
"public",
"String",
"getDisplayString",
"(",
")",
"{",
"IType",
"declaringType",
"=",
"getSuggestedJavaType",
"(",
")",
".",
"getDeclaringType",
"(",
")",
";",
"String",
"declaration",
"=",
"declaringType",
"!=",
"null",
"?",
"declaringType",
".",
"getFullyQualifiedName",
"(",
")",
".",
"replace",
"(",
"'$'",
",",
"'.'",
")",
":",
"getSuggestedJavaType",
"(",
")",
".",
"getPackageFragment",
"(",
")",
".",
"getElementName",
"(",
")",
";",
"return",
"\"Import",
"'\"",
"+",
"getSuggestedJavaType",
"(",
")",
".",
"getElementName",
"(",
")",
"+",
"\"'",
"(\"",
"+",
"declaration",
"+",
"\")\"",
";",
"}",
"}",
"protected",
"ProblemType",
"[",
"]",
"getTypes",
"(",
")",
"{",
"return",
"new",
"ProblemType",
"[",
"]",
"{",
"ProblemType",
".",
"MISSING_IMPORTS_TYPE",
"}",
";",
"}",
"protected",
"List",
"<",
"IType",
">",
"getImportTypeSuggestions",
"(",
")",
"{",
"int",
"offset",
"=",
"getQuickFixProblem",
"(",
")",
".",
"getOffset",
"(",
")",
";",
"try",
"{",
"String",
"simpleTypeName",
"=",
"getUnresolvedSimpleName",
"(",
")",
";",
"if",
"(",
"simpleTypeName",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"OrganizeGroovyImports",
".",
"UnresolvedTypeData",
">",
"unresolvedTypes",
"=",
"new",
"HashMap",
"<",
"String",
",",
"OrganizeGroovyImports",
".",
"UnresolvedTypeData",
">",
"(",
")",
";",
"unresolvedTypes",
".",
"put",
"(",
"simpleTypeName",
",",
"new",
"UnresolvedTypeData",
"(",
"simpleTypeName",
",",
"false",
",",
"new",
"SourceRange",
"(",
"offset",
",",
"simpleTypeName",
".",
"length",
"(",
")",
")",
")",
")",
";",
"new",
"TypeSearch",
"(",
")",
".",
"searchForTypes",
"(",
"getGroovyCompilationUnit",
"(",
")",
",",
"unresolvedTypes",
")",
";",
"UnresolvedTypeData",
"foundData",
"=",
"unresolvedTypes",
".",
"get",
"(",
"simpleTypeName",
")",
";",
"List",
"<",
"TypeNameMatch",
">",
"matches",
"=",
"foundData",
".",
"getFoundInfos",
"(",
")",
";",
"if",
"(",
"matches",
"!=",
"null",
")",
"{",
"List",
"<",
"IType",
">",
"suggestions",
"=",
"new",
"ArrayList",
"<",
"IType",
">",
"(",
")",
";",
"for",
"(",
"TypeNameMatch",
"match",
":",
"matches",
")",
"{",
"suggestions",
".",
"add",
"(",
"match",
".",
"getType",
"(",
")",
")",
";",
"}",
"return",
"suggestions",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyQuickFixPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"String",
"getUnresolvedSimpleName",
"(",
")",
"{",
"String",
"[",
"]",
"messages",
"=",
"getQuickFixProblem",
"(",
")",
".",
"getProblemDescriptor",
"(",
")",
".",
"getMarkerMessages",
"(",
")",
";",
"if",
"(",
"messages",
"==",
"null",
"||",
"messages",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"StringBuffer",
"errorMessage",
"=",
"new",
"StringBuffer",
"(",
"messages",
"[",
"0",
"]",
")",
";",
"int",
"prefixIndex",
"=",
"errorMessage",
".",
"indexOf",
"(",
"ProblemType",
".",
"MISSING_IMPORTS_TYPE",
".",
"groovyProblemSnippets",
"[",
"0",
"]",
")",
";",
"if",
"(",
"prefixIndex",
">=",
"0",
")",
"{",
"errorMessage",
".",
"delete",
"(",
"prefixIndex",
",",
"prefixIndex",
"+",
"ProblemType",
".",
"MISSING_IMPORTS_TYPE",
".",
"groovyProblemSnippets",
"[",
"0",
"]",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
";",
"errorMessage",
".",
"length",
"(",
")",
">",
"0",
";",
")",
"{",
"if",
"(",
"Character",
".",
"isWhitespace",
"(",
"errorMessage",
".",
"charAt",
"(",
"0",
")",
")",
")",
"{",
"errorMessage",
".",
"deleteCharAt",
"(",
"0",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"for",
"(",
";",
"errorMessage",
".",
"length",
"(",
")",
">",
"0",
";",
")",
"{",
"int",
"lastIndex",
"=",
"errorMessage",
".",
"length",
"(",
")",
"-",
"1",
";",
"if",
"(",
"Character",
".",
"isWhitespace",
"(",
"errorMessage",
".",
"charAt",
"(",
"lastIndex",
")",
")",
")",
"{",
"errorMessage",
".",
"deleteCharAt",
"(",
"lastIndex",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"return",
"getTopLevelType",
"(",
"errorMessage",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"static",
"String",
"getTopLevelType",
"(",
"String",
"simpleName",
")",
"{",
"int",
"firstIndex",
"=",
"simpleName",
"!=",
"null",
"?",
"simpleName",
".",
"indexOf",
"(",
"'.'",
")",
":",
"-",
"1",
";",
"if",
"(",
"firstIndex",
">=",
"0",
")",
"{",
"simpleName",
"=",
"simpleName",
".",
"substring",
"(",
"0",
",",
"firstIndex",
")",
";",
"}",
"return",
"simpleName",
";",
"}",
"public",
"List",
"<",
"IJavaCompletionProposal",
">",
"getQuickFixProposals",
"(",
")",
"{",
"List",
"<",
"IType",
">",
"suggestions",
"=",
"getImportTypeSuggestions",
"(",
")",
";",
"if",
"(",
"suggestions",
"!=",
"null",
")",
"{",
"List",
"<",
"IJavaCompletionProposal",
">",
"fixes",
"=",
"new",
"ArrayList",
"<",
"IJavaCompletionProposal",
">",
"(",
")",
";",
"for",
"(",
"IType",
"type",
":",
"suggestions",
")",
"{",
"int",
"revelance",
"=",
"getRelevance",
"(",
"type",
")",
";",
"fixes",
".",
"add",
"(",
"new",
"AddMissingImportProposal",
"(",
"type",
",",
"getGroovyCompilationUnit",
"(",
")",
",",
"getQuickFixProblem",
"(",
")",
",",
"revelance",
")",
")",
";",
"}",
"return",
"fixes",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"GroovyCompilationUnit",
"getGroovyCompilationUnit",
"(",
")",
"{",
"return",
"(",
"GroovyCompilationUnit",
")",
"getQuickFixProblem",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"}",
"protected",
"int",
"getRelevance",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"return",
"RelevanceRules",
".",
"ALL_RULES",
".",
"getRelevance",
"(",
"type",
",",
"getContextTypes",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,395 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"IProblem",
";",
"public",
"enum",
"ProblemType",
"{",
"MISSING_SEMI_COLON_TYPE",
"(",
"IProblem",
".",
"ParsingErrorInsertToComplete",
",",
"(",
"String",
"[",
"]",
")",
"null",
")",
",",
"MISSING_SEMI_COLON_TYPE_VARIANT",
"(",
"IProblem",
".",
"ParsingErrorInsertTokenAfter",
",",
"(",
"String",
"[",
"]",
")",
"null",
")",
",",
"MISSING_IMPORTS_TYPE",
"(",
"\"\"",
")",
",",
"UNIMPLEMENTED_METHODS_TYPE",
"(",
"\"\"",
")",
",",
"MISSING_CLASSPATH_CONTAINER_TYPE",
"(",
"IProblem",
".",
"IsClassPathCorrect",
",",
"\"\"",
",",
"\"\"",
")",
";",
"public",
"final",
"String",
"markerType",
";",
"public",
"final",
"int",
"problemId",
";",
"public",
"final",
"String",
"groovyProblemSnippets",
"[",
"]",
";",
"public",
"static",
"final",
"int",
"GROOVY_PROBLEM_ID",
"=",
"0",
";",
"private",
"ProblemType",
"(",
"String",
"...",
"groovyProblemSnippets",
")",
"{",
"this",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"GROOVY_PROBLEM_ID",
",",
"groovyProblemSnippets",
")",
";",
"}",
"private",
"ProblemType",
"(",
"int",
"problemID",
",",
"String",
"...",
"groovyProblemSnippets",
")",
"{",
"this",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"problemID",
",",
"groovyProblemSnippets",
")",
";",
"}",
"private",
"ProblemType",
"(",
"String",
"markerType",
",",
"int",
"problemID",
",",
"String",
"...",
"groovyProblemSnippets",
")",
"{",
"this",
".",
"markerType",
"=",
"markerType",
";",
"this",
".",
"problemId",
"=",
"problemID",
";",
"this",
".",
"groovyProblemSnippets",
"=",
"groovyProblemSnippets",
";",
"}",
"private",
"boolean",
"matches",
"(",
"int",
"problemID",
",",
"String",
"markerType",
",",
"String",
"[",
"]",
"messages",
")",
"{",
"if",
"(",
"this",
".",
"problemId",
"==",
"problemID",
"&&",
"this",
".",
"markerType",
".",
"equals",
"(",
"markerType",
")",
")",
"{",
"if",
"(",
"groovyProblemSnippets",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"String",
"message",
":",
"messages",
")",
"{",
"for",
"(",
"String",
"groovyProblemSnippet",
":",
"groovyProblemSnippets",
")",
"{",
"if",
"(",
"message",
"!=",
"null",
"&&",
"message",
".",
"contains",
"(",
"groovyProblemSnippet",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"static",
"ProblemType",
"getProblemType",
"(",
"int",
"problemID",
",",
"String",
"markerType",
",",
"String",
"[",
"]",
"messages",
")",
"{",
"for",
"(",
"ProblemType",
"problemType",
":",
"ProblemType",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"problemType",
".",
"matches",
"(",
"problemID",
",",
"markerType",
",",
"messages",
")",
")",
"{",
"return",
"problemType",
";",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"static",
"boolean",
"isRecognizedProblemId",
"(",
"int",
"problemId",
")",
"{",
"for",
"(",
"ProblemType",
"problemType",
":",
"values",
"(",
")",
")",
"{",
"if",
"(",
"problemType",
".",
"problemId",
"==",
"problemId",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
6,396 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPluginImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"IJavaCompletionProposal",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"public",
"class",
"AddGroovyRuntimeResolver",
"extends",
"AbstractQuickFixResolver",
"{",
"public",
"static",
"class",
"AddGroovyRuntimeProposal",
"extends",
"AbstractGroovyQuickFixProposal",
"{",
"private",
"final",
"IJavaProject",
"project",
";",
"public",
"AddGroovyRuntimeProposal",
"(",
"IJavaProject",
"project",
",",
"QuickFixProblemContext",
"problem",
",",
"int",
"relevance",
")",
"{",
"super",
"(",
"problem",
",",
"relevance",
")",
";",
"this",
".",
"project",
"=",
"project",
";",
"}",
"public",
"void",
"apply",
"(",
"IDocument",
"document",
")",
"{",
"GroovyRuntime",
".",
"addGroovyClasspathContainer",
"(",
"project",
")",
";",
"}",
"public",
"String",
"getDisplayString",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"String",
"getImageBundleLocation",
"(",
")",
"{",
"return",
"JavaPluginImages",
".",
"IMG_OBJS_LIBRARY",
";",
"}",
"}",
"protected",
"AddGroovyRuntimeResolver",
"(",
"QuickFixProblemContext",
"problem",
")",
"{",
"super",
"(",
"problem",
")",
";",
"}",
"public",
"List",
"<",
"IJavaCompletionProposal",
">",
"getQuickFixProposals",
"(",
")",
"{",
"IJavaProject",
"project",
"=",
"getQuickFixProblem",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
".",
"getJavaProject",
"(",
")",
";",
"List",
"<",
"IJavaCompletionProposal",
">",
"proposals",
"=",
"new",
"ArrayList",
"<",
"IJavaCompletionProposal",
">",
"(",
"2",
")",
";",
"try",
"{",
"if",
"(",
"!",
"GroovyRuntime",
".",
"hasGroovyClasspathContainer",
"(",
"project",
")",
")",
"{",
"proposals",
".",
"add",
"(",
"new",
"AddGroovyRuntimeProposal",
"(",
"project",
",",
"getQuickFixProblem",
"(",
")",
",",
"100",
")",
")",
";",
"return",
"proposals",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logWarning",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"@",
"Override",
"protected",
"ProblemType",
"[",
"]",
"getTypes",
"(",
")",
"{",
"return",
"new",
"ProblemType",
"[",
"]",
"{",
"ProblemType",
".",
"MISSING_CLASSPATH_CONTAINER_TYPE",
"}",
";",
"}",
"}",
"</s>"
] |
6,397 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"utils",
".",
"GroovyResourceUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPluginImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"IJavaCompletionProposal",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"public",
"class",
"ConvertToGroovyFileResolver",
"extends",
"AbstractQuickFixResolver",
"{",
"public",
"static",
"final",
"String",
"DESCRIPTION",
"=",
"\"\"",
";",
"public",
"ConvertToGroovyFileResolver",
"(",
"QuickFixProblemContext",
"problem",
")",
"{",
"super",
"(",
"problem",
")",
";",
"}",
"public",
"static",
"class",
"ConvertToGroovyQuickFix",
"extends",
"AbstractGroovyQuickFixProposal",
"{",
"public",
"ConvertToGroovyQuickFix",
"(",
"QuickFixProblemContext",
"problem",
")",
"{",
"super",
"(",
"problem",
")",
";",
"}",
"protected",
"String",
"getImageBundleLocation",
"(",
")",
"{",
"return",
"JavaPluginImages",
".",
"IMG_CORRECTION_CHANGE",
";",
"}",
"public",
"void",
"apply",
"(",
"IDocument",
"document",
")",
"{",
"IResource",
"resource",
"=",
"getQuickFixProblemContext",
"(",
")",
".",
"getResource",
"(",
")",
";",
"List",
"<",
"IResource",
">",
"resources",
"=",
"new",
"ArrayList",
"<",
"IResource",
">",
"(",
")",
";",
"resources",
".",
"add",
"(",
"resource",
")",
";",
"GroovyResourceUtil",
".",
"renameFile",
"(",
"GroovyResourceUtil",
".",
"GROOVY",
",",
"resources",
")",
";",
"}",
"public",
"String",
"getDisplayString",
"(",
")",
"{",
"return",
"DESCRIPTION",
";",
"}",
"}",
"protected",
"ProblemType",
"[",
"]",
"getTypes",
"(",
")",
"{",
"return",
"new",
"ProblemType",
"[",
"]",
"{",
"ProblemType",
".",
"MISSING_SEMI_COLON_TYPE",
",",
"ProblemType",
".",
"MISSING_SEMI_COLON_TYPE_VARIANT",
"}",
";",
"}",
"public",
"List",
"<",
"IJavaCompletionProposal",
">",
"getQuickFixProposals",
"(",
")",
"{",
"List",
"<",
"IJavaCompletionProposal",
">",
"fixes",
"=",
"new",
"ArrayList",
"<",
"IJavaCompletionProposal",
">",
"(",
")",
";",
"fixes",
".",
"add",
"(",
"new",
"ConvertToGroovyQuickFix",
"(",
"getQuickFixProblem",
"(",
")",
")",
")",
";",
"return",
"fixes",
";",
"}",
"}",
"</s>"
] |
6,398 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"abstract",
"class",
"AbstractQuickFixResolver",
"implements",
"IQuickFixResolver",
"{",
"private",
"List",
"<",
"ProblemType",
">",
"problemTypes",
";",
"private",
"QuickFixProblemContext",
"problem",
";",
"protected",
"AbstractQuickFixResolver",
"(",
"QuickFixProblemContext",
"problem",
")",
"{",
"this",
".",
"problem",
"=",
"problem",
";",
"}",
"protected",
"QuickFixProblemContext",
"getQuickFixProblem",
"(",
")",
"{",
"return",
"problem",
";",
"}",
"public",
"List",
"<",
"ProblemType",
">",
"getProblemTypes",
"(",
")",
"{",
"if",
"(",
"problemTypes",
"==",
"null",
")",
"{",
"problemTypes",
"=",
"new",
"ArrayList",
"<",
"ProblemType",
">",
"(",
")",
";",
"ProblemType",
"[",
"]",
"types",
"=",
"getTypes",
"(",
")",
";",
"if",
"(",
"types",
"!=",
"null",
")",
"{",
"for",
"(",
"ProblemType",
"type",
":",
"types",
")",
"{",
"if",
"(",
"type",
"!=",
"null",
"&&",
"!",
"problemTypes",
".",
"contains",
"(",
"type",
")",
")",
"{",
"problemTypes",
".",
"add",
"(",
"type",
")",
";",
"}",
"}",
"}",
"}",
"return",
"problemTypes",
";",
"}",
"protected",
"IType",
"[",
"]",
"getContextTypes",
"(",
")",
"{",
"QuickFixProblemContext",
"context",
"=",
"getQuickFixProblem",
"(",
")",
";",
"if",
"(",
"context",
"!=",
"null",
")",
"{",
"ICompilationUnit",
"unit",
"=",
"context",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"unit",
".",
"getAllTypes",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"abstract",
"ProblemType",
"[",
"]",
"getTypes",
"(",
")",
";",
"}",
"</s>"
] |
6,399 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"quickfix",
".",
"proposals",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPluginImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"IJavaCompletionProposal",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"contentassist",
".",
"IContextInformation",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"public",
"abstract",
"class",
"AbstractGroovyQuickFixProposal",
"implements",
"IJavaCompletionProposal",
"{",
"private",
"QuickFixProblemContext",
"problemContext",
";",
"private",
"int",
"relevance",
";",
"public",
"AbstractGroovyQuickFixProposal",
"(",
"QuickFixProblemContext",
"problem",
")",
"{",
"this",
".",
"problemContext",
"=",
"problem",
";",
"}",
"public",
"AbstractGroovyQuickFixProposal",
"(",
"QuickFixProblemContext",
"problem",
",",
"int",
"relevance",
")",
"{",
"this",
".",
"problemContext",
"=",
"problem",
";",
"this",
".",
"relevance",
"=",
"relevance",
";",
"}",
"public",
"int",
"getRelevance",
"(",
")",
"{",
"return",
"relevance",
";",
"}",
"protected",
"QuickFixProblemContext",
"getQuickFixProblemContext",
"(",
")",
"{",
"return",
"problemContext",
";",
"}",
"public",
"Point",
"getSelection",
"(",
"IDocument",
"document",
")",
"{",
"return",
"problemContext",
"!=",
"null",
"?",
"new",
"Point",
"(",
"problemContext",
".",
"getOffset",
"(",
")",
",",
"problemContext",
".",
"getLength",
"(",
")",
")",
":",
"null",
";",
"}",
"public",
"String",
"getAdditionalProposalInfo",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"Image",
"getImage",
"(",
")",
"{",
"String",
"imageLocation",
"=",
"getImageBundleLocation",
"(",
")",
";",
"if",
"(",
"imageLocation",
"!=",
"null",
")",
"{",
"return",
"JavaPluginImages",
".",
"get",
"(",
"imageLocation",
")",
";",
"}",
"return",
"null",
";",
"}",
"abstract",
"protected",
"String",
"getImageBundleLocation",
"(",
")",
";",
"public",
"IContextInformation",
"getContextInformation",
"(",
")",
"{",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.