id
int32 0
12.9k
| code
sequencelengths 2
264k
|
---|---|
6,200 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"public",
"abstract",
"class",
"AbstractLabeledDialogueControl",
"extends",
"AbstractControlManager",
"{",
"private",
"Point",
"offsetLabelLocation",
";",
"private",
"Label",
"parameterNameLabel",
";",
"private",
"IDialogueControlDescriptor",
"labelDescriptor",
";",
"protected",
"AbstractLabeledDialogueControl",
"(",
"IDialogueControlDescriptor",
"labelDescriptor",
",",
"Point",
"offsetLabelLocation",
")",
"{",
"this",
".",
"labelDescriptor",
"=",
"labelDescriptor",
";",
"this",
".",
"offsetLabelLocation",
"=",
"offsetLabelLocation",
";",
"}",
"protected",
"IDialogueControlDescriptor",
"getLabelDescriptor",
"(",
")",
"{",
"return",
"labelDescriptor",
";",
"}",
"protected",
"int",
"numberofColumns",
"(",
")",
"{",
"return",
"2",
";",
"}",
"protected",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"createManagedControls",
"(",
"Composite",
"parent",
")",
"{",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"controls",
"=",
"new",
"HashMap",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"(",
")",
";",
"if",
"(",
"labelDescriptor",
"!=",
"null",
")",
"{",
"Composite",
"labelArea",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"numberofColumns",
"(",
")",
")",
".",
"margins",
"(",
"0",
",",
"0",
")",
".",
"equalWidth",
"(",
"false",
")",
".",
"applyTo",
"(",
"labelArea",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"false",
")",
".",
"applyTo",
"(",
"labelArea",
")",
";",
"parameterNameLabel",
"=",
"new",
"Label",
"(",
"labelArea",
",",
"SWT",
".",
"READ_ONLY",
")",
";",
"parameterNameLabel",
".",
"setText",
"(",
"labelDescriptor",
".",
"getLabel",
"(",
")",
"+",
"\":",
"\"",
")",
";",
"parameterNameLabel",
".",
"setToolTipText",
"(",
"labelDescriptor",
".",
"getToolTipText",
"(",
")",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"false",
",",
"false",
")",
".",
"align",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
")",
".",
"applyTo",
"(",
"parameterNameLabel",
")",
";",
"if",
"(",
"offsetLabelLocation",
"!=",
"null",
")",
"{",
"GridData",
"data",
"=",
"(",
"GridData",
")",
"parameterNameLabel",
".",
"getLayoutData",
"(",
")",
";",
"int",
"heightHint",
"=",
"offsetLabelLocation",
".",
"y",
";",
"if",
"(",
"heightHint",
">",
"0",
")",
"{",
"data",
".",
"heightHint",
"=",
"heightHint",
";",
"}",
"int",
"widthHint",
"=",
"offsetLabelLocation",
".",
"x",
";",
"if",
"(",
"widthHint",
">",
"0",
")",
"{",
"data",
".",
"widthHint",
"=",
"widthHint",
";",
"}",
"}",
"Control",
"labeledControl",
"=",
"getManagedControl",
"(",
"labelArea",
")",
";",
"if",
"(",
"labeledControl",
"!=",
"null",
")",
"{",
"controls",
".",
"put",
"(",
"labeledControl",
",",
"getLabelDescriptor",
"(",
")",
")",
";",
"}",
"}",
"return",
"controls",
";",
"}",
"abstract",
"protected",
"Control",
"getManagedControl",
"(",
"Composite",
"parent",
")",
";",
"public",
"Label",
"getLabel",
"(",
")",
"{",
"return",
"parameterNameLabel",
"!=",
"null",
"&&",
"!",
"parameterNameLabel",
".",
"isDisposed",
"(",
")",
"?",
"parameterNameLabel",
":",
"null",
";",
"}",
"}",
"</s>"
] |
6,201 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"public",
"class",
"ControlSelectionEvent",
"{",
"private",
"Object",
"data",
";",
"private",
"IDialogueControlDescriptor",
"descriptor",
";",
"private",
"String",
"errorMessage",
";",
"public",
"ControlSelectionEvent",
"(",
"IDialogueControlDescriptor",
"descriptor",
",",
"String",
"errorMessage",
")",
"{",
"this",
".",
"data",
"=",
"null",
";",
"this",
".",
"descriptor",
"=",
"descriptor",
";",
"this",
".",
"errorMessage",
"=",
"errorMessage",
";",
"}",
"public",
"ControlSelectionEvent",
"(",
"Object",
"data",
",",
"IDialogueControlDescriptor",
"descriptor",
")",
"{",
"this",
".",
"data",
"=",
"data",
";",
"this",
".",
"descriptor",
"=",
"descriptor",
";",
"this",
".",
"errorMessage",
"=",
"null",
";",
"}",
"public",
"Object",
"getSelectionData",
"(",
")",
"{",
"return",
"data",
";",
"}",
"public",
"IDialogueControlDescriptor",
"getControlDescriptor",
"(",
")",
"{",
"return",
"descriptor",
";",
"}",
"public",
"String",
"getErrorMessage",
"(",
")",
"{",
"return",
"errorMessage",
";",
"}",
"}",
"</s>"
] |
6,202 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"GroovyMethodSuggestion",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"GroovySuggestionDeclaringType",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"IGroovySuggestion",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"IValueCheckingRule",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"JavaValidTypeRule",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"MethodParameter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"SuggestionDescriptor",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ValueStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"class",
"AddInferencingSuggestionDialogue",
"extends",
"AbstractDialogue",
"{",
"public",
"static",
"final",
"DialogueDescriptor",
"DIALOGUE_DESCRIPTOR",
"=",
"new",
"DialogueDescriptor",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"private",
"Point",
"labelControlOffset",
";",
"private",
"boolean",
"isStatic",
";",
"private",
"boolean",
"isMethod",
"=",
"false",
";",
"private",
"String",
"suggestionName",
";",
"private",
"String",
"javaDoc",
";",
"private",
"String",
"declaringTypeName",
";",
"private",
"String",
"suggestionType",
";",
"private",
"boolean",
"isActive",
";",
"private",
"List",
"<",
"MethodParameter",
">",
"initialParameters",
";",
"private",
"IGroovySuggestion",
"currentSuggestion",
";",
"private",
"boolean",
"useNamedArguments",
";",
"private",
"MethodParameterTable",
"table",
";",
"private",
"IProject",
"project",
";",
"public",
"AddInferencingSuggestionDialogue",
"(",
"Shell",
"parentShell",
",",
"SuggestionDescriptor",
"descriptor",
",",
"IProject",
"project",
")",
"{",
"super",
"(",
"parentShell",
")",
";",
"this",
".",
"project",
"=",
"project",
";",
"setSuggestion",
"(",
"descriptor",
")",
";",
"}",
"public",
"AddInferencingSuggestionDialogue",
"(",
"Shell",
"parentShell",
",",
"GroovySuggestionDeclaringType",
"declaringType",
",",
"IProject",
"project",
")",
"{",
"this",
"(",
"parentShell",
",",
"project",
",",
"null",
",",
"declaringType",
",",
"true",
")",
";",
"}",
"public",
"AddInferencingSuggestionDialogue",
"(",
"Shell",
"parentShell",
",",
"IProject",
"project",
")",
"{",
"this",
"(",
"parentShell",
",",
"project",
",",
"null",
",",
"null",
",",
"true",
")",
";",
"}",
"protected",
"AddInferencingSuggestionDialogue",
"(",
"Shell",
"parentShell",
",",
"IProject",
"project",
",",
"IGroovySuggestion",
"currentSuggestion",
",",
"GroovySuggestionDeclaringType",
"declaringType",
",",
"boolean",
"isActive",
")",
"{",
"super",
"(",
"parentShell",
")",
";",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"currentSuggestion",
"=",
"currentSuggestion",
";",
"this",
".",
"declaringTypeName",
"=",
"declaringType",
"!=",
"null",
"?",
"declaringType",
".",
"getName",
"(",
")",
":",
"null",
";",
"this",
".",
"isActive",
"=",
"isActive",
";",
"}",
"protected",
"DialogueDescriptor",
"getDialogueDescriptor",
"(",
")",
"{",
"return",
"DIALOGUE_DESCRIPTOR",
";",
"}",
"public",
"IGroovySuggestion",
"getCurrentSuggestion",
"(",
")",
"{",
"return",
"currentSuggestion",
";",
"}",
"public",
"SuggestionDescriptor",
"getSuggestionChange",
"(",
")",
"{",
"return",
"isMethod",
"?",
"new",
"SuggestionDescriptor",
"(",
"declaringTypeName",
",",
"isStatic",
",",
"suggestionName",
",",
"javaDoc",
",",
"suggestionType",
",",
"useNamedArguments",
",",
"table",
".",
"getMethodParameter",
"(",
")",
",",
"isActive",
")",
":",
"new",
"SuggestionDescriptor",
"(",
"declaringTypeName",
",",
"isStatic",
",",
"suggestionName",
",",
"javaDoc",
",",
"suggestionType",
",",
"isActive",
")",
";",
"}",
"protected",
"void",
"setSuggestion",
"(",
"IGroovySuggestion",
"suggestion",
")",
"{",
"this",
".",
"currentSuggestion",
"=",
"suggestion",
";",
"if",
"(",
"currentSuggestion",
"!=",
"null",
")",
"{",
"isStatic",
"=",
"currentSuggestion",
".",
"isStatic",
"(",
")",
";",
"suggestionName",
"=",
"currentSuggestion",
".",
"getName",
"(",
")",
";",
"declaringTypeName",
"=",
"currentSuggestion",
".",
"getDeclaringType",
"(",
")",
".",
"getName",
"(",
")",
";",
"javaDoc",
"=",
"currentSuggestion",
".",
"getJavaDoc",
"(",
")",
";",
"suggestionType",
"=",
"currentSuggestion",
".",
"getType",
"(",
")",
";",
"isActive",
"=",
"currentSuggestion",
".",
"isActive",
"(",
")",
";",
"if",
"(",
"currentSuggestion",
"instanceof",
"GroovyMethodSuggestion",
")",
"{",
"GroovyMethodSuggestion",
"method",
"=",
"(",
"GroovyMethodSuggestion",
")",
"currentSuggestion",
";",
"initialParameters",
"=",
"method",
".",
"getParameters",
"(",
")",
";",
"useNamedArguments",
"=",
"method",
".",
"useNamedArguments",
"(",
")",
";",
"isMethod",
"=",
"true",
";",
"}",
"}",
"}",
"protected",
"void",
"setSuggestion",
"(",
"SuggestionDescriptor",
"descriptor",
")",
"{",
"isStatic",
"=",
"descriptor",
".",
"isStatic",
"(",
")",
";",
"suggestionName",
"=",
"descriptor",
".",
"getName",
"(",
")",
";",
"declaringTypeName",
"=",
"descriptor",
".",
"getDeclaringTypeName",
"(",
")",
";",
"javaDoc",
"=",
"descriptor",
".",
"getJavaDoc",
"(",
")",
";",
"suggestionType",
"=",
"descriptor",
".",
"getSuggestionType",
"(",
")",
";",
"isActive",
"=",
"descriptor",
".",
"isActive",
"(",
")",
";",
"if",
"(",
"descriptor",
".",
"isMethod",
"(",
")",
")",
"{",
"initialParameters",
"=",
"descriptor",
".",
"getParameters",
"(",
")",
";",
"useNamedArguments",
"=",
"descriptor",
".",
"isUseArgumentNames",
"(",
")",
";",
"isMethod",
"=",
"true",
";",
"}",
"}",
"protected",
"void",
"createCommandArea",
"(",
"Composite",
"parent",
")",
"{",
"createFieldAreas",
"(",
"parent",
")",
";",
"createDocumentationArea",
"(",
"parent",
")",
";",
"}",
"protected",
"IJavaProject",
"getJavaProject",
"(",
")",
"{",
"return",
"project",
"!=",
"null",
"?",
"JavaCore",
".",
"create",
"(",
"project",
")",
":",
"null",
";",
"}",
"protected",
"void",
"createFieldAreas",
"(",
"Composite",
"parent",
")",
"{",
"JavaTextControl",
"nameControl",
"=",
"new",
"JavaTextControl",
"(",
"ControlTypes",
".",
"NAME",
",",
"getOffsetLabelLocation",
"(",
")",
",",
"suggestionName",
")",
";",
"nameControl",
".",
"createControlArea",
"(",
"parent",
")",
";",
"nameControl",
".",
"addSelectionListener",
"(",
"new",
"ValidatedValueSelectionListener",
"(",
"ControlTypes",
".",
"NAME",
",",
"suggestionName",
")",
"{",
"protected",
"void",
"handleValidatedValue",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"Object",
"selection",
"=",
"event",
".",
"getSelectionData",
"(",
")",
";",
"if",
"(",
"selection",
"instanceof",
"String",
")",
"{",
"suggestionName",
"=",
"(",
"String",
")",
"selection",
";",
"}",
"}",
"}",
")",
";",
"JavaTypeBrowsingControl",
"declaringTypeControl",
"=",
"new",
"JavaTypeBrowsingControl",
"(",
"ControlTypes",
".",
"DECLARING_TYPE",
",",
"getOffsetLabelLocation",
"(",
")",
",",
"declaringTypeName",
",",
"getJavaProject",
"(",
")",
")",
"{",
"protected",
"IValueCheckingRule",
"getCachedValidationRule",
"(",
")",
"{",
"return",
"new",
"JavaValidTypeRule",
"(",
"getJavaProject",
"(",
")",
")",
";",
"}",
"}",
";",
"declaringTypeControl",
".",
"createControlArea",
"(",
"parent",
")",
";",
"declaringTypeControl",
".",
"setEnabled",
"(",
"true",
")",
";",
"declaringTypeControl",
".",
"addSelectionListener",
"(",
"new",
"ValidatedValueSelectionListener",
"(",
"ControlTypes",
".",
"DECLARING_TYPE",
",",
"declaringTypeName",
")",
"{",
"protected",
"void",
"handleValidatedValue",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"Object",
"selection",
"=",
"event",
".",
"getSelectionData",
"(",
")",
";",
"if",
"(",
"selection",
"instanceof",
"String",
")",
"{",
"declaringTypeName",
"=",
"(",
"String",
")",
"selection",
";",
"}",
"}",
"}",
")",
";",
"JavaTypeBrowsingControl",
"suggestionTypeControl",
"=",
"new",
"JavaTypeBrowsingControl",
"(",
"ControlTypes",
".",
"TYPE",
",",
"getOffsetLabelLocation",
"(",
")",
",",
"suggestionType",
",",
"getJavaProject",
"(",
")",
")",
"{",
"protected",
"ValueStatus",
"isControlValueValid",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"ValueStatus",
".",
"getValidStatus",
"(",
"value",
")",
";",
"}",
"return",
"super",
".",
"isControlValueValid",
"(",
"value",
")",
";",
"}",
"}",
";",
"suggestionTypeControl",
".",
"createControlArea",
"(",
"parent",
")",
";",
"suggestionTypeControl",
".",
"addSelectionListener",
"(",
"new",
"ValidatedValueSelectionListener",
"(",
")",
"{",
"protected",
"void",
"handleValidatedValue",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"Object",
"selection",
"=",
"event",
".",
"getSelectionData",
"(",
")",
";",
"if",
"(",
"selection",
"instanceof",
"String",
")",
"{",
"suggestionType",
"=",
"(",
"String",
")",
"selection",
";",
"}",
"}",
"}",
")",
";",
"ButtonDialogueControl",
"isStaticButton",
"=",
"new",
"ButtonDialogueControl",
"(",
"ControlTypes",
".",
"IS_STATIC",
",",
"SWT",
".",
"CHECK",
",",
"isStatic",
")",
";",
"isStaticButton",
".",
"createControlArea",
"(",
"parent",
")",
";",
"isStaticButton",
".",
"addSelectionListener",
"(",
"new",
"ControlSelectionListener",
"(",
")",
"{",
"public",
"void",
"handleSelection",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"Object",
"selection",
"=",
"event",
".",
"getSelectionData",
"(",
")",
";",
"if",
"(",
"selection",
"instanceof",
"Boolean",
")",
"{",
"isStatic",
"=",
"(",
"(",
"Boolean",
")",
"selection",
")",
".",
"booleanValue",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"ControlTypes",
"defaultSuggestionTypeButton",
"=",
"isMethod",
"?",
"ControlTypes",
".",
"METHOD",
":",
"ControlTypes",
".",
"PROPERTY",
";",
"RadioSelectionDialogueControl",
"radioSelection",
"=",
"new",
"RadioSelectionDialogueControl",
"(",
"new",
"IDialogueControlDescriptor",
"[",
"]",
"{",
"ControlTypes",
".",
"PROPERTY",
",",
"ControlTypes",
".",
"METHOD",
"}",
",",
"defaultSuggestionTypeButton",
")",
";",
"radioSelection",
".",
"createControlArea",
"(",
"parent",
")",
";",
"table",
"=",
"new",
"MethodParameterTable",
"(",
"getJavaProject",
"(",
")",
",",
"initialParameters",
",",
"useNamedArguments",
")",
";",
"table",
".",
"createControlArea",
"(",
"parent",
")",
";",
"if",
"(",
"!",
"isMethod",
")",
"{",
"table",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"table",
".",
"addSelectionListener",
"(",
"new",
"ControlSelectionListener",
"(",
")",
"{",
"public",
"void",
"handleSelection",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"Object",
"selection",
"=",
"event",
".",
"getSelectionData",
"(",
")",
";",
"if",
"(",
"event",
".",
"getControlDescriptor",
"(",
")",
"==",
"ControlTypes",
".",
"USE_NAMED_ARGUMENTS",
"&&",
"selection",
"instanceof",
"Boolean",
")",
"{",
"useNamedArguments",
"=",
"(",
"(",
"Boolean",
")",
"selection",
")",
".",
"booleanValue",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"radioSelection",
".",
"addSelectionListener",
"(",
"new",
"ControlSelectionListener",
"(",
")",
"{",
"public",
"void",
"handleSelection",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"IDialogueControlDescriptor",
"descriptor",
"=",
"event",
".",
"getControlDescriptor",
"(",
")",
";",
"if",
"(",
"descriptor",
"==",
"ControlTypes",
".",
"PROPERTY",
")",
"{",
"table",
".",
"setEnabled",
"(",
"false",
")",
";",
"isMethod",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"descriptor",
"==",
"ControlTypes",
".",
"METHOD",
")",
"{",
"table",
".",
"setEnabled",
"(",
"true",
")",
";",
"isMethod",
"=",
"true",
";",
"}",
"}",
"}",
")",
";",
"}",
"protected",
"Point",
"getOffsetLabelLocation",
"(",
")",
"{",
"if",
"(",
"labelControlOffset",
"==",
"null",
")",
"{",
"IDialogueControlDescriptor",
"[",
"]",
"descriptors",
"=",
"new",
"IDialogueControlDescriptor",
"[",
"]",
"{",
"ControlTypes",
".",
"DECLARING_TYPE",
",",
"ControlTypes",
".",
"IS_STATIC",
",",
"ControlTypes",
".",
"TYPE",
",",
"ControlTypes",
".",
"NAME",
"}",
";",
"String",
"[",
"]",
"labelNames",
"=",
"new",
"String",
"[",
"descriptors",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"descriptors",
".",
"length",
";",
"++",
"i",
")",
"{",
"labelNames",
"[",
"i",
"]",
"=",
"descriptors",
"[",
"i",
"]",
".",
"getLabel",
"(",
")",
";",
"}",
"labelControlOffset",
"=",
"getOffsetLabelLocation",
"(",
"labelNames",
")",
";",
"}",
"return",
"labelControlOffset",
";",
"}",
"protected",
"void",
"createDocumentationArea",
"(",
"Composite",
"parent",
")",
"{",
"DocumentDialogueControl",
"docControl",
"=",
"new",
"DocumentDialogueControl",
"(",
"ControlTypes",
".",
"DOC",
",",
"null",
",",
"javaDoc",
")",
";",
"docControl",
".",
"createControlArea",
"(",
"parent",
")",
";",
"docControl",
".",
"addSelectionListener",
"(",
"new",
"ControlSelectionListener",
"(",
")",
"{",
"public",
"void",
"handleSelection",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getSelectionData",
"(",
")",
"instanceof",
"String",
")",
"{",
"javaDoc",
"=",
"(",
"String",
")",
"event",
".",
"getSelectionData",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"}",
"</s>"
] |
6,203 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"IValueCheckingRule",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"JavaValidIdentifierRule",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ValueStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"ModifyEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"ModifyListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Text",
";",
"public",
"class",
"JavaTextControl",
"extends",
"AbstractLabeledDialogueControl",
"{",
"private",
"String",
"initialValue",
";",
"private",
"Text",
"textControl",
";",
"private",
"IValueCheckingRule",
"cachedValueCheckingRule",
";",
"public",
"JavaTextControl",
"(",
"IDialogueControlDescriptor",
"labelDescriptor",
",",
"Point",
"offsetLabelLocation",
",",
"String",
"initialValue",
")",
"{",
"super",
"(",
"labelDescriptor",
",",
"offsetLabelLocation",
")",
";",
"this",
".",
"initialValue",
"=",
"initialValue",
";",
"}",
"protected",
"Control",
"getManagedControl",
"(",
"Composite",
"parent",
")",
"{",
"textControl",
"=",
"new",
"Text",
"(",
"parent",
",",
"SWT",
".",
"BORDER",
")",
";",
"if",
"(",
"initialValue",
"!=",
"null",
")",
"{",
"textControl",
".",
"setText",
"(",
"initialValue",
")",
";",
"}",
"textControl",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
",",
"true",
",",
"false",
")",
")",
";",
"textControl",
".",
"addModifyListener",
"(",
"new",
"ModifyListener",
"(",
")",
"{",
"public",
"void",
"modifyText",
"(",
"ModifyEvent",
"e",
")",
"{",
"notifyControlChange",
"(",
"textControl",
".",
"getText",
"(",
")",
",",
"textControl",
")",
";",
"}",
"}",
")",
";",
"return",
"textControl",
";",
"}",
"protected",
"Text",
"getTextControl",
"(",
")",
"{",
"return",
"textControl",
";",
"}",
"protected",
"ValueStatus",
"isControlValueValid",
"(",
"Control",
"control",
")",
"{",
"if",
"(",
"control",
"==",
"textControl",
")",
"{",
"String",
"stringVal",
"=",
"textControl",
".",
"getText",
"(",
")",
";",
"return",
"isControlValueValid",
"(",
"stringVal",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"ValueStatus",
"isControlValueValid",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"cachedValueCheckingRule",
"==",
"null",
")",
"{",
"cachedValueCheckingRule",
"=",
"getCachedValidationRule",
"(",
")",
";",
"}",
"if",
"(",
"cachedValueCheckingRule",
"!=",
"null",
")",
"{",
"return",
"cachedValueCheckingRule",
".",
"checkValidity",
"(",
"value",
")",
";",
"}",
"return",
"ValueStatus",
".",
"getValidStatus",
"(",
"value",
")",
";",
"}",
"protected",
"IValueCheckingRule",
"getCachedValidationRule",
"(",
")",
"{",
"return",
"new",
"JavaValidIdentifierRule",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,204 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"public",
"class",
"RadioSelectionDialogueControl",
"extends",
"AbstractControlManager",
"{",
"private",
"IDialogueControlDescriptor",
"[",
"]",
"radioValues",
";",
"private",
"IDialogueControlDescriptor",
"defaultValue",
";",
"protected",
"RadioSelectionDialogueControl",
"(",
"IDialogueControlDescriptor",
"[",
"]",
"radioValues",
",",
"IDialogueControlDescriptor",
"defaultValue",
")",
"{",
"this",
".",
"radioValues",
"=",
"radioValues",
";",
"this",
".",
"defaultValue",
"=",
"defaultValue",
";",
"}",
"protected",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"createManagedControls",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"buttonArea",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"2",
")",
".",
"equalWidth",
"(",
"true",
")",
".",
"applyTo",
"(",
"buttonArea",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"false",
")",
".",
"applyTo",
"(",
"buttonArea",
")",
";",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"controls",
"=",
"new",
"HashMap",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"(",
")",
";",
"for",
"(",
"IDialogueControlDescriptor",
"descriptor",
":",
"radioValues",
")",
"{",
"String",
"buttonLabel",
"=",
"descriptor",
".",
"getLabel",
"(",
")",
";",
"if",
"(",
"buttonLabel",
"==",
"null",
"||",
"buttonLabel",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"continue",
";",
"}",
"final",
"Button",
"button",
"=",
"new",
"Button",
"(",
"buttonArea",
",",
"SWT",
".",
"RADIO",
")",
";",
"button",
".",
"setText",
"(",
"buttonLabel",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"align",
"(",
"SWT",
".",
"BEGINNING",
",",
"SWT",
".",
"CENTER",
")",
".",
"applyTo",
"(",
"button",
")",
";",
"button",
".",
"setSelection",
"(",
"false",
")",
";",
"if",
"(",
"button",
"!=",
"null",
")",
"{",
"controls",
".",
"put",
"(",
"button",
",",
"descriptor",
")",
";",
"button",
".",
"setData",
"(",
"descriptor",
")",
";",
"String",
"toolTipText",
"=",
"descriptor",
".",
"getToolTipText",
"(",
")",
";",
"if",
"(",
"toolTipText",
"!=",
"null",
")",
"{",
"button",
".",
"setToolTipText",
"(",
"toolTipText",
")",
";",
"}",
"if",
"(",
"buttonLabel",
".",
"equals",
"(",
"defaultValue",
".",
"getLabel",
"(",
")",
")",
")",
"{",
"button",
".",
"setSelection",
"(",
"true",
")",
";",
"}",
"button",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"if",
"(",
"button",
".",
"getData",
"(",
")",
"instanceof",
"IDialogueControlDescriptor",
")",
"{",
"notifyControlChange",
"(",
"button",
".",
"getData",
"(",
")",
",",
"button",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"}",
"return",
"controls",
";",
"}",
"}",
"</s>"
] |
6,205 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"MethodParameter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ColumnLabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredContentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"TableViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"Viewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ViewerCell",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Table",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"TableColumn",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"TableItem",
";",
"public",
"class",
"MethodParameterTable",
"extends",
"AbstractControlManager",
"{",
"enum",
"ColumnTypes",
"{",
"NAME",
"(",
"\"Name\"",
",",
"300",
")",
",",
"TYPE",
"(",
"\"Type\"",
",",
"300",
")",
";",
"private",
"String",
"label",
";",
"private",
"int",
"weight",
";",
"private",
"ColumnTypes",
"(",
"String",
"label",
",",
"int",
"weight",
")",
"{",
"this",
".",
"label",
"=",
"label",
";",
"this",
".",
"weight",
"=",
"weight",
";",
"}",
"public",
"String",
"getLabel",
"(",
")",
"{",
"return",
"label",
";",
"}",
"public",
"int",
"getWeight",
"(",
")",
"{",
"return",
"weight",
";",
"}",
"}",
"private",
"List",
"<",
"MethodParameter",
">",
"parameters",
";",
"private",
"TableViewer",
"viewer",
";",
"private",
"IJavaProject",
"project",
";",
"private",
"boolean",
"useNamedArguments",
";",
"public",
"MethodParameterTable",
"(",
"IJavaProject",
"project",
",",
"List",
"<",
"MethodParameter",
">",
"parameters",
",",
"boolean",
"useNamedArguments",
")",
"{",
"this",
".",
"parameters",
"=",
"parameters",
";",
"if",
"(",
"parameters",
"==",
"null",
")",
"{",
"this",
".",
"parameters",
"=",
"new",
"ArrayList",
"<",
"MethodParameter",
">",
"(",
")",
";",
"}",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"useNamedArguments",
"=",
"useNamedArguments",
";",
"}",
"protected",
"int",
"getLabelRowColumns",
"(",
")",
"{",
"return",
"1",
";",
"}",
"protected",
"IDialogueControlDescriptor",
"[",
"]",
"getTableButtonDescriptors",
"(",
")",
"{",
"return",
"new",
"IDialogueControlDescriptor",
"[",
"]",
"{",
"ControlTypes",
".",
"ADD",
",",
"ControlTypes",
".",
"REMOVE",
",",
"ControlTypes",
".",
"EDIT",
",",
"ControlTypes",
".",
"UP",
",",
"ControlTypes",
".",
"DOWN",
"}",
";",
"}",
"protected",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"createOperationButtonArea",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"buttons",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"align",
"(",
"GridData",
".",
"CENTER",
",",
"GridData",
".",
"BEGINNING",
")",
".",
"applyTo",
"(",
"buttons",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"applyTo",
"(",
"buttons",
")",
";",
"IDialogueControlDescriptor",
"[",
"]",
"types",
"=",
"getTableButtonDescriptors",
"(",
")",
";",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"opButtons",
"=",
"new",
"HashMap",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"(",
")",
";",
"for",
"(",
"IDialogueControlDescriptor",
"type",
":",
"types",
")",
"{",
"Button",
"button",
"=",
"createSelectionButton",
"(",
"buttons",
",",
"type",
")",
";",
"if",
"(",
"button",
"!=",
"null",
")",
"{",
"opButtons",
".",
"put",
"(",
"button",
",",
"type",
")",
";",
"}",
"}",
"return",
"opButtons",
";",
"}",
"protected",
"Button",
"createSelectionButton",
"(",
"Composite",
"parent",
",",
"IDialogueControlDescriptor",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Button",
"button",
"=",
"new",
"Button",
"(",
"parent",
",",
"SWT",
".",
"PUSH",
")",
";",
"button",
".",
"setText",
"(",
"type",
".",
"getLabel",
"(",
")",
")",
";",
"button",
".",
"setData",
"(",
"type",
")",
";",
"Point",
"minSize",
"=",
"button",
".",
"computeSize",
"(",
"SWT",
".",
"DEFAULT",
",",
"SWT",
".",
"DEFAULT",
",",
"true",
")",
";",
"int",
"widthHint",
"=",
"0",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"hint",
"(",
"Math",
".",
"max",
"(",
"widthHint",
",",
"minSize",
".",
"x",
")",
",",
"SWT",
".",
"DEFAULT",
")",
".",
"applyTo",
"(",
"button",
")",
";",
"button",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"Object",
"obj",
"=",
"e",
".",
"getSource",
"(",
")",
";",
"if",
"(",
"obj",
"instanceof",
"Button",
")",
"{",
"IDialogueControlDescriptor",
"descriptor",
"=",
"(",
"IDialogueControlDescriptor",
")",
"(",
"(",
"Button",
")",
"obj",
")",
".",
"getData",
"(",
")",
";",
"handleButtonSelection",
"(",
"descriptor",
")",
";",
"}",
"}",
"}",
")",
";",
"return",
"button",
";",
"}",
"protected",
"void",
"handleButtonSelection",
"(",
"IDialogueControlDescriptor",
"type",
")",
"{",
"if",
"(",
"!",
"(",
"type",
"instanceof",
"ControlTypes",
")",
")",
"{",
"return",
";",
"}",
"ControlTypes",
"controlType",
"=",
"(",
"ControlTypes",
")",
"type",
";",
"switch",
"(",
"controlType",
")",
"{",
"case",
"ADD",
":",
"addElement",
"(",
")",
";",
"break",
";",
"case",
"REMOVE",
":",
"removeElement",
"(",
")",
";",
"break",
";",
"case",
"EDIT",
":",
"editElement",
"(",
")",
";",
"break",
";",
"case",
"UP",
":",
"int",
"selectionIndex",
"=",
"viewer",
".",
"getTable",
"(",
")",
".",
"getSelectionIndex",
"(",
")",
";",
"if",
"(",
"selectionIndex",
">",
"0",
")",
"{",
"MethodParameter",
"element",
"=",
"parameters",
".",
"remove",
"(",
"selectionIndex",
")",
";",
"parameters",
".",
"add",
"(",
"selectionIndex",
"-",
"1",
",",
"element",
")",
";",
"refreshTable",
"(",
")",
";",
"}",
"break",
";",
"case",
"DOWN",
":",
"selectionIndex",
"=",
"viewer",
".",
"getTable",
"(",
")",
".",
"getSelectionIndex",
"(",
")",
";",
"if",
"(",
"selectionIndex",
">=",
"0",
"&&",
"selectionIndex",
"<",
"parameters",
".",
"size",
"(",
")",
"-",
"1",
")",
"{",
"MethodParameter",
"element",
"=",
"parameters",
".",
"remove",
"(",
"selectionIndex",
")",
";",
"parameters",
".",
"add",
"(",
"selectionIndex",
"+",
"1",
",",
"element",
")",
";",
"refreshTable",
"(",
")",
";",
"}",
"break",
";",
"}",
"}",
"protected",
"int",
"getViewerConfiguration",
"(",
")",
"{",
"return",
"SWT",
".",
"BORDER",
"|",
"SWT",
".",
"MULTI",
"|",
"SWT",
".",
"FULL_SELECTION",
"|",
"SWT",
".",
"H_SCROLL",
"|",
"SWT",
".",
"V_SCROLL",
";",
"}",
"protected",
"int",
"getViewerHeightHint",
"(",
")",
"{",
"return",
"200",
";",
"}",
"protected",
"TableViewer",
"createTableViewer",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"treeComposite",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"applyTo",
"(",
"treeComposite",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"applyTo",
"(",
"treeComposite",
")",
";",
"Table",
"table",
"=",
"new",
"Table",
"(",
"treeComposite",
",",
"getViewerConfiguration",
"(",
")",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"hint",
"(",
"SWT",
".",
"DEFAULT",
",",
"getViewerHeightHint",
"(",
")",
")",
".",
"applyTo",
"(",
"table",
")",
";",
"viewer",
"=",
"new",
"TableViewer",
"(",
"table",
")",
";",
"ColumnTypes",
"[",
"]",
"values",
"=",
"ColumnTypes",
".",
"values",
"(",
")",
";",
"for",
"(",
"ColumnTypes",
"column",
":",
"values",
")",
"{",
"if",
"(",
"column",
"!=",
"null",
")",
"{",
"TableColumn",
"tableColumn",
"=",
"new",
"TableColumn",
"(",
"table",
",",
"SWT",
".",
"NONE",
")",
";",
"tableColumn",
".",
"setResizable",
"(",
"true",
")",
";",
"tableColumn",
".",
"setText",
"(",
"column",
".",
"getLabel",
"(",
")",
")",
";",
"tableColumn",
".",
"setWidth",
"(",
"column",
".",
"getWeight",
"(",
")",
")",
";",
"}",
"}",
"table",
".",
"setHeaderVisible",
"(",
"true",
")",
";",
"table",
".",
"setLinesVisible",
"(",
"true",
")",
";",
"setTableProviders",
"(",
"viewer",
")",
";",
"return",
"viewer",
";",
"}",
"protected",
"void",
"setTableProviders",
"(",
"final",
"TableViewer",
"viewer",
")",
"{",
"viewer",
".",
"setContentProvider",
"(",
"new",
"IStructuredContentProvider",
"(",
")",
"{",
"public",
"void",
"inputChanged",
"(",
"Viewer",
"viewer",
",",
"Object",
"oldInput",
",",
"Object",
"newInput",
")",
"{",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"}",
"public",
"Object",
"[",
"]",
"getElements",
"(",
"Object",
"inputElement",
")",
"{",
"if",
"(",
"inputElement",
"instanceof",
"List",
")",
"{",
"return",
"(",
"(",
"List",
"<",
"?",
">",
")",
"inputElement",
")",
".",
"toArray",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
")",
";",
"viewer",
".",
"setLabelProvider",
"(",
"new",
"ColumnLabelProvider",
"(",
")",
"{",
"public",
"void",
"update",
"(",
"ViewerCell",
"cell",
")",
"{",
"Object",
"element",
"=",
"cell",
".",
"getElement",
"(",
")",
";",
"int",
"index",
"=",
"cell",
".",
"getColumnIndex",
"(",
")",
";",
"cell",
".",
"setText",
"(",
"getColumnText",
"(",
"element",
",",
"index",
")",
")",
";",
"}",
"public",
"String",
"getColumnText",
"(",
"Object",
"element",
",",
"int",
"index",
")",
"{",
"String",
"text",
"=",
"null",
";",
"if",
"(",
"element",
"instanceof",
"MethodParameter",
")",
"{",
"ColumnTypes",
"[",
"]",
"values",
"=",
"ColumnTypes",
".",
"values",
"(",
")",
";",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"values",
".",
"length",
")",
"{",
"ColumnTypes",
"type",
"=",
"values",
"[",
"index",
"]",
";",
"MethodParameter",
"arg",
"=",
"(",
"MethodParameter",
")",
"element",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"NAME",
":",
"text",
"=",
"arg",
".",
"getName",
"(",
")",
";",
"break",
";",
"case",
"TYPE",
":",
"text",
"=",
"arg",
".",
"getType",
"(",
")",
";",
"break",
";",
"}",
"}",
"}",
"return",
"text",
";",
"}",
"}",
")",
";",
"viewer",
".",
"setInput",
"(",
"parameters",
")",
";",
"}",
"protected",
"MethodParameter",
"getSelectedElement",
"(",
")",
"{",
"ISelection",
"selection",
"=",
"viewer",
".",
"getSelection",
"(",
")",
";",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"Object",
"selectObj",
"=",
"(",
"(",
"IStructuredSelection",
")",
"selection",
")",
".",
"getFirstElement",
"(",
")",
";",
"if",
"(",
"selectObj",
"instanceof",
"MethodParameter",
")",
"{",
"return",
"(",
"MethodParameter",
")",
"selectObj",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"MethodParameter",
"getElement",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"viewer",
".",
"getTable",
"(",
")",
".",
"getItemCount",
"(",
")",
")",
"{",
"return",
"getArgumentElementFromSelectionObject",
"(",
"viewer",
".",
"getElementAt",
"(",
"index",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"void",
"addElement",
"(",
")",
"{",
"MethodParameterDialogue",
"dialogue",
"=",
"new",
"MethodParameterDialogue",
"(",
"getShell",
"(",
")",
",",
"project",
",",
"null",
",",
"parameters",
")",
";",
"if",
"(",
"dialogue",
".",
"open",
"(",
")",
"==",
"Window",
".",
"OK",
")",
"{",
"MethodParameter",
"parameter",
"=",
"dialogue",
".",
"getMethodParameter",
"(",
")",
";",
"if",
"(",
"parameter",
"!=",
"null",
")",
"{",
"int",
"selectionIndex",
"=",
"viewer",
".",
"getTable",
"(",
")",
".",
"getSelectionIndex",
"(",
")",
";",
"if",
"(",
"selectionIndex",
">=",
"0",
")",
"{",
"parameters",
".",
"add",
"(",
"selectionIndex",
",",
"parameter",
")",
";",
"}",
"else",
"{",
"parameters",
".",
"add",
"(",
"parameter",
")",
";",
"}",
"}",
"refreshTable",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"editElement",
"(",
")",
"{",
"MethodParameter",
"selected",
"=",
"getSelectedElement",
"(",
")",
";",
"if",
"(",
"selected",
"!=",
"null",
")",
"{",
"MethodParameterDialogue",
"dialogue",
"=",
"new",
"MethodParameterDialogue",
"(",
"getShell",
"(",
")",
",",
"project",
",",
"selected",
",",
"parameters",
")",
";",
"if",
"(",
"dialogue",
".",
"open",
"(",
")",
"==",
"Window",
".",
"OK",
")",
"{",
"MethodParameter",
"editedParameter",
"=",
"dialogue",
".",
"getMethodParameter",
"(",
")",
";",
"if",
"(",
"editedParameter",
"!=",
"null",
")",
"{",
"int",
"selectionIndex",
"=",
"viewer",
".",
"getTable",
"(",
")",
".",
"getSelectionIndex",
"(",
")",
";",
"parameters",
".",
"remove",
"(",
"selected",
")",
";",
"if",
"(",
"selectionIndex",
">=",
"0",
")",
"{",
"parameters",
".",
"add",
"(",
"selectionIndex",
",",
"editedParameter",
")",
";",
"}",
"else",
"{",
"parameters",
".",
"add",
"(",
"editedParameter",
")",
";",
"}",
"}",
"refreshTable",
"(",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"removeElement",
"(",
")",
"{",
"MethodParameter",
"selected",
"=",
"getSelectedElement",
"(",
")",
";",
"if",
"(",
"selected",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parameters",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"MethodParameter",
"item",
"=",
"parameters",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"item",
".",
"equals",
"(",
"selected",
")",
")",
"{",
"parameters",
".",
"remove",
"(",
"i",
")",
";",
"}",
"}",
"}",
"refreshTable",
"(",
")",
";",
"}",
"protected",
"void",
"refreshTable",
"(",
")",
"{",
"viewer",
".",
"getTable",
"(",
")",
".",
"setFocus",
"(",
")",
";",
"viewer",
".",
"setInput",
"(",
"parameters",
")",
";",
"viewer",
".",
"refresh",
"(",
"true",
")",
";",
"}",
"protected",
"MethodParameter",
"getArgumentElementFromSelectionObject",
"(",
"Object",
"element",
")",
"{",
"MethodParameter",
"arg",
"=",
"null",
";",
"if",
"(",
"element",
"instanceof",
"MethodParameter",
")",
"{",
"arg",
"=",
"(",
"MethodParameter",
")",
"element",
";",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"TableItem",
")",
"{",
"TableItem",
"item",
"=",
"(",
"TableItem",
")",
"element",
";",
"Object",
"dataOb",
"=",
"item",
".",
"getData",
"(",
")",
";",
"if",
"(",
"dataOb",
"instanceof",
"MethodParameter",
")",
"{",
"arg",
"=",
"(",
"MethodParameter",
")",
"dataOb",
";",
"}",
"}",
"return",
"arg",
";",
"}",
"public",
"void",
"changeControlValue",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"}",
"protected",
"Button",
"createCheckButton",
"(",
"Composite",
"parent",
",",
"IDialogueControlDescriptor",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Button",
"button",
"=",
"new",
"Button",
"(",
"parent",
",",
"SWT",
".",
"CHECK",
")",
";",
"button",
".",
"setText",
"(",
"type",
".",
"getLabel",
"(",
")",
")",
";",
"button",
".",
"setData",
"(",
"type",
")",
";",
"Point",
"minSize",
"=",
"button",
".",
"computeSize",
"(",
"SWT",
".",
"DEFAULT",
",",
"SWT",
".",
"DEFAULT",
",",
"true",
")",
";",
"int",
"widthHint",
"=",
"0",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"hint",
"(",
"Math",
".",
"max",
"(",
"widthHint",
",",
"minSize",
".",
"x",
")",
",",
"SWT",
".",
"DEFAULT",
")",
".",
"applyTo",
"(",
"button",
")",
";",
"button",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"Object",
"obj",
"=",
"e",
".",
"getSource",
"(",
")",
";",
"if",
"(",
"obj",
"instanceof",
"Button",
")",
"{",
"notifyControlChange",
"(",
"new",
"Boolean",
"(",
"(",
"(",
"Button",
")",
"obj",
")",
".",
"getSelection",
"(",
")",
")",
",",
"(",
"Button",
")",
"obj",
")",
";",
"}",
"}",
"}",
")",
";",
"return",
"button",
";",
"}",
"protected",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"createManagedControls",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"viewerArea",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"2",
")",
".",
"equalWidth",
"(",
"false",
")",
".",
"applyTo",
"(",
"viewerArea",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"applyTo",
"(",
"viewerArea",
")",
";",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"allControls",
"=",
"new",
"HashMap",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"(",
")",
";",
"TableViewer",
"viewer",
"=",
"createTableViewer",
"(",
"viewerArea",
")",
";",
"if",
"(",
"viewer",
"!=",
"null",
")",
"{",
"allControls",
".",
"put",
"(",
"viewer",
".",
"getTable",
"(",
")",
",",
"ControlTypes",
".",
"PARAMETERS",
")",
";",
"}",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"buttonControls",
"=",
"createOperationButtonArea",
"(",
"viewerArea",
")",
";",
"if",
"(",
"buttonControls",
"!=",
"null",
")",
"{",
"allControls",
".",
"putAll",
"(",
"buttonControls",
")",
";",
"}",
"Button",
"useNamedButton",
"=",
"createCheckButton",
"(",
"parent",
",",
"ControlTypes",
".",
"USE_NAMED_ARGUMENTS",
")",
";",
"if",
"(",
"useNamedButton",
"!=",
"null",
")",
"{",
"useNamedButton",
".",
"setSelection",
"(",
"useNamedArguments",
")",
";",
"allControls",
".",
"put",
"(",
"useNamedButton",
",",
"ControlTypes",
".",
"USE_NAMED_ARGUMENTS",
")",
";",
"}",
"return",
"allControls",
";",
"}",
"public",
"List",
"<",
"MethodParameter",
">",
"getMethodParameter",
"(",
")",
"{",
"return",
"parameters",
";",
"}",
"}",
"</s>"
] |
6,206 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"IGroovySuggestion",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"class",
"EditInferencingSuggestionDialogue",
"extends",
"AddInferencingSuggestionDialogue",
"{",
"public",
"static",
"final",
"DialogueDescriptor",
"EDIT_DIALOGUE_DESCRIPTOR",
"=",
"new",
"DialogueDescriptor",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"public",
"EditInferencingSuggestionDialogue",
"(",
"Shell",
"parentShell",
",",
"IGroovySuggestion",
"suggestion",
",",
"IProject",
"project",
")",
"{",
"super",
"(",
"parentShell",
",",
"project",
")",
";",
"setSuggestion",
"(",
"suggestion",
")",
";",
"}",
"protected",
"DialogueDescriptor",
"getDialogueDescriptor",
"(",
")",
"{",
"return",
"EDIT_DIALOGUE_DESCRIPTOR",
";",
"}",
"}",
"</s>"
] |
6,207 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"IValueCheckingRule",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"JavaValidParameterizedTypeRule",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"browse",
".",
"IBrowseTypeHandler",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"ui",
".",
"browse",
".",
"TypeBrowseSupport",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Text",
";",
"public",
"class",
"JavaTypeBrowsingControl",
"extends",
"JavaTextControl",
"{",
"private",
"static",
"final",
"String",
"BROWSE",
"=",
"\"Browse...\"",
";",
"private",
"Button",
"browse",
";",
"private",
"IJavaProject",
"project",
";",
"public",
"JavaTypeBrowsingControl",
"(",
"IDialogueControlDescriptor",
"labelDescriptor",
",",
"Point",
"offsetLabelLocation",
",",
"String",
"initialValue",
",",
"IJavaProject",
"project",
")",
"{",
"super",
"(",
"labelDescriptor",
",",
"offsetLabelLocation",
",",
"initialValue",
")",
";",
"this",
".",
"project",
"=",
"project",
";",
"}",
"protected",
"Control",
"getManagedControl",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"fieldComposite",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"2",
")",
".",
"applyTo",
"(",
"fieldComposite",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"false",
")",
".",
"applyTo",
"(",
"fieldComposite",
")",
";",
"Text",
"text",
"=",
"(",
"Text",
")",
"super",
".",
"getManagedControl",
"(",
"fieldComposite",
")",
";",
"browse",
"=",
"new",
"Button",
"(",
"fieldComposite",
",",
"SWT",
".",
"PUSH",
")",
";",
"browse",
".",
"setEnabled",
"(",
"true",
")",
";",
"browse",
".",
"setText",
"(",
"BROWSE",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"align",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
")",
".",
"grab",
"(",
"false",
",",
"false",
")",
".",
"applyTo",
"(",
"browse",
")",
";",
"GridData",
"data",
"=",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
")",
";",
"data",
".",
"heightHint",
"=",
"getButtonHeight",
"(",
")",
";",
"browse",
".",
"setLayoutData",
"(",
"data",
")",
";",
"addTypeBrowseSupport",
"(",
"text",
",",
"browse",
",",
"parent",
".",
"getShell",
"(",
")",
")",
";",
"return",
"text",
";",
"}",
"protected",
"void",
"addTypeBrowseSupport",
"(",
"Text",
"text",
",",
"Button",
"browse",
",",
"Shell",
"shell",
")",
"{",
"final",
"Text",
"finText",
"=",
"text",
";",
"new",
"TypeBrowseSupport",
"(",
"shell",
",",
"project",
",",
"new",
"IBrowseTypeHandler",
"(",
")",
"{",
"public",
"void",
"handleTypeSelection",
"(",
"String",
"qualifiedName",
")",
"{",
"finText",
".",
"setText",
"(",
"qualifiedName",
")",
";",
"notifyControlChange",
"(",
"qualifiedName",
",",
"finText",
")",
";",
"}",
"}",
")",
".",
"applySupport",
"(",
"browse",
",",
"text",
")",
";",
"}",
"protected",
"int",
"getButtonHeight",
"(",
")",
"{",
"return",
"23",
";",
"}",
"public",
"void",
"setEnabled",
"(",
"boolean",
"enable",
")",
"{",
"super",
".",
"setEnabled",
"(",
"enable",
")",
";",
"browse",
".",
"setEnabled",
"(",
"enable",
")",
";",
"}",
"protected",
"IValueCheckingRule",
"getCachedValidationRule",
"(",
")",
"{",
"return",
"new",
"JavaValidParameterizedTypeRule",
"(",
"project",
")",
";",
"}",
"}",
"</s>"
] |
6,208 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Combo",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"class",
"ProjectDropDownControl",
"extends",
"ProjectDisplayControl",
"{",
"private",
"List",
"<",
"IProject",
">",
"projects",
";",
"private",
"Combo",
"dropDown",
";",
"private",
"ISelectionHandler",
"handler",
";",
"protected",
"ProjectDropDownControl",
"(",
"List",
"<",
"IProject",
">",
"projects",
",",
"Shell",
"shell",
",",
"Composite",
"parent",
",",
"ISelectionHandler",
"handler",
")",
"{",
"super",
"(",
"shell",
",",
"parent",
")",
";",
"this",
".",
"projects",
"=",
"projects",
";",
"this",
".",
"handler",
"=",
"handler",
";",
"}",
"protected",
"List",
"<",
"IProject",
">",
"getProjects",
"(",
")",
"{",
"return",
"projects",
";",
"}",
"public",
"static",
"IProjectUIControl",
"getProjectSelectionControl",
"(",
"List",
"<",
"IProject",
">",
"projects",
",",
"Shell",
"shell",
",",
"Composite",
"parent",
",",
"ISelectionHandler",
"handler",
")",
"{",
"IProjectUIControl",
"control",
"=",
"null",
";",
"if",
"(",
"projects",
"==",
"null",
"||",
"projects",
".",
"size",
"(",
")",
"<=",
"1",
")",
"{",
"control",
"=",
"new",
"ProjectDisplayControl",
"(",
"shell",
",",
"parent",
")",
";",
"if",
"(",
"projects",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"control",
".",
"setProject",
"(",
"projects",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"}",
"else",
"{",
"control",
"=",
"new",
"ProjectDropDownControl",
"(",
"projects",
",",
"shell",
",",
"parent",
",",
"handler",
")",
";",
"}",
"return",
"control",
";",
"}",
"public",
"void",
"createProjectDisplayControl",
"(",
"Composite",
"parent",
")",
"{",
"String",
"[",
"]",
"projectNames",
"=",
"new",
"String",
"[",
"projects",
".",
"size",
"(",
")",
"]",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"projectNames",
".",
"length",
"&&",
"i",
"<",
"projects",
".",
"size",
"(",
")",
")",
"{",
"projectNames",
"[",
"i",
"]",
"=",
"projects",
".",
"get",
"(",
"i",
")",
".",
"getName",
"(",
")",
";",
"i",
"++",
";",
"}",
"dropDown",
"=",
"new",
"Combo",
"(",
"parent",
",",
"SWT",
".",
"DROP_DOWN",
"|",
"SWT",
".",
"READ_ONLY",
")",
";",
"dropDown",
".",
"setItems",
"(",
"projectNames",
")",
";",
"dropDown",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"String",
"newSelection",
"=",
"dropDown",
".",
"getItem",
"(",
"dropDown",
".",
"getSelectionIndex",
"(",
")",
")",
";",
"IProject",
"project",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"newSelection",
")",
";",
"ProjectDropDownControl",
".",
"super",
".",
"setProject",
"(",
"project",
")",
";",
"handleProjectChange",
"(",
"project",
")",
";",
"}",
"}",
")",
";",
"setProject",
"(",
"projects",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"protected",
"boolean",
"isSelectionSame",
"(",
"IProject",
"projectToSelect",
")",
"{",
"int",
"selectionIndex",
"=",
"dropDown",
".",
"getSelectionIndex",
"(",
")",
";",
"if",
"(",
"selectionIndex",
">=",
"0",
")",
"{",
"String",
"currentSelection",
"=",
"dropDown",
".",
"getItem",
"(",
"selectionIndex",
")",
";",
"return",
"projectToSelect",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"currentSelection",
")",
";",
"}",
"return",
"projectToSelect",
"==",
"getProject",
"(",
")",
";",
"}",
"public",
"IProject",
"setProject",
"(",
"IProject",
"projectToSelect",
")",
"{",
"if",
"(",
"projectToSelect",
"==",
"null",
"||",
"isSelectionSame",
"(",
"projectToSelect",
")",
")",
"{",
"return",
"projectToSelect",
";",
"}",
"int",
"selectedIndex",
"=",
"-",
"1",
";",
"String",
"[",
"]",
"allProjects",
"=",
"dropDown",
".",
"getItems",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allProjects",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"projectToSelect",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"allProjects",
"[",
"i",
"]",
")",
")",
"{",
"selectedIndex",
"=",
"i",
";",
"break",
";",
"}",
"}",
"if",
"(",
"selectedIndex",
">=",
"0",
")",
"{",
"dropDown",
".",
"select",
"(",
"selectedIndex",
")",
";",
"super",
".",
"setProject",
"(",
"projectToSelect",
")",
";",
"handleProjectChange",
"(",
"projectToSelect",
")",
";",
"return",
"projectToSelect",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"protected",
"void",
"handleProjectChange",
"(",
"IProject",
"selectedProject",
")",
"{",
"if",
"(",
"handler",
"!=",
"null",
")",
"{",
"handler",
".",
"selectionChanged",
"(",
"selectedProject",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,209 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"class",
"ProjectDisplayControl",
"implements",
"IProjectUIControl",
"{",
"private",
"Shell",
"shell",
";",
"private",
"Composite",
"parent",
";",
"private",
"IProject",
"project",
";",
"protected",
"static",
"final",
"String",
"NO_PROJECT",
"=",
"\"\"",
";",
"protected",
"ProjectDisplayControl",
"(",
"Shell",
"shell",
",",
"Composite",
"parent",
")",
"{",
"this",
".",
"shell",
"=",
"shell",
";",
"this",
".",
"parent",
"=",
"parent",
";",
"}",
"protected",
"Shell",
"getShell",
"(",
")",
"{",
"return",
"shell",
";",
"}",
"public",
"IProject",
"getProject",
"(",
")",
"{",
"return",
"project",
";",
"}",
"public",
"Control",
"createControls",
"(",
")",
"{",
"Composite",
"projectComposite",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"2",
")",
".",
"equalWidth",
"(",
"false",
")",
".",
"applyTo",
"(",
"projectComposite",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"false",
")",
".",
"applyTo",
"(",
"projectComposite",
")",
";",
"Label",
"projectLabel",
"=",
"new",
"Label",
"(",
"projectComposite",
",",
"SWT",
".",
"NONE",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"align",
"(",
"SWT",
".",
"LEFT",
",",
"SWT",
".",
"CENTER",
")",
".",
"grab",
"(",
"false",
",",
"false",
")",
".",
"applyTo",
"(",
"projectLabel",
")",
";",
"projectLabel",
".",
"setText",
"(",
"\"Project:",
"\"",
")",
";",
"createProjectDisplayControl",
"(",
"projectComposite",
")",
";",
"return",
"projectComposite",
";",
"}",
"protected",
"void",
"createProjectDisplayControl",
"(",
"Composite",
"parent",
")",
"{",
"Label",
"projectLabel",
"=",
"new",
"Label",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"align",
"(",
"SWT",
".",
"LEFT",
",",
"SWT",
".",
"CENTER",
")",
".",
"grab",
"(",
"false",
",",
"false",
")",
".",
"applyTo",
"(",
"projectLabel",
")",
";",
"String",
"labelVal",
"=",
"project",
"!=",
"null",
"?",
"project",
".",
"getName",
"(",
")",
":",
"NO_PROJECT",
";",
"projectLabel",
".",
"setText",
"(",
"labelVal",
")",
";",
"}",
"public",
"IProject",
"setProject",
"(",
"IProject",
"project",
")",
"{",
"this",
".",
"project",
"=",
"project",
";",
"return",
"project",
";",
"}",
"}",
"</s>"
] |
6,210 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"browser",
".",
"Browser",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"StyledText",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"KeyEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"KeyListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"public",
"class",
"DocumentDialogueControl",
"extends",
"AbstractControlManager",
"{",
"private",
"String",
"initialValue",
";",
"private",
"IDialogueControlDescriptor",
"descriptor",
";",
"public",
"DocumentDialogueControl",
"(",
"IDialogueControlDescriptor",
"descriptor",
",",
"Point",
"offsetLabelLocation",
",",
"String",
"initialValue",
")",
"{",
"this",
".",
"descriptor",
"=",
"descriptor",
";",
"this",
".",
"initialValue",
"=",
"initialValue",
";",
"}",
"protected",
"void",
"setControlValue",
"(",
"Control",
"control",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"control",
"instanceof",
"Browser",
"&&",
"value",
"instanceof",
"String",
")",
"{",
"(",
"(",
"Browser",
")",
"control",
")",
".",
"setText",
"(",
"(",
"String",
")",
"value",
")",
";",
"}",
"}",
"protected",
"int",
"numberofColumns",
"(",
")",
"{",
"return",
"1",
";",
"}",
"protected",
"int",
"getDocumentControlHeight",
"(",
")",
"{",
"return",
"100",
";",
"}",
"protected",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"createManagedControls",
"(",
"Composite",
"parent",
")",
"{",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"controls",
"=",
"new",
"HashMap",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"(",
")",
";",
"if",
"(",
"descriptor",
"!=",
"null",
")",
"{",
"Composite",
"labelArea",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"numberofColumns",
"(",
")",
")",
".",
"margins",
"(",
"0",
",",
"0",
")",
".",
"equalWidth",
"(",
"false",
")",
".",
"applyTo",
"(",
"labelArea",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"applyTo",
"(",
"labelArea",
")",
";",
"Label",
"parameterNameLabel",
"=",
"new",
"Label",
"(",
"labelArea",
",",
"SWT",
".",
"READ_ONLY",
")",
";",
"parameterNameLabel",
".",
"setText",
"(",
"descriptor",
".",
"getLabel",
"(",
")",
"+",
"\":",
"\"",
")",
";",
"parameterNameLabel",
".",
"setToolTipText",
"(",
"descriptor",
".",
"getToolTipText",
"(",
")",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"false",
",",
"false",
")",
".",
"align",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
")",
".",
"applyTo",
"(",
"parameterNameLabel",
")",
";",
"final",
"StyledText",
"styledText",
"=",
"new",
"StyledText",
"(",
"labelArea",
",",
"SWT",
".",
"BORDER",
"|",
"SWT",
".",
"MULTI",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"minSize",
"(",
"SWT",
".",
"DEFAULT",
",",
"getDocumentControlHeight",
"(",
")",
")",
".",
"applyTo",
"(",
"styledText",
")",
";",
"styledText",
".",
"setVisible",
"(",
"true",
")",
";",
"styledText",
".",
"addKeyListener",
"(",
"new",
"KeyListener",
"(",
")",
"{",
"public",
"void",
"keyReleased",
"(",
"KeyEvent",
"e",
")",
"{",
"notifyControlChange",
"(",
"styledText",
".",
"getText",
"(",
")",
",",
"styledText",
")",
";",
"}",
"public",
"void",
"keyPressed",
"(",
"KeyEvent",
"e",
")",
"{",
"}",
"}",
")",
";",
"if",
"(",
"initialValue",
"!=",
"null",
")",
"{",
"styledText",
".",
"setText",
"(",
"initialValue",
")",
";",
"}",
"controls",
".",
"put",
"(",
"styledText",
",",
"descriptor",
")",
";",
"}",
"return",
"controls",
";",
"}",
"}",
"</s>"
] |
6,211 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"public",
"interface",
"IDialogueControlManager",
"{",
"public",
"Composite",
"createControlArea",
"(",
"Composite",
"parent",
")",
";",
"public",
"void",
"setEnabled",
"(",
"boolean",
"disable",
")",
";",
"public",
"void",
"addSelectionListener",
"(",
"IControlSelectionListener",
"listener",
")",
";",
"}",
"</s>"
] |
6,212 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"public",
"class",
"ButtonDialogueControl",
"extends",
"AbstractControlManager",
"{",
"private",
"Button",
"boolButton",
";",
"private",
"IDialogueControlDescriptor",
"descriptor",
";",
"private",
"boolean",
"initialValue",
";",
"private",
"int",
"buttonType",
";",
"public",
"ButtonDialogueControl",
"(",
"IDialogueControlDescriptor",
"descriptor",
",",
"int",
"buttonType",
",",
"boolean",
"initialValue",
")",
"{",
"this",
".",
"descriptor",
"=",
"descriptor",
";",
"this",
".",
"buttonType",
"=",
"buttonType",
";",
"this",
".",
"initialValue",
"=",
"initialValue",
";",
"}",
"protected",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"createManagedControls",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"baseCommandArea",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"1",
")",
".",
"applyTo",
"(",
"baseCommandArea",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"applyTo",
"(",
"baseCommandArea",
")",
";",
"boolButton",
"=",
"new",
"Button",
"(",
"baseCommandArea",
",",
"buttonType",
")",
";",
"boolButton",
".",
"setText",
"(",
"descriptor",
".",
"getLabel",
"(",
")",
")",
";",
"boolButton",
".",
"setData",
"(",
"descriptor",
")",
";",
"boolButton",
".",
"setSelection",
"(",
"initialValue",
")",
";",
"boolButton",
".",
"setToolTipText",
"(",
"descriptor",
".",
"getToolTipText",
"(",
")",
")",
";",
"GridData",
"gd",
"=",
"new",
"GridData",
"(",
")",
";",
"gd",
".",
"horizontalAlignment",
"=",
"GridData",
".",
"FILL",
";",
"gd",
".",
"grabExcessHorizontalSpace",
"=",
"false",
";",
"gd",
".",
"horizontalSpan",
"=",
"1",
";",
"boolButton",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"boolButton",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"notifyControlChange",
"(",
"new",
"Boolean",
"(",
"boolButton",
".",
"getSelection",
"(",
")",
")",
",",
"boolButton",
")",
";",
"}",
"}",
")",
";",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"controls",
"=",
"new",
"HashMap",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"(",
")",
";",
"controls",
".",
"put",
"(",
"boolButton",
",",
"descriptor",
")",
";",
"return",
"controls",
";",
"}",
"}",
"</s>"
] |
6,213 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"public",
"class",
"DialogueDescriptor",
"{",
"private",
"String",
"message",
";",
"private",
"String",
"title",
";",
"private",
"String",
"iconLocation",
";",
"public",
"DialogueDescriptor",
"(",
"String",
"message",
",",
"String",
"title",
",",
"String",
"iconLocation",
")",
"{",
"super",
"(",
")",
";",
"this",
".",
"message",
"=",
"message",
";",
"this",
".",
"title",
"=",
"title",
";",
"this",
".",
"iconLocation",
"=",
"iconLocation",
";",
"}",
"public",
"String",
"getMessage",
"(",
")",
"{",
"return",
"message",
";",
"}",
"public",
"String",
"getTitle",
"(",
")",
"{",
"return",
"title",
";",
"}",
"public",
"String",
"getIconLocation",
"(",
")",
"{",
"return",
"iconLocation",
";",
"}",
"}",
"</s>"
] |
6,214 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"public",
"enum",
"ControlTypes",
"implements",
"IDialogueControlDescriptor",
"{",
"NAME",
"(",
"\"Name\"",
",",
"\"\"",
")",
",",
"DECLARING_TYPE",
"(",
"\"\"",
",",
"\"\"",
")",
",",
"TYPE",
"(",
"\"Type\"",
",",
"\"\"",
")",
",",
"IS_STATIC",
"(",
"\"",
"Is",
"static\"",
",",
"\"\"",
")",
",",
"PROPERTY",
"(",
"\"Property\"",
",",
"\"\"",
")",
",",
"METHOD",
"(",
"\"Method\"",
",",
"\"\"",
")",
",",
"PARAMETERS",
"(",
"\"Parameters\"",
",",
"\"\"",
")",
",",
"USE_NAMED_ARGUMENTS",
"(",
"\"\"",
",",
"\"\"",
")",
",",
"DOC",
"(",
"\"Doc\"",
",",
"\"\"",
")",
",",
"ADD",
"(",
"\"Add\"",
",",
"\"Add",
"item\"",
")",
",",
"REMOVE",
"(",
"\"Remove\"",
",",
"\"\"",
")",
",",
"EDIT",
"(",
"\"Edit\"",
",",
"\"\"",
")",
",",
"UP",
"(",
"\"Up\"",
",",
"\"\"",
")",
",",
"DOWN",
"(",
"\"Down\"",
",",
"\"\"",
")",
";",
"private",
"String",
"label",
";",
"private",
"String",
"toolTipText",
";",
"private",
"ControlTypes",
"(",
"String",
"label",
",",
"String",
"toolTipText",
")",
"{",
"this",
".",
"label",
"=",
"label",
";",
"this",
".",
"toolTipText",
"=",
"toolTipText",
";",
"}",
"public",
"String",
"getLabel",
"(",
")",
"{",
"return",
"label",
";",
"}",
"public",
"String",
"getToolTipText",
"(",
")",
"{",
"return",
"toolTipText",
";",
"}",
"}",
"</s>"
] |
6,215 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"Dialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"IDialogConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"TitleAreaDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"JFaceResources",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Font",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"FontMetrics",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"GC",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"abstract",
"class",
"AbstractDialogue",
"extends",
"TitleAreaDialog",
"{",
"private",
"Map",
"<",
"IDialogueControlDescriptor",
",",
"SetValue",
">",
"invalidValues",
";",
"protected",
"static",
"final",
"String",
"EMPTY_ERROR_MESSAGE",
"=",
"\"",
"\"",
";",
"public",
"AbstractDialogue",
"(",
"Shell",
"parentShell",
")",
"{",
"super",
"(",
"parentShell",
")",
";",
"}",
"abstract",
"protected",
"DialogueDescriptor",
"getDialogueDescriptor",
"(",
")",
";",
"protected",
"boolean",
"isResizable",
"(",
")",
"{",
"return",
"true",
";",
"}",
"protected",
"String",
"iconLocation",
"(",
")",
"{",
"return",
"null",
";",
"}",
"protected",
"Control",
"createDialogArea",
"(",
"Composite",
"parent",
")",
"{",
"invalidValues",
"=",
"new",
"HashMap",
"<",
"IDialogueControlDescriptor",
",",
"SetValue",
">",
"(",
")",
";",
"DialogueDescriptor",
"descriptor",
"=",
"getDialogueDescriptor",
"(",
")",
";",
"setTitle",
"(",
"descriptor",
".",
"getTitle",
"(",
")",
")",
";",
"setMessage",
"(",
"descriptor",
".",
"getMessage",
"(",
")",
")",
";",
"String",
"iconLocation",
"=",
"descriptor",
".",
"getIconLocation",
"(",
")",
";",
"if",
"(",
"iconLocation",
"!=",
"null",
"&&",
"iconLocation",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"setTitleImage",
"(",
"GroovyDSLCoreActivator",
".",
"getImageDescriptor",
"(",
"iconLocation",
")",
".",
"createImage",
"(",
")",
")",
";",
"}",
"Composite",
"composite",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"margins",
"(",
"getDefaultCompositeHMargin",
"(",
")",
",",
"getDefaultCompositeVMargin",
"(",
")",
")",
".",
"spacing",
"(",
"convertHorizontalDLUsToPixels",
"(",
"IDialogConstants",
".",
"HORIZONTAL_SPACING",
")",
",",
"convertVerticalDLUsToPixels",
"(",
"IDialogConstants",
".",
"VERTICAL_SPACING",
")",
")",
".",
"applyTo",
"(",
"composite",
")",
";",
"Dialog",
".",
"applyDialogFont",
"(",
"composite",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"applyTo",
"(",
"composite",
")",
";",
"createCommandArea",
"(",
"composite",
")",
";",
"return",
"composite",
";",
"}",
"protected",
"Control",
"createContents",
"(",
"Composite",
"parent",
")",
"{",
"Control",
"control",
"=",
"super",
".",
"createContents",
"(",
"parent",
")",
";",
"if",
"(",
"invalidValues",
"!=",
"null",
")",
"{",
"for",
"(",
"SetValue",
"setValue",
":",
"invalidValues",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"setValue",
".",
"getValue",
"(",
")",
"==",
"null",
")",
"{",
"enableOKButton",
"(",
"false",
")",
";",
"}",
"}",
"}",
"return",
"control",
";",
"}",
"protected",
"Point",
"getOffsetLabelLocation",
"(",
"String",
"[",
"]",
"labels",
")",
"{",
"int",
"length",
"=",
"SWT",
".",
"DEFAULT",
";",
"int",
"charLength",
"=",
"0",
";",
"for",
"(",
"String",
"label",
":",
"labels",
")",
"{",
"int",
"nameLength",
"=",
"label",
".",
"length",
"(",
")",
";",
"if",
"(",
"nameLength",
">",
"charLength",
")",
"{",
"charLength",
"=",
"nameLength",
";",
"}",
"}",
"if",
"(",
"charLength",
">",
"0",
")",
"{",
"Control",
"control",
"=",
"getShell",
"(",
")",
";",
"GC",
"gc",
"=",
"new",
"GC",
"(",
"control",
")",
";",
"Font",
"requiredLabelFont",
"=",
"getRequiredParameterFont",
"(",
")",
";",
"gc",
".",
"setFont",
"(",
"requiredLabelFont",
"!=",
"null",
"?",
"requiredLabelFont",
":",
"control",
".",
"getFont",
"(",
")",
")",
";",
"FontMetrics",
"fontMetrics",
"=",
"gc",
".",
"getFontMetrics",
"(",
")",
";",
"length",
"=",
"Dialog",
".",
"convertWidthInCharsToPixels",
"(",
"fontMetrics",
",",
"charLength",
")",
";",
"gc",
".",
"dispose",
"(",
")",
";",
"}",
"Point",
"longestLabelWidth",
"=",
"new",
"Point",
"(",
"length",
",",
"-",
"1",
")",
";",
"longestLabelWidth",
".",
"x",
"+=",
"getLabelNameSeparatorOffset",
"(",
")",
";",
"return",
"longestLabelWidth",
";",
"}",
"protected",
"int",
"getLabelNameSeparatorOffset",
"(",
")",
"{",
"return",
"5",
";",
"}",
"protected",
"Font",
"getRequiredParameterFont",
"(",
")",
"{",
"return",
"JFaceResources",
".",
"getFontRegistry",
"(",
")",
".",
"getBold",
"(",
"JFaceResources",
".",
"DIALOG_FONT",
")",
";",
"}",
"protected",
"int",
"getDefaultCompositeVMargin",
"(",
")",
"{",
"return",
"convertVerticalDLUsToPixels",
"(",
"IDialogConstants",
".",
"VERTICAL_MARGIN",
")",
";",
"}",
"protected",
"int",
"getDefaultCompositeHMargin",
"(",
")",
"{",
"return",
"convertHorizontalDLUsToPixels",
"(",
"IDialogConstants",
".",
"HORIZONTAL_MARGIN",
")",
";",
"}",
"abstract",
"protected",
"void",
"createCommandArea",
"(",
"Composite",
"parent",
")",
";",
"abstract",
"protected",
"class",
"ValidatedValueSelectionListener",
"implements",
"IControlSelectionListener",
"{",
"public",
"ValidatedValueSelectionListener",
"(",
")",
"{",
"}",
"public",
"ValidatedValueSelectionListener",
"(",
"IDialogueControlDescriptor",
"descriptor",
",",
"Object",
"initialValue",
")",
"{",
"if",
"(",
"descriptor",
"!=",
"null",
")",
"{",
"invalidValues",
".",
"put",
"(",
"descriptor",
",",
"new",
"SetValue",
"(",
"initialValue",
",",
"null",
")",
")",
";",
"}",
"}",
"public",
"void",
"handleSelection",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"handleValidatedValue",
"(",
"event",
")",
";",
"notifyValidValueSet",
"(",
"event",
".",
"getControlDescriptor",
"(",
")",
",",
"event",
".",
"getSelectionData",
"(",
")",
")",
";",
"}",
"public",
"void",
"handleInvalidSelection",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"IDialogueControlDescriptor",
"descriptor",
"=",
"event",
".",
"getControlDescriptor",
"(",
")",
";",
"invalidValues",
".",
"put",
"(",
"descriptor",
",",
"new",
"SetValue",
"(",
"event",
".",
"getSelectionData",
"(",
")",
",",
"event",
".",
"getErrorMessage",
"(",
")",
")",
")",
";",
"displayInvalidValueError",
"(",
"descriptor",
",",
"event",
".",
"getErrorMessage",
"(",
")",
",",
"true",
")",
";",
"}",
"abstract",
"protected",
"void",
"handleValidatedValue",
"(",
"ControlSelectionEvent",
"event",
")",
";",
"}",
"protected",
"void",
"notifyValidValueSet",
"(",
"IDialogueControlDescriptor",
"descriptor",
",",
"Object",
"value",
")",
"{",
"invalidValues",
".",
"remove",
"(",
"descriptor",
")",
";",
"if",
"(",
"invalidValues",
"!=",
"null",
")",
"{",
"for",
"(",
"Entry",
"<",
"IDialogueControlDescriptor",
",",
"SetValue",
">",
"entry",
":",
"invalidValues",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
".",
"getValue",
"(",
")",
"==",
"null",
")",
"{",
"displayInvalidValueError",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
".",
"getErrorMessage",
"(",
")",
",",
"true",
")",
";",
"return",
";",
"}",
"}",
"}",
"setErrorMessage",
"(",
"null",
")",
";",
"enableOKButton",
"(",
"true",
")",
";",
"}",
"protected",
"void",
"displayInvalidValueError",
"(",
"IDialogueControlDescriptor",
"descriptor",
",",
"String",
"errorMessage",
",",
"boolean",
"displayErrorMessage",
")",
"{",
"StringBuffer",
"missingFields",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"missingFields",
".",
"append",
"(",
"\"Value",
"(\"",
")",
";",
"missingFields",
".",
"append",
"(",
"descriptor",
".",
"getLabel",
"(",
")",
")",
";",
"missingFields",
".",
"append",
"(",
"')'",
")",
";",
"if",
"(",
"errorMessage",
"!=",
"null",
"&&",
"errorMessage",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"missingFields",
".",
"append",
"(",
"':'",
")",
";",
"missingFields",
".",
"append",
"(",
"'",
"'",
")",
";",
"missingFields",
".",
"append",
"(",
"errorMessage",
")",
";",
"}",
"else",
"{",
"missingFields",
".",
"append",
"(",
"\"",
"is",
"missing\"",
")",
";",
"}",
"if",
"(",
"displayErrorMessage",
")",
"{",
"setErrorMessage",
"(",
"missingFields",
".",
"toString",
"(",
")",
")",
";",
"}",
"enableOKButton",
"(",
"false",
")",
";",
"}",
"protected",
"void",
"enableOKButton",
"(",
"boolean",
"enable",
")",
"{",
"Button",
"okButton",
"=",
"getButton",
"(",
"IDialogConstants",
".",
"OK_ID",
")",
";",
"if",
"(",
"okButton",
"!=",
"null",
"&&",
"!",
"okButton",
".",
"isDisposed",
"(",
")",
")",
"{",
"okButton",
".",
"setEnabled",
"(",
"enable",
")",
";",
"}",
"}",
"protected",
"class",
"SetValue",
"{",
"private",
"Object",
"value",
";",
"private",
"String",
"errorMessage",
";",
"public",
"SetValue",
"(",
"Object",
"value",
",",
"String",
"errorMessage",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"errorMessage",
"=",
"errorMessage",
";",
"}",
"public",
"Object",
"getValue",
"(",
")",
"{",
"return",
"value",
";",
"}",
"public",
"String",
"getErrorMessage",
"(",
")",
"{",
"return",
"errorMessage",
";",
"}",
"}",
"}",
"</s>"
] |
6,216 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"DuplicateParameterRule",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"MethodParameter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ValueStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"class",
"MethodParameterDialogue",
"extends",
"AbstractDialogue",
"{",
"public",
"static",
"final",
"DialogueDescriptor",
"DIALOGUE_DESCRIPTOR",
"=",
"new",
"DialogueDescriptor",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"private",
"Point",
"labelOffset",
";",
"private",
"String",
"type",
";",
"private",
"String",
"name",
";",
"private",
"IJavaProject",
"javaProject",
";",
"private",
"List",
"<",
"MethodParameter",
">",
"existingParameters",
";",
"public",
"MethodParameterDialogue",
"(",
"Shell",
"parentShell",
",",
"IJavaProject",
"javaProject",
",",
"MethodParameter",
"parameterToEdit",
",",
"List",
"<",
"MethodParameter",
">",
"existingParameters",
")",
"{",
"super",
"(",
"parentShell",
")",
";",
"this",
".",
"javaProject",
"=",
"javaProject",
";",
"if",
"(",
"parameterToEdit",
"!=",
"null",
")",
"{",
"this",
".",
"name",
"=",
"parameterToEdit",
".",
"getName",
"(",
")",
";",
"this",
".",
"type",
"=",
"parameterToEdit",
".",
"getType",
"(",
")",
";",
"}",
"this",
".",
"existingParameters",
"=",
"existingParameters",
";",
"}",
"public",
"MethodParameter",
"getMethodParameter",
"(",
")",
"{",
"return",
"new",
"MethodParameter",
"(",
"name",
",",
"type",
")",
";",
"}",
"protected",
"DialogueDescriptor",
"getDialogueDescriptor",
"(",
")",
"{",
"return",
"DIALOGUE_DESCRIPTOR",
";",
"}",
"protected",
"Point",
"getOffsetLabelLocation",
"(",
")",
"{",
"if",
"(",
"labelOffset",
"==",
"null",
")",
"{",
"IDialogueControlDescriptor",
"[",
"]",
"descriptors",
"=",
"new",
"IDialogueControlDescriptor",
"[",
"]",
"{",
"ControlTypes",
".",
"TYPE",
",",
"ControlTypes",
".",
"NAME",
"}",
";",
"String",
"[",
"]",
"labelNames",
"=",
"new",
"String",
"[",
"descriptors",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"descriptors",
".",
"length",
";",
"++",
"i",
")",
"{",
"labelNames",
"[",
"i",
"]",
"=",
"descriptors",
"[",
"i",
"]",
".",
"getLabel",
"(",
")",
";",
"}",
"labelOffset",
"=",
"getOffsetLabelLocation",
"(",
"labelNames",
")",
";",
"}",
"return",
"labelOffset",
";",
"}",
"protected",
"void",
"createCommandArea",
"(",
"Composite",
"parent",
")",
"{",
"JavaTextControl",
"nameControl",
"=",
"new",
"JavaTextControl",
"(",
"ControlTypes",
".",
"NAME",
",",
"getOffsetLabelLocation",
"(",
")",
",",
"name",
")",
"{",
"protected",
"ValueStatus",
"isControlValueValid",
"(",
"Control",
"control",
")",
"{",
"ValueStatus",
"status",
"=",
"super",
".",
"isControlValueValid",
"(",
"control",
")",
";",
"if",
"(",
"!",
"status",
".",
"isError",
"(",
")",
")",
"{",
"status",
"=",
"new",
"DuplicateParameterRule",
"(",
"existingParameters",
")",
".",
"checkValidity",
"(",
"status",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"status",
";",
"}",
"}",
";",
"nameControl",
".",
"createControlArea",
"(",
"parent",
")",
";",
"nameControl",
".",
"addSelectionListener",
"(",
"new",
"ValidatedValueSelectionListener",
"(",
"ControlTypes",
".",
"NAME",
",",
"name",
")",
"{",
"protected",
"void",
"handleValidatedValue",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"Object",
"selection",
"=",
"event",
".",
"getSelectionData",
"(",
")",
";",
"if",
"(",
"selection",
"instanceof",
"String",
")",
"{",
"name",
"=",
"(",
"String",
")",
"selection",
";",
"}",
"}",
"}",
")",
";",
"JavaTypeBrowsingControl",
"typeControl",
"=",
"new",
"JavaTypeBrowsingControl",
"(",
"ControlTypes",
".",
"TYPE",
",",
"getOffsetLabelLocation",
"(",
")",
",",
"type",
",",
"javaProject",
")",
"{",
"protected",
"ValueStatus",
"isControlValueValid",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"ValueStatus",
".",
"getValidStatus",
"(",
"value",
")",
";",
"}",
"return",
"super",
".",
"isControlValueValid",
"(",
"value",
")",
";",
"}",
"}",
";",
"typeControl",
".",
"createControlArea",
"(",
"parent",
")",
";",
"typeControl",
".",
"addSelectionListener",
"(",
"new",
"ValidatedValueSelectionListener",
"(",
")",
"{",
"protected",
"void",
"handleValidatedValue",
"(",
"ControlSelectionEvent",
"event",
")",
"{",
"Object",
"selection",
"=",
"event",
".",
"getSelectionData",
"(",
")",
";",
"if",
"(",
"selection",
"instanceof",
"String",
")",
"{",
"type",
"=",
"(",
"String",
")",
"selection",
";",
"}",
"}",
"}",
")",
";",
"}",
"}",
"</s>"
] |
6,217 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ValueStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"abstract",
"class",
"AbstractControlManager",
"implements",
"IDialogueControlManager",
"{",
"private",
"IControlSelectionListener",
"listener",
";",
"private",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"controls",
";",
"private",
"Shell",
"shell",
";",
"protected",
"ValueStatus",
"isControlValueValid",
"(",
"Control",
"control",
")",
"{",
"return",
"null",
";",
"}",
"protected",
"void",
"notifyControlChange",
"(",
"Object",
"value",
",",
"Control",
"control",
")",
"{",
"if",
"(",
"listener",
"!=",
"null",
"&&",
"handleInvalidCheck",
"(",
"control",
")",
")",
"{",
"IDialogueControlDescriptor",
"descriptor",
"=",
"controls",
".",
"get",
"(",
"control",
")",
";",
"ControlSelectionEvent",
"event",
"=",
"new",
"ControlSelectionEvent",
"(",
"value",
",",
"descriptor",
")",
";",
"listener",
".",
"handleSelection",
"(",
"event",
")",
";",
"}",
"}",
"protected",
"boolean",
"handleInvalidCheck",
"(",
"Control",
"control",
")",
"{",
"if",
"(",
"control",
"!=",
"null",
")",
"{",
"ValueStatus",
"status",
"=",
"isControlValueValid",
"(",
"control",
")",
";",
"if",
"(",
"status",
"!=",
"null",
"&&",
"status",
".",
"isError",
"(",
")",
")",
"{",
"IDialogueControlDescriptor",
"descriptor",
"=",
"controls",
".",
"get",
"(",
"control",
")",
";",
"ControlSelectionEvent",
"event",
"=",
"new",
"ControlSelectionEvent",
"(",
"descriptor",
",",
"status",
".",
"getMessage",
"(",
")",
")",
";",
"listener",
".",
"handleInvalidSelection",
"(",
"event",
")",
";",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"public",
"Composite",
"createControlArea",
"(",
"Composite",
"parent",
")",
"{",
"controls",
"=",
"new",
"HashMap",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"(",
")",
";",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"createdControls",
"=",
"createManagedControls",
"(",
"parent",
")",
";",
"if",
"(",
"createdControls",
"!=",
"null",
")",
"{",
"controls",
".",
"putAll",
"(",
"createdControls",
")",
";",
"}",
"shell",
"=",
"parent",
".",
"getShell",
"(",
")",
";",
"return",
"parent",
";",
"}",
"protected",
"Shell",
"getShell",
"(",
")",
"{",
"return",
"shell",
";",
"}",
"public",
"void",
"setEnabled",
"(",
"boolean",
"enable",
")",
"{",
"if",
"(",
"controls",
"!=",
"null",
")",
"{",
"for",
"(",
"Control",
"control",
":",
"controls",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"!",
"control",
".",
"isDisposed",
"(",
")",
")",
"{",
"control",
".",
"setEnabled",
"(",
"enable",
")",
";",
"}",
"}",
"}",
"}",
"public",
"void",
"addSelectionListener",
"(",
"IControlSelectionListener",
"listener",
")",
"{",
"this",
".",
"listener",
"=",
"listener",
";",
"}",
"abstract",
"protected",
"Map",
"<",
"Control",
",",
"IDialogueControlDescriptor",
">",
"createManagedControls",
"(",
"Composite",
"parent",
")",
";",
"}",
"</s>"
] |
6,218 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"public",
"interface",
"IDialogueControlDescriptor",
"{",
"public",
"String",
"getLabel",
"(",
")",
";",
"public",
"String",
"getToolTipText",
"(",
")",
";",
"}",
"</s>"
] |
6,219 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
";",
"public",
"interface",
"IControlSelectionListener",
"{",
"public",
"void",
"handleSelection",
"(",
"ControlSelectionEvent",
"event",
")",
";",
"public",
"void",
"handleInvalidSelection",
"(",
"ControlSelectionEvent",
"event",
")",
";",
"}",
"</s>"
] |
6,220 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"public",
"class",
"ValueStatus",
"{",
"private",
"Object",
"value",
";",
"private",
"IStatus",
"status",
";",
"protected",
"ValueStatus",
"(",
"Object",
"value",
",",
"IStatus",
"status",
")",
"{",
"this",
".",
"status",
"=",
"status",
";",
"this",
".",
"value",
"=",
"value",
";",
"}",
"public",
"static",
"ValueStatus",
"getErrorStatus",
"(",
"Object",
"value",
")",
"{",
"return",
"new",
"ValueStatus",
"(",
"value",
",",
"getErrorStatus",
"(",
"null",
")",
")",
";",
"}",
"public",
"static",
"ValueStatus",
"getErrorStatus",
"(",
"Object",
"value",
",",
"String",
"message",
")",
"{",
"return",
"new",
"ValueStatus",
"(",
"value",
",",
"getErrorStatus",
"(",
"message",
")",
")",
";",
"}",
"protected",
"static",
"IStatus",
"getErrorStatus",
"(",
"String",
"message",
")",
"{",
"return",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"GroovyDSLCoreActivator",
".",
"PLUGIN_ID",
",",
"message",
")",
";",
"}",
"public",
"static",
"ValueStatus",
"getValidStatus",
"(",
"Object",
"value",
")",
"{",
"return",
"new",
"ValueStatus",
"(",
"value",
",",
"Status",
".",
"OK_STATUS",
")",
";",
"}",
"public",
"String",
"getMessage",
"(",
")",
"{",
"return",
"status",
".",
"getMessage",
"(",
")",
";",
"}",
"public",
"boolean",
"isError",
"(",
")",
"{",
"return",
"status",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"ERROR",
";",
"}",
"public",
"boolean",
"isWarning",
"(",
")",
"{",
"return",
"status",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"WARNING",
";",
"}",
"public",
"Object",
"getValue",
"(",
")",
"{",
"return",
"value",
";",
"}",
"protected",
"static",
"IStatus",
"getWarningStatus",
"(",
"String",
"message",
")",
"{",
"return",
"new",
"Status",
"(",
"IStatus",
".",
"WARNING",
",",
"GroovyDSLCoreActivator",
".",
"PLUGIN_ID",
",",
"message",
")",
";",
"}",
"}",
"</s>"
] |
6,221 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"preferencepage",
";",
"public",
"interface",
"ISuggestionLabel",
"{",
"public",
"abstract",
"String",
"getLabel",
"(",
")",
";",
"}",
"</s>"
] |
6,222 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"preferencepage",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"GroovyMethodSuggestion",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"MethodParameter",
";",
"public",
"class",
"MethodSuggestionLabel",
"extends",
"AbstractSuggestionLabel",
"{",
"private",
"GroovyMethodSuggestion",
"suggestion",
";",
"public",
"MethodSuggestionLabel",
"(",
"GroovyMethodSuggestion",
"suggestion",
")",
"{",
"this",
".",
"suggestion",
"=",
"suggestion",
";",
"}",
"protected",
"String",
"constructName",
"(",
")",
"{",
"if",
"(",
"suggestion",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"name",
"=",
"suggestion",
".",
"getName",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"name",
")",
";",
"String",
"typeName",
"=",
"suggestion",
".",
"getType",
"(",
")",
";",
"if",
"(",
"typeName",
"!=",
"null",
"&&",
"typeName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"EMPTY_SPACE",
")",
";",
"buffer",
".",
"append",
"(",
"COLON",
")",
";",
"buffer",
".",
"append",
"(",
"EMPTY_SPACE",
")",
";",
"buffer",
".",
"append",
"(",
"typeName",
")",
";",
"}",
"List",
"<",
"MethodParameter",
">",
"parameters",
"=",
"suggestion",
".",
"getParameters",
"(",
")",
";",
"if",
"(",
"parameters",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"OPEN_PAR",
")",
";",
"int",
"size",
"=",
"parameters",
".",
"size",
"(",
")",
";",
"for",
"(",
"MethodParameter",
"param",
":",
"parameters",
")",
"{",
"String",
"paramType",
"=",
"param",
".",
"getType",
"(",
")",
";",
"if",
"(",
"paramType",
"!=",
"null",
"&&",
"paramType",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"paramType",
")",
";",
"buffer",
".",
"append",
"(",
"EMPTY_SPACE",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"param",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"--",
"size",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"COMMA",
")",
";",
"buffer",
".",
"append",
"(",
"EMPTY_SPACE",
")",
";",
"}",
"}",
"buffer",
".",
"append",
"(",
"CLOSE_PAR",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,223 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"preferencepage",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"GroovyPropertySuggestion",
";",
"public",
"class",
"PropertySuggestionLabel",
"extends",
"AbstractSuggestionLabel",
"{",
"private",
"GroovyPropertySuggestion",
"property",
";",
"public",
"PropertySuggestionLabel",
"(",
"GroovyPropertySuggestion",
"property",
")",
"{",
"this",
".",
"property",
"=",
"property",
";",
"}",
"protected",
"String",
"constructName",
"(",
")",
"{",
"if",
"(",
"property",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"name",
"=",
"property",
".",
"getName",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"name",
")",
";",
"String",
"type",
"=",
"property",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null",
"&&",
"type",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"EMPTY_SPACE",
")",
";",
"buffer",
".",
"append",
"(",
"COLON",
")",
";",
"buffer",
".",
"append",
"(",
"EMPTY_SPACE",
")",
";",
"buffer",
".",
"append",
"(",
"type",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,224 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"preferencepage",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"InferencingSuggestionsManager",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPreferencePage",
";",
"public",
"class",
"InferencingPreferencesPage",
"extends",
"PreferencePage",
"implements",
"IWorkbenchPreferencePage",
"{",
"private",
"IWorkbenchPage",
"page",
";",
"private",
"GroovySuggestionsTable",
"table",
";",
"public",
"static",
"final",
"String",
"PAGE_DESCRIPTION",
"=",
"\"\"",
";",
"public",
"InferencingPreferencesPage",
"(",
")",
"{",
"setDescription",
"(",
"PAGE_DESCRIPTION",
")",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbench",
"workbench",
")",
"{",
"if",
"(",
"workbench",
"!=",
"null",
"&&",
"workbench",
".",
"getActiveWorkbenchWindow",
"(",
")",
"!=",
"null",
")",
"{",
"page",
"=",
"workbench",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getActivePage",
"(",
")",
";",
"}",
"}",
"protected",
"IWorkbenchPage",
"getPage",
"(",
")",
"{",
"return",
"page",
";",
"}",
"protected",
"Control",
"createContents",
"(",
"Composite",
"parent",
")",
"{",
"List",
"<",
"IProject",
">",
"projects",
"=",
"GroovyNature",
".",
"getAllAccessibleGroovyProjects",
"(",
")",
";",
"table",
"=",
"new",
"GroovySuggestionsTable",
"(",
"projects",
")",
";",
"return",
"table",
".",
"createTable",
"(",
"parent",
")",
";",
"}",
"public",
"boolean",
"performOk",
"(",
")",
"{",
"if",
"(",
"super",
".",
"performOk",
"(",
")",
")",
"{",
"IProject",
"project",
"=",
"table",
".",
"getSelectedProject",
"(",
")",
";",
"InferencingSuggestionsManager",
".",
"getInstance",
"(",
")",
".",
"commitChanges",
"(",
"project",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"performCancel",
"(",
")",
"{",
"IProject",
"project",
"=",
"table",
".",
"getSelectedProject",
"(",
")",
";",
"InferencingSuggestionsManager",
".",
"getInstance",
"(",
")",
".",
"restoreSuggestions",
"(",
"project",
")",
";",
"return",
"super",
".",
"performCancel",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,225 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"preferencepage",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"GroovyMethodSuggestion",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"GroovyPropertySuggestion",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"IGroovySuggestion",
";",
"public",
"class",
"SuggestionLabelFactory",
"{",
"public",
"ISuggestionLabel",
"getSuggestionLabel",
"(",
"IGroovySuggestion",
"suggestion",
")",
"{",
"if",
"(",
"suggestion",
"instanceof",
"GroovyMethodSuggestion",
")",
"{",
"return",
"new",
"MethodSuggestionLabel",
"(",
"(",
"GroovyMethodSuggestion",
")",
"suggestion",
")",
";",
"}",
"else",
"if",
"(",
"suggestion",
"instanceof",
"GroovyPropertySuggestion",
")",
"{",
"return",
"new",
"PropertySuggestionLabel",
"(",
"(",
"GroovyPropertySuggestion",
")",
"suggestion",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
6,226 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"preferencepage",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"PixelConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ICheckStateProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Tree",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"TreeColumn",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"ContainerCheckedTreeViewer",
";",
"public",
"class",
"SuggestionsViewer",
"{",
"private",
"ContainerCheckedTreeViewer",
"viewer",
";",
"private",
"ITreeViewerColumn",
"[",
"]",
"columns",
";",
"private",
"ColumnSortListener",
"columnListener",
";",
"private",
"ITreeViewerColumn",
"defaultSortColumn",
";",
"public",
"SuggestionsViewer",
"(",
"ITreeViewerColumn",
"[",
"]",
"columns",
",",
"ITreeViewerColumn",
"defaultSortColumn",
")",
"{",
"this",
".",
"defaultSortColumn",
"=",
"defaultSortColumn",
";",
"this",
".",
"columns",
"=",
"columns",
";",
"}",
"protected",
"int",
"getConfiguration",
"(",
")",
"{",
"return",
"SWT",
".",
"BORDER",
"|",
"SWT",
".",
"MULTI",
"|",
"SWT",
".",
"FULL_SELECTION",
"|",
"SWT",
".",
"H_SCROLL",
"|",
"SWT",
".",
"V_SCROLL",
"|",
"SWT",
".",
"CHECK",
";",
"}",
"protected",
"ICheckStateProvider",
"getCheckStateProvider",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"void",
"createControls",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"treeComposite",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"applyTo",
"(",
"treeComposite",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"applyTo",
"(",
"treeComposite",
")",
";",
"Tree",
"tree",
"=",
"new",
"Tree",
"(",
"treeComposite",
",",
"getConfiguration",
"(",
")",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"hint",
"(",
"SWT",
".",
"DEFAULT",
",",
"getHeightHint",
"(",
")",
")",
".",
"applyTo",
"(",
"tree",
")",
";",
"viewer",
"=",
"new",
"ContainerCheckedTreeViewer",
"(",
"tree",
")",
";",
"if",
"(",
"columns",
"!=",
"null",
"&&",
"columns",
".",
"length",
">",
"0",
")",
"{",
"PixelConverter",
"converter",
"=",
"new",
"PixelConverter",
"(",
"treeComposite",
")",
";",
"for",
"(",
"ITreeViewerColumn",
"column",
":",
"columns",
")",
"{",
"if",
"(",
"column",
"!=",
"null",
")",
"{",
"TreeColumn",
"treeColumn",
"=",
"new",
"TreeColumn",
"(",
"tree",
",",
"SWT",
".",
"NONE",
")",
";",
"treeColumn",
".",
"setResizable",
"(",
"true",
")",
";",
"treeColumn",
".",
"setWidth",
"(",
"converter",
".",
"convertWidthInCharsToPixels",
"(",
"column",
".",
"getWidth",
"(",
")",
")",
")",
";",
"treeColumn",
".",
"setText",
"(",
"column",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"}",
"TreeColumn",
"sortColumn",
"=",
"getDefaultSortColumn",
"(",
")",
";",
"if",
"(",
"sortColumn",
"!=",
"null",
")",
"{",
"tree",
".",
"setSortColumn",
"(",
"sortColumn",
")",
";",
"tree",
".",
"setSortDirection",
"(",
"SWT",
".",
"UP",
")",
";",
"}",
"TreeColumn",
"[",
"]",
"columns",
"=",
"viewer",
".",
"getTree",
"(",
")",
".",
"getColumns",
"(",
")",
";",
"if",
"(",
"columnListener",
"!=",
"null",
")",
"{",
"removeListeners",
"(",
")",
";",
"}",
"columnListener",
"=",
"new",
"ColumnSortListener",
"(",
")",
";",
"for",
"(",
"TreeColumn",
"column",
":",
"columns",
")",
"{",
"column",
".",
"addSelectionListener",
"(",
"columnListener",
")",
";",
"}",
"tree",
".",
"setHeaderVisible",
"(",
"true",
")",
";",
"tree",
".",
"setLinesVisible",
"(",
"true",
")",
";",
"viewer",
".",
"refresh",
"(",
")",
";",
"}",
"public",
"ContainerCheckedTreeViewer",
"getTreeViewer",
"(",
")",
"{",
"return",
"viewer",
";",
"}",
"protected",
"int",
"getHeightHint",
"(",
")",
"{",
"return",
"200",
";",
"}",
"protected",
"TreeColumn",
"getDefaultSortColumn",
"(",
")",
"{",
"if",
"(",
"defaultSortColumn",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"sortColumnName",
"=",
"defaultSortColumn",
".",
"getName",
"(",
")",
";",
"if",
"(",
"sortColumnName",
"!=",
"null",
")",
"{",
"Tree",
"tree",
"=",
"viewer",
".",
"getTree",
"(",
")",
";",
"TreeColumn",
"[",
"]",
"columns",
"=",
"tree",
".",
"getColumns",
"(",
")",
";",
"if",
"(",
"columns",
"!=",
"null",
")",
"{",
"for",
"(",
"TreeColumn",
"column",
":",
"columns",
")",
"{",
"if",
"(",
"sortColumnName",
".",
"equals",
"(",
"column",
".",
"getText",
"(",
")",
")",
")",
"{",
"return",
"column",
";",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"void",
"setChecked",
"(",
"Object",
"child",
",",
"boolean",
"newState",
")",
"{",
"viewer",
".",
"setChecked",
"(",
"child",
",",
"newState",
")",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"removeListeners",
"(",
")",
";",
"}",
"protected",
"void",
"removeListeners",
"(",
")",
"{",
"if",
"(",
"columnListener",
"!=",
"null",
")",
"{",
"TreeColumn",
"[",
"]",
"columns",
"=",
"viewer",
".",
"getTree",
"(",
")",
".",
"getColumns",
"(",
")",
";",
"for",
"(",
"TreeColumn",
"column",
":",
"columns",
")",
"{",
"column",
".",
"removeSelectionListener",
"(",
"columnListener",
")",
";",
"}",
"}",
"}",
"protected",
"class",
"ColumnSortListener",
"extends",
"SelectionAdapter",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"if",
"(",
"e",
".",
"widget",
"instanceof",
"TreeColumn",
")",
"{",
"TreeColumn",
"selected",
"=",
"(",
"TreeColumn",
")",
"e",
".",
"widget",
";",
"Tree",
"tree",
"=",
"viewer",
".",
"getTree",
"(",
")",
";",
"TreeColumn",
"current",
"=",
"tree",
".",
"getSortColumn",
"(",
")",
";",
"int",
"newDirection",
"=",
"SWT",
".",
"UP",
";",
"if",
"(",
"current",
"==",
"selected",
")",
"{",
"newDirection",
"=",
"tree",
".",
"getSortDirection",
"(",
")",
"==",
"SWT",
".",
"UP",
"?",
"SWT",
".",
"DOWN",
":",
"SWT",
".",
"UP",
";",
"}",
"else",
"{",
"tree",
".",
"setSortColumn",
"(",
"selected",
")",
";",
"}",
"tree",
".",
"setSortDirection",
"(",
"newDirection",
")",
";",
"viewer",
".",
"refresh",
"(",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
6,227 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"preferencepage",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"GroovyMethodSuggestion",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"GroovyPropertySuggestion",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"GroovySuggestionDeclaringType",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"IBaseGroovySuggestion",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"IGroovySuggestion",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"InferencingSuggestionsManager",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"InferencingSuggestionsManager",
".",
"ProjectSuggestions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"OperationManager",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
".",
"IProjectUIControl",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
".",
"ISelectionHandler",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
".",
"ProjectDropDownControl",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridDataFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"GridLayoutFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"CheckStateChangedEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"CheckboxTreeViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ColumnLabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ICheckStateListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelectionChangedListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ITreePathContentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ITreeViewerListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"SelectionChangedEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"TreeExpansionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"TreePath",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"TreeViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"Viewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ViewerCell",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ViewerSorter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Font",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Point",
";",
"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",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Tree",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"TreeColumn",
";",
"public",
"class",
"GroovySuggestionsTable",
"{",
"private",
"static",
"final",
"String",
"DEACTIVATE_REMOVE_EDIT_OR_ADD_A_TYPE_SUGGESTION",
"=",
"\"\"",
";",
"private",
"Map",
"<",
"ButtonTypes",
",",
"Button",
">",
"selectionButtons",
";",
"private",
"List",
"<",
"IProject",
">",
"projects",
";",
"private",
"IProjectUIControl",
"selector",
";",
"private",
"SuggestionsViewer",
"viewer",
";",
"enum",
"ButtonTypes",
"{",
"EDIT",
"(",
"\"Edit...\"",
")",
",",
"ADD",
"(",
"\"Add...\"",
")",
",",
"REMOVE",
"(",
"\"Remove\"",
")",
",",
"SELECT_ALL",
"(",
"\"Select",
"All\"",
")",
",",
"DESELECT_ALL",
"(",
"\"Deselect",
"All\"",
")",
",",
"COLLAPSE_ALL",
"(",
"\"Collapse",
"All\"",
")",
",",
"EXPAND_ALL",
"(",
"\"Expand",
"All\"",
")",
";",
"private",
"String",
"label",
";",
"private",
"ButtonTypes",
"(",
"String",
"label",
")",
"{",
"this",
".",
"label",
"=",
"label",
";",
"}",
"public",
"String",
"getLabel",
"(",
")",
"{",
"return",
"label",
";",
"}",
"}",
"enum",
"ColumnTypes",
"implements",
"ITreeViewerColumn",
"{",
"SUGGESTIONS",
"(",
"\"Suggestions\"",
",",
"60",
")",
";",
"private",
"String",
"label",
";",
"private",
"int",
"weight",
";",
"private",
"ColumnTypes",
"(",
"String",
"label",
",",
"int",
"weight",
")",
"{",
"this",
".",
"label",
"=",
"label",
";",
"this",
".",
"weight",
"=",
"weight",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"label",
";",
"}",
"public",
"int",
"getWidth",
"(",
")",
"{",
"return",
"weight",
";",
"}",
"}",
"public",
"GroovySuggestionsTable",
"(",
"List",
"<",
"IProject",
">",
"projects",
")",
"{",
"this",
".",
"projects",
"=",
"projects",
"!=",
"null",
"?",
"projects",
":",
"new",
"ArrayList",
"<",
"IProject",
">",
"(",
")",
";",
"}",
"public",
"Composite",
"createTable",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"subparent",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"1",
")",
".",
"equalWidth",
"(",
"false",
")",
".",
"applyTo",
"(",
"subparent",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"applyTo",
"(",
"parent",
")",
";",
"createProjectArea",
"(",
"subparent",
")",
";",
"return",
"createViewerArea",
"(",
"subparent",
")",
";",
"}",
"protected",
"void",
"createProjectArea",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"subparent",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"1",
")",
".",
"equalWidth",
"(",
"false",
")",
".",
"applyTo",
"(",
"subparent",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"false",
",",
"false",
")",
".",
"applyTo",
"(",
"parent",
")",
";",
"ISelectionHandler",
"handler",
"=",
"new",
"ISelectionHandler",
"(",
")",
"{",
"public",
"void",
"selectionChanged",
"(",
"IProject",
"project",
")",
"{",
"setViewerInput",
"(",
"project",
")",
";",
"}",
"}",
";",
"selector",
"=",
"ProjectDropDownControl",
".",
"getProjectSelectionControl",
"(",
"projects",
",",
"parent",
".",
"getShell",
"(",
")",
",",
"subparent",
",",
"handler",
")",
";",
"if",
"(",
"selector",
"!=",
"null",
")",
"{",
"selector",
".",
"createControls",
"(",
")",
";",
"IProject",
"previouslyModifiedProject",
"=",
"InferencingSuggestionsManager",
".",
"getInstance",
"(",
")",
".",
"getlastModifiedProject",
"(",
")",
";",
"if",
"(",
"previouslyModifiedProject",
"!=",
"null",
")",
"{",
"selector",
".",
"setProject",
"(",
"previouslyModifiedProject",
")",
";",
"}",
"}",
"}",
"protected",
"String",
"getViewerLabel",
"(",
")",
"{",
"return",
"DEACTIVATE_REMOVE_EDIT_OR_ADD_A_TYPE_SUGGESTION",
";",
"}",
"public",
"IProject",
"getSelectedProject",
"(",
")",
"{",
"if",
"(",
"selector",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"selector",
".",
"getProject",
"(",
")",
";",
"}",
"protected",
"Composite",
"createViewerArea",
"(",
"Composite",
"parent",
")",
"{",
"String",
"label",
"=",
"getViewerLabel",
"(",
")",
";",
"if",
"(",
"label",
"!=",
"null",
"&&",
"label",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"Label",
"viewerLabel",
"=",
"new",
"Label",
"(",
"parent",
",",
"SWT",
".",
"READ_ONLY",
")",
";",
"viewerLabel",
".",
"setText",
"(",
"label",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"false",
",",
"false",
")",
".",
"align",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
")",
".",
"applyTo",
"(",
"viewerLabel",
")",
";",
"}",
"Composite",
"subparent",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"numColumns",
"(",
"2",
")",
".",
"equalWidth",
"(",
"false",
")",
".",
"applyTo",
"(",
"subparent",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"grab",
"(",
"true",
",",
"true",
")",
".",
"applyTo",
"(",
"parent",
")",
";",
"createTableViewer",
"(",
"subparent",
")",
";",
"createOperationButtonArea",
"(",
"subparent",
")",
";",
"return",
"subparent",
";",
"}",
"protected",
"void",
"collapseAll",
"(",
")",
"{",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"collapseAll",
"(",
")",
";",
"}",
"protected",
"void",
"expandAll",
"(",
")",
"{",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"expandAll",
"(",
")",
";",
"}",
"protected",
"void",
"uncheckAll",
"(",
")",
"{",
"setCheckStateAll",
"(",
"false",
")",
";",
"}",
"protected",
"void",
"checkAll",
"(",
")",
"{",
"setCheckStateAll",
"(",
"true",
")",
";",
"}",
"protected",
"void",
"setCheckStateAll",
"(",
"boolean",
"checkState",
")",
"{",
"IProject",
"project",
"=",
"getSelectedProject",
"(",
")",
";",
"ProjectSuggestions",
"suggestions",
"=",
"InferencingSuggestionsManager",
".",
"getInstance",
"(",
")",
".",
"getSuggestions",
"(",
"project",
")",
";",
"if",
"(",
"suggestions",
"!=",
"null",
")",
"{",
"Collection",
"<",
"GroovySuggestionDeclaringType",
">",
"declaringTypes",
"=",
"suggestions",
".",
"getDeclaringTypes",
"(",
")",
";",
"for",
"(",
"GroovySuggestionDeclaringType",
"declaringType",
":",
"declaringTypes",
")",
"{",
"setActiveState",
"(",
"declaringType",
",",
"checkState",
")",
";",
"refresh",
"(",
")",
";",
"setCheckState",
"(",
"declaringType",
")",
";",
"}",
"}",
"}",
"protected",
"ITreeViewerColumn",
"[",
"]",
"getColumns",
"(",
")",
"{",
"return",
"ColumnTypes",
".",
"values",
"(",
")",
";",
"}",
"protected",
"void",
"createTableViewer",
"(",
"Composite",
"parent",
")",
"{",
"viewer",
"=",
"new",
"SuggestionsViewer",
"(",
"getColumns",
"(",
")",
",",
"ColumnTypes",
".",
"SUGGESTIONS",
")",
";",
"viewer",
".",
"createControls",
"(",
"parent",
")",
";",
"final",
"CheckboxTreeViewer",
"treeViewer",
"=",
"viewer",
".",
"getTreeViewer",
"(",
")",
";",
"treeViewer",
".",
"addCheckStateListener",
"(",
"new",
"ICheckStateListener",
"(",
")",
"{",
"public",
"void",
"checkStateChanged",
"(",
"CheckStateChangedEvent",
"event",
")",
"{",
"Object",
"obj",
"=",
"event",
".",
"getElement",
"(",
")",
";",
"setActiveState",
"(",
"obj",
",",
"event",
".",
"getChecked",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"treeViewer",
".",
"addTreeListener",
"(",
"new",
"ITreeViewerListener",
"(",
")",
"{",
"public",
"void",
"treeExpanded",
"(",
"TreeExpansionEvent",
"event",
")",
"{",
"setCheckState",
"(",
"event",
".",
"getElement",
"(",
")",
")",
";",
"}",
"public",
"void",
"treeCollapsed",
"(",
"TreeExpansionEvent",
"event",
")",
"{",
"}",
"}",
")",
";",
"treeViewer",
".",
"setLabelProvider",
"(",
"new",
"ViewerLabelProvider",
"(",
")",
")",
";",
"treeViewer",
".",
"setContentProvider",
"(",
"new",
"ViewerContentProvider",
"(",
")",
")",
";",
"treeViewer",
".",
"setComparator",
"(",
"new",
"SuggestionViewerSorter",
"(",
")",
")",
";",
"setViewerListeners",
"(",
"treeViewer",
")",
";",
"setViewerInput",
"(",
"getSelectedProject",
"(",
")",
")",
";",
"}",
"protected",
"void",
"setActiveState",
"(",
"Object",
"viewerElement",
",",
"boolean",
"checkState",
")",
"{",
"if",
"(",
"viewerElement",
"instanceof",
"GroovySuggestionDeclaringType",
")",
"{",
"GroovySuggestionDeclaringType",
"declaringType",
"=",
"(",
"GroovySuggestionDeclaringType",
")",
"viewerElement",
";",
"List",
"<",
"IGroovySuggestion",
">",
"suggestions",
"=",
"declaringType",
".",
"getSuggestions",
"(",
")",
";",
"for",
"(",
"IGroovySuggestion",
"suggestion",
":",
"suggestions",
")",
"{",
"suggestion",
".",
"changeActiveState",
"(",
"checkState",
")",
";",
"}",
"}",
"else",
"if",
"(",
"viewerElement",
"instanceof",
"IGroovySuggestion",
")",
"{",
"IGroovySuggestion",
"suggestion",
"=",
"(",
"IGroovySuggestion",
")",
"viewerElement",
";",
"suggestion",
".",
"changeActiveState",
"(",
"checkState",
")",
";",
"}",
"}",
"protected",
"void",
"setCheckState",
"(",
"Object",
"viewerElement",
")",
"{",
"if",
"(",
"viewerElement",
"instanceof",
"GroovySuggestionDeclaringType",
")",
"{",
"GroovySuggestionDeclaringType",
"declaringType",
"=",
"(",
"GroovySuggestionDeclaringType",
")",
"viewerElement",
";",
"List",
"<",
"IGroovySuggestion",
">",
"suggestions",
"=",
"declaringType",
".",
"getSuggestions",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"IGroovySuggestion",
">",
"it",
"=",
"suggestions",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"IGroovySuggestion",
"suggestion",
"=",
"it",
".",
"next",
"(",
")",
";",
"boolean",
"isSuggestionActive",
"=",
"suggestion",
".",
"isActive",
"(",
")",
";",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"setChecked",
"(",
"suggestion",
",",
"isSuggestionActive",
")",
";",
"}",
"}",
"else",
"if",
"(",
"viewerElement",
"instanceof",
"IGroovySuggestion",
")",
"{",
"IGroovySuggestion",
"suggestion",
"=",
"(",
"IGroovySuggestion",
")",
"viewerElement",
";",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"setChecked",
"(",
"suggestion",
",",
"suggestion",
".",
"isActive",
"(",
")",
")",
";",
"}",
"}",
"protected",
"void",
"setViewerListeners",
"(",
"TreeViewer",
"tree",
")",
"{",
"tree",
".",
"addSelectionChangedListener",
"(",
"new",
"ISelectionChangedListener",
"(",
")",
"{",
"public",
"void",
"selectionChanged",
"(",
"SelectionChangedEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getSelection",
"(",
")",
"instanceof",
"IStructuredSelection",
")",
"{",
"IStructuredSelection",
"selection",
"=",
"(",
"IStructuredSelection",
")",
"event",
".",
"getSelection",
"(",
")",
";",
"handleSelectionButtonEnablement",
"(",
"selection",
".",
"toList",
"(",
")",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"protected",
"void",
"handleSelectionButtonEnablement",
"(",
"List",
"<",
"Object",
">",
"selectedObjects",
")",
"{",
"if",
"(",
"projects",
"==",
"null",
"||",
"projects",
".",
"isEmpty",
"(",
")",
")",
"{",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"ADD",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"EDIT",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"REMOVE",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"else",
"if",
"(",
"selectedObjects",
"==",
"null",
"||",
"selectedObjects",
".",
"isEmpty",
"(",
")",
")",
"{",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"ADD",
")",
".",
"setEnabled",
"(",
"true",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"EDIT",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"REMOVE",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"else",
"if",
"(",
"selectedObjects",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"Object",
"selectedObj",
"=",
"selectedObjects",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"selectedObj",
"instanceof",
"GroovySuggestionDeclaringType",
")",
"{",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"ADD",
")",
".",
"setEnabled",
"(",
"true",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"EDIT",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"REMOVE",
")",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"selectedObj",
"instanceof",
"IGroovySuggestion",
")",
"{",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"ADD",
")",
".",
"setEnabled",
"(",
"true",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"EDIT",
")",
".",
"setEnabled",
"(",
"true",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"REMOVE",
")",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"}",
"else",
"{",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"ADD",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"EDIT",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"selectionButtons",
".",
"get",
"(",
"ButtonTypes",
".",
"REMOVE",
")",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"}",
"protected",
"void",
"editSuggestion",
"(",
")",
"{",
"if",
"(",
"getSelections",
"(",
")",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"return",
";",
"}",
"else",
"{",
"if",
"(",
"getSelections",
"(",
")",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"Object",
"selectedObj",
"=",
"getSelections",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"selectedObj",
"instanceof",
"IBaseGroovySuggestion",
")",
"{",
"IBaseGroovySuggestion",
"existingSuggestion",
"=",
"(",
"IBaseGroovySuggestion",
")",
"selectedObj",
";",
"IGroovySuggestion",
"editedSuggestion",
"=",
"new",
"OperationManager",
"(",
")",
".",
"editGroovySuggestion",
"(",
"getSelectedProject",
"(",
")",
",",
"existingSuggestion",
",",
"getShell",
"(",
")",
")",
";",
"if",
"(",
"editedSuggestion",
"!=",
"null",
")",
"{",
"refresh",
"(",
")",
";",
"setCheckState",
"(",
"editedSuggestion",
")",
";",
"}",
"}",
"}",
"}",
"}",
"protected",
"Shell",
"getShell",
"(",
")",
"{",
"return",
"viewer",
"!=",
"null",
"?",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"getTree",
"(",
")",
".",
"getShell",
"(",
")",
":",
"null",
";",
"}",
"protected",
"void",
"addSuggestion",
"(",
")",
"{",
"Object",
"selectedObj",
"=",
"getSelections",
"(",
")",
".",
"size",
"(",
")",
"==",
"1",
"?",
"getSelections",
"(",
")",
".",
"get",
"(",
"0",
")",
":",
"null",
";",
"IBaseGroovySuggestion",
"contextSuggestion",
"=",
"selectedObj",
"instanceof",
"IBaseGroovySuggestion",
"?",
"(",
"IBaseGroovySuggestion",
")",
"selectedObj",
":",
"null",
";",
"IGroovySuggestion",
"suggestion",
"=",
"new",
"OperationManager",
"(",
")",
".",
"addGroovySuggestion",
"(",
"getSelectedProject",
"(",
")",
",",
"contextSuggestion",
",",
"getShell",
"(",
")",
")",
";",
"if",
"(",
"suggestion",
"!=",
"null",
")",
"{",
"refresh",
"(",
")",
";",
"setCheckState",
"(",
"suggestion",
")",
";",
"}",
"}",
"protected",
"void",
"handleButtonSelection",
"(",
"ButtonTypes",
"button",
")",
"{",
"if",
"(",
"button",
"!=",
"null",
")",
"{",
"switch",
"(",
"button",
")",
"{",
"case",
"ADD",
":",
"addSuggestion",
"(",
")",
";",
"break",
";",
"case",
"EDIT",
":",
"editSuggestion",
"(",
")",
";",
"break",
";",
"case",
"COLLAPSE_ALL",
":",
"collapseAll",
"(",
")",
";",
"break",
";",
"case",
"DESELECT_ALL",
":",
"uncheckAll",
"(",
")",
";",
"break",
";",
"case",
"REMOVE",
":",
"handleRemove",
"(",
")",
";",
"break",
";",
"case",
"SELECT_ALL",
":",
"checkAll",
"(",
")",
";",
"break",
";",
"case",
"EXPAND_ALL",
":",
"expandAll",
"(",
")",
";",
"break",
";",
"}",
"}",
"}",
"protected",
"void",
"handleRemove",
"(",
")",
"{",
"List",
"<",
"Object",
">",
"selections",
"=",
"getSelections",
"(",
")",
";",
"List",
"<",
"IBaseGroovySuggestion",
">",
"suggestionsToRemove",
"=",
"new",
"ArrayList",
"<",
"IBaseGroovySuggestion",
">",
"(",
"selections",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Object",
"selection",
":",
"selections",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"IBaseGroovySuggestion",
")",
"{",
"suggestionsToRemove",
".",
"add",
"(",
"(",
"IBaseGroovySuggestion",
")",
"selection",
")",
";",
"}",
"}",
"new",
"OperationManager",
"(",
")",
".",
"removeGroovySuggestion",
"(",
"getSelectedProject",
"(",
")",
",",
"suggestionsToRemove",
")",
";",
"refresh",
"(",
")",
";",
"}",
"protected",
"void",
"setViewerInput",
"(",
"IProject",
"project",
")",
"{",
"if",
"(",
"isViewerDisposed",
"(",
")",
"||",
"project",
"==",
"null",
")",
"{",
"return",
";",
"}",
"ProjectSuggestions",
"suggestions",
"=",
"InferencingSuggestionsManager",
".",
"getInstance",
"(",
")",
".",
"getSuggestions",
"(",
"project",
")",
";",
"if",
"(",
"suggestions",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Collection",
"<",
"GroovySuggestionDeclaringType",
">",
"declaringTypes",
"=",
"suggestions",
".",
"getDeclaringTypes",
"(",
")",
";",
"if",
"(",
"declaringTypes",
"==",
"null",
")",
"{",
"return",
";",
"}",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"setInput",
"(",
"declaringTypes",
")",
";",
"refresh",
"(",
")",
";",
"for",
"(",
"GroovySuggestionDeclaringType",
"declaringType",
":",
"declaringTypes",
")",
"{",
"setCheckState",
"(",
"declaringType",
")",
";",
"}",
"}",
"protected",
"void",
"refresh",
"(",
")",
"{",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"refresh",
"(",
"true",
")",
";",
"expandAll",
"(",
")",
";",
"}",
"protected",
"boolean",
"isViewerDisposed",
"(",
")",
"{",
"if",
"(",
"viewer",
"==",
"null",
"||",
"viewer",
".",
"getTreeViewer",
"(",
")",
"==",
"null",
"||",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"getTree",
"(",
")",
".",
"isDisposed",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"protected",
"static",
"class",
"ViewerContentProvider",
"implements",
"ITreePathContentProvider",
"{",
"public",
"Object",
"[",
"]",
"getElements",
"(",
"Object",
"inputElement",
")",
"{",
"if",
"(",
"inputElement",
"instanceof",
"Collection",
"<",
"?",
">",
")",
"{",
"List",
"<",
"Object",
">",
"suggestedTypes",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"Collection",
"<",
"?",
">",
"topLevel",
"=",
"(",
"Collection",
"<",
"?",
">",
")",
"inputElement",
";",
"for",
"(",
"Object",
"possibleTypeSuggestion",
":",
"topLevel",
")",
"{",
"if",
"(",
"possibleTypeSuggestion",
"instanceof",
"GroovySuggestionDeclaringType",
")",
"{",
"suggestedTypes",
".",
"add",
"(",
"possibleTypeSuggestion",
")",
";",
"}",
"}",
"return",
"suggestedTypes",
".",
"toArray",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"Object",
"[",
"]",
"getChildren",
"(",
"TreePath",
"path",
")",
"{",
"Object",
"lastElement",
"=",
"path",
".",
"getLastSegment",
"(",
")",
";",
"if",
"(",
"lastElement",
"instanceof",
"GroovySuggestionDeclaringType",
")",
"{",
"GroovySuggestionDeclaringType",
"treeElement",
"=",
"(",
"GroovySuggestionDeclaringType",
")",
"lastElement",
";",
"List",
"<",
"IGroovySuggestion",
">",
"properties",
"=",
"treeElement",
".",
"getSuggestions",
"(",
")",
";",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"return",
"properties",
".",
"toArray",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"TreePath",
"[",
"]",
"getParents",
"(",
"Object",
"element",
")",
"{",
"return",
"new",
"TreePath",
"[",
"]",
"{",
"}",
";",
"}",
"public",
"boolean",
"hasChildren",
"(",
"TreePath",
"path",
")",
"{",
"return",
"getChildren",
"(",
"path",
")",
"!=",
"null",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"}",
"public",
"void",
"inputChanged",
"(",
"Viewer",
"viewer",
",",
"Object",
"e1",
",",
"Object",
"e2",
")",
"{",
"}",
"}",
"protected",
"List",
"<",
"Object",
">",
"getSelections",
"(",
")",
"{",
"if",
"(",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"getSelection",
"(",
")",
"instanceof",
"IStructuredSelection",
")",
"{",
"return",
"(",
"(",
"IStructuredSelection",
")",
"viewer",
".",
"getTreeViewer",
"(",
")",
".",
"getSelection",
"(",
")",
")",
".",
"toList",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"EMPTY_LIST",
";",
"}",
"protected",
"static",
"class",
"ViewerLabelProvider",
"extends",
"ColumnLabelProvider",
"{",
"public",
"void",
"update",
"(",
"ViewerCell",
"cell",
")",
"{",
"Object",
"element",
"=",
"cell",
".",
"getElement",
"(",
")",
";",
"int",
"index",
"=",
"cell",
".",
"getColumnIndex",
"(",
")",
";",
"cell",
".",
"setText",
"(",
"getColumnText",
"(",
"element",
",",
"index",
")",
")",
";",
"cell",
".",
"setImage",
"(",
"getColumnImage",
"(",
"element",
",",
"index",
")",
")",
";",
"cell",
".",
"setFont",
"(",
"getFont",
"(",
"element",
")",
")",
";",
"}",
"public",
"Image",
"getColumnImage",
"(",
"Object",
"element",
",",
"int",
"index",
")",
"{",
"return",
"null",
";",
"}",
"public",
"Font",
"getFont",
"(",
"Object",
"element",
")",
"{",
"return",
"super",
".",
"getFont",
"(",
"element",
")",
";",
"}",
"public",
"String",
"getColumnText",
"(",
"Object",
"element",
",",
"int",
"index",
")",
"{",
"ColumnTypes",
"[",
"]",
"values",
"=",
"ColumnTypes",
".",
"values",
"(",
")",
";",
"if",
"(",
"index",
"<",
"values",
".",
"length",
")",
"{",
"ColumnTypes",
"colType",
"=",
"values",
"[",
"index",
"]",
";",
"String",
"text",
"=",
"null",
";",
"switch",
"(",
"colType",
")",
"{",
"case",
"SUGGESTIONS",
":",
"text",
"=",
"getDisplayString",
"(",
"element",
")",
";",
"break",
";",
"}",
"return",
"text",
";",
"}",
"return",
"null",
";",
"}",
"}",
"protected",
"static",
"String",
"getDisplayString",
"(",
"Object",
"element",
")",
"{",
"String",
"text",
"=",
"null",
";",
"if",
"(",
"element",
"instanceof",
"GroovySuggestionDeclaringType",
")",
"{",
"return",
"(",
"(",
"GroovySuggestionDeclaringType",
")",
"element",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"IGroovySuggestion",
")",
"{",
"ISuggestionLabel",
"suggestionLabel",
"=",
"new",
"SuggestionLabelFactory",
"(",
")",
".",
"getSuggestionLabel",
"(",
"(",
"IGroovySuggestion",
")",
"element",
")",
";",
"if",
"(",
"suggestionLabel",
"!=",
"null",
")",
"{",
"text",
"=",
"suggestionLabel",
".",
"getLabel",
"(",
")",
";",
"}",
"}",
"return",
"text",
";",
"}",
"protected",
"void",
"createOperationButtonArea",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"buttons",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"align",
"(",
"GridData",
".",
"CENTER",
",",
"GridData",
".",
"BEGINNING",
")",
".",
"applyTo",
"(",
"buttons",
")",
";",
"GridLayoutFactory",
".",
"fillDefaults",
"(",
")",
".",
"applyTo",
"(",
"buttons",
")",
";",
"ButtonTypes",
"[",
"]",
"types",
"=",
"ButtonTypes",
".",
"values",
"(",
")",
";",
"selectionButtons",
"=",
"new",
"HashMap",
"<",
"GroovySuggestionsTable",
".",
"ButtonTypes",
",",
"Button",
">",
"(",
")",
";",
"for",
"(",
"ButtonTypes",
"type",
":",
"types",
")",
"{",
"Button",
"button",
"=",
"createSelectionButton",
"(",
"buttons",
",",
"type",
")",
";",
"if",
"(",
"button",
"!=",
"null",
")",
"{",
"selectionButtons",
".",
"put",
"(",
"type",
",",
"button",
")",
";",
"}",
"}",
"handleSelectionButtonEnablement",
"(",
"getSelections",
"(",
")",
")",
";",
"}",
"protected",
"Button",
"createSelectionButton",
"(",
"Composite",
"parent",
",",
"final",
"ButtonTypes",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Button",
"button",
"=",
"new",
"Button",
"(",
"parent",
",",
"SWT",
".",
"PUSH",
")",
";",
"button",
".",
"setText",
"(",
"type",
".",
"getLabel",
"(",
")",
")",
";",
"button",
".",
"setData",
"(",
"type",
")",
";",
"Point",
"minSize",
"=",
"button",
".",
"computeSize",
"(",
"SWT",
".",
"DEFAULT",
",",
"SWT",
".",
"DEFAULT",
",",
"true",
")",
";",
"int",
"widthHint",
"=",
"0",
";",
"GridDataFactory",
".",
"fillDefaults",
"(",
")",
".",
"hint",
"(",
"Math",
".",
"max",
"(",
"widthHint",
",",
"minSize",
".",
"x",
")",
",",
"SWT",
".",
"DEFAULT",
")",
".",
"applyTo",
"(",
"button",
")",
";",
"button",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"super",
".",
"widgetSelected",
"(",
"e",
")",
";",
"Object",
"item",
"=",
"e",
".",
"getSource",
"(",
")",
";",
"if",
"(",
"item",
"instanceof",
"Button",
")",
"{",
"Object",
"widgetData",
"=",
"(",
"(",
"Button",
")",
"item",
")",
".",
"getData",
"(",
")",
";",
"if",
"(",
"widgetData",
"instanceof",
"ButtonTypes",
")",
"{",
"handleButtonSelection",
"(",
"(",
"ButtonTypes",
")",
"widgetData",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"return",
"button",
";",
"}",
"public",
"static",
"class",
"SuggestionViewerSorter",
"extends",
"TreeViewerSorter",
"{",
"protected",
"String",
"getCompareString",
"(",
"TreeColumn",
"column",
",",
"Object",
"rowItem",
")",
"{",
"ColumnTypes",
"type",
"=",
"getColumnType",
"(",
"column",
")",
";",
"String",
"text",
"=",
"null",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"SUGGESTIONS",
":",
"text",
"=",
"getDisplayString",
"(",
"rowItem",
")",
";",
"break",
";",
"}",
"}",
"return",
"text",
";",
"}",
"public",
"int",
"compare",
"(",
"Viewer",
"viewer",
",",
"Object",
"e1",
",",
"Object",
"e2",
")",
"{",
"Tree",
"tree",
"=",
"(",
"(",
"TreeViewer",
")",
"viewer",
")",
".",
"getTree",
"(",
")",
";",
"TreeColumn",
"sortColumn",
"=",
"tree",
".",
"getSortColumn",
"(",
")",
";",
"ColumnTypes",
"type",
"=",
"getColumnType",
"(",
"sortColumn",
")",
";",
"int",
"sortDirection",
"=",
"1",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"SUGGESTIONS",
":",
"if",
"(",
"e1",
"instanceof",
"GroovyPropertySuggestion",
")",
"{",
"if",
"(",
"e2",
"instanceof",
"GroovyPropertySuggestion",
")",
"{",
"sortDirection",
"=",
"super",
".",
"compare",
"(",
"viewer",
",",
"e1",
",",
"e2",
")",
";",
"}",
"else",
"{",
"sortDirection",
"=",
"sortDirection",
"==",
"SWT",
".",
"UP",
"?",
"-",
"1",
":",
"1",
";",
"}",
"}",
"else",
"if",
"(",
"e1",
"instanceof",
"GroovyMethodSuggestion",
")",
"{",
"if",
"(",
"e2",
"instanceof",
"GroovyMethodSuggestion",
")",
"{",
"sortDirection",
"=",
"super",
".",
"compare",
"(",
"viewer",
",",
"e1",
",",
"e2",
")",
";",
"}",
"else",
"{",
"sortDirection",
"=",
"sortDirection",
"==",
"SWT",
".",
"UP",
"?",
"1",
":",
"-",
"1",
";",
"}",
"}",
"else",
"{",
"sortDirection",
"=",
"super",
".",
"compare",
"(",
"viewer",
",",
"e1",
",",
"e2",
")",
";",
"}",
"return",
"sortDirection",
";",
"}",
"}",
"return",
"super",
".",
"compare",
"(",
"viewer",
",",
"e1",
",",
"e2",
")",
";",
"}",
"protected",
"ColumnTypes",
"getColumnType",
"(",
"TreeColumn",
"column",
")",
"{",
"String",
"columnName",
"=",
"column",
".",
"getText",
"(",
")",
";",
"for",
"(",
"ColumnTypes",
"type",
":",
"ColumnTypes",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"type",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"columnName",
")",
")",
"{",
"return",
"type",
";",
"}",
"}",
"return",
"null",
";",
"}",
"}",
"public",
"abstract",
"static",
"class",
"TreeViewerSorter",
"extends",
"ViewerSorter",
"{",
"public",
"int",
"compare",
"(",
"Viewer",
"viewer",
",",
"Object",
"e1",
",",
"Object",
"e2",
")",
"{",
"if",
"(",
"viewer",
"instanceof",
"TreeViewer",
")",
"{",
"Tree",
"tree",
"=",
"(",
"(",
"TreeViewer",
")",
"viewer",
")",
".",
"getTree",
"(",
")",
";",
"TreeColumn",
"sortColumn",
"=",
"tree",
".",
"getSortColumn",
"(",
")",
";",
"int",
"sortDirection",
"=",
"tree",
".",
"getSortDirection",
"(",
")",
";",
"if",
"(",
"sortColumn",
"!=",
"null",
")",
"{",
"String",
"compareText1",
"=",
"getCompareString",
"(",
"sortColumn",
",",
"e1",
")",
";",
"String",
"compareText2",
"=",
"getCompareString",
"(",
"sortColumn",
",",
"e2",
")",
";",
"if",
"(",
"compareText1",
"!=",
"null",
")",
"{",
"if",
"(",
"compareText2",
"!=",
"null",
")",
"{",
"return",
"sortDirection",
"==",
"SWT",
".",
"UP",
"?",
"compareText1",
".",
"compareToIgnoreCase",
"(",
"compareText2",
")",
":",
"compareText2",
".",
"compareToIgnoreCase",
"(",
"compareText1",
")",
";",
"}",
"else",
"{",
"return",
"sortDirection",
"==",
"SWT",
".",
"UP",
"?",
"-",
"1",
":",
"1",
";",
"}",
"}",
"else",
"if",
"(",
"compareText2",
"!=",
"null",
")",
"{",
"return",
"sortDirection",
"==",
"SWT",
".",
"UP",
"?",
"1",
":",
"-",
"1",
";",
"}",
"}",
"}",
"return",
"super",
".",
"compare",
"(",
"viewer",
",",
"e1",
",",
"e2",
")",
";",
"}",
"abstract",
"protected",
"String",
"getCompareString",
"(",
"TreeColumn",
"column",
",",
"Object",
"rowItem",
")",
";",
"}",
"}",
"</s>"
] |
6,228 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"preferencepage",
";",
"public",
"abstract",
"class",
"AbstractSuggestionLabel",
"implements",
"ISuggestionLabel",
"{",
"protected",
"static",
"final",
"String",
"EMPTY_SPACE",
"=",
"\"",
"\"",
";",
"protected",
"static",
"final",
"String",
"COLON",
"=",
"\":\"",
";",
"protected",
"static",
"final",
"String",
"OPEN_PAR",
"=",
"\"(\"",
";",
"protected",
"static",
"final",
"String",
"CLOSE_PAR",
"=",
"\")\"",
";",
"protected",
"static",
"final",
"String",
"COMMA",
"=",
"\",\"",
";",
"private",
"String",
"displayName",
";",
"public",
"String",
"getLabel",
"(",
")",
"{",
"if",
"(",
"displayName",
"==",
"null",
")",
"{",
"displayName",
"=",
"constructName",
"(",
")",
";",
"if",
"(",
"displayName",
"==",
"null",
")",
"{",
"displayName",
"=",
"\"\"",
";",
"}",
"}",
"return",
"displayName",
";",
"}",
"protected",
"abstract",
"String",
"constructName",
"(",
")",
";",
"}",
"</s>"
] |
6,229 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"preferencepage",
";",
"public",
"interface",
"ITreeViewerColumn",
"{",
"public",
"String",
"getName",
"(",
")",
";",
"public",
"int",
"getWidth",
"(",
")",
";",
"}",
"</s>"
] |
6,230 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ImportNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstantExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"FieldExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"StaticMethodCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"VariableExpression",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"ITypeRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeLookupResult",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"VariableScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"NamedMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"SuggestionsRequestor",
"implements",
"ITypeRequestor",
"{",
"private",
"final",
"ASTNode",
"nodeToLookFor",
";",
"private",
"SuggestionDescriptor",
"descriptor",
";",
"public",
"SuggestionsRequestor",
"(",
"ASTNode",
"nodeToLookFor",
")",
"{",
"this",
".",
"nodeToLookFor",
"=",
"nodeToLookFor",
";",
"}",
"public",
"VisitStatus",
"acceptASTNode",
"(",
"ASTNode",
"node",
",",
"TypeLookupResult",
"result",
",",
"IJavaElement",
"enclosingElement",
")",
"{",
"if",
"(",
"!",
"interestingElement",
"(",
"enclosingElement",
")",
")",
"{",
"return",
"VisitStatus",
".",
"CANCEL_MEMBER",
";",
"}",
"if",
"(",
"node",
"instanceof",
"ImportNode",
")",
"{",
"node",
"=",
"(",
"(",
"ImportNode",
")",
"node",
")",
".",
"getType",
"(",
")",
";",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"}",
"if",
"(",
"isValidNode",
"(",
"node",
")",
"&&",
"doTest",
"(",
"node",
")",
")",
"{",
"Expression",
"expression",
"=",
"(",
"Expression",
")",
"node",
";",
"descriptor",
"=",
"createDescriptor",
"(",
"expression",
",",
"result",
")",
";",
"return",
"VisitStatus",
".",
"STOP_VISIT",
";",
"}",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"public",
"SuggestionDescriptor",
"getSuggestionDescriptor",
"(",
")",
"{",
"return",
"descriptor",
";",
"}",
"protected",
"SuggestionDescriptor",
"createDescriptor",
"(",
"Expression",
"suggestionNode",
",",
"TypeLookupResult",
"result",
")",
"{",
"ClassNode",
"declaringTypeNode",
"=",
"result",
".",
"declaringType",
";",
"ClassNode",
"suggestionTypeNode",
"=",
"result",
".",
"type",
";",
"VariableScope",
"scope",
"=",
"result",
".",
"scope",
";",
"String",
"declaringTypeName",
"=",
"declaringTypeNode",
".",
"getName",
"(",
")",
";",
"String",
"suggestionType",
"=",
"suggestionTypeNode",
".",
"getName",
"(",
")",
";",
"Object",
"suggestionName",
"=",
"suggestionNode",
"instanceof",
"ConstantExpression",
"?",
"(",
"(",
"ConstantExpression",
")",
"suggestionNode",
")",
".",
"getValue",
"(",
")",
":",
"suggestionNode",
".",
"getText",
"(",
")",
";",
"String",
"name",
"=",
"suggestionName",
"instanceof",
"String",
"?",
"(",
"String",
")",
"suggestionName",
":",
"null",
";",
"boolean",
"isStatic",
"=",
"false",
";",
"String",
"javaDoc",
"=",
"null",
";",
"boolean",
"useNamedArguments",
"=",
"false",
";",
"List",
"<",
"MethodParameter",
">",
"parameters",
"=",
"null",
";",
"boolean",
"isMethod",
"=",
"isMethod",
"(",
"scope",
")",
";",
"boolean",
"isActive",
"=",
"true",
";",
"return",
"isMethod",
"?",
"new",
"SuggestionDescriptor",
"(",
"declaringTypeName",
",",
"isStatic",
",",
"name",
",",
"javaDoc",
",",
"suggestionType",
",",
"useNamedArguments",
",",
"parameters",
",",
"isActive",
")",
":",
"new",
"SuggestionDescriptor",
"(",
"declaringTypeName",
",",
"isStatic",
",",
"name",
",",
"javaDoc",
",",
"suggestionType",
",",
"isActive",
")",
";",
"}",
"protected",
"boolean",
"isMethod",
"(",
"VariableScope",
"scope",
")",
"{",
"if",
"(",
"scope",
"!=",
"null",
")",
"{",
"return",
"scope",
".",
"isMethodCall",
"(",
")",
";",
"}",
"return",
"false",
";",
"}",
"protected",
"boolean",
"interestingElement",
"(",
"IJavaElement",
"enclosingElement",
")",
"{",
"if",
"(",
"enclosingElement",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"<clinit>\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"enclosingElement",
"instanceof",
"NamedMember",
")",
"{",
"try",
"{",
"ISourceRange",
"range",
"=",
"(",
"(",
"ISourceReference",
")",
"enclosingElement",
")",
".",
"getSourceRange",
"(",
")",
";",
"return",
"range",
".",
"getOffset",
"(",
")",
"<=",
"nodeToLookFor",
".",
"getStart",
"(",
")",
"&&",
"range",
".",
"getOffset",
"(",
")",
"+",
"range",
".",
"getLength",
"(",
")",
">=",
"nodeToLookFor",
".",
"getEnd",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"doTest",
"(",
"ASTNode",
"node",
")",
"{",
"return",
"node",
".",
"getClass",
"(",
")",
"==",
"nodeToLookFor",
".",
"getClass",
"(",
")",
"&&",
"nodeToLookFor",
".",
"getStart",
"(",
")",
"==",
"node",
".",
"getStart",
"(",
")",
"&&",
"nodeToLookFor",
".",
"getEnd",
"(",
")",
"==",
"node",
".",
"getEnd",
"(",
")",
";",
"}",
"public",
"static",
"boolean",
"isValidNode",
"(",
"ASTNode",
"node",
")",
"{",
"return",
"node",
"instanceof",
"VariableExpression",
"||",
"node",
"instanceof",
"StaticMethodCallExpression",
"||",
"node",
"instanceof",
"FieldExpression",
"||",
"node",
"instanceof",
"ConstantExpression",
";",
"}",
"}",
"</s>"
] |
6,231 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"public",
"class",
"GroovyMethodSuggestion",
"extends",
"GroovySuggestion",
"{",
"private",
"List",
"<",
"MethodParameter",
">",
"parameters",
";",
"private",
"boolean",
"useNamedArgument",
";",
"public",
"GroovyMethodSuggestion",
"(",
"GroovySuggestionDeclaringType",
"declaringType",
",",
"List",
"<",
"MethodParameter",
">",
"arguments",
",",
"boolean",
"useNameArguments",
",",
"String",
"name",
",",
"String",
"type",
",",
"boolean",
"isStatic",
",",
"String",
"javaDoc",
",",
"boolean",
"isActive",
")",
"{",
"super",
"(",
"declaringType",
",",
"name",
",",
"type",
",",
"isStatic",
",",
"javaDoc",
",",
"isActive",
")",
";",
"this",
".",
"useNamedArgument",
"=",
"useNameArguments",
";",
"this",
".",
"parameters",
"=",
"arguments",
";",
"}",
"public",
"List",
"<",
"MethodParameter",
">",
"getParameters",
"(",
")",
"{",
"return",
"parameters",
";",
"}",
"public",
"boolean",
"useNamedArguments",
"(",
")",
"{",
"return",
"useNamedArgument",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"final",
"int",
"prime",
"=",
"31",
";",
"int",
"result",
"=",
"super",
".",
"hashCode",
"(",
")",
";",
"result",
"=",
"prime",
"*",
"result",
"+",
"(",
"(",
"parameters",
"==",
"null",
")",
"?",
"0",
":",
"parameters",
".",
"hashCode",
"(",
")",
")",
";",
"result",
"=",
"prime",
"*",
"result",
"+",
"(",
"useNamedArgument",
"?",
"1231",
":",
"1237",
")",
";",
"return",
"result",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"this",
"==",
"obj",
")",
"return",
"true",
";",
"if",
"(",
"!",
"super",
".",
"equals",
"(",
"obj",
")",
")",
"return",
"false",
";",
"if",
"(",
"getClass",
"(",
")",
"!=",
"obj",
".",
"getClass",
"(",
")",
")",
"return",
"false",
";",
"GroovyMethodSuggestion",
"other",
"=",
"(",
"GroovyMethodSuggestion",
")",
"obj",
";",
"if",
"(",
"parameters",
"==",
"null",
")",
"{",
"if",
"(",
"other",
".",
"parameters",
"!=",
"null",
")",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"!",
"parameters",
".",
"equals",
"(",
"other",
".",
"parameters",
")",
")",
"return",
"false",
";",
"if",
"(",
"useNamedArgument",
"!=",
"other",
".",
"useNamedArgument",
")",
"return",
"false",
";",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
6,232 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"public",
"interface",
"ISuggestionsOperation",
"{",
"public",
"IProject",
"getProject",
"(",
")",
";",
"public",
"ValueStatus",
"run",
"(",
")",
";",
"public",
"IBaseGroovySuggestion",
"getContext",
"(",
")",
";",
"}",
"</s>"
] |
6,233 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ArrayType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"Name",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"NodeFinder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ParameterizedType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"PrimitiveType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"Type",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"dom",
".",
"ASTNodes",
";",
"public",
"class",
"JavaValidParameterizedTypeRule",
"extends",
"AbstractJavaTypeVerifiedRule",
"{",
"public",
"JavaValidParameterizedTypeRule",
"(",
"IJavaProject",
"project",
")",
"{",
"super",
"(",
"project",
")",
";",
"}",
"public",
"ValueStatus",
"checkValidity",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"String",
")",
")",
"{",
"return",
"ValueStatus",
".",
"getErrorStatus",
"(",
"value",
")",
";",
"}",
"String",
"typeToCheck",
"=",
"(",
"String",
")",
"value",
";",
"StringBuffer",
"source",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Type",
"astType",
"=",
"getASTType",
"(",
"typeToCheck",
",",
"source",
")",
";",
"List",
"<",
"String",
">",
"allNonExistantTypes",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"astType",
"!=",
"null",
")",
"{",
"try",
"{",
"boolean",
"isValid",
"=",
"allTypesExist",
"(",
"astType",
",",
"source",
",",
"allNonExistantTypes",
")",
";",
"if",
"(",
"!",
"isValid",
")",
"{",
"String",
"message",
"=",
"composeErrorMessage",
"(",
"allNonExistantTypes",
")",
";",
"return",
"ValueStatus",
".",
"getErrorStatus",
"(",
"value",
",",
"message",
")",
";",
"}",
"else",
"{",
"return",
"ValueStatus",
".",
"getValidStatus",
"(",
"value",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyDSLCoreActivator",
".",
"logException",
"(",
"e",
")",
";",
"return",
"ValueStatus",
".",
"getErrorStatus",
"(",
"value",
",",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
";",
"}",
"}",
"return",
"ValueStatus",
".",
"getErrorStatus",
"(",
"value",
",",
"INVALID_JAVA",
")",
";",
"}",
"protected",
"String",
"getTypeName",
"(",
"Type",
"type",
",",
"StringBuffer",
"source",
")",
"{",
"String",
"name",
"=",
"null",
";",
"name",
"=",
"source",
".",
"substring",
"(",
"type",
".",
"getStartPosition",
"(",
")",
",",
"ASTNodes",
".",
"getExclusiveEnd",
"(",
"type",
")",
")",
";",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
")",
"{",
"int",
"index",
"=",
"name",
".",
"indexOf",
"(",
"'<'",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"name",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"}",
"}",
"return",
"name",
";",
"}",
"protected",
"boolean",
"allTypesExist",
"(",
"Type",
"type",
",",
"StringBuffer",
"source",
",",
"List",
"<",
"String",
">",
"nonExistantTypes",
")",
"throws",
"JavaModelException",
"{",
"String",
"typeName",
"=",
"getTypeName",
"(",
"type",
",",
"source",
")",
";",
"IType",
"actualType",
"=",
"getActualType",
"(",
"typeName",
")",
";",
"if",
"(",
"actualType",
"!=",
"null",
")",
"{",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
")",
"{",
"List",
"<",
"?",
">",
"parameterisedNodes",
"=",
"(",
"(",
"ParameterizedType",
")",
"type",
")",
".",
"typeArguments",
"(",
")",
";",
"if",
"(",
"parameterisedNodes",
"!=",
"null",
")",
"{",
"boolean",
"allParamsValid",
"=",
"true",
";",
"for",
"(",
"Object",
"node",
":",
"parameterisedNodes",
")",
"{",
"if",
"(",
"!",
"(",
"node",
"instanceof",
"Type",
")",
"||",
"!",
"allTypesExist",
"(",
"(",
"Type",
")",
"node",
",",
"source",
",",
"nonExistantTypes",
")",
")",
"{",
"allParamsValid",
"=",
"false",
";",
"break",
";",
"}",
"}",
"return",
"allParamsValid",
";",
"}",
"}",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"type",
"instanceof",
"PrimitiveType",
"||",
"type",
"instanceof",
"ArrayType",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"nonExistantTypes",
"!=",
"null",
"&&",
"!",
"nonExistantTypes",
".",
"contains",
"(",
"typeName",
")",
")",
"{",
"nonExistantTypes",
".",
"add",
"(",
"typeName",
")",
";",
"}",
"}",
"return",
"false",
";",
"}",
"protected",
"Type",
"getASTType",
"(",
"String",
"typeToCheck",
",",
"StringBuffer",
"sourceBuffer",
")",
"{",
"sourceBuffer",
".",
"append",
"(",
"\"\"",
")",
";",
"int",
"valueOffset",
"=",
"sourceBuffer",
".",
"length",
"(",
")",
";",
"sourceBuffer",
".",
"append",
"(",
"typeToCheck",
")",
".",
"append",
"(",
"\"",
"v;\"",
")",
";",
"sourceBuffer",
".",
"append",
"(",
"\"}\"",
")",
";",
"ASTParser",
"parser",
"=",
"ASTParser",
".",
"newParser",
"(",
"AST",
".",
"JLS3",
")",
";",
"parser",
".",
"setSource",
"(",
"sourceBuffer",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"options",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"JavaCore",
".",
"setComplianceOptions",
"(",
"JavaCore",
".",
"VERSION_1_5",
",",
"options",
")",
";",
"parser",
".",
"setCompilerOptions",
"(",
"options",
")",
";",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"parser",
".",
"createAST",
"(",
"null",
")",
";",
"ASTNode",
"selected",
"=",
"NodeFinder",
".",
"perform",
"(",
"cu",
",",
"valueOffset",
",",
"typeToCheck",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"selected",
"instanceof",
"Name",
")",
"{",
"selected",
"=",
"selected",
".",
"getParent",
"(",
")",
";",
"}",
"if",
"(",
"selected",
"instanceof",
"Type",
")",
"{",
"return",
"(",
"Type",
")",
"selected",
";",
"}",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
6,234 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaConventions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"JavaValidTypeRule",
"extends",
"AbstractJavaTypeVerifiedRule",
"{",
"public",
"JavaValidTypeRule",
"(",
"IJavaProject",
"project",
")",
"{",
"super",
"(",
"project",
")",
";",
"}",
"public",
"ValueStatus",
"checkValidity",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"String",
"name",
"=",
"(",
"String",
")",
"value",
";",
"IStatus",
"status",
"=",
"JavaConventions",
".",
"validateJavaTypeName",
"(",
"name",
",",
"JavaCore",
".",
"VERSION_1_3",
",",
"JavaCore",
".",
"VERSION_1_3",
")",
";",
"if",
"(",
"status",
".",
"getSeverity",
"(",
")",
"!=",
"IStatus",
".",
"ERROR",
")",
"{",
"try",
"{",
"IType",
"type",
"=",
"getActualType",
"(",
"name",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"return",
"ValueStatus",
".",
"getValidStatus",
"(",
"value",
")",
";",
"}",
"else",
"{",
"return",
"ValueStatus",
".",
"getErrorStatus",
"(",
"value",
",",
"THE_SPECIFIED_JAVA_TYPES_DO_NOT_EXIST",
"+",
"name",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyDSLCoreActivator",
".",
"logException",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"return",
"ValueStatus",
".",
"getErrorStatus",
"(",
"value",
",",
"INVALID_JAVA",
")",
";",
"}",
"}",
"return",
"ValueStatus",
".",
"getErrorStatus",
"(",
"value",
",",
"INVALID_JAVA",
")",
";",
"}",
"}",
"</s>"
] |
6,235 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
";",
"public",
"interface",
"IGroovySuggestion",
"extends",
"IBaseGroovySuggestion",
"{",
"public",
"GroovySuggestionDeclaringType",
"getDeclaringType",
"(",
")",
";",
"public",
"String",
"getJavaDoc",
"(",
")",
";",
"public",
"String",
"getType",
"(",
")",
";",
"public",
"boolean",
"isStatic",
"(",
")",
";",
"public",
"boolean",
"isActive",
"(",
")",
";",
"public",
"void",
"changeActiveState",
"(",
"boolean",
"isActive",
")",
";",
"}",
"</s>"
] |
6,236 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"public",
"abstract",
"class",
"AbstractCreateOperation",
"extends",
"AbstractSuggestionOperation",
"{",
"protected",
"static",
"final",
"String",
"MISSING_DESCRIPTOR",
"=",
"\"\"",
";",
"private",
"SuggestionDescriptor",
"descriptor",
";",
"public",
"AbstractCreateOperation",
"(",
"IProject",
"project",
",",
"IBaseGroovySuggestion",
"suggestionContext",
")",
"{",
"super",
"(",
"project",
",",
"suggestionContext",
")",
";",
"}",
"public",
"void",
"setSuggestionDescriptor",
"(",
"SuggestionDescriptor",
"descriptor",
")",
"{",
"this",
".",
"descriptor",
"=",
"descriptor",
";",
"}",
"public",
"SuggestionDescriptor",
"getDescriptor",
"(",
")",
"{",
"return",
"descriptor",
";",
"}",
"public",
"ValueStatus",
"run",
"(",
")",
"{",
"if",
"(",
"descriptor",
"!=",
"null",
")",
"{",
"return",
"run",
"(",
"descriptor",
")",
";",
"}",
"return",
"ValueStatus",
".",
"getErrorStatus",
"(",
"null",
",",
"MISSING_DESCRIPTOR",
")",
";",
"}",
"abstract",
"protected",
"ValueStatus",
"run",
"(",
"SuggestionDescriptor",
"descriptor",
")",
";",
"}",
"</s>"
] |
6,237 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
".",
"AddInferencingSuggestionDialogue",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"ui",
".",
"EditInferencingSuggestionDialogue",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"class",
"SuggestionsUIOperation",
"{",
"private",
"Shell",
"shell",
";",
"private",
"AbstractCreateOperation",
"operation",
";",
"protected",
"static",
"final",
"String",
"UNABLE_TO_OPEN_DIALOGUE",
"=",
"\"\"",
";",
"public",
"SuggestionsUIOperation",
"(",
"AbstractCreateOperation",
"operation",
",",
"Shell",
"shell",
")",
"{",
"this",
".",
"shell",
"=",
"shell",
";",
"this",
".",
"operation",
"=",
"operation",
";",
"}",
"public",
"ValueStatus",
"run",
"(",
")",
"{",
"IBaseGroovySuggestion",
"context",
"=",
"operation",
".",
"getContext",
"(",
")",
";",
"AddInferencingSuggestionDialogue",
"dialogue",
"=",
"null",
";",
"IProject",
"project",
"=",
"operation",
".",
"getProject",
"(",
")",
";",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"SuggestionDescriptor",
"descriptor",
"=",
"operation",
".",
"getDescriptor",
"(",
")",
";",
"if",
"(",
"descriptor",
"!=",
"null",
")",
"{",
"dialogue",
"=",
"new",
"AddInferencingSuggestionDialogue",
"(",
"shell",
",",
"descriptor",
",",
"project",
")",
";",
"}",
"else",
"{",
"dialogue",
"=",
"new",
"AddInferencingSuggestionDialogue",
"(",
"shell",
",",
"project",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"context",
"instanceof",
"GroovySuggestionDeclaringType",
")",
"{",
"dialogue",
"=",
"new",
"AddInferencingSuggestionDialogue",
"(",
"shell",
",",
"(",
"GroovySuggestionDeclaringType",
")",
"context",
",",
"project",
")",
";",
"}",
"else",
"if",
"(",
"context",
"instanceof",
"IGroovySuggestion",
")",
"{",
"if",
"(",
"operation",
"instanceof",
"EditSuggestionOperation",
")",
"{",
"dialogue",
"=",
"new",
"EditInferencingSuggestionDialogue",
"(",
"shell",
",",
"(",
"IGroovySuggestion",
")",
"context",
",",
"project",
")",
";",
"}",
"else",
"if",
"(",
"operation",
"instanceof",
"AddSuggestionsOperation",
")",
"{",
"dialogue",
"=",
"new",
"AddInferencingSuggestionDialogue",
"(",
"shell",
",",
"(",
"(",
"IGroovySuggestion",
")",
"context",
")",
".",
"getDeclaringType",
"(",
")",
",",
"project",
")",
";",
"}",
"}",
"}",
"if",
"(",
"dialogue",
"!=",
"null",
"&&",
"dialogue",
".",
"open",
"(",
")",
"==",
"Window",
".",
"OK",
")",
"{",
"SuggestionDescriptor",
"descriptor",
"=",
"dialogue",
".",
"getSuggestionChange",
"(",
")",
";",
"operation",
".",
"setSuggestionDescriptor",
"(",
"descriptor",
")",
";",
"return",
"operation",
".",
"run",
"(",
")",
";",
"}",
"return",
"ValueStatus",
".",
"getErrorStatus",
"(",
"null",
",",
"UNABLE_TO_OPEN_DIALOGUE",
")",
";",
"}",
"}",
"</s>"
] |
6,238 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"checker",
";",
"import",
"java",
".",
"io",
".",
"PrintStream",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"class",
"SysoutStaticCheckerHandler",
"implements",
"IStaticCheckerHandler",
"{",
"private",
"int",
"numProblems",
"=",
"0",
";",
"private",
"final",
"PrintStream",
"out",
";",
"public",
"SysoutStaticCheckerHandler",
"(",
"PrintStream",
"out",
")",
"{",
"this",
".",
"out",
"=",
"out",
";",
"}",
"public",
"void",
"handleUnknownReference",
"(",
"ASTNode",
"node",
",",
"Position",
"position",
",",
"int",
"line",
")",
"{",
"out",
".",
"println",
"(",
"createUnknownMessage",
"(",
"node",
",",
"line",
")",
")",
";",
"numProblems",
"++",
";",
"}",
"public",
"void",
"handleTypeAssertionFailed",
"(",
"ASTNode",
"node",
",",
"String",
"expectedType",
",",
"String",
"actualType",
",",
"Position",
"position",
",",
"int",
"line",
")",
"{",
"out",
".",
"println",
"(",
"createInvalidTypeMessage",
"(",
"node",
",",
"expectedType",
",",
"actualType",
",",
"line",
")",
")",
";",
"numProblems",
"++",
";",
"}",
"public",
"void",
"setResource",
"(",
"IFile",
"resource",
")",
"{",
"out",
".",
"println",
"(",
"\"nChecking:",
"\"",
"+",
"resource",
".",
"getFullPath",
"(",
")",
")",
";",
"}",
"private",
"String",
"createUnknownMessage",
"(",
"ASTNode",
"node",
",",
"int",
"line",
")",
"{",
"return",
"\"tLine",
"\"",
"+",
"line",
"+",
"\"\"",
"+",
"node",
".",
"getText",
"(",
")",
";",
"}",
"private",
"String",
"createInvalidTypeMessage",
"(",
"ASTNode",
"node",
",",
"String",
"expectedType",
",",
"String",
"actualType",
",",
"int",
"line",
")",
"{",
"return",
"\"tLine",
"\"",
"+",
"line",
"+",
"\"\"",
"+",
"node",
".",
"getText",
"(",
")",
"+",
"\"",
"Expected:",
"\"",
"+",
"expectedType",
"+",
"\"",
"Actual:",
"\"",
"+",
"actualType",
";",
"}",
"public",
"int",
"numProblemsFound",
"(",
")",
"{",
"return",
"numProblems",
";",
"}",
"public",
"void",
"handleResourceStart",
"(",
"IResource",
"resource",
")",
"throws",
"CoreException",
"{",
"}",
"public",
"boolean",
"finish",
"(",
"Shell",
"shell",
")",
"{",
"String",
"message",
"=",
"createMessage",
"(",
")",
";",
"out",
".",
"println",
"(",
"message",
")",
";",
"if",
"(",
"out",
"!=",
"System",
".",
"out",
")",
"{",
"out",
".",
"close",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"message",
")",
";",
"}",
"return",
"numProblems",
"==",
"0",
";",
"}",
"private",
"String",
"createMessage",
"(",
")",
"{",
"if",
"(",
"numProblems",
"==",
"0",
")",
"{",
"return",
"\"SUCCESS\"",
";",
"}",
"else",
"if",
"(",
"numProblems",
"==",
"1",
")",
"{",
"return",
"\"\"",
";",
"}",
"else",
"{",
"return",
"\"\"",
"+",
"numProblems",
"+",
"\"\"",
";",
"}",
"}",
"}",
"</s>"
] |
6,239 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"checker",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"interface",
"IStaticCheckerHandler",
"{",
"void",
"handleUnknownReference",
"(",
"ASTNode",
"node",
",",
"Position",
"position",
",",
"int",
"line",
")",
";",
"void",
"handleTypeAssertionFailed",
"(",
"ASTNode",
"node",
",",
"String",
"expectedType",
",",
"String",
"actualType",
",",
"Position",
"position",
",",
"int",
"line",
")",
";",
"void",
"setResource",
"(",
"IFile",
"resource",
")",
";",
"int",
"numProblemsFound",
"(",
")",
";",
"void",
"handleResourceStart",
"(",
"IResource",
"resource",
")",
"throws",
"CoreException",
";",
"boolean",
"finish",
"(",
"Shell",
"shell",
")",
";",
"}",
"</s>"
] |
6,240 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"checker",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotatedNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"GenericsType",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"BlockStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"highlighting",
".",
"SemanticReferenceRequestor",
";",
"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",
";",
"public",
"class",
"StaticTypeCheckerRequestor",
"extends",
"SemanticReferenceRequestor",
"implements",
"ITypeRequestor",
"{",
"private",
"final",
"IStaticCheckerHandler",
"handler",
";",
"private",
"final",
"Map",
"<",
"Integer",
",",
"String",
">",
"commentsMap",
";",
"private",
"final",
"boolean",
"onlyAssertions",
";",
"StaticTypeCheckerRequestor",
"(",
"IStaticCheckerHandler",
"handler",
",",
"Map",
"<",
"Integer",
",",
"String",
">",
"commentsMap",
",",
"boolean",
"onlyAssertions",
")",
"{",
"this",
".",
"handler",
"=",
"handler",
";",
"this",
".",
"commentsMap",
"=",
"commentsMap",
";",
"this",
".",
"onlyAssertions",
"=",
"onlyAssertions",
";",
"}",
"public",
"VisitStatus",
"acceptASTNode",
"(",
"ASTNode",
"node",
",",
"TypeLookupResult",
"result",
",",
"IJavaElement",
"enclosingElement",
")",
"{",
"if",
"(",
"node",
"instanceof",
"BlockStatement",
")",
"{",
"if",
"(",
"(",
"(",
"BlockStatement",
")",
"node",
")",
".",
"getStatements",
"(",
")",
"==",
"null",
")",
"{",
"return",
"VisitStatus",
".",
"CANCEL_BRANCH",
";",
"}",
"}",
"if",
"(",
"!",
"(",
"node",
"instanceof",
"AnnotatedNode",
")",
")",
"{",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"if",
"(",
"node",
".",
"getEnd",
"(",
")",
"<=",
"0",
"||",
"(",
"node",
".",
"getStart",
"(",
")",
"==",
"0",
"&&",
"node",
".",
"getEnd",
"(",
")",
"==",
"1",
")",
")",
"{",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"if",
"(",
"!",
"onlyAssertions",
"&&",
"result",
".",
"confidence",
"==",
"TypeConfidence",
".",
"UNKNOWN",
"&&",
"node",
".",
"getEnd",
"(",
")",
">",
"0",
")",
"{",
"handler",
".",
"handleUnknownReference",
"(",
"node",
",",
"getPosition",
"(",
"node",
")",
",",
"node",
".",
"getLineNumber",
"(",
")",
")",
";",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"String",
"expectedType",
"=",
"commentsMap",
".",
"remove",
"(",
"node",
".",
"getLineNumber",
"(",
")",
")",
";",
"if",
"(",
"expectedType",
"!=",
"null",
"&&",
"!",
"typeMatches",
"(",
"result",
".",
"type",
",",
"expectedType",
")",
")",
"{",
"handler",
".",
"handleTypeAssertionFailed",
"(",
"node",
",",
"expectedType",
",",
"printTypeName",
"(",
"result",
".",
"type",
")",
",",
"getPosition",
"(",
"node",
")",
",",
"node",
".",
"getLineNumber",
"(",
")",
")",
";",
"}",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"private",
"boolean",
"typeMatches",
"(",
"ClassNode",
"type",
",",
"String",
"expectedType",
")",
"{",
"String",
"actualType",
"=",
"printTypeName",
"(",
"type",
")",
";",
"return",
"expectedType",
".",
"equals",
"(",
"actualType",
")",
";",
"}",
"protected",
"String",
"printTypeName",
"(",
"ClassNode",
"type",
")",
"{",
"return",
"type",
"!=",
"null",
"?",
"type",
".",
"getName",
"(",
")",
"+",
"printGenerics",
"(",
"type",
")",
":",
"\"null\"",
";",
"}",
"private",
"String",
"printGenerics",
"(",
"ClassNode",
"type",
")",
"{",
"if",
"(",
"type",
".",
"getGenericsTypes",
"(",
")",
"==",
"null",
"||",
"type",
".",
"getGenericsTypes",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"'<'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"type",
".",
"getGenericsTypes",
"(",
")",
".",
"length",
";",
"i",
"++",
")",
"{",
"GenericsType",
"gt",
"=",
"type",
".",
"getGenericsTypes",
"(",
")",
"[",
"i",
"]",
";",
"sb",
".",
"append",
"(",
"printTypeName",
"(",
"gt",
".",
"getType",
"(",
")",
")",
")",
";",
"if",
"(",
"i",
"<",
"type",
".",
"getGenericsTypes",
"(",
")",
".",
"length",
"-",
"1",
")",
"{",
"sb",
".",
"append",
"(",
"','",
")",
";",
"}",
"}",
"sb",
".",
"append",
"(",
"'>'",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,241 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"checker",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileNotFoundException",
";",
"import",
"java",
".",
"io",
".",
"PrintStream",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"RefreshDSLDJob",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"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",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"equinox",
".",
"app",
".",
"IApplication",
";",
"import",
"org",
".",
"eclipse",
".",
"equinox",
".",
"app",
".",
"IApplicationContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"application",
".",
"WorkbenchAdvisor",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"Workbench",
";",
"public",
"class",
"StaticCheckerApplication",
"implements",
"IApplication",
"{",
"class",
"CheckerJob",
"extends",
"Job",
"{",
"public",
"CheckerJob",
"(",
")",
"{",
"super",
"(",
"\"Checker",
"Job\"",
")",
";",
"}",
"@",
"Override",
"protected",
"IStatus",
"run",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"try",
"{",
"JavaCore",
".",
"initializeAfterLoad",
"(",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"try",
"{",
"createProject",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
"+",
"projectName",
"+",
"\"\"",
"+",
"projectFolderPath",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"e",
".",
"getStatus",
"(",
")",
";",
"}",
"try",
"{",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"projectName",
")",
".",
"open",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
"+",
"projectName",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"e",
".",
"getStatus",
"(",
")",
";",
"}",
"addExtraDslds",
"(",
")",
";",
"final",
"RefreshDSLDJob",
"job",
"=",
"new",
"RefreshDSLDJob",
"(",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"projectName",
")",
")",
";",
"job",
".",
"run",
"(",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"projectName",
")",
";",
"boolean",
"success",
"=",
"false",
";",
"try",
"{",
"IStaticCheckerHandler",
"handler",
"=",
"new",
"SysoutStaticCheckerHandler",
"(",
"resultFile",
"==",
"null",
"?",
"System",
".",
"out",
":",
"createOutStream",
"(",
"resultFile",
")",
")",
";",
"ResourceTypeChecker",
"checker",
"=",
"new",
"ResourceTypeChecker",
"(",
"handler",
",",
"projectName",
",",
"inclusionFilters",
",",
"exclusionFilters",
",",
"assertionsOnly",
")",
";",
"success",
"=",
"checker",
".",
"doCheck",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"removeExtraDslds",
"(",
")",
";",
"}",
"display",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
")",
";",
"System",
".",
"exit",
"(",
"success",
"?",
"0",
":",
"-",
"1",
")",
";",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"}",
"public",
"class",
"CheckerWorkbenchAdvisor",
"extends",
"WorkbenchAdvisor",
"{",
"@",
"Override",
"public",
"String",
"getInitialWindowPerspectiveId",
"(",
")",
"{",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"void",
"postStartup",
"(",
")",
"{",
"CheckerJob",
"checkerJob",
"=",
"new",
"CheckerJob",
"(",
")",
";",
"checkerJob",
".",
"schedule",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"postShutdown",
"(",
")",
"{",
"super",
".",
"postShutdown",
"(",
")",
";",
"}",
"}",
"private",
"String",
"projectName",
";",
"private",
"char",
"[",
"]",
"[",
"]",
"inclusionFilters",
";",
"private",
"char",
"[",
"]",
"[",
"]",
"exclusionFilters",
";",
"private",
"boolean",
"assertionsOnly",
";",
"private",
"String",
"[",
"]",
"extraDslds",
";",
"private",
"IFile",
"[",
"]",
"extraDsldFiles",
";",
"private",
"String",
"projectFolderPath",
";",
"Display",
"display",
";",
"private",
"String",
"resultFile",
";",
"public",
"Object",
"start",
"(",
"IApplicationContext",
"context",
")",
"throws",
"Exception",
"{",
"processCommandLine",
"(",
"(",
"String",
"[",
"]",
")",
"context",
".",
"getArguments",
"(",
")",
".",
"get",
"(",
"IApplicationContext",
".",
"APPLICATION_ARGS",
")",
")",
";",
"try",
"{",
"display",
"=",
"createDisplay",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"e",
";",
"}",
"WorkbenchAdvisor",
"advisor",
"=",
"new",
"CheckerWorkbenchAdvisor",
"(",
")",
";",
"return",
"PlatformUI",
".",
"createAndRunWorkbench",
"(",
"display",
",",
"advisor",
")",
";",
"}",
"public",
"PrintStream",
"createOutStream",
"(",
"String",
"fileName",
")",
"throws",
"FileNotFoundException",
"{",
"return",
"new",
"PrintStream",
"(",
"new",
"File",
"(",
"fileName",
")",
")",
";",
"}",
"public",
"void",
"stop",
"(",
")",
"{",
"removeExtraDslds",
"(",
")",
";",
"}",
"private",
"void",
"addExtraDslds",
"(",
")",
"{",
"if",
"(",
"extraDslds",
"!=",
"null",
")",
"{",
"extraDsldFiles",
"=",
"new",
"IFile",
"[",
"extraDslds",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"extraDslds",
".",
"length",
";",
"i",
"++",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"extraDslds",
"[",
"i",
"]",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"IFile",
"linkedFile",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"projectName",
")",
".",
"getFile",
"(",
"file",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"linkedFile",
".",
"exists",
"(",
")",
"&&",
"linkedFile",
".",
"isLinked",
"(",
")",
")",
"{",
"try",
"{",
"linkedFile",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"if",
"(",
"!",
"linkedFile",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Adding",
"\"",
"+",
"file",
".",
"toURI",
"(",
")",
")",
";",
"linkedFile",
".",
"createLink",
"(",
"file",
".",
"toURI",
"(",
")",
",",
"IResource",
".",
"NONE",
",",
"null",
")",
";",
"extraDsldFiles",
"[",
"i",
"]",
"=",
"linkedFile",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"else",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
"+",
"extraDslds",
"[",
"i",
"]",
"+",
"\"\"",
")",
";",
"}",
"}",
"}",
"}",
"private",
"void",
"createProject",
"(",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"projectFolderPath",
"==",
"null",
")",
"{",
"return",
";",
"}",
"IProject",
"project",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"projectName",
")",
";",
"if",
"(",
"project",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"project",
".",
"getLocation",
"(",
")",
".",
"toOSString",
"(",
")",
".",
"equals",
"(",
"projectFolderPath",
")",
")",
"{",
"return",
";",
"}",
"else",
"{",
"project",
".",
"delete",
"(",
"IResource",
".",
"NEVER_DELETE_PROJECT_CONTENT",
"|",
"IResource",
".",
"FORCE",
",",
"null",
")",
";",
"}",
"}",
"IPath",
"dotProjectPath",
"=",
"new",
"Path",
"(",
"projectFolderPath",
")",
".",
"append",
"(",
"\".project\"",
")",
";",
"IProjectDescription",
"description",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"loadProjectDescription",
"(",
"dotProjectPath",
")",
";",
"description",
".",
"setName",
"(",
"projectName",
")",
";",
"project",
".",
"create",
"(",
"description",
",",
"null",
")",
";",
"}",
"private",
"void",
"processCommandLine",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"boolean",
"doHelp",
"=",
"false",
";",
"String",
"excludes",
"=",
"null",
";",
"String",
"includes",
"=",
"null",
";",
"if",
"(",
"args",
".",
"length",
"<",
"1",
")",
"{",
"printUsage",
"(",
"true",
")",
";",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"close",
"(",
")",
";",
"return",
";",
"}",
"projectName",
"=",
"args",
"[",
"args",
".",
"length",
"-",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"arg",
"=",
"args",
"[",
"i",
"]",
";",
"if",
"(",
"arg",
".",
"equals",
"(",
"\"-h\"",
")",
"||",
"arg",
".",
"equals",
"(",
"\"--help\"",
")",
")",
"{",
"doHelp",
"=",
"true",
";",
"break",
";",
"}",
"else",
"if",
"(",
"arg",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"assertionsOnly",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"arg",
".",
"equals",
"(",
"\"--excludes\"",
")",
")",
"{",
"if",
"(",
"i",
"==",
"args",
".",
"length",
"-",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"doHelp",
"=",
"true",
";",
"break",
";",
"}",
"excludes",
"=",
"args",
"[",
"++",
"i",
"]",
";",
"}",
"else",
"if",
"(",
"arg",
".",
"equals",
"(",
"\"--includes\"",
")",
")",
"{",
"if",
"(",
"i",
"==",
"args",
".",
"length",
"-",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"doHelp",
"=",
"true",
";",
"break",
";",
"}",
"includes",
"=",
"args",
"[",
"++",
"i",
"]",
";",
"}",
"else",
"if",
"(",
"arg",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"if",
"(",
"i",
"==",
"args",
".",
"length",
"-",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"doHelp",
"=",
"true",
";",
"break",
";",
"}",
"extraDslds",
"=",
"args",
"[",
"++",
"i",
"]",
".",
"split",
"(",
"\"\\\\|\"",
")",
";",
"}",
"else",
"if",
"(",
"arg",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"if",
"(",
"i",
"==",
"args",
".",
"length",
"-",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"doHelp",
"=",
"true",
";",
"break",
";",
"}",
"projectFolderPath",
"=",
"args",
"[",
"++",
"i",
"]",
";",
"}",
"else",
"if",
"(",
"arg",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"if",
"(",
"i",
"==",
"args",
".",
"length",
"-",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"doHelp",
"=",
"true",
";",
"break",
";",
"}",
"resultFile",
"=",
"args",
"[",
"++",
"i",
"]",
";",
"}",
"}",
"inclusionFilters",
"=",
"convertToCharChar",
"(",
"includes",
")",
";",
"exclusionFilters",
"=",
"convertToCharChar",
"(",
"excludes",
")",
";",
"if",
"(",
"doHelp",
")",
"{",
"printUsage",
"(",
"false",
")",
";",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
"private",
"char",
"[",
"]",
"[",
"]",
"convertToCharChar",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"splits",
"=",
"str",
".",
"split",
"(",
"\"\\\\|\"",
")",
";",
"char",
"[",
"]",
"[",
"]",
"chars",
"=",
"new",
"char",
"[",
"splits",
".",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"splits",
".",
"length",
";",
"i",
"++",
")",
"{",
"chars",
"[",
"i",
"]",
"=",
"(",
"\"/\"",
"+",
"projectName",
"+",
"\"/\"",
"+",
"splits",
"[",
"i",
"]",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"return",
"chars",
";",
"}",
"private",
"void",
"printUsage",
"(",
"boolean",
"isInvalid",
")",
"{",
"if",
"(",
"isInvalid",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"Usage:\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"where:\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"private",
"void",
"removeExtraDslds",
"(",
")",
"{",
"if",
"(",
"extraDsldFiles",
"!=",
"null",
")",
"{",
"for",
"(",
"IFile",
"file",
":",
"extraDsldFiles",
")",
"{",
"if",
"(",
"file",
"!=",
"null",
"&&",
"file",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"nRemoving",
"\"",
"+",
"file",
".",
"getLocation",
"(",
")",
".",
"toFile",
"(",
")",
".",
"toURI",
"(",
")",
")",
";",
"file",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"}",
"}",
"protected",
"Display",
"createDisplay",
"(",
")",
"{",
"return",
"PlatformUI",
".",
"createDisplay",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,242 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"checker",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"StringTokenizer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Comment",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"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",
".",
"resources",
".",
"IResourceVisitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ContentTypeUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorWithRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ResourceTypeChecker",
"{",
"class",
"CheckerVisitor",
"implements",
"IResourceVisitor",
"{",
"private",
"IProgressMonitor",
"monitor",
";",
"CheckerVisitor",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"this",
".",
"monitor",
"=",
"monitor",
";",
"}",
"public",
"boolean",
"visit",
"(",
"IResource",
"resource",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"resource",
".",
"isDerived",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"handler",
".",
"handleResourceStart",
"(",
"resource",
")",
";",
"if",
"(",
"resource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FILE",
"&&",
"ContentTypeUtils",
".",
"isGroovyLikeFileName",
"(",
"resource",
".",
"getName",
"(",
")",
")",
")",
"{",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"resource",
",",
"includes",
",",
"excludes",
")",
")",
"{",
"return",
"false",
";",
"}",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"create",
"(",
"(",
"IFile",
")",
"resource",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
"&&",
"unit",
".",
"isOnBuildPath",
"(",
")",
")",
"{",
"if",
"(",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"{",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"}",
"monitor",
".",
"subTask",
"(",
"resource",
".",
"getName",
"(",
")",
")",
";",
"handler",
".",
"setResource",
"(",
"(",
"IFile",
")",
"resource",
")",
";",
"Map",
"<",
"Integer",
",",
"String",
">",
"commentsMap",
"=",
"findComments",
"(",
"unit",
")",
";",
"StaticTypeCheckerRequestor",
"requestor",
"=",
"new",
"StaticTypeCheckerRequestor",
"(",
"handler",
",",
"commentsMap",
",",
"onlyAssertions",
")",
";",
"TypeInferencingVisitorWithRequestor",
"visitor",
"=",
"new",
"TypeInferencingVisitorFactory",
"(",
")",
".",
"createVisitor",
"(",
"unit",
")",
";",
"try",
"{",
"unit",
".",
"becomeWorkingCopy",
"(",
"monitor",
")",
";",
"visitor",
".",
"visitCompilationUnit",
"(",
"requestor",
")",
";",
"}",
"finally",
"{",
"unit",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}",
"private",
"Map",
"<",
"Integer",
",",
"String",
">",
"findComments",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"List",
"<",
"Comment",
">",
"comments",
"=",
"unit",
".",
"getModuleNode",
"(",
")",
".",
"getContext",
"(",
")",
".",
"getComments",
"(",
")",
";",
"Map",
"<",
"Integer",
",",
"String",
">",
"allComments",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"String",
">",
"(",
"comments",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Comment",
"comment",
":",
"comments",
")",
"{",
"StringTokenizer",
"stok",
"=",
"new",
"StringTokenizer",
"(",
"comment",
".",
"toString",
"(",
")",
")",
";",
"String",
"type",
"=",
"null",
";",
"if",
"(",
"stok",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"String",
"val",
"=",
"stok",
".",
"nextToken",
"(",
")",
";",
"int",
"typeIndex",
"=",
"val",
".",
"indexOf",
"(",
"\"TYPE:\"",
")",
";",
"if",
"(",
"typeIndex",
">",
"0",
")",
"{",
"type",
"=",
"val",
".",
"substring",
"(",
"typeIndex",
"+",
"\"TYPE:\"",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"type",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"type",
"=",
"null",
";",
"}",
"}",
"}",
"String",
"candidate",
";",
"if",
"(",
"stok",
".",
"hasMoreTokens",
"(",
")",
"&&",
"(",
"candidate",
"=",
"stok",
".",
"nextToken",
"(",
")",
")",
".",
"startsWith",
"(",
"\"TYPE:\"",
")",
")",
"{",
"if",
"(",
"candidate",
".",
"equals",
"(",
"\"TYPE:\"",
")",
")",
"{",
"if",
"(",
"stok",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"type",
"=",
"stok",
".",
"nextToken",
"(",
")",
";",
"}",
"}",
"else",
"{",
"String",
"[",
"]",
"split",
"=",
"candidate",
".",
"split",
"(",
"\"\\\\:\"",
")",
";",
"type",
"=",
"split",
"[",
"1",
"]",
";",
"}",
"}",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"allComments",
".",
"put",
"(",
"comment",
".",
"sline",
",",
"type",
")",
";",
"}",
"}",
"return",
"allComments",
";",
"}",
"}",
"private",
"final",
"IStaticCheckerHandler",
"handler",
";",
"private",
"final",
"List",
"<",
"IResource",
">",
"resources",
";",
"protected",
"boolean",
"onlyAssertions",
";",
"protected",
"final",
"char",
"[",
"]",
"[",
"]",
"includes",
";",
"protected",
"final",
"char",
"[",
"]",
"[",
"]",
"excludes",
";",
"public",
"ResourceTypeChecker",
"(",
"IStaticCheckerHandler",
"handler",
",",
"String",
"projectName",
",",
"char",
"[",
"]",
"[",
"]",
"includes",
",",
"char",
"[",
"]",
"[",
"]",
"excludes",
",",
"boolean",
"onlyAssertions",
")",
"{",
"this",
"(",
"handler",
",",
"createProject",
"(",
"projectName",
")",
",",
"includes",
",",
"excludes",
",",
"onlyAssertions",
")",
";",
"}",
"public",
"ResourceTypeChecker",
"(",
"IStaticCheckerHandler",
"handler",
",",
"List",
"<",
"IResource",
">",
"resources",
",",
"char",
"[",
"]",
"[",
"]",
"includes",
",",
"char",
"[",
"]",
"[",
"]",
"excludes",
",",
"boolean",
"onlyAssertions",
")",
"{",
"this",
".",
"handler",
"=",
"handler",
";",
"this",
".",
"resources",
"=",
"resources",
";",
"this",
".",
"includes",
"=",
"includes",
";",
"this",
".",
"excludes",
"=",
"excludes",
";",
"this",
".",
"onlyAssertions",
"=",
"onlyAssertions",
";",
"}",
"private",
"static",
"List",
"<",
"IResource",
">",
"createProject",
"(",
"String",
"projectName",
")",
"{",
"IProject",
"project",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"projectName",
")",
";",
"if",
"(",
"!",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"project",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
"+",
"projectName",
")",
";",
"}",
"return",
"Collections",
".",
"<",
"IResource",
">",
"singletonList",
"(",
"project",
")",
";",
"}",
"public",
"boolean",
"doCheck",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"monitor",
"==",
"null",
")",
"{",
"monitor",
"=",
"new",
"NullProgressMonitor",
"(",
")",
";",
"}",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"resources",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"IResource",
"resource",
":",
"resources",
")",
"{",
"if",
"(",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"{",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"}",
"CheckerVisitor",
"visitor",
"=",
"new",
"CheckerVisitor",
"(",
"monitor",
")",
";",
"resource",
".",
"accept",
"(",
"visitor",
")",
";",
"monitor",
".",
"worked",
"(",
"1",
")",
";",
"}",
"return",
"handler",
".",
"finish",
"(",
"null",
")",
";",
"}",
"}",
"</s>"
] |
6,243 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"checker",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"public",
"class",
"ResourceMarkerHandler",
"implements",
"IStaticCheckerHandler",
"{",
"private",
"IFile",
"resource",
";",
"private",
"int",
"numFound",
"=",
"0",
";",
"public",
"void",
"setResource",
"(",
"IFile",
"resource",
")",
"{",
"this",
".",
"resource",
"=",
"resource",
";",
"}",
"public",
"void",
"handleUnknownReference",
"(",
"ASTNode",
"node",
",",
"Position",
"position",
",",
"int",
"line",
")",
"{",
"numFound",
"++",
";",
"createMarker",
"(",
"position",
",",
"line",
",",
"createUnknownMessage",
"(",
"node",
")",
")",
";",
"}",
"public",
"void",
"handleTypeAssertionFailed",
"(",
"ASTNode",
"node",
",",
"String",
"expectedType",
",",
"String",
"actualType",
",",
"Position",
"position",
",",
"int",
"line",
")",
"{",
"numFound",
"++",
";",
"createMarker",
"(",
"position",
",",
"line",
",",
"createInvalidTypeMessage",
"(",
"node",
",",
"expectedType",
",",
"actualType",
")",
")",
";",
"}",
"private",
"String",
"createUnknownMessage",
"(",
"ASTNode",
"node",
")",
"{",
"return",
"\"\"",
"+",
"node",
".",
"getText",
"(",
")",
";",
"}",
"private",
"String",
"createInvalidTypeMessage",
"(",
"ASTNode",
"node",
",",
"String",
"expectedType",
",",
"String",
"actualType",
")",
"{",
"return",
"\"\"",
"+",
"expectedType",
"+",
"\"",
"Actual:",
"\"",
"+",
"actualType",
";",
"}",
"private",
"void",
"createMarker",
"(",
"Position",
"position",
",",
"int",
"line",
",",
"String",
"message",
")",
"{",
"try",
"{",
"IMarker",
"marker",
"=",
"resource",
".",
"createMarker",
"(",
"GroovyDSLCoreActivator",
".",
"MARKER_ID",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"SEVERITY",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"CHAR_START",
",",
"position",
".",
"offset",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"CHAR_END",
",",
"position",
".",
"offset",
"+",
"position",
".",
"length",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"LINE_NUMBER",
",",
"line",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"LOCATION",
",",
"\"\"",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"SOURCE_ID",
",",
"\"Groovy\"",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"MESSAGE",
",",
"message",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"resource",
".",
"getFullPath",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"public",
"int",
"numProblemsFound",
"(",
")",
"{",
"return",
"numFound",
";",
"}",
"public",
"void",
"handleResourceStart",
"(",
"IResource",
"resource",
")",
"throws",
"CoreException",
"{",
"resource",
".",
"deleteMarkers",
"(",
"GroovyDSLCoreActivator",
".",
"MARKER_ID",
",",
"true",
",",
"IResource",
".",
"DEPTH_ZERO",
")",
";",
"}",
"public",
"boolean",
"finish",
"(",
"Shell",
"shell",
")",
"{",
"if",
"(",
"shell",
"!=",
"null",
")",
"{",
"if",
"(",
"numProblemsFound",
"(",
")",
"==",
"0",
")",
"{",
"MessageDialog",
".",
"openInformation",
"(",
"shell",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"else",
"if",
"(",
"numProblemsFound",
"(",
")",
"==",
"1",
")",
"{",
"MessageDialog",
".",
"openInformation",
"(",
"shell",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"else",
"{",
"MessageDialog",
".",
"openInformation",
"(",
"shell",
",",
"\"\"",
",",
"\"\"",
"+",
"numProblemsFound",
"(",
")",
"+",
"\"\"",
")",
";",
"}",
"}",
"return",
"numFound",
"==",
"0",
";",
"}",
"}",
"</s>"
] |
6,244 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"earlystartup",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"DSLPreferencesInitializer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"RefreshDSLDJob",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"InstanceScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IStartup",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"preferences",
".",
"ScopedPreferenceStore",
";",
"public",
"class",
"InitializeAllDSLDs",
"implements",
"IStartup",
"{",
"public",
"void",
"earlyStartup",
"(",
")",
"{",
"initializeAll",
"(",
")",
";",
"}",
"public",
"void",
"initializeAll",
"(",
")",
"{",
"IPreferenceStore",
"prefStore",
"=",
"getPreferenceStore",
"(",
")",
";",
"if",
"(",
"prefStore",
".",
"getBoolean",
"(",
"DSLPreferencesInitializer",
".",
"DSLD_DISABLED",
")",
")",
"{",
"return",
";",
"}",
"IProject",
"[",
"]",
"allProjects",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProjects",
"(",
")",
";",
"List",
"<",
"IProject",
">",
"toRefresh",
"=",
"new",
"ArrayList",
"<",
"IProject",
">",
"(",
"allProjects",
".",
"length",
")",
";",
"for",
"(",
"IProject",
"project",
":",
"allProjects",
")",
"{",
"try",
"{",
"if",
"(",
"project",
".",
"isAccessible",
"(",
")",
"&&",
"project",
".",
"hasNature",
"(",
"\"\"",
")",
")",
"{",
"toRefresh",
".",
"add",
"(",
"project",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"logException",
"(",
"e",
")",
";",
"}",
"}",
"Job",
"refreshJob",
"=",
"new",
"RefreshDSLDJob",
"(",
"toRefresh",
")",
";",
"refreshJob",
".",
"setPriority",
"(",
"Job",
".",
"LONG",
")",
";",
"refreshJob",
".",
"schedule",
"(",
")",
";",
"}",
"private",
"void",
"logException",
"(",
"CoreException",
"e",
")",
"{",
"GroovyDSLCoreActivator",
".",
"logException",
"(",
"e",
")",
";",
"}",
"static",
"final",
"String",
"PLUGIN_ID",
"=",
"\"\"",
";",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"IPreferenceStore",
"getPreferenceStore",
"(",
")",
"{",
"return",
"new",
"ScopedPreferenceStore",
"(",
"new",
"InstanceScope",
"(",
")",
",",
"PLUGIN_ID",
")",
";",
"}",
"}",
"</s>"
] |
6,245 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyLogManager",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"TraceCategory",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"SuggestionsLoader",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"inferencing",
".",
"suggestions",
".",
"writer",
".",
"SuggestionsFileProperties",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"script",
".",
"DSLDScriptExecutor",
";",
"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",
".",
"resources",
".",
"IResourceChangeEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceChangeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceDeltaVisitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"public",
"class",
"DSLDResourceListener",
"implements",
"IResourceChangeListener",
"{",
"private",
"class",
"DSLDChangeResourceDeltaVisitor",
"implements",
"IResourceDeltaVisitor",
"{",
"private",
"final",
"int",
"eventType",
";",
"private",
"DSLDChangeResourceDeltaVisitor",
"(",
"int",
"eventType",
")",
"{",
"this",
".",
"eventType",
"=",
"eventType",
";",
"}",
"public",
"boolean",
"visit",
"(",
"IResourceDelta",
"delta",
")",
"throws",
"CoreException",
"{",
"IResource",
"deltaResource",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"deltaResource",
".",
"isDerived",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"deltaResource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"IProject",
"project",
"=",
"(",
"IProject",
")",
"deltaResource",
";",
"if",
"(",
"(",
"eventType",
"==",
"IResourceChangeEvent",
".",
"PRE_DELETE",
"&&",
"delta",
".",
"getKind",
"(",
")",
"==",
"IResourceDelta",
".",
"REMOVED",
")",
"||",
"eventType",
"==",
"IResourceChangeEvent",
".",
"PRE_CLOSE",
"||",
"!",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"project",
")",
")",
"{",
"if",
"(",
"GroovyLogManager",
".",
"manager",
".",
"hasLoggers",
"(",
")",
")",
"{",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"\"\"",
"+",
"project",
".",
"getName",
"(",
")",
")",
";",
"}",
"contextStoreManager",
".",
"clearDSLDStore",
"(",
"project",
")",
";",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"!",
"contextStoreManager",
".",
"hasDSLDStoreFor",
"(",
"project",
")",
"&&",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"project",
")",
")",
"{",
"Job",
"refreshJob",
"=",
"new",
"RefreshDSLDJob",
"(",
"project",
")",
";",
"refreshJob",
".",
"setPriority",
"(",
"Job",
".",
"LONG",
")",
";",
"refreshJob",
".",
"schedule",
"(",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"project",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"if",
"(",
"deltaResource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FILE",
")",
"{",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"deltaResource",
";",
"if",
"(",
"isDSLDFile",
"(",
"file",
")",
"||",
"isXDSL",
"(",
"file",
")",
")",
"{",
"IProject",
"project",
"=",
"file",
".",
"getProject",
"(",
")",
";",
"DSLDStore",
"store",
"=",
"contextStoreManager",
".",
"getDSLDStore",
"(",
"project",
")",
";",
"Assert",
".",
"isNotNull",
"(",
"store",
",",
"\"\"",
")",
";",
"if",
"(",
"GroovyLogManager",
".",
"manager",
".",
"hasLoggers",
"(",
")",
")",
"{",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"\"Processing",
"\"",
"+",
"file",
".",
"getName",
"(",
")",
")",
";",
"}",
"store",
".",
"purgeIdentifier",
"(",
"file",
")",
";",
"if",
"(",
"file",
".",
"isAccessible",
"(",
")",
"&&",
"eventType",
"==",
"IResourceChangeEvent",
".",
"POST_CHANGE",
")",
"{",
"if",
"(",
"isDSLDFile",
"(",
"file",
")",
")",
"{",
"DSLDScriptExecutor",
"executor",
"=",
"new",
"DSLDScriptExecutor",
"(",
"JavaCore",
".",
"create",
"(",
"project",
")",
")",
";",
"executor",
".",
"executeScript",
"(",
"file",
")",
";",
"}",
"else",
"if",
"(",
"isXDSL",
"(",
"file",
")",
")",
"{",
"new",
"SuggestionsLoader",
"(",
"file",
")",
".",
"addSuggestionsContributionGroup",
"(",
")",
";",
"}",
"}",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"private",
"static",
"final",
"DSLDStoreManager",
"contextStoreManager",
"=",
"GroovyDSLCoreActivator",
".",
"getDefault",
"(",
")",
".",
"getContextStoreManager",
"(",
")",
";",
"public",
"void",
"resourceChanged",
"(",
"IResourceChangeEvent",
"event",
")",
"{",
"switch",
"(",
"event",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResourceChangeEvent",
".",
"PRE_DELETE",
":",
"case",
"IResourceChangeEvent",
".",
"PRE_CLOSE",
":",
"case",
"IResourceChangeEvent",
".",
"POST_CHANGE",
":",
"try",
"{",
"if",
"(",
"event",
".",
"getDelta",
"(",
")",
"!=",
"null",
")",
"{",
"event",
".",
"getDelta",
"(",
")",
".",
"accept",
"(",
"new",
"DSLDChangeResourceDeltaVisitor",
"(",
"event",
".",
"getType",
"(",
")",
")",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyDSLCoreActivator",
".",
"logException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"public",
"boolean",
"isDSLDFile",
"(",
"IFile",
"file",
")",
"{",
"String",
"fileExtension",
"=",
"file",
".",
"getFileExtension",
"(",
")",
";",
"return",
"fileExtension",
"!=",
"null",
"&&",
"fileExtension",
".",
"equals",
"(",
"\"dsld\"",
")",
";",
"}",
"public",
"boolean",
"isXDSL",
"(",
"IFile",
"file",
")",
"{",
"String",
"fileExtension",
"=",
"file",
".",
"getFileExtension",
"(",
")",
";",
"return",
"fileExtension",
"!=",
"null",
"&&",
"fileExtension",
".",
"equals",
"(",
"SuggestionsFileProperties",
".",
"FILE_TYPE",
")",
";",
"}",
"}",
"</s>"
] |
6,246 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"script",
";",
"import",
"groovy",
".",
"lang",
".",
"Closure",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"IPointcut",
";",
"public",
"class",
"PointcutClosure",
"extends",
"Closure",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"-",
"1L",
";",
"private",
"final",
"IPointcut",
"pointcut",
";",
"public",
"PointcutClosure",
"(",
"Object",
"owner",
",",
"IPointcut",
"pointcut",
")",
"{",
"super",
"(",
"owner",
")",
";",
"this",
".",
"pointcut",
"=",
"pointcut",
";",
"}",
"public",
"PointcutClosure",
"(",
"Object",
"owner",
",",
"Object",
"thisObject",
",",
"IPointcut",
"pointcut",
")",
"{",
"super",
"(",
"owner",
",",
"thisObject",
")",
";",
"this",
".",
"pointcut",
"=",
"pointcut",
";",
"}",
"@",
"Override",
"public",
"Object",
"call",
"(",
"Object",
"arguments",
")",
"{",
"if",
"(",
"arguments",
"instanceof",
"Map",
"<",
"?",
",",
"?",
">",
")",
"{",
"for",
"(",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"(",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
")",
"arguments",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"Object",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"pointcut",
".",
"addArgument",
"(",
"key",
"==",
"null",
"?",
"null",
":",
"key",
".",
"toString",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"arguments",
"instanceof",
"Collection",
"<",
"?",
">",
")",
"{",
"for",
"(",
"Object",
"arg",
":",
"(",
"Collection",
"<",
"Object",
">",
")",
"arguments",
")",
"{",
"pointcut",
".",
"addArgument",
"(",
"arg",
")",
";",
"}",
"}",
"else",
"if",
"(",
"arguments",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"for",
"(",
"Object",
"arg",
":",
"(",
"Object",
"[",
"]",
")",
"arguments",
")",
"{",
"pointcut",
".",
"addArgument",
"(",
"arg",
")",
";",
"}",
"}",
"else",
"if",
"(",
"arguments",
"!=",
"null",
")",
"{",
"pointcut",
".",
"addArgument",
"(",
"arguments",
")",
";",
"}",
"return",
"pointcut",
";",
"}",
"@",
"Override",
"public",
"Object",
"call",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"args",
".",
"length",
"==",
"1",
"&&",
"args",
"[",
"0",
"]",
"instanceof",
"Map",
")",
"{",
"return",
"call",
"(",
"args",
"[",
"0",
"]",
")",
";",
"}",
"for",
"(",
"Object",
"arg",
":",
"args",
")",
"{",
"pointcut",
".",
"addArgument",
"(",
"arg",
")",
";",
"}",
"return",
"pointcut",
";",
"}",
"@",
"Override",
"public",
"Object",
"call",
"(",
")",
"{",
"return",
"pointcut",
";",
"}",
"}",
"</s>"
] |
6,247 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"script",
";",
"import",
"groovy",
".",
"lang",
".",
"Binding",
";",
"import",
"groovy",
".",
"lang",
".",
"Closure",
";",
"import",
"groovy",
".",
"lang",
".",
"GroovyClassLoader",
";",
"import",
"groovy",
".",
"lang",
".",
"MissingMethodException",
";",
"import",
"groovy",
".",
"lang",
".",
"Script",
";",
"import",
"java",
".",
"io",
".",
"BufferedReader",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStreamReader",
";",
"import",
"java",
".",
"io",
".",
"PrintWriter",
";",
"import",
"java",
".",
"io",
".",
"StringWriter",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyLogManager",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"TraceCategory",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"IPointcut",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IStorage",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Platform",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"Bundle",
";",
"import",
"org",
".",
"osgi",
".",
"framework",
".",
"Version",
";",
"public",
"class",
"DSLDScriptExecutor",
"{",
"private",
"final",
"class",
"UnsupportedDSLVersion",
"extends",
"RuntimeException",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"public",
"UnsupportedDSLVersion",
"(",
"String",
"why",
")",
"{",
"super",
"(",
"scriptFile",
".",
"getName",
"(",
")",
"+",
"\"\"",
"+",
"why",
")",
";",
"}",
"}",
"private",
"final",
"class",
"RegisterClosure",
"extends",
"Closure",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1162731585734041055L",
";",
"public",
"RegisterClosure",
"(",
"Object",
"owner",
")",
"{",
"super",
"(",
"owner",
")",
";",
"}",
"@",
"Override",
"public",
"Object",
"call",
"(",
"Object",
"arguments",
")",
"{",
"return",
"tryRegister",
"(",
"arguments",
")",
";",
"}",
"@",
"Override",
"public",
"Object",
"call",
"(",
"Object",
"[",
"]",
"arguments",
")",
"{",
"return",
"tryRegister",
"(",
"arguments",
")",
";",
"}",
"}",
"private",
"final",
"class",
"DSLDScriptBinding",
"extends",
"Binding",
"{",
"private",
"final",
"Script",
"dsldScript",
";",
"public",
"DSLDScriptBinding",
"(",
"Script",
"dsldScript",
")",
"{",
"this",
".",
"dsldScript",
"=",
"dsldScript",
";",
"}",
"@",
"Override",
"public",
"Object",
"invokeMethod",
"(",
"String",
"name",
",",
"Object",
"args",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"return",
"tryRegister",
"(",
"args",
")",
";",
"}",
"else",
"if",
"(",
"name",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"String",
"result",
"=",
"(",
"String",
")",
"checkVersion",
"(",
"new",
"Object",
"[",
"]",
"{",
"args",
"}",
")",
";",
"return",
"result",
"==",
"null",
";",
"}",
"else",
"if",
"(",
"name",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"String",
"result",
"=",
"(",
"String",
")",
"checkVersion",
"(",
"new",
"Object",
"[",
"]",
"{",
"args",
"}",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"throw",
"new",
"UnsupportedDSLVersion",
"(",
"result",
")",
";",
"}",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"name",
".",
"equals",
"(",
"\"contribute\"",
")",
")",
"{",
"Object",
"result",
"=",
"contribution",
"(",
"args",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"MissingMethodException",
"(",
"name",
",",
"dsldScript",
".",
"getClass",
"(",
")",
",",
"new",
"Object",
"[",
"]",
"{",
"args",
"}",
")",
";",
"}",
"return",
"result",
";",
"}",
"else",
"if",
"(",
"name",
".",
"equals",
"(",
"\"log\"",
")",
")",
"{",
"if",
"(",
"GroovyLogManager",
".",
"manager",
".",
"hasLoggers",
"(",
")",
")",
"{",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"\"==========",
"\"",
"+",
"args",
")",
";",
"}",
"return",
"args",
";",
"}",
"IPointcut",
"pc",
"=",
"factory",
".",
"createPointcut",
"(",
"name",
")",
";",
"if",
"(",
"pc",
"!=",
"null",
")",
"{",
"configure",
"(",
"pc",
",",
"args",
")",
";",
"return",
"pc",
";",
"}",
"else",
"{",
"return",
"super",
".",
"invokeMethod",
"(",
"name",
",",
"args",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"Object",
"getVariable",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"new",
"RegisterClosure",
"(",
"this",
")",
";",
"}",
"else",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"new",
"Closure",
"(",
"this",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"Override",
"public",
"Object",
"call",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"String",
"result",
"=",
"(",
"String",
")",
"checkVersion",
"(",
"args",
")",
";",
"return",
"result",
"==",
"null",
";",
"}",
"}",
";",
"}",
"else",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"new",
"Closure",
"(",
"this",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"Override",
"public",
"Object",
"call",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"String",
"result",
"=",
"(",
"String",
")",
"checkVersion",
"(",
"args",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"throw",
"new",
"UnsupportedDSLVersion",
"(",
"result",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
";",
"}",
"else",
"if",
"(",
"\"contribute\"",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"new",
"Closure",
"(",
"this",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"Override",
"public",
"Object",
"call",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"Object",
"result",
"=",
"contribution",
"(",
"args",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"MissingMethodException",
"(",
"\"contribute\"",
",",
"dsldScript",
".",
"getClass",
"(",
")",
",",
"new",
"Object",
"[",
"]",
"{",
"args",
"}",
")",
";",
"}",
"return",
"result",
";",
"}",
"}",
";",
"}",
"else",
"if",
"(",
"\"log\"",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"new",
"Closure",
"(",
"this",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"Override",
"public",
"Object",
"call",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"GroovyLogManager",
".",
"manager",
".",
"hasLoggers",
"(",
")",
")",
"{",
"String",
"msg",
";",
"if",
"(",
"args",
"==",
"null",
")",
"{",
"msg",
"=",
"\"null\"",
";",
"}",
"else",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"msg",
"=",
"\"\"",
";",
"}",
"else",
"{",
"msg",
"=",
"args",
"[",
"0",
"]",
".",
"toString",
"(",
")",
";",
"}",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"\"==========",
"\"",
"+",
"msg",
")",
";",
"}",
"return",
"args",
";",
"}",
"}",
";",
"}",
"IPointcut",
"pc",
"=",
"factory",
".",
"createPointcut",
"(",
"name",
")",
";",
"if",
"(",
"pc",
"!=",
"null",
")",
"{",
"return",
"new",
"PointcutClosure",
"(",
"this",
",",
"pc",
")",
";",
"}",
"else",
"{",
"return",
"super",
".",
"getVariable",
"(",
"name",
")",
";",
"}",
"}",
"private",
"void",
"configure",
"(",
"IPointcut",
"pointcut",
",",
"Object",
"arguments",
")",
"{",
"if",
"(",
"arguments",
"instanceof",
"Map",
"<",
"?",
",",
"?",
">",
")",
"{",
"for",
"(",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"(",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
")",
"arguments",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"Object",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"pointcut",
".",
"addArgument",
"(",
"key",
"==",
"null",
"?",
"null",
":",
"key",
".",
"toString",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"arguments",
"instanceof",
"Collection",
"<",
"?",
">",
")",
"{",
"for",
"(",
"Object",
"arg",
":",
"(",
"Collection",
"<",
"Object",
">",
")",
"arguments",
")",
"{",
"pointcut",
".",
"addArgument",
"(",
"arg",
")",
";",
"}",
"}",
"else",
"if",
"(",
"arguments",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"for",
"(",
"Object",
"arg",
":",
"(",
"Object",
"[",
"]",
")",
"arguments",
")",
"{",
"pointcut",
".",
"addArgument",
"(",
"arg",
")",
";",
"}",
"}",
"else",
"if",
"(",
"arguments",
"!=",
"null",
")",
"{",
"pointcut",
".",
"addArgument",
"(",
"arguments",
")",
";",
"}",
"}",
"}",
"private",
"final",
"GroovyClassLoader",
"gcl",
";",
"private",
"final",
"IJavaProject",
"project",
";",
"private",
"PointcutFactory",
"factory",
";",
"private",
"IStorage",
"scriptFile",
";",
"public",
"DSLDScriptExecutor",
"(",
"IJavaProject",
"project",
")",
"{",
"gcl",
"=",
"new",
"GroovyClassLoader",
"(",
"GroovyDSLCoreActivator",
".",
"class",
".",
"getClassLoader",
"(",
")",
")",
";",
"this",
".",
"project",
"=",
"project",
";",
"}",
"public",
"Object",
"executeScript",
"(",
"IStorage",
"scriptFile",
")",
"{",
"this",
".",
"scriptFile",
"=",
"scriptFile",
";",
"String",
"event",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"GroovyLogManager",
".",
"manager",
".",
"hasLoggers",
"(",
")",
")",
"{",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"\"\"",
"+",
"scriptFile",
")",
";",
"event",
"=",
"\"\"",
"+",
"scriptFile",
";",
"GroovyLogManager",
".",
"manager",
".",
"logStart",
"(",
"event",
")",
";",
"}",
"factory",
"=",
"new",
"PointcutFactory",
"(",
"scriptFile",
",",
"project",
".",
"getProject",
"(",
")",
")",
";",
"Object",
"result",
"=",
"null",
";",
"try",
"{",
"String",
"scriptContents",
"=",
"getContents",
"(",
"scriptFile",
")",
";",
"Class",
"<",
"Script",
">",
"clazz",
"=",
"null",
";",
"try",
"{",
"clazz",
"=",
"gcl",
".",
"parseClass",
"(",
"scriptContents",
",",
"scriptFile",
".",
"getName",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"GroovyLogManager",
".",
"manager",
".",
"hasLoggers",
"(",
")",
")",
"{",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"e",
".",
"printStackTrace",
"(",
"new",
"PrintWriter",
"(",
"writer",
")",
")",
";",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"\"\"",
"+",
"scriptFile",
"+",
"\"\"",
"+",
"writer",
".",
"getBuffer",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}",
"if",
"(",
"!",
"Script",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
")",
"{",
"if",
"(",
"GroovyLogManager",
".",
"manager",
".",
"hasLoggers",
"(",
")",
")",
"{",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"\"Class",
"\"",
"+",
"scriptFile",
"+",
"\"\"",
")",
";",
"}",
"return",
"result",
";",
"}",
"Script",
"dsldScript",
"=",
"clazz",
".",
"newInstance",
"(",
")",
";",
"dsldScript",
".",
"setBinding",
"(",
"new",
"DSLDScriptBinding",
"(",
"dsldScript",
")",
")",
";",
"result",
"=",
"dsldScript",
".",
"run",
"(",
")",
";",
"}",
"catch",
"(",
"UnsupportedDSLVersion",
"e",
")",
"{",
"if",
"(",
"GroovyLogManager",
".",
"manager",
".",
"hasLoggers",
"(",
")",
")",
"{",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyDSLCoreActivator",
".",
"logException",
"(",
"e",
")",
";",
"}",
"return",
"result",
";",
"}",
"finally",
"{",
"if",
"(",
"event",
"!=",
"null",
")",
"{",
"GroovyLogManager",
".",
"manager",
".",
"logEnd",
"(",
"event",
",",
"TraceCategory",
".",
"DSL",
")",
";",
"}",
"}",
"}",
"public",
"String",
"getContents",
"(",
"IStorage",
"file",
")",
"throws",
"IOException",
",",
"CoreException",
"{",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"file",
".",
"getContents",
"(",
")",
")",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"300",
")",
";",
"try",
"{",
"int",
"read",
"=",
"0",
";",
"while",
"(",
"(",
"read",
"=",
"br",
".",
"read",
"(",
")",
")",
"!=",
"-",
"1",
")",
"sb",
".",
"append",
"(",
"(",
"char",
")",
"read",
")",
";",
"}",
"finally",
"{",
"br",
".",
"close",
"(",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"Object",
"tryRegister",
"(",
"Object",
"args",
")",
"{",
"Object",
"[",
"]",
"nameAndClosure",
"=",
"extractArgsForRegister",
"(",
"args",
")",
";",
"if",
"(",
"nameAndClosure",
"!=",
"null",
")",
"{",
"factory",
".",
"registerLocalPointcut",
"(",
"(",
"String",
")",
"nameAndClosure",
"[",
"0",
"]",
",",
"(",
"Closure",
")",
"nameAndClosure",
"[",
"1",
"]",
")",
";",
"return",
"nameAndClosure",
"[",
"1",
"]",
";",
"}",
"else",
"{",
"if",
"(",
"GroovyLogManager",
".",
"manager",
".",
"hasLoggers",
"(",
")",
")",
"{",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"\"\"",
"+",
"(",
"args",
"instanceof",
"Object",
"[",
"]",
"?",
"Arrays",
".",
"toString",
"(",
"(",
"Object",
"[",
"]",
")",
"args",
")",
":",
"args",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"protected",
"Object",
"[",
"]",
"extractArgsContribution",
"(",
"Object",
"args",
")",
"{",
"if",
"(",
"args",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"Object",
"[",
"]",
"arr",
"=",
"(",
"Object",
"[",
"]",
")",
"args",
";",
"if",
"(",
"arr",
".",
"length",
"==",
"2",
"&&",
"arr",
"[",
"0",
"]",
"instanceof",
"IPointcut",
"&&",
"arr",
"[",
"1",
"]",
"instanceof",
"Closure",
")",
"{",
"return",
"arr",
";",
"}",
"}",
"else",
"if",
"(",
"args",
"instanceof",
"Collection",
"<",
"?",
">",
")",
"{",
"Collection",
"<",
"Object",
">",
"coll",
"=",
"(",
"Collection",
"<",
"Object",
">",
")",
"args",
";",
"Object",
"[",
"]",
"arr",
"=",
"new",
"Object",
"[",
"2",
"]",
";",
"Iterator",
"<",
"Object",
">",
"iter",
"=",
"coll",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"iter",
".",
"hasNext",
"(",
")",
"&&",
"(",
"arr",
"[",
"0",
"]",
"=",
"iter",
".",
"next",
"(",
")",
")",
"instanceof",
"IPointcut",
"&&",
"iter",
".",
"hasNext",
"(",
")",
"&&",
"(",
"arr",
"[",
"1",
"]",
"=",
"iter",
".",
"next",
"(",
")",
")",
"instanceof",
"Closure",
"&&",
"!",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"arr",
";",
"}",
"}",
"else",
"if",
"(",
"args",
"instanceof",
"Map",
"<",
"?",
",",
"?",
">",
")",
"{",
"return",
"extractArgsContribution",
"(",
"(",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
")",
"args",
")",
".",
"values",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"Object",
"[",
"]",
"extractArgsForRegister",
"(",
"Object",
"args",
")",
"{",
"if",
"(",
"args",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"Object",
"[",
"]",
"arr",
"=",
"(",
"Object",
"[",
"]",
")",
"args",
";",
"if",
"(",
"arr",
".",
"length",
"==",
"2",
"&&",
"arr",
"[",
"0",
"]",
"instanceof",
"String",
"&&",
"arr",
"[",
"1",
"]",
"instanceof",
"Closure",
")",
"{",
"return",
"arr",
";",
"}",
"}",
"else",
"if",
"(",
"args",
"instanceof",
"Collection",
"<",
"?",
">",
")",
"{",
"Collection",
"<",
"Object",
">",
"coll",
"=",
"(",
"Collection",
"<",
"Object",
">",
")",
"args",
";",
"Object",
"[",
"]",
"arr",
"=",
"new",
"Object",
"[",
"2",
"]",
";",
"Iterator",
"<",
"Object",
">",
"iter",
"=",
"coll",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"iter",
".",
"hasNext",
"(",
")",
"&&",
"(",
"arr",
"[",
"0",
"]",
"=",
"iter",
".",
"next",
"(",
")",
")",
"instanceof",
"String",
"&&",
"iter",
".",
"hasNext",
"(",
")",
"&&",
"(",
"arr",
"[",
"1",
"]",
"=",
"iter",
".",
"next",
"(",
")",
")",
"instanceof",
"Closure",
"&&",
"!",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"arr",
";",
"}",
"}",
"else",
"if",
"(",
"args",
"instanceof",
"Map",
"<",
"?",
",",
"?",
">",
")",
"{",
"return",
"extractArgsForRegister",
"(",
"(",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
")",
"args",
")",
".",
"values",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"static",
"Version",
"groovyEclipseVersion",
";",
"private",
"static",
"Version",
"groovyVersion",
";",
"private",
"static",
"Version",
"grailsToolingVersion",
";",
"private",
"final",
"static",
"Object",
"versionLock",
"=",
"new",
"Object",
"(",
")",
";",
"private",
"static",
"void",
"initializeVersions",
"(",
")",
"{",
"groovyEclipseVersion",
"=",
"GroovyDSLCoreActivator",
".",
"getDefault",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"getVersion",
"(",
")",
";",
"Bundle",
"groovyBundle",
"=",
"Platform",
".",
"getBundle",
"(",
"\"\"",
")",
";",
"if",
"(",
"groovyBundle",
"!=",
"null",
")",
"{",
"groovyVersion",
"=",
"groovyBundle",
".",
"getVersion",
"(",
")",
";",
"}",
"Bundle",
"grailsBundle",
"=",
"Platform",
".",
"getBundle",
"(",
"\"\"",
")",
";",
"if",
"(",
"grailsBundle",
"==",
"null",
")",
"{",
"grailsBundle",
"=",
"Platform",
".",
"getBundle",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"grailsBundle",
"!=",
"null",
")",
"{",
"grailsToolingVersion",
"=",
"grailsBundle",
".",
"getVersion",
"(",
")",
";",
"}",
"}",
"public",
"Object",
"contribution",
"(",
"Object",
"args",
")",
"{",
"Object",
"[",
"]",
"contributionArgs",
"=",
"extractArgsContribution",
"(",
"args",
")",
";",
"if",
"(",
"args",
"==",
"null",
"||",
"contributionArgs",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"IPointcut",
"p",
"=",
"(",
"IPointcut",
")",
"contributionArgs",
"[",
"0",
"]",
";",
"p",
".",
"accept",
"(",
"(",
"Closure",
")",
"contributionArgs",
"[",
"1",
"]",
")",
";",
"return",
"Boolean",
".",
"TRUE",
";",
"}",
"public",
"Object",
"checkVersion",
"(",
"Object",
"[",
"]",
"array",
")",
"{",
"if",
"(",
"array",
"==",
"null",
"||",
"array",
".",
"length",
"!=",
"1",
")",
"{",
"return",
"createInvalidVersionString",
"(",
"array",
")",
";",
"}",
"Object",
"args",
"=",
"array",
"[",
"0",
"]",
";",
"synchronized",
"(",
"versionLock",
")",
"{",
"if",
"(",
"groovyEclipseVersion",
"==",
"null",
")",
"{",
"initializeVersions",
"(",
")",
";",
"}",
"}",
"if",
"(",
"!",
"(",
"args",
"instanceof",
"Map",
"<",
"?",
",",
"?",
">",
")",
")",
"{",
"return",
"createInvalidVersionString",
"(",
"args",
")",
";",
"}",
"Map",
"<",
"?",
",",
"?",
">",
"versions",
"=",
"(",
"Map",
"<",
"?",
",",
"?",
">",
")",
"args",
";",
"for",
"(",
"Entry",
"<",
"?",
",",
"?",
">",
"entry",
":",
"versions",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"!",
"(",
"entry",
".",
"getValue",
"(",
")",
"instanceof",
"String",
")",
")",
"{",
"return",
"createInvalidVersionString",
"(",
"args",
")",
";",
"}",
"Version",
"v",
"=",
"null",
";",
"try",
"{",
"v",
"=",
"new",
"Version",
"(",
"(",
"String",
")",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"throw",
"new",
"UnsupportedDSLVersion",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"if",
"(",
"\"groovy\"",
".",
"equals",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
")",
"{",
"if",
"(",
"groovyVersion",
"!=",
"null",
"&&",
"v",
".",
"compareTo",
"(",
"groovyVersion",
")",
">",
"0",
")",
"{",
"return",
"\"\"",
"+",
"v",
"+",
"\"",
"Installed:",
"\"",
"+",
"groovyVersion",
";",
"}",
"else",
"if",
"(",
"groovyVersion",
"==",
"null",
")",
"{",
"return",
"\"\"",
"+",
"groovyVersion",
";",
"}",
"}",
"else",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
")",
"{",
"if",
"(",
"groovyEclipseVersion",
"!=",
"null",
"&&",
"v",
".",
"compareTo",
"(",
"groovyEclipseVersion",
")",
">",
"0",
")",
"{",
"return",
"\"\"",
"+",
"v",
"+",
"\"",
"Installed:",
"\"",
"+",
"groovyEclipseVersion",
";",
"}",
"else",
"if",
"(",
"groovyEclipseVersion",
"==",
"null",
")",
"{",
"return",
"\"\"",
"+",
"groovyEclipseVersion",
";",
"}",
"}",
"else",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
"||",
"\"sts\"",
".",
"equals",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
")",
"{",
"if",
"(",
"grailsToolingVersion",
"!=",
"null",
"&&",
"v",
".",
"compareTo",
"(",
"grailsToolingVersion",
")",
">",
"0",
")",
"{",
"return",
"\"\"",
"+",
"v",
"+",
"\"",
"Installed:",
"\"",
"+",
"grailsToolingVersion",
";",
"}",
"else",
"if",
"(",
"grailsToolingVersion",
"==",
"null",
")",
"{",
"return",
"\"\"",
"+",
"grailsToolingVersion",
";",
"}",
"}",
"else",
"{",
"return",
"createInvalidVersionString",
"(",
"args",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"String",
"createInvalidVersionString",
"(",
"Object",
"args",
")",
"{",
"return",
"args",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"}",
"}",
"</s>"
] |
6,248 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"script",
";",
"import",
"groovy",
".",
"lang",
".",
"Closure",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"AbstractPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"IPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"AbstractModifierPointcut",
".",
"FinalPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"AbstractModifierPointcut",
".",
"PrivatePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"AbstractModifierPointcut",
".",
"PublicPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"AbstractModifierPointcut",
".",
"StaticPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"AbstractModifierPointcut",
".",
"SynchronizedPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"AndPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"BindPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"CurrentIdentifierPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"CurrentTypeIsEnclosingTypePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"CurrentTypePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"DeclaringTypePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"EnclosingCallDeclaringTypePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"EnclosingCallNamePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"EnclosingCallPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"EnclosingClassPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"EnclosingClosurePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"EnclosingFieldPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"EnclosingMethodPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"EnclosingScriptPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"FileExtensionPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"FileNamePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"FindAnnotationPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"FindFieldPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"FindMethodPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"FindPropertyPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"HasArgumentsPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"HasAttributesPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"IsThisTypePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"NamePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"NotPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"OrPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"PackageFolderPointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"ProjectNaturePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"SourceFolderOfFilePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"SourceFolderOfTypePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"SubTypePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"TypePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"UserExtensiblePointcut",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"pointcuts",
".",
"impl",
".",
"ValuePointcut",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IStorage",
";",
"public",
"class",
"PointcutFactory",
"{",
"private",
"static",
"final",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
"extends",
"IPointcut",
">",
">",
"registry",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Class",
"<",
"?",
"extends",
"IPointcut",
">",
">",
"(",
")",
";",
"private",
"static",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"docRegistry",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"private",
"static",
"final",
"Set",
"<",
"String",
">",
"deprecatedRegistry",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"static",
"{",
"registerGlobalPointcut",
"(",
"\"and\"",
",",
"AndPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"or\"",
",",
"OrPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"not\"",
",",
"NotPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"any",
"pointcut\"",
",",
"\"\"",
"+",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"bind\"",
",",
"BindPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"any",
"pointcut\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"currentType\"",
",",
"CurrentTypePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"isThisType\"",
",",
"IsThisTypePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"subType\"",
",",
"SubTypePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"annotatedBy\"",
",",
"FindAnnotationPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"fields\"",
",",
"FindFieldPointcut",
".",
"class",
",",
"createFind",
"(",
"\"field\"",
",",
"\"fields\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"methods\"",
",",
"FindMethodPointcut",
".",
"class",
",",
"createFind",
"(",
"\"method\"",
",",
"\"methods\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"properties\"",
",",
"FindPropertyPointcut",
".",
"class",
",",
"createFind",
"(",
"\"property\"",
",",
"\"properties\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"name\"",
",",
"NamePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"isFinal\"",
",",
"FinalPointcut",
".",
"class",
",",
"createModifier",
"(",
"\"final\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"isPrivate\"",
",",
"PrivatePointcut",
".",
"class",
",",
"createModifier",
"(",
"\"private\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"isPublic\"",
",",
"PublicPointcut",
".",
"class",
",",
"createModifier",
"(",
"\"public\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"isStatic\"",
",",
"StaticPointcut",
".",
"class",
",",
"createModifier",
"(",
"\"static\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"SynchronizedPointcut",
".",
"class",
",",
"createModifier",
"(",
"\"synchronized\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"SourceFolderOfTypePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"hasAttribute\"",
",",
"HasAttributesPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"hasArgument\"",
",",
"HasArgumentsPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"value\"",
",",
"ValuePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"type\"",
",",
"TypePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"DeclaringTypePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"EnclosingCallPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"EnclosingClassPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"isClass\"",
",",
"EnclosingClassPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"EnclosingScriptPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"isScript\"",
",",
"EnclosingScriptPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"EnclosingFieldPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"EnclosingMethodPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"EnclosingCallNamePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"EnclosingCallDeclaringTypePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"EnclosingClosurePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"none\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"inClosure\"",
",",
"EnclosingClosurePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"none\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"CurrentIdentifierPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"FileExtensionPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"fileName\"",
",",
"FileNamePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"PackageFolderPointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"nature\"",
",",
"ProjectNaturePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"SourceFolderOfFilePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"false",
")",
";",
"registerGlobalPointcut",
"(",
"\"\"",
",",
"CurrentTypeIsEnclosingTypePointcut",
".",
"class",
",",
"createDoc",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
",",
"true",
")",
";",
"}",
"private",
"static",
"String",
"createModifier",
"(",
"String",
"modifier",
")",
"{",
"return",
"createDoc",
"(",
"\"\"",
"+",
"modifier",
"+",
"\"</code>\"",
",",
"\"none\"",
",",
"\"\"",
"+",
"modifier",
"+",
"\"</code>.\"",
")",
";",
"}",
"private",
"static",
"String",
"createFind",
"(",
"String",
"kind",
",",
"String",
"kinds",
")",
"{",
"return",
"createDoc",
"(",
"\"\"",
"+",
"kind",
"+",
"\"\"",
"+",
"kind",
"+",
"\"\"",
",",
"\"\"",
"+",
"kind",
"+",
"\"\"",
"+",
"\"\"",
"+",
"kinds",
"+",
"\"\"",
",",
"\"the",
"\"",
"+",
"kind",
"+",
"\"",
"or",
"\"",
"+",
"kinds",
"+",
"\"\"",
"+",
"\"\"",
"+",
"kinds",
"+",
"\"",
"in",
"that",
"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"kinds",
"+",
"\"\"",
"+",
"kinds",
"+",
"\"\"",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"private",
"final",
"Map",
"<",
"String",
",",
"Closure",
">",
"localRegistry",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Closure",
">",
"(",
")",
";",
"private",
"final",
"IStorage",
"uniqueID",
";",
"private",
"final",
"IProject",
"project",
";",
"public",
"PointcutFactory",
"(",
"IStorage",
"uniqueID",
",",
"IProject",
"project",
")",
"{",
"this",
".",
"uniqueID",
"=",
"uniqueID",
";",
"this",
".",
"project",
"=",
"project",
";",
"}",
"private",
"static",
"void",
"registerGlobalPointcut",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
"extends",
"IPointcut",
">",
"pcClazz",
",",
"String",
"doc",
",",
"boolean",
"isDeprecated",
")",
"{",
"registry",
".",
"put",
"(",
"name",
",",
"pcClazz",
")",
";",
"docRegistry",
".",
"put",
"(",
"name",
",",
"doc",
")",
";",
"if",
"(",
"isDeprecated",
")",
"{",
"deprecatedRegistry",
".",
"add",
"(",
"name",
")",
";",
"}",
"}",
"public",
"void",
"registerLocalPointcut",
"(",
"String",
"name",
",",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"Closure",
"c",
")",
"{",
"localRegistry",
".",
"put",
"(",
"name",
",",
"c",
")",
";",
"}",
"public",
"IPointcut",
"createPointcut",
"(",
"String",
"name",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"Closure",
"c",
"=",
"localRegistry",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"UserExtensiblePointcut",
"userExtensiblePointcut",
"=",
"new",
"UserExtensiblePointcut",
"(",
"uniqueID",
",",
"name",
",",
"c",
")",
";",
"userExtensiblePointcut",
".",
"setProject",
"(",
"project",
")",
";",
"return",
"userExtensiblePointcut",
";",
"}",
"Class",
"<",
"?",
"extends",
"IPointcut",
">",
"pc",
"=",
"registry",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"pc",
"!=",
"null",
")",
"{",
"try",
"{",
"try",
"{",
"IPointcut",
"p",
"=",
"pc",
".",
"getConstructor",
"(",
"IStorage",
".",
"class",
",",
"String",
".",
"class",
")",
".",
"newInstance",
"(",
"uniqueID",
",",
"name",
")",
";",
"p",
".",
"setProject",
"(",
"project",
")",
";",
"return",
"p",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"IPointcut",
"p",
"=",
"pc",
".",
"getConstructor",
"(",
"String",
".",
"class",
")",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"p",
"instanceof",
"AbstractPointcut",
")",
"{",
"(",
"(",
"AbstractPointcut",
")",
"p",
")",
".",
"setPointcutName",
"(",
"name",
")",
";",
"(",
"(",
"AbstractPointcut",
")",
"p",
")",
".",
"setContainerIdentifier",
"(",
"uniqueID",
")",
";",
"p",
".",
"setProject",
"(",
"project",
")",
";",
"return",
"p",
";",
"}",
"throw",
"e",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyDSLCoreActivator",
".",
"logException",
"(",
"e",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"static",
"String",
"createDoc",
"(",
"String",
"description",
",",
"String",
"expects",
",",
"String",
"returns",
")",
"{",
"return",
"description",
"+",
"\"\"",
"+",
"expects",
"+",
"\"\"",
"+",
"returns",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"}",
"}",
"</s>"
] |
6,249 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"RefreshDSLDJob",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"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",
"class",
"RefreshDSLDFilesActionDelegate",
"implements",
"IWorkbenchWindowActionDelegate",
"{",
"private",
"IProject",
"[",
"]",
"groovyProjects",
";",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"for",
"(",
"IProject",
"project",
":",
"groovyProjects",
")",
"{",
"Job",
"refreshJob",
"=",
"new",
"RefreshDSLDJob",
"(",
"project",
")",
";",
"refreshJob",
".",
"setPriority",
"(",
"Job",
".",
"LONG",
")",
";",
"refreshJob",
".",
"schedule",
"(",
")",
";",
"}",
"}",
"public",
"void",
"selectionChanged",
"(",
"IAction",
"action",
",",
"ISelection",
"selection",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"IStructuredSelection",
"ss",
"=",
"(",
"IStructuredSelection",
")",
"selection",
";",
"Object",
"[",
"]",
"elts",
"=",
"ss",
".",
"toArray",
"(",
")",
";",
"groovyProjects",
"=",
"new",
"IProject",
"[",
"elts",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elts",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"elts",
"[",
"i",
"]",
"instanceof",
"IProject",
"&&",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"(",
"IProject",
")",
"elts",
"[",
"i",
"]",
")",
")",
"{",
"groovyProjects",
"[",
"i",
"]",
"=",
"(",
"IProject",
")",
"elts",
"[",
"i",
"]",
";",
"}",
"else",
"{",
"groovyProjects",
"=",
"null",
";",
"return",
";",
"}",
"}",
"}",
"else",
"{",
"groovyProjects",
"=",
"null",
";",
"}",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"groovyProjects",
"=",
"null",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbenchWindow",
"window",
")",
"{",
"}",
"}",
"</s>"
] |
6,250 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"checker",
".",
"IStaticCheckerHandler",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"checker",
".",
"ResourceMarkerHandler",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"checker",
".",
"ResourceTypeChecker",
";",
"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",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"MultiRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IObjectActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"progress",
".",
"UIJob",
";",
"public",
"class",
"StaticTypeCheckAction",
"extends",
"AbstractCheckerAction",
"implements",
"IObjectActionDelegate",
"{",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"final",
"List",
"<",
"IResource",
">",
"selectionList",
"=",
"findSelection",
"(",
")",
";",
"if",
"(",
"selectionList",
"!=",
"null",
")",
"{",
"UIJob",
"job",
"=",
"new",
"UIJob",
"(",
"shell",
"!=",
"null",
"?",
"shell",
".",
"getDisplay",
"(",
")",
":",
"null",
",",
"\"\"",
")",
"{",
"@",
"Override",
"public",
"IStatus",
"runInUIThread",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"ISchedulingRule",
"rule",
"=",
"new",
"MultiRule",
"(",
"selectionList",
".",
"toArray",
"(",
"new",
"IResource",
"[",
"0",
"]",
")",
")",
";",
"getJobManager",
"(",
")",
".",
"beginRule",
"(",
"rule",
",",
"monitor",
")",
";",
"try",
"{",
"perform",
"(",
"selectionList",
",",
"monitor",
")",
";",
"}",
"finally",
"{",
"getJobManager",
"(",
")",
".",
"endRule",
"(",
"rule",
")",
";",
"}",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"}",
";",
"job",
".",
"setUser",
"(",
"true",
")",
";",
"job",
".",
"setPriority",
"(",
"Job",
".",
"LONG",
")",
";",
"job",
".",
"schedule",
"(",
")",
";",
"}",
"}",
"public",
"void",
"perform",
"(",
"List",
"<",
"IResource",
">",
"selectionList",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"IStaticCheckerHandler",
"handler",
"=",
"new",
"ResourceMarkerHandler",
"(",
")",
";",
"ResourceTypeChecker",
"checker",
"=",
"new",
"ResourceTypeChecker",
"(",
"handler",
",",
"selectionList",
",",
"null",
",",
"null",
",",
"false",
")",
";",
"try",
"{",
"checker",
".",
"doCheck",
"(",
"monitor",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,251 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"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",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPartSite",
";",
"public",
"class",
"AbstractCheckerAction",
"{",
"private",
"ISelection",
"selection",
";",
"protected",
"Shell",
"shell",
";",
"public",
"AbstractCheckerAction",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"protected",
"List",
"<",
"IResource",
">",
"findSelection",
"(",
")",
"{",
"List",
"<",
"IResource",
">",
"currentSelection",
";",
"if",
"(",
"!",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
")",
"{",
"currentSelection",
"=",
"null",
";",
"}",
"List",
"<",
"?",
">",
"elts",
"=",
"(",
"(",
"IStructuredSelection",
")",
"selection",
")",
".",
"toList",
"(",
")",
";",
"currentSelection",
"=",
"new",
"ArrayList",
"<",
"IResource",
">",
"(",
"elts",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Object",
"elt",
":",
"elts",
")",
"{",
"IResource",
"candidate",
"=",
"null",
";",
"if",
"(",
"elt",
"instanceof",
"IResource",
")",
"{",
"candidate",
"=",
"(",
"IResource",
")",
"elt",
";",
"}",
"else",
"if",
"(",
"elt",
"instanceof",
"IAdaptable",
")",
"{",
"candidate",
"=",
"(",
"IResource",
")",
"(",
"(",
"IAdaptable",
")",
"elt",
")",
".",
"getAdapter",
"(",
"IResource",
".",
"class",
")",
";",
"}",
"if",
"(",
"candidate",
"!=",
"null",
"&&",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"candidate",
".",
"getProject",
"(",
")",
")",
")",
"{",
"currentSelection",
".",
"add",
"(",
"candidate",
")",
";",
"}",
"}",
"if",
"(",
"currentSelection",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"currentSelection",
"=",
"null",
";",
"}",
"return",
"currentSelection",
";",
"}",
"public",
"void",
"selectionChanged",
"(",
"IAction",
"action",
",",
"ISelection",
"selection",
")",
"{",
"this",
".",
"selection",
"=",
"selection",
";",
"}",
"public",
"void",
"setActivePart",
"(",
"IAction",
"action",
",",
"IWorkbenchPart",
"targetPart",
")",
"{",
"try",
"{",
"IWorkbenchPartSite",
"site",
"=",
"targetPart",
".",
"getSite",
"(",
")",
";",
"if",
"(",
"site",
"!=",
"null",
")",
"{",
"shell",
"=",
"site",
".",
"getShell",
"(",
")",
";",
"return",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"shell",
"=",
"null",
";",
"}",
"}",
"</s>"
] |
6,252 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"actions",
".",
"AbstractAddClasspathContainerAction",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"public",
"class",
"AddDSLDContainerActtion",
"extends",
"AbstractAddClasspathContainerAction",
"{",
"@",
"Override",
"protected",
"IPath",
"getClasspathContainerPath",
"(",
")",
"{",
"return",
"GroovyDSLCoreActivator",
".",
"CLASSPATH_CONTAINER_ID",
";",
"}",
"@",
"Override",
"protected",
"String",
"errorMessage",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"String",
"disabledText",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"String",
"addText",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"String",
"removeText",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"super",
".",
"run",
"(",
"action",
")",
";",
"GroovyDSLCoreActivator",
".",
"getDefault",
"(",
")",
".",
"getContainerListener",
"(",
")",
".",
"ignoreProject",
"(",
"targetProject",
".",
"getProject",
"(",
")",
")",
";",
"}",
"@",
"Override",
"protected",
"boolean",
"exportClasspath",
"(",
")",
"{",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
6,253 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"ui",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"Reader",
";",
"import",
"java",
".",
"io",
".",
"StringReader",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"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",
".",
"jface",
".",
"dialogs",
".",
"IMessageProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"ImageDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchWindow",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PartInitException",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"WizardNewFileCreationPage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"ide",
".",
"IDE",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"ide",
".",
"DialogUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"wizards",
".",
"newresource",
".",
"ResourceMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"wizards",
".",
"newresource",
".",
"BasicNewResourceWizard",
";",
"public",
"class",
"NewDSLDWizard",
"extends",
"BasicNewResourceWizard",
"{",
"class",
"NewDSLDWizardPage",
"extends",
"WizardNewFileCreationPage",
"{",
"public",
"NewDSLDWizardPage",
"(",
"String",
"pageName",
",",
"IStructuredSelection",
"selection",
")",
"{",
"super",
"(",
"pageName",
",",
"selection",
")",
";",
"}",
"@",
"Override",
"protected",
"InputStream",
"getInitialContents",
"(",
")",
"{",
"return",
"new",
"StringInputStream",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"//",
"}n\"",
")",
";",
"}",
"@",
"Override",
"protected",
"boolean",
"validatePage",
"(",
")",
"{",
"if",
"(",
"!",
"super",
".",
"validatePage",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"IPath",
"path",
"=",
"getContainerFullPath",
"(",
")",
";",
"IProject",
"project",
";",
"if",
"(",
"path",
".",
"segmentCount",
"(",
")",
">",
"1",
")",
"{",
"IFolder",
"folder",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"path",
")",
";",
"project",
"=",
"folder",
".",
"getProject",
"(",
")",
";",
"}",
"else",
"if",
"(",
"path",
".",
"segmentCount",
"(",
")",
"==",
"1",
")",
"{",
"project",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"path",
".",
"lastSegment",
"(",
")",
")",
";",
"}",
"else",
"{",
"project",
"=",
"null",
";",
"setErrorMessage",
"(",
"\"\"",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"project",
".",
"exists",
"(",
")",
")",
"{",
"setErrorMessage",
"(",
"\"Project",
"\"",
"+",
"project",
".",
"getName",
"(",
")",
"+",
"\"\"",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"project",
")",
")",
"{",
"setErrorMessage",
"(",
"\"Project",
"\"",
"+",
"project",
".",
"getName",
"(",
")",
"+",
"\"\"",
")",
";",
"return",
"false",
";",
"}",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"try",
"{",
"IClasspathEntry",
"[",
"]",
"rawClasspath",
"=",
"javaProject",
".",
"getRawClasspath",
"(",
")",
";",
"boolean",
"inSourceFolder",
"=",
"false",
";",
"for",
"(",
"IClasspathEntry",
"entry",
":",
"rawClasspath",
")",
"{",
"IPath",
"sourcePath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"sourcePath",
".",
"isPrefixOf",
"(",
"path",
")",
")",
"{",
"inSourceFolder",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"inSourceFolder",
")",
"{",
"setMessage",
"(",
"\"\"",
",",
"IMessageProvider",
".",
"WARNING",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"setErrorMessage",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"}",
"class",
"StringInputStream",
"extends",
"InputStream",
"{",
"private",
"Reader",
"reader",
";",
"public",
"StringInputStream",
"(",
"String",
"contents",
")",
"{",
"this",
".",
"reader",
"=",
"new",
"StringReader",
"(",
"contents",
")",
";",
"}",
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"return",
"reader",
".",
"read",
"(",
")",
";",
"}",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"reader",
".",
"close",
"(",
")",
";",
"}",
"}",
"private",
"WizardNewFileCreationPage",
"mainPage",
";",
"public",
"NewDSLDWizard",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"public",
"void",
"addPages",
"(",
")",
"{",
"super",
".",
"addPages",
"(",
")",
";",
"mainPage",
"=",
"new",
"NewDSLDWizardPage",
"(",
"\"\"",
",",
"getSelection",
"(",
")",
")",
";",
"mainPage",
".",
"setTitle",
"(",
"\"DSLD",
"File\"",
")",
";",
"mainPage",
".",
"setDescription",
"(",
"\"\"",
")",
";",
"mainPage",
".",
"setFileExtension",
"(",
"\"dsld\"",
")",
";",
"addPage",
"(",
"mainPage",
")",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbench",
"workbench",
",",
"IStructuredSelection",
"currentSelection",
")",
"{",
"super",
".",
"init",
"(",
"workbench",
",",
"currentSelection",
")",
";",
"setWindowTitle",
"(",
"\"\"",
")",
";",
"setNeedsProgressMonitor",
"(",
"true",
")",
";",
"}",
"protected",
"void",
"initializeDefaultPageImageDescriptor",
"(",
")",
"{",
"ImageDescriptor",
"desc",
"=",
"GroovyDSLCoreActivator",
".",
"imageDescriptorFromPlugin",
"(",
"GroovyDSLCoreActivator",
".",
"PLUGIN_ID",
",",
"\"\"",
")",
";",
"setDefaultPageImageDescriptor",
"(",
"desc",
")",
";",
"}",
"public",
"boolean",
"performFinish",
"(",
")",
"{",
"IFile",
"file",
"=",
"mainPage",
".",
"createNewFile",
"(",
")",
";",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"selectAndReveal",
"(",
"file",
")",
";",
"IWorkbenchWindow",
"dw",
"=",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
";",
"try",
"{",
"if",
"(",
"dw",
"!=",
"null",
")",
"{",
"IWorkbenchPage",
"page",
"=",
"dw",
".",
"getActivePage",
"(",
")",
";",
"if",
"(",
"page",
"!=",
"null",
")",
"{",
"IDE",
".",
"openEditor",
"(",
"page",
",",
"file",
",",
"true",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"PartInitException",
"e",
")",
"{",
"DialogUtil",
".",
"openError",
"(",
"dw",
".",
"getShell",
"(",
")",
",",
"ResourceMessages",
".",
"FileResource_errorMessage",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
6,254 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"ui",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyLogManager",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"TraceCategory",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"DSLDStore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"DSLDStoreManager",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"DSLPreferencesInitializer",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"DisabledScriptsCache",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"earlystartup",
".",
"InitializeAllDSLDs",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"editor",
".",
"GroovyEditor",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"internal",
".",
"filesystem",
".",
"local",
".",
"LocalFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IStorage",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"EditorUtility",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"DialogField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"ITreeListAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"LayoutUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"TreeListDialogField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"ISharedImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaUI",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"ErrorDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"layout",
".",
"PixelConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"ImageDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"CheckStateChangedEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ICheckStateListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ILabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"LabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"TreeViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"KeyEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Tree",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPreferencePage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PartInitException",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"ContainerCheckedTreeViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"ide",
".",
"FileStoreEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"ide",
".",
"IDE",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"Workbench",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"model",
".",
"WorkbenchLabelProvider",
";",
"public",
"class",
"DSLPreferencesPage",
"extends",
"PreferencePage",
"implements",
"IWorkbenchPreferencePage",
"{",
"private",
"static",
"final",
"IWorkspaceRoot",
"ROOT",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"private",
"final",
"String",
"[",
"]",
"LABELS",
"=",
"{",
"\"Edit...\"",
",",
"\"\"",
",",
"\"Refresh",
"List\"",
",",
"\"Check",
"All\"",
",",
"\"Uncheck",
"All\"",
"}",
";",
"private",
"final",
"int",
"IDX_EDIT",
"=",
"0",
";",
"private",
"final",
"int",
"IDX_RECOMPILE",
"=",
"1",
";",
"private",
"final",
"int",
"IDX_REFRESH",
"=",
"2",
";",
"private",
"final",
"int",
"IDX_CHECK_ALL",
"=",
"3",
";",
"private",
"final",
"int",
"IDX_UNCHECK_ALL",
"=",
"4",
";",
"private",
"final",
"class",
"CheckStateListener",
"implements",
"ICheckStateListener",
"{",
"public",
"void",
"checkStateChanged",
"(",
"CheckStateChangedEvent",
"event",
")",
"{",
"Object",
"element",
"=",
"event",
".",
"getElement",
"(",
")",
";",
"if",
"(",
"element",
"instanceof",
"ProjectContextKey",
")",
"{",
"ProjectContextKey",
"key",
"=",
"(",
"ProjectContextKey",
")",
"element",
";",
"key",
".",
"isChecked",
"=",
"event",
".",
"getChecked",
"(",
")",
";",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"String",
")",
"{",
"ProjectContextKey",
"[",
"]",
"children",
"=",
"elementsMap",
".",
"get",
"(",
"element",
")",
";",
"for",
"(",
"ProjectContextKey",
"child",
":",
"children",
")",
"{",
"child",
".",
"isChecked",
"=",
"event",
".",
"getChecked",
"(",
")",
";",
"}",
"}",
"}",
"}",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"private",
"final",
"class",
"CheckedTreeListDialogField",
"extends",
"TreeListDialogField",
"{",
"private",
"ContainerCheckedTreeViewer",
"checkboxViewer",
";",
"private",
"CheckedTreeListDialogField",
"(",
"ITreeListAdapter",
"adapter",
",",
"String",
"[",
"]",
"buttonLabels",
",",
"ILabelProvider",
"lprovider",
")",
"{",
"super",
"(",
"adapter",
",",
"buttonLabels",
",",
"lprovider",
")",
";",
"}",
"protected",
"TreeViewer",
"createTreeViewer",
"(",
"Composite",
"parent",
")",
"{",
"Tree",
"tree",
"=",
"new",
"Tree",
"(",
"parent",
",",
"getTreeStyle",
"(",
")",
"|",
"SWT",
".",
"CHECK",
")",
";",
"tree",
".",
"setFont",
"(",
"parent",
".",
"getFont",
"(",
")",
")",
";",
"checkboxViewer",
"=",
"new",
"ContainerCheckedTreeViewer",
"(",
"tree",
")",
";",
"checkboxViewer",
".",
"addCheckStateListener",
"(",
"new",
"CheckStateListener",
"(",
")",
")",
";",
"return",
"checkboxViewer",
";",
"}",
"void",
"setChecked",
"(",
"Object",
"child",
",",
"boolean",
"newState",
")",
"{",
"checkboxViewer",
".",
"setChecked",
"(",
"child",
",",
"newState",
")",
";",
"}",
"}",
"class",
"ProjectContextKey",
"{",
"final",
"String",
"projectName",
";",
"final",
"IStorage",
"dslFile",
";",
"boolean",
"isChecked",
";",
"public",
"ProjectContextKey",
"(",
"String",
"projectName",
",",
"IStorage",
"dslFile",
")",
"{",
"this",
".",
"projectName",
"=",
"projectName",
";",
"this",
".",
"dslFile",
"=",
"dslFile",
";",
"}",
"}",
"class",
"DSLLabelProvider",
"extends",
"LabelProvider",
"{",
"WorkbenchLabelProvider",
"provider",
"=",
"new",
"WorkbenchLabelProvider",
"(",
")",
";",
"public",
"void",
"dispose",
"(",
")",
"{",
"provider",
".",
"dispose",
"(",
")",
";",
"super",
".",
"dispose",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"getText",
"(",
"Object",
"element",
")",
"{",
"if",
"(",
"element",
"instanceof",
"ProjectContextKey",
")",
"{",
"ProjectContextKey",
"pck",
"=",
"(",
"ProjectContextKey",
")",
"element",
";",
"return",
"pck",
".",
"dslFile",
".",
"getName",
"(",
")",
";",
"}",
"return",
"super",
".",
"getText",
"(",
"element",
")",
";",
"}",
"public",
"Image",
"getImage",
"(",
"Object",
"element",
")",
"{",
"IProject",
"proj",
"=",
"toProject",
"(",
"element",
")",
";",
"if",
"(",
"proj",
"!=",
"null",
")",
"{",
"return",
"provider",
".",
"getImage",
"(",
"proj",
")",
";",
"}",
"IFile",
"file",
"=",
"null",
";",
"if",
"(",
"element",
"instanceof",
"ProjectContextKey",
"&&",
"(",
"(",
"ProjectContextKey",
")",
"element",
")",
".",
"dslFile",
"instanceof",
"IFile",
")",
"{",
"file",
"=",
"(",
"IFile",
")",
"(",
"(",
"ProjectContextKey",
")",
"element",
")",
".",
"dslFile",
";",
"}",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"return",
"provider",
".",
"getImage",
"(",
"file",
")",
";",
"}",
"return",
"JavaUI",
".",
"getSharedImages",
"(",
")",
".",
"getImage",
"(",
"ISharedImages",
".",
"IMG_OBJS_CFILE",
")",
";",
"}",
"}",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"class",
"DSLListAdapter",
"implements",
"ITreeListAdapter",
"{",
"public",
"void",
"customButtonPressed",
"(",
"TreeListDialogField",
"field",
",",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"==",
"IDX_EDIT",
")",
"{",
"edit",
"(",
")",
";",
"}",
"else",
"if",
"(",
"index",
"==",
"IDX_RECOMPILE",
")",
"{",
"recompile",
"(",
")",
";",
"}",
"else",
"if",
"(",
"index",
"==",
"IDX_REFRESH",
")",
"{",
"refresh",
"(",
")",
";",
"}",
"else",
"if",
"(",
"index",
"==",
"IDX_CHECK_ALL",
")",
"{",
"checkAll",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"index",
"==",
"IDX_UNCHECK_ALL",
")",
"{",
"checkAll",
"(",
"false",
")",
";",
"}",
"}",
"public",
"void",
"selectionChanged",
"(",
"TreeListDialogField",
"field",
")",
"{",
"if",
"(",
"canEdit",
"(",
")",
")",
"{",
"field",
".",
"enableButton",
"(",
"IDX_EDIT",
",",
"true",
")",
";",
"}",
"else",
"{",
"field",
".",
"enableButton",
"(",
"IDX_EDIT",
",",
"false",
")",
";",
"}",
"}",
"public",
"void",
"doubleClicked",
"(",
"TreeListDialogField",
"field",
")",
"{",
"edit",
"(",
")",
";",
"}",
"public",
"void",
"keyPressed",
"(",
"TreeListDialogField",
"field",
",",
"KeyEvent",
"event",
")",
"{",
"}",
"public",
"Object",
"[",
"]",
"getChildren",
"(",
"TreeListDialogField",
"field",
",",
"Object",
"element",
")",
"{",
"if",
"(",
"element",
"instanceof",
"String",
")",
"{",
"return",
"elementsMap",
".",
"get",
"(",
"element",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"Object",
"getParent",
"(",
"TreeListDialogField",
"field",
",",
"Object",
"element",
")",
"{",
"if",
"(",
"element",
"instanceof",
"ProjectContextKey",
")",
"{",
"return",
"(",
"(",
"ProjectContextKey",
")",
"element",
")",
".",
"projectName",
";",
"}",
"return",
"null",
";",
"}",
"public",
"boolean",
"hasChildren",
"(",
"TreeListDialogField",
"field",
",",
"Object",
"element",
")",
"{",
"Object",
"[",
"]",
"children",
"=",
"getChildren",
"(",
"field",
",",
"element",
")",
";",
"return",
"children",
"!=",
"null",
"&&",
"children",
".",
"length",
">",
"0",
";",
"}",
"}",
"DisabledScriptsCache",
"cache",
";",
"Map",
"<",
"String",
",",
"ProjectContextKey",
"[",
"]",
">",
"elementsMap",
";",
"private",
"CheckedTreeListDialogField",
"tree",
";",
"private",
"DSLDStoreManager",
"manager",
";",
"private",
"IWorkbenchPage",
"page",
";",
"private",
"IPreferenceStore",
"store",
"=",
"GroovyDSLCoreActivator",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"private",
"Button",
"autoAdd",
";",
"private",
"Button",
"disableDSLDs",
";",
"public",
"DSLPreferencesPage",
"(",
")",
"{",
"}",
"public",
"DSLPreferencesPage",
"(",
"String",
"title",
")",
"{",
"super",
"(",
"title",
")",
";",
"}",
"public",
"DSLPreferencesPage",
"(",
"String",
"title",
",",
"ImageDescriptor",
"image",
")",
"{",
"super",
"(",
"title",
",",
"image",
")",
";",
"}",
"public",
"void",
"init",
"(",
"IWorkbench",
"workbench",
")",
"{",
"manager",
"=",
"GroovyDSLCoreActivator",
".",
"getDefault",
"(",
")",
".",
"getContextStoreManager",
"(",
")",
";",
"cache",
"=",
"new",
"DisabledScriptsCache",
"(",
")",
";",
"elementsMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"DSLPreferencesPage",
".",
"ProjectContextKey",
"[",
"]",
">",
"(",
")",
";",
"try",
"{",
"page",
"=",
"workbench",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getActivePage",
"(",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"}",
"}",
"@",
"Override",
"protected",
"Control",
"createContents",
"(",
"Composite",
"parent",
")",
"{",
"Composite",
"composite",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"composite",
".",
"setFont",
"(",
"parent",
".",
"getFont",
"(",
")",
")",
";",
"tree",
"=",
"new",
"CheckedTreeListDialogField",
"(",
"new",
"DSLListAdapter",
"(",
")",
",",
"LABELS",
",",
"new",
"DSLLabelProvider",
"(",
")",
")",
";",
"tree",
".",
"setTreeExpansionLevel",
"(",
"2",
")",
";",
"LayoutUtil",
".",
"doDefaultLayout",
"(",
"composite",
",",
"new",
"DialogField",
"[",
"]",
"{",
"tree",
"}",
",",
"true",
",",
"SWT",
".",
"DEFAULT",
",",
"SWT",
".",
"DEFAULT",
")",
";",
"LayoutUtil",
".",
"setHorizontalGrabbing",
"(",
"tree",
".",
"getTreeControl",
"(",
"null",
")",
")",
";",
"refresh",
"(",
")",
";",
"PixelConverter",
"converter",
"=",
"new",
"PixelConverter",
"(",
"parent",
")",
";",
"int",
"buttonBarWidth",
"=",
"converter",
".",
"convertWidthInCharsToPixels",
"(",
"24",
")",
";",
"tree",
".",
"setButtonsMinWidth",
"(",
"buttonBarWidth",
")",
";",
"autoAdd",
"=",
"new",
"Button",
"(",
"composite",
",",
"SWT",
".",
"CHECK",
")",
";",
"autoAdd",
".",
"setText",
"(",
"\"\"",
")",
";",
"autoAdd",
".",
"setSelection",
"(",
"store",
".",
"getBoolean",
"(",
"DSLPreferencesInitializer",
".",
"AUTO_ADD_DSL_SUPPORT",
")",
")",
";",
"GridData",
"data",
"=",
"new",
"GridData",
"(",
"SWT",
".",
"LEFT",
",",
"SWT",
".",
"TOP",
",",
"true",
",",
"false",
")",
";",
"data",
".",
"horizontalSpan",
"=",
"2",
";",
"autoAdd",
".",
"setLayoutData",
"(",
"data",
")",
";",
"disableDSLDs",
"=",
"new",
"Button",
"(",
"composite",
",",
"SWT",
".",
"CHECK",
")",
";",
"disableDSLDs",
".",
"setText",
"(",
"\"\"",
")",
";",
"boolean",
"isDisabled",
"=",
"store",
".",
"getBoolean",
"(",
"DSLPreferencesInitializer",
".",
"DSLD_DISABLED",
")",
";",
"disableDSLDs",
".",
"setSelection",
"(",
"isDisabled",
")",
";",
"disableDSLDs",
".",
"setLayoutData",
"(",
"data",
")",
";",
"if",
"(",
"disableDSLDs",
".",
"getSelection",
"(",
")",
")",
"{",
"Label",
"l",
"=",
"new",
"Label",
"(",
"composite",
",",
"SWT",
".",
"NONE",
")",
";",
"l",
".",
"setText",
"(",
"\"\"",
")",
";",
"}",
"return",
"composite",
";",
"}",
"protected",
"IProject",
"toProject",
"(",
"Object",
"element",
")",
"{",
"if",
"(",
"element",
"instanceof",
"String",
")",
"{",
"String",
"name",
"=",
"(",
"String",
")",
"element",
";",
"IProject",
"proj",
"=",
"ROOT",
".",
"getProject",
"(",
"name",
")",
";",
"if",
"(",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"proj",
")",
")",
"{",
"return",
"proj",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"boolean",
"canEdit",
"(",
")",
"{",
"List",
"<",
"?",
">",
"selected",
"=",
"tree",
".",
"getSelectedElements",
"(",
")",
";",
"return",
"selected",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"selected",
".",
"get",
"(",
"0",
")",
"instanceof",
"ProjectContextKey",
";",
"}",
"protected",
"void",
"edit",
"(",
")",
"{",
"if",
"(",
"canEdit",
"(",
")",
")",
"{",
"List",
"<",
"?",
">",
"selected",
"=",
"tree",
".",
"getSelectedElements",
"(",
")",
";",
"ProjectContextKey",
"pck",
"=",
"(",
"ProjectContextKey",
")",
"selected",
".",
"get",
"(",
"0",
")",
";",
"IStorage",
"storage",
"=",
"pck",
".",
"dslFile",
";",
"IEditorInput",
"input",
"=",
"getEditorInput",
"(",
"storage",
")",
";",
"if",
"(",
"input",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"page",
"!=",
"null",
")",
"{",
"IDE",
".",
"openEditor",
"(",
"page",
",",
"input",
",",
"GroovyEditor",
".",
"EDITOR_ID",
",",
"true",
")",
";",
"}",
"}",
"catch",
"(",
"PartInitException",
"e",
")",
"{",
"if",
"(",
"page",
"!=",
"null",
")",
"{",
"ErrorDialog",
".",
"openError",
"(",
"page",
".",
"getWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
",",
"\"\"",
",",
"\"\"",
"+",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"GroovyDSLCoreActivator",
".",
"logException",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"page",
"!=",
"null",
")",
"{",
"ErrorDialog",
".",
"openError",
"(",
"page",
".",
"getWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
",",
"\"\"",
",",
"\"File",
"\"",
"+",
"pck",
".",
"dslFile",
"+",
"\"\"",
",",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"GroovyDSLCoreActivator",
".",
"PLUGIN_ID",
",",
"\"\"",
")",
")",
";",
"}",
"}",
"}",
"}",
"private",
"IEditorInput",
"getEditorInput",
"(",
"IStorage",
"storage",
")",
"{",
"if",
"(",
"storage",
"instanceof",
"IFile",
"&&",
"(",
"(",
"IFile",
")",
"storage",
")",
".",
"getProject",
"(",
")",
".",
"equals",
"(",
"JavaModelManager",
".",
"getExternalManager",
"(",
")",
".",
"getExternalFoldersProject",
"(",
")",
")",
")",
"{",
"return",
"new",
"FileStoreEditorInput",
"(",
"new",
"LocalFile",
"(",
"new",
"File",
"(",
"(",
"(",
"IFile",
")",
"storage",
")",
".",
"getLocationURI",
"(",
")",
")",
")",
")",
";",
"}",
"else",
"{",
"return",
"EditorUtility",
".",
"getEditorInput",
"(",
"storage",
")",
";",
"}",
"}",
"protected",
"void",
"refresh",
"(",
")",
"{",
"List",
"<",
"String",
">",
"allStores",
"=",
"manager",
".",
"getAllStores",
"(",
")",
";",
"elementsMap",
".",
"clear",
"(",
")",
";",
"for",
"(",
"String",
"element",
":",
"allStores",
")",
"{",
"IProject",
"project",
"=",
"toProject",
"(",
"element",
")",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
"DSLDStore",
"store",
"=",
"manager",
".",
"getDSLDStore",
"(",
"project",
")",
";",
"if",
"(",
"store",
"!=",
"null",
")",
"{",
"IStorage",
"[",
"]",
"keys",
"=",
"store",
".",
"getAllContextKeys",
"(",
")",
";",
"ProjectContextKey",
"[",
"]",
"pck",
"=",
"new",
"ProjectContextKey",
"[",
"keys",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pck",
".",
"length",
";",
"i",
"++",
")",
"{",
"pck",
"[",
"i",
"]",
"=",
"new",
"ProjectContextKey",
"(",
"element",
",",
"keys",
"[",
"i",
"]",
")",
";",
"pck",
"[",
"i",
"]",
".",
"isChecked",
"=",
"!",
"cache",
".",
"isDisabled",
"(",
"DSLDStore",
".",
"toUniqueString",
"(",
"pck",
"[",
"i",
"]",
".",
"dslFile",
")",
")",
";",
"}",
"elementsMap",
".",
"put",
"(",
"element",
",",
"pck",
")",
";",
"}",
"}",
"}",
"Collections",
".",
"sort",
"(",
"allStores",
")",
";",
"tree",
".",
"setElements",
"(",
"allStores",
")",
";",
"tree",
".",
"refresh",
"(",
")",
";",
"for",
"(",
"ProjectContextKey",
"[",
"]",
"keys",
":",
"elementsMap",
".",
"values",
"(",
")",
")",
"{",
"for",
"(",
"ProjectContextKey",
"key",
":",
"keys",
")",
"{",
"tree",
".",
"setChecked",
"(",
"key",
",",
"key",
".",
"isChecked",
")",
";",
"}",
"}",
"}",
"void",
"checkAll",
"(",
"boolean",
"newState",
")",
"{",
"for",
"(",
"ProjectContextKey",
"[",
"]",
"keys",
":",
"elementsMap",
".",
"values",
"(",
")",
")",
"{",
"for",
"(",
"ProjectContextKey",
"key",
":",
"keys",
")",
"{",
"key",
".",
"isChecked",
"=",
"newState",
";",
"tree",
".",
"setChecked",
"(",
"key",
",",
"key",
".",
"isChecked",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"storeChecks",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"unchecked",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"ProjectContextKey",
"[",
"]",
"keys",
":",
"elementsMap",
".",
"values",
"(",
")",
")",
"{",
"for",
"(",
"ProjectContextKey",
"key",
":",
"keys",
")",
"{",
"if",
"(",
"!",
"key",
".",
"isChecked",
")",
"{",
"unchecked",
".",
"add",
"(",
"DSLDStore",
".",
"toUniqueString",
"(",
"key",
".",
"dslFile",
")",
")",
";",
"}",
"}",
"}",
"cache",
".",
"setDisabled",
"(",
"unchecked",
")",
";",
"}",
"private",
"static",
"final",
"String",
"EVENT",
"=",
"\"\"",
";",
"protected",
"void",
"recompile",
"(",
")",
"{",
"GroovyLogManager",
".",
"manager",
".",
"log",
"(",
"TraceCategory",
".",
"DSL",
",",
"EVENT",
")",
";",
"GroovyLogManager",
".",
"manager",
".",
"logStart",
"(",
"EVENT",
")",
";",
"new",
"InitializeAllDSLDs",
"(",
")",
".",
"initializeAll",
"(",
")",
";",
"GroovyLogManager",
".",
"manager",
".",
"logEnd",
"(",
"EVENT",
",",
"TraceCategory",
".",
"DSL",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"performDefaults",
"(",
")",
"{",
"super",
".",
"performDefaults",
"(",
")",
";",
"checkAll",
"(",
"true",
")",
";",
"DSLPreferencesInitializer",
".",
"reset",
"(",
")",
";",
"autoAdd",
".",
"setSelection",
"(",
"true",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"performOk",
"(",
")",
"{",
"storeChecks",
"(",
")",
";",
"store",
".",
"setValue",
"(",
"DSLPreferencesInitializer",
".",
"AUTO_ADD_DSL_SUPPORT",
",",
"autoAdd",
".",
"getSelection",
"(",
")",
")",
";",
"boolean",
"origDisabled",
"=",
"store",
".",
"getBoolean",
"(",
"DSLPreferencesInitializer",
".",
"DSLD_DISABLED",
")",
";",
"if",
"(",
"origDisabled",
"!=",
"disableDSLDs",
".",
"getSelection",
"(",
")",
")",
"{",
"store",
".",
"setValue",
"(",
"DSLPreferencesInitializer",
".",
"DSLD_DISABLED",
",",
"disableDSLDs",
".",
"getSelection",
"(",
")",
")",
";",
"String",
"newValue",
"=",
"disableDSLDs",
".",
"getSelection",
"(",
")",
"?",
"\"enabled\"",
":",
"\"disabled\"",
";",
"boolean",
"res",
"=",
"MessageDialog",
".",
"openQuestion",
"(",
"getShell",
"(",
")",
",",
"\"Restart",
"now?\"",
",",
"\"You",
"have",
"\"",
"+",
"newValue",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"if",
"(",
"res",
")",
"{",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"restart",
"(",
")",
";",
"}",
"}",
"return",
"super",
".",
"performOk",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,255 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
".",
"GroovyDSLCoreActivator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IObjectActionDelegate",
";",
"public",
"class",
"RemoveCheckerWarnings",
"extends",
"AbstractCheckerAction",
"implements",
"IObjectActionDelegate",
"{",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"List",
"<",
"IResource",
">",
"sel",
"=",
"findSelection",
"(",
")",
";",
"if",
"(",
"sel",
"!=",
"null",
")",
"{",
"for",
"(",
"IResource",
"resource",
":",
"sel",
")",
"{",
"try",
"{",
"resource",
".",
"deleteMarkers",
"(",
"GroovyDSLCoreActivator",
".",
"MARKER_ID",
",",
"true",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"}",
"</s>"
] |
6,256 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"public",
"class",
"DisabledScriptsCache",
"{",
"private",
"Set",
"<",
"String",
">",
"disabled",
";",
"public",
"Set",
"<",
"String",
">",
"getDisabled",
"(",
")",
"{",
"ensureInitialized",
"(",
")",
";",
"return",
"disabled",
";",
"}",
"public",
"boolean",
"isDisabled",
"(",
"String",
"script",
")",
"{",
"ensureInitialized",
"(",
")",
";",
"return",
"disabled",
".",
"contains",
"(",
"script",
")",
";",
"}",
"public",
"void",
"setDisabled",
"(",
"Set",
"<",
"String",
">",
"disabled",
")",
"{",
"this",
".",
"disabled",
"=",
"disabled",
";",
"DSLPreferences",
".",
"setDisabledScripts",
"(",
"disabled",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
")",
";",
"}",
"private",
"void",
"ensureInitialized",
"(",
")",
"{",
"if",
"(",
"disabled",
"==",
"null",
")",
"{",
"disabled",
"=",
"DSLPreferences",
".",
"getDisabledScriptsAsSet",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,257 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ElementChangedEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IElementChangedListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElementDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"public",
"class",
"DSLDElementListener",
"implements",
"IElementChangedListener",
"{",
"public",
"void",
"elementChanged",
"(",
"ElementChangedEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getType",
"(",
")",
"==",
"ElementChangedEvent",
".",
"POST_CHANGE",
"&&",
"event",
".",
"getDelta",
"(",
")",
"!=",
"null",
")",
"{",
"List",
"<",
"IProject",
">",
"projectsToRefresh",
"=",
"new",
"ArrayList",
"<",
"IProject",
">",
"(",
")",
";",
"for",
"(",
"IJavaElementDelta",
"delta",
":",
"event",
".",
"getDelta",
"(",
")",
".",
"getChangedChildren",
"(",
")",
")",
"{",
"if",
"(",
"delta",
".",
"getElement",
"(",
")",
"instanceof",
"IJavaProject",
"&&",
"isResolvedClasspathChangeNotRawClasspath",
"(",
"delta",
")",
"&&",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"(",
"(",
"IJavaProject",
")",
"delta",
".",
"getElement",
"(",
")",
")",
".",
"getProject",
"(",
")",
")",
")",
"{",
"projectsToRefresh",
".",
"add",
"(",
"(",
"(",
"IJavaProject",
")",
"delta",
".",
"getElement",
"(",
")",
")",
".",
"getProject",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"!",
"projectsToRefresh",
".",
"isEmpty",
"(",
")",
")",
"{",
"Job",
"refreshJob",
"=",
"new",
"RefreshDSLDJob",
"(",
"projectsToRefresh",
")",
";",
"refreshJob",
".",
"setPriority",
"(",
"Job",
".",
"LONG",
")",
";",
"refreshJob",
".",
"schedule",
"(",
")",
";",
"}",
"}",
"}",
"private",
"boolean",
"isResolvedClasspathChangeNotRawClasspath",
"(",
"IJavaElementDelta",
"delta",
")",
"{",
"return",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IJavaElementDelta",
".",
"F_RESOLVED_CLASSPATH_CHANGED",
")",
"!=",
"0",
"&&",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IJavaElementDelta",
".",
"F_CLASSPATH_CHANGED",
")",
"==",
"0",
";",
"}",
"}",
"</s>"
] |
6,258 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"dsl",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"public",
"class",
"DSLDStoreManager",
"{",
"private",
"final",
"Map",
"<",
"String",
",",
"DSLDStore",
">",
"projectDSLDMap",
";",
"public",
"DSLDStoreManager",
"(",
")",
"{",
"projectDSLDMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"DSLDStore",
">",
"(",
")",
";",
"}",
"public",
"DSLDStore",
"getDSLDStore",
"(",
"IJavaProject",
"project",
")",
"{",
"return",
"getDSLDStore",
"(",
"project",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"DSLDStore",
"getDSLDStore",
"(",
"IProject",
"project",
")",
"{",
"return",
"getDSLDStore",
"(",
"project",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"DSLDStore",
"getDSLDStore",
"(",
"String",
"projectName",
")",
"{",
"DSLDStore",
"contextStore",
"=",
"projectDSLDMap",
".",
"get",
"(",
"projectName",
")",
";",
"if",
"(",
"contextStore",
"==",
"null",
")",
"{",
"contextStore",
"=",
"new",
"DSLDStore",
"(",
")",
";",
"projectDSLDMap",
".",
"put",
"(",
"projectName",
",",
"contextStore",
")",
";",
"}",
"return",
"contextStore",
";",
"}",
"public",
"void",
"clearDSLDStore",
"(",
"IProject",
"project",
")",
"{",
"projectDSLDMap",
".",
"remove",
"(",
"project",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"clearDSLDStore",
"(",
"IJavaProject",
"project",
")",
"{",
"projectDSLDMap",
".",
"remove",
"(",
"project",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"void",
"reset",
"(",
")",
"{",
"projectDSLDMap",
".",
"clear",
"(",
")",
";",
"}",
"public",
"boolean",
"hasDSLDStoreFor",
"(",
"IProject",
"project",
")",
"{",
"return",
"projectDSLDMap",
".",
"containsKey",
"(",
"project",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"List",
"<",
"String",
">",
"getAllStores",
"(",
")",
"{",
"return",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"projectDSLDMap",
".",
"keySet",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
6,259 | [
"<s>",
"package",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ImportRewrite",
";",
"import",
"java",
".",
"util",
".",
"regex",
".",
"Pattern",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"PreferenceConstants",
";",
"public",
"class",
"CodeStyleConfiguration",
"{",
"private",
"static",
"final",
"Pattern",
"SEMICOLON_PATTERN",
"=",
"Pattern",
".",
"compile",
"(",
"\";\"",
")",
";",
"private",
"CodeStyleConfiguration",
"(",
")",
"{",
"}",
"public",
"static",
"ImportRewrite",
"createImportRewrite",
"(",
"ICompilationUnit",
"cu",
",",
"boolean",
"restoreExistingImports",
")",
"throws",
"JavaModelException",
"{",
"return",
"configureImportRewrite",
"(",
"ImportRewrite",
".",
"create",
"(",
"cu",
",",
"restoreExistingImports",
")",
")",
";",
"}",
"public",
"static",
"ImportRewrite",
"createImportRewrite",
"(",
"CompilationUnit",
"astRoot",
",",
"boolean",
"restoreExistingImports",
")",
"{",
"return",
"configureImportRewrite",
"(",
"ImportRewrite",
".",
"create",
"(",
"astRoot",
",",
"restoreExistingImports",
")",
")",
";",
"}",
"private",
"static",
"ImportRewrite",
"configureImportRewrite",
"(",
"ImportRewrite",
"rewrite",
")",
"{",
"IJavaProject",
"project",
"=",
"rewrite",
".",
"getCompilationUnit",
"(",
")",
".",
"getJavaProject",
"(",
")",
";",
"String",
"order",
"=",
"PreferenceConstants",
".",
"getPreference",
"(",
"PreferenceConstants",
".",
"ORGIMPORTS_IMPORTORDER",
",",
"project",
")",
";",
"if",
"(",
"order",
".",
"endsWith",
"(",
"\";\"",
")",
")",
"{",
"order",
"=",
"order",
".",
"substring",
"(",
"0",
",",
"order",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"String",
"[",
"]",
"split",
"=",
"SEMICOLON_PATTERN",
".",
"split",
"(",
"order",
",",
"-",
"1",
")",
";",
"rewrite",
".",
"setImportOrder",
"(",
"split",
")",
";",
"String",
"thres",
"=",
"PreferenceConstants",
".",
"getPreference",
"(",
"PreferenceConstants",
".",
"ORGIMPORTS_ONDEMANDTHRESHOLD",
",",
"project",
")",
";",
"try",
"{",
"int",
"num",
"=",
"Integer",
".",
"parseInt",
"(",
"thres",
")",
";",
"if",
"(",
"num",
"==",
"0",
")",
"num",
"=",
"1",
";",
"rewrite",
".",
"setOnDemandImportThreshold",
"(",
"num",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"}",
"String",
"thresStatic",
"=",
"PreferenceConstants",
".",
"getPreference",
"(",
"PreferenceConstants",
".",
"ORGIMPORTS_STATIC_ONDEMANDTHRESHOLD",
",",
"project",
")",
";",
"try",
"{",
"int",
"num",
"=",
"Integer",
".",
"parseInt",
"(",
"thresStatic",
")",
";",
"if",
"(",
"num",
"==",
"0",
")",
"num",
"=",
"1",
";",
"rewrite",
".",
"setStaticOnDemandImportThreshold",
"(",
"num",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"}",
"return",
"rewrite",
";",
"}",
"}",
"</s>"
] |
6,260 | [
"<s>",
"package",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ImportRewriteAnalyzer",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"SubProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IImportDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"IBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"IMethodBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ITypeBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"IVariableBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ImportDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"Modifier",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ParameterizedType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"PrimitiveType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"Type",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"WildcardType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MultiTextEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"final",
"class",
"ImportRewrite",
"{",
"public",
"static",
"abstract",
"class",
"ImportRewriteContext",
"{",
"public",
"final",
"static",
"int",
"RES_NAME_FOUND",
"=",
"1",
";",
"public",
"final",
"static",
"int",
"RES_NAME_UNKNOWN",
"=",
"2",
";",
"public",
"final",
"static",
"int",
"RES_NAME_CONFLICT",
"=",
"3",
";",
"public",
"final",
"static",
"int",
"KIND_TYPE",
"=",
"1",
";",
"public",
"final",
"static",
"int",
"KIND_STATIC_FIELD",
"=",
"2",
";",
"public",
"final",
"static",
"int",
"KIND_STATIC_METHOD",
"=",
"3",
";",
"public",
"abstract",
"int",
"findInContext",
"(",
"String",
"qualifier",
",",
"String",
"name",
",",
"int",
"kind",
")",
";",
"}",
"private",
"static",
"final",
"char",
"STATIC_PREFIX",
"=",
"'s'",
";",
"private",
"static",
"final",
"char",
"NORMAL_PREFIX",
"=",
"'n'",
";",
"private",
"final",
"ImportRewriteContext",
"defaultContext",
";",
"private",
"final",
"ICompilationUnit",
"compilationUnit",
";",
"private",
"final",
"CompilationUnit",
"astRoot",
";",
"private",
"final",
"boolean",
"restoreExistingImports",
";",
"private",
"final",
"List",
"existingImports",
";",
"private",
"final",
"Map",
"importsKindMap",
";",
"private",
"String",
"[",
"]",
"importOrder",
";",
"private",
"int",
"importOnDemandThreshold",
";",
"private",
"int",
"staticImportOnDemandThreshold",
";",
"private",
"List",
"addedImports",
";",
"private",
"List",
"removedImports",
";",
"private",
"String",
"[",
"]",
"createdImports",
";",
"private",
"String",
"[",
"]",
"createdStaticImports",
";",
"private",
"boolean",
"filterImplicitImports",
";",
"private",
"boolean",
"useContextToFilterImplicitImports",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"ImportRewrite",
"create",
"(",
"ICompilationUnit",
"cu",
",",
"boolean",
"restoreExistingImports",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"cu",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"List",
"existingImport",
"=",
"null",
";",
"if",
"(",
"restoreExistingImports",
")",
"{",
"existingImport",
"=",
"new",
"ArrayList",
"(",
")",
";",
"IImportDeclaration",
"[",
"]",
"imports",
"=",
"cu",
".",
"getImports",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"imports",
".",
"length",
";",
"i",
"++",
")",
"{",
"IImportDeclaration",
"curr",
"=",
"imports",
"[",
"i",
"]",
";",
"char",
"prefix",
"=",
"Flags",
".",
"isStatic",
"(",
"curr",
".",
"getFlags",
"(",
")",
")",
"?",
"STATIC_PREFIX",
":",
"NORMAL_PREFIX",
";",
"existingImport",
".",
"add",
"(",
"prefix",
"+",
"curr",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"return",
"new",
"ImportRewrite",
"(",
"cu",
",",
"null",
",",
"existingImport",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"ImportRewrite",
"create",
"(",
"CompilationUnit",
"astRoot",
",",
"boolean",
"restoreExistingImports",
")",
"{",
"if",
"(",
"astRoot",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"ITypeRoot",
"typeRoot",
"=",
"astRoot",
".",
"getTypeRoot",
"(",
")",
";",
"if",
"(",
"!",
"(",
"typeRoot",
"instanceof",
"ICompilationUnit",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"List",
"existingImport",
"=",
"null",
";",
"if",
"(",
"restoreExistingImports",
")",
"{",
"existingImport",
"=",
"new",
"ArrayList",
"(",
")",
";",
"List",
"imports",
"=",
"astRoot",
".",
"imports",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"imports",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"ImportDeclaration",
"curr",
"=",
"(",
"ImportDeclaration",
")",
"imports",
".",
"get",
"(",
"i",
")",
";",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"curr",
".",
"isStatic",
"(",
")",
"?",
"STATIC_PREFIX",
":",
"NORMAL_PREFIX",
")",
".",
"append",
"(",
"curr",
".",
"getName",
"(",
")",
".",
"getFullyQualifiedName",
"(",
")",
")",
";",
"if",
"(",
"curr",
".",
"isOnDemand",
"(",
")",
")",
"{",
"if",
"(",
"buf",
".",
"length",
"(",
")",
">",
"1",
")",
"buf",
".",
"append",
"(",
"'.'",
")",
";",
"buf",
".",
"append",
"(",
"'*'",
")",
";",
"}",
"existingImport",
".",
"add",
"(",
"buf",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"return",
"new",
"ImportRewrite",
"(",
"(",
"ICompilationUnit",
")",
"typeRoot",
",",
"astRoot",
",",
"existingImport",
")",
";",
"}",
"private",
"ImportRewrite",
"(",
"ICompilationUnit",
"cu",
",",
"CompilationUnit",
"astRoot",
",",
"List",
"existingImports",
")",
"{",
"this",
".",
"compilationUnit",
"=",
"cu",
";",
"this",
".",
"astRoot",
"=",
"astRoot",
";",
"if",
"(",
"existingImports",
"!=",
"null",
")",
"{",
"this",
".",
"existingImports",
"=",
"existingImports",
";",
"this",
".",
"restoreExistingImports",
"=",
"!",
"existingImports",
".",
"isEmpty",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"existingImports",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"restoreExistingImports",
"=",
"false",
";",
"}",
"this",
".",
"filterImplicitImports",
"=",
"true",
";",
"this",
".",
"useContextToFilterImplicitImports",
"=",
"false",
";",
"this",
".",
"defaultContext",
"=",
"new",
"ImportRewriteContext",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"findInContext",
"(",
"String",
"qualifier",
",",
"String",
"name",
",",
"int",
"kind",
")",
"{",
"return",
"findInImports",
"(",
"qualifier",
",",
"name",
",",
"kind",
")",
";",
"}",
"}",
";",
"this",
".",
"addedImports",
"=",
"null",
";",
"this",
".",
"removedImports",
"=",
"null",
";",
"this",
".",
"createdImports",
"=",
"null",
";",
"this",
".",
"createdStaticImports",
"=",
"null",
";",
"this",
".",
"importOrder",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"this",
".",
"importOnDemandThreshold",
"=",
"99",
";",
"this",
".",
"staticImportOnDemandThreshold",
"=",
"99",
";",
"this",
".",
"importsKindMap",
"=",
"new",
"HashMap",
"(",
")",
";",
"}",
"public",
"void",
"setImportOrder",
"(",
"String",
"[",
"]",
"order",
")",
"{",
"if",
"(",
"order",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"this",
".",
"importOrder",
"=",
"order",
";",
"}",
"public",
"void",
"setOnDemandImportThreshold",
"(",
"int",
"threshold",
")",
"{",
"if",
"(",
"threshold",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"this",
".",
"importOnDemandThreshold",
"=",
"threshold",
";",
"}",
"public",
"void",
"setStaticOnDemandImportThreshold",
"(",
"int",
"threshold",
")",
"{",
"if",
"(",
"threshold",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"this",
".",
"staticImportOnDemandThreshold",
"=",
"threshold",
";",
"}",
"public",
"ICompilationUnit",
"getCompilationUnit",
"(",
")",
"{",
"return",
"this",
".",
"compilationUnit",
";",
"}",
"public",
"ImportRewriteContext",
"getDefaultImportRewriteContext",
"(",
")",
"{",
"return",
"this",
".",
"defaultContext",
";",
"}",
"public",
"void",
"setFilterImplicitImports",
"(",
"boolean",
"filterImplicitImports",
")",
"{",
"this",
".",
"filterImplicitImports",
"=",
"filterImplicitImports",
";",
"}",
"public",
"void",
"setUseContextToFilterImplicitImports",
"(",
"boolean",
"useContextToFilterImplicitImports",
")",
"{",
"this",
".",
"useContextToFilterImplicitImports",
"=",
"useContextToFilterImplicitImports",
";",
"}",
"private",
"static",
"int",
"compareImport",
"(",
"char",
"prefix",
",",
"String",
"qualifier",
",",
"String",
"name",
",",
"String",
"curr",
")",
"{",
"if",
"(",
"curr",
".",
"charAt",
"(",
"0",
")",
"!=",
"prefix",
"||",
"!",
"curr",
".",
"endsWith",
"(",
"name",
")",
")",
"{",
"return",
"ImportRewriteContext",
".",
"RES_NAME_UNKNOWN",
";",
"}",
"curr",
"=",
"curr",
".",
"substring",
"(",
"1",
")",
";",
"if",
"(",
"curr",
".",
"length",
"(",
")",
"==",
"name",
".",
"length",
"(",
")",
")",
"{",
"if",
"(",
"qualifier",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"ImportRewriteContext",
".",
"RES_NAME_FOUND",
";",
"}",
"return",
"ImportRewriteContext",
".",
"RES_NAME_CONFLICT",
";",
"}",
"int",
"dotPos",
"=",
"curr",
".",
"length",
"(",
")",
"-",
"name",
".",
"length",
"(",
")",
"-",
"1",
";",
"if",
"(",
"curr",
".",
"charAt",
"(",
"dotPos",
")",
"!=",
"'.'",
")",
"{",
"return",
"ImportRewriteContext",
".",
"RES_NAME_UNKNOWN",
";",
"}",
"if",
"(",
"qualifier",
".",
"length",
"(",
")",
"!=",
"dotPos",
"||",
"!",
"curr",
".",
"startsWith",
"(",
"qualifier",
")",
")",
"{",
"return",
"ImportRewriteContext",
".",
"RES_NAME_CONFLICT",
";",
"}",
"return",
"ImportRewriteContext",
".",
"RES_NAME_FOUND",
";",
"}",
"final",
"int",
"findInImports",
"(",
"String",
"qualifier",
",",
"String",
"name",
",",
"int",
"kind",
")",
"{",
"boolean",
"allowAmbiguity",
"=",
"(",
"kind",
"==",
"ImportRewriteContext",
".",
"KIND_STATIC_METHOD",
")",
"||",
"(",
"name",
".",
"length",
"(",
")",
"==",
"1",
"&&",
"name",
".",
"charAt",
"(",
"0",
")",
"==",
"'*'",
")",
";",
"List",
"imports",
"=",
"this",
".",
"existingImports",
";",
"char",
"prefix",
"=",
"(",
"kind",
"==",
"ImportRewriteContext",
".",
"KIND_TYPE",
")",
"?",
"NORMAL_PREFIX",
":",
"STATIC_PREFIX",
";",
"for",
"(",
"int",
"i",
"=",
"imports",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"String",
"curr",
"=",
"(",
"String",
")",
"imports",
".",
"get",
"(",
"i",
")",
";",
"int",
"res",
"=",
"compareImport",
"(",
"prefix",
",",
"qualifier",
",",
"name",
",",
"curr",
")",
";",
"if",
"(",
"res",
"!=",
"ImportRewriteContext",
".",
"RES_NAME_UNKNOWN",
")",
"{",
"if",
"(",
"!",
"allowAmbiguity",
"||",
"res",
"==",
"ImportRewriteContext",
".",
"RES_NAME_FOUND",
")",
"{",
"if",
"(",
"prefix",
"!=",
"STATIC_PREFIX",
")",
"{",
"return",
"res",
";",
"}",
"Object",
"currKind",
"=",
"this",
".",
"importsKindMap",
".",
"get",
"(",
"curr",
".",
"substring",
"(",
"1",
")",
")",
";",
"if",
"(",
"currKind",
"!=",
"null",
"&&",
"currKind",
".",
"equals",
"(",
"this",
".",
"importsKindMap",
".",
"get",
"(",
"qualifier",
"+",
"'.'",
"+",
"name",
")",
")",
")",
"{",
"return",
"res",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"this",
".",
"filterImplicitImports",
"&&",
"this",
".",
"useContextToFilterImplicitImports",
")",
"{",
"String",
"fPackageName",
"=",
"this",
".",
"compilationUnit",
".",
"getParent",
"(",
")",
".",
"getElementName",
"(",
")",
";",
"String",
"mainTypeSimpleName",
"=",
"JavaCore",
".",
"removeJavaLikeExtension",
"(",
"this",
".",
"compilationUnit",
".",
"getElementName",
"(",
")",
")",
";",
"String",
"fMainTypeName",
"=",
"Util",
".",
"concatenateName",
"(",
"fPackageName",
",",
"mainTypeSimpleName",
",",
"'.'",
")",
";",
"if",
"(",
"kind",
"==",
"ImportRewriteContext",
".",
"KIND_TYPE",
"&&",
"(",
"qualifier",
".",
"equals",
"(",
"fPackageName",
")",
"||",
"fMainTypeName",
".",
"equals",
"(",
"Util",
".",
"concatenateName",
"(",
"qualifier",
",",
"name",
",",
"'.'",
")",
")",
")",
")",
"return",
"ImportRewriteContext",
".",
"RES_NAME_FOUND",
";",
"}",
"return",
"ImportRewriteContext",
".",
"RES_NAME_UNKNOWN",
";",
"}",
"public",
"Type",
"addImportFromSignature",
"(",
"String",
"typeSig",
",",
"AST",
"ast",
")",
"{",
"return",
"addImportFromSignature",
"(",
"typeSig",
",",
"ast",
",",
"this",
".",
"defaultContext",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Type",
"addImportFromSignature",
"(",
"String",
"typeSig",
",",
"AST",
"ast",
",",
"ImportRewriteContext",
"context",
")",
"{",
"if",
"(",
"typeSig",
"==",
"null",
"||",
"typeSig",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"int",
"sigKind",
"=",
"Signature",
".",
"getTypeSignatureKind",
"(",
"typeSig",
")",
";",
"switch",
"(",
"sigKind",
")",
"{",
"case",
"Signature",
".",
"BASE_TYPE_SIGNATURE",
":",
"return",
"ast",
".",
"newPrimitiveType",
"(",
"PrimitiveType",
".",
"toCode",
"(",
"Signature",
".",
"toString",
"(",
"typeSig",
")",
")",
")",
";",
"case",
"Signature",
".",
"ARRAY_TYPE_SIGNATURE",
":",
"Type",
"elementType",
"=",
"addImportFromSignature",
"(",
"Signature",
".",
"getElementType",
"(",
"typeSig",
")",
",",
"ast",
",",
"context",
")",
";",
"return",
"ast",
".",
"newArrayType",
"(",
"elementType",
",",
"Signature",
".",
"getArrayCount",
"(",
"typeSig",
")",
")",
";",
"case",
"Signature",
".",
"CLASS_TYPE_SIGNATURE",
":",
"String",
"erasureSig",
"=",
"Signature",
".",
"getTypeErasure",
"(",
"typeSig",
")",
";",
"String",
"erasureName",
"=",
"Signature",
".",
"toString",
"(",
"erasureSig",
")",
";",
"if",
"(",
"erasureSig",
".",
"charAt",
"(",
"0",
")",
"==",
"Signature",
".",
"C_RESOLVED",
")",
"{",
"erasureName",
"=",
"internalAddImport",
"(",
"erasureName",
",",
"context",
")",
";",
"}",
"Type",
"baseType",
"=",
"ast",
".",
"newSimpleType",
"(",
"ast",
".",
"newName",
"(",
"erasureName",
")",
")",
";",
"String",
"[",
"]",
"typeArguments",
"=",
"Signature",
".",
"getTypeArguments",
"(",
"typeSig",
")",
";",
"if",
"(",
"typeArguments",
".",
"length",
">",
"0",
")",
"{",
"ParameterizedType",
"type",
"=",
"ast",
".",
"newParameterizedType",
"(",
"baseType",
")",
";",
"List",
"argNodes",
"=",
"type",
".",
"typeArguments",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"typeArguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"curr",
"=",
"typeArguments",
"[",
"i",
"]",
";",
"if",
"(",
"containsNestedCapture",
"(",
"curr",
")",
")",
"{",
"argNodes",
".",
"add",
"(",
"ast",
".",
"newWildcardType",
"(",
")",
")",
";",
"}",
"else",
"{",
"argNodes",
".",
"add",
"(",
"addImportFromSignature",
"(",
"curr",
",",
"ast",
",",
"context",
")",
")",
";",
"}",
"}",
"return",
"type",
";",
"}",
"return",
"baseType",
";",
"case",
"Signature",
".",
"TYPE_VARIABLE_SIGNATURE",
":",
"return",
"ast",
".",
"newSimpleType",
"(",
"ast",
".",
"newSimpleName",
"(",
"Signature",
".",
"toString",
"(",
"typeSig",
")",
")",
")",
";",
"case",
"Signature",
".",
"WILDCARD_TYPE_SIGNATURE",
":",
"WildcardType",
"wildcardType",
"=",
"ast",
".",
"newWildcardType",
"(",
")",
";",
"char",
"ch",
"=",
"typeSig",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"ch",
"!=",
"Signature",
".",
"C_STAR",
")",
"{",
"Type",
"bound",
"=",
"addImportFromSignature",
"(",
"typeSig",
".",
"substring",
"(",
"1",
")",
",",
"ast",
",",
"context",
")",
";",
"wildcardType",
".",
"setBound",
"(",
"bound",
",",
"ch",
"==",
"Signature",
".",
"C_EXTENDS",
")",
";",
"}",
"return",
"wildcardType",
";",
"case",
"Signature",
".",
"CAPTURE_TYPE_SIGNATURE",
":",
"return",
"addImportFromSignature",
"(",
"typeSig",
".",
"substring",
"(",
"1",
")",
",",
"ast",
",",
"context",
")",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
"+",
"typeSig",
")",
";",
"}",
"}",
"public",
"String",
"addImport",
"(",
"ITypeBinding",
"binding",
")",
"{",
"return",
"addImport",
"(",
"binding",
",",
"this",
".",
"defaultContext",
")",
";",
"}",
"public",
"String",
"addImport",
"(",
"ITypeBinding",
"binding",
",",
"ImportRewriteContext",
"context",
")",
"{",
"if",
"(",
"binding",
".",
"isPrimitive",
"(",
")",
"||",
"binding",
".",
"isTypeVariable",
"(",
")",
"||",
"binding",
".",
"isRecovered",
"(",
")",
")",
"{",
"return",
"binding",
".",
"getName",
"(",
")",
";",
"}",
"ITypeBinding",
"normalizedBinding",
"=",
"normalizeTypeBinding",
"(",
"binding",
")",
";",
"if",
"(",
"normalizedBinding",
"==",
"null",
")",
"{",
"return",
"\"invalid\"",
";",
"}",
"if",
"(",
"normalizedBinding",
".",
"isWildcardType",
"(",
")",
")",
"{",
"StringBuffer",
"res",
"=",
"new",
"StringBuffer",
"(",
"\"?\"",
")",
";",
"ITypeBinding",
"bound",
"=",
"normalizedBinding",
".",
"getBound",
"(",
")",
";",
"if",
"(",
"bound",
"!=",
"null",
"&&",
"!",
"bound",
".",
"isWildcardType",
"(",
")",
"&&",
"!",
"bound",
".",
"isCapture",
"(",
")",
")",
"{",
"if",
"(",
"normalizedBinding",
".",
"isUpperbound",
"(",
")",
")",
"{",
"res",
".",
"append",
"(",
"\"",
"extends",
"\"",
")",
";",
"}",
"else",
"{",
"res",
".",
"append",
"(",
"\"",
"super",
"\"",
")",
";",
"}",
"res",
".",
"append",
"(",
"addImport",
"(",
"bound",
",",
"context",
")",
")",
";",
"}",
"return",
"res",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"normalizedBinding",
".",
"isArray",
"(",
")",
")",
"{",
"StringBuffer",
"res",
"=",
"new",
"StringBuffer",
"(",
"addImport",
"(",
"normalizedBinding",
".",
"getElementType",
"(",
")",
",",
"context",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"normalizedBinding",
".",
"getDimensions",
"(",
")",
";",
"i",
">",
"0",
";",
"i",
"--",
")",
"{",
"res",
".",
"append",
"(",
"\"[]\"",
")",
";",
"}",
"return",
"res",
".",
"toString",
"(",
")",
";",
"}",
"String",
"qualifiedName",
"=",
"getRawQualifiedName",
"(",
"normalizedBinding",
")",
";",
"if",
"(",
"qualifiedName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"String",
"str",
"=",
"internalAddImport",
"(",
"qualifiedName",
",",
"context",
")",
";",
"ITypeBinding",
"[",
"]",
"typeArguments",
"=",
"normalizedBinding",
".",
"getTypeArguments",
"(",
")",
";",
"if",
"(",
"typeArguments",
".",
"length",
">",
"0",
")",
"{",
"StringBuffer",
"res",
"=",
"new",
"StringBuffer",
"(",
"str",
")",
";",
"res",
".",
"append",
"(",
"'<'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"typeArguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"res",
".",
"append",
"(",
"','",
")",
";",
"}",
"ITypeBinding",
"curr",
"=",
"typeArguments",
"[",
"i",
"]",
";",
"if",
"(",
"containsNestedCapture",
"(",
"curr",
",",
"false",
")",
")",
"{",
"res",
".",
"append",
"(",
"'?'",
")",
";",
"}",
"else",
"{",
"res",
".",
"append",
"(",
"addImport",
"(",
"curr",
",",
"context",
")",
")",
";",
"}",
"}",
"res",
".",
"append",
"(",
"'>'",
")",
";",
"return",
"res",
".",
"toString",
"(",
")",
";",
"}",
"return",
"str",
";",
"}",
"return",
"getRawName",
"(",
"normalizedBinding",
")",
";",
"}",
"private",
"boolean",
"containsNestedCapture",
"(",
"ITypeBinding",
"binding",
",",
"boolean",
"isNested",
")",
"{",
"if",
"(",
"binding",
"==",
"null",
"||",
"binding",
".",
"isPrimitive",
"(",
")",
"||",
"binding",
".",
"isTypeVariable",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"binding",
".",
"isCapture",
"(",
")",
")",
"{",
"if",
"(",
"isNested",
")",
"{",
"return",
"true",
";",
"}",
"return",
"containsNestedCapture",
"(",
"binding",
".",
"getWildcard",
"(",
")",
",",
"true",
")",
";",
"}",
"if",
"(",
"binding",
".",
"isWildcardType",
"(",
")",
")",
"{",
"return",
"containsNestedCapture",
"(",
"binding",
".",
"getBound",
"(",
")",
",",
"true",
")",
";",
"}",
"if",
"(",
"binding",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"containsNestedCapture",
"(",
"binding",
".",
"getElementType",
"(",
")",
",",
"true",
")",
";",
"}",
"ITypeBinding",
"[",
"]",
"typeArguments",
"=",
"binding",
".",
"getTypeArguments",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"typeArguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"containsNestedCapture",
"(",
"typeArguments",
"[",
"i",
"]",
",",
"true",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"containsNestedCapture",
"(",
"String",
"signature",
")",
"{",
"return",
"signature",
".",
"length",
"(",
")",
">",
"1",
"&&",
"signature",
".",
"indexOf",
"(",
"Signature",
".",
"C_CAPTURE",
",",
"1",
")",
"!=",
"-",
"1",
";",
"}",
"private",
"static",
"ITypeBinding",
"normalizeTypeBinding",
"(",
"ITypeBinding",
"binding",
")",
"{",
"if",
"(",
"binding",
"!=",
"null",
"&&",
"!",
"binding",
".",
"isNullType",
"(",
")",
"&&",
"!",
"\"void\"",
".",
"equals",
"(",
"binding",
".",
"getName",
"(",
")",
")",
")",
"{",
"if",
"(",
"binding",
".",
"isAnonymous",
"(",
")",
")",
"{",
"ITypeBinding",
"[",
"]",
"baseBindings",
"=",
"binding",
".",
"getInterfaces",
"(",
")",
";",
"if",
"(",
"baseBindings",
".",
"length",
">",
"0",
")",
"{",
"return",
"baseBindings",
"[",
"0",
"]",
";",
"}",
"return",
"binding",
".",
"getSuperclass",
"(",
")",
";",
"}",
"if",
"(",
"binding",
".",
"isCapture",
"(",
")",
")",
"{",
"return",
"binding",
".",
"getWildcard",
"(",
")",
";",
"}",
"return",
"binding",
";",
"}",
"return",
"null",
";",
"}",
"public",
"Type",
"addImport",
"(",
"ITypeBinding",
"binding",
",",
"AST",
"ast",
")",
"{",
"return",
"addImport",
"(",
"binding",
",",
"ast",
",",
"this",
".",
"defaultContext",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Type",
"addImport",
"(",
"ITypeBinding",
"binding",
",",
"AST",
"ast",
",",
"ImportRewriteContext",
"context",
")",
"{",
"if",
"(",
"binding",
".",
"isPrimitive",
"(",
")",
")",
"{",
"return",
"ast",
".",
"newPrimitiveType",
"(",
"PrimitiveType",
".",
"toCode",
"(",
"binding",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"ITypeBinding",
"normalizedBinding",
"=",
"normalizeTypeBinding",
"(",
"binding",
")",
";",
"if",
"(",
"normalizedBinding",
"==",
"null",
")",
"{",
"return",
"ast",
".",
"newSimpleType",
"(",
"ast",
".",
"newSimpleName",
"(",
"\"invalid\"",
")",
")",
";",
"}",
"if",
"(",
"normalizedBinding",
".",
"isTypeVariable",
"(",
")",
")",
"{",
"return",
"ast",
".",
"newSimpleType",
"(",
"ast",
".",
"newSimpleName",
"(",
"binding",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"normalizedBinding",
".",
"isWildcardType",
"(",
")",
")",
"{",
"WildcardType",
"wcType",
"=",
"ast",
".",
"newWildcardType",
"(",
")",
";",
"ITypeBinding",
"bound",
"=",
"normalizedBinding",
".",
"getBound",
"(",
")",
";",
"if",
"(",
"bound",
"!=",
"null",
"&&",
"!",
"bound",
".",
"isWildcardType",
"(",
")",
"&&",
"!",
"bound",
".",
"isCapture",
"(",
")",
")",
"{",
"Type",
"boundType",
"=",
"addImport",
"(",
"bound",
",",
"ast",
",",
"context",
")",
";",
"wcType",
".",
"setBound",
"(",
"boundType",
",",
"normalizedBinding",
".",
"isUpperbound",
"(",
")",
")",
";",
"}",
"return",
"wcType",
";",
"}",
"if",
"(",
"normalizedBinding",
".",
"isArray",
"(",
")",
")",
"{",
"Type",
"elementType",
"=",
"addImport",
"(",
"normalizedBinding",
".",
"getElementType",
"(",
")",
",",
"ast",
",",
"context",
")",
";",
"return",
"ast",
".",
"newArrayType",
"(",
"elementType",
",",
"normalizedBinding",
".",
"getDimensions",
"(",
")",
")",
";",
"}",
"String",
"qualifiedName",
"=",
"getRawQualifiedName",
"(",
"normalizedBinding",
")",
";",
"if",
"(",
"qualifiedName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"String",
"res",
"=",
"internalAddImport",
"(",
"qualifiedName",
",",
"context",
")",
";",
"ITypeBinding",
"[",
"]",
"typeArguments",
"=",
"normalizedBinding",
".",
"getTypeArguments",
"(",
")",
";",
"if",
"(",
"typeArguments",
".",
"length",
">",
"0",
")",
"{",
"Type",
"erasureType",
"=",
"ast",
".",
"newSimpleType",
"(",
"ast",
".",
"newName",
"(",
"res",
")",
")",
";",
"ParameterizedType",
"paramType",
"=",
"ast",
".",
"newParameterizedType",
"(",
"erasureType",
")",
";",
"List",
"arguments",
"=",
"paramType",
".",
"typeArguments",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"typeArguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"ITypeBinding",
"curr",
"=",
"typeArguments",
"[",
"i",
"]",
";",
"if",
"(",
"containsNestedCapture",
"(",
"curr",
",",
"false",
")",
")",
"{",
"arguments",
".",
"add",
"(",
"ast",
".",
"newWildcardType",
"(",
")",
")",
";",
"}",
"else",
"{",
"arguments",
".",
"add",
"(",
"addImport",
"(",
"curr",
",",
"ast",
",",
"context",
")",
")",
";",
"}",
"}",
"return",
"paramType",
";",
"}",
"return",
"ast",
".",
"newSimpleType",
"(",
"ast",
".",
"newName",
"(",
"res",
")",
")",
";",
"}",
"return",
"ast",
".",
"newSimpleType",
"(",
"ast",
".",
"newName",
"(",
"getRawName",
"(",
"normalizedBinding",
")",
")",
")",
";",
"}",
"public",
"String",
"addImport",
"(",
"String",
"qualifiedTypeName",
",",
"ImportRewriteContext",
"context",
")",
"{",
"int",
"angleBracketOffset",
"=",
"qualifiedTypeName",
".",
"indexOf",
"(",
"'<'",
")",
";",
"if",
"(",
"angleBracketOffset",
"!=",
"-",
"1",
")",
"{",
"return",
"internalAddImport",
"(",
"qualifiedTypeName",
".",
"substring",
"(",
"0",
",",
"angleBracketOffset",
")",
",",
"context",
")",
"+",
"qualifiedTypeName",
".",
"substring",
"(",
"angleBracketOffset",
")",
";",
"}",
"int",
"bracketOffset",
"=",
"qualifiedTypeName",
".",
"indexOf",
"(",
"'['",
")",
";",
"if",
"(",
"bracketOffset",
"!=",
"-",
"1",
")",
"{",
"return",
"internalAddImport",
"(",
"qualifiedTypeName",
".",
"substring",
"(",
"0",
",",
"bracketOffset",
")",
",",
"context",
")",
"+",
"qualifiedTypeName",
".",
"substring",
"(",
"bracketOffset",
")",
";",
"}",
"return",
"internalAddImport",
"(",
"qualifiedTypeName",
",",
"context",
")",
";",
"}",
"public",
"String",
"addImport",
"(",
"String",
"qualifiedTypeName",
")",
"{",
"return",
"addImport",
"(",
"qualifiedTypeName",
",",
"this",
".",
"defaultContext",
")",
";",
"}",
"public",
"String",
"addStaticImport",
"(",
"IBinding",
"binding",
")",
"{",
"return",
"addStaticImport",
"(",
"binding",
",",
"this",
".",
"defaultContext",
")",
";",
"}",
"public",
"String",
"addStaticImport",
"(",
"IBinding",
"binding",
",",
"ImportRewriteContext",
"context",
")",
"{",
"if",
"(",
"Modifier",
".",
"isStatic",
"(",
"binding",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"if",
"(",
"binding",
"instanceof",
"IVariableBinding",
")",
"{",
"IVariableBinding",
"variableBinding",
"=",
"(",
"IVariableBinding",
")",
"binding",
";",
"if",
"(",
"variableBinding",
".",
"isField",
"(",
")",
")",
"{",
"ITypeBinding",
"declaringType",
"=",
"variableBinding",
".",
"getDeclaringClass",
"(",
")",
";",
"return",
"addStaticImport",
"(",
"getRawQualifiedName",
"(",
"declaringType",
")",
",",
"binding",
".",
"getName",
"(",
")",
",",
"true",
",",
"context",
")",
";",
"}",
"}",
"else",
"if",
"(",
"binding",
"instanceof",
"IMethodBinding",
")",
"{",
"ITypeBinding",
"declaringType",
"=",
"(",
"(",
"IMethodBinding",
")",
"binding",
")",
".",
"getDeclaringClass",
"(",
")",
";",
"return",
"addStaticImport",
"(",
"getRawQualifiedName",
"(",
"declaringType",
")",
",",
"binding",
".",
"getName",
"(",
")",
",",
"false",
",",
"context",
")",
";",
"}",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"public",
"String",
"addStaticImport",
"(",
"String",
"declaringTypeName",
",",
"String",
"simpleName",
",",
"boolean",
"isField",
")",
"{",
"return",
"addStaticImport",
"(",
"declaringTypeName",
",",
"simpleName",
",",
"isField",
",",
"this",
".",
"defaultContext",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"String",
"addStaticImport",
"(",
"String",
"declaringTypeName",
",",
"String",
"simpleName",
",",
"boolean",
"isField",
",",
"ImportRewriteContext",
"context",
")",
"{",
"String",
"key",
"=",
"declaringTypeName",
"+",
"'.'",
"+",
"simpleName",
";",
"if",
"(",
"declaringTypeName",
".",
"indexOf",
"(",
"'.'",
")",
"==",
"-",
"1",
")",
"{",
"return",
"key",
";",
"}",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"context",
"=",
"this",
".",
"defaultContext",
";",
"}",
"int",
"kind",
"=",
"isField",
"?",
"ImportRewriteContext",
".",
"KIND_STATIC_FIELD",
":",
"ImportRewriteContext",
".",
"KIND_STATIC_METHOD",
";",
"this",
".",
"importsKindMap",
".",
"put",
"(",
"key",
",",
"new",
"Integer",
"(",
"kind",
")",
")",
";",
"int",
"res",
"=",
"context",
".",
"findInContext",
"(",
"declaringTypeName",
",",
"simpleName",
",",
"kind",
")",
";",
"if",
"(",
"res",
"==",
"ImportRewriteContext",
".",
"RES_NAME_CONFLICT",
")",
"{",
"return",
"key",
";",
"}",
"if",
"(",
"res",
"==",
"ImportRewriteContext",
".",
"RES_NAME_UNKNOWN",
")",
"{",
"addEntry",
"(",
"STATIC_PREFIX",
"+",
"key",
")",
";",
"}",
"return",
"simpleName",
";",
"}",
"private",
"String",
"internalAddImport",
"(",
"String",
"fullTypeName",
",",
"ImportRewriteContext",
"context",
")",
"{",
"int",
"idx",
"=",
"fullTypeName",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"String",
"typeContainerName",
",",
"typeName",
";",
"if",
"(",
"idx",
"!=",
"-",
"1",
")",
"{",
"typeContainerName",
"=",
"fullTypeName",
".",
"substring",
"(",
"0",
",",
"idx",
")",
";",
"typeName",
"=",
"fullTypeName",
".",
"substring",
"(",
"idx",
"+",
"1",
")",
";",
"}",
"else",
"{",
"typeContainerName",
"=",
"\"\"",
";",
"typeName",
"=",
"fullTypeName",
";",
"}",
"if",
"(",
"typeContainerName",
".",
"length",
"(",
")",
"==",
"0",
"&&",
"PrimitiveType",
".",
"toCode",
"(",
"typeName",
")",
"!=",
"null",
")",
"{",
"return",
"fullTypeName",
";",
"}",
"if",
"(",
"context",
"==",
"null",
")",
"context",
"=",
"this",
".",
"defaultContext",
";",
"int",
"res",
"=",
"context",
".",
"findInContext",
"(",
"typeContainerName",
",",
"typeName",
",",
"ImportRewriteContext",
".",
"KIND_TYPE",
")",
";",
"if",
"(",
"res",
"==",
"ImportRewriteContext",
".",
"RES_NAME_CONFLICT",
")",
"{",
"return",
"fullTypeName",
";",
"}",
"if",
"(",
"res",
"==",
"ImportRewriteContext",
".",
"RES_NAME_UNKNOWN",
")",
"{",
"addEntry",
"(",
"NORMAL_PREFIX",
"+",
"fullTypeName",
")",
";",
"}",
"return",
"typeName",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"addEntry",
"(",
"String",
"entry",
")",
"{",
"this",
".",
"existingImports",
".",
"add",
"(",
"entry",
")",
";",
"if",
"(",
"this",
".",
"removedImports",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"removedImports",
".",
"remove",
"(",
"entry",
")",
")",
"{",
"return",
";",
"}",
"}",
"if",
"(",
"this",
".",
"addedImports",
"==",
"null",
")",
"{",
"this",
".",
"addedImports",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"this",
".",
"addedImports",
".",
"add",
"(",
"entry",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"boolean",
"removeEntry",
"(",
"String",
"entry",
")",
"{",
"if",
"(",
"this",
".",
"existingImports",
".",
"remove",
"(",
"entry",
")",
")",
"{",
"if",
"(",
"this",
".",
"addedImports",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"addedImports",
".",
"remove",
"(",
"entry",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"if",
"(",
"this",
".",
"removedImports",
"==",
"null",
")",
"{",
"this",
".",
"removedImports",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"this",
".",
"removedImports",
".",
"add",
"(",
"entry",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"removeImport",
"(",
"String",
"qualifiedName",
")",
"{",
"return",
"removeEntry",
"(",
"NORMAL_PREFIX",
"+",
"qualifiedName",
")",
";",
"}",
"public",
"boolean",
"removeStaticImport",
"(",
"String",
"qualifiedName",
")",
"{",
"return",
"removeEntry",
"(",
"STATIC_PREFIX",
"+",
"qualifiedName",
")",
";",
"}",
"private",
"static",
"String",
"getRawName",
"(",
"ITypeBinding",
"normalizedBinding",
")",
"{",
"return",
"normalizedBinding",
".",
"getTypeDeclaration",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"private",
"static",
"String",
"getRawQualifiedName",
"(",
"ITypeBinding",
"normalizedBinding",
")",
"{",
"return",
"normalizedBinding",
".",
"getTypeDeclaration",
"(",
")",
".",
"getQualifiedName",
"(",
")",
";",
"}",
"public",
"final",
"TextEdit",
"rewriteImports",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"monitor",
"==",
"null",
")",
"{",
"monitor",
"=",
"new",
"NullProgressMonitor",
"(",
")",
";",
"}",
"try",
"{",
"monitor",
".",
"beginTask",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"importRewrite_processDescription",
")",
",",
"2",
")",
";",
"if",
"(",
"!",
"hasRecordedChanges",
"(",
")",
")",
"{",
"this",
".",
"createdImports",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"this",
".",
"createdStaticImports",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"return",
"new",
"MultiTextEdit",
"(",
")",
";",
"}",
"CompilationUnit",
"usedAstRoot",
"=",
"this",
".",
"astRoot",
";",
"if",
"(",
"usedAstRoot",
"==",
"null",
")",
"{",
"ASTParser",
"parser",
"=",
"ASTParser",
".",
"newParser",
"(",
"AST",
".",
"JLS3",
")",
";",
"parser",
".",
"setSource",
"(",
"this",
".",
"compilationUnit",
")",
";",
"parser",
".",
"setFocalPosition",
"(",
"0",
")",
";",
"parser",
".",
"setResolveBindings",
"(",
"false",
")",
";",
"usedAstRoot",
"=",
"(",
"CompilationUnit",
")",
"parser",
".",
"createAST",
"(",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"}",
"ImportRewriteAnalyzer",
"computer",
"=",
"new",
"ImportRewriteAnalyzer",
"(",
"this",
".",
"compilationUnit",
",",
"usedAstRoot",
",",
"this",
".",
"importOrder",
",",
"this",
".",
"importOnDemandThreshold",
",",
"this",
".",
"staticImportOnDemandThreshold",
",",
"this",
".",
"restoreExistingImports",
",",
"this",
".",
"useContextToFilterImplicitImports",
")",
";",
"computer",
".",
"setFilterImplicitImports",
"(",
"this",
".",
"filterImplicitImports",
")",
";",
"if",
"(",
"this",
".",
"addedImports",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"addedImports",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"curr",
"=",
"(",
"String",
")",
"this",
".",
"addedImports",
".",
"get",
"(",
"i",
")",
";",
"computer",
".",
"addImport",
"(",
"curr",
".",
"substring",
"(",
"1",
")",
",",
"STATIC_PREFIX",
"==",
"curr",
".",
"charAt",
"(",
"0",
")",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"removedImports",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"removedImports",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"curr",
"=",
"(",
"String",
")",
"this",
".",
"removedImports",
".",
"get",
"(",
"i",
")",
";",
"computer",
".",
"removeImport",
"(",
"curr",
".",
"substring",
"(",
"1",
")",
",",
"STATIC_PREFIX",
"==",
"curr",
".",
"charAt",
"(",
"0",
")",
")",
";",
"}",
"}",
"TextEdit",
"result",
"=",
"computer",
".",
"getResultingEdits",
"(",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"this",
".",
"createdImports",
"=",
"computer",
".",
"getCreatedImports",
"(",
")",
";",
"this",
".",
"createdStaticImports",
"=",
"computer",
".",
"getCreatedStaticImports",
"(",
")",
";",
"return",
"result",
";",
"}",
"finally",
"{",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"public",
"String",
"[",
"]",
"getCreatedImports",
"(",
")",
"{",
"return",
"this",
".",
"createdImports",
";",
"}",
"public",
"String",
"[",
"]",
"getCreatedStaticImports",
"(",
")",
"{",
"return",
"this",
".",
"createdStaticImports",
";",
"}",
"public",
"String",
"[",
"]",
"getAddedImports",
"(",
")",
"{",
"return",
"filterFromList",
"(",
"this",
".",
"addedImports",
",",
"NORMAL_PREFIX",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getAddedStaticImports",
"(",
")",
"{",
"return",
"filterFromList",
"(",
"this",
".",
"addedImports",
",",
"STATIC_PREFIX",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getRemovedImports",
"(",
")",
"{",
"return",
"filterFromList",
"(",
"this",
".",
"removedImports",
",",
"NORMAL_PREFIX",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getRemovedStaticImports",
"(",
")",
"{",
"return",
"filterFromList",
"(",
"this",
".",
"removedImports",
",",
"STATIC_PREFIX",
")",
";",
"}",
"public",
"boolean",
"hasRecordedChanges",
"(",
")",
"{",
"return",
"!",
"this",
".",
"restoreExistingImports",
"||",
"(",
"this",
".",
"addedImports",
"!=",
"null",
"&&",
"!",
"this",
".",
"addedImports",
".",
"isEmpty",
"(",
")",
")",
"||",
"(",
"this",
".",
"removedImports",
"!=",
"null",
"&&",
"!",
"this",
".",
"removedImports",
".",
"isEmpty",
"(",
")",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"String",
"[",
"]",
"filterFromList",
"(",
"List",
"imports",
",",
"char",
"prefix",
")",
"{",
"if",
"(",
"imports",
"==",
"null",
")",
"{",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"ArrayList",
"res",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"imports",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"curr",
"=",
"(",
"String",
")",
"imports",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"prefix",
"==",
"curr",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"res",
".",
"add",
"(",
"curr",
".",
"substring",
"(",
"1",
")",
")",
";",
"}",
"}",
"return",
"(",
"String",
"[",
"]",
")",
"res",
".",
"toArray",
"(",
"new",
"String",
"[",
"res",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"addAlias",
"(",
"String",
"importName",
",",
"String",
"aliasName",
")",
"{",
"if",
"(",
"addedImports",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"addedImports",
".",
"indexOf",
"(",
"importName",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"addedImports",
".",
"set",
"(",
"index",
",",
"importName",
"+",
"\"",
"as",
"\"",
"+",
"aliasName",
")",
";",
"}",
"}",
"if",
"(",
"existingImports",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"existingImports",
".",
"indexOf",
"(",
"importName",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"existingImports",
".",
"set",
"(",
"index",
",",
"importName",
"+",
"\"",
"as",
"\"",
"+",
"aliasName",
")",
";",
"}",
"}",
"}",
"public",
"void",
"removeInvalidStaticAlias",
"(",
"String",
"aliasName",
")",
"{",
"existingImports",
".",
"remove",
"(",
"\"s\"",
"+",
"aliasName",
")",
";",
"}",
"}",
"</s>"
] |
6,261 | [
"<s>",
"package",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"dom",
".",
"rewrite",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ImportDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"PackageDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"formatter",
".",
"DefaultCodeFormatterConstants",
";",
"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",
".",
"TypeNameRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Region",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"DeleteEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"InsertEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MultiTextEdit",
";",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"final",
"class",
"ImportRewriteAnalyzer",
"{",
"private",
"final",
"ICompilationUnit",
"compilationUnit",
";",
"private",
"final",
"ArrayList",
"packageEntries",
";",
"private",
"final",
"List",
"importsCreated",
";",
"private",
"final",
"List",
"staticImportsCreated",
";",
"private",
"final",
"IRegion",
"replaceRange",
";",
"private",
"final",
"int",
"importOnDemandThreshold",
";",
"private",
"final",
"int",
"staticImportOnDemandThreshold",
";",
"private",
"boolean",
"filterImplicitImports",
";",
"private",
"boolean",
"useContextToFilterImplicitImports",
";",
"private",
"boolean",
"findAmbiguousImports",
";",
"private",
"int",
"flags",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"F_NEEDS_LEADING_DELIM",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"F_NEEDS_TRAILING_DELIM",
"=",
"4",
";",
"private",
"static",
"final",
"String",
"JAVA_LANG",
"=",
"\"java.lang\"",
";",
"public",
"ImportRewriteAnalyzer",
"(",
"ICompilationUnit",
"cu",
",",
"CompilationUnit",
"root",
",",
"String",
"[",
"]",
"importOrder",
",",
"int",
"threshold",
",",
"int",
"staticThreshold",
",",
"boolean",
"restoreExistingImports",
",",
"boolean",
"useContextToFilterImplicitImports",
")",
"{",
"this",
".",
"compilationUnit",
"=",
"cu",
";",
"this",
".",
"importOnDemandThreshold",
"=",
"threshold",
";",
"this",
".",
"staticImportOnDemandThreshold",
"=",
"staticThreshold",
";",
"this",
".",
"useContextToFilterImplicitImports",
"=",
"useContextToFilterImplicitImports",
";",
"this",
".",
"filterImplicitImports",
"=",
"true",
";",
"this",
".",
"findAmbiguousImports",
"=",
"true",
";",
"this",
".",
"packageEntries",
"=",
"new",
"ArrayList",
"(",
"20",
")",
";",
"this",
".",
"importsCreated",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"staticImportsCreated",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"flags",
"=",
"0",
";",
"this",
".",
"replaceRange",
"=",
"evaluateReplaceRange",
"(",
"root",
")",
";",
"if",
"(",
"restoreExistingImports",
")",
"{",
"addExistingImports",
"(",
"root",
")",
";",
"}",
"PackageEntry",
"[",
"]",
"order",
"=",
"new",
"PackageEntry",
"[",
"importOrder",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"order",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"curr",
"=",
"importOrder",
"[",
"i",
"]",
";",
"if",
"(",
"curr",
".",
"length",
"(",
")",
">",
"0",
"&&",
"curr",
".",
"charAt",
"(",
"0",
")",
"==",
"'#'",
")",
"{",
"curr",
"=",
"curr",
".",
"substring",
"(",
"1",
")",
";",
"order",
"[",
"i",
"]",
"=",
"new",
"PackageEntry",
"(",
"curr",
",",
"curr",
",",
"true",
")",
";",
"}",
"else",
"{",
"order",
"[",
"i",
"]",
"=",
"new",
"PackageEntry",
"(",
"curr",
",",
"curr",
",",
"false",
")",
";",
"}",
"}",
"addPreferenceOrderHolders",
"(",
"order",
")",
";",
"}",
"private",
"int",
"getSpacesBetweenImportGroups",
"(",
")",
"{",
"try",
"{",
"int",
"num",
"=",
"Integer",
".",
"parseInt",
"(",
"this",
".",
"compilationUnit",
".",
"getJavaProject",
"(",
")",
".",
"getOption",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS",
",",
"true",
")",
")",
";",
"if",
"(",
"num",
">=",
"0",
")",
"return",
"num",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"}",
"return",
"1",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"boolean",
"insertSpaceBeforeSemicolon",
"(",
")",
"{",
"return",
"JavaCore",
".",
"INSERT",
".",
"equals",
"(",
"this",
".",
"compilationUnit",
".",
"getJavaProject",
"(",
")",
".",
"getOption",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON",
",",
"true",
")",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"addPreferenceOrderHolders",
"(",
"PackageEntry",
"[",
"]",
"preferenceOrder",
")",
"{",
"if",
"(",
"this",
".",
"packageEntries",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"preferenceOrder",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"packageEntries",
".",
"add",
"(",
"preferenceOrder",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"{",
"PackageEntry",
"[",
"]",
"lastAssigned",
"=",
"new",
"PackageEntry",
"[",
"preferenceOrder",
".",
"length",
"]",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"this",
".",
"packageEntries",
".",
"size",
"(",
")",
";",
"k",
"++",
")",
"{",
"PackageEntry",
"entry",
"=",
"(",
"PackageEntry",
")",
"this",
".",
"packageEntries",
".",
"get",
"(",
"k",
")",
";",
"if",
"(",
"!",
"entry",
".",
"isComment",
"(",
")",
")",
"{",
"String",
"currName",
"=",
"entry",
".",
"getName",
"(",
")",
";",
"int",
"currNameLen",
"=",
"currName",
".",
"length",
"(",
")",
";",
"int",
"bestGroupIndex",
"=",
"-",
"1",
";",
"int",
"bestGroupLen",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"preferenceOrder",
".",
"length",
";",
"i",
"++",
")",
"{",
"boolean",
"currPrevStatic",
"=",
"preferenceOrder",
"[",
"i",
"]",
".",
"isStatic",
"(",
")",
";",
"if",
"(",
"currPrevStatic",
"==",
"entry",
".",
"isStatic",
"(",
")",
")",
"{",
"String",
"currPrefEntry",
"=",
"preferenceOrder",
"[",
"i",
"]",
".",
"getName",
"(",
")",
";",
"int",
"currPrefLen",
"=",
"currPrefEntry",
".",
"length",
"(",
")",
";",
"if",
"(",
"currName",
".",
"startsWith",
"(",
"currPrefEntry",
")",
"&&",
"currPrefLen",
">=",
"bestGroupLen",
")",
"{",
"if",
"(",
"currPrefLen",
"==",
"currNameLen",
"||",
"currName",
".",
"charAt",
"(",
"currPrefLen",
")",
"==",
"'.'",
")",
"{",
"if",
"(",
"bestGroupIndex",
"==",
"-",
"1",
"||",
"currPrefLen",
">",
"bestGroupLen",
")",
"{",
"bestGroupLen",
"=",
"currPrefLen",
";",
"bestGroupIndex",
"=",
"i",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"bestGroupIndex",
"!=",
"-",
"1",
")",
"{",
"entry",
".",
"setGroupID",
"(",
"preferenceOrder",
"[",
"bestGroupIndex",
"]",
".",
"getName",
"(",
")",
")",
";",
"lastAssigned",
"[",
"bestGroupIndex",
"]",
"=",
"entry",
";",
"}",
"}",
"}",
"int",
"currAppendIndex",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"lastAssigned",
".",
"length",
";",
"i",
"++",
")",
"{",
"PackageEntry",
"entry",
"=",
"lastAssigned",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"PackageEntry",
"newEntry",
"=",
"preferenceOrder",
"[",
"i",
"]",
";",
"if",
"(",
"currAppendIndex",
"==",
"0",
"&&",
"!",
"newEntry",
".",
"isStatic",
"(",
")",
")",
"{",
"currAppendIndex",
"=",
"getIndexAfterStatics",
"(",
")",
";",
"}",
"this",
".",
"packageEntries",
".",
"add",
"(",
"currAppendIndex",
",",
"newEntry",
")",
";",
"currAppendIndex",
"++",
";",
"}",
"else",
"{",
"currAppendIndex",
"=",
"this",
".",
"packageEntries",
".",
"indexOf",
"(",
"entry",
")",
"+",
"1",
";",
"}",
"}",
"}",
"}",
"private",
"String",
"getQualifier",
"(",
"ImportDeclaration",
"decl",
")",
"{",
"String",
"name",
"=",
"decl",
".",
"getName",
"(",
")",
".",
"getFullyQualifiedName",
"(",
")",
";",
"if",
"(",
"decl",
".",
"isOnDemand",
"(",
")",
")",
"{",
"return",
"name",
";",
"}",
"return",
"getQualifier",
"(",
"name",
",",
"decl",
".",
"isStatic",
"(",
")",
")",
";",
"}",
"private",
"String",
"getQualifier",
"(",
"String",
"name",
",",
"boolean",
"isStatic",
")",
"{",
"if",
"(",
"isStatic",
"||",
"!",
"this",
".",
"useContextToFilterImplicitImports",
")",
"{",
"return",
"Signature",
".",
"getQualifier",
"(",
"name",
")",
";",
"}",
"char",
"[",
"]",
"searchedName",
"=",
"name",
".",
"toCharArray",
"(",
")",
";",
"int",
"index",
"=",
"name",
".",
"length",
"(",
")",
";",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"this",
".",
"compilationUnit",
".",
"getJavaProject",
"(",
")",
";",
"do",
"{",
"String",
"testedName",
"=",
"new",
"String",
"(",
"searchedName",
",",
"0",
",",
"index",
")",
";",
"IJavaElement",
"fragment",
"=",
"null",
";",
"try",
"{",
"fragment",
"=",
"project",
".",
"findPackageFragment",
"(",
"testedName",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"name",
";",
"}",
"if",
"(",
"fragment",
"!=",
"null",
")",
"{",
"return",
"testedName",
";",
"}",
"try",
"{",
"fragment",
"=",
"project",
".",
"findType",
"(",
"testedName",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"name",
";",
"}",
"if",
"(",
"fragment",
"!=",
"null",
")",
"{",
"index",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"Signature",
".",
"C_DOT",
",",
"searchedName",
",",
"0",
",",
"index",
"-",
"1",
")",
";",
"}",
"else",
"{",
"index",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"Signature",
".",
"C_DOT",
",",
"searchedName",
",",
"0",
",",
"index",
"-",
"1",
")",
";",
"if",
"(",
"Character",
".",
"isLowerCase",
"(",
"searchedName",
"[",
"index",
"+",
"1",
"]",
")",
")",
"{",
"return",
"testedName",
";",
"}",
"}",
"}",
"while",
"(",
"index",
">=",
"0",
")",
";",
"return",
"name",
";",
"}",
"private",
"static",
"String",
"getFullName",
"(",
"ImportDeclaration",
"decl",
")",
"{",
"String",
"name",
"=",
"decl",
".",
"getName",
"(",
")",
".",
"getFullyQualifiedName",
"(",
")",
";",
"return",
"decl",
".",
"isOnDemand",
"(",
")",
"?",
"name",
"+",
"\".*\"",
":",
"name",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"addExistingImports",
"(",
"CompilationUnit",
"root",
")",
"{",
"List",
"decls",
"=",
"root",
".",
"imports",
"(",
")",
";",
"if",
"(",
"decls",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"PackageEntry",
"currPackage",
"=",
"null",
";",
"ImportDeclaration",
"curr",
"=",
"(",
"ImportDeclaration",
")",
"decls",
".",
"get",
"(",
"0",
")",
";",
"int",
"currOffset",
"=",
"curr",
".",
"getStartPosition",
"(",
")",
";",
"int",
"currLength",
"=",
"curr",
".",
"getLength",
"(",
")",
";",
"int",
"currEndLine",
"=",
"root",
".",
"getLineNumber",
"(",
"currOffset",
"+",
"currLength",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"decls",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"boolean",
"isStatic",
"=",
"curr",
".",
"isStatic",
"(",
")",
";",
"String",
"name",
"=",
"getFullName",
"(",
"curr",
")",
";",
"String",
"packName",
"=",
"getQualifier",
"(",
"curr",
")",
";",
"if",
"(",
"currPackage",
"==",
"null",
"||",
"currPackage",
".",
"compareTo",
"(",
"packName",
",",
"isStatic",
")",
"!=",
"0",
")",
"{",
"currPackage",
"=",
"new",
"PackageEntry",
"(",
"packName",
",",
"null",
",",
"isStatic",
")",
";",
"this",
".",
"packageEntries",
".",
"add",
"(",
"currPackage",
")",
";",
"}",
"ImportDeclaration",
"next",
"=",
"(",
"ImportDeclaration",
")",
"decls",
".",
"get",
"(",
"i",
")",
";",
"int",
"nextOffset",
"=",
"next",
".",
"getStartPosition",
"(",
")",
";",
"int",
"nextLength",
"=",
"next",
".",
"getLength",
"(",
")",
";",
"int",
"nextOffsetLine",
"=",
"root",
".",
"getLineNumber",
"(",
"nextOffset",
")",
";",
"if",
"(",
"currEndLine",
"<",
"nextOffsetLine",
")",
"{",
"currEndLine",
"++",
";",
"nextOffset",
"=",
"root",
".",
"getPosition",
"(",
"currEndLine",
",",
"0",
")",
";",
"}",
"currPackage",
".",
"add",
"(",
"new",
"ImportDeclEntry",
"(",
"packName",
".",
"length",
"(",
")",
",",
"name",
",",
"isStatic",
",",
"new",
"Region",
"(",
"currOffset",
",",
"nextOffset",
"-",
"currOffset",
")",
")",
")",
";",
"currOffset",
"=",
"nextOffset",
";",
"curr",
"=",
"next",
";",
"if",
"(",
"currEndLine",
"<",
"nextOffsetLine",
")",
"{",
"nextOffset",
"=",
"root",
".",
"getPosition",
"(",
"nextOffsetLine",
",",
"0",
")",
";",
"currPackage",
"=",
"new",
"PackageEntry",
"(",
")",
";",
"this",
".",
"packageEntries",
".",
"add",
"(",
"currPackage",
")",
";",
"currPackage",
".",
"add",
"(",
"new",
"ImportDeclEntry",
"(",
"packName",
".",
"length",
"(",
")",
",",
"null",
",",
"false",
",",
"new",
"Region",
"(",
"currOffset",
",",
"nextOffset",
"-",
"currOffset",
")",
")",
")",
";",
"currOffset",
"=",
"nextOffset",
";",
"}",
"currEndLine",
"=",
"root",
".",
"getLineNumber",
"(",
"nextOffset",
"+",
"nextLength",
")",
";",
"}",
"boolean",
"isStatic",
"=",
"curr",
".",
"isStatic",
"(",
")",
";",
"String",
"name",
"=",
"getFullName",
"(",
"curr",
")",
";",
"String",
"packName",
"=",
"getQualifier",
"(",
"curr",
")",
";",
"if",
"(",
"currPackage",
"==",
"null",
"||",
"currPackage",
".",
"compareTo",
"(",
"packName",
",",
"isStatic",
")",
"!=",
"0",
")",
"{",
"currPackage",
"=",
"new",
"PackageEntry",
"(",
"packName",
",",
"null",
",",
"isStatic",
")",
";",
"this",
".",
"packageEntries",
".",
"add",
"(",
"currPackage",
")",
";",
"}",
"int",
"length",
"=",
"this",
".",
"replaceRange",
".",
"getOffset",
"(",
")",
"+",
"this",
".",
"replaceRange",
".",
"getLength",
"(",
")",
"-",
"curr",
".",
"getStartPosition",
"(",
")",
";",
"currPackage",
".",
"add",
"(",
"new",
"ImportDeclEntry",
"(",
"packName",
".",
"length",
"(",
")",
",",
"name",
",",
"isStatic",
",",
"new",
"Region",
"(",
"curr",
".",
"getStartPosition",
"(",
")",
",",
"length",
")",
")",
")",
";",
"}",
"public",
"void",
"setFilterImplicitImports",
"(",
"boolean",
"filterImplicitImports",
")",
"{",
"this",
".",
"filterImplicitImports",
"=",
"filterImplicitImports",
";",
"}",
"public",
"void",
"setFindAmbiguousImports",
"(",
"boolean",
"findAmbiguousImports",
")",
"{",
"this",
".",
"findAmbiguousImports",
"=",
"findAmbiguousImports",
";",
"}",
"private",
"static",
"class",
"PackageMatcher",
"{",
"private",
"String",
"newName",
";",
"private",
"String",
"bestName",
";",
"private",
"int",
"bestMatchLen",
";",
"public",
"PackageMatcher",
"(",
")",
"{",
"}",
"public",
"void",
"initialize",
"(",
"String",
"newImportName",
",",
"String",
"bestImportName",
")",
"{",
"this",
".",
"newName",
"=",
"newImportName",
";",
"this",
".",
"bestName",
"=",
"bestImportName",
";",
"this",
".",
"bestMatchLen",
"=",
"getCommonPrefixLength",
"(",
"bestImportName",
",",
"newImportName",
")",
";",
"}",
"public",
"boolean",
"isBetterMatch",
"(",
"String",
"currName",
",",
"boolean",
"preferCurr",
")",
"{",
"boolean",
"isBetter",
";",
"int",
"currMatchLen",
"=",
"getCommonPrefixLength",
"(",
"currName",
",",
"this",
".",
"newName",
")",
";",
"int",
"matchDiff",
"=",
"currMatchLen",
"-",
"this",
".",
"bestMatchLen",
";",
"if",
"(",
"matchDiff",
"==",
"0",
")",
"{",
"if",
"(",
"currMatchLen",
"==",
"this",
".",
"newName",
".",
"length",
"(",
")",
"&&",
"currMatchLen",
"==",
"currName",
".",
"length",
"(",
")",
"&&",
"currMatchLen",
"==",
"this",
".",
"bestName",
".",
"length",
"(",
")",
")",
"{",
"isBetter",
"=",
"preferCurr",
";",
"}",
"else",
"{",
"isBetter",
"=",
"sameMatchLenTest",
"(",
"currName",
")",
";",
"}",
"}",
"else",
"{",
"isBetter",
"=",
"(",
"matchDiff",
">",
"0",
")",
";",
"}",
"if",
"(",
"isBetter",
")",
"{",
"this",
".",
"bestName",
"=",
"currName",
";",
"this",
".",
"bestMatchLen",
"=",
"currMatchLen",
";",
"}",
"return",
"isBetter",
";",
"}",
"private",
"boolean",
"sameMatchLenTest",
"(",
"String",
"currName",
")",
"{",
"int",
"matchLen",
"=",
"this",
".",
"bestMatchLen",
";",
"char",
"newChar",
"=",
"getCharAt",
"(",
"this",
".",
"newName",
",",
"matchLen",
")",
";",
"char",
"currChar",
"=",
"getCharAt",
"(",
"currName",
",",
"matchLen",
")",
";",
"char",
"bestChar",
"=",
"getCharAt",
"(",
"this",
".",
"bestName",
",",
"matchLen",
")",
";",
"if",
"(",
"newChar",
"<",
"currChar",
")",
"{",
"if",
"(",
"bestChar",
"<",
"newChar",
")",
"{",
"return",
"(",
"currChar",
"-",
"newChar",
")",
"<",
"(",
"newChar",
"-",
"bestChar",
")",
";",
"}",
"else",
"{",
"if",
"(",
"currChar",
"==",
"bestChar",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"currChar",
"<",
"bestChar",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"bestChar",
">",
"newChar",
")",
"{",
"return",
"(",
"newChar",
"-",
"currChar",
")",
"<",
"(",
"bestChar",
"-",
"newChar",
")",
";",
"}",
"else",
"{",
"if",
"(",
"currChar",
"==",
"bestChar",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"currChar",
">",
"bestChar",
";",
"}",
"}",
"}",
"}",
"}",
"static",
"int",
"getCommonPrefixLength",
"(",
"String",
"s",
",",
"String",
"t",
")",
"{",
"int",
"len",
"=",
"Math",
".",
"min",
"(",
"s",
".",
"length",
"(",
")",
",",
"t",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"s",
".",
"charAt",
"(",
"i",
")",
"!=",
"t",
".",
"charAt",
"(",
"i",
")",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"len",
";",
"}",
"static",
"char",
"getCharAt",
"(",
"String",
"str",
",",
"int",
"index",
")",
"{",
"if",
"(",
"str",
".",
"length",
"(",
")",
">",
"index",
")",
"{",
"return",
"str",
".",
"charAt",
"(",
"index",
")",
";",
"}",
"return",
"0",
";",
"}",
"private",
"PackageEntry",
"findBestMatch",
"(",
"String",
"newName",
",",
"boolean",
"isStatic",
")",
"{",
"if",
"(",
"this",
".",
"packageEntries",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"groupId",
"=",
"null",
";",
"int",
"longestPrefix",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"packageEntries",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"PackageEntry",
"curr",
"=",
"(",
"PackageEntry",
")",
"this",
".",
"packageEntries",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"isStatic",
"==",
"curr",
".",
"isStatic",
"(",
")",
")",
"{",
"String",
"currGroup",
"=",
"curr",
".",
"getGroupID",
"(",
")",
";",
"if",
"(",
"currGroup",
"!=",
"null",
"&&",
"newName",
".",
"startsWith",
"(",
"currGroup",
")",
")",
"{",
"int",
"prefixLen",
"=",
"currGroup",
".",
"length",
"(",
")",
";",
"if",
"(",
"prefixLen",
"==",
"newName",
".",
"length",
"(",
")",
")",
"{",
"return",
"curr",
";",
"}",
"if",
"(",
"(",
"newName",
".",
"charAt",
"(",
"prefixLen",
")",
"==",
"'.'",
"||",
"prefixLen",
"==",
"0",
")",
"&&",
"prefixLen",
">",
"longestPrefix",
")",
"{",
"longestPrefix",
"=",
"prefixLen",
";",
"groupId",
"=",
"currGroup",
";",
"}",
"}",
"}",
"}",
"PackageEntry",
"bestMatch",
"=",
"null",
";",
"PackageMatcher",
"matcher",
"=",
"new",
"PackageMatcher",
"(",
")",
";",
"matcher",
".",
"initialize",
"(",
"newName",
",",
"\"\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"packageEntries",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"PackageEntry",
"curr",
"=",
"(",
"PackageEntry",
")",
"this",
".",
"packageEntries",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"!",
"curr",
".",
"isComment",
"(",
")",
"&&",
"curr",
".",
"isStatic",
"(",
")",
"==",
"isStatic",
")",
"{",
"if",
"(",
"groupId",
"==",
"null",
"||",
"groupId",
".",
"equals",
"(",
"curr",
".",
"getGroupID",
"(",
")",
")",
")",
"{",
"boolean",
"preferrCurr",
"=",
"(",
"bestMatch",
"==",
"null",
")",
"||",
"(",
"curr",
".",
"getNumberOfImports",
"(",
")",
">",
"bestMatch",
".",
"getNumberOfImports",
"(",
")",
")",
";",
"if",
"(",
"matcher",
".",
"isBetterMatch",
"(",
"curr",
".",
"getName",
"(",
")",
",",
"preferrCurr",
")",
")",
"{",
"bestMatch",
"=",
"curr",
";",
"}",
"}",
"}",
"}",
"return",
"bestMatch",
";",
"}",
"private",
"boolean",
"isImplicitImport",
"(",
"String",
"qualifier",
")",
"{",
"if",
"(",
"JAVA_LANG",
".",
"equals",
"(",
"qualifier",
")",
")",
"{",
"return",
"true",
";",
"}",
"ICompilationUnit",
"cu",
"=",
"this",
".",
"compilationUnit",
";",
"String",
"packageName",
"=",
"cu",
".",
"getParent",
"(",
")",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"qualifier",
".",
"equals",
"(",
"packageName",
")",
")",
"{",
"return",
"true",
";",
"}",
"String",
"mainTypeName",
"=",
"JavaCore",
".",
"removeJavaLikeExtension",
"(",
"cu",
".",
"getElementName",
"(",
")",
")",
";",
"if",
"(",
"packageName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"qualifier",
".",
"equals",
"(",
"mainTypeName",
")",
";",
"}",
"return",
"qualifier",
".",
"equals",
"(",
"packageName",
"+",
"'.'",
"+",
"mainTypeName",
")",
";",
"}",
"public",
"void",
"addImport",
"(",
"String",
"fullTypeName",
",",
"boolean",
"isStatic",
")",
"{",
"String",
"typeContainerName",
"=",
"getQualifier",
"(",
"fullTypeName",
",",
"isStatic",
")",
";",
"ImportDeclEntry",
"decl",
"=",
"new",
"ImportDeclEntry",
"(",
"typeContainerName",
".",
"length",
"(",
")",
",",
"fullTypeName",
",",
"isStatic",
",",
"null",
")",
";",
"sortIn",
"(",
"typeContainerName",
",",
"decl",
",",
"isStatic",
")",
";",
"}",
"public",
"boolean",
"removeImport",
"(",
"String",
"qualifiedName",
",",
"boolean",
"isStatic",
")",
"{",
"String",
"containerName",
"=",
"getQualifier",
"(",
"qualifiedName",
",",
"isStatic",
")",
";",
"int",
"nPackages",
"=",
"this",
".",
"packageEntries",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nPackages",
";",
"i",
"++",
")",
"{",
"PackageEntry",
"entry",
"=",
"(",
"PackageEntry",
")",
"this",
".",
"packageEntries",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"entry",
".",
"compareTo",
"(",
"containerName",
",",
"isStatic",
")",
"==",
"0",
")",
"{",
"if",
"(",
"entry",
".",
"remove",
"(",
"qualifiedName",
",",
"isStatic",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"int",
"getIndexAfterStatics",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"packageEntries",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"(",
"(",
"PackageEntry",
")",
"this",
".",
"packageEntries",
".",
"get",
"(",
"i",
")",
")",
".",
"isStatic",
"(",
")",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"this",
".",
"packageEntries",
".",
"size",
"(",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"sortIn",
"(",
"String",
"typeContainerName",
",",
"ImportDeclEntry",
"decl",
",",
"boolean",
"isStatic",
")",
"{",
"PackageEntry",
"bestMatch",
"=",
"findBestMatch",
"(",
"typeContainerName",
",",
"isStatic",
")",
";",
"if",
"(",
"bestMatch",
"==",
"null",
")",
"{",
"PackageEntry",
"packEntry",
"=",
"new",
"PackageEntry",
"(",
"typeContainerName",
",",
"null",
",",
"isStatic",
")",
";",
"packEntry",
".",
"add",
"(",
"decl",
")",
";",
"int",
"insertPos",
"=",
"packEntry",
".",
"isStatic",
"(",
")",
"?",
"0",
":",
"getIndexAfterStatics",
"(",
")",
";",
"this",
".",
"packageEntries",
".",
"add",
"(",
"insertPos",
",",
"packEntry",
")",
";",
"}",
"else",
"{",
"int",
"cmp",
"=",
"typeContainerName",
".",
"compareTo",
"(",
"bestMatch",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"cmp",
"==",
"0",
")",
"{",
"bestMatch",
".",
"sortIn",
"(",
"decl",
")",
";",
"}",
"else",
"{",
"String",
"group",
"=",
"bestMatch",
".",
"getGroupID",
"(",
")",
";",
"if",
"(",
"group",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"typeContainerName",
".",
"startsWith",
"(",
"group",
")",
")",
"{",
"group",
"=",
"null",
";",
"}",
"}",
"PackageEntry",
"packEntry",
"=",
"new",
"PackageEntry",
"(",
"typeContainerName",
",",
"group",
",",
"isStatic",
")",
";",
"packEntry",
".",
"add",
"(",
"decl",
")",
";",
"int",
"index",
"=",
"this",
".",
"packageEntries",
".",
"indexOf",
"(",
"bestMatch",
")",
";",
"if",
"(",
"cmp",
"<",
"0",
")",
"{",
"this",
".",
"packageEntries",
".",
"add",
"(",
"index",
",",
"packEntry",
")",
";",
"}",
"else",
"{",
"this",
".",
"packageEntries",
".",
"add",
"(",
"index",
"+",
"1",
",",
"packEntry",
")",
";",
"}",
"}",
"}",
"}",
"private",
"IRegion",
"evaluateReplaceRange",
"(",
"CompilationUnit",
"root",
")",
"{",
"List",
"imports",
"=",
"root",
".",
"imports",
"(",
")",
";",
"if",
"(",
"!",
"imports",
".",
"isEmpty",
"(",
")",
")",
"{",
"ImportDeclaration",
"first",
"=",
"(",
"ImportDeclaration",
")",
"imports",
".",
"get",
"(",
"0",
")",
";",
"ImportDeclaration",
"last",
"=",
"(",
"ImportDeclaration",
")",
"imports",
".",
"get",
"(",
"imports",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"int",
"startPos",
"=",
"first",
".",
"getStartPosition",
"(",
")",
";",
"int",
"endPos",
"=",
"root",
".",
"getExtendedStartPosition",
"(",
"last",
")",
"+",
"root",
".",
"getExtendedLength",
"(",
"last",
")",
";",
"int",
"endLine",
"=",
"root",
".",
"getLineNumber",
"(",
"endPos",
")",
";",
"if",
"(",
"endLine",
">",
"0",
")",
"{",
"int",
"nextLinePos",
"=",
"root",
".",
"getPosition",
"(",
"endLine",
"+",
"1",
",",
"0",
")",
";",
"if",
"(",
"nextLinePos",
">=",
"0",
")",
"{",
"int",
"firstTypePos",
"=",
"getFirstTypeBeginPos",
"(",
"root",
")",
";",
"if",
"(",
"firstTypePos",
"!=",
"-",
"1",
"&&",
"firstTypePos",
"<",
"nextLinePos",
")",
"{",
"endPos",
"=",
"firstTypePos",
";",
"}",
"else",
"{",
"endPos",
"=",
"nextLinePos",
";",
"}",
"}",
"}",
"return",
"new",
"Region",
"(",
"startPos",
",",
"endPos",
"-",
"startPos",
")",
";",
"}",
"else",
"{",
"int",
"start",
"=",
"getPackageStatementEndPos",
"(",
"root",
")",
";",
"return",
"new",
"Region",
"(",
"start",
",",
"0",
")",
";",
"}",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"MultiTextEdit",
"getResultingEdits",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"monitor",
"==",
"null",
")",
"{",
"monitor",
"=",
"new",
"NullProgressMonitor",
"(",
")",
";",
"}",
"try",
"{",
"int",
"importsStart",
"=",
"this",
".",
"replaceRange",
".",
"getOffset",
"(",
")",
";",
"int",
"importsLen",
"=",
"this",
".",
"replaceRange",
".",
"getLength",
"(",
")",
";",
"String",
"lineDelim",
"=",
"this",
".",
"compilationUnit",
".",
"findRecommendedLineSeparator",
"(",
")",
";",
"IBuffer",
"buffer",
"=",
"this",
".",
"compilationUnit",
".",
"getBuffer",
"(",
")",
";",
"int",
"currPos",
"=",
"importsStart",
";",
"MultiTextEdit",
"resEdit",
"=",
"new",
"MultiTextEdit",
"(",
")",
";",
"if",
"(",
"(",
"this",
".",
"flags",
"&",
"F_NEEDS_LEADING_DELIM",
")",
"!=",
"0",
")",
"{",
"resEdit",
".",
"addChild",
"(",
"new",
"InsertEdit",
"(",
"currPos",
",",
"lineDelim",
")",
")",
";",
"}",
"PackageEntry",
"lastPackage",
"=",
"null",
";",
"Set",
"onDemandConflicts",
"=",
"null",
";",
"if",
"(",
"this",
".",
"findAmbiguousImports",
")",
"{",
"onDemandConflicts",
"=",
"evaluateStarImportConflicts",
"(",
"monitor",
")",
";",
"}",
"int",
"spacesBetweenGroups",
"=",
"getSpacesBetweenImportGroups",
"(",
")",
";",
"ArrayList",
"stringsToInsert",
"=",
"new",
"ArrayList",
"(",
")",
";",
"int",
"nPackageEntries",
"=",
"this",
".",
"packageEntries",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nPackageEntries",
";",
"i",
"++",
")",
"{",
"PackageEntry",
"pack",
"=",
"(",
"PackageEntry",
")",
"this",
".",
"packageEntries",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"this",
".",
"filterImplicitImports",
"&&",
"!",
"pack",
".",
"isStatic",
"(",
")",
"&&",
"isImplicitImport",
"(",
"pack",
".",
"getName",
"(",
")",
")",
")",
"{",
"pack",
".",
"filterImplicitImports",
"(",
"this",
".",
"useContextToFilterImplicitImports",
")",
";",
"}",
"int",
"nImports",
"=",
"pack",
".",
"getNumberOfImports",
"(",
")",
";",
"if",
"(",
"nImports",
"==",
"0",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"spacesBetweenGroups",
">",
"0",
")",
"{",
"if",
"(",
"lastPackage",
"!=",
"null",
"&&",
"!",
"pack",
".",
"isComment",
"(",
")",
"&&",
"!",
"pack",
".",
"isSameGroup",
"(",
"lastPackage",
")",
")",
"{",
"ImportDeclEntry",
"last",
"=",
"lastPackage",
".",
"getImportAt",
"(",
"lastPackage",
".",
"getNumberOfImports",
"(",
")",
"-",
"1",
")",
";",
"ImportDeclEntry",
"first",
"=",
"pack",
".",
"getImportAt",
"(",
"0",
")",
";",
"if",
"(",
"!",
"lastPackage",
".",
"isComment",
"(",
")",
"&&",
"(",
"last",
".",
"isNew",
"(",
")",
"||",
"first",
".",
"isNew",
"(",
")",
")",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"spacesBetweenGroups",
";",
"k",
">",
"0",
";",
"k",
"--",
")",
"{",
"stringsToInsert",
".",
"add",
"(",
"lineDelim",
")",
";",
"}",
"}",
"}",
"}",
"lastPackage",
"=",
"pack",
";",
"boolean",
"isStatic",
"=",
"pack",
".",
"isStatic",
"(",
")",
";",
"int",
"threshold",
"=",
"isStatic",
"?",
"this",
".",
"staticImportOnDemandThreshold",
":",
"this",
".",
"importOnDemandThreshold",
";",
"boolean",
"doStarImport",
"=",
"pack",
".",
"hasStarImport",
"(",
"threshold",
",",
"onDemandConflicts",
")",
";",
"if",
"(",
"doStarImport",
"&&",
"(",
"pack",
".",
"find",
"(",
"\"*\"",
")",
"==",
"null",
")",
")",
"{",
"String",
"[",
"]",
"imports",
"=",
"getNewImportStrings",
"(",
"pack",
",",
"isStatic",
",",
"lineDelim",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"max",
"=",
"imports",
".",
"length",
";",
"j",
"<",
"max",
";",
"j",
"++",
")",
"{",
"stringsToInsert",
".",
"add",
"(",
"imports",
"[",
"j",
"]",
")",
";",
"}",
"}",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"nImports",
";",
"k",
"++",
")",
"{",
"ImportDeclEntry",
"currDecl",
"=",
"pack",
".",
"getImportAt",
"(",
"k",
")",
";",
"IRegion",
"region",
"=",
"currDecl",
".",
"getSourceRange",
"(",
")",
";",
"if",
"(",
"region",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"doStarImport",
"||",
"currDecl",
".",
"isOnDemand",
"(",
")",
"||",
"(",
"onDemandConflicts",
"!=",
"null",
"&&",
"onDemandConflicts",
".",
"contains",
"(",
"currDecl",
".",
"getSimpleName",
"(",
")",
")",
")",
")",
"{",
"String",
"str",
"=",
"getNewImportString",
"(",
"currDecl",
".",
"getElementName",
"(",
")",
",",
"isStatic",
",",
"lineDelim",
")",
";",
"stringsToInsert",
".",
"add",
"(",
"str",
")",
";",
"}",
"else",
"if",
"(",
"doStarImport",
"&&",
"!",
"currDecl",
".",
"isOnDemand",
"(",
")",
")",
"{",
"String",
"simpleName",
"=",
"currDecl",
".",
"getTypeQualifiedName",
"(",
")",
";",
"if",
"(",
"simpleName",
".",
"indexOf",
"(",
"'.'",
")",
"!=",
"-",
"1",
")",
"{",
"String",
"str",
"=",
"getNewImportString",
"(",
"currDecl",
".",
"getElementName",
"(",
")",
",",
"isStatic",
",",
"lineDelim",
")",
";",
"if",
"(",
"stringsToInsert",
".",
"indexOf",
"(",
"str",
")",
"==",
"-",
"1",
")",
"{",
"stringsToInsert",
".",
"add",
"(",
"str",
")",
";",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"!",
"doStarImport",
"||",
"currDecl",
".",
"isOnDemand",
"(",
")",
"||",
"onDemandConflicts",
"==",
"null",
"||",
"onDemandConflicts",
".",
"contains",
"(",
"currDecl",
".",
"getSimpleName",
"(",
")",
")",
")",
"{",
"int",
"offset",
"=",
"region",
".",
"getOffset",
"(",
")",
";",
"removeAndInsertNew",
"(",
"buffer",
",",
"currPos",
",",
"offset",
",",
"stringsToInsert",
",",
"resEdit",
")",
";",
"stringsToInsert",
".",
"clear",
"(",
")",
";",
"currPos",
"=",
"offset",
"+",
"region",
".",
"getLength",
"(",
")",
";",
"}",
"else",
"if",
"(",
"doStarImport",
"&&",
"!",
"currDecl",
".",
"isOnDemand",
"(",
")",
")",
"{",
"String",
"simpleName",
"=",
"currDecl",
".",
"getTypeQualifiedName",
"(",
")",
";",
"if",
"(",
"simpleName",
".",
"indexOf",
"(",
"'.'",
")",
"!=",
"-",
"1",
")",
"{",
"String",
"str",
"=",
"getNewImportString",
"(",
"currDecl",
".",
"getElementName",
"(",
")",
",",
"isStatic",
",",
"lineDelim",
")",
";",
"if",
"(",
"stringsToInsert",
".",
"indexOf",
"(",
"str",
")",
"==",
"-",
"1",
")",
"{",
"stringsToInsert",
".",
"add",
"(",
"str",
")",
";",
"}",
"}",
"}",
"}",
"}",
"int",
"end",
"=",
"importsStart",
"+",
"importsLen",
";",
"removeAndInsertNew",
"(",
"buffer",
",",
"currPos",
",",
"end",
",",
"stringsToInsert",
",",
"resEdit",
")",
";",
"if",
"(",
"importsLen",
"==",
"0",
")",
"{",
"if",
"(",
"!",
"this",
".",
"importsCreated",
".",
"isEmpty",
"(",
")",
"||",
"!",
"this",
".",
"staticImportsCreated",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"(",
"this",
".",
"flags",
"&",
"F_NEEDS_TRAILING_DELIM",
")",
"!=",
"0",
")",
"{",
"resEdit",
".",
"addChild",
"(",
"new",
"InsertEdit",
"(",
"currPos",
",",
"lineDelim",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"new",
"MultiTextEdit",
"(",
")",
";",
"}",
"}",
"return",
"resEdit",
";",
"}",
"finally",
"{",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"private",
"void",
"removeAndInsertNew",
"(",
"IBuffer",
"buffer",
",",
"int",
"contentOffset",
",",
"int",
"contentEnd",
",",
"ArrayList",
"stringsToInsert",
",",
"MultiTextEdit",
"resEdit",
")",
"{",
"int",
"pos",
"=",
"contentOffset",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"stringsToInsert",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"curr",
"=",
"(",
"String",
")",
"stringsToInsert",
".",
"get",
"(",
"i",
")",
";",
"int",
"idx",
"=",
"findInBuffer",
"(",
"buffer",
",",
"curr",
",",
"pos",
",",
"contentEnd",
")",
";",
"if",
"(",
"idx",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"idx",
"!=",
"pos",
")",
"{",
"resEdit",
".",
"addChild",
"(",
"new",
"DeleteEdit",
"(",
"pos",
",",
"idx",
"-",
"pos",
")",
")",
";",
"}",
"pos",
"=",
"idx",
"+",
"curr",
".",
"length",
"(",
")",
";",
"}",
"else",
"{",
"resEdit",
".",
"addChild",
"(",
"new",
"InsertEdit",
"(",
"pos",
",",
"curr",
")",
")",
";",
"}",
"}",
"if",
"(",
"pos",
"<",
"contentEnd",
")",
"{",
"resEdit",
".",
"addChild",
"(",
"new",
"DeleteEdit",
"(",
"pos",
",",
"contentEnd",
"-",
"pos",
")",
")",
";",
"}",
"}",
"private",
"int",
"findInBuffer",
"(",
"IBuffer",
"buffer",
",",
"String",
"str",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"if",
"(",
"pos",
"+",
"len",
">",
"end",
"||",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"-",
"1",
";",
"}",
"char",
"first",
"=",
"str",
".",
"charAt",
"(",
"0",
")",
";",
"int",
"step",
"=",
"str",
".",
"indexOf",
"(",
"first",
",",
"1",
")",
";",
"if",
"(",
"step",
"==",
"-",
"1",
")",
"{",
"step",
"=",
"len",
";",
"}",
"while",
"(",
"pos",
"+",
"len",
"<=",
"end",
")",
"{",
"if",
"(",
"buffer",
".",
"getChar",
"(",
"pos",
")",
"==",
"first",
")",
"{",
"int",
"k",
"=",
"1",
";",
"while",
"(",
"k",
"<",
"len",
"&&",
"buffer",
".",
"getChar",
"(",
"pos",
"+",
"k",
")",
"==",
"str",
".",
"charAt",
"(",
"k",
")",
")",
"{",
"k",
"++",
";",
"}",
"if",
"(",
"k",
"==",
"len",
")",
"{",
"return",
"pos",
";",
"}",
"if",
"(",
"k",
"<",
"step",
")",
"{",
"pos",
"+=",
"k",
";",
"}",
"else",
"{",
"pos",
"+=",
"step",
";",
"}",
"}",
"else",
"{",
"pos",
"++",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Set",
"evaluateStarImportConflicts",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"final",
"HashSet",
"onDemandConflicts",
"=",
"new",
"HashSet",
"(",
")",
";",
"IJavaSearchScope",
"scope",
"=",
"SearchEngine",
".",
"createJavaSearchScope",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
".",
"compilationUnit",
".",
"getJavaProject",
"(",
")",
"}",
")",
";",
"ArrayList",
"starImportPackages",
"=",
"new",
"ArrayList",
"(",
")",
";",
"ArrayList",
"simpleTypeNames",
"=",
"new",
"ArrayList",
"(",
")",
";",
"int",
"nPackageEntries",
"=",
"this",
".",
"packageEntries",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nPackageEntries",
";",
"i",
"++",
")",
"{",
"PackageEntry",
"pack",
"=",
"(",
"PackageEntry",
")",
"this",
".",
"packageEntries",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"!",
"pack",
".",
"isStatic",
"(",
")",
"&&",
"pack",
".",
"hasStarImport",
"(",
"this",
".",
"importOnDemandThreshold",
",",
"null",
")",
")",
"{",
"starImportPackages",
".",
"add",
"(",
"pack",
".",
"getName",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"pack",
".",
"getNumberOfImports",
"(",
")",
";",
"k",
"++",
")",
"{",
"ImportDeclEntry",
"curr",
"=",
"pack",
".",
"getImportAt",
"(",
"k",
")",
";",
"if",
"(",
"!",
"curr",
".",
"isOnDemand",
"(",
")",
"&&",
"!",
"curr",
".",
"isComment",
"(",
")",
")",
"{",
"simpleTypeNames",
".",
"add",
"(",
"curr",
".",
"getSimpleName",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"starImportPackages",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"starImportPackages",
".",
"add",
"(",
"this",
".",
"compilationUnit",
".",
"getParent",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"starImportPackages",
".",
"add",
"(",
"JAVA_LANG",
".",
"toCharArray",
"(",
")",
")",
";",
"char",
"[",
"]",
"[",
"]",
"allPackages",
"=",
"(",
"char",
"[",
"]",
"[",
"]",
")",
"starImportPackages",
".",
"toArray",
"(",
"new",
"char",
"[",
"starImportPackages",
".",
"size",
"(",
")",
"]",
"[",
"]",
")",
";",
"char",
"[",
"]",
"[",
"]",
"allTypes",
"=",
"(",
"char",
"[",
"]",
"[",
"]",
")",
"simpleTypeNames",
".",
"toArray",
"(",
"new",
"char",
"[",
"simpleTypeNames",
".",
"size",
"(",
")",
"]",
"[",
"]",
")",
";",
"TypeNameRequestor",
"requestor",
"=",
"new",
"TypeNameRequestor",
"(",
")",
"{",
"HashMap",
"foundTypes",
"=",
"new",
"HashMap",
"(",
")",
";",
"private",
"String",
"getTypeContainerName",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"[",
"]",
"enclosingTypeNames",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"packageName",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"enclosingTypeNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"buf",
".",
"length",
"(",
")",
">",
"0",
")",
"buf",
".",
"append",
"(",
"'.'",
")",
";",
"buf",
".",
"append",
"(",
"enclosingTypeNames",
"[",
"i",
"]",
")",
";",
"}",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"acceptType",
"(",
"int",
"modifiers",
",",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"simpleTypeName",
",",
"char",
"[",
"]",
"[",
"]",
"enclosingTypeNames",
",",
"String",
"path",
")",
"{",
"String",
"name",
"=",
"new",
"String",
"(",
"simpleTypeName",
")",
";",
"String",
"containerName",
"=",
"getTypeContainerName",
"(",
"packageName",
",",
"enclosingTypeNames",
")",
";",
"String",
"oldContainer",
"=",
"(",
"String",
")",
"this",
".",
"foundTypes",
".",
"put",
"(",
"name",
",",
"containerName",
")",
";",
"if",
"(",
"oldContainer",
"!=",
"null",
"&&",
"!",
"oldContainer",
".",
"equals",
"(",
"containerName",
")",
")",
"{",
"onDemandConflicts",
".",
"add",
"(",
"name",
")",
";",
"}",
"}",
"}",
";",
"new",
"SearchEngine",
"(",
")",
".",
"searchAllTypeNames",
"(",
"allPackages",
",",
"allTypes",
",",
"scope",
",",
"requestor",
",",
"IJavaSearchConstants",
".",
"WAIT_UNTIL_READY_TO_SEARCH",
",",
"monitor",
")",
";",
"return",
"onDemandConflicts",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"String",
"getNewImportString",
"(",
"String",
"importName",
",",
"boolean",
"isStatic",
",",
"String",
"lineDelim",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"import",
"\"",
")",
";",
"if",
"(",
"isStatic",
")",
"{",
"buf",
".",
"append",
"(",
"\"static",
"\"",
")",
";",
"}",
"buf",
".",
"append",
"(",
"importName",
")",
";",
"buf",
".",
"append",
"(",
"lineDelim",
")",
";",
"if",
"(",
"isStatic",
")",
"{",
"this",
".",
"staticImportsCreated",
".",
"add",
"(",
"importName",
")",
";",
"}",
"else",
"{",
"this",
".",
"importsCreated",
".",
"add",
"(",
"importName",
")",
";",
"}",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"String",
"[",
"]",
"getNewImportStrings",
"(",
"PackageEntry",
"packageEntry",
",",
"boolean",
"isStatic",
",",
"String",
"lineDelim",
")",
"{",
"boolean",
"isStarImportAdded",
"=",
"false",
";",
"List",
"allImports",
"=",
"new",
"ArrayList",
"(",
")",
";",
"int",
"nImports",
"=",
"packageEntry",
".",
"getNumberOfImports",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nImports",
";",
"i",
"++",
")",
"{",
"ImportDeclEntry",
"curr",
"=",
"packageEntry",
".",
"getImportAt",
"(",
"i",
")",
";",
"String",
"simpleName",
"=",
"curr",
".",
"getTypeQualifiedName",
"(",
")",
";",
"if",
"(",
"simpleName",
".",
"indexOf",
"(",
"'.'",
")",
"!=",
"-",
"1",
")",
"{",
"allImports",
".",
"add",
"(",
"getNewImportString",
"(",
"curr",
".",
"getElementName",
"(",
")",
",",
"isStatic",
",",
"lineDelim",
")",
")",
";",
"}",
"else",
"if",
"(",
"!",
"isStarImportAdded",
")",
"{",
"String",
"starImportString",
"=",
"packageEntry",
".",
"getName",
"(",
")",
"+",
"\".*\"",
";",
"allImports",
".",
"add",
"(",
"getNewImportString",
"(",
"starImportString",
",",
"isStatic",
",",
"lineDelim",
")",
")",
";",
"isStarImportAdded",
"=",
"true",
";",
"}",
"}",
"return",
"(",
"String",
"[",
"]",
")",
"allImports",
".",
"toArray",
"(",
"new",
"String",
"[",
"allImports",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"private",
"static",
"int",
"getFirstTypeBeginPos",
"(",
"CompilationUnit",
"root",
")",
"{",
"List",
"types",
"=",
"root",
".",
"types",
"(",
")",
";",
"if",
"(",
"!",
"types",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"root",
".",
"getExtendedStartPosition",
"(",
"(",
"(",
"ASTNode",
")",
"types",
".",
"get",
"(",
"0",
")",
")",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"private",
"int",
"getPackageStatementEndPos",
"(",
"CompilationUnit",
"root",
")",
"{",
"PackageDeclaration",
"packDecl",
"=",
"root",
".",
"getPackage",
"(",
")",
";",
"if",
"(",
"packDecl",
"!=",
"null",
")",
"{",
"int",
"afterPackageStatementPos",
"=",
"-",
"1",
";",
"int",
"lineNumber",
"=",
"root",
".",
"getLineNumber",
"(",
"packDecl",
".",
"getStartPosition",
"(",
")",
"+",
"packDecl",
".",
"getLength",
"(",
")",
")",
";",
"if",
"(",
"lineNumber",
">=",
"0",
")",
"{",
"int",
"lineAfterPackage",
"=",
"lineNumber",
"+",
"1",
";",
"afterPackageStatementPos",
"=",
"root",
".",
"getPosition",
"(",
"lineAfterPackage",
",",
"0",
")",
";",
"}",
"if",
"(",
"afterPackageStatementPos",
"<",
"0",
")",
"{",
"this",
".",
"flags",
"|=",
"F_NEEDS_LEADING_DELIM",
";",
"return",
"packDecl",
".",
"getStartPosition",
"(",
")",
"+",
"packDecl",
".",
"getLength",
"(",
")",
";",
"}",
"int",
"firstTypePos",
"=",
"getFirstTypeBeginPos",
"(",
"root",
")",
";",
"if",
"(",
"firstTypePos",
"!=",
"-",
"1",
"&&",
"firstTypePos",
"<=",
"afterPackageStatementPos",
")",
"{",
"this",
".",
"flags",
"|=",
"F_NEEDS_TRAILING_DELIM",
";",
"if",
"(",
"firstTypePos",
"==",
"afterPackageStatementPos",
")",
"{",
"this",
".",
"flags",
"|=",
"F_NEEDS_LEADING_DELIM",
";",
"}",
"return",
"firstTypePos",
";",
"}",
"this",
".",
"flags",
"|=",
"F_NEEDS_LEADING_DELIM",
";",
"return",
"afterPackageStatementPos",
";",
"}",
"this",
".",
"flags",
"|=",
"F_NEEDS_TRAILING_DELIM",
";",
"return",
"0",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"int",
"nPackages",
"=",
"this",
".",
"packageEntries",
".",
"size",
"(",
")",
";",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"\"\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nPackages",
";",
"i",
"++",
")",
"{",
"PackageEntry",
"entry",
"=",
"(",
"PackageEntry",
")",
"this",
".",
"packageEntries",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"entry",
".",
"isStatic",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"static",
"\"",
")",
";",
"}",
"buf",
".",
"append",
"(",
"entry",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}",
"private",
"static",
"final",
"class",
"ImportDeclEntry",
"{",
"private",
"String",
"elementName",
";",
"private",
"IRegion",
"sourceRange",
";",
"private",
"final",
"boolean",
"isStatic",
";",
"private",
"int",
"containerNameLength",
";",
"public",
"ImportDeclEntry",
"(",
"int",
"containerNameLength",
",",
"String",
"elementName",
",",
"boolean",
"isStatic",
",",
"IRegion",
"sourceRange",
")",
"{",
"this",
".",
"elementName",
"=",
"elementName",
";",
"this",
".",
"sourceRange",
"=",
"sourceRange",
";",
"this",
".",
"isStatic",
"=",
"isStatic",
";",
"this",
".",
"containerNameLength",
"=",
"containerNameLength",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"elementName",
";",
"}",
"public",
"int",
"compareTo",
"(",
"String",
"fullName",
",",
"boolean",
"isStaticImport",
")",
"{",
"int",
"cmp",
"=",
"this",
".",
"elementName",
".",
"compareTo",
"(",
"fullName",
")",
";",
"if",
"(",
"cmp",
"==",
"0",
")",
"{",
"if",
"(",
"this",
".",
"isStatic",
"==",
"isStaticImport",
")",
"{",
"return",
"0",
";",
"}",
"return",
"this",
".",
"isStatic",
"?",
"-",
"1",
":",
"1",
";",
"}",
"return",
"cmp",
";",
"}",
"public",
"String",
"getSimpleName",
"(",
")",
"{",
"return",
"Signature",
".",
"getSimpleName",
"(",
"this",
".",
"elementName",
")",
";",
"}",
"public",
"String",
"getTypeQualifiedName",
"(",
")",
"{",
"return",
"this",
".",
"elementName",
".",
"substring",
"(",
"this",
".",
"containerNameLength",
"+",
"1",
")",
";",
"}",
"public",
"boolean",
"isOnDemand",
"(",
")",
"{",
"return",
"this",
".",
"elementName",
"!=",
"null",
"&&",
"this",
".",
"elementName",
".",
"endsWith",
"(",
"\".*\"",
")",
";",
"}",
"public",
"boolean",
"isStatic",
"(",
")",
"{",
"return",
"this",
".",
"isStatic",
";",
"}",
"public",
"boolean",
"isNew",
"(",
")",
"{",
"return",
"this",
".",
"sourceRange",
"==",
"null",
";",
"}",
"public",
"boolean",
"isComment",
"(",
")",
"{",
"return",
"this",
".",
"elementName",
"==",
"null",
";",
"}",
"public",
"IRegion",
"getSourceRange",
"(",
")",
"{",
"return",
"this",
".",
"sourceRange",
";",
"}",
"}",
"private",
"final",
"static",
"class",
"PackageEntry",
"{",
"private",
"String",
"name",
";",
"private",
"ArrayList",
"importEntries",
";",
"private",
"String",
"group",
";",
"private",
"boolean",
"isStatic",
";",
"public",
"PackageEntry",
"(",
")",
"{",
"this",
"(",
"\"!\"",
",",
"null",
",",
"false",
")",
";",
"}",
"public",
"PackageEntry",
"(",
"String",
"name",
",",
"String",
"group",
",",
"boolean",
"isStatic",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"importEntries",
"=",
"new",
"ArrayList",
"(",
"5",
")",
";",
"this",
".",
"group",
"=",
"group",
";",
"this",
".",
"isStatic",
"=",
"isStatic",
";",
"}",
"public",
"boolean",
"isStatic",
"(",
")",
"{",
"return",
"this",
".",
"isStatic",
";",
"}",
"public",
"int",
"compareTo",
"(",
"String",
"otherName",
",",
"boolean",
"isOtherStatic",
")",
"{",
"int",
"cmp",
"=",
"this",
".",
"name",
".",
"compareTo",
"(",
"otherName",
")",
";",
"if",
"(",
"cmp",
"==",
"0",
")",
"{",
"if",
"(",
"this",
".",
"isStatic",
"==",
"isOtherStatic",
")",
"{",
"return",
"0",
";",
"}",
"return",
"this",
".",
"isStatic",
"?",
"-",
"1",
":",
"1",
";",
"}",
"return",
"cmp",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"sortIn",
"(",
"ImportDeclEntry",
"imp",
")",
"{",
"String",
"fullImportName",
"=",
"imp",
".",
"getElementName",
"(",
")",
";",
"int",
"insertPosition",
"=",
"-",
"1",
";",
"int",
"nInports",
"=",
"this",
".",
"importEntries",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nInports",
";",
"i",
"++",
")",
"{",
"ImportDeclEntry",
"curr",
"=",
"getImportAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"curr",
".",
"isComment",
"(",
")",
")",
"{",
"int",
"cmp",
"=",
"curr",
".",
"compareTo",
"(",
"fullImportName",
",",
"imp",
".",
"isStatic",
"(",
")",
")",
";",
"if",
"(",
"cmp",
"==",
"0",
")",
"{",
"return",
";",
"}",
"else",
"if",
"(",
"cmp",
">",
"0",
"&&",
"insertPosition",
"==",
"-",
"1",
")",
"{",
"insertPosition",
"=",
"i",
";",
"}",
"}",
"}",
"if",
"(",
"insertPosition",
"==",
"-",
"1",
")",
"{",
"this",
".",
"importEntries",
".",
"add",
"(",
"imp",
")",
";",
"}",
"else",
"{",
"this",
".",
"importEntries",
".",
"add",
"(",
"insertPosition",
",",
"imp",
")",
";",
"}",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"add",
"(",
"ImportDeclEntry",
"imp",
")",
"{",
"this",
".",
"importEntries",
".",
"add",
"(",
"imp",
")",
";",
"}",
"public",
"ImportDeclEntry",
"find",
"(",
"String",
"simpleName",
")",
"{",
"int",
"nInports",
"=",
"this",
".",
"importEntries",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nInports",
";",
"i",
"++",
")",
"{",
"ImportDeclEntry",
"curr",
"=",
"getImportAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"curr",
".",
"isComment",
"(",
")",
")",
"{",
"String",
"currName",
"=",
"curr",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"currName",
".",
"endsWith",
"(",
"simpleName",
")",
")",
"{",
"int",
"dotPos",
"=",
"currName",
".",
"length",
"(",
")",
"-",
"simpleName",
".",
"length",
"(",
")",
"-",
"1",
";",
"if",
"(",
"(",
"dotPos",
"==",
"-",
"1",
")",
"||",
"(",
"dotPos",
">",
"0",
"&&",
"currName",
".",
"charAt",
"(",
"dotPos",
")",
"==",
"'.'",
")",
")",
"{",
"return",
"curr",
";",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"boolean",
"remove",
"(",
"String",
"fullName",
",",
"boolean",
"isStaticImport",
")",
"{",
"int",
"nInports",
"=",
"this",
".",
"importEntries",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nInports",
";",
"i",
"++",
")",
"{",
"ImportDeclEntry",
"curr",
"=",
"getImportAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"curr",
".",
"isComment",
"(",
")",
"&&",
"curr",
".",
"compareTo",
"(",
"fullName",
",",
"isStaticImport",
")",
"==",
"0",
")",
"{",
"this",
".",
"importEntries",
".",
"remove",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"void",
"filterImplicitImports",
"(",
"boolean",
"useContextToFilterImplicitImports",
")",
"{",
"int",
"nInports",
"=",
"this",
".",
"importEntries",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"nInports",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"ImportDeclEntry",
"curr",
"=",
"getImportAt",
"(",
"i",
")",
";",
"if",
"(",
"curr",
".",
"isNew",
"(",
")",
")",
"{",
"if",
"(",
"!",
"useContextToFilterImplicitImports",
")",
"{",
"this",
".",
"importEntries",
".",
"remove",
"(",
"i",
")",
";",
"}",
"else",
"{",
"String",
"elementName",
"=",
"curr",
".",
"getElementName",
"(",
")",
";",
"int",
"lastIndexOf",
"=",
"elementName",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"boolean",
"internalClassImport",
"=",
"lastIndexOf",
">",
"getName",
"(",
")",
".",
"length",
"(",
")",
";",
"if",
"(",
"!",
"internalClassImport",
")",
"{",
"this",
".",
"importEntries",
".",
"remove",
"(",
"i",
")",
";",
"}",
"}",
"}",
"}",
"}",
"public",
"ImportDeclEntry",
"getImportAt",
"(",
"int",
"index",
")",
"{",
"return",
"(",
"ImportDeclEntry",
")",
"this",
".",
"importEntries",
".",
"get",
"(",
"index",
")",
";",
"}",
"public",
"boolean",
"hasStarImport",
"(",
"int",
"threshold",
",",
"Set",
"explicitImports",
")",
"{",
"if",
"(",
"isComment",
"(",
")",
"||",
"isDefaultPackage",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"int",
"nImports",
"=",
"getNumberOfImports",
"(",
")",
";",
"int",
"count",
"=",
"0",
";",
"boolean",
"containsNew",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nImports",
";",
"i",
"++",
")",
"{",
"ImportDeclEntry",
"curr",
"=",
"getImportAt",
"(",
"i",
")",
";",
"if",
"(",
"curr",
".",
"isOnDemand",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"curr",
".",
"isComment",
"(",
")",
")",
"{",
"count",
"++",
";",
"boolean",
"isExplicit",
"=",
"!",
"curr",
".",
"isStatic",
"(",
")",
"&&",
"(",
"explicitImports",
"!=",
"null",
")",
"&&",
"explicitImports",
".",
"contains",
"(",
"curr",
".",
"getSimpleName",
"(",
")",
")",
";",
"containsNew",
"|=",
"curr",
".",
"isNew",
"(",
")",
"&&",
"!",
"isExplicit",
";",
"}",
"}",
"return",
"(",
"count",
">=",
"threshold",
")",
"&&",
"containsNew",
";",
"}",
"public",
"int",
"getNumberOfImports",
"(",
")",
"{",
"return",
"this",
".",
"importEntries",
".",
"size",
"(",
")",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"public",
"String",
"getGroupID",
"(",
")",
"{",
"return",
"this",
".",
"group",
";",
"}",
"public",
"void",
"setGroupID",
"(",
"String",
"groupID",
")",
"{",
"this",
".",
"group",
"=",
"groupID",
";",
"}",
"public",
"boolean",
"isSameGroup",
"(",
"PackageEntry",
"other",
")",
"{",
"if",
"(",
"this",
".",
"group",
"==",
"null",
")",
"{",
"return",
"other",
".",
"getGroupID",
"(",
")",
"==",
"null",
";",
"}",
"else",
"{",
"return",
"this",
".",
"group",
".",
"equals",
"(",
"other",
".",
"getGroupID",
"(",
")",
")",
"&&",
"(",
"this",
".",
"isStatic",
"==",
"other",
".",
"isStatic",
"(",
")",
")",
";",
"}",
"}",
"public",
"boolean",
"isComment",
"(",
")",
"{",
"return",
"\"!\"",
".",
"equals",
"(",
"this",
".",
"name",
")",
";",
"}",
"public",
"boolean",
"isDefaultPackage",
"(",
")",
"{",
"return",
"this",
".",
"name",
".",
"length",
"(",
")",
"==",
"0",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"isComment",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"commentn\"",
")",
";",
"}",
"else",
"{",
"buf",
".",
"append",
"(",
"this",
".",
"name",
")",
";",
"buf",
".",
"append",
"(",
"\",",
"groupId:",
"\"",
")",
";",
"buf",
".",
"append",
"(",
"this",
".",
"group",
")",
";",
"buf",
".",
"append",
"(",
"\"n\"",
")",
";",
"int",
"nImports",
"=",
"getNumberOfImports",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nImports",
";",
"i",
"++",
")",
"{",
"ImportDeclEntry",
"curr",
"=",
"getImportAt",
"(",
"i",
")",
";",
"buf",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"curr",
".",
"isStatic",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"static",
"\"",
")",
";",
"}",
"buf",
".",
"append",
"(",
"curr",
".",
"getTypeQualifiedName",
"(",
")",
")",
";",
"if",
"(",
"curr",
".",
"isNew",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"",
"(new)\"",
")",
";",
"}",
"buf",
".",
"append",
"(",
"\"n\"",
")",
";",
"}",
"}",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"String",
"[",
"]",
"getCreatedImports",
"(",
")",
"{",
"return",
"(",
"String",
"[",
"]",
")",
"this",
".",
"importsCreated",
".",
"toArray",
"(",
"new",
"String",
"[",
"this",
".",
"importsCreated",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"String",
"[",
"]",
"getCreatedStaticImports",
"(",
")",
"{",
"return",
"(",
"String",
"[",
"]",
")",
"this",
".",
"staticImportsCreated",
".",
"toArray",
"(",
"new",
"String",
"[",
"this",
".",
"staticImportsCreated",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"}",
"</s>"
] |
6,262 | [
"<s>",
"package",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"wizards",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"junit",
".",
"wizards",
".",
"NewTestCaseWizardPageOne",
";",
"import",
"java",
".",
"lang",
".",
"reflect",
".",
"InvocationTargetException",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"SubProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"JUnitCorePlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"ui",
".",
"JUnitPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"wizards",
".",
"JUnitWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"wizards",
".",
"WizardMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"junit",
".",
"wizards",
".",
"NewTestCaseWizardPageTwo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"ClasspathFixProcessor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"text",
".",
"java",
".",
"ClasspathFixProcessor",
".",
"ClasspathFixProposal",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"IDialogConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"operation",
".",
"IRunnableWithProgress",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ArrayContentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"DoubleClickEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IDoubleClickListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"LabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"StructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"TableViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ViewerComparator",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"Change",
";",
"import",
"org",
".",
"eclipse",
".",
"ltk",
".",
"core",
".",
"refactoring",
".",
"PerformChangeOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Control",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"PreferencesUtil",
";",
"public",
"class",
"NewTestCaseCreationWizard",
"extends",
"JUnitWizard",
"{",
"private",
"NewTestCaseWizardPageOne",
"fPage1",
";",
"private",
"NewTestCaseWizardPageTwo",
"fPage2",
";",
"public",
"NewTestCaseCreationWizard",
"(",
")",
"{",
"super",
"(",
")",
";",
"setWindowTitle",
"(",
"WizardMessages",
".",
"Wizard_title_new_testcase",
")",
";",
"initDialogSettings",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"initializeDefaultPageImageDescriptor",
"(",
")",
"{",
"setDefaultPageImageDescriptor",
"(",
"JUnitPlugin",
".",
"getImageDescriptor",
"(",
"\"\"",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"addPages",
"(",
")",
"{",
"super",
".",
"addPages",
"(",
")",
";",
"fPage2",
"=",
"new",
"NewTestCaseWizardPageTwo",
"(",
")",
";",
"fPage1",
"=",
"new",
"NewTestCaseWizardPageOne",
"(",
"fPage2",
")",
";",
"addPage",
"(",
"fPage1",
")",
";",
"fPage1",
".",
"init",
"(",
"getSelection",
"(",
")",
")",
";",
"addPage",
"(",
"fPage2",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"performFinish",
"(",
")",
"{",
"IJavaProject",
"project",
"=",
"fPage1",
".",
"getJavaProject",
"(",
")",
";",
"IRunnableWithProgress",
"runnable",
"=",
"fPage1",
".",
"getRunnable",
"(",
")",
";",
"try",
"{",
"if",
"(",
"fPage1",
".",
"isJUnit4",
"(",
")",
")",
"{",
"if",
"(",
"project",
".",
"findType",
"(",
"JUnitCorePlugin",
".",
"JUNIT4_ANNOTATION_NAME",
")",
"==",
"null",
")",
"{",
"runnable",
"=",
"addJUnitToClasspath",
"(",
"project",
",",
"runnable",
",",
"true",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"project",
".",
"findType",
"(",
"JUnitCorePlugin",
".",
"TEST_SUPERCLASS_NAME",
")",
"==",
"null",
")",
"{",
"runnable",
"=",
"addJUnitToClasspath",
"(",
"project",
",",
"runnable",
",",
"false",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"catch",
"(",
"OperationCanceledException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"finishPage",
"(",
"runnable",
")",
")",
"{",
"IType",
"newClass",
"=",
"fPage1",
".",
"getCreatedType",
"(",
")",
";",
"IResource",
"resource",
"=",
"newClass",
".",
"getCompilationUnit",
"(",
")",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"selectAndReveal",
"(",
"resource",
")",
";",
"openResource",
"(",
"resource",
")",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"private",
"IRunnableWithProgress",
"addJUnitToClasspath",
"(",
"IJavaProject",
"project",
",",
"final",
"IRunnableWithProgress",
"runnable",
",",
"boolean",
"isJUnit4",
")",
"{",
"String",
"typeToLookup",
"=",
"isJUnit4",
"?",
"\"org.junit.*\"",
":",
"\"\"",
";",
"ClasspathFixProposal",
"[",
"]",
"fixProposals",
"=",
"ClasspathFixProcessor",
".",
"getContributedFixImportProposals",
"(",
"project",
",",
"typeToLookup",
",",
"null",
")",
";",
"ClasspathFixSelectionDialog",
"dialog",
"=",
"new",
"ClasspathFixSelectionDialog",
"(",
"getShell",
"(",
")",
",",
"isJUnit4",
",",
"project",
",",
"fixProposals",
")",
";",
"if",
"(",
"dialog",
".",
"open",
"(",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"}",
"final",
"ClasspathFixProposal",
"fix",
"=",
"dialog",
".",
"getSelectedClasspathFix",
"(",
")",
";",
"if",
"(",
"fix",
"!=",
"null",
")",
"{",
"return",
"new",
"IRunnableWithProgress",
"(",
")",
"{",
"public",
"void",
"run",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"InvocationTargetException",
",",
"InterruptedException",
"{",
"if",
"(",
"monitor",
"==",
"null",
")",
"{",
"monitor",
"=",
"new",
"NullProgressMonitor",
"(",
")",
";",
"}",
"monitor",
".",
"beginTask",
"(",
"WizardMessages",
".",
"NewTestCaseCreationWizard_create_progress",
",",
"4",
")",
";",
"try",
"{",
"Change",
"change",
"=",
"fix",
".",
"createChange",
"(",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"new",
"PerformChangeOperation",
"(",
"change",
")",
".",
"run",
"(",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"runnable",
".",
"run",
"(",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"2",
")",
")",
";",
"}",
"catch",
"(",
"OperationCanceledException",
"e",
")",
"{",
"throw",
"new",
"InterruptedException",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"InvocationTargetException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"}",
";",
"}",
"return",
"runnable",
";",
"}",
"private",
"static",
"class",
"ClasspathFixSelectionDialog",
"extends",
"MessageDialog",
"implements",
"SelectionListener",
",",
"IDoubleClickListener",
"{",
"static",
"class",
"ClasspathFixLabelProvider",
"extends",
"LabelProvider",
"{",
"@",
"Override",
"public",
"Image",
"getImage",
"(",
"Object",
"element",
")",
"{",
"if",
"(",
"element",
"instanceof",
"ClasspathFixProposal",
")",
"{",
"ClasspathFixProposal",
"classpathFixProposal",
"=",
"(",
"ClasspathFixProposal",
")",
"element",
";",
"return",
"classpathFixProposal",
".",
"getImage",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"String",
"getText",
"(",
"Object",
"element",
")",
"{",
"if",
"(",
"element",
"instanceof",
"ClasspathFixProposal",
")",
"{",
"ClasspathFixProposal",
"classpathFixProposal",
"=",
"(",
"ClasspathFixProposal",
")",
"element",
";",
"return",
"classpathFixProposal",
".",
"getDisplayString",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"private",
"final",
"ClasspathFixProposal",
"[",
"]",
"fFixProposals",
";",
"private",
"final",
"IJavaProject",
"fProject",
";",
"private",
"TableViewer",
"fFixSelectionTable",
";",
"private",
"Button",
"fNoActionRadio",
";",
"private",
"Button",
"fOpenBuildPathRadio",
";",
"private",
"Button",
"fPerformFix",
";",
"private",
"ClasspathFixProposal",
"fSelectedFix",
";",
"public",
"ClasspathFixSelectionDialog",
"(",
"Shell",
"parent",
",",
"boolean",
"isJUnit4",
",",
"IJavaProject",
"project",
",",
"ClasspathFixProposal",
"[",
"]",
"fixProposals",
")",
"{",
"super",
"(",
"parent",
",",
"WizardMessages",
".",
"Wizard_title_new_testcase",
",",
"null",
",",
"getDialogMessage",
"(",
"isJUnit4",
")",
",",
"MessageDialog",
".",
"QUESTION",
",",
"new",
"String",
"[",
"]",
"{",
"IDialogConstants",
".",
"OK_LABEL",
",",
"IDialogConstants",
".",
"CANCEL_LABEL",
"}",
",",
"0",
")",
";",
"fProject",
"=",
"project",
";",
"fFixProposals",
"=",
"fixProposals",
";",
"fSelectedFix",
"=",
"null",
";",
"}",
"@",
"Override",
"protected",
"boolean",
"isResizable",
"(",
")",
"{",
"return",
"true",
";",
"}",
"private",
"static",
"String",
"getDialogMessage",
"(",
"boolean",
"isJunit4",
")",
"{",
"return",
"isJunit4",
"?",
"WizardMessages",
".",
"NewTestCaseCreationWizard_fix_selection_junit4_description",
":",
"WizardMessages",
".",
"NewTestCaseCreationWizard_fix_selection_junit3_description",
";",
"}",
"@",
"Override",
"protected",
"Control",
"createCustomArea",
"(",
"Composite",
"composite",
")",
"{",
"fNoActionRadio",
"=",
"new",
"Button",
"(",
"composite",
",",
"SWT",
".",
"RADIO",
")",
";",
"fNoActionRadio",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"LEAD",
",",
"SWT",
".",
"TOP",
",",
"false",
",",
"false",
")",
")",
";",
"fNoActionRadio",
".",
"setText",
"(",
"WizardMessages",
".",
"NewTestCaseCreationWizard_fix_selection_not_now",
")",
";",
"fNoActionRadio",
".",
"addSelectionListener",
"(",
"this",
")",
";",
"fOpenBuildPathRadio",
"=",
"new",
"Button",
"(",
"composite",
",",
"SWT",
".",
"RADIO",
")",
";",
"fOpenBuildPathRadio",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"LEAD",
",",
"SWT",
".",
"TOP",
",",
"false",
",",
"false",
")",
")",
";",
"fOpenBuildPathRadio",
".",
"setText",
"(",
"WizardMessages",
".",
"NewTestCaseCreationWizard_fix_selection_open_build_path_dialog",
")",
";",
"fOpenBuildPathRadio",
".",
"addSelectionListener",
"(",
"this",
")",
";",
"if",
"(",
"fFixProposals",
".",
"length",
">",
"0",
")",
"{",
"fPerformFix",
"=",
"new",
"Button",
"(",
"composite",
",",
"SWT",
".",
"RADIO",
")",
";",
"fPerformFix",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"LEAD",
",",
"SWT",
".",
"TOP",
",",
"false",
",",
"false",
")",
")",
";",
"fPerformFix",
".",
"setText",
"(",
"WizardMessages",
".",
"NewTestCaseCreationWizard_fix_selection_invoke_fix",
")",
";",
"fPerformFix",
".",
"addSelectionListener",
"(",
"this",
")",
";",
"fFixSelectionTable",
"=",
"new",
"TableViewer",
"(",
"composite",
",",
"SWT",
".",
"SINGLE",
"|",
"SWT",
".",
"BORDER",
")",
";",
"fFixSelectionTable",
".",
"setContentProvider",
"(",
"new",
"ArrayContentProvider",
"(",
")",
")",
";",
"fFixSelectionTable",
".",
"setLabelProvider",
"(",
"new",
"ClasspathFixLabelProvider",
"(",
")",
")",
";",
"fFixSelectionTable",
".",
"setComparator",
"(",
"new",
"ViewerComparator",
"(",
")",
")",
";",
"fFixSelectionTable",
".",
"addDoubleClickListener",
"(",
"this",
")",
";",
"fFixSelectionTable",
".",
"setInput",
"(",
"fFixProposals",
")",
";",
"fFixSelectionTable",
".",
"setSelection",
"(",
"new",
"StructuredSelection",
"(",
"fFixProposals",
"[",
"0",
"]",
")",
")",
";",
"GridData",
"gridData",
"=",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"FILL",
",",
"true",
",",
"true",
")",
";",
"gridData",
".",
"heightHint",
"=",
"convertHeightInCharsToPixels",
"(",
"4",
")",
";",
"gridData",
".",
"horizontalIndent",
"=",
"convertWidthInCharsToPixels",
"(",
"2",
")",
";",
"fFixSelectionTable",
".",
"getControl",
"(",
")",
".",
"setLayoutData",
"(",
"gridData",
")",
";",
"fNoActionRadio",
".",
"setSelection",
"(",
"false",
")",
";",
"fOpenBuildPathRadio",
".",
"setSelection",
"(",
"false",
")",
";",
"fPerformFix",
".",
"setSelection",
"(",
"true",
")",
";",
"}",
"else",
"{",
"fNoActionRadio",
".",
"setSelection",
"(",
"true",
")",
";",
"fOpenBuildPathRadio",
".",
"setSelection",
"(",
"false",
")",
";",
"}",
"updateEnableStates",
"(",
")",
";",
"return",
"composite",
";",
"}",
"private",
"void",
"updateEnableStates",
"(",
")",
"{",
"if",
"(",
"fPerformFix",
"!=",
"null",
")",
"{",
"fFixSelectionTable",
".",
"getTable",
"(",
")",
".",
"setEnabled",
"(",
"fPerformFix",
".",
"getSelection",
"(",
")",
")",
";",
"}",
"}",
"private",
"static",
"final",
"String",
"BUILD_PATH_PAGE_ID",
"=",
"\"\"",
";",
"private",
"static",
"final",
"Object",
"BUILD_PATH_BLOCK",
"=",
"\"\"",
";",
"@",
"Override",
"protected",
"void",
"buttonPressed",
"(",
"int",
"buttonId",
")",
"{",
"fSelectedFix",
"=",
"null",
";",
"if",
"(",
"buttonId",
"==",
"0",
")",
"{",
"if",
"(",
"fNoActionRadio",
".",
"getSelection",
"(",
")",
")",
"{",
"}",
"else",
"if",
"(",
"fOpenBuildPathRadio",
".",
"getSelection",
"(",
")",
")",
"{",
"String",
"id",
"=",
"BUILD_PATH_PAGE_ID",
";",
"Map",
"input",
"=",
"new",
"HashMap",
"(",
")",
";",
"input",
".",
"put",
"(",
"BUILD_PATH_BLOCK",
",",
"Boolean",
".",
"TRUE",
")",
";",
"if",
"(",
"PreferencesUtil",
".",
"createPropertyDialogOn",
"(",
"getShell",
"(",
")",
",",
"fProject",
",",
"id",
",",
"new",
"String",
"[",
"]",
"{",
"id",
"}",
",",
"input",
")",
".",
"open",
"(",
")",
"!=",
"Window",
".",
"OK",
")",
"{",
"return",
";",
"}",
"}",
"else",
"if",
"(",
"fFixSelectionTable",
"!=",
"null",
")",
"{",
"IStructuredSelection",
"selection",
"=",
"(",
"IStructuredSelection",
")",
"fFixSelectionTable",
".",
"getSelection",
"(",
")",
";",
"Object",
"firstElement",
"=",
"selection",
".",
"getFirstElement",
"(",
")",
";",
"if",
"(",
"firstElement",
"instanceof",
"ClasspathFixProposal",
")",
"{",
"fSelectedFix",
"=",
"(",
"ClasspathFixProposal",
")",
"firstElement",
";",
"}",
"}",
"}",
"super",
".",
"buttonPressed",
"(",
"buttonId",
")",
";",
"}",
"public",
"ClasspathFixProposal",
"getSelectedClasspathFix",
"(",
")",
"{",
"return",
"fSelectedFix",
";",
"}",
"public",
"void",
"widgetDefaultSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"updateEnableStates",
"(",
")",
";",
"}",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"updateEnableStates",
"(",
")",
";",
"}",
"public",
"void",
"doubleClick",
"(",
"DoubleClickEvent",
"event",
")",
"{",
"okPressed",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,263 | [
"<s>",
"package",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextAttribute",
";",
"public",
"class",
"HighlightingStyle",
"{",
"private",
"TextAttribute",
"fTextAttribute",
";",
"private",
"boolean",
"fIsEnabled",
";",
"public",
"HighlightingStyle",
"(",
"TextAttribute",
"textAttribute",
",",
"boolean",
"isEnabled",
")",
"{",
"setTextAttribute",
"(",
"textAttribute",
")",
";",
"setEnabled",
"(",
"isEnabled",
")",
";",
"}",
"public",
"TextAttribute",
"getTextAttribute",
"(",
")",
"{",
"return",
"fTextAttribute",
";",
"}",
"public",
"void",
"setTextAttribute",
"(",
"TextAttribute",
"textAttribute",
")",
"{",
"fTextAttribute",
"=",
"textAttribute",
";",
"}",
"public",
"boolean",
"isEnabled",
"(",
")",
"{",
"return",
"fIsEnabled",
";",
"}",
"public",
"void",
"setEnabled",
"(",
"boolean",
"isEnabled",
")",
"{",
"fIsEnabled",
"=",
"isEnabled",
";",
"}",
"}",
"</s>"
] |
6,264 | [
"<s>",
"package",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextAttribute",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"StyleRange",
";",
"public",
"class",
"HighlightedPosition",
"extends",
"Position",
"{",
"private",
"HighlightingStyle",
"fStyle",
";",
"private",
"Object",
"fLock",
";",
"public",
"HighlightedPosition",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"HighlightingStyle",
"highlighting",
",",
"Object",
"lock",
")",
"{",
"super",
"(",
"offset",
",",
"length",
")",
";",
"fStyle",
"=",
"highlighting",
";",
"fLock",
"=",
"lock",
";",
"}",
"public",
"StyleRange",
"createStyleRange",
"(",
")",
"{",
"int",
"len",
"=",
"0",
";",
"if",
"(",
"fStyle",
".",
"isEnabled",
"(",
")",
")",
"len",
"=",
"getLength",
"(",
")",
";",
"TextAttribute",
"textAttribute",
"=",
"fStyle",
".",
"getTextAttribute",
"(",
")",
";",
"int",
"style",
"=",
"textAttribute",
".",
"getStyle",
"(",
")",
";",
"int",
"fontStyle",
"=",
"style",
"&",
"(",
"SWT",
".",
"ITALIC",
"|",
"SWT",
".",
"BOLD",
"|",
"SWT",
".",
"NORMAL",
")",
";",
"StyleRange",
"styleRange",
"=",
"new",
"StyleRange",
"(",
"getOffset",
"(",
")",
",",
"len",
",",
"textAttribute",
".",
"getForeground",
"(",
")",
",",
"textAttribute",
".",
"getBackground",
"(",
")",
",",
"fontStyle",
")",
";",
"styleRange",
".",
"strikeout",
"=",
"(",
"style",
"&",
"TextAttribute",
".",
"STRIKETHROUGH",
")",
"!=",
"0",
";",
"styleRange",
".",
"underline",
"=",
"(",
"style",
"&",
"TextAttribute",
".",
"UNDERLINE",
")",
"!=",
"0",
";",
"return",
"styleRange",
";",
"}",
"public",
"boolean",
"isEqual",
"(",
"int",
"off",
",",
"int",
"len",
",",
"HighlightingStyle",
"highlighting",
")",
"{",
"synchronized",
"(",
"fLock",
")",
"{",
"return",
"!",
"isDeleted",
"(",
")",
"&&",
"getOffset",
"(",
")",
"==",
"off",
"&&",
"getLength",
"(",
")",
"==",
"len",
"&&",
"fStyle",
"==",
"highlighting",
";",
"}",
"}",
"public",
"boolean",
"isContained",
"(",
"int",
"off",
",",
"int",
"len",
")",
"{",
"synchronized",
"(",
"fLock",
")",
"{",
"return",
"!",
"isDeleted",
"(",
")",
"&&",
"off",
"<=",
"getOffset",
"(",
")",
"&&",
"off",
"+",
"len",
">=",
"getOffset",
"(",
")",
"+",
"getLength",
"(",
")",
";",
"}",
"}",
"public",
"void",
"update",
"(",
"int",
"off",
",",
"int",
"len",
")",
"{",
"synchronized",
"(",
"fLock",
")",
"{",
"super",
".",
"setOffset",
"(",
"off",
")",
";",
"super",
".",
"setLength",
"(",
"len",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"setLength",
"(",
"int",
"length",
")",
"{",
"synchronized",
"(",
"fLock",
")",
"{",
"super",
".",
"setLength",
"(",
"length",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"setOffset",
"(",
"int",
"offset",
")",
"{",
"synchronized",
"(",
"fLock",
")",
"{",
"super",
".",
"setOffset",
"(",
"offset",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"delete",
"(",
")",
"{",
"synchronized",
"(",
"fLock",
")",
"{",
"super",
".",
"delete",
"(",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"undelete",
"(",
")",
"{",
"synchronized",
"(",
"fLock",
")",
"{",
"super",
".",
"undelete",
"(",
")",
";",
"}",
"}",
"public",
"HighlightingStyle",
"getHighlighting",
"(",
")",
"{",
"return",
"fStyle",
";",
"}",
"}",
"</s>"
] |
6,265 | [
"<s>",
"package",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"javaeditor",
".",
"JavaSourceViewer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"text",
".",
"JavaPresentationReconciler",
";",
"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",
".",
"IDocumentListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IPositionUpdater",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ISynchronizable",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextInputListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"ITextPresentationListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Region",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextPresentation",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"StyleRange",
";",
"public",
"class",
"SemanticHighlightingPresenter",
"implements",
"ITextPresentationListener",
",",
"ITextInputListener",
",",
"IDocumentListener",
"{",
"private",
"class",
"HighlightingPositionUpdater",
"implements",
"IPositionUpdater",
"{",
"private",
"final",
"String",
"fCategory",
";",
"public",
"HighlightingPositionUpdater",
"(",
"String",
"category",
")",
"{",
"fCategory",
"=",
"category",
";",
"}",
"public",
"void",
"update",
"(",
"DocumentEvent",
"event",
")",
"{",
"int",
"eventOffset",
"=",
"event",
".",
"getOffset",
"(",
")",
";",
"int",
"eventOldLength",
"=",
"event",
".",
"getLength",
"(",
")",
";",
"int",
"eventEnd",
"=",
"eventOffset",
"+",
"eventOldLength",
";",
"try",
"{",
"Position",
"[",
"]",
"positions",
"=",
"event",
".",
"getDocument",
"(",
")",
".",
"getPositions",
"(",
"fCategory",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"positions",
".",
"length",
";",
"i",
"++",
")",
"{",
"HighlightedPosition",
"position",
"=",
"(",
"HighlightedPosition",
")",
"positions",
"[",
"i",
"]",
";",
"int",
"offset",
"=",
"position",
".",
"getOffset",
"(",
")",
";",
"int",
"length",
"=",
"position",
".",
"getLength",
"(",
")",
";",
"int",
"end",
"=",
"offset",
"+",
"length",
";",
"if",
"(",
"offset",
">",
"eventEnd",
")",
"updateWithPrecedingEvent",
"(",
"position",
",",
"event",
")",
";",
"else",
"if",
"(",
"end",
"<",
"eventOffset",
")",
"updateWithSucceedingEvent",
"(",
"position",
",",
"event",
")",
";",
"else",
"if",
"(",
"offset",
"<=",
"eventOffset",
"&&",
"end",
">=",
"eventEnd",
")",
"updateWithIncludedEvent",
"(",
"position",
",",
"event",
")",
";",
"else",
"if",
"(",
"offset",
"<=",
"eventOffset",
")",
"updateWithOverEndEvent",
"(",
"position",
",",
"event",
")",
";",
"else",
"if",
"(",
"end",
">=",
"eventEnd",
")",
"updateWithOverStartEvent",
"(",
"position",
",",
"event",
")",
";",
"else",
"updateWithIncludingEvent",
"(",
"position",
",",
"event",
")",
";",
"}",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"}",
"}",
"private",
"void",
"updateWithPrecedingEvent",
"(",
"HighlightedPosition",
"position",
",",
"DocumentEvent",
"event",
")",
"{",
"String",
"newText",
"=",
"event",
".",
"getText",
"(",
")",
";",
"int",
"eventNewLength",
"=",
"newText",
"!=",
"null",
"?",
"newText",
".",
"length",
"(",
")",
":",
"0",
";",
"int",
"deltaLength",
"=",
"eventNewLength",
"-",
"event",
".",
"getLength",
"(",
")",
";",
"position",
".",
"setOffset",
"(",
"position",
".",
"getOffset",
"(",
")",
"+",
"deltaLength",
")",
";",
"}",
"private",
"void",
"updateWithSucceedingEvent",
"(",
"HighlightedPosition",
"position",
",",
"DocumentEvent",
"event",
")",
"{",
"}",
"private",
"void",
"updateWithIncludedEvent",
"(",
"HighlightedPosition",
"position",
",",
"DocumentEvent",
"event",
")",
"{",
"int",
"eventOffset",
"=",
"event",
".",
"getOffset",
"(",
")",
";",
"String",
"newText",
"=",
"event",
".",
"getText",
"(",
")",
";",
"if",
"(",
"newText",
"==",
"null",
")",
"newText",
"=",
"\"\"",
";",
"int",
"eventNewLength",
"=",
"newText",
".",
"length",
"(",
")",
";",
"int",
"deltaLength",
"=",
"eventNewLength",
"-",
"event",
".",
"getLength",
"(",
")",
";",
"int",
"offset",
"=",
"position",
".",
"getOffset",
"(",
")",
";",
"int",
"length",
"=",
"position",
".",
"getLength",
"(",
")",
";",
"int",
"end",
"=",
"offset",
"+",
"length",
";",
"int",
"includedLength",
"=",
"0",
";",
"while",
"(",
"includedLength",
"<",
"eventNewLength",
"&&",
"Character",
".",
"isJavaIdentifierPart",
"(",
"newText",
".",
"charAt",
"(",
"includedLength",
")",
")",
")",
"includedLength",
"++",
";",
"if",
"(",
"includedLength",
"==",
"eventNewLength",
")",
"position",
".",
"setLength",
"(",
"length",
"+",
"deltaLength",
")",
";",
"else",
"{",
"int",
"newLeftLength",
"=",
"eventOffset",
"-",
"offset",
"+",
"includedLength",
";",
"int",
"excludedLength",
"=",
"eventNewLength",
";",
"while",
"(",
"excludedLength",
">",
"0",
"&&",
"Character",
".",
"isJavaIdentifierPart",
"(",
"newText",
".",
"charAt",
"(",
"excludedLength",
"-",
"1",
")",
")",
")",
"excludedLength",
"--",
";",
"int",
"newRightOffset",
"=",
"eventOffset",
"+",
"excludedLength",
";",
"int",
"newRightLength",
"=",
"end",
"+",
"deltaLength",
"-",
"newRightOffset",
";",
"if",
"(",
"newRightLength",
"==",
"0",
")",
"{",
"position",
".",
"setLength",
"(",
"newLeftLength",
")",
";",
"}",
"else",
"{",
"if",
"(",
"newLeftLength",
"==",
"0",
")",
"{",
"position",
".",
"update",
"(",
"newRightOffset",
",",
"newRightLength",
")",
";",
"}",
"else",
"{",
"position",
".",
"setLength",
"(",
"newLeftLength",
")",
";",
"addPositionFromUI",
"(",
"newRightOffset",
",",
"newRightLength",
",",
"position",
".",
"getHighlighting",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"private",
"void",
"updateWithOverEndEvent",
"(",
"HighlightedPosition",
"position",
",",
"DocumentEvent",
"event",
")",
"{",
"String",
"newText",
"=",
"event",
".",
"getText",
"(",
")",
";",
"if",
"(",
"newText",
"==",
"null",
")",
"newText",
"=",
"\"\"",
";",
"int",
"eventNewLength",
"=",
"newText",
".",
"length",
"(",
")",
";",
"int",
"includedLength",
"=",
"0",
";",
"while",
"(",
"includedLength",
"<",
"eventNewLength",
"&&",
"Character",
".",
"isJavaIdentifierPart",
"(",
"newText",
".",
"charAt",
"(",
"includedLength",
")",
")",
")",
"includedLength",
"++",
";",
"position",
".",
"setLength",
"(",
"event",
".",
"getOffset",
"(",
")",
"-",
"position",
".",
"getOffset",
"(",
")",
"+",
"includedLength",
")",
";",
"}",
"private",
"void",
"updateWithOverStartEvent",
"(",
"HighlightedPosition",
"position",
",",
"DocumentEvent",
"event",
")",
"{",
"int",
"eventOffset",
"=",
"event",
".",
"getOffset",
"(",
")",
";",
"int",
"eventEnd",
"=",
"eventOffset",
"+",
"event",
".",
"getLength",
"(",
")",
";",
"String",
"newText",
"=",
"event",
".",
"getText",
"(",
")",
";",
"if",
"(",
"newText",
"==",
"null",
")",
"newText",
"=",
"\"\"",
";",
"int",
"eventNewLength",
"=",
"newText",
".",
"length",
"(",
")",
";",
"int",
"excludedLength",
"=",
"eventNewLength",
";",
"while",
"(",
"excludedLength",
">",
"0",
"&&",
"Character",
".",
"isJavaIdentifierPart",
"(",
"newText",
".",
"charAt",
"(",
"excludedLength",
"-",
"1",
")",
")",
")",
"excludedLength",
"--",
";",
"int",
"deleted",
"=",
"eventEnd",
"-",
"position",
".",
"getOffset",
"(",
")",
";",
"int",
"inserted",
"=",
"eventNewLength",
"-",
"excludedLength",
";",
"position",
".",
"update",
"(",
"eventOffset",
"+",
"excludedLength",
",",
"position",
".",
"getLength",
"(",
")",
"-",
"deleted",
"+",
"inserted",
")",
";",
"}",
"private",
"void",
"updateWithIncludingEvent",
"(",
"HighlightedPosition",
"position",
",",
"DocumentEvent",
"event",
")",
"{",
"position",
".",
"delete",
"(",
")",
";",
"position",
".",
"update",
"(",
"event",
".",
"getOffset",
"(",
")",
",",
"0",
")",
";",
"}",
"}",
"private",
"IPositionUpdater",
"fPositionUpdater",
"=",
"new",
"HighlightingPositionUpdater",
"(",
"getPositionCategory",
"(",
")",
")",
";",
"private",
"JavaSourceViewer",
"fSourceViewer",
";",
"private",
"JavaPresentationReconciler",
"fPresentationReconciler",
";",
"public",
"List",
"fPositions",
"=",
"new",
"ArrayList",
"(",
")",
";",
"private",
"Object",
"fPositionLock",
"=",
"new",
"Object",
"(",
")",
";",
"private",
"boolean",
"fIsCanceled",
"=",
"false",
";",
"public",
"HighlightedPosition",
"createHighlightedPosition",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"HighlightingStyle",
"highlighting",
")",
"{",
"return",
"new",
"HighlightedPosition",
"(",
"offset",
",",
"length",
",",
"highlighting",
",",
"fPositionUpdater",
")",
";",
"}",
"public",
"void",
"addAllPositions",
"(",
"List",
"list",
")",
"{",
"synchronized",
"(",
"fPositionLock",
")",
"{",
"list",
".",
"addAll",
"(",
"fPositions",
")",
";",
"}",
"}",
"public",
"TextPresentation",
"createPresentation",
"(",
"List",
"addedPositions",
",",
"List",
"removedPositions",
")",
"{",
"JavaSourceViewer",
"sourceViewer",
"=",
"fSourceViewer",
";",
"JavaPresentationReconciler",
"presentationReconciler",
"=",
"fPresentationReconciler",
";",
"if",
"(",
"sourceViewer",
"==",
"null",
"||",
"presentationReconciler",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"isCanceled",
"(",
")",
")",
"return",
"null",
";",
"IDocument",
"document",
"=",
"sourceViewer",
".",
"getDocument",
"(",
")",
";",
"if",
"(",
"document",
"==",
"null",
")",
"return",
"null",
";",
"int",
"minStart",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"int",
"maxEnd",
"=",
"Integer",
".",
"MIN_VALUE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"removedPositions",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Position",
"position",
"=",
"(",
"Position",
")",
"removedPositions",
".",
"get",
"(",
"i",
")",
";",
"int",
"offset",
"=",
"position",
".",
"getOffset",
"(",
")",
";",
"minStart",
"=",
"Math",
".",
"min",
"(",
"minStart",
",",
"offset",
")",
";",
"maxEnd",
"=",
"Math",
".",
"max",
"(",
"maxEnd",
",",
"offset",
"+",
"position",
".",
"getLength",
"(",
")",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"addedPositions",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Position",
"position",
"=",
"(",
"Position",
")",
"addedPositions",
".",
"get",
"(",
"i",
")",
";",
"int",
"offset",
"=",
"position",
".",
"getOffset",
"(",
")",
";",
"minStart",
"=",
"Math",
".",
"min",
"(",
"minStart",
",",
"offset",
")",
";",
"maxEnd",
"=",
"Math",
".",
"max",
"(",
"maxEnd",
",",
"offset",
"+",
"position",
".",
"getLength",
"(",
")",
")",
";",
"}",
"if",
"(",
"minStart",
"<",
"maxEnd",
")",
"try",
"{",
"return",
"presentationReconciler",
".",
"createRepairDescription",
"(",
"new",
"Region",
"(",
"minStart",
",",
"maxEnd",
"-",
"minStart",
")",
",",
"document",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"}",
"return",
"null",
";",
"}",
"public",
"Runnable",
"createUpdateRunnable",
"(",
"final",
"TextPresentation",
"textPresentation",
",",
"List",
"addedPositions",
",",
"List",
"removedPositions",
")",
"{",
"if",
"(",
"fSourceViewer",
"==",
"null",
"||",
"textPresentation",
"==",
"null",
")",
"return",
"null",
";",
"final",
"HighlightedPosition",
"[",
"]",
"added",
"=",
"new",
"HighlightedPosition",
"[",
"addedPositions",
".",
"size",
"(",
")",
"]",
";",
"addedPositions",
".",
"toArray",
"(",
"added",
")",
";",
"final",
"HighlightedPosition",
"[",
"]",
"removed",
"=",
"new",
"HighlightedPosition",
"[",
"removedPositions",
".",
"size",
"(",
")",
"]",
";",
"removedPositions",
".",
"toArray",
"(",
"removed",
")",
";",
"if",
"(",
"isCanceled",
"(",
")",
")",
"return",
"null",
";",
"Runnable",
"runnable",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"updatePresentation",
"(",
"textPresentation",
",",
"added",
",",
"removed",
")",
";",
"}",
"}",
";",
"return",
"runnable",
";",
"}",
"public",
"void",
"updatePresentation",
"(",
"TextPresentation",
"textPresentation",
",",
"HighlightedPosition",
"[",
"]",
"addedPositions",
",",
"HighlightedPosition",
"[",
"]",
"removedPositions",
")",
"{",
"if",
"(",
"fSourceViewer",
"==",
"null",
")",
"return",
";",
"if",
"(",
"isCanceled",
"(",
")",
")",
"return",
";",
"IDocument",
"document",
"=",
"fSourceViewer",
".",
"getDocument",
"(",
")",
";",
"if",
"(",
"document",
"==",
"null",
")",
"return",
";",
"String",
"positionCategory",
"=",
"getPositionCategory",
"(",
")",
";",
"List",
"removedPositionsList",
"=",
"Arrays",
".",
"asList",
"(",
"removedPositions",
")",
";",
"try",
"{",
"synchronized",
"(",
"fPositionLock",
")",
"{",
"List",
"oldPositions",
"=",
"fPositions",
";",
"int",
"newSize",
"=",
"Math",
".",
"max",
"(",
"fPositions",
".",
"size",
"(",
")",
"+",
"addedPositions",
".",
"length",
"-",
"removedPositions",
".",
"length",
",",
"10",
")",
";",
"List",
"newPositions",
"=",
"new",
"ArrayList",
"(",
"newSize",
")",
";",
"Position",
"position",
"=",
"null",
";",
"Position",
"addedPosition",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"0",
",",
"n",
"=",
"oldPositions",
".",
"size",
"(",
")",
",",
"m",
"=",
"addedPositions",
".",
"length",
";",
"i",
"<",
"n",
"||",
"position",
"!=",
"null",
"||",
"j",
"<",
"m",
"||",
"addedPosition",
"!=",
"null",
";",
")",
"{",
"while",
"(",
"position",
"==",
"null",
"&&",
"i",
"<",
"n",
")",
"{",
"position",
"=",
"(",
"Position",
")",
"oldPositions",
".",
"get",
"(",
"i",
"++",
")",
";",
"if",
"(",
"position",
".",
"isDeleted",
"(",
")",
"||",
"contain",
"(",
"removedPositionsList",
",",
"position",
")",
")",
"{",
"document",
".",
"removePosition",
"(",
"positionCategory",
",",
"position",
")",
";",
"position",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"addedPosition",
"==",
"null",
"&&",
"j",
"<",
"m",
")",
"{",
"addedPosition",
"=",
"addedPositions",
"[",
"j",
"++",
"]",
";",
"document",
".",
"addPosition",
"(",
"positionCategory",
",",
"addedPosition",
")",
";",
"}",
"if",
"(",
"position",
"!=",
"null",
")",
"{",
"if",
"(",
"addedPosition",
"!=",
"null",
")",
"if",
"(",
"position",
".",
"getOffset",
"(",
")",
"<=",
"addedPosition",
".",
"getOffset",
"(",
")",
")",
"{",
"newPositions",
".",
"add",
"(",
"position",
")",
";",
"position",
"=",
"null",
";",
"}",
"else",
"{",
"newPositions",
".",
"add",
"(",
"addedPosition",
")",
";",
"addedPosition",
"=",
"null",
";",
"}",
"else",
"{",
"newPositions",
".",
"add",
"(",
"position",
")",
";",
"position",
"=",
"null",
";",
"}",
"}",
"else",
"if",
"(",
"addedPosition",
"!=",
"null",
")",
"{",
"newPositions",
".",
"add",
"(",
"addedPosition",
")",
";",
"addedPosition",
"=",
"null",
";",
"}",
"}",
"fPositions",
"=",
"newPositions",
";",
"}",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"if",
"(",
"textPresentation",
"!=",
"null",
")",
"fSourceViewer",
".",
"changeTextPresentation",
"(",
"textPresentation",
",",
"false",
")",
";",
"else",
"fSourceViewer",
".",
"invalidateTextPresentation",
"(",
")",
";",
"}",
"private",
"boolean",
"contain",
"(",
"List",
"positions",
",",
"Position",
"position",
")",
"{",
"return",
"indexOf",
"(",
"positions",
",",
"position",
")",
"!=",
"-",
"1",
";",
"}",
"private",
"int",
"indexOf",
"(",
"List",
"positions",
",",
"Position",
"position",
")",
"{",
"int",
"index",
"=",
"computeIndexAtOffset",
"(",
"positions",
",",
"position",
".",
"getOffset",
"(",
")",
")",
";",
"int",
"size",
"=",
"positions",
".",
"size",
"(",
")",
";",
"while",
"(",
"index",
"<",
"size",
")",
"{",
"if",
"(",
"positions",
".",
"get",
"(",
"index",
")",
"==",
"position",
")",
"return",
"index",
";",
"index",
"++",
";",
"}",
"return",
"-",
"1",
";",
"}",
"private",
"void",
"insertPosition",
"(",
"Position",
"position",
")",
"{",
"int",
"i",
"=",
"computeIndexAfterOffset",
"(",
"fPositions",
",",
"position",
".",
"getOffset",
"(",
")",
")",
";",
"fPositions",
".",
"add",
"(",
"i",
",",
"position",
")",
";",
"}",
"private",
"int",
"computeIndexAfterOffset",
"(",
"List",
"positions",
",",
"int",
"offset",
")",
"{",
"int",
"i",
"=",
"-",
"1",
";",
"int",
"j",
"=",
"positions",
".",
"size",
"(",
")",
";",
"while",
"(",
"j",
"-",
"i",
">",
"1",
")",
"{",
"int",
"k",
"=",
"(",
"i",
"+",
"j",
")",
">>",
"1",
";",
"Position",
"position",
"=",
"(",
"Position",
")",
"positions",
".",
"get",
"(",
"k",
")",
";",
"if",
"(",
"position",
".",
"getOffset",
"(",
")",
">",
"offset",
")",
"j",
"=",
"k",
";",
"else",
"i",
"=",
"k",
";",
"}",
"return",
"j",
";",
"}",
"private",
"int",
"computeIndexAtOffset",
"(",
"List",
"positions",
",",
"int",
"offset",
")",
"{",
"int",
"i",
"=",
"-",
"1",
";",
"int",
"j",
"=",
"positions",
".",
"size",
"(",
")",
";",
"while",
"(",
"j",
"-",
"i",
">",
"1",
")",
"{",
"int",
"k",
"=",
"(",
"i",
"+",
"j",
")",
">>",
"1",
";",
"Position",
"position",
"=",
"(",
"Position",
")",
"positions",
".",
"get",
"(",
"k",
")",
";",
"if",
"(",
"position",
".",
"getOffset",
"(",
")",
">=",
"offset",
")",
"j",
"=",
"k",
";",
"else",
"i",
"=",
"k",
";",
"}",
"return",
"j",
";",
"}",
"public",
"void",
"applyTextPresentation",
"(",
"TextPresentation",
"textPresentation",
")",
"{",
"IRegion",
"region",
"=",
"textPresentation",
".",
"getExtent",
"(",
")",
";",
"int",
"i",
"=",
"computeIndexAtOffset",
"(",
"fPositions",
",",
"region",
".",
"getOffset",
"(",
")",
")",
",",
"n",
"=",
"computeIndexAtOffset",
"(",
"fPositions",
",",
"region",
".",
"getOffset",
"(",
")",
"+",
"region",
".",
"getLength",
"(",
")",
")",
";",
"if",
"(",
"n",
"-",
"i",
">",
"2",
")",
"{",
"List",
"ranges",
"=",
"new",
"ArrayList",
"(",
"n",
"-",
"i",
")",
";",
"for",
"(",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"HighlightedPosition",
"position",
"=",
"(",
"HighlightedPosition",
")",
"fPositions",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"!",
"position",
".",
"isDeleted",
"(",
")",
")",
"ranges",
".",
"add",
"(",
"position",
".",
"createStyleRange",
"(",
")",
")",
";",
"}",
"StyleRange",
"[",
"]",
"array",
"=",
"new",
"StyleRange",
"[",
"ranges",
".",
"size",
"(",
")",
"]",
";",
"array",
"=",
"(",
"StyleRange",
"[",
"]",
")",
"ranges",
".",
"toArray",
"(",
"array",
")",
";",
"textPresentation",
".",
"mergeStyleRanges",
"(",
"array",
")",
";",
"}",
"else",
"{",
"for",
"(",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"HighlightedPosition",
"position",
"=",
"(",
"HighlightedPosition",
")",
"fPositions",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"!",
"position",
".",
"isDeleted",
"(",
")",
")",
"textPresentation",
".",
"mergeStyleRange",
"(",
"position",
".",
"createStyleRange",
"(",
")",
")",
";",
"}",
"}",
"}",
"public",
"void",
"inputDocumentAboutToBeChanged",
"(",
"IDocument",
"oldInput",
",",
"IDocument",
"newInput",
")",
"{",
"setCanceled",
"(",
"true",
")",
";",
"releaseDocument",
"(",
"oldInput",
")",
";",
"resetState",
"(",
")",
";",
"}",
"public",
"void",
"inputDocumentChanged",
"(",
"IDocument",
"oldInput",
",",
"IDocument",
"newInput",
")",
"{",
"manageDocument",
"(",
"newInput",
")",
";",
"}",
"public",
"void",
"documentAboutToBeChanged",
"(",
"DocumentEvent",
"event",
")",
"{",
"setCanceled",
"(",
"true",
")",
";",
"}",
"public",
"void",
"documentChanged",
"(",
"DocumentEvent",
"event",
")",
"{",
"}",
"public",
"boolean",
"isCanceled",
"(",
")",
"{",
"IDocument",
"document",
"=",
"fSourceViewer",
"!=",
"null",
"?",
"fSourceViewer",
".",
"getDocument",
"(",
")",
":",
"null",
";",
"if",
"(",
"document",
"==",
"null",
")",
"return",
"fIsCanceled",
";",
"synchronized",
"(",
"getLockObject",
"(",
"document",
")",
")",
"{",
"return",
"fIsCanceled",
";",
"}",
"}",
"public",
"void",
"setCanceled",
"(",
"boolean",
"isCanceled",
")",
"{",
"IDocument",
"document",
"=",
"fSourceViewer",
"!=",
"null",
"?",
"fSourceViewer",
".",
"getDocument",
"(",
")",
":",
"null",
";",
"if",
"(",
"document",
"==",
"null",
")",
"{",
"fIsCanceled",
"=",
"isCanceled",
";",
"return",
";",
"}",
"synchronized",
"(",
"getLockObject",
"(",
"document",
")",
")",
"{",
"fIsCanceled",
"=",
"isCanceled",
";",
"}",
"}",
"private",
"Object",
"getLockObject",
"(",
"IDocument",
"document",
")",
"{",
"if",
"(",
"document",
"instanceof",
"ISynchronizable",
")",
"{",
"Object",
"lock",
"=",
"(",
"(",
"ISynchronizable",
")",
"document",
")",
".",
"getLockObject",
"(",
")",
";",
"if",
"(",
"lock",
"!=",
"null",
")",
"return",
"lock",
";",
"}",
"return",
"document",
";",
"}",
"public",
"void",
"install",
"(",
"JavaSourceViewer",
"sourceViewer",
",",
"JavaPresentationReconciler",
"backgroundPresentationReconciler",
")",
"{",
"fSourceViewer",
"=",
"sourceViewer",
";",
"fPresentationReconciler",
"=",
"backgroundPresentationReconciler",
";",
"fSourceViewer",
".",
"prependTextPresentationListener",
"(",
"this",
")",
";",
"fSourceViewer",
".",
"addTextInputListener",
"(",
"this",
")",
";",
"manageDocument",
"(",
"fSourceViewer",
".",
"getDocument",
"(",
")",
")",
";",
"}",
"public",
"void",
"uninstall",
"(",
")",
"{",
"setCanceled",
"(",
"true",
")",
";",
"if",
"(",
"fSourceViewer",
"!=",
"null",
")",
"{",
"fSourceViewer",
".",
"removeTextPresentationListener",
"(",
"this",
")",
";",
"releaseDocument",
"(",
"fSourceViewer",
".",
"getDocument",
"(",
")",
")",
";",
"invalidateTextPresentation",
"(",
")",
";",
"resetState",
"(",
")",
";",
"fSourceViewer",
".",
"removeTextInputListener",
"(",
"this",
")",
";",
"fSourceViewer",
"=",
"null",
";",
"}",
"}",
"public",
"void",
"highlightingStyleChanged",
"(",
"HighlightingStyle",
"highlighting",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"fPositions",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"HighlightedPosition",
"position",
"=",
"(",
"HighlightedPosition",
")",
"fPositions",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"position",
".",
"getHighlighting",
"(",
")",
"==",
"highlighting",
")",
"fSourceViewer",
".",
"invalidateTextPresentation",
"(",
"position",
".",
"getOffset",
"(",
")",
",",
"position",
".",
"getLength",
"(",
")",
")",
";",
"}",
"}",
"private",
"void",
"invalidateTextPresentation",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"fPositions",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Position",
"position",
"=",
"(",
"Position",
")",
"fPositions",
".",
"get",
"(",
"i",
")",
";",
"fSourceViewer",
".",
"invalidateTextPresentation",
"(",
"position",
".",
"getOffset",
"(",
")",
",",
"position",
".",
"getLength",
"(",
")",
")",
";",
"}",
"}",
"void",
"addPositionFromUI",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"HighlightingStyle",
"highlighting",
")",
"{",
"Position",
"position",
"=",
"createHighlightedPosition",
"(",
"offset",
",",
"length",
",",
"highlighting",
")",
";",
"synchronized",
"(",
"fPositionLock",
")",
"{",
"insertPosition",
"(",
"position",
")",
";",
"}",
"IDocument",
"document",
"=",
"fSourceViewer",
".",
"getDocument",
"(",
")",
";",
"if",
"(",
"document",
"==",
"null",
")",
"return",
";",
"String",
"positionCategory",
"=",
"getPositionCategory",
"(",
")",
";",
"try",
"{",
"document",
".",
"addPosition",
"(",
"positionCategory",
",",
"position",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"private",
"void",
"resetState",
"(",
")",
"{",
"synchronized",
"(",
"fPositionLock",
")",
"{",
"fPositions",
".",
"clear",
"(",
")",
";",
"}",
"}",
"private",
"void",
"manageDocument",
"(",
"IDocument",
"document",
")",
"{",
"if",
"(",
"document",
"!=",
"null",
")",
"{",
"document",
".",
"addPositionCategory",
"(",
"getPositionCategory",
"(",
")",
")",
";",
"document",
".",
"addPositionUpdater",
"(",
"fPositionUpdater",
")",
";",
"document",
".",
"addDocumentListener",
"(",
"this",
")",
";",
"}",
"}",
"private",
"void",
"releaseDocument",
"(",
"IDocument",
"document",
")",
"{",
"if",
"(",
"document",
"!=",
"null",
")",
"{",
"document",
".",
"removeDocumentListener",
"(",
"this",
")",
";",
"document",
".",
"removePositionUpdater",
"(",
"fPositionUpdater",
")",
";",
"try",
"{",
"document",
".",
"removePositionCategory",
"(",
"getPositionCategory",
"(",
")",
")",
";",
"}",
"catch",
"(",
"BadPositionCategoryException",
"e",
")",
"{",
"JavaPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"}",
"private",
"String",
"getPositionCategory",
"(",
")",
"{",
"return",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,266 | [
"<s>",
"package",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"junit",
".",
"wizards",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"ListIterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClassFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeHierarchy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"corext",
".",
"util",
".",
"JavaConventionsUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"BasicElementLabels",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"JUnitCorePlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"buildpath",
".",
"BuildPathSupport",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"ui",
".",
"IJUnitHelpContextIds",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"util",
".",
"JUnitStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"util",
".",
"JUnitStubUtility",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"util",
".",
"JUnitStubUtility",
".",
"GenStubSettings",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"util",
".",
"LayoutUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"util",
".",
"TestSearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"wizards",
".",
"MethodStubsSelectionButtonGroup",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"wizards",
".",
"WizardMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"contentassist",
".",
"ControlContentAssistHelper",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"refactoring",
".",
"contentassist",
".",
"JavaTypeCompletionProcessor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"junit",
".",
"wizards",
".",
"NewTestCaseWizardPageTwo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"CodeGeneration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"IJavaElementSearchConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaElementLabels",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaUI",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"wizards",
".",
"NewTypeWizardPage",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"Dialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"IDialogSettings",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"JFaceResources",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"ModifyEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"ModifyListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridData",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"layout",
".",
"GridLayout",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Label",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Link",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Text",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"PreferencesUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"SelectionDialog",
";",
"public",
"class",
"NewTestCaseWizardPageOne",
"extends",
"NewTypeWizardPage",
"{",
"private",
"final",
"static",
"String",
"PAGE_NAME",
"=",
"\"\"",
";",
"public",
"final",
"static",
"String",
"CLASS_UNDER_TEST",
"=",
"PAGE_NAME",
"+",
"\"\"",
";",
"public",
"final",
"static",
"String",
"JUNIT4TOGGLE",
"=",
"PAGE_NAME",
"+",
"\"\"",
";",
"private",
"static",
"final",
"String",
"COMPLIANCE_PAGE_ID",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"BUILD_PATH_PAGE_ID",
"=",
"\"\"",
";",
"private",
"static",
"final",
"Object",
"BUILD_PATH_KEY_ADD_ENTRY",
"=",
"\"\"",
";",
"private",
"static",
"final",
"Object",
"BUILD_PATH_BLOCK",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"KEY_NO_LINK",
"=",
"\"\"",
";",
"private",
"final",
"static",
"String",
"QUESTION_MARK_TAG",
"=",
"\"Q\"",
";",
"private",
"final",
"static",
"String",
"OF_TAG",
"=",
"\"Of\"",
";",
"private",
"final",
"static",
"String",
"TEST_SUFFIX",
"=",
"\"Test\"",
";",
"private",
"final",
"static",
"String",
"PREFIX",
"=",
"\"test\"",
";",
"private",
"final",
"static",
"String",
"STORE_SETUP",
"=",
"PAGE_NAME",
"+",
"\".USE_SETUP\"",
";",
"private",
"final",
"static",
"String",
"STORE_TEARDOWN",
"=",
"PAGE_NAME",
"+",
"\"\"",
";",
"private",
"final",
"static",
"String",
"STORE_SETUP_CLASS",
"=",
"PAGE_NAME",
"+",
"\"\"",
";",
"private",
"final",
"static",
"String",
"STORE_TEARDOWN_CLASS",
"=",
"PAGE_NAME",
"+",
"\"\"",
";",
"private",
"final",
"static",
"String",
"STORE_CONSTRUCTOR",
"=",
"PAGE_NAME",
"+",
"\"\"",
";",
"private",
"final",
"static",
"int",
"IDX_SETUP_CLASS",
"=",
"0",
";",
"private",
"final",
"static",
"int",
"IDX_TEARDOWN_CLASS",
"=",
"1",
";",
"private",
"final",
"static",
"int",
"IDX_SETUP",
"=",
"2",
";",
"private",
"final",
"static",
"int",
"IDX_TEARDOWN",
"=",
"3",
";",
"private",
"final",
"static",
"int",
"IDX_CONSTRUCTOR",
"=",
"4",
";",
"private",
"NewTestCaseWizardPageTwo",
"fPage2",
";",
"private",
"MethodStubsSelectionButtonGroup",
"fMethodStubsButtons",
";",
"private",
"String",
"fClassUnderTestText",
";",
"private",
"IType",
"fClassUnderTest",
";",
"private",
"Text",
"fClassUnderTestControl",
";",
"private",
"IStatus",
"fClassUnderTestStatus",
";",
"private",
"Button",
"fClassUnderTestButton",
";",
"private",
"JavaTypeCompletionProcessor",
"fClassToTestCompletionProcessor",
";",
"private",
"Button",
"fJUnit4Toggle",
";",
"private",
"boolean",
"fIsJunit4",
";",
"private",
"IStatus",
"fJunit4Status",
";",
"private",
"boolean",
"fIsJunit4Enabled",
";",
"private",
"Link",
"fLink",
";",
"private",
"Label",
"fImage",
";",
"public",
"NewTestCaseWizardPageOne",
"(",
"NewTestCaseWizardPageTwo",
"page2",
")",
"{",
"super",
"(",
"true",
",",
"PAGE_NAME",
")",
";",
"fPage2",
"=",
"page2",
";",
"setTitle",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_title",
")",
";",
"setDescription",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_description",
")",
";",
"String",
"[",
"]",
"buttonNames",
"=",
"new",
"String",
"[",
"]",
"{",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_methodStub_setUpBeforeClass",
",",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_methodStub_tearDownAfterClass",
",",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_methodStub_setUp",
",",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_methodStub_tearDown",
",",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_methodStub_constructor",
"}",
";",
"enableCommentControl",
"(",
"true",
")",
";",
"fMethodStubsButtons",
"=",
"new",
"MethodStubsSelectionButtonGroup",
"(",
"SWT",
".",
"CHECK",
",",
"buttonNames",
",",
"2",
")",
";",
"fMethodStubsButtons",
".",
"setLabelText",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_method_Stub_label",
")",
";",
"fClassToTestCompletionProcessor",
"=",
"new",
"JavaTypeCompletionProcessor",
"(",
"false",
",",
"false",
",",
"true",
")",
";",
"fClassUnderTestStatus",
"=",
"new",
"JUnitStatus",
"(",
")",
";",
"fClassUnderTestText",
"=",
"\"\"",
";",
"fJunit4Status",
"=",
"new",
"JUnitStatus",
"(",
")",
";",
"fIsJunit4",
"=",
"false",
";",
"}",
"public",
"void",
"init",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"IJavaElement",
"element",
"=",
"getInitialJavaElement",
"(",
"selection",
")",
";",
"initContainerPage",
"(",
"element",
")",
";",
"initTypePage",
"(",
"element",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"IType",
"classToTest",
"=",
"null",
";",
"IType",
"typeInCompUnit",
"=",
"(",
"IType",
")",
"element",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"TYPE",
")",
";",
"if",
"(",
"typeInCompUnit",
"!=",
"null",
")",
"{",
"if",
"(",
"typeInCompUnit",
".",
"getCompilationUnit",
"(",
")",
"!=",
"null",
")",
"{",
"classToTest",
"=",
"typeInCompUnit",
";",
"}",
"}",
"else",
"{",
"ICompilationUnit",
"cu",
"=",
"(",
"ICompilationUnit",
")",
"element",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
";",
"if",
"(",
"cu",
"!=",
"null",
")",
"classToTest",
"=",
"cu",
".",
"findPrimaryType",
"(",
")",
";",
"else",
"{",
"if",
"(",
"element",
"instanceof",
"IClassFile",
")",
"{",
"try",
"{",
"IClassFile",
"cf",
"=",
"(",
"IClassFile",
")",
"element",
";",
"if",
"(",
"cf",
".",
"isStructureKnown",
"(",
")",
")",
"classToTest",
"=",
"cf",
".",
"getType",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"JUnitCorePlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"classToTest",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"TestSearchEngine",
".",
"isTestImplementor",
"(",
"classToTest",
")",
")",
"{",
"setClassUnderTest",
"(",
"classToTest",
".",
"getFullyQualifiedName",
"(",
"'.'",
")",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"JUnitCorePlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"}",
"restoreWidgetValues",
"(",
")",
";",
"boolean",
"isJunit4",
"=",
"false",
";",
"if",
"(",
"element",
"!=",
"null",
"&&",
"element",
".",
"getElementType",
"(",
")",
"!=",
"IJavaElement",
".",
"JAVA_MODEL",
")",
"{",
"IJavaProject",
"project",
"=",
"element",
".",
"getJavaProject",
"(",
")",
";",
"try",
"{",
"isJunit4",
"=",
"project",
".",
"findType",
"(",
"JUnitCorePlugin",
".",
"JUNIT4_ANNOTATION_NAME",
")",
"!=",
"null",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"setJUnit4",
"(",
"isJunit4",
",",
"true",
")",
";",
"updateStatus",
"(",
"getStatusList",
"(",
")",
")",
";",
"}",
"private",
"IStatus",
"junit4Changed",
"(",
")",
"{",
"JUnitStatus",
"status",
"=",
"new",
"JUnitStatus",
"(",
")",
";",
"return",
"status",
";",
"}",
"public",
"void",
"setJUnit4",
"(",
"boolean",
"isJUnit4",
",",
"boolean",
"isEnabled",
")",
"{",
"fIsJunit4Enabled",
"=",
"isEnabled",
";",
"if",
"(",
"fJUnit4Toggle",
"!=",
"null",
"&&",
"!",
"fJUnit4Toggle",
".",
"isDisposed",
"(",
")",
")",
"{",
"fJUnit4Toggle",
".",
"setSelection",
"(",
"isJUnit4",
")",
";",
"fJUnit4Toggle",
".",
"setEnabled",
"(",
"isEnabled",
")",
";",
"}",
"internalSetJUnit4",
"(",
"isJUnit4",
")",
";",
"}",
"public",
"boolean",
"isJUnit4",
"(",
")",
"{",
"return",
"fIsJunit4",
";",
"}",
"private",
"void",
"internalSetJUnit4",
"(",
"boolean",
"isJUnit4",
")",
"{",
"fIsJunit4",
"=",
"isJUnit4",
";",
"fJunit4Status",
"=",
"junit4Changed",
"(",
")",
";",
"if",
"(",
"fIsJunit4",
")",
"{",
"setSuperClass",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"else",
"{",
"setSuperClass",
"(",
"getJUnit3TestSuperclassName",
"(",
")",
",",
"true",
")",
";",
"}",
"handleFieldChanged",
"(",
"JUNIT4TOGGLE",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"handleFieldChanged",
"(",
"String",
"fieldName",
")",
"{",
"super",
".",
"handleFieldChanged",
"(",
"fieldName",
")",
";",
"if",
"(",
"fieldName",
".",
"equals",
"(",
"CONTAINER",
")",
")",
"{",
"fClassUnderTestStatus",
"=",
"classUnderTestChanged",
"(",
")",
";",
"if",
"(",
"fClassUnderTestButton",
"!=",
"null",
"&&",
"!",
"fClassUnderTestButton",
".",
"isDisposed",
"(",
")",
")",
"{",
"fClassUnderTestButton",
".",
"setEnabled",
"(",
"getPackageFragmentRoot",
"(",
")",
"!=",
"null",
")",
";",
"}",
"fJunit4Status",
"=",
"junit4Changed",
"(",
")",
";",
"updateBuildPathMessage",
"(",
")",
";",
"}",
"else",
"if",
"(",
"fieldName",
".",
"equals",
"(",
"JUNIT4TOGGLE",
")",
")",
"{",
"updateBuildPathMessage",
"(",
")",
";",
"fMethodStubsButtons",
".",
"setEnabled",
"(",
"IDX_SETUP_CLASS",
",",
"isJUnit4",
"(",
")",
")",
";",
"fMethodStubsButtons",
".",
"setEnabled",
"(",
"IDX_TEARDOWN_CLASS",
",",
"isJUnit4",
"(",
")",
")",
";",
"fMethodStubsButtons",
".",
"setEnabled",
"(",
"IDX_CONSTRUCTOR",
",",
"!",
"isJUnit4",
"(",
")",
")",
";",
"}",
"updateStatus",
"(",
"getStatusList",
"(",
")",
")",
";",
"}",
"protected",
"IStatus",
"[",
"]",
"getStatusList",
"(",
")",
"{",
"return",
"new",
"IStatus",
"[",
"]",
"{",
"fContainerStatus",
",",
"fPackageStatus",
",",
"fTypeNameStatus",
",",
"fClassUnderTestStatus",
",",
"fModifierStatus",
",",
"fSuperClassStatus",
",",
"fJunit4Status",
"}",
";",
"}",
"public",
"void",
"createControl",
"(",
"Composite",
"parent",
")",
"{",
"initializeDialogUnits",
"(",
"parent",
")",
";",
"Composite",
"composite",
"=",
"new",
"Composite",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"int",
"nColumns",
"=",
"4",
";",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
")",
";",
"layout",
".",
"numColumns",
"=",
"nColumns",
";",
"composite",
".",
"setLayout",
"(",
"layout",
")",
";",
"createJUnit4Controls",
"(",
"composite",
",",
"nColumns",
")",
";",
"createContainerControls",
"(",
"composite",
",",
"nColumns",
")",
";",
"createPackageControls",
"(",
"composite",
",",
"nColumns",
")",
";",
"createSeparator",
"(",
"composite",
",",
"nColumns",
")",
";",
"createTypeNameControls",
"(",
"composite",
",",
"nColumns",
")",
";",
"createSuperClassControls",
"(",
"composite",
",",
"nColumns",
")",
";",
"createMethodStubSelectionControls",
"(",
"composite",
",",
"nColumns",
")",
";",
"createCommentControls",
"(",
"composite",
",",
"nColumns",
")",
";",
"createSeparator",
"(",
"composite",
",",
"nColumns",
")",
";",
"createClassUnderTestControls",
"(",
"composite",
",",
"nColumns",
")",
";",
"createBuildPathConfigureControls",
"(",
"composite",
",",
"nColumns",
")",
";",
"setControl",
"(",
"composite",
")",
";",
"String",
"classUnderTest",
"=",
"getClassUnderTestText",
"(",
")",
";",
"if",
"(",
"classUnderTest",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"setTypeName",
"(",
"Signature",
".",
"getSimpleName",
"(",
"classUnderTest",
")",
"+",
"TEST_SUFFIX",
",",
"true",
")",
";",
"}",
"Dialog",
".",
"applyDialogFont",
"(",
"composite",
")",
";",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getHelpSystem",
"(",
")",
".",
"setHelp",
"(",
"composite",
",",
"IJUnitHelpContextIds",
".",
"NEW_TESTCASE_WIZARD_PAGE",
")",
";",
"setFocus",
"(",
")",
";",
"}",
"protected",
"void",
"createMethodStubSelectionControls",
"(",
"Composite",
"composite",
",",
"int",
"nColumns",
")",
"{",
"LayoutUtil",
".",
"setHorizontalSpan",
"(",
"fMethodStubsButtons",
".",
"getLabelControl",
"(",
"composite",
")",
",",
"nColumns",
")",
";",
"LayoutUtil",
".",
"createEmptySpace",
"(",
"composite",
",",
"1",
")",
";",
"LayoutUtil",
".",
"setHorizontalSpan",
"(",
"fMethodStubsButtons",
".",
"getSelectionButtonsGroup",
"(",
"composite",
")",
",",
"nColumns",
"-",
"1",
")",
";",
"}",
"protected",
"void",
"createClassUnderTestControls",
"(",
"Composite",
"composite",
",",
"int",
"nColumns",
")",
"{",
"Label",
"classUnderTestLabel",
"=",
"new",
"Label",
"(",
"composite",
",",
"SWT",
".",
"LEFT",
"|",
"SWT",
".",
"WRAP",
")",
";",
"classUnderTestLabel",
".",
"setFont",
"(",
"composite",
".",
"getFont",
"(",
")",
")",
";",
"classUnderTestLabel",
".",
"setText",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_class_to_test_label",
")",
";",
"classUnderTestLabel",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
")",
")",
";",
"fClassUnderTestControl",
"=",
"new",
"Text",
"(",
"composite",
",",
"SWT",
".",
"SINGLE",
"|",
"SWT",
".",
"BORDER",
")",
";",
"fClassUnderTestControl",
".",
"setEnabled",
"(",
"true",
")",
";",
"fClassUnderTestControl",
".",
"setFont",
"(",
"composite",
".",
"getFont",
"(",
")",
")",
";",
"fClassUnderTestControl",
".",
"setText",
"(",
"fClassUnderTestText",
")",
";",
"fClassUnderTestControl",
".",
"addModifyListener",
"(",
"new",
"ModifyListener",
"(",
")",
"{",
"public",
"void",
"modifyText",
"(",
"ModifyEvent",
"e",
")",
"{",
"internalSetClassUnderText",
"(",
"(",
"(",
"Text",
")",
"e",
".",
"widget",
")",
".",
"getText",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"GridData",
"gd",
"=",
"new",
"GridData",
"(",
")",
";",
"gd",
".",
"horizontalAlignment",
"=",
"GridData",
".",
"FILL",
";",
"gd",
".",
"grabExcessHorizontalSpace",
"=",
"true",
";",
"gd",
".",
"horizontalSpan",
"=",
"nColumns",
"-",
"2",
";",
"fClassUnderTestControl",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"fClassUnderTestButton",
"=",
"new",
"Button",
"(",
"composite",
",",
"SWT",
".",
"PUSH",
")",
";",
"fClassUnderTestButton",
".",
"setText",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_class_to_test_browse",
")",
";",
"fClassUnderTestButton",
".",
"setEnabled",
"(",
"true",
")",
";",
"fClassUnderTestButton",
".",
"addSelectionListener",
"(",
"new",
"SelectionListener",
"(",
")",
"{",
"public",
"void",
"widgetDefaultSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"classToTestButtonPressed",
"(",
")",
";",
"}",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"classToTestButtonPressed",
"(",
")",
";",
"}",
"}",
")",
";",
"gd",
"=",
"new",
"GridData",
"(",
")",
";",
"gd",
".",
"horizontalAlignment",
"=",
"GridData",
".",
"FILL",
";",
"gd",
".",
"grabExcessHorizontalSpace",
"=",
"false",
";",
"gd",
".",
"horizontalSpan",
"=",
"1",
";",
"gd",
".",
"widthHint",
"=",
"LayoutUtil",
".",
"getButtonWidthHint",
"(",
"fClassUnderTestButton",
")",
";",
"fClassUnderTestButton",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"ControlContentAssistHelper",
".",
"createTextContentAssistant",
"(",
"fClassUnderTestControl",
",",
"fClassToTestCompletionProcessor",
")",
";",
"}",
"protected",
"void",
"createJUnit4Controls",
"(",
"Composite",
"composite",
",",
"int",
"nColumns",
")",
"{",
"Composite",
"inner",
"=",
"new",
"Composite",
"(",
"composite",
",",
"SWT",
".",
"NONE",
")",
";",
"inner",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"SWT",
".",
"FILL",
",",
"SWT",
".",
"CENTER",
",",
"false",
",",
"false",
",",
"nColumns",
",",
"1",
")",
")",
";",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
"2",
",",
"false",
")",
";",
"layout",
".",
"marginHeight",
"=",
"0",
";",
"layout",
".",
"marginWidth",
"=",
"0",
";",
"inner",
".",
"setLayout",
"(",
"layout",
")",
";",
"SelectionAdapter",
"listener",
"=",
"new",
"SelectionAdapter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"boolean",
"isSelected",
"=",
"(",
"(",
"Button",
")",
"e",
".",
"widget",
")",
".",
"getSelection",
"(",
")",
";",
"internalSetJUnit4",
"(",
"isSelected",
")",
";",
"}",
"}",
";",
"Button",
"junti3Toggle",
"=",
"new",
"Button",
"(",
"inner",
",",
"SWT",
".",
"RADIO",
")",
";",
"junti3Toggle",
".",
"setText",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_junit3_radio_label",
")",
";",
"junti3Toggle",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"GridData",
".",
"FILL",
",",
"GridData",
".",
"CENTER",
",",
"false",
",",
"false",
",",
"1",
",",
"1",
")",
")",
";",
"junti3Toggle",
".",
"setSelection",
"(",
"!",
"fIsJunit4",
")",
";",
"junti3Toggle",
".",
"setEnabled",
"(",
"fIsJunit4Enabled",
")",
";",
"fJUnit4Toggle",
"=",
"new",
"Button",
"(",
"inner",
",",
"SWT",
".",
"RADIO",
")",
";",
"fJUnit4Toggle",
".",
"setText",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_junit4_radio_label",
")",
";",
"fJUnit4Toggle",
".",
"setSelection",
"(",
"fIsJunit4",
")",
";",
"fJUnit4Toggle",
".",
"setEnabled",
"(",
"fIsJunit4Enabled",
")",
";",
"fJUnit4Toggle",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"GridData",
".",
"FILL",
",",
"GridData",
".",
"CENTER",
",",
"false",
",",
"false",
",",
"1",
",",
"1",
")",
")",
";",
"fJUnit4Toggle",
".",
"addSelectionListener",
"(",
"listener",
")",
";",
"}",
"protected",
"void",
"createBuildPathConfigureControls",
"(",
"Composite",
"composite",
",",
"int",
"nColumns",
")",
"{",
"Composite",
"inner",
"=",
"new",
"Composite",
"(",
"composite",
",",
"SWT",
".",
"NONE",
")",
";",
"inner",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"GridData",
".",
"FILL",
",",
"GridData",
".",
"FILL",
",",
"false",
",",
"false",
",",
"nColumns",
",",
"1",
")",
")",
";",
"GridLayout",
"layout",
"=",
"new",
"GridLayout",
"(",
"2",
",",
"false",
")",
";",
"layout",
".",
"marginWidth",
"=",
"0",
";",
"layout",
".",
"marginHeight",
"=",
"0",
";",
"inner",
".",
"setLayout",
"(",
"layout",
")",
";",
"fImage",
"=",
"new",
"Label",
"(",
"inner",
",",
"SWT",
".",
"NONE",
")",
";",
"fImage",
".",
"setImage",
"(",
"JFaceResources",
".",
"getImage",
"(",
"Dialog",
".",
"DLG_IMG_MESSAGE_WARNING",
")",
")",
";",
"fImage",
".",
"setLayoutData",
"(",
"new",
"GridData",
"(",
"GridData",
".",
"BEGINNING",
",",
"GridData",
".",
"BEGINNING",
",",
"false",
",",
"false",
",",
"1",
",",
"1",
")",
")",
";",
"fLink",
"=",
"new",
"Link",
"(",
"inner",
",",
"SWT",
".",
"WRAP",
")",
";",
"fLink",
".",
"setText",
"(",
"\"nn\"",
")",
";",
"fLink",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"e",
")",
"{",
"performBuildpathConfiguration",
"(",
"e",
".",
"text",
")",
";",
"}",
"}",
")",
";",
"GridData",
"gd",
"=",
"new",
"GridData",
"(",
"GridData",
".",
"FILL",
",",
"GridData",
".",
"BEGINNING",
",",
"true",
",",
"false",
",",
"1",
",",
"1",
")",
";",
"gd",
".",
"widthHint",
"=",
"convertWidthInCharsToPixels",
"(",
"60",
")",
";",
"fLink",
".",
"setLayoutData",
"(",
"gd",
")",
";",
"updateBuildPathMessage",
"(",
")",
";",
"}",
"private",
"void",
"performBuildpathConfiguration",
"(",
"Object",
"data",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"return",
";",
"}",
"IJavaProject",
"javaProject",
"=",
"root",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"\"a3\"",
".",
"equals",
"(",
"data",
")",
")",
"{",
"String",
"id",
"=",
"BUILD_PATH_PAGE_ID",
";",
"Map",
"input",
"=",
"new",
"HashMap",
"(",
")",
";",
"IClasspathEntry",
"newEntry",
"=",
"BuildPathSupport",
".",
"getJUnit3ClasspathEntry",
"(",
")",
";",
"input",
".",
"put",
"(",
"BUILD_PATH_KEY_ADD_ENTRY",
",",
"newEntry",
")",
";",
"input",
".",
"put",
"(",
"BUILD_PATH_BLOCK",
",",
"Boolean",
".",
"TRUE",
")",
";",
"PreferencesUtil",
".",
"createPropertyDialogOn",
"(",
"getShell",
"(",
")",
",",
"javaProject",
",",
"id",
",",
"new",
"String",
"[",
"]",
"{",
"id",
"}",
",",
"input",
")",
".",
"open",
"(",
")",
";",
"}",
"else",
"if",
"(",
"\"a4\"",
".",
"equals",
"(",
"data",
")",
")",
"{",
"String",
"id",
"=",
"BUILD_PATH_PAGE_ID",
";",
"Map",
"input",
"=",
"new",
"HashMap",
"(",
")",
";",
"IClasspathEntry",
"newEntry",
"=",
"BuildPathSupport",
".",
"getJUnit4ClasspathEntry",
"(",
")",
";",
"input",
".",
"put",
"(",
"BUILD_PATH_KEY_ADD_ENTRY",
",",
"newEntry",
")",
";",
"input",
".",
"put",
"(",
"BUILD_PATH_BLOCK",
",",
"Boolean",
".",
"TRUE",
")",
";",
"PreferencesUtil",
".",
"createPropertyDialogOn",
"(",
"getShell",
"(",
")",
",",
"javaProject",
",",
"id",
",",
"new",
"String",
"[",
"]",
"{",
"id",
"}",
",",
"input",
")",
".",
"open",
"(",
")",
";",
"}",
"else",
"if",
"(",
"\"b\"",
".",
"equals",
"(",
"data",
")",
")",
"{",
"String",
"id",
"=",
"BUILD_PATH_PAGE_ID",
";",
"Map",
"input",
"=",
"new",
"HashMap",
"(",
")",
";",
"input",
".",
"put",
"(",
"BUILD_PATH_BLOCK",
",",
"Boolean",
".",
"TRUE",
")",
";",
"PreferencesUtil",
".",
"createPropertyDialogOn",
"(",
"getShell",
"(",
")",
",",
"javaProject",
",",
"id",
",",
"new",
"String",
"[",
"]",
"{",
"id",
"}",
",",
"input",
")",
".",
"open",
"(",
")",
";",
"}",
"else",
"if",
"(",
"\"c\"",
".",
"equals",
"(",
"data",
")",
")",
"{",
"String",
"buildPath",
"=",
"BUILD_PATH_PAGE_ID",
";",
"String",
"complianceId",
"=",
"COMPLIANCE_PAGE_ID",
";",
"Map",
"input",
"=",
"new",
"HashMap",
"(",
")",
";",
"input",
".",
"put",
"(",
"BUILD_PATH_BLOCK",
",",
"Boolean",
".",
"TRUE",
")",
";",
"input",
".",
"put",
"(",
"KEY_NO_LINK",
",",
"Boolean",
".",
"TRUE",
")",
";",
"PreferencesUtil",
".",
"createPropertyDialogOn",
"(",
"getShell",
"(",
")",
",",
"javaProject",
",",
"complianceId",
",",
"new",
"String",
"[",
"]",
"{",
"buildPath",
",",
"complianceId",
"}",
",",
"data",
")",
".",
"open",
"(",
")",
";",
"}",
"updateBuildPathMessage",
"(",
")",
";",
"}",
"private",
"void",
"updateBuildPathMessage",
"(",
")",
"{",
"if",
"(",
"fLink",
"==",
"null",
"||",
"fLink",
".",
"isDisposed",
"(",
")",
")",
"{",
"return",
";",
"}",
"String",
"message",
"=",
"null",
";",
"IPackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"!=",
"null",
")",
"{",
"IJavaProject",
"project",
"=",
"root",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"project",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"isJUnit4",
"(",
")",
")",
"{",
"if",
"(",
"!",
"JUnitStubUtility",
".",
"is50OrHigher",
"(",
"project",
")",
")",
"{",
"message",
"=",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_linkedtext_java5required",
";",
"}",
"}",
"}",
"}",
"fLink",
".",
"setVisible",
"(",
"message",
"!=",
"null",
")",
";",
"fImage",
".",
"setVisible",
"(",
"message",
"!=",
"null",
")",
";",
"if",
"(",
"message",
"!=",
"null",
")",
"{",
"fLink",
".",
"setText",
"(",
"message",
")",
";",
"}",
"}",
"private",
"void",
"classToTestButtonPressed",
"(",
")",
"{",
"IType",
"type",
"=",
"chooseClassToTestType",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"setClassUnderTest",
"(",
"type",
".",
"getFullyQualifiedName",
"(",
"'.'",
")",
")",
";",
"}",
"}",
"private",
"IType",
"chooseClassToTestType",
"(",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"==",
"null",
")",
"return",
"null",
";",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"root",
".",
"getJavaProject",
"(",
")",
"}",
";",
"IJavaSearchScope",
"scope",
"=",
"SearchEngine",
".",
"createJavaSearchScope",
"(",
"elements",
")",
";",
"try",
"{",
"SelectionDialog",
"dialog",
"=",
"JavaUI",
".",
"createTypeDialog",
"(",
"getShell",
"(",
")",
",",
"getWizard",
"(",
")",
".",
"getContainer",
"(",
")",
",",
"scope",
",",
"IJavaElementSearchConstants",
".",
"CONSIDER_CLASSES_AND_ENUMS",
",",
"false",
",",
"getClassUnderTestText",
"(",
")",
")",
";",
"dialog",
".",
"setTitle",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_class_to_test_dialog_title",
")",
";",
"dialog",
".",
"setMessage",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_class_to_test_dialog_message",
")",
";",
"if",
"(",
"dialog",
".",
"open",
"(",
")",
"==",
"Window",
".",
"OK",
")",
"{",
"Object",
"[",
"]",
"resultArray",
"=",
"dialog",
".",
"getResult",
"(",
")",
";",
"if",
"(",
"resultArray",
"!=",
"null",
"&&",
"resultArray",
".",
"length",
">",
"0",
")",
"return",
"(",
"IType",
")",
"resultArray",
"[",
"0",
"]",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"JUnitCorePlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"@",
"Override",
"protected",
"IStatus",
"packageChanged",
"(",
")",
"{",
"IStatus",
"status",
"=",
"super",
".",
"packageChanged",
"(",
")",
";",
"fClassToTestCompletionProcessor",
".",
"setPackageFragment",
"(",
"getPackageFragment",
"(",
")",
")",
";",
"return",
"status",
";",
"}",
"protected",
"IStatus",
"classUnderTestChanged",
"(",
")",
"{",
"JUnitStatus",
"status",
"=",
"new",
"JUnitStatus",
"(",
")",
";",
"fClassUnderTest",
"=",
"null",
";",
"IPackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"return",
"status",
";",
"}",
"String",
"classToTestName",
"=",
"getClassUnderTestText",
"(",
")",
";",
"if",
"(",
"classToTestName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"status",
";",
"}",
"IStatus",
"val",
"=",
"JavaConventionsUtil",
".",
"validateJavaTypeName",
"(",
"classToTestName",
",",
"root",
")",
";",
"if",
"(",
"val",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"ERROR",
")",
"{",
"status",
".",
"setError",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_error_class_to_test_not_valid",
")",
";",
"return",
"status",
";",
"}",
"IPackageFragment",
"pack",
"=",
"getPackageFragment",
"(",
")",
";",
"try",
"{",
"IType",
"type",
"=",
"resolveClassNameToType",
"(",
"root",
".",
"getJavaProject",
"(",
")",
",",
"pack",
",",
"classToTestName",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"status",
".",
"setError",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_error_class_to_test_not_exist",
")",
";",
"return",
"status",
";",
"}",
"if",
"(",
"type",
".",
"isInterface",
"(",
")",
")",
"{",
"status",
".",
"setWarning",
"(",
"Messages",
".",
"format",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_warning_class_to_test_is_interface",
",",
"BasicElementLabels",
".",
"getJavaElementName",
"(",
"classToTestName",
")",
")",
")",
";",
"}",
"if",
"(",
"pack",
"!=",
"null",
"&&",
"!",
"JUnitStubUtility",
".",
"isVisible",
"(",
"type",
",",
"pack",
")",
")",
"{",
"status",
".",
"setWarning",
"(",
"Messages",
".",
"format",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_warning_class_to_test_not_visible",
",",
"BasicElementLabels",
".",
"getJavaElementName",
"(",
"classToTestName",
")",
")",
")",
";",
"}",
"fClassUnderTest",
"=",
"type",
";",
"fPage2",
".",
"setClassUnderTest",
"(",
"fClassUnderTest",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"status",
".",
"setError",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_error_class_to_test_not_valid",
")",
";",
"}",
"return",
"status",
";",
"}",
"public",
"String",
"getClassUnderTestText",
"(",
")",
"{",
"return",
"fClassUnderTestText",
";",
"}",
"public",
"IType",
"getClassUnderTest",
"(",
")",
"{",
"return",
"fClassUnderTest",
";",
"}",
"public",
"void",
"setClassUnderTest",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"fClassUnderTestControl",
"!=",
"null",
"&&",
"!",
"fClassUnderTestControl",
".",
"isDisposed",
"(",
")",
")",
"{",
"fClassUnderTestControl",
".",
"setText",
"(",
"name",
")",
";",
"}",
"internalSetClassUnderText",
"(",
"name",
")",
";",
"}",
"private",
"void",
"internalSetClassUnderText",
"(",
"String",
"name",
")",
"{",
"fClassUnderTestText",
"=",
"name",
";",
"fClassUnderTestStatus",
"=",
"classUnderTestChanged",
"(",
")",
";",
"handleFieldChanged",
"(",
"CLASS_UNDER_TEST",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"createTypeMembers",
"(",
"IType",
"type",
",",
"ImportsManager",
"imports",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_CONSTRUCTOR",
")",
")",
"createConstructor",
"(",
"type",
",",
"imports",
")",
";",
"if",
"(",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_SETUP_CLASS",
")",
")",
"{",
"createSetUpClass",
"(",
"type",
",",
"imports",
")",
";",
"}",
"if",
"(",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_TEARDOWN_CLASS",
")",
")",
"{",
"createTearDownClass",
"(",
"type",
",",
"imports",
")",
";",
"}",
"if",
"(",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_SETUP",
")",
")",
"{",
"createSetUp",
"(",
"type",
",",
"imports",
")",
";",
"}",
"if",
"(",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_TEARDOWN",
")",
")",
"{",
"createTearDown",
"(",
"type",
",",
"imports",
")",
";",
"}",
"if",
"(",
"fClassUnderTest",
"!=",
"null",
")",
"{",
"createTestMethodStubs",
"(",
"type",
",",
"imports",
")",
";",
"}",
"if",
"(",
"isJUnit4",
"(",
")",
")",
"{",
"imports",
".",
"addStaticImport",
"(",
"\"\"",
",",
"\"*\"",
",",
"false",
")",
";",
"}",
"}",
"private",
"void",
"createConstructor",
"(",
"IType",
"type",
",",
"ImportsManager",
"imports",
")",
"throws",
"CoreException",
"{",
"ITypeHierarchy",
"typeHierarchy",
"=",
"null",
";",
"IType",
"[",
"]",
"superTypes",
"=",
"null",
";",
"String",
"content",
";",
"IMethod",
"methodTemplate",
"=",
"null",
";",
"if",
"(",
"type",
".",
"exists",
"(",
")",
")",
"{",
"typeHierarchy",
"=",
"type",
".",
"newSupertypeHierarchy",
"(",
"null",
")",
";",
"superTypes",
"=",
"typeHierarchy",
".",
"getAllSuperclasses",
"(",
"type",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"superTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"superTypes",
"[",
"i",
"]",
".",
"exists",
"(",
")",
")",
"{",
"IMethod",
"constrMethod",
"=",
"superTypes",
"[",
"i",
"]",
".",
"getMethod",
"(",
"superTypes",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
"}",
")",
";",
"if",
"(",
"constrMethod",
".",
"exists",
"(",
")",
"&&",
"constrMethod",
".",
"isConstructor",
"(",
")",
")",
"{",
"methodTemplate",
"=",
"constrMethod",
";",
"break",
";",
"}",
"}",
"}",
"}",
"GenStubSettings",
"settings",
"=",
"JUnitStubUtility",
".",
"getCodeGenerationSettings",
"(",
"type",
".",
"getJavaProject",
"(",
")",
")",
";",
"settings",
".",
"createComments",
"=",
"isAddComments",
"(",
")",
";",
"if",
"(",
"methodTemplate",
"!=",
"null",
")",
"{",
"settings",
".",
"callSuper",
"=",
"true",
";",
"settings",
".",
"methodOverwrites",
"=",
"true",
";",
"content",
"=",
"JUnitStubUtility",
".",
"genStub",
"(",
"type",
".",
"getCompilationUnit",
"(",
")",
",",
"getTypeName",
"(",
")",
",",
"methodTemplate",
",",
"settings",
",",
"null",
",",
"imports",
")",
";",
"}",
"else",
"{",
"final",
"String",
"delimiter",
"=",
"getLineDelimiter",
"(",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"32",
")",
";",
"buffer",
".",
"append",
"(",
"\"public",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"getTypeName",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"'('",
")",
";",
"if",
"(",
"!",
"isJUnit4",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"imports",
".",
"addImport",
"(",
"\"\"",
")",
")",
".",
"append",
"(",
"\"",
"name\"",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\")",
"{\"",
")",
";",
"buffer",
".",
"append",
"(",
"delimiter",
")",
";",
"if",
"(",
"!",
"isJUnit4",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\"super(name);\"",
")",
".",
"append",
"(",
"delimiter",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"'}'",
")",
";",
"buffer",
".",
"append",
"(",
"delimiter",
")",
";",
"content",
"=",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"type",
".",
"createMethod",
"(",
"content",
",",
"null",
",",
"true",
",",
"null",
")",
";",
"}",
"private",
"IMethod",
"findInHierarchy",
"(",
"IType",
"type",
",",
"String",
"methodName",
")",
"throws",
"JavaModelException",
"{",
"ITypeHierarchy",
"typeHierarchy",
"=",
"null",
";",
"IType",
"[",
"]",
"superTypes",
"=",
"null",
";",
"if",
"(",
"type",
".",
"exists",
"(",
")",
")",
"{",
"typeHierarchy",
"=",
"type",
".",
"newSupertypeHierarchy",
"(",
"null",
")",
";",
"superTypes",
"=",
"typeHierarchy",
".",
"getAllSuperclasses",
"(",
"type",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"superTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"superTypes",
"[",
"i",
"]",
".",
"exists",
"(",
")",
")",
"{",
"IMethod",
"testMethod",
"=",
"superTypes",
"[",
"i",
"]",
".",
"getMethod",
"(",
"methodName",
",",
"new",
"String",
"[",
"]",
"{",
"}",
")",
";",
"if",
"(",
"testMethod",
".",
"exists",
"(",
")",
")",
"{",
"return",
"testMethod",
";",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"void",
"createSetupStubs",
"(",
"IType",
"type",
",",
"String",
"methodName",
",",
"boolean",
"isStatic",
",",
"String",
"annotationType",
",",
"ImportsManager",
"imports",
")",
"throws",
"CoreException",
"{",
"String",
"content",
"=",
"null",
";",
"IMethod",
"methodTemplate",
"=",
"findInHierarchy",
"(",
"type",
",",
"methodName",
")",
";",
"String",
"annotation",
"=",
"null",
";",
"if",
"(",
"isJUnit4",
"(",
")",
")",
"{",
"annotation",
"=",
"'@'",
"+",
"imports",
".",
"addImport",
"(",
"annotationType",
")",
";",
"}",
"GenStubSettings",
"settings",
"=",
"JUnitStubUtility",
".",
"getCodeGenerationSettings",
"(",
"type",
".",
"getJavaProject",
"(",
")",
")",
";",
"settings",
".",
"createComments",
"=",
"isAddComments",
"(",
")",
";",
"if",
"(",
"methodTemplate",
"!=",
"null",
")",
"{",
"settings",
".",
"callSuper",
"=",
"true",
";",
"settings",
".",
"methodOverwrites",
"=",
"true",
";",
"content",
"=",
"JUnitStubUtility",
".",
"genStub",
"(",
"type",
".",
"getCompilationUnit",
"(",
")",
",",
"getTypeName",
"(",
")",
",",
"methodTemplate",
",",
"settings",
",",
"annotation",
",",
"imports",
")",
";",
"}",
"else",
"{",
"final",
"String",
"delimiter",
"=",
"getLineDelimiter",
"(",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"settings",
".",
"createComments",
")",
"{",
"String",
"[",
"]",
"excSignature",
"=",
"{",
"Signature",
".",
"createTypeSignature",
"(",
"\"\"",
",",
"true",
")",
"}",
";",
"String",
"comment",
"=",
"CodeGeneration",
".",
"getMethodComment",
"(",
"type",
".",
"getCompilationUnit",
"(",
")",
",",
"type",
".",
"getElementName",
"(",
")",
",",
"methodName",
",",
"new",
"String",
"[",
"0",
"]",
",",
"excSignature",
",",
"Signature",
".",
"SIG_VOID",
",",
"null",
",",
"delimiter",
")",
";",
"if",
"(",
"comment",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"comment",
")",
";",
"}",
"}",
"if",
"(",
"annotation",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"annotation",
")",
".",
"append",
"(",
"delimiter",
")",
";",
"}",
"if",
"(",
"isJUnit4",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\"public",
"\"",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"\"protected",
"\"",
")",
";",
"}",
"if",
"(",
"isStatic",
")",
"{",
"buffer",
".",
"append",
"(",
"\"static",
"\"",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"void",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"methodName",
")",
";",
"buffer",
".",
"append",
"(",
"\"()",
"throws",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"imports",
".",
"addImport",
"(",
"\"\"",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"",
"{}\"",
")",
";",
"buffer",
".",
"append",
"(",
"delimiter",
")",
";",
"content",
"=",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"type",
".",
"createMethod",
"(",
"content",
",",
"null",
",",
"false",
",",
"null",
")",
";",
"}",
"private",
"void",
"createSetUp",
"(",
"IType",
"type",
",",
"ImportsManager",
"imports",
")",
"throws",
"CoreException",
"{",
"createSetupStubs",
"(",
"type",
",",
"\"setUp\"",
",",
"false",
",",
"\"\"",
",",
"imports",
")",
";",
"}",
"private",
"void",
"createTearDown",
"(",
"IType",
"type",
",",
"ImportsManager",
"imports",
")",
"throws",
"CoreException",
"{",
"createSetupStubs",
"(",
"type",
",",
"\"tearDown\"",
",",
"false",
",",
"\"\"",
",",
"imports",
")",
";",
"}",
"private",
"void",
"createSetUpClass",
"(",
"IType",
"type",
",",
"ImportsManager",
"imports",
")",
"throws",
"CoreException",
"{",
"createSetupStubs",
"(",
"type",
",",
"\"\"",
",",
"true",
",",
"\"\"",
",",
"imports",
")",
";",
"}",
"private",
"void",
"createTearDownClass",
"(",
"IType",
"type",
",",
"ImportsManager",
"imports",
")",
"throws",
"CoreException",
"{",
"createSetupStubs",
"(",
"type",
",",
"\"\"",
",",
"true",
",",
"\"\"",
",",
"imports",
")",
";",
"}",
"private",
"void",
"createTestMethodStubs",
"(",
"IType",
"type",
",",
"ImportsManager",
"imports",
")",
"throws",
"CoreException",
"{",
"IMethod",
"[",
"]",
"methods",
"=",
"fPage2",
".",
"getCheckedMethods",
"(",
")",
";",
"if",
"(",
"methods",
".",
"length",
"==",
"0",
")",
"return",
";",
"IMethod",
"[",
"]",
"allMethodsArray",
"=",
"fPage2",
".",
"getAllMethods",
"(",
")",
";",
"List",
"allMethods",
"=",
"new",
"ArrayList",
"(",
")",
";",
"allMethods",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"allMethodsArray",
")",
")",
";",
"List",
"overloadedMethods",
"=",
"getOverloadedMethods",
"(",
"allMethods",
")",
";",
"List",
"names",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methods",
".",
"length",
";",
"i",
"++",
")",
"{",
"IMethod",
"method",
"=",
"methods",
"[",
"i",
"]",
";",
"String",
"elementName",
"=",
"method",
".",
"getElementName",
"(",
")",
";",
"StringBuffer",
"name",
"=",
"new",
"StringBuffer",
"(",
"PREFIX",
")",
".",
"append",
"(",
"Character",
".",
"toUpperCase",
"(",
"elementName",
".",
"charAt",
"(",
"0",
")",
")",
")",
".",
"append",
"(",
"elementName",
".",
"substring",
"(",
"1",
")",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"final",
"boolean",
"contains",
"=",
"overloadedMethods",
".",
"contains",
"(",
"method",
")",
";",
"if",
"(",
"contains",
")",
"appendParameterNamesToMethodName",
"(",
"name",
",",
"method",
".",
"getParameterTypes",
"(",
")",
")",
";",
"replaceIllegalCharacters",
"(",
"name",
")",
";",
"String",
"testName",
"=",
"name",
".",
"toString",
"(",
")",
";",
"if",
"(",
"names",
".",
"contains",
"(",
"testName",
")",
")",
"{",
"int",
"suffix",
"=",
"1",
";",
"while",
"(",
"names",
".",
"contains",
"(",
"testName",
"+",
"Integer",
".",
"toString",
"(",
"suffix",
")",
")",
")",
"suffix",
"++",
";",
"name",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"suffix",
")",
")",
";",
"}",
"testName",
"=",
"name",
".",
"toString",
"(",
")",
";",
"names",
".",
"add",
"(",
"testName",
")",
";",
"if",
"(",
"isAddComments",
"(",
")",
")",
"{",
"appendMethodComment",
"(",
"buffer",
",",
"method",
")",
";",
"}",
"if",
"(",
"isJUnit4",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"'@'",
")",
".",
"append",
"(",
"imports",
".",
"addImport",
"(",
"JUnitCorePlugin",
".",
"JUNIT4_ANNOTATION_NAME",
")",
")",
".",
"append",
"(",
"getLineDelimiter",
"(",
")",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"public",
"\"",
")",
";",
"if",
"(",
"fPage2",
".",
"getCreateFinalMethodStubsButtonSelection",
"(",
")",
")",
"buffer",
".",
"append",
"(",
"\"final",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"void",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"testName",
")",
";",
"buffer",
".",
"append",
"(",
"\"()\"",
")",
";",
"appendTestMethodBody",
"(",
"buffer",
",",
"type",
".",
"getCompilationUnit",
"(",
")",
")",
";",
"type",
".",
"createMethod",
"(",
"buffer",
".",
"toString",
"(",
")",
",",
"null",
",",
"false",
",",
"null",
")",
";",
"}",
"}",
"private",
"void",
"replaceIllegalCharacters",
"(",
"StringBuffer",
"buffer",
")",
"{",
"char",
"character",
"=",
"0",
";",
"for",
"(",
"int",
"index",
"=",
"buffer",
".",
"length",
"(",
")",
"-",
"1",
";",
"index",
">=",
"0",
";",
"index",
"--",
")",
"{",
"character",
"=",
"buffer",
".",
"charAt",
"(",
"index",
")",
";",
"if",
"(",
"Character",
".",
"isWhitespace",
"(",
"character",
")",
")",
"buffer",
".",
"deleteCharAt",
"(",
"index",
")",
";",
"else",
"if",
"(",
"character",
"==",
"'<'",
")",
"buffer",
".",
"replace",
"(",
"index",
",",
"index",
"+",
"1",
",",
"OF_TAG",
")",
";",
"else",
"if",
"(",
"character",
"==",
"'?'",
")",
"buffer",
".",
"replace",
"(",
"index",
",",
"index",
"+",
"1",
",",
"QUESTION_MARK_TAG",
")",
";",
"else",
"if",
"(",
"!",
"Character",
".",
"isJavaIdentifierPart",
"(",
"character",
")",
")",
"buffer",
".",
"deleteCharAt",
"(",
"index",
")",
";",
"}",
"}",
"private",
"String",
"getLineDelimiter",
"(",
")",
"throws",
"JavaModelException",
"{",
"IType",
"classToTest",
"=",
"getClassUnderTest",
"(",
")",
";",
"if",
"(",
"classToTest",
"!=",
"null",
"&&",
"classToTest",
".",
"exists",
"(",
")",
"&&",
"classToTest",
".",
"getCompilationUnit",
"(",
")",
"!=",
"null",
")",
"return",
"classToTest",
".",
"getCompilationUnit",
"(",
")",
".",
"findRecommendedLineSeparator",
"(",
")",
";",
"return",
"getPackageFragment",
"(",
")",
".",
"findRecommendedLineSeparator",
"(",
")",
";",
"}",
"private",
"void",
"appendTestMethodBody",
"(",
"StringBuffer",
"buffer",
",",
"ICompilationUnit",
"targetCu",
")",
"throws",
"CoreException",
"{",
"final",
"String",
"delimiter",
"=",
"getLineDelimiter",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"'{'",
")",
".",
"append",
"(",
"delimiter",
")",
";",
"String",
"todoTask",
"=",
"\"\"",
";",
"if",
"(",
"fPage2",
".",
"isCreateTasks",
"(",
")",
")",
"{",
"String",
"todoTaskTag",
"=",
"JUnitStubUtility",
".",
"getTodoTaskTag",
"(",
"targetCu",
".",
"getJavaProject",
"(",
")",
")",
";",
"if",
"(",
"todoTaskTag",
"!=",
"null",
")",
"{",
"todoTask",
"=",
"\"",
"//",
"\"",
"+",
"todoTaskTag",
";",
"}",
"}",
"String",
"message",
"=",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_not_yet_implemented_string",
";",
"buffer",
".",
"append",
"(",
"Messages",
".",
"format",
"(",
"\"fail(\\\"{0}\\\");\"",
",",
"message",
")",
")",
".",
"append",
"(",
"todoTask",
")",
".",
"append",
"(",
"delimiter",
")",
";",
"buffer",
".",
"append",
"(",
"'}'",
")",
".",
"append",
"(",
"delimiter",
")",
";",
"}",
"private",
"void",
"appendParameterNamesToMethodName",
"(",
"StringBuffer",
"buffer",
",",
"String",
"[",
"]",
"parameters",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parameters",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"Signature",
".",
"getSimpleName",
"(",
"Signature",
".",
"toString",
"(",
"Signature",
".",
"getElementType",
"(",
"parameters",
"[",
"i",
"]",
")",
")",
")",
")",
";",
"final",
"char",
"character",
"=",
"buf",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"buf",
".",
"length",
"(",
")",
">",
"0",
"&&",
"!",
"Character",
".",
"isUpperCase",
"(",
"character",
")",
")",
"buf",
".",
"setCharAt",
"(",
"0",
",",
"Character",
".",
"toUpperCase",
"(",
"character",
")",
")",
";",
"buffer",
".",
"append",
"(",
"buf",
".",
"toString",
"(",
")",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"arrayCount",
"=",
"Signature",
".",
"getArrayCount",
"(",
"parameters",
"[",
"i",
"]",
")",
";",
"j",
"<",
"arrayCount",
";",
"j",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"\"Array\"",
")",
";",
"}",
"}",
"}",
"private",
"void",
"appendMethodComment",
"(",
"StringBuffer",
"buffer",
",",
"IMethod",
"method",
")",
"throws",
"JavaModelException",
"{",
"final",
"String",
"delimiter",
"=",
"getLineDelimiter",
"(",
")",
";",
"final",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"\"{@link",
"\"",
")",
";",
"JavaElementLabels",
".",
"getTypeLabel",
"(",
"method",
".",
"getDeclaringType",
"(",
")",
",",
"JavaElementLabels",
".",
"T_FULLY_QUALIFIED",
",",
"buf",
")",
";",
"buf",
".",
"append",
"(",
"'#'",
")",
";",
"buf",
".",
"append",
"(",
"method",
".",
"getElementName",
"(",
")",
")",
";",
"buf",
".",
"append",
"(",
"'('",
")",
";",
"String",
"[",
"]",
"paramTypes",
"=",
"JUnitStubUtility",
".",
"getParameterTypeNamesForSeeTag",
"(",
"method",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paramTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!=",
"0",
")",
"{",
"buf",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"buf",
".",
"append",
"(",
"paramTypes",
"[",
"i",
"]",
")",
";",
"}",
"buf",
".",
"append",
"(",
"')'",
")",
";",
"buf",
".",
"append",
"(",
"'}'",
")",
";",
"buffer",
".",
"append",
"(",
"\"/**\"",
")",
";",
"buffer",
".",
"append",
"(",
"delimiter",
")",
";",
"buffer",
".",
"append",
"(",
"\"",
"*",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"Messages",
".",
"format",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_comment_class_to_test",
",",
"buf",
".",
"toString",
"(",
")",
")",
")",
";",
"buffer",
".",
"append",
"(",
"delimiter",
")",
";",
"buffer",
".",
"append",
"(",
"\"",
"*/\"",
")",
";",
"buffer",
".",
"append",
"(",
"delimiter",
")",
";",
"}",
"private",
"List",
"getOverloadedMethods",
"(",
"List",
"allMethods",
")",
"{",
"List",
"overloadedMethods",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allMethods",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"IMethod",
"current",
"=",
"(",
"IMethod",
")",
"allMethods",
".",
"get",
"(",
"i",
")",
";",
"String",
"currentName",
"=",
"current",
".",
"getElementName",
"(",
")",
";",
"boolean",
"currentAdded",
"=",
"false",
";",
"for",
"(",
"ListIterator",
"iter",
"=",
"allMethods",
".",
"listIterator",
"(",
"i",
"+",
"1",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"IMethod",
"iterMethod",
"=",
"(",
"IMethod",
")",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"iterMethod",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"currentName",
")",
")",
"{",
"if",
"(",
"!",
"currentAdded",
")",
"{",
"overloadedMethods",
".",
"add",
"(",
"current",
")",
";",
"currentAdded",
"=",
"true",
";",
"}",
"overloadedMethods",
".",
"add",
"(",
"iterMethod",
")",
";",
"iter",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}",
"return",
"overloadedMethods",
";",
"}",
"@",
"Override",
"public",
"void",
"setVisible",
"(",
"boolean",
"visible",
")",
"{",
"super",
".",
"setVisible",
"(",
"visible",
")",
";",
"if",
"(",
"!",
"visible",
")",
"{",
"saveWidgetValues",
"(",
")",
";",
"}",
"}",
"protected",
"IStatus",
"validateIfJUnitProject",
"(",
")",
"{",
"JUnitStatus",
"status",
"=",
"new",
"JUnitStatus",
"(",
")",
";",
"IPackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"!=",
"null",
")",
"{",
"try",
"{",
"IJavaProject",
"project",
"=",
"root",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"project",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"isJUnit4",
"(",
")",
")",
"{",
"if",
"(",
"!",
"JUnitStubUtility",
".",
"is50OrHigher",
"(",
"project",
")",
")",
"{",
"status",
".",
"setError",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_error_java5required",
")",
";",
"return",
"status",
";",
"}",
"if",
"(",
"project",
".",
"findType",
"(",
"JUnitCorePlugin",
".",
"JUNIT4_ANNOTATION_NAME",
")",
"==",
"null",
")",
"{",
"status",
".",
"setWarning",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne__error_junit4NotOnbuildpath",
")",
";",
"return",
"status",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"project",
".",
"findType",
"(",
"JUnitCorePlugin",
".",
"TEST_SUPERCLASS_NAME",
")",
"==",
"null",
")",
"{",
"status",
".",
"setWarning",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_error_junitNotOnbuildpath",
")",
";",
"return",
"status",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"return",
"status",
";",
"}",
"@",
"Override",
"protected",
"IStatus",
"superClassChanged",
"(",
")",
"{",
"if",
"(",
"isJUnit4",
"(",
")",
")",
"{",
"return",
"new",
"JUnitStatus",
"(",
")",
";",
"}",
"String",
"superClassName",
"=",
"getSuperClass",
"(",
")",
";",
"JUnitStatus",
"status",
"=",
"new",
"JUnitStatus",
"(",
")",
";",
"if",
"(",
"superClassName",
"==",
"null",
"||",
"superClassName",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"status",
".",
"setError",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_error_superclass_empty",
")",
";",
"return",
"status",
";",
"}",
"if",
"(",
"getPackageFragmentRoot",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"IType",
"type",
"=",
"resolveClassNameToType",
"(",
"getPackageFragmentRoot",
"(",
")",
".",
"getJavaProject",
"(",
")",
",",
"getPackageFragment",
"(",
")",
",",
"superClassName",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"status",
".",
"setWarning",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_error_superclass_not_exist",
")",
";",
"return",
"status",
";",
"}",
"if",
"(",
"type",
".",
"isInterface",
"(",
")",
")",
"{",
"status",
".",
"setError",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_error_superclass_is_interface",
")",
";",
"return",
"status",
";",
"}",
"if",
"(",
"!",
"TestSearchEngine",
".",
"isTestImplementor",
"(",
"type",
")",
")",
"{",
"status",
".",
"setError",
"(",
"Messages",
".",
"format",
"(",
"WizardMessages",
".",
"NewTestCaseWizardPageOne_error_superclass_not_implementing_test_interface",
",",
"BasicElementLabels",
".",
"getJavaElementName",
"(",
"JUnitCorePlugin",
".",
"TEST_INTERFACE_NAME",
")",
")",
")",
";",
"return",
"status",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"JUnitCorePlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"}",
"return",
"status",
";",
"}",
"@",
"Override",
"public",
"boolean",
"canFlipToNextPage",
"(",
")",
"{",
"return",
"super",
".",
"canFlipToNextPage",
"(",
")",
"&&",
"getClassUnderTest",
"(",
")",
"!=",
"null",
";",
"}",
"private",
"IType",
"resolveClassNameToType",
"(",
"IJavaProject",
"jproject",
",",
"IPackageFragment",
"pack",
",",
"String",
"classToTestName",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"jproject",
".",
"exists",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"IType",
"type",
"=",
"jproject",
".",
"findType",
"(",
"classToTestName",
")",
";",
"if",
"(",
"type",
"==",
"null",
"&&",
"pack",
"!=",
"null",
"&&",
"!",
"pack",
".",
"isDefaultPackage",
"(",
")",
")",
"{",
"type",
"=",
"jproject",
".",
"findType",
"(",
"pack",
".",
"getElementName",
"(",
")",
",",
"classToTestName",
")",
";",
"}",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"type",
"=",
"jproject",
".",
"findType",
"(",
"\"java.lang\"",
",",
"classToTestName",
")",
";",
"}",
"return",
"type",
";",
"}",
"private",
"void",
"restoreWidgetValues",
"(",
")",
"{",
"IDialogSettings",
"settings",
"=",
"getDialogSettings",
"(",
")",
";",
"if",
"(",
"settings",
"!=",
"null",
")",
"{",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_SETUP",
",",
"settings",
".",
"getBoolean",
"(",
"STORE_SETUP",
")",
")",
";",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_TEARDOWN",
",",
"settings",
".",
"getBoolean",
"(",
"STORE_TEARDOWN",
")",
")",
";",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_SETUP_CLASS",
",",
"settings",
".",
"getBoolean",
"(",
"STORE_SETUP_CLASS",
")",
")",
";",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_TEARDOWN_CLASS",
",",
"settings",
".",
"getBoolean",
"(",
"STORE_TEARDOWN_CLASS",
")",
")",
";",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_CONSTRUCTOR",
",",
"settings",
".",
"getBoolean",
"(",
"STORE_CONSTRUCTOR",
")",
")",
";",
"}",
"else",
"{",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_SETUP",
",",
"false",
")",
";",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_TEARDOWN",
",",
"false",
")",
";",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_SETUP_CLASS",
",",
"false",
")",
";",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_TEARDOWN_CLASS",
",",
"false",
")",
";",
"fMethodStubsButtons",
".",
"setSelection",
"(",
"IDX_CONSTRUCTOR",
",",
"false",
")",
";",
"}",
"}",
"private",
"void",
"saveWidgetValues",
"(",
")",
"{",
"IDialogSettings",
"settings",
"=",
"getDialogSettings",
"(",
")",
";",
"if",
"(",
"settings",
"!=",
"null",
")",
"{",
"settings",
".",
"put",
"(",
"STORE_SETUP",
",",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_SETUP",
")",
")",
";",
"settings",
".",
"put",
"(",
"STORE_TEARDOWN",
",",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_TEARDOWN",
")",
")",
";",
"settings",
".",
"put",
"(",
"STORE_SETUP_CLASS",
",",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_SETUP_CLASS",
")",
")",
";",
"settings",
".",
"put",
"(",
"STORE_TEARDOWN_CLASS",
",",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_TEARDOWN_CLASS",
")",
")",
";",
"settings",
".",
"put",
"(",
"STORE_CONSTRUCTOR",
",",
"fMethodStubsButtons",
".",
"isSelected",
"(",
"IDX_CONSTRUCTOR",
")",
")",
";",
"}",
"}",
"protected",
"String",
"getJUnit3TestSuperclassName",
"(",
")",
"{",
"return",
"JUnitCorePlugin",
".",
"TEST_SUPERCLASS_NAME",
";",
"}",
"}",
"</s>"
] |
6,267 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"internal",
".",
"ui",
".",
"viewers",
".",
"model",
".",
"provisional",
".",
"ILabelUpdate",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"core",
".",
"IJavaStackFrame",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"variables",
".",
"JavaStackFrameLabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"IPropertyChangeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"PropertyChangeEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"RGB",
";",
"class",
"GroovyJavaStackFrameLabelProvider",
"extends",
"JavaStackFrameLabelProvider",
"implements",
"IPropertyChangeListener",
"{",
"private",
"boolean",
"isEnabled",
";",
"private",
"String",
"[",
"]",
"filteredList",
";",
"private",
"IPreferenceStore",
"preferenceStore",
";",
"public",
"GroovyJavaStackFrameLabelProvider",
"(",
")",
"{",
"preferenceStore",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"isEnabled",
"=",
"preferenceStore",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FILTER_STACK",
")",
";",
"filteredList",
"=",
"computeFilteredList",
"(",
")",
";",
"}",
"private",
"String",
"[",
"]",
"computeFilteredList",
"(",
")",
"{",
"String",
"filter",
"=",
"preferenceStore",
".",
"getString",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FILTER_LIST",
")",
";",
"if",
"(",
"filter",
"!=",
"null",
")",
"{",
"return",
"filter",
".",
"split",
"(",
"\",\"",
")",
";",
"}",
"else",
"{",
"return",
"new",
"String",
"[",
"0",
"]",
";",
"}",
"}",
"@",
"Override",
"protected",
"void",
"retrieveLabel",
"(",
"ILabelUpdate",
"update",
")",
"throws",
"CoreException",
"{",
"super",
".",
"retrieveLabel",
"(",
"update",
")",
";",
"if",
"(",
"isEnabled",
"&&",
"!",
"update",
".",
"isCanceled",
"(",
")",
")",
"{",
"Object",
"element",
"=",
"update",
".",
"getElement",
"(",
")",
";",
"if",
"(",
"element",
"instanceof",
"IJavaStackFrame",
")",
"{",
"IJavaStackFrame",
"frame",
"=",
"(",
"IJavaStackFrame",
")",
"element",
";",
"if",
"(",
"isFiltered",
"(",
"frame",
".",
"getDeclaringTypeName",
"(",
")",
")",
")",
"{",
"try",
"{",
"update",
".",
"setForeground",
"(",
"new",
"RGB",
"(",
"200",
",",
"200",
",",
"200",
")",
",",
"0",
")",
";",
"}",
"catch",
"(",
"ArrayIndexOutOfBoundsException",
"e",
")",
"{",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"}",
"private",
"boolean",
"isFiltered",
"(",
"String",
"qualifiedName",
")",
"{",
"for",
"(",
"String",
"filter",
":",
"filteredList",
")",
"{",
"if",
"(",
"qualifiedName",
".",
"startsWith",
"(",
"filter",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"void",
"propertyChange",
"(",
"PropertyChangeEvent",
"event",
")",
"{",
"if",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FILTER_STACK",
".",
"equals",
"(",
"event",
".",
"getProperty",
"(",
")",
")",
")",
"{",
"isEnabled",
"=",
"preferenceStore",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FILTER_STACK",
")",
";",
"}",
"else",
"if",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FILTER_LIST",
".",
"equals",
"(",
"event",
".",
"getProperty",
"(",
")",
")",
")",
"{",
"filteredList",
"=",
"computeFilteredList",
"(",
")",
";",
"}",
"}",
"void",
"connect",
"(",
")",
"{",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
".",
"addPropertyChangeListener",
"(",
"this",
")",
";",
"}",
"void",
"disconnect",
"(",
")",
"{",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
".",
"removePropertyChangeListener",
"(",
"this",
")",
";",
"}",
"}",
"</s>"
] |
6,268 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"DebugPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"model",
".",
"IBreakpoint",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"actions",
".",
"IToggleBreakpointsTargetExtension",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClassFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"core",
".",
"IJavaLineBreakpoint",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"core",
".",
"JDIDebugModel",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"BreakpointUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"JDIDebugUIPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"actions",
".",
"ActionDelegateHelper",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IStatusLineManager",
";",
"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",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"osgi",
".",
"util",
".",
"NLS",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"IDocumentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"IEditorStatusLine",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"ITextEditor",
";",
"public",
"class",
"ToggleBreakpointAdapter",
"implements",
"IToggleBreakpointsTargetExtension",
"{",
"public",
"final",
"static",
"Object",
"TOGGLE_BREAKPOINT_FAMILY",
"=",
"new",
"Object",
"(",
")",
";",
"public",
"ToggleBreakpointAdapter",
"(",
")",
"{",
"ActionDelegateHelper",
".",
"getDefault",
"(",
")",
";",
"}",
"protected",
"void",
"report",
"(",
"final",
"String",
"message",
",",
"final",
"IWorkbenchPart",
"part",
")",
"{",
"JDIDebugUIPlugin",
".",
"getStandardDisplay",
"(",
")",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"IEditorStatusLine",
"statusLine",
"=",
"(",
"IEditorStatusLine",
")",
"part",
".",
"getAdapter",
"(",
"IEditorStatusLine",
".",
"class",
")",
";",
"if",
"(",
"statusLine",
"!=",
"null",
")",
"{",
"if",
"(",
"message",
"!=",
"null",
")",
"{",
"statusLine",
".",
"setMessage",
"(",
"true",
",",
"message",
",",
"null",
")",
";",
"}",
"else",
"{",
"statusLine",
".",
"setMessage",
"(",
"true",
",",
"null",
",",
"null",
")",
";",
"}",
"}",
"if",
"(",
"message",
"!=",
"null",
"&&",
"JDIDebugUIPlugin",
".",
"getActiveWorkbenchShell",
"(",
")",
"!=",
"null",
")",
"{",
"JDIDebugUIPlugin",
".",
"getActiveWorkbenchShell",
"(",
")",
".",
"getDisplay",
"(",
")",
".",
"beep",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"protected",
"IType",
"getType",
"(",
"ITextSelection",
"selection",
")",
"{",
"IMember",
"member",
"=",
"ActionDelegateHelper",
".",
"getDefault",
"(",
")",
".",
"getCurrentMember",
"(",
"selection",
")",
";",
"IType",
"type",
"=",
"null",
";",
"if",
"(",
"member",
"instanceof",
"IType",
")",
"{",
"type",
"=",
"(",
"IType",
")",
"member",
";",
"}",
"else",
"if",
"(",
"member",
"!=",
"null",
")",
"{",
"type",
"=",
"member",
".",
"getDeclaringType",
"(",
")",
";",
"}",
"try",
"{",
"while",
"(",
"type",
"!=",
"null",
"&&",
"!",
"type",
".",
"isBinary",
"(",
")",
"&&",
"type",
".",
"isLocal",
"(",
")",
")",
"{",
"type",
"=",
"type",
".",
"getDeclaringType",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"JDIDebugUIPlugin",
".",
"log",
"(",
"e",
")",
";",
"}",
"return",
"type",
";",
"}",
"public",
"void",
"toggleLineBreakpoints",
"(",
"IWorkbenchPart",
"part",
",",
"ISelection",
"selection",
")",
"throws",
"CoreException",
"{",
"toggleLineBreakpoints",
"(",
"part",
",",
"selection",
",",
"false",
")",
";",
"}",
"public",
"void",
"toggleLineBreakpoints",
"(",
"final",
"IWorkbenchPart",
"part",
",",
"final",
"ISelection",
"selection",
",",
"final",
"boolean",
"bestMatch",
")",
"{",
"Job",
"job",
"=",
"new",
"Job",
"(",
"\"\"",
")",
"{",
"@",
"Override",
"public",
"boolean",
"belongsTo",
"(",
"Object",
"family",
")",
"{",
"return",
"family",
"==",
"TOGGLE_BREAKPOINT_FAMILY",
";",
"}",
"@",
"Override",
"protected",
"IStatus",
"run",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"ITextSelection",
")",
"{",
"if",
"(",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"{",
"return",
"Status",
".",
"CANCEL_STATUS",
";",
"}",
"report",
"(",
"null",
",",
"part",
")",
";",
"IEditorPart",
"editorPart",
"=",
"(",
"IEditorPart",
")",
"part",
";",
"ITextSelection",
"textSelection",
"=",
"(",
"ITextSelection",
")",
"selection",
";",
"IType",
"type",
"=",
"getType",
"(",
"textSelection",
")",
";",
"IEditorInput",
"editorInput",
"=",
"editorPart",
".",
"getEditorInput",
"(",
")",
";",
"IDocumentProvider",
"documentProvider",
"=",
"(",
"(",
"ITextEditor",
")",
"editorPart",
")",
".",
"getDocumentProvider",
"(",
")",
";",
"if",
"(",
"documentProvider",
"==",
"null",
")",
"{",
"return",
"Status",
".",
"CANCEL_STATUS",
";",
"}",
"IDocument",
"document",
"=",
"documentProvider",
".",
"getDocument",
"(",
"editorInput",
")",
";",
"int",
"lineNumber",
"=",
"textSelection",
".",
"getStartLine",
"(",
")",
"+",
"1",
";",
"int",
"offset",
"=",
"textSelection",
".",
"getOffset",
"(",
")",
";",
"try",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"IClassFile",
"classFile",
"=",
"(",
"IClassFile",
")",
"editorInput",
".",
"getAdapter",
"(",
"IClassFile",
".",
"class",
")",
";",
"if",
"(",
"classFile",
"!=",
"null",
")",
"{",
"type",
"=",
"classFile",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
".",
"getDeclaringType",
"(",
")",
"!=",
"null",
")",
"{",
"ISourceRange",
"sourceRange",
"=",
"type",
".",
"getSourceRange",
"(",
")",
";",
"int",
"start",
"=",
"sourceRange",
".",
"getOffset",
"(",
")",
";",
"int",
"end",
"=",
"start",
"+",
"sourceRange",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"offset",
"<",
"start",
"||",
"offset",
">",
"end",
")",
"{",
"IStatusLineManager",
"statusLine",
"=",
"editorPart",
".",
"getEditorSite",
"(",
")",
".",
"getActionBars",
"(",
")",
".",
"getStatusLineManager",
"(",
")",
";",
"statusLine",
".",
"setErrorMessage",
"(",
"NLS",
".",
"bind",
"(",
"\"\"",
",",
"new",
"String",
"[",
"]",
"{",
"type",
".",
"getTypeQualifiedName",
"(",
")",
"}",
")",
")",
";",
"Display",
".",
"getCurrent",
"(",
")",
".",
"beep",
"(",
")",
";",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"}",
"}",
"}",
"String",
"typeName",
"=",
"null",
";",
"IResource",
"resource",
"=",
"null",
";",
"Map",
"attributes",
"=",
"new",
"HashMap",
"(",
"10",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"resource",
"=",
"getResource",
"(",
"editorPart",
")",
";",
"if",
"(",
"editorPart",
"instanceof",
"ITextEditor",
")",
"{",
"ModuleNode",
"node",
"=",
"getModuleNode",
"(",
"(",
"ITextEditor",
")",
"editorPart",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"for",
"(",
"ClassNode",
"clazz",
":",
"(",
"Iterable",
"<",
"ClassNode",
">",
")",
"node",
".",
"getClasses",
"(",
")",
")",
"{",
"int",
"begin",
"=",
"clazz",
".",
"getStart",
"(",
")",
";",
"int",
"end",
"=",
"clazz",
".",
"getEnd",
"(",
")",
";",
"if",
"(",
"offset",
">=",
"begin",
"&&",
"offset",
"<=",
"end",
"&&",
"!",
"clazz",
".",
"isInterface",
"(",
")",
")",
"{",
"typeName",
"=",
"clazz",
".",
"getName",
"(",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"typeName",
"==",
"null",
")",
"{",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"(",
"IFile",
")",
"resource",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"IType",
"[",
"]",
"types",
"=",
"unit",
".",
"getAllTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"int",
"begin",
"=",
"types",
"[",
"i",
"]",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
";",
"int",
"end",
"=",
"begin",
"+",
"types",
"[",
"i",
"]",
".",
"getSourceRange",
"(",
")",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"offset",
">=",
"begin",
"&&",
"offset",
"<=",
"end",
"&&",
"!",
"types",
"[",
"i",
"]",
".",
"isInterface",
"(",
")",
")",
"{",
"typeName",
"=",
"types",
"[",
"i",
"]",
".",
"getPackageFragment",
"(",
")",
".",
"getElementName",
"(",
")",
"+",
"\".\"",
"+",
"types",
"[",
"i",
"]",
".",
"getTypeQualifiedName",
"(",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"{",
"typeName",
"=",
"type",
".",
"getFullyQualifiedName",
"(",
")",
";",
"int",
"index",
"=",
"typeName",
".",
"indexOf",
"(",
"'$'",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"typeName",
"=",
"typeName",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"}",
"resource",
"=",
"BreakpointUtils",
".",
"getBreakpointResource",
"(",
"type",
")",
";",
"try",
"{",
"IRegion",
"line",
"=",
"document",
".",
"getLineInformation",
"(",
"lineNumber",
"-",
"1",
")",
";",
"int",
"start",
"=",
"line",
".",
"getOffset",
"(",
")",
";",
"int",
"end",
"=",
"start",
"+",
"line",
".",
"getLength",
"(",
")",
"-",
"1",
";",
"BreakpointUtils",
".",
"addJavaBreakpointAttributesWithMemberDetails",
"(",
"attributes",
",",
"type",
",",
"start",
",",
"end",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"ble",
")",
"{",
"JDIDebugUIPlugin",
".",
"log",
"(",
"ble",
")",
";",
"}",
"}",
"if",
"(",
"typeName",
"!=",
"null",
"&&",
"resource",
"!=",
"null",
")",
"{",
"IJavaLineBreakpoint",
"existingBreakpoint",
"=",
"JDIDebugModel",
".",
"lineBreakpointExists",
"(",
"resource",
",",
"typeName",
",",
"lineNumber",
")",
";",
"if",
"(",
"existingBreakpoint",
"!=",
"null",
")",
"{",
"removeBreakpoint",
"(",
"existingBreakpoint",
",",
"true",
")",
";",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"createLineBreakpoint",
"(",
"resource",
",",
"typeName",
",",
"offset",
",",
"lineNumber",
",",
"-",
"1",
",",
"-",
"1",
",",
"0",
",",
"true",
",",
"attributes",
",",
"document",
",",
"bestMatch",
",",
"type",
",",
"editorPart",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"return",
"ce",
".",
"getStatus",
"(",
")",
";",
"}",
"}",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"}",
";",
"job",
".",
"schedule",
"(",
")",
";",
"}",
"private",
"void",
"createLineBreakpoint",
"(",
"IResource",
"resource",
",",
"String",
"typeName",
",",
"int",
"offset",
",",
"int",
"lineNumber",
",",
"int",
"charStart",
",",
"int",
"charEnd",
",",
"int",
"hitCount",
",",
"boolean",
"register",
",",
"Map",
"attributes",
",",
"IDocument",
"document",
",",
"boolean",
"bestMatch",
",",
"IType",
"type",
",",
"IEditorPart",
"editorPart",
")",
"throws",
"CoreException",
"{",
"IJavaLineBreakpoint",
"breakpoint",
"=",
"JDIDebugModel",
".",
"createLineBreakpoint",
"(",
"resource",
",",
"typeName",
",",
"lineNumber",
",",
"charStart",
",",
"charEnd",
",",
"hitCount",
",",
"register",
",",
"attributes",
")",
";",
"new",
"BreakpointLocationVerifierJob",
"(",
"breakpoint",
",",
"lineNumber",
",",
"typeName",
",",
"type",
",",
"resource",
",",
"editorPart",
")",
".",
"schedule",
"(",
")",
";",
"}",
"public",
"boolean",
"canToggleLineBreakpoints",
"(",
"IWorkbenchPart",
"part",
",",
"ISelection",
"selection",
")",
"{",
"return",
"selection",
"instanceof",
"ITextSelection",
";",
"}",
"public",
"void",
"toggleMethodBreakpoints",
"(",
"final",
"IWorkbenchPart",
"part",
",",
"final",
"ISelection",
"finalSelection",
")",
"{",
"}",
"private",
"void",
"removeBreakpoint",
"(",
"IBreakpoint",
"breakpoint",
",",
"boolean",
"delete",
")",
"throws",
"CoreException",
"{",
"DebugPlugin",
".",
"getDefault",
"(",
")",
".",
"getBreakpointManager",
"(",
")",
".",
"removeBreakpoint",
"(",
"breakpoint",
",",
"delete",
")",
";",
"}",
"public",
"boolean",
"canToggleMethodBreakpoints",
"(",
"IWorkbenchPart",
"part",
",",
"ISelection",
"selection",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"ModuleNode",
"getModuleNode",
"(",
"ITextEditor",
"editor",
")",
"throws",
"CoreException",
"{",
"IEditorInput",
"editorInput",
"=",
"editor",
".",
"getEditorInput",
"(",
")",
";",
"ICompilationUnit",
"unit",
"=",
"(",
"ICompilationUnit",
")",
"editorInput",
".",
"getAdapter",
"(",
"ICompilationUnit",
".",
"class",
")",
";",
"if",
"(",
"unit",
"==",
"null",
")",
"{",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"editorInput",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"}",
"}",
"if",
"(",
"!",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
")",
"{",
"throw",
"new",
"CoreException",
"(",
"Status",
".",
"CANCEL_STATUS",
")",
";",
"}",
"return",
"(",
"(",
"GroovyCompilationUnit",
")",
"unit",
")",
".",
"getModuleNode",
"(",
")",
";",
"}",
"public",
"void",
"toggleWatchpoints",
"(",
"final",
"IWorkbenchPart",
"part",
",",
"final",
"ISelection",
"finalSelection",
")",
"{",
"}",
"protected",
"static",
"IResource",
"getResource",
"(",
"IEditorPart",
"editor",
")",
"{",
"IEditorInput",
"editorInput",
"=",
"editor",
".",
"getEditorInput",
"(",
")",
";",
"IResource",
"resource",
"=",
"(",
"IResource",
")",
"editorInput",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"resource",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"}",
"return",
"resource",
";",
"}",
"public",
"boolean",
"canToggleWatchpoints",
"(",
"IWorkbenchPart",
"part",
",",
"ISelection",
"selection",
")",
"{",
"return",
"false",
";",
"}",
"public",
"void",
"toggleBreakpoints",
"(",
"IWorkbenchPart",
"part",
",",
"ISelection",
"selection",
")",
"throws",
"CoreException",
"{",
"toggleLineBreakpoints",
"(",
"part",
",",
"selection",
",",
"true",
")",
";",
"}",
"public",
"boolean",
"canToggleBreakpoints",
"(",
"IWorkbenchPart",
"part",
",",
"ISelection",
"selection",
")",
"{",
"return",
"canToggleLineBreakpoints",
"(",
"part",
",",
"selection",
")",
";",
"}",
"}",
"</s>"
] |
6,269 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"DebugPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"IJDIPreferencesConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"JDIDebugUIPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"JavaDebugOptionsManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"public",
"class",
"GroovyDebugOptionsEnforcer",
"{",
"private",
"final",
"static",
"String",
"[",
"]",
"DEFAULT_GROOVY_STEP_FILTERS",
"=",
"{",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"sun.misc.*\"",
",",
"\"groovy.ui.*\"",
",",
"\"\"",
"}",
";",
"private",
"IPreferenceStore",
"preferenceStore",
";",
"public",
"GroovyDebugOptionsEnforcer",
"(",
")",
"{",
"preferenceStore",
"=",
"JDIDebugUIPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"}",
"public",
"void",
"force",
"(",
")",
"{",
"forceLogicalStructure",
"(",
")",
";",
"forceStepThroughFilters",
"(",
")",
";",
"forceUseStepFilters",
"(",
")",
";",
"forceGroovyStepFilters",
"(",
")",
";",
"forceDetailFormatter",
"(",
")",
";",
"}",
"private",
"void",
"forceDetailFormatter",
"(",
")",
"{",
"new",
"ForceDetailFormatter",
"(",
")",
".",
"forceReferenceFormatter",
"(",
")",
";",
"}",
"private",
"void",
"forceLogicalStructure",
"(",
")",
"{",
"}",
"private",
"void",
"forceStepThroughFilters",
"(",
")",
"{",
"preferenceStore",
".",
"setValue",
"(",
"IJDIPreferencesConstants",
".",
"PREF_STEP_THRU_FILTERS",
",",
"true",
")",
";",
"}",
"private",
"void",
"forceUseStepFilters",
"(",
")",
"{",
"DebugPlugin",
".",
"setUseStepFilters",
"(",
"true",
")",
";",
"}",
"private",
"void",
"forceGroovyStepFilters",
"(",
")",
"{",
"String",
"active",
"=",
"preferenceStore",
".",
"getString",
"(",
"IJDIPreferencesConstants",
".",
"PREF_ACTIVE_FILTERS_LIST",
")",
";",
"String",
"[",
"]",
"activeArr",
"=",
"JavaDebugOptionsManager",
".",
"parseList",
"(",
"active",
")",
";",
"List",
"<",
"String",
">",
"activeList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"Arrays",
".",
"asList",
"(",
"activeArr",
")",
")",
";",
"for",
"(",
"String",
"filter",
":",
"DEFAULT_GROOVY_STEP_FILTERS",
")",
"{",
"if",
"(",
"!",
"activeList",
".",
"contains",
"(",
"filter",
")",
")",
"{",
"activeList",
".",
"add",
"(",
"filter",
")",
";",
"}",
"}",
"String",
"newActive",
"=",
"JavaDebugOptionsManager",
".",
"serializeList",
"(",
"activeList",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
")",
";",
"preferenceStore",
".",
"setValue",
"(",
"IJDIPreferencesConstants",
".",
"PREF_ACTIVE_FILTERS_LIST",
",",
"newActive",
")",
";",
"String",
"inactive",
"=",
"preferenceStore",
".",
"getString",
"(",
"IJDIPreferencesConstants",
".",
"PREF_INACTIVE_FILTERS_LIST",
")",
";",
"String",
"[",
"]",
"inactiveArr",
"=",
"JavaDebugOptionsManager",
".",
"parseList",
"(",
"inactive",
")",
";",
"List",
"<",
"String",
">",
"inactiveList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"Arrays",
".",
"asList",
"(",
"inactiveArr",
")",
")",
";",
"for",
"(",
"String",
"filter",
":",
"DEFAULT_GROOVY_STEP_FILTERS",
")",
"{",
"while",
"(",
"inactiveList",
".",
"remove",
"(",
"filter",
")",
")",
"{",
"}",
"}",
"String",
"newInactive",
"=",
"JavaDebugOptionsManager",
".",
"serializeList",
"(",
"inactiveList",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
")",
";",
"preferenceStore",
".",
"setValue",
"(",
"IJDIPreferencesConstants",
".",
"PREF_INACTIVE_FILTERS_LIST",
",",
"newInactive",
")",
";",
"}",
"public",
"void",
"maybeForce",
"(",
"IPreferenceStore",
"store",
")",
"{",
"if",
"(",
"store",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FORCE_DEBUG_OPTIONS_ON_STARTUP",
")",
")",
"{",
"force",
"(",
")",
";",
"store",
".",
"setValue",
"(",
"PreferenceConstants",
".",
"GROOVY_DEBUG_FORCE_DEBUG_OPTIONS_ON_STARTUP",
",",
"false",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,270 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"internal",
".",
"runtime",
".",
"AdapterManager",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdapterFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Platform",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"internal",
".",
"ui",
".",
"viewers",
".",
"model",
".",
"provisional",
".",
"IElementContentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"internal",
".",
"ui",
".",
"viewers",
".",
"model",
".",
"provisional",
".",
"IElementLabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"actions",
".",
"IWatchExpressionFactoryAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"core",
".",
"IJavaStackFrame",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"variables",
".",
"JavaDebugElementAdapterFactory",
";",
"public",
"class",
"GroovyJavaDebugElementAdapterFactory",
"implements",
"IAdapterFactory",
"{",
"JavaDebugElementAdapterFactory",
"containedFactory",
"=",
"new",
"JavaDebugElementAdapterFactory",
"(",
")",
";",
"static",
"final",
"GroovyJavaStackFrameLabelProvider",
"fgLPFrame",
"=",
"new",
"GroovyJavaStackFrameLabelProvider",
"(",
")",
";",
"public",
"Object",
"getAdapter",
"(",
"Object",
"adaptableObject",
",",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"Class",
"adapterType",
")",
"{",
"if",
"(",
"IElementLabelProvider",
".",
"class",
".",
"equals",
"(",
"adapterType",
")",
")",
"{",
"if",
"(",
"adaptableObject",
"instanceof",
"IJavaStackFrame",
")",
"{",
"return",
"fgLPFrame",
";",
"}",
"}",
"return",
"containedFactory",
".",
"getAdapter",
"(",
"adaptableObject",
",",
"adapterType",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"Class",
"[",
"]",
"getAdapterList",
"(",
")",
"{",
"return",
"new",
"Class",
"[",
"]",
"{",
"IElementLabelProvider",
".",
"class",
",",
"IElementContentProvider",
".",
"class",
",",
"IWatchExpressionFactoryAdapter",
".",
"class",
"}",
";",
"}",
"public",
"static",
"void",
"connect",
"(",
")",
"{",
"removeJDIAdapter",
"(",
")",
";",
"Platform",
".",
"getAdapterManager",
"(",
")",
".",
"registerAdapters",
"(",
"new",
"GroovyJavaDebugElementAdapterFactory",
"(",
")",
",",
"IJavaStackFrame",
".",
"class",
")",
";",
"fgLPFrame",
".",
"connect",
"(",
")",
";",
"}",
"public",
"static",
"void",
"removeJDIAdapter",
"(",
")",
"{",
"try",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"IAdapterFactory",
">",
"factories",
"=",
"(",
"List",
"<",
"IAdapterFactory",
">",
")",
"(",
"(",
"AdapterManager",
")",
"Platform",
".",
"getAdapterManager",
"(",
")",
")",
".",
"getFactories",
"(",
")",
".",
"get",
"(",
"\"\"",
")",
";",
"for",
"(",
"Iterator",
"<",
"IAdapterFactory",
">",
"iterator",
"=",
"factories",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"IAdapterFactory",
"factory",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"factory",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"break",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"public",
"static",
"void",
"disconnect",
"(",
")",
"{",
"fgLPFrame",
".",
"disconnect",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,271 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdapterFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"actions",
".",
"IToggleBreakpointsTarget",
";",
"public",
"class",
"GroovyRetargettableActionAdapterFactory",
"implements",
"IAdapterFactory",
"{",
"public",
"Object",
"getAdapter",
"(",
"Object",
"adaptableObject",
",",
"Class",
"adapterType",
")",
"{",
"if",
"(",
"adapterType",
"==",
"IToggleBreakpointsTarget",
".",
"class",
")",
"{",
"return",
"new",
"ToggleBreakpointAdapter",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"Class",
"[",
"]",
"getAdapterList",
"(",
")",
"{",
"return",
"new",
"Class",
"[",
"]",
"{",
"IToggleBreakpointsTarget",
".",
"class",
"}",
";",
"}",
"}",
"</s>"
] |
6,272 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"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",
".",
"stmt",
".",
"Statement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"search",
".",
"LexicalClassVisitor",
";",
"public",
"class",
"ValidBreakpointLocationFinder",
"{",
"private",
"class",
"VisitCompleted",
"extends",
"RuntimeException",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"}",
"private",
"ASTNode",
"lastValid",
"=",
"null",
";",
"private",
"int",
"startLine",
";",
"public",
"ValidBreakpointLocationFinder",
"(",
"int",
"startLine",
")",
"{",
"this",
".",
"startLine",
"=",
"startLine",
";",
"}",
"private",
"void",
"validateNode",
"(",
"ASTNode",
"node",
")",
"throws",
"VisitCompleted",
"{",
"if",
"(",
"node",
".",
"getLineNumber",
"(",
")",
"==",
"-",
"1",
"||",
"node",
"instanceof",
"Statement",
"||",
"node",
"instanceof",
"ClosureExpression",
"||",
"node",
"instanceof",
"ClassNode",
"||",
"node",
"instanceof",
"FieldNode",
")",
"{",
"return",
";",
"}",
"if",
"(",
"node",
".",
"getLineNumber",
"(",
")",
"==",
"startLine",
")",
"{",
"lastValid",
"=",
"node",
";",
"}",
"else",
"if",
"(",
"node",
".",
"getLineNumber",
"(",
")",
">",
"startLine",
")",
"{",
"if",
"(",
"lastValid",
"==",
"null",
")",
"{",
"lastValid",
"=",
"node",
";",
"}",
"throw",
"new",
"VisitCompleted",
"(",
")",
";",
"}",
"}",
"public",
"ASTNode",
"findValidBreakpointLocation",
"(",
"ModuleNode",
"module",
")",
"{",
"LexicalClassVisitor",
"visitor",
"=",
"new",
"LexicalClassVisitor",
"(",
"module",
")",
";",
"try",
"{",
"boolean",
"skipNext",
"=",
"false",
";",
"while",
"(",
"visitor",
".",
"hasNextNode",
"(",
")",
")",
"{",
"ASTNode",
"node",
"=",
"visitor",
".",
"getNextNode",
"(",
")",
";",
"if",
"(",
"node",
"instanceof",
"DeclarationExpression",
")",
"{",
"skipNext",
"=",
"true",
";",
"Expression",
"rightExpression",
"=",
"(",
"(",
"DeclarationExpression",
")",
"node",
")",
".",
"getRightExpression",
"(",
")",
";",
"if",
"(",
"rightExpression",
"==",
"null",
"||",
"\"null\"",
".",
"equals",
"(",
"rightExpression",
".",
"getText",
"(",
")",
")",
")",
"{",
"continue",
";",
"}",
"}",
"else",
"if",
"(",
"skipNext",
")",
"{",
"skipNext",
"=",
"false",
";",
"}",
"else",
"{",
"validateNode",
"(",
"node",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"VisitCompleted",
"vc",
")",
"{",
"}",
"return",
"lastValid",
";",
"}",
"}",
"</s>"
] |
6,273 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"DebugPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"IBreakpointManager",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"model",
".",
"IBreakpoint",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"JDIDebugUIPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"Action",
";",
"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",
".",
"Position",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"TextSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"IAnnotationModel",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"IVerticalRulerInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IFileEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"AbstractMarkerAnnotationModel",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"IDocumentProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"IEditorStatusLine",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"ITextEditor",
";",
"public",
"class",
"GroovyBreakpointRulerAction",
"extends",
"Action",
"{",
"private",
"IVerticalRulerInfo",
"fRuler",
";",
"private",
"ITextEditor",
"fTextEditor",
";",
"private",
"IEditorStatusLine",
"fStatusLine",
";",
"private",
"ToggleBreakpointAdapter",
"fBreakpointAdapter",
";",
"public",
"GroovyBreakpointRulerAction",
"(",
"IVerticalRulerInfo",
"ruler",
",",
"ITextEditor",
"editor",
",",
"IEditorPart",
"editorPart",
")",
"{",
"super",
"(",
"\"\"",
")",
";",
"fRuler",
"=",
"ruler",
";",
"fTextEditor",
"=",
"editor",
";",
"fStatusLine",
"=",
"(",
"IEditorStatusLine",
")",
"editorPart",
".",
"getAdapter",
"(",
"IEditorStatusLine",
".",
"class",
")",
";",
"fBreakpointAdapter",
"=",
"new",
"ToggleBreakpointAdapter",
"(",
")",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"fTextEditor",
"=",
"null",
";",
"fRuler",
"=",
"null",
";",
"}",
"protected",
"IVerticalRulerInfo",
"getVerticalRulerInfo",
"(",
")",
"{",
"return",
"fRuler",
";",
"}",
"protected",
"ITextEditor",
"getTextEditor",
"(",
")",
"{",
"return",
"fTextEditor",
";",
"}",
"protected",
"IDocument",
"getDocument",
"(",
")",
"{",
"IDocumentProvider",
"provider",
"=",
"fTextEditor",
".",
"getDocumentProvider",
"(",
")",
";",
"return",
"provider",
".",
"getDocument",
"(",
"fTextEditor",
".",
"getEditorInput",
"(",
")",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"List",
"<",
"IMarker",
">",
"list",
"=",
"getMarkers",
"(",
")",
";",
"if",
"(",
"list",
".",
"isEmpty",
"(",
")",
")",
"{",
"IDocument",
"document",
"=",
"getDocument",
"(",
")",
";",
"int",
"lineNumber",
"=",
"getVerticalRulerInfo",
"(",
")",
".",
"getLineOfLastMouseButtonActivity",
"(",
")",
";",
"if",
"(",
"lineNumber",
">=",
"document",
".",
"getNumberOfLines",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"IRegion",
"line",
"=",
"document",
".",
"getLineInformation",
"(",
"lineNumber",
")",
";",
"ITextSelection",
"selection",
"=",
"new",
"TextSelection",
"(",
"document",
",",
"line",
".",
"getOffset",
"(",
")",
",",
"line",
".",
"getLength",
"(",
")",
")",
";",
"fBreakpointAdapter",
".",
"toggleLineBreakpoints",
"(",
"fTextEditor",
",",
"selection",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"}",
"}",
"else",
"{",
"IBreakpointManager",
"manager",
"=",
"DebugPlugin",
".",
"getDefault",
"(",
")",
".",
"getBreakpointManager",
"(",
")",
";",
"Iterator",
"<",
"IMarker",
">",
"iterator",
"=",
"list",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"IMarker",
"marker",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"IBreakpoint",
"breakpoint",
"=",
"manager",
".",
"getBreakpoint",
"(",
"marker",
")",
";",
"if",
"(",
"breakpoint",
"!=",
"null",
")",
"{",
"breakpoint",
".",
"delete",
"(",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"JDIDebugUIPlugin",
".",
"errorDialog",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"protected",
"IResource",
"getResource",
"(",
")",
"{",
"IResource",
"resource",
"=",
"null",
";",
"IEditorInput",
"editorInput",
"=",
"fTextEditor",
".",
"getEditorInput",
"(",
")",
";",
"if",
"(",
"editorInput",
"instanceof",
"IFileEditorInput",
")",
"{",
"resource",
"=",
"(",
"(",
"IFileEditorInput",
")",
"editorInput",
")",
".",
"getFile",
"(",
")",
";",
"}",
"return",
"resource",
";",
"}",
"protected",
"List",
"<",
"IMarker",
">",
"getMarkers",
"(",
")",
"{",
"List",
"<",
"IMarker",
">",
"breakpoints",
"=",
"new",
"ArrayList",
"<",
"IMarker",
">",
"(",
")",
";",
"IResource",
"resource",
"=",
"getResource",
"(",
")",
";",
"IDocument",
"document",
"=",
"getDocument",
"(",
")",
";",
"AbstractMarkerAnnotationModel",
"model",
"=",
"getAnnotationModel",
"(",
")",
";",
"if",
"(",
"model",
"!=",
"null",
")",
"{",
"try",
"{",
"IMarker",
"[",
"]",
"markers",
"=",
"null",
";",
"if",
"(",
"resource",
"instanceof",
"IFile",
")",
"markers",
"=",
"resource",
".",
"findMarkers",
"(",
"IBreakpoint",
".",
"BREAKPOINT_MARKER",
",",
"true",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"else",
"{",
"IWorkspaceRoot",
"root",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"markers",
"=",
"root",
".",
"findMarkers",
"(",
"IBreakpoint",
".",
"BREAKPOINT_MARKER",
",",
"true",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"}",
"if",
"(",
"markers",
"!=",
"null",
")",
"{",
"IBreakpointManager",
"breakpointManager",
"=",
"DebugPlugin",
".",
"getDefault",
"(",
")",
".",
"getBreakpointManager",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"markers",
".",
"length",
";",
"i",
"++",
")",
"{",
"IBreakpoint",
"breakpoint",
"=",
"breakpointManager",
".",
"getBreakpoint",
"(",
"markers",
"[",
"i",
"]",
")",
";",
"if",
"(",
"breakpoint",
"!=",
"null",
"&&",
"breakpointManager",
".",
"isRegistered",
"(",
"breakpoint",
")",
"&&",
"includesRulerLine",
"(",
"model",
".",
"getMarkerPosition",
"(",
"markers",
"[",
"i",
"]",
")",
",",
"document",
")",
")",
"breakpoints",
".",
"add",
"(",
"markers",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"x",
")",
"{",
"JDIDebugUIPlugin",
".",
"log",
"(",
"x",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}",
"return",
"breakpoints",
";",
"}",
"protected",
"AbstractMarkerAnnotationModel",
"getAnnotationModel",
"(",
")",
"{",
"IDocumentProvider",
"provider",
"=",
"fTextEditor",
".",
"getDocumentProvider",
"(",
")",
";",
"IAnnotationModel",
"model",
"=",
"provider",
".",
"getAnnotationModel",
"(",
"fTextEditor",
".",
"getEditorInput",
"(",
")",
")",
";",
"if",
"(",
"model",
"instanceof",
"AbstractMarkerAnnotationModel",
")",
"{",
"return",
"(",
"AbstractMarkerAnnotationModel",
")",
"model",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"boolean",
"includesRulerLine",
"(",
"Position",
"position",
",",
"IDocument",
"document",
")",
"{",
"if",
"(",
"position",
"!=",
"null",
")",
"{",
"try",
"{",
"int",
"markerLine",
"=",
"document",
".",
"getLineOfOffset",
"(",
"position",
".",
"getOffset",
"(",
")",
")",
";",
"int",
"line",
"=",
"fRuler",
".",
"getLineOfLastMouseButtonActivity",
"(",
")",
";",
"if",
"(",
"line",
"==",
"markerLine",
")",
"{",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
"BadLocationException",
"x",
")",
"{",
"}",
"}",
"return",
"false",
";",
"}",
"protected",
"void",
"report",
"(",
"final",
"String",
"message",
")",
"{",
"JDIDebugUIPlugin",
".",
"getStandardDisplay",
"(",
")",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"fStatusLine",
"!=",
"null",
")",
"{",
"fStatusLine",
".",
"setMessage",
"(",
"true",
",",
"message",
",",
"null",
")",
";",
"}",
"if",
"(",
"message",
"!=",
"null",
"&&",
"JDIDebugUIPlugin",
".",
"getActiveWorkbenchShell",
"(",
")",
"!=",
"null",
")",
"{",
"Display",
".",
"getCurrent",
"(",
")",
".",
"beep",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"}",
"</s>"
] |
6,274 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"actions",
".",
"RulerToggleBreakpointActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"source",
".",
"IVerticalRulerInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Event",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IFileEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"AbstractRulerActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"ITextEditor",
";",
"public",
"class",
"GroovyBreakpointRulerActionDelegate",
"extends",
"RulerToggleBreakpointActionDelegate",
"{",
"private",
"IEditorPart",
"fEditorPart",
";",
"private",
"GroovyBreakpointRulerAction",
"groovyDelegate",
";",
"@",
"Override",
"public",
"void",
"setActiveEditor",
"(",
"IAction",
"callerAction",
",",
"IEditorPart",
"targetEditor",
")",
"{",
"fEditorPart",
"=",
"targetEditor",
";",
"super",
".",
"setActiveEditor",
"(",
"callerAction",
",",
"targetEditor",
")",
";",
"}",
"@",
"Override",
"protected",
"IAction",
"createAction",
"(",
"ITextEditor",
"editor",
",",
"IVerticalRulerInfo",
"rulerInfo",
")",
"{",
"IResource",
"resource",
";",
"IEditorInput",
"editorInput",
"=",
"editor",
".",
"getEditorInput",
"(",
")",
";",
"if",
"(",
"editorInput",
"instanceof",
"IFileEditorInput",
")",
"{",
"resource",
"=",
"(",
"(",
"IFileEditorInput",
")",
"editorInput",
")",
".",
"getFile",
"(",
")",
";",
"if",
"(",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"resource",
".",
"getProject",
"(",
")",
")",
")",
"{",
"groovyDelegate",
"=",
"new",
"GroovyBreakpointRulerAction",
"(",
"rulerInfo",
",",
"editor",
",",
"fEditorPart",
")",
";",
"return",
"groovyDelegate",
";",
"}",
"}",
"return",
"super",
".",
"createAction",
"(",
"editor",
",",
"rulerInfo",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"runWithEvent",
"(",
"IAction",
"action",
",",
"Event",
"event",
")",
"{",
"if",
"(",
"groovyDelegate",
"!=",
"null",
")",
"{",
"groovyDelegate",
".",
"runWithEvent",
"(",
"event",
")",
";",
"}",
"else",
"{",
"super",
".",
"runWithEvent",
"(",
"action",
",",
"event",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"dispose",
"(",
")",
"{",
"groovyDelegate",
"=",
"null",
";",
"super",
".",
"dispose",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,275 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"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",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"DebugPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"core",
".",
"IJavaLineBreakpoint",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"core",
".",
"JDIDebugModel",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"VariableScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"BreakpointUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"JDIDebugUIPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"actions",
".",
"ActionMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"IEditorStatusLine",
";",
"public",
"class",
"BreakpointLocationVerifierJob",
"extends",
"Job",
"{",
"public",
"final",
"static",
"Object",
"FAMILY",
"=",
"new",
"Object",
"(",
")",
";",
"private",
"IJavaLineBreakpoint",
"fBreakpoint",
";",
"private",
"int",
"fLineNumber",
";",
"private",
"String",
"fTypeName",
";",
"private",
"IType",
"fType",
";",
"private",
"IResource",
"fResource",
";",
"private",
"IEditorStatusLine",
"fStatusLine",
";",
"public",
"BreakpointLocationVerifierJob",
"(",
"IJavaLineBreakpoint",
"breakpoint",
",",
"int",
"lineNumber",
",",
"String",
"typeName",
",",
"IType",
"type",
",",
"IResource",
"resource",
",",
"IEditorPart",
"editorPart",
")",
"{",
"super",
"(",
"ActionMessages",
".",
"BreakpointLocationVerifierJob_breakpoint_location",
")",
";",
"fBreakpoint",
"=",
"breakpoint",
";",
"fLineNumber",
"=",
"lineNumber",
";",
"fTypeName",
"=",
"typeName",
";",
"fType",
"=",
"type",
";",
"fResource",
"=",
"resource",
";",
"fStatusLine",
"=",
"(",
"IEditorStatusLine",
")",
"editorPart",
".",
"getAdapter",
"(",
"IEditorStatusLine",
".",
"class",
")",
";",
"}",
"@",
"Override",
"public",
"IStatus",
"run",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"ICompilationUnit",
"cu",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"(",
"IFile",
")",
"fResource",
")",
";",
"try",
"{",
"ModuleNode",
"node",
"=",
"null",
";",
"if",
"(",
"cu",
"instanceof",
"GroovyCompilationUnit",
")",
"{",
"node",
"=",
"(",
"(",
"GroovyCompilationUnit",
")",
"cu",
")",
".",
"getModuleNode",
"(",
")",
";",
"}",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
"new",
"Status",
"(",
"IStatus",
".",
"WARNING",
",",
"JDIDebugUIPlugin",
".",
"getUniqueIdentifier",
"(",
")",
",",
"IStatus",
".",
"ERROR",
",",
"ActionMessages",
".",
"BreakpointLocationVerifierJob_not_valid_location",
",",
"null",
")",
";",
"}",
"if",
"(",
"fBreakpoint",
"!=",
"null",
")",
"{",
"DebugPlugin",
".",
"getDefault",
"(",
")",
".",
"getBreakpointManager",
"(",
")",
".",
"removeBreakpoint",
"(",
"fBreakpoint",
",",
"true",
")",
";",
"}",
"ValidBreakpointLocationFinder",
"finder",
"=",
"new",
"ValidBreakpointLocationFinder",
"(",
"fLineNumber",
")",
";",
"ASTNode",
"valid",
"=",
"finder",
".",
"findValidBreakpointLocation",
"(",
"node",
")",
";",
"if",
"(",
"valid",
"instanceof",
"MethodNode",
"&&",
"(",
"(",
"MethodNode",
")",
"valid",
")",
".",
"getNameEnd",
"(",
")",
">",
"0",
")",
"{",
"createNewMethodBreakpoint",
"(",
"(",
"MethodNode",
")",
"valid",
",",
"fTypeName",
")",
";",
"return",
"new",
"Status",
"(",
"IStatus",
".",
"OK",
",",
"JDIDebugUIPlugin",
".",
"getUniqueIdentifier",
"(",
")",
",",
"IStatus",
".",
"OK",
",",
"ActionMessages",
".",
"BreakpointLocationVerifierJob_breakpoint_set",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"valid",
"!=",
"null",
")",
"{",
"createNewLineBreakpoint",
"(",
"valid",
",",
"fTypeName",
")",
";",
"return",
"new",
"Status",
"(",
"IStatus",
".",
"OK",
",",
"JDIDebugUIPlugin",
".",
"getUniqueIdentifier",
"(",
")",
",",
"IStatus",
".",
"OK",
",",
"ActionMessages",
".",
"BreakpointLocationVerifierJob_breakpoint_set",
",",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"report",
"(",
"ActionMessages",
".",
"BreakpointLocationVerifierJob_not_valid_location",
")",
";",
"return",
"new",
"Status",
"(",
"IStatus",
".",
"OK",
",",
"JDIDebugUIPlugin",
".",
"getUniqueIdentifier",
"(",
")",
",",
"IStatus",
".",
"ERROR",
",",
"ActionMessages",
".",
"BreakpointLocationVerifierJob_not_valid_location",
",",
"null",
")",
";",
"}",
"private",
"void",
"createNewMethodBreakpoint",
"(",
"MethodNode",
"node",
",",
"String",
"typeName",
")",
"throws",
"CoreException",
"{",
"Map",
"newAttributes",
"=",
"new",
"HashMap",
"(",
"10",
")",
";",
"int",
"start",
"=",
"node",
".",
"getNameStart",
"(",
")",
";",
"int",
"end",
"=",
"node",
".",
"getNameEnd",
"(",
")",
";",
"if",
"(",
"fType",
"!=",
"null",
")",
"{",
"IJavaElement",
"elt",
"=",
"fType",
".",
"getTypeRoot",
"(",
")",
".",
"getElementAt",
"(",
"start",
")",
";",
"if",
"(",
"elt",
"!=",
"null",
")",
"{",
"IMethod",
"method",
"=",
"(",
"IMethod",
")",
"elt",
";",
"BreakpointUtils",
".",
"addJavaBreakpointAttributesWithMemberDetails",
"(",
"newAttributes",
",",
"fType",
",",
"start",
",",
"end",
")",
";",
"BreakpointUtils",
".",
"addJavaBreakpointAttributes",
"(",
"newAttributes",
",",
"method",
")",
";",
"JDIDebugModel",
".",
"createMethodBreakpoint",
"(",
"fResource",
",",
"typeName",
",",
"node",
".",
"getName",
"(",
")",
",",
"createMethodSignature",
"(",
"node",
")",
",",
"true",
",",
"false",
",",
"false",
",",
"node",
".",
"getLineNumber",
"(",
")",
",",
"start",
",",
"end",
",",
"0",
",",
"true",
",",
"newAttributes",
")",
";",
"}",
"}",
"}",
"private",
"String",
"createMethodSignature",
"(",
"MethodNode",
"node",
")",
"{",
"String",
"returnType",
"=",
"createTypeSignatureStr",
"(",
"node",
".",
"getReturnType",
"(",
")",
")",
";",
"String",
"[",
"]",
"parameterTypes",
"=",
"new",
"String",
"[",
"node",
".",
"getParameters",
"(",
")",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parameterTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"parameterTypes",
"[",
"i",
"]",
"=",
"createTypeSignatureStr",
"(",
"node",
".",
"getParameters",
"(",
")",
"[",
"i",
"]",
".",
"getType",
"(",
")",
")",
";",
"}",
"return",
"Signature",
".",
"createMethodSignature",
"(",
"parameterTypes",
",",
"returnType",
")",
".",
"replace",
"(",
"'.'",
",",
"'/'",
")",
";",
"}",
"private",
"String",
"createTypeSignatureStr",
"(",
"ClassNode",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"node",
"=",
"VariableScope",
".",
"OBJECT_CLASS_NODE",
";",
"}",
"String",
"name",
"=",
"node",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"[\"",
")",
")",
"{",
"return",
"name",
";",
"}",
"else",
"{",
"return",
"Signature",
".",
"createTypeSignature",
"(",
"name",
",",
"true",
")",
";",
"}",
"}",
"private",
"void",
"createNewLineBreakpoint",
"(",
"ASTNode",
"node",
",",
"String",
"typeName",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"JDIDebugModel",
".",
"lineBreakpointExists",
"(",
"typeName",
",",
"node",
".",
"getLineNumber",
"(",
")",
")",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"Map",
"newAttributes",
"=",
"new",
"HashMap",
"(",
"10",
")",
";",
"int",
"start",
"=",
"node",
".",
"getStart",
"(",
")",
";",
"int",
"end",
"=",
"node",
".",
"getEnd",
"(",
")",
";",
"if",
"(",
"fType",
"!=",
"null",
")",
"{",
"BreakpointUtils",
".",
"addJavaBreakpointAttributesWithMemberDetails",
"(",
"newAttributes",
",",
"fType",
",",
"start",
",",
"end",
")",
";",
"}",
"JDIDebugModel",
".",
"createLineBreakpoint",
"(",
"fResource",
",",
"typeName",
",",
"node",
".",
"getLineNumber",
"(",
")",
",",
"start",
",",
"end",
",",
"0",
",",
"true",
",",
"newAttributes",
")",
";",
"}",
"protected",
"void",
"report",
"(",
"final",
"String",
"message",
")",
"{",
"JDIDebugUIPlugin",
".",
"getStandardDisplay",
"(",
")",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"fStatusLine",
"!=",
"null",
")",
"{",
"fStatusLine",
".",
"setMessage",
"(",
"true",
",",
"message",
",",
"null",
")",
";",
"}",
"if",
"(",
"message",
"!=",
"null",
"&&",
"JDIDebugUIPlugin",
".",
"getActiveWorkbenchShell",
"(",
")",
"!=",
"null",
")",
"{",
"Display",
".",
"getCurrent",
"(",
")",
".",
"beep",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"belongsTo",
"(",
"Object",
"family",
")",
"{",
"return",
"family",
"==",
"FAMILY",
";",
"}",
"}",
"</s>"
] |
6,276 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"ui",
".",
"FailureTrace",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"ui",
".",
"TestRunnerViewPart",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"IPreferenceStore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"resource",
".",
"JFaceResources",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"IPropertyChangeListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"util",
".",
"PropertyChangeEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IPartListener2",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPage",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPartReference",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"internal",
".",
"Workbench",
";",
"public",
"class",
"EnsureJUnitFont",
"implements",
"IPartListener2",
",",
"IPropertyChangeListener",
"{",
"private",
"static",
"final",
"String",
"JUNIT_RESULT_VIEW",
"=",
"\"\"",
";",
"public",
"void",
"maybeForceMonospaceFont",
"(",
")",
"{",
"forceMonospaceFont",
"(",
"isMonospace",
"(",
")",
")",
";",
"}",
"public",
"void",
"forceMonospaceFont",
"(",
"boolean",
"isMonospace",
")",
"{",
"try",
"{",
"IWorkbenchPage",
"page",
"=",
"Workbench",
".",
"getInstance",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getActivePage",
"(",
")",
";",
"if",
"(",
"page",
"==",
"null",
")",
"{",
"return",
";",
"}",
"TestRunnerViewPart",
"view",
"=",
"(",
"TestRunnerViewPart",
")",
"page",
".",
"findView",
"(",
"JUNIT_RESULT_VIEW",
")",
";",
"if",
"(",
"view",
"==",
"null",
")",
"{",
"return",
";",
"}",
"internalSetMonospaceFont",
"(",
"isMonospace",
",",
"view",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"isMonospace",
",",
"e",
")",
";",
"}",
"}",
"private",
"boolean",
"isMonospace",
"(",
")",
"{",
"try",
"{",
"IPreferenceStore",
"prefs",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
";",
"return",
"prefs",
".",
"getBoolean",
"(",
"PreferenceConstants",
".",
"GROOVY_JUNIT_MONOSPACE_FONT",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
"private",
"void",
"internalSetMonospaceFont",
"(",
"boolean",
"isMonospace",
",",
"TestRunnerViewPart",
"view",
")",
"{",
"FailureTrace",
"trace",
"=",
"view",
".",
"getFailureTrace",
"(",
")",
";",
"Composite",
"widget",
"=",
"(",
"Composite",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"FailureTrace",
".",
"class",
",",
"\"fTable\"",
",",
"trace",
")",
";",
"if",
"(",
"isMonospace",
")",
"{",
"widget",
".",
"setFont",
"(",
"JFaceResources",
".",
"getTextFont",
"(",
")",
")",
";",
"}",
"else",
"{",
"widget",
".",
"setFont",
"(",
"JFaceResources",
".",
"getDefaultFont",
"(",
")",
")",
";",
"}",
"}",
"private",
"void",
"internalForceMonospaceFont",
"(",
"IWorkbenchPartReference",
"partRef",
")",
"{",
"if",
"(",
"partRef",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"JUNIT_RESULT_VIEW",
")",
")",
"{",
"TestRunnerViewPart",
"view",
"=",
"(",
"TestRunnerViewPart",
")",
"partRef",
".",
"getPage",
"(",
")",
".",
"findView",
"(",
"JUNIT_RESULT_VIEW",
")",
";",
"if",
"(",
"view",
"!=",
"null",
")",
"{",
"internalSetMonospaceFont",
"(",
"isMonospace",
"(",
")",
",",
"view",
")",
";",
"}",
"}",
"}",
"public",
"void",
"partActivated",
"(",
"IWorkbenchPartReference",
"partRef",
")",
"{",
"internalForceMonospaceFont",
"(",
"partRef",
")",
";",
"}",
"public",
"void",
"partBroughtToTop",
"(",
"IWorkbenchPartReference",
"partRef",
")",
"{",
"internalForceMonospaceFont",
"(",
"partRef",
")",
";",
"}",
"public",
"void",
"partOpened",
"(",
"IWorkbenchPartReference",
"partRef",
")",
"{",
"internalForceMonospaceFont",
"(",
"partRef",
")",
";",
"}",
"public",
"void",
"partVisible",
"(",
"IWorkbenchPartReference",
"partRef",
")",
"{",
"internalForceMonospaceFont",
"(",
"partRef",
")",
";",
"}",
"public",
"void",
"partClosed",
"(",
"IWorkbenchPartReference",
"partRef",
")",
"{",
"}",
"public",
"void",
"partDeactivated",
"(",
"IWorkbenchPartReference",
"partRef",
")",
"{",
"}",
"public",
"void",
"partHidden",
"(",
"IWorkbenchPartReference",
"partRef",
")",
"{",
"}",
"public",
"void",
"partInputChanged",
"(",
"IWorkbenchPartReference",
"partRef",
")",
"{",
"}",
"public",
"void",
"propertyChange",
"(",
"PropertyChangeEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getProperty",
"(",
")",
".",
"equals",
"(",
"PreferenceConstants",
".",
"GROOVY_JUNIT_MONOSPACE_FONT",
")",
"||",
"event",
".",
"getProperty",
"(",
")",
".",
"equals",
"(",
"JFaceResources",
".",
"TEXT_FONT",
")",
"||",
"event",
".",
"getProperty",
"(",
")",
".",
"equals",
"(",
"JFaceResources",
".",
"DEFAULT_FONT",
")",
")",
"{",
"maybeForceMonospaceFont",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,277 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"DebugPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"IBreakpointManager",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"model",
".",
"IBreakpoint",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"core",
".",
"IJavaLineBreakpoint",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"core",
".",
"JDIDebugPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"core",
".",
"breakpoints",
".",
"JavaLineBreakpoint",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"BreakpointMarkerUpdater",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Position",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"IMarkerUpdater",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"texteditor",
".",
"MarkerUtilities",
";",
"public",
"class",
"BreakpointUpdater",
"implements",
"IMarkerUpdater",
"{",
"public",
"String",
"[",
"]",
"getAttribute",
"(",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"IMarker",
".",
"LINE_NUMBER",
"}",
";",
"}",
"public",
"String",
"getMarkerType",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"boolean",
"updateMarker",
"(",
"IMarker",
"marker",
",",
"IDocument",
"document",
",",
"Position",
"position",
")",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"getCompilationUnit",
"(",
"marker",
")",
";",
"if",
"(",
"unit",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"position",
".",
"isDeleted",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"IBreakpointManager",
"manager",
"=",
"DebugPlugin",
".",
"getDefault",
"(",
")",
".",
"getBreakpointManager",
"(",
")",
";",
"IBreakpoint",
"breakpoint",
"=",
"manager",
".",
"getBreakpoint",
"(",
"marker",
")",
";",
"if",
"(",
"breakpoint",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"Object",
"attribute",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"LINE_NUMBER",
")",
";",
"if",
"(",
"attribute",
"!=",
"null",
")",
"{",
"ValidBreakpointLocationFinder",
"finder",
"=",
"new",
"ValidBreakpointLocationFinder",
"(",
"(",
"(",
"Integer",
")",
"attribute",
")",
".",
"intValue",
"(",
")",
")",
";",
"ASTNode",
"validNode",
"=",
"finder",
".",
"findValidBreakpointLocation",
"(",
"unit",
".",
"getModuleNode",
"(",
")",
")",
";",
"if",
"(",
"validNode",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"int",
"line",
"=",
"validNode",
".",
"getLineNumber",
"(",
")",
";",
"MarkerUtilities",
".",
"setLineNumber",
"(",
"marker",
",",
"line",
")",
";",
"if",
"(",
"isLineBreakpoint",
"(",
"marker",
")",
")",
"{",
"ensureRanges",
"(",
"document",
",",
"marker",
",",
"line",
")",
";",
"return",
"lineBreakpointExists",
"(",
"marker",
".",
"getResource",
"(",
")",
",",
"(",
"(",
"IJavaLineBreakpoint",
")",
"breakpoint",
")",
".",
"getTypeName",
"(",
")",
",",
"line",
",",
"marker",
")",
"==",
"null",
";",
"}",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"}",
"private",
"GroovyCompilationUnit",
"getCompilationUnit",
"(",
"IMarker",
"marker",
")",
"{",
"IResource",
"resource",
"=",
"marker",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"!",
"Util",
".",
"isJavaLikeFileName",
"(",
"resource",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"ICompilationUnit",
"unit",
"=",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getCompilationUnitDocumentProvider",
"(",
")",
".",
"getWorkingCopy",
"(",
"resource",
")",
";",
"if",
"(",
"unit",
"==",
"null",
"&&",
"resource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FILE",
")",
"{",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"(",
"IFile",
")",
"resource",
")",
";",
"}",
"if",
"(",
"unit",
"!=",
"null",
"&&",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
"{",
"return",
"(",
"GroovyCompilationUnit",
")",
"unit",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"private",
"void",
"ensureRanges",
"(",
"IDocument",
"document",
",",
"IMarker",
"marker",
",",
"int",
"line",
")",
"throws",
"BadLocationException",
"{",
"if",
"(",
"line",
"<",
"0",
"||",
"line",
">",
"document",
".",
"getNumberOfLines",
"(",
")",
")",
"{",
"return",
";",
"}",
"IRegion",
"region",
"=",
"document",
".",
"getLineInformation",
"(",
"line",
"-",
"1",
")",
";",
"int",
"charstart",
"=",
"region",
".",
"getOffset",
"(",
")",
";",
"int",
"charend",
"=",
"charstart",
"+",
"region",
".",
"getLength",
"(",
")",
";",
"MarkerUtilities",
".",
"setCharStart",
"(",
"marker",
",",
"charstart",
")",
";",
"MarkerUtilities",
".",
"setCharEnd",
"(",
"marker",
",",
"charend",
")",
";",
"}",
"private",
"boolean",
"isLineBreakpoint",
"(",
"IMarker",
"marker",
")",
"{",
"return",
"MarkerUtilities",
".",
"isMarkerType",
"(",
"marker",
",",
"\"\"",
")",
";",
"}",
"private",
"IJavaLineBreakpoint",
"lineBreakpointExists",
"(",
"IResource",
"resource",
",",
"String",
"typeName",
",",
"int",
"lineNumber",
",",
"IMarker",
"currentmarker",
")",
"throws",
"CoreException",
"{",
"String",
"modelId",
"=",
"JDIDebugPlugin",
".",
"getUniqueIdentifier",
"(",
")",
";",
"String",
"markerType",
"=",
"JavaLineBreakpoint",
".",
"getMarkerType",
"(",
")",
";",
"IBreakpointManager",
"manager",
"=",
"DebugPlugin",
".",
"getDefault",
"(",
")",
".",
"getBreakpointManager",
"(",
")",
";",
"IBreakpoint",
"[",
"]",
"breakpoints",
"=",
"manager",
".",
"getBreakpoints",
"(",
"modelId",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"breakpoints",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"(",
"breakpoints",
"[",
"i",
"]",
"instanceof",
"IJavaLineBreakpoint",
")",
")",
"{",
"continue",
";",
"}",
"IJavaLineBreakpoint",
"breakpoint",
"=",
"(",
"IJavaLineBreakpoint",
")",
"breakpoints",
"[",
"i",
"]",
";",
"IMarker",
"marker",
"=",
"breakpoint",
".",
"getMarker",
"(",
")",
";",
"if",
"(",
"marker",
"!=",
"null",
"&&",
"marker",
".",
"exists",
"(",
")",
"&&",
"marker",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"markerType",
")",
"&&",
"currentmarker",
".",
"getId",
"(",
")",
"!=",
"marker",
".",
"getId",
"(",
")",
")",
"{",
"String",
"breakpointTypeName",
"=",
"breakpoint",
".",
"getTypeName",
"(",
")",
";",
"if",
"(",
"(",
"breakpointTypeName",
".",
"equals",
"(",
"typeName",
")",
"||",
"breakpointTypeName",
".",
"startsWith",
"(",
"typeName",
"+",
"'$'",
")",
")",
"&&",
"breakpoint",
".",
"getLineNumber",
"(",
")",
"==",
"lineNumber",
"&&",
"resource",
".",
"equals",
"(",
"marker",
".",
"getResource",
"(",
")",
")",
")",
"{",
"return",
"breakpoint",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
6,278 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"debug",
".",
"ui",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"DebugException",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunch",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"model",
".",
"IDebugTarget",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"core",
".",
"IJavaType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"DetailFormatter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"JavaDetailFormattersManager",
";",
"public",
"class",
"ForceDetailFormatter",
"{",
"class",
"DetailType",
"implements",
"IJavaType",
"{",
"final",
"String",
"name",
";",
"public",
"DetailType",
"(",
"String",
"name",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"throws",
"DebugException",
"{",
"return",
"name",
";",
"}",
"public",
"String",
"getSignature",
"(",
")",
"throws",
"DebugException",
"{",
"return",
"Signature",
".",
"createTypeSignature",
"(",
"name",
",",
"true",
")",
";",
"}",
"public",
"IDebugTarget",
"getDebugTarget",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"ILaunch",
"getLaunch",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"String",
"getModelIdentifier",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"Object",
"getAdapter",
"(",
"Class",
"adapter",
")",
"{",
"return",
"null",
";",
"}",
"}",
"private",
"boolean",
"referenceAlreadyExists",
"(",
"String",
"typeName",
")",
"{",
"JavaDetailFormattersManager",
"manager",
"=",
"JavaDetailFormattersManager",
".",
"getDefault",
"(",
")",
";",
"return",
"manager",
".",
"hasAssociatedDetailFormatter",
"(",
"new",
"DetailType",
"(",
"typeName",
")",
")",
";",
"}",
"private",
"void",
"addFormatter",
"(",
"String",
"typeName",
",",
"String",
"snippet",
")",
"{",
"DetailFormatter",
"formatter",
"=",
"new",
"DetailFormatter",
"(",
"typeName",
",",
"snippet",
",",
"true",
")",
";",
"JavaDetailFormattersManager",
"manager",
"=",
"JavaDetailFormattersManager",
".",
"getDefault",
"(",
")",
";",
"manager",
".",
"setAssociatedDetailFormatter",
"(",
"formatter",
")",
";",
"}",
"public",
"void",
"forceReferenceFormatter",
"(",
")",
"{",
"String",
"typeName",
"=",
"\"\"",
";",
"if",
"(",
"!",
"referenceAlreadyExists",
"(",
"typeName",
")",
")",
"{",
"addFormatter",
"(",
"typeName",
",",
"\"get()\"",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,279 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"actions",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCoreActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"builder",
".",
"ConvertLegacyProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdaptable",
";",
"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",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IObjectActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPart",
";",
"public",
"class",
"ConvertLegacyProjectAction",
"implements",
"IObjectActionDelegate",
"{",
"private",
"IProject",
"[",
"]",
"projects",
";",
"private",
"Shell",
"currentShell",
";",
"public",
"void",
"run",
"(",
"final",
"IAction",
"action",
")",
"{",
"if",
"(",
"projects",
"!=",
"null",
"&&",
"projects",
".",
"length",
">",
"0",
")",
"{",
"ConvertLegacyProject",
"convert",
"=",
"new",
"ConvertLegacyProject",
"(",
")",
";",
"try",
"{",
"convert",
".",
"convertProjects",
"(",
"projects",
")",
";",
"MessageDialog",
".",
"openInformation",
"(",
"(",
"currentShell",
"!=",
"null",
"?",
"currentShell",
":",
"Display",
".",
"getCurrent",
"(",
")",
".",
"getActiveShell",
"(",
")",
")",
",",
"\"\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"IProject",
"project",
":",
"projects",
")",
"{",
"sb",
".",
"append",
"(",
"project",
".",
"getName",
"(",
")",
"+",
"\"",
"\"",
")",
";",
"}",
"String",
"message",
"=",
"\"\"",
"+",
"sb",
";",
"GroovyCore",
".",
"logException",
"(",
"message",
",",
"e",
")",
";",
"IStatus",
"reason",
"=",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"GroovyCoreActivator",
".",
"PLUGIN_ID",
",",
"message",
",",
"e",
")",
";",
"ErrorDialog",
".",
"openError",
"(",
"(",
"currentShell",
"!=",
"null",
"?",
"currentShell",
":",
"Display",
".",
"getCurrent",
"(",
")",
".",
"getActiveShell",
"(",
")",
")",
",",
"\"\"",
",",
"\"\"",
",",
"reason",
")",
";",
"}",
"}",
"}",
"public",
"void",
"selectionChanged",
"(",
"final",
"IAction",
"action",
",",
"final",
"ISelection",
"selection",
")",
"{",
"List",
"<",
"IProject",
">",
"newSelected",
"=",
"new",
"LinkedList",
"<",
"IProject",
">",
"(",
")",
";",
"boolean",
"enabled",
"=",
"true",
";",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"IStructuredSelection",
"newSelection",
"=",
"(",
"IStructuredSelection",
")",
"selection",
";",
"for",
"(",
"Iterator",
"<",
"?",
">",
"iter",
"=",
"newSelection",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Object",
"object",
"=",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"IAdaptable",
")",
"{",
"IProject",
"project",
"=",
"(",
"IProject",
")",
"(",
"(",
"IAdaptable",
")",
"object",
")",
".",
"getAdapter",
"(",
"IProject",
".",
"class",
")",
";",
"try",
"{",
"if",
"(",
"project",
"!=",
"null",
"&&",
"project",
".",
"hasNature",
"(",
"ConvertLegacyProject",
".",
"OLD_NATURE",
")",
")",
"{",
"newSelected",
".",
"add",
"(",
"project",
")",
";",
"}",
"else",
"{",
"enabled",
"=",
"false",
";",
"break",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"project",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"enabled",
"=",
"false",
";",
"break",
";",
"}",
"}",
"if",
"(",
"action",
"!=",
"null",
")",
"{",
"action",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"}",
"}",
"if",
"(",
"enabled",
")",
"{",
"this",
".",
"projects",
"=",
"newSelected",
".",
"toArray",
"(",
"new",
"IProject",
"[",
"0",
"]",
")",
";",
"}",
"else",
"{",
"this",
".",
"projects",
"=",
"null",
";",
"}",
"}",
"public",
"void",
"setActivePart",
"(",
"final",
"IAction",
"action",
",",
"final",
"IWorkbenchPart",
"targetPart",
")",
"{",
"try",
"{",
"currentShell",
"=",
"targetPart",
".",
"getSite",
"(",
")",
".",
"getShell",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"currentShell",
"=",
"null",
";",
"}",
"}",
"}",
"</s>"
] |
6,280 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"actions",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"compiler",
".",
"CompilerUtils",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"preferences",
".",
"CompilerPreferencesPage",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPluginImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"preference",
".",
"PreferenceDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IMarkerResolution",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IMarkerResolution2",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IMarkerResolutionGenerator",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"PreferencesUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"views",
".",
"markers",
".",
"WorkbenchMarkerResolution",
";",
"public",
"class",
"CompilerMismatchMarkerResolutionGenerator",
"implements",
"IMarkerResolutionGenerator",
"{",
"private",
"static",
"final",
"IMarkerResolution",
"[",
"]",
"NO_RESOLUTIONS",
"=",
"new",
"IMarkerResolution",
"[",
"0",
"]",
";",
"private",
"static",
"final",
"String",
"COMPILER_MISMATCH_MARKER",
"=",
"\"\"",
";",
"private",
"static",
"abstract",
"class",
"AbstractCompilerConfigurator",
"extends",
"WorkbenchMarkerResolution",
"implements",
"IMarkerResolution2",
"{",
"private",
"final",
"IMarker",
"thisMarker",
";",
"public",
"AbstractCompilerConfigurator",
"(",
"IMarker",
"thisMarker",
")",
"{",
"this",
".",
"thisMarker",
"=",
"thisMarker",
";",
"}",
"@",
"Override",
"public",
"IMarker",
"[",
"]",
"findOtherMarkers",
"(",
"IMarker",
"[",
"]",
"markers",
")",
"{",
"List",
"<",
"IMarker",
">",
"markerList",
"=",
"new",
"ArrayList",
"<",
"IMarker",
">",
"(",
"markers",
".",
"length",
")",
";",
"for",
"(",
"IMarker",
"marker",
":",
"markers",
")",
"{",
"try",
"{",
"if",
"(",
"marker",
"!=",
"thisMarker",
"&&",
"marker",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"COMPILER_MISMATCH_MARKER",
")",
")",
"{",
"markerList",
".",
"add",
"(",
"marker",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"markerList",
".",
"toArray",
"(",
"new",
"IMarker",
"[",
"0",
"]",
")",
";",
"}",
"}",
"private",
"static",
"class",
"ConfigureCompilerLevelResolution",
"extends",
"AbstractCompilerConfigurator",
"{",
"ConfigureCompilerLevelResolution",
"(",
"IMarker",
"thisMarker",
")",
"{",
"super",
"(",
"thisMarker",
")",
";",
"}",
"public",
"String",
"getLabel",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"void",
"run",
"(",
"IMarker",
"marker",
")",
"{",
"IProject",
"project",
"=",
"marker",
".",
"getResource",
"(",
")",
".",
"getProject",
"(",
")",
";",
"PreferenceDialog",
"propertyDialog",
"=",
"PreferencesUtil",
".",
"createPropertyDialogOn",
"(",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
",",
"project",
",",
"CompilerPreferencesPage",
".",
"PROPERTY_ID",
",",
"new",
"String",
"[",
"]",
"{",
"CompilerPreferencesPage",
".",
"PROPERTY_ID",
"}",
",",
"null",
")",
";",
"propertyDialog",
".",
"open",
"(",
")",
";",
"}",
"public",
"String",
"getDescription",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"Image",
"getImage",
"(",
")",
"{",
"return",
"JavaPluginImages",
".",
"DESC_ELCL_CONFIGURE_BUILDPATH",
".",
"createImage",
"(",
")",
";",
"}",
"}",
"private",
"static",
"class",
"ConfigureWorksaceCompilerLevelResolution",
"extends",
"AbstractCompilerConfigurator",
"{",
"public",
"ConfigureWorksaceCompilerLevelResolution",
"(",
"IMarker",
"thisMarker",
")",
"{",
"super",
"(",
"thisMarker",
")",
";",
"}",
"public",
"String",
"getLabel",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"void",
"run",
"(",
"IMarker",
"marker",
")",
"{",
"PreferenceDialog",
"preferenceDialog",
"=",
"PreferencesUtil",
".",
"createPreferenceDialogOn",
"(",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
",",
"CompilerPreferencesPage",
".",
"PREFERENCES_ID",
",",
"new",
"String",
"[",
"]",
"{",
"CompilerPreferencesPage",
".",
"PREFERENCES_ID",
"}",
",",
"null",
")",
";",
"preferenceDialog",
".",
"open",
"(",
")",
";",
"}",
"public",
"String",
"getDescription",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"Image",
"getImage",
"(",
")",
"{",
"return",
"JavaPluginImages",
".",
"DESC_ELCL_CONFIGURE_BUILDPATH",
".",
"createImage",
"(",
")",
";",
"}",
"}",
"private",
"static",
"class",
"SetToWorkspaceCompilerLevelResolution",
"extends",
"AbstractCompilerConfigurator",
"{",
"public",
"SetToWorkspaceCompilerLevelResolution",
"(",
"IMarker",
"thisMarker",
")",
"{",
"super",
"(",
"thisMarker",
")",
";",
"}",
"public",
"String",
"getLabel",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"void",
"run",
"(",
"IMarker",
"marker",
")",
"{",
"IProject",
"project",
"=",
"marker",
".",
"getResource",
"(",
")",
".",
"getProject",
"(",
")",
";",
"CompilerUtils",
".",
"setCompilerLevel",
"(",
"project",
",",
"CompilerUtils",
".",
"getActiveGroovyVersion",
"(",
")",
")",
";",
"}",
"public",
"String",
"getDescription",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"Image",
"getImage",
"(",
")",
"{",
"return",
"JavaPluginImages",
".",
"DESC_ELCL_CONFIGURE_BUILDPATH",
".",
"createImage",
"(",
")",
";",
"}",
"}",
"public",
"IMarkerResolution",
"[",
"]",
"getResolutions",
"(",
"IMarker",
"marker",
")",
"{",
"if",
"(",
"marker",
".",
"getResource",
"(",
")",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"return",
"new",
"IMarkerResolution",
"[",
"]",
"{",
"new",
"ConfigureCompilerLevelResolution",
"(",
"marker",
")",
",",
"new",
"SetToWorkspaceCompilerLevelResolution",
"(",
"marker",
")",
",",
"new",
"ConfigureWorksaceCompilerLevelResolution",
"(",
"marker",
")",
"}",
";",
"}",
"return",
"NO_RESOLUTIONS",
";",
"}",
"}",
"</s>"
] |
6,281 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"actions",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"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",
".",
"IObjectActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPart",
";",
"public",
"class",
"AddGroovyNatureAction",
"implements",
"IObjectActionDelegate",
"{",
"private",
"List",
"<",
"IProject",
">",
"currSelected",
"=",
"new",
"LinkedList",
"<",
"IProject",
">",
"(",
")",
";",
"public",
"void",
"run",
"(",
"final",
"IAction",
"action",
")",
"{",
"if",
"(",
"currSelected",
"!=",
"null",
"&&",
"currSelected",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"GroovyCore",
".",
"trace",
"(",
"\"\"",
")",
";",
"for",
"(",
"IProject",
"project",
":",
"currSelected",
")",
"{",
"GroovyCore",
".",
"trace",
"(",
"\"",
"to",
"\"",
"+",
"project",
".",
"getName",
"(",
")",
")",
";",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"project",
")",
";",
"}",
"}",
"}",
"public",
"void",
"selectionChanged",
"(",
"final",
"IAction",
"action",
",",
"final",
"ISelection",
"selection",
")",
"{",
"currSelected",
".",
"clear",
"(",
")",
";",
"List",
"<",
"IProject",
">",
"newSelected",
"=",
"new",
"LinkedList",
"<",
"IProject",
">",
"(",
")",
";",
"boolean",
"enabled",
"=",
"true",
";",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"IStructuredSelection",
"newSelection",
"=",
"(",
"IStructuredSelection",
")",
"selection",
";",
"for",
"(",
"Iterator",
"<",
"?",
">",
"iter",
"=",
"newSelection",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Object",
"object",
"=",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"IAdaptable",
")",
"{",
"IProject",
"project",
"=",
"(",
"IProject",
")",
"(",
"(",
"IAdaptable",
")",
"object",
")",
".",
"getAdapter",
"(",
"IProject",
".",
"class",
")",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
"newSelected",
".",
"add",
"(",
"project",
")",
";",
"}",
"else",
"{",
"enabled",
"=",
"false",
";",
"break",
";",
"}",
"}",
"else",
"{",
"enabled",
"=",
"false",
";",
"break",
";",
"}",
"}",
"if",
"(",
"action",
"!=",
"null",
")",
"{",
"action",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"}",
"}",
"if",
"(",
"enabled",
")",
"{",
"this",
".",
"currSelected",
"=",
"newSelected",
";",
"}",
"}",
"public",
"void",
"setActivePart",
"(",
"final",
"IAction",
"action",
",",
"final",
"IWorkbenchPart",
"targetPart",
")",
"{",
"}",
"}",
"</s>"
] |
6,282 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IObjectActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPart",
";",
"public",
"abstract",
"class",
"AbstractAddClasspathContainerAction",
"implements",
"IObjectActionDelegate",
"{",
"protected",
"IJavaProject",
"targetProject",
";",
"public",
"void",
"setActivePart",
"(",
"final",
"IAction",
"action",
",",
"final",
"IWorkbenchPart",
"targetPart",
")",
"{",
"}",
"public",
"void",
"run",
"(",
"final",
"IAction",
"action",
")",
"{",
"try",
"{",
"if",
"(",
"GroovyRuntime",
".",
"hasClasspathContainer",
"(",
"targetProject",
",",
"getClasspathContainerPath",
"(",
")",
")",
")",
"{",
"GroovyRuntime",
".",
"removeLibraryFromClasspath",
"(",
"targetProject",
",",
"getClasspathContainerPath",
"(",
")",
")",
";",
"}",
"else",
"{",
"GroovyRuntime",
".",
"addLibraryToClasspath",
"(",
"targetProject",
",",
"getClasspathContainerPath",
"(",
")",
",",
"exportClasspath",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"errorMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"public",
"void",
"selectionChanged",
"(",
"final",
"IAction",
"action",
",",
"final",
"ISelection",
"selection",
")",
"{",
"targetProject",
"=",
"getTargetProject",
"(",
"selection",
")",
";",
"if",
"(",
"targetProject",
"==",
"null",
")",
"{",
"action",
".",
"setEnabled",
"(",
"false",
")",
";",
"action",
".",
"setText",
"(",
"disabledText",
"(",
")",
")",
";",
"}",
"else",
"{",
"action",
".",
"setEnabled",
"(",
"true",
")",
";",
"try",
"{",
"if",
"(",
"GroovyRuntime",
".",
"hasClasspathContainer",
"(",
"targetProject",
",",
"getClasspathContainerPath",
"(",
")",
")",
")",
"{",
"action",
".",
"setText",
"(",
"removeText",
"(",
")",
")",
";",
"}",
"else",
"{",
"action",
".",
"setText",
"(",
"addText",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"errorMessage",
"(",
")",
",",
"e",
")",
";",
"action",
".",
"setEnabled",
"(",
"false",
")",
";",
"action",
".",
"setText",
"(",
"disabledText",
"(",
")",
")",
";",
"}",
"}",
"}",
"private",
"IJavaProject",
"getTargetProject",
"(",
"ISelection",
"selection",
")",
"{",
"IJavaProject",
"candidate",
"=",
"null",
";",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"final",
"Object",
"selected",
"=",
"(",
"(",
"IStructuredSelection",
")",
"selection",
")",
".",
"getFirstElement",
"(",
")",
";",
"if",
"(",
"selected",
"instanceof",
"IProject",
")",
"{",
"IProject",
"projSelected",
"=",
"(",
"IProject",
")",
"selected",
";",
"if",
"(",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"projSelected",
")",
")",
"{",
"candidate",
"=",
"JavaCore",
".",
"create",
"(",
"projSelected",
")",
";",
"}",
"}",
"else",
"if",
"(",
"selected",
"instanceof",
"IJavaProject",
")",
"{",
"IJavaProject",
"projSelected",
"=",
"(",
"IJavaProject",
")",
"selected",
";",
"if",
"(",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"projSelected",
".",
"getProject",
"(",
")",
")",
")",
"{",
"candidate",
"=",
"projSelected",
";",
"}",
"}",
"}",
"return",
"candidate",
";",
"}",
"protected",
"abstract",
"IPath",
"getClasspathContainerPath",
"(",
")",
";",
"protected",
"abstract",
"boolean",
"exportClasspath",
"(",
")",
";",
"protected",
"abstract",
"String",
"errorMessage",
"(",
")",
";",
"protected",
"abstract",
"String",
"disabledText",
"(",
")",
";",
"protected",
"abstract",
"String",
"addText",
"(",
")",
";",
"protected",
"abstract",
"String",
"removeText",
"(",
")",
";",
"}",
"</s>"
] |
6,283 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"actions",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"builder",
".",
"GroovyClasspathContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IObjectActionDelegate",
";",
"public",
"class",
"AddGroovyClasspathContainerAction",
"extends",
"AbstractAddClasspathContainerAction",
"implements",
"IObjectActionDelegate",
"{",
"@",
"Override",
"protected",
"IPath",
"getClasspathContainerPath",
"(",
")",
"{",
"return",
"GroovyClasspathContainer",
".",
"CONTAINER_ID",
";",
"}",
"@",
"Override",
"protected",
"String",
"errorMessage",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"String",
"disabledText",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"String",
"addText",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"String",
"removeText",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"boolean",
"exportClasspath",
"(",
")",
"{",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
6,284 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"actions",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdaptable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IObjectActionDelegate",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchPart",
";",
"public",
"class",
"RemoveGroovyNatureAction",
"implements",
"IObjectActionDelegate",
"{",
"private",
"List",
"<",
"IProject",
">",
"currSelected",
"=",
"new",
"LinkedList",
"<",
"IProject",
">",
"(",
")",
";",
"private",
"IWorkbenchPart",
"targetPart",
";",
"private",
"boolean",
"shouldAskToRemoveJars",
"=",
"true",
";",
"public",
"void",
"run",
"(",
"final",
"IAction",
"action",
")",
"{",
"if",
"(",
"currSelected",
"!=",
"null",
"&&",
"currSelected",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"GroovyCore",
".",
"trace",
"(",
"\"\"",
")",
";",
"for",
"(",
"IProject",
"project",
":",
"currSelected",
")",
"{",
"GroovyCore",
".",
"trace",
"(",
"\"",
"to",
"\"",
"+",
"project",
".",
"getName",
"(",
")",
")",
";",
"try",
"{",
"GroovyRuntime",
".",
"removeGroovyNature",
"(",
"project",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"if",
"(",
"GroovyRuntime",
".",
"hasGroovyClasspathContainer",
"(",
"javaProject",
")",
")",
"{",
"boolean",
"shouldRemove",
";",
"if",
"(",
"shouldAskToRemoveJars",
")",
"{",
"shouldRemove",
"=",
"MessageDialog",
".",
"openQuestion",
"(",
"getShell",
"(",
")",
",",
"\"\"",
",",
"\"\"",
"+",
"project",
".",
"getName",
"(",
")",
"+",
"\"?\"",
")",
";",
"}",
"else",
"{",
"shouldRemove",
"=",
"true",
";",
"}",
"if",
"(",
"shouldRemove",
")",
"{",
"GroovyRuntime",
".",
"removeGroovyClasspathContainer",
"(",
"javaProject",
")",
";",
"GroovyRuntime",
".",
"removeLibraryFromClasspath",
"(",
"javaProject",
",",
"GroovyRuntime",
".",
"DSLD_CONTAINER_ID",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"private",
"Shell",
"getShell",
"(",
")",
"{",
"return",
"targetPart",
"!=",
"null",
"?",
"targetPart",
".",
"getSite",
"(",
")",
".",
"getShell",
"(",
")",
":",
"Display",
".",
"getDefault",
"(",
")",
".",
"getActiveShell",
"(",
")",
";",
"}",
"public",
"void",
"selectionChanged",
"(",
"final",
"IAction",
"action",
",",
"final",
"ISelection",
"selection",
")",
"{",
"currSelected",
".",
"clear",
"(",
")",
";",
"List",
"<",
"IProject",
">",
"newSelected",
"=",
"new",
"LinkedList",
"<",
"IProject",
">",
"(",
")",
";",
"boolean",
"enabled",
"=",
"true",
";",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"IStructuredSelection",
"newSelection",
"=",
"(",
"IStructuredSelection",
")",
"selection",
";",
"for",
"(",
"Iterator",
"<",
"?",
">",
"iter",
"=",
"newSelection",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Object",
"object",
"=",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"IAdaptable",
")",
"{",
"IProject",
"project",
"=",
"(",
"IProject",
")",
"(",
"(",
"IAdaptable",
")",
"object",
")",
".",
"getAdapter",
"(",
"IProject",
".",
"class",
")",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
"newSelected",
".",
"add",
"(",
"project",
")",
";",
"}",
"else",
"{",
"enabled",
"=",
"false",
";",
"break",
";",
"}",
"}",
"else",
"{",
"enabled",
"=",
"false",
";",
"break",
";",
"}",
"}",
"if",
"(",
"action",
"!=",
"null",
")",
"{",
"action",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"}",
"}",
"if",
"(",
"enabled",
")",
"{",
"this",
".",
"currSelected",
"=",
"newSelected",
";",
"}",
"}",
"public",
"void",
"setActivePart",
"(",
"final",
"IAction",
"action",
",",
"final",
"IWorkbenchPart",
"targetPart",
")",
"{",
"this",
".",
"targetPart",
"=",
"targetPart",
";",
"}",
"public",
"void",
"doNotAskToRemoveJars",
"(",
")",
"{",
"this",
".",
"shouldAskToRemoveJars",
"=",
"false",
";",
"}",
"}",
"</s>"
] |
6,285 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"wizards",
";",
"import",
"org",
".",
"eclipse",
".",
"osgi",
".",
"util",
".",
"NLS",
";",
"public",
"final",
"class",
"NewWizardMessages",
"extends",
"NLS",
"{",
"private",
"static",
"final",
"String",
"BUNDLE_NAME",
"=",
"\"\"",
";",
"private",
"NewWizardMessages",
"(",
")",
"{",
"}",
"public",
"static",
"String",
"AbstractOpenWizardAction_noproject_title",
";",
"public",
"static",
"String",
"AbstractOpenWizardAction_noproject_message",
";",
"public",
"static",
"String",
"AbstractOpenWizardAction_createerror_title",
";",
"public",
"static",
"String",
"AbstractOpenWizardAction_createerror_message",
";",
"public",
"static",
"String",
"AddArchiveToBuildpathAction_DuplicateArchiveInfo_message",
";",
"public",
"static",
"String",
"AddArchiveToBuildpathAction_DuplicateArchivesInfo_message",
";",
"public",
"static",
"String",
"AddArchiveToBuildpathAction_ErrorTitle",
";",
"public",
"static",
"String",
"AddArchiveToBuildpathAction_InfoTitle",
";",
"public",
"static",
"String",
"AddLibraryToBuildpathAction_ErrorTitle",
";",
"public",
"static",
"String",
"AddSelectedLibraryToBuildpathAction_ErrorTitle",
";",
"public",
"static",
"String",
"AddSourceFolderToBuildpathAction_ErrorTitle",
";",
"public",
"static",
"String",
"AddSourceFolderWizardPage_description",
";",
"public",
"static",
"String",
"AddSourceFolderWizardPage_addSinglePattern",
";",
"public",
"static",
"String",
"AddSourceFolderWizardPage_conflictWarning",
";",
"public",
"static",
"String",
"AddSourceFolderWizardPage_ignoreNestingConflicts",
";",
"public",
"static",
"String",
"AddSourceFolderWizardPage_replaceSourceFolderInfo",
";",
"public",
"static",
"String",
"BuildPathsBlock_RemoveOldOutputFolder_description",
";",
"public",
"static",
"String",
"BuildPathSupport_deprecated",
";",
"public",
"static",
"String",
"CPListLabelProvider_attribute_label",
";",
"public",
"static",
"String",
"CPVariableElementLabelProvider_appendix",
";",
"public",
"static",
"String",
"CPVariableElementLabelProvider_deprecated",
";",
"public",
"static",
"String",
"CPVariableElementLabelProvider_one_restriction",
";",
"public",
"static",
"String",
"CPVariableElementLabelProvider_read_only",
";",
"public",
"static",
"String",
"CPVariableElementLabelProvider_two_restrictions",
";",
"public",
"static",
"String",
"EditOutputFolderAction_DeleteOldOutputFolderQuestion",
";",
"public",
"static",
"String",
"EditOutputFolderAction_ErrorDescription",
";",
"public",
"static",
"String",
"EditOutputFolderAction_ProgressMonitorDescription",
";",
"public",
"static",
"String",
"ExcludeFromBuildathAction_ErrorTitle",
";",
"public",
"static",
"String",
"IncludeToBuildpathAction_ErrorTitle",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_DetectGroup_differendWorkspaceCC_message",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_EnableWorkingSet_button",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_JREGroup_specific_EE",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_Message_existingFolderInWorkspace",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_Message_invalidProjectNameForWorkspaceRoot",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_Message_notExisingProjectOnWorkspaceRoot",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_Message_notOnWorkspaceRoot",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_NoJREFound_link",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_UnknownDefaultJRE_name",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_WorkingSets_group",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_WorkingSetSelection_message",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_DeleteCorruptProjectFile_message",
";",
"public",
"static",
"String",
"NewElementWizard_op_error_title",
";",
"public",
"static",
"String",
"NewElementWizard_op_error_message",
";",
"public",
"static",
"String",
"NewElementWizard_typecomment_deprecated_title",
";",
"public",
"static",
"String",
"NewElementWizard_typecomment_deprecated_message",
";",
"public",
"static",
"String",
"NewContainerWizardPage_container_label",
";",
"public",
"static",
"String",
"NewContainerWizardPage_container_button",
";",
"public",
"static",
"String",
"NewContainerWizardPage_error_EnterContainerName",
";",
"public",
"static",
"String",
"NewContainerWizardPage_error_ContainerIsBinary",
";",
"public",
"static",
"String",
"NewContainerWizardPage_error_ContainerDoesNotExist",
";",
"public",
"static",
"String",
"NewContainerWizardPage_error_NotAFolder",
";",
"public",
"static",
"String",
"NewContainerWizardPage_error_ProjectClosed",
";",
"public",
"static",
"String",
"NewContainerWizardPage_warning_NotAJavaProject",
";",
"public",
"static",
"String",
"NewContainerWizardPage_warning_NotInAJavaProject",
";",
"public",
"static",
"String",
"NewContainerWizardPage_warning_NotOnClassPath",
";",
"public",
"static",
"String",
"NewContainerWizardPage_ChooseSourceContainerDialog_title",
";",
"public",
"static",
"String",
"NewContainerWizardPage_ChooseSourceContainerDialog_description",
";",
"public",
"static",
"String",
"NewPackageCreationWizard_title",
";",
"public",
"static",
"String",
"NewPackageWizardPage_package_label",
";",
"public",
"static",
"String",
"NewPackageWizardPage_error_InvalidPackageName",
";",
"public",
"static",
"String",
"NewPackageWizardPage_error_IsOutputFolder",
";",
"public",
"static",
"String",
"NewPackageWizardPage_error_PackageExists",
";",
"public",
"static",
"String",
"NewPackageWizardPage_error_PackageExistsDifferentCase",
";",
"public",
"static",
"String",
"NewPackageWizardPage_error_EnterName",
";",
"public",
"static",
"String",
"NewPackageWizardPage_error_PackageNotShown",
";",
"public",
"static",
"String",
"NewPackageWizardPage_warning_DiscouragedPackageName",
";",
"public",
"static",
"String",
"NewPackageWizardPage_title",
";",
"public",
"static",
"String",
"NewPackageWizardPage_description",
";",
"public",
"static",
"String",
"NewPackageWizardPage_info",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_ProjectNotOpen",
";",
"public",
"static",
"String",
"NewTypeWizardPage_package_label",
";",
"public",
"static",
"String",
"NewTypeWizardPage_package_button",
";",
"public",
"static",
"String",
"NewTypeWizardPage_enclosing_selection_label",
";",
"public",
"static",
"String",
"NewTypeWizardPage_enclosing_field_description",
";",
"public",
"static",
"String",
"NewTypeWizardPage_enclosing_button",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_InvalidPackageName",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_ClashOutputLocation",
";",
"public",
"static",
"String",
"NewTypeWizardPage_warning_DiscouragedPackageName",
";",
"public",
"static",
"String",
"NewTypeWizardPage_warning_DefaultPackageDiscouraged",
";",
"public",
"static",
"String",
"NewTypeWizardPage_warning_NotJDKCompliant",
";",
"public",
"static",
"String",
"NewTypeWizardPage_warning_EnumClassNotFound",
";",
"public",
"static",
"String",
"NewTypeWizardPage_default",
";",
"public",
"static",
"String",
"NewTypeWizardPage_ChoosePackageDialog_title",
";",
"public",
"static",
"String",
"NewTypeWizardPage_ChoosePackageDialog_description",
";",
"public",
"static",
"String",
"NewTypeWizardPage_ChoosePackageDialog_empty",
";",
"public",
"static",
"String",
"NewTypeWizardPage_ChooseEnclosingTypeDialog_title",
";",
"public",
"static",
"String",
"NewTypeWizardPage_ChooseEnclosingTypeDialog_description",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_EnclosingTypeEnterName",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_EnclosingTypeNotExists",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_EnclosingNotInCU",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_EnclosingNotEditable",
";",
"public",
"static",
"String",
"NewTypeWizardPage_warning_EnclosingNotInSourceFolder",
";",
"public",
"static",
"String",
"NewTypeWizardPage_typename_label",
";",
"public",
"static",
"String",
"NewTypeWizardPage_superclass_label",
";",
"public",
"static",
"String",
"NewTypeWizardPage_superclass_button",
";",
"public",
"static",
"String",
"NewTypeWizardPage_interfaces_class_label",
";",
"public",
"static",
"String",
"NewTypeWizardPage_interfaces_ifc_label",
";",
"public",
"static",
"String",
"NewTypeWizardPage_interfaces_add",
";",
"public",
"static",
"String",
"NewTypeWizardPage_interfaces_remove",
";",
"public",
"static",
"String",
"NewTypeWizardPage_modifiers_acc_label",
";",
"public",
"static",
"String",
"NewTypeWizardPage_modifiers_public",
";",
"public",
"static",
"String",
"NewTypeWizardPage_modifiers_private",
";",
"public",
"static",
"String",
"NewTypeWizardPage_modifiers_protected",
";",
"public",
"static",
"String",
"NewTypeWizardPage_modifiers_default",
";",
"public",
"static",
"String",
"NewTypeWizardPage_modifiers_abstract",
";",
"public",
"static",
"String",
"NewTypeWizardPage_modifiers_final",
";",
"public",
"static",
"String",
"NewTypeWizardPage_modifiers_static",
";",
"public",
"static",
"String",
"NewTypeWizardPage_addcomment_label",
";",
"public",
"static",
"String",
"NewTypeWizardPage_addcomment_description",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_EnterTypeName",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_TypeNameExists",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_TypeNameExistsDifferentCase",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_InvalidTypeName",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_QualifiedName",
";",
"public",
"static",
"String",
"NewTypeWizardPage_warning_TypeNameDiscouraged",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_TypeParameters",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_InvalidSuperClassName",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_SuperClassNotParameterized",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_InvalidSuperInterfaceName",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_SuperInterfaceNotParameterized",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_ModifiersFinalAndAbstract",
";",
"public",
"static",
"String",
"NewTypeWizardPage_configure_templates_message",
";",
"public",
"static",
"String",
"NewTypeWizardPage_configure_templates_title",
";",
"public",
"static",
"String",
"NewTypeWizardPage_SuperClassDialog_title",
";",
"public",
"static",
"String",
"NewTypeWizardPage_SuperClassDialog_message",
";",
"public",
"static",
"String",
"NewTypeWizardPage_InterfacesDialog_class_title",
";",
"public",
"static",
"String",
"NewTypeWizardPage_InterfacesDialog_interface_title",
";",
"public",
"static",
"String",
"NewTypeWizardPage_InterfacesDialog_message",
";",
"public",
"static",
"String",
"NewTypeWizardPage_operationdesc",
";",
"public",
"static",
"String",
"NewTypeWizardPage_error_uri_location_unkown",
";",
"public",
"static",
"String",
"OutputLocation_DotAsLocation",
";",
"public",
"static",
"String",
"OutputLocation_SettingsAsLocation",
";",
"public",
"static",
"String",
"OutputLocationDialog_removeProjectFromBP",
";",
"public",
"static",
"String",
"RemoveFromBuildpathAction_ErrorTitle",
";",
"public",
"static",
"String",
"SuperInterfaceSelectionDialog_addButton_label",
";",
"public",
"static",
"String",
"SuperInterfaceSelectionDialog_interfaceadded_info",
";",
"public",
"static",
"String",
"SuperInterfaceSelectionDialog_interfacealreadyadded_info",
";",
"public",
"static",
"String",
"NewClassCreationWizard_title",
";",
"public",
"static",
"String",
"NewClassWizardPage_title",
";",
"public",
"static",
"String",
"NewClassWizardPage_description",
";",
"public",
"static",
"String",
"NewClassWizardPage_methods_label",
";",
"public",
"static",
"String",
"NewClassWizardPage_methods_main",
";",
"public",
"static",
"String",
"NewClassWizardPage_methods_constructors",
";",
"public",
"static",
"String",
"NewClassWizardPage_methods_inherited",
";",
"public",
"static",
"String",
"NewInterfaceCreationWizard_title",
";",
"public",
"static",
"String",
"NewInterfaceWizardPage_title",
";",
"public",
"static",
"String",
"NewInterfaceWizardPage_description",
";",
"public",
"static",
"String",
"NewEnumCreationWizard_title",
";",
"public",
"static",
"String",
"NewEnumWizardPage_title",
";",
"public",
"static",
"String",
"NewEnumWizardPage_description",
";",
"public",
"static",
"String",
"NewAnnotationCreationWizard_title",
";",
"public",
"static",
"String",
"NewAnnotationWizardPage_title",
";",
"public",
"static",
"String",
"NewAnnotationWizardPage_description",
";",
"public",
"static",
"String",
"JavaCapabilityConfigurationPage_title",
";",
"public",
"static",
"String",
"JavaCapabilityConfigurationPage_description",
";",
"public",
"static",
"String",
"JavaCapabilityConfigurationPage_op_desc_java",
";",
"public",
"static",
"String",
"JavaProjectWizard_title",
";",
"public",
"static",
"String",
"JavaProjectWizard_op_error_title",
";",
"public",
"static",
"String",
"JavaProjectWizard_op_error_create_message",
";",
"public",
"static",
"String",
"NewJavaProjectWizardPage_title",
";",
"public",
"static",
"String",
"NewJavaProjectWizardPage_description",
";",
"public",
"static",
"String",
"NewJavaProjectWizardPage_op_desc",
";",
"public",
"static",
"String",
"NewSourceFolderCreationWizard_title",
";",
"public",
"static",
"String",
"NewSourceFolderCreationWizard_edit_title",
";",
"public",
"static",
"String",
"NewSourceFolderCreationWizard_link_title",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_title",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_description",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_root_label",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_root_button",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_project_label",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_project_button",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_operation",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_exclude_label",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_ChooseExistingRootDialog_title",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_ChooseExistingRootDialog_description",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_ChooseProjectDialog_title",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_ChooseProjectDialog_description",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_EnterRootName",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_InvalidRootName",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_NotAFolder",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_AlreadyExisting",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_AlreadyExistingDifferentCase",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_EnterProjectName",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_InvalidProjectPath",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_NotAJavaProject",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_error_ProjectNotExists",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_warning_ReplaceSFandOL",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_warning_ReplaceOL",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_warning_ReplaceSF",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_warning_AddedExclusions",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_ReplaceExistingSourceFolder_label",
";",
"public",
"static",
"String",
"NewSourceFolderWizardPage_edit_description",
";",
"public",
"static",
"String",
"BuildPathsBlock_tab_source",
";",
"public",
"static",
"String",
"BuildPathsBlock_tab_projects",
";",
"public",
"static",
"String",
"BuildPathsBlock_tab_libraries",
";",
"public",
"static",
"String",
"BuildPathsBlock_tab_order",
";",
"public",
"static",
"String",
"BuildPathsBlock_classpath_label",
";",
"public",
"static",
"String",
"BuildPathsBlock_classpath_up_button",
";",
"public",
"static",
"String",
"BuildPathsBlock_classpath_down_button",
";",
"public",
"static",
"String",
"BuildPathsBlock_classpath_top_button",
";",
"public",
"static",
"String",
"BuildPathsBlock_classpath_bottom_button",
";",
"public",
"static",
"String",
"BuildPathsBlock_classpath_checkall_button",
";",
"public",
"static",
"String",
"BuildPathsBlock_classpath_uncheckall_button",
";",
"public",
"static",
"String",
"BuildPathsBlock_buildpath_label",
";",
"public",
"static",
"String",
"BuildPathsBlock_buildpath_button",
";",
"public",
"static",
"String",
"BuildPathsBlock_error_InvalidBuildPath",
";",
"public",
"static",
"String",
"BuildPathsBlock_error_EnterBuildPath",
";",
"public",
"static",
"String",
"BuildPathsBlock_warning_EntryMissing",
";",
"public",
"static",
"String",
"BuildPathsBlock_warning_EntriesMissing",
";",
"public",
"static",
"String",
"BuildPathsBlock_operationdesc_project",
";",
"public",
"static",
"String",
"BuildPathsBlock_operationdesc_java",
";",
"public",
"static",
"String",
"BuildPathsBlock_ChooseOutputFolderDialog_title",
";",
"public",
"static",
"String",
"BuildPathsBlock_ChooseOutputFolderDialog_description",
";",
"public",
"static",
"String",
"BuildPathsBlock_RemoveBinariesDialog_title",
";",
"public",
"static",
"String",
"BuildPathsBlock_RemoveBinariesDialog_description",
";",
"public",
"static",
"String",
"CPListLabelProvider_new",
";",
"public",
"static",
"String",
"CPListLabelProvider_classcontainer",
";",
"public",
"static",
"String",
"CPListLabelProvider_twopart",
";",
"public",
"static",
"String",
"CPListLabelProvider_willbecreated",
";",
"public",
"static",
"String",
"CPListLabelProvider_unbound_library",
";",
"public",
"static",
"String",
"CPListLabelProvider_systemlibrary",
";",
"public",
"static",
"String",
"CPListLabelProvider_native_library_path",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_folders_label",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_folders_remove_button",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_folders_add_button",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_folders_edit_button",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_folders_check",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_ExistingSourceFolderDialog_new_title",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_ExistingSourceFolderDialog_new_description",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_NewSourceFolderDialog_new_title",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_NewSourceFolderDialog_edit_title",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_NewSourceFolderDialog_description",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_ChangeOutputLocationDialog_title",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_ChangeOutputLocationDialog_project_and_output_message",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_ChangeOutputLocationDialog_project_message",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_ExistingSourceFolderDialog_edit_title",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_ExistingSourceFolderDialog_edit_description",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_exclusion_added_title",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_exclusion_added_message",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_folders_link_source_button",
";",
"public",
"static",
"String",
"SourceContainerWorkbookPage_error_while_linking",
";",
"public",
"static",
"String",
"ProjectsWorkbookPage_projects_label",
";",
"public",
"static",
"String",
"ProjectsWorkbookPage_projects_add_button",
";",
"public",
"static",
"String",
"ProjectsWorkbookPage_projects_edit_button",
";",
"public",
"static",
"String",
"ProjectsWorkbookPage_projects_remove_button",
";",
"public",
"static",
"String",
"ProjectsWorkbookPage_chooseProjects_message",
";",
"public",
"static",
"String",
"ProjectsWorkbookPage_chooseProjects_title",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_libraries_label",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_libraries_remove_button",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_libraries_addjar_button",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_libraries_addextjar_button",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_libraries_addvariable_button",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_libraries_addlibrary_button",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_libraries_addclassfolder_button",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_libraries_replace_button",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_configurecontainer_error_title",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_configurecontainer_error_message",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_libraries_edit_button",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_NewClassFolderDialog_new_title",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_NewClassFolderDialog_edit_title",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_NewClassFolderDialog_description",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_JavadocPropertyDialog_title",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_exclusion_added_title",
";",
"public",
"static",
"String",
"LibrariesWorkbookPage_exclusion_added_message",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_ExistingSourceFolderDialog_new_title",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_ExistingSourceFolderDialog_new_description",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_ExistingClassFolderDialog_new_title",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_ExistingClassFolderDialog_new_description",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_JARArchiveDialog_new_title",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_JARArchiveDialog_new_description",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_JARArchiveDialog_edit_title",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_JARArchiveDialog_edit_description",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_ExtJARArchiveDialog_new_title",
";",
"public",
"static",
"String",
"BuildPathDialogAccess_ExtJARArchiveDialog_edit_title",
";",
"public",
"static",
"String",
"NewContainerDialog_error_invalidpath",
";",
"public",
"static",
"String",
"NewContainerDialog_error_enterpath",
";",
"public",
"static",
"String",
"NewContainerDialog_error_pathexists",
";",
"public",
"static",
"String",
"NewSourceFolderDialog_error_invalidpath",
";",
"public",
"static",
"String",
"NewSourceFolderDialog_error_enterpath",
";",
"public",
"static",
"String",
"NewSourceFolderDialog_error_pathexists",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_message",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_description",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_label",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_externalfile_button",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_externalfolder_button",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_internal_button",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_varlabel",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_variable_button",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_external_varbutton",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_error_notvalid",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_error_notabsolute",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_error_filenotexists",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_error_varnotexists",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_error_deviceinpath",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_filename_warning_varempty",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_intjardialog_title",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_intjardialog_message",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_extvardialog_title",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_extvardialog_description",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_extjardialog_text",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_extfolderdialog_text",
";",
"public",
"static",
"String",
"BuildPathSupport_putoncpdialog_title",
";",
"public",
"static",
"String",
"BuildPathSupport_putoncpdialog_message",
";",
"public",
"static",
"String",
"SourceAttachmentDialog_title",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_title",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_varlabel",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_variable_button",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_external_varbutton",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_extvardialog_title",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_extvardialog_description",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_error_notvalid",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_error_filenotexists",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_error_varnotexists",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_error_deviceinpath",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_warning_varempty",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_error_alreadyexists",
";",
"public",
"static",
"String",
"VariableBlock_vars_label",
";",
"public",
"static",
"String",
"VariableBlock_vars_add_button",
";",
"public",
"static",
"String",
"VariableBlock_vars_edit_button",
";",
"public",
"static",
"String",
"VariableBlock_vars_remove_button",
";",
"public",
"static",
"String",
"VariableBlock_operation_desc",
";",
"public",
"static",
"String",
"VariableBlock_job_description",
";",
"public",
"static",
"String",
"VariableBlock_needsbuild_title",
";",
"public",
"static",
"String",
"VariableBlock_needsbuild_message",
";",
"public",
"static",
"String",
"VariableBlock_variableSettingError_titel",
";",
"public",
"static",
"String",
"VariableBlock_variableSettingError_message",
";",
"public",
"static",
"String",
"VariablePathDialogField_variabledialog_title",
";",
"public",
"static",
"String",
"CPVariableElementLabelProvider_empty",
";",
"public",
"static",
"String",
"VariableCreationDialog_titlenew",
";",
"public",
"static",
"String",
"VariableCreationDialog_titleedit",
";",
"public",
"static",
"String",
"VariableCreationDialog_name_label",
";",
"public",
"static",
"String",
"VariableCreationDialog_path_label",
";",
"public",
"static",
"String",
"VariableCreationDialog_path_file_button",
";",
"public",
"static",
"String",
"VariableCreationDialog_path_dir_button",
";",
"public",
"static",
"String",
"VariableCreationDialog_error_entername",
";",
"public",
"static",
"String",
"VariableCreationDialog_error_whitespace",
";",
"public",
"static",
"String",
"VariableCreationDialog_error_invalidname",
";",
"public",
"static",
"String",
"VariableCreationDialog_error_nameexists",
";",
"public",
"static",
"String",
"VariableCreationDialog_error_invalidpath",
";",
"public",
"static",
"String",
"VariableCreationDialog_warning_pathnotexists",
";",
"public",
"static",
"String",
"VariableCreationDialog_extjardialog_text",
";",
"public",
"static",
"String",
"VariableCreationDialog_extdirdialog_text",
";",
"public",
"static",
"String",
"VariableCreationDialog_extdirdialog_message",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_title",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_vars_extend",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_configbutton_label",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_vars_label",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_ExtensionDialog_title",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_ExtensionDialog_description",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_info_isfolder",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_info_notexists",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_info_noselection",
";",
"public",
"static",
"String",
"NewVariableEntryDialog_info_selected",
";",
"public",
"static",
"String",
"OutputLocationDialog_title",
";",
"public",
"static",
"String",
"OutputLocationDialog_usedefault_label",
";",
"public",
"static",
"String",
"OutputLocationDialog_usespecific_label",
";",
"public",
"static",
"String",
"OutputLocationDialog_location_button",
";",
"public",
"static",
"String",
"OutputLocationDialog_error_existingisfile",
";",
"public",
"static",
"String",
"OutputLocationDialog_error_invalidpath",
";",
"public",
"static",
"String",
"OutputLocationDialog_ChooseOutputFolder_title",
";",
"public",
"static",
"String",
"OutputLocationDialog_ChooseOutputFolder_description",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_title",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_description",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_description2",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_exclusion_pattern_label",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_inclusion_pattern_label",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_inclusion_pattern_add",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_inclusion_pattern_add_multiple",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_inclusion_pattern_remove",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_inclusion_pattern_edit",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_exclusion_pattern_add",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_exclusion_pattern_add_multiple",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_exclusion_pattern_remove",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_exclusion_pattern_edit",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_ChooseExclusionPattern_title",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_ChooseExclusionPattern_description",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_ChooseInclusionPattern_title",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_ChooseInclusionPattern_description",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_Info_SrcAndOutput",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_Info_Src",
";",
"public",
"static",
"String",
"ExclusionInclusionDialog_Info_Output",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_exclude_add_title",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_exclude_edit_title",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_exclude_description",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_exclude_pattern_label",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_include_add_title",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_include_edit_title",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_include_description",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_include_pattern_label",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_pattern_button",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_error_empty",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_error_notrelative",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_error_exists",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_ChooseExclusionPattern_title",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_ChooseExclusionPattern_description",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_ChooseInclusionPattern_title",
";",
"public",
"static",
"String",
"ExclusionInclusionEntryDialog_ChooseInclusionPattern_description",
";",
"public",
"static",
"String",
"AccessRulesDialog_title",
";",
"public",
"static",
"String",
"AccessRulesDialog_container_description",
";",
"public",
"static",
"String",
"AccessRulesDialog_project_description",
";",
"public",
"static",
"String",
"AccessRulesDialog_description",
";",
"public",
"static",
"String",
"AccessRulesDialog_rules_label",
";",
"public",
"static",
"String",
"AccessRulesDialog_rules_add",
";",
"public",
"static",
"String",
"AccessRulesDialog_rules_up",
";",
"public",
"static",
"String",
"AccessRulesDialog_rules_remove",
";",
"public",
"static",
"String",
"AccessRulesDialog_combine_label",
";",
"public",
"static",
"String",
"AccessRulesDialog_rules_edit",
";",
"public",
"static",
"String",
"AccessRulesDialog_rules_down",
";",
"public",
"static",
"String",
"AccessRulesLabelProvider_kind_accessible",
";",
"public",
"static",
"String",
"AccessRulesLabelProvider_kind_discouraged",
";",
"public",
"static",
"String",
"AccessRulesLabelProvider_kind_non_accessible",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_add_title",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_edit_title",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_pattern_label",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_description",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_description2",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_error_empty",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_error_notrelative",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_kind_accessible",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_kind_label",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_kind_discourraged",
";",
"public",
"static",
"String",
"TypeRestrictionEntryDialog_kind_non_accessible",
";",
"public",
"static",
"String",
"ClasspathContainerDefaultPage_title",
";",
"public",
"static",
"String",
"ClasspathContainerDefaultPage_description",
";",
"public",
"static",
"String",
"ClasspathContainerDefaultPage_path_label",
";",
"public",
"static",
"String",
"ClasspathContainerDefaultPage_path_error_enterpath",
";",
"public",
"static",
"String",
"ClasspathContainerDefaultPage_path_error_invalidpath",
";",
"public",
"static",
"String",
"ClasspathContainerDefaultPage_path_error_needssegment",
";",
"public",
"static",
"String",
"ClasspathContainerDefaultPage_path_error_alreadyexists",
";",
"public",
"static",
"String",
"ClasspathContainerSelectionPage_title",
";",
"public",
"static",
"String",
"ClasspathContainerSelectionPage_description",
";",
"public",
"static",
"String",
"ClasspathContainerWizard_pagecreationerror_title",
";",
"public",
"static",
"String",
"ClasspathContainerWizard_pagecreationerror_message",
";",
"public",
"static",
"String",
"ClasspathContainerWizard_new_title",
";",
"public",
"static",
"String",
"ClasspathContainerWizard_edit_title",
";",
"public",
"static",
"String",
"FolderSelectionDialog_button",
";",
"public",
"static",
"String",
"MultipleFolderSelectionDialog_button",
";",
"public",
"static",
"String",
"CPListLabelProvider_none",
";",
"public",
"static",
"String",
"CPListLabelProvider_all",
";",
"public",
"static",
"String",
"CPListLabelProvider_source_attachment_label",
";",
"public",
"static",
"String",
"CPListLabelProvider_javadoc_location_label",
";",
"public",
"static",
"String",
"CPListLabelProvider_output_folder_label",
";",
"public",
"static",
"String",
"CPListLabelProvider_default_output_folder_label",
";",
"public",
"static",
"String",
"CPListLabelProvider_exclusion_filter_label",
";",
"public",
"static",
"String",
"CPListLabelProvider_exclusion_filter_separator",
";",
"public",
"static",
"String",
"CPListLabelProvider_inclusion_filter_label",
";",
"public",
"static",
"String",
"CPListLabelProvider_inclusion_filter_separator",
";",
"public",
"static",
"String",
"CPListLabelProvider_unknown_element_label",
";",
"public",
"static",
"String",
"CPListLabelProvider_access_rules_enabled",
";",
"public",
"static",
"String",
"CPListLabelProvider_project_access_rules_combined",
";",
"public",
"static",
"String",
"CPListLabelProvider_project_access_rules_no_rules",
";",
"public",
"static",
"String",
"CPListLabelProvider_project_access_rules_not_combined",
";",
"public",
"static",
"String",
"CPListLabelProvider_access_rules_disabled",
";",
"public",
"static",
"String",
"NewSourceFolderDialog_useproject_button",
";",
"public",
"static",
"String",
"NewSourceFolderDialog_usefolder_button",
";",
"public",
"static",
"String",
"NewSourceFolderDialog_sourcefolder_label",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_NameGroup_label_text",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LocationGroup_title",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LocationGroup_external_desc",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LocationGroup_workspace_desc",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LocationGroup_locationLabel_desc",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LocationGroup_browseButton_desc",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LayoutGroup_title",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LayoutGroup_option_separateFolders",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LayoutGroup_option_oneFolder",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LayoutGroup_configure",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_DetectGroup_message",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_Message_enterProjectName",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_Message_projectAlreadyExists",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_Message_enterLocation",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_Message_invalidDirectory",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_Message_cannotCreateAtExternalLocation",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_page_pageName",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_page_title",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_page_description",
";",
"public",
"static",
"String",
"HintTextGroup_Exception_Title",
";",
"public",
"static",
"String",
"HintTextGroup_Exception_Title_refresh",
";",
"public",
"static",
"String",
"HintTextGroup_Exception_Title_output",
";",
"public",
"static",
"String",
"HintTextGroup_NoAction",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_Exception_Title",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_Exception_refresh",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_HintTextGroup_title",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_CreateFolder_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_ConfigureBP_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_ConfigureBP_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Edit_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Edit_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_EditOutput_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_EditOutput_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_AddJarCP_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_AddJarCP_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_AddLibCP_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Include_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Exclude_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Exclude_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Uninclude_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Unexclude_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Unexclude_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Reset_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_ClearAll_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_ClearAll_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_CreateOutput_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Link_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Link_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Help_tooltip",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Help_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_Help_link",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_CreateSrcFolder_label",
";",
"public",
"static",
"String",
"NewSourceContainerWorkbookPage_ToolBar_CreateSrcFolder_tooltip",
";",
"public",
"static",
"String",
"NewFolderDialog_TypeGroup_title",
";",
"public",
"static",
"String",
"NewFolderDialog_folderNameGroup_label",
";",
"public",
"static",
"String",
"NewFolderDialog_folderTypeGroup_source_desc",
";",
"public",
"static",
"String",
"NewFolderDialog_folderTypeGroup_normal_desc",
";",
"public",
"static",
"String",
"NewFolderDialog_dependenciesGroup_none_desc",
";",
"public",
"static",
"String",
"NewFolderDialog_dependenciesGroup_copy_desc",
";",
"public",
"static",
"String",
"NewFolderDialog_dependenciesGroup_link_desc",
";",
"public",
"static",
"String",
"NewFolderDialog_dependenciesGroup_link_descDisabled",
";",
"public",
"static",
"String",
"NewFolderDialog_dependenciesGroup_locationLabel_desc",
";",
"public",
"static",
"String",
"NewFolderDialog_dependenciesGroup_browseButton_desc",
";",
"public",
"static",
"String",
"NewFolderDialog_dependenciesGroup_variables_desc",
";",
"public",
"static",
"String",
"NewFolderDialog_DependencyGroup_title",
";",
"public",
"static",
"String",
"NewFolderDialog_links_parentNotProject",
";",
"public",
"static",
"String",
"NewFolderDialog_linkTargetNonExistent",
";",
"public",
"static",
"String",
"NewFolderDialog_linkTargetNotFolder",
";",
"public",
"static",
"String",
"NewFolderDialog_folderNameEmpty",
";",
"public",
"static",
"String",
"NewFolderDialog_folderNameEmpty_alreadyExists",
";",
"public",
"static",
"String",
"NewFolderDialog_title",
";",
"public",
"static",
"String",
"NewFolderDialog_errorTitle",
";",
"public",
"static",
"String",
"NewFolderDialog_internalError",
";",
"public",
"static",
"String",
"NewFolderDialog_progress",
";",
"public",
"static",
"String",
"NewFolderDialog_notExists",
";",
"public",
"static",
"String",
"NewFolderDialog_createIn",
";",
"public",
"static",
"String",
"LinkFolderDialog_title",
";",
"public",
"static",
"String",
"LinkFolderDialog_createIn",
";",
"public",
"static",
"String",
"LinkFolderDialog_folderNameGroup_label",
";",
"public",
"static",
"String",
"LinkFolderDialog_dependenciesGroup_locationLabel_desc",
";",
"public",
"static",
"String",
"LinkFolderDialog_dependenciesGroup_browseButton_desc",
";",
"public",
"static",
"String",
"LinkFolderDialog_dependenciesGroup_variables_desc",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_NoAction_File",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_NoAction_DefaultPackage",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_NoAction_NullSelection",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_NoAction_MultiSelection",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_NoAction_ArchiveResource",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_NoAction_NoReason",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_create",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_createLinkedFolder",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_FolderToBuildpath",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_ArchiveToBuildpath",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_PackageToBuildpath",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_ProjectToBuildpath",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_fromBuildpath",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_ProjectFromBuildpath",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_ExcludePackage",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_ExcludeFile",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Include",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Edit",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_UnexcludeFolder",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_UnincludeFolder",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_UnincludeFile",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_ResetFilters",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_UnexcludeFile",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_EditOutputFolder",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_SetOutputToDefault",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_Uninclude",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_Unexclude",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_ResetAllOutputFolders",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_FromBuildpath",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_Include",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_Exclude",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_CreateOutput",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_toBuildpath",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_toBuildpath_archives",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_toBuildpath_library",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_Reset",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_Default_ResetAll",
";",
"public",
"static",
"String",
"PackageExplorerActionGroup_FormText_createNewSourceFolder",
";",
"public",
"static",
"String",
"DialogPackageExplorer_LabelProvider_Excluded",
";",
"public",
"static",
"String",
"DialogPackageExplorer_LabelProvider_SingleExcluded",
";",
"public",
"static",
"String",
"DialogPackageExplorer_LabelProvider_MultiExcluded",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_AddToBuildpath",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_RemoveFromBuildpath",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_ResetFilters",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_Including",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_RemoveInclusion",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_Excluding",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_RemoveExclusion",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_ContainsPath",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_ExamineInputFilters",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_EditInclusionExclusionFilters",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_RemovePath",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_CheckOutputFolders",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_Resetting",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_SetNewEntry",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_ComparePaths",
";",
"public",
"static",
"String",
"ClasspathModifier_Monitor_ResetOutputFolder",
";",
"public",
"static",
"String",
"ClasspathModifier_ChangeOutputLocationDialog_title",
";",
"public",
"static",
"String",
"ClasspathModifier_ChangeOutputLocationDialog_project_message",
";",
"public",
"static",
"String",
"ClasspathModifier_ChangeOutputLocationDialog_project_outputLocation",
";",
"public",
"static",
"String",
"ClasspathModifier_Error_NoNatures",
";",
"public",
"static",
"String",
"ClassPathDetector_operation_description",
";",
"public",
"static",
"String",
"ClassPathDetector_error_closing_file",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_error_title",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_error_message",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_problem_backup",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_operation_initialize",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_operation_create",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_operation_remove",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_error_remove_title",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_error_remove_message",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_problem_restore_project",
";",
"public",
"static",
"String",
"JavaProjectWizardSecondPage_problem_restore_classpath",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_directory_message",
";",
"public",
"static",
"String",
"UserLibraryWizardPage_title",
";",
"public",
"static",
"String",
"UserLibraryWizardPage_list_config_button",
";",
"public",
"static",
"String",
"UserLibraryWizardPage_list_label",
";",
"public",
"static",
"String",
"UserLibraryWizardPage_description_new",
";",
"public",
"static",
"String",
"UserLibraryWizardPage_description_edit",
";",
"public",
"static",
"String",
"UserLibraryWizardPage_error_selectentry",
";",
"public",
"static",
"String",
"UserLibraryWizardPage_error_selectonlyone",
";",
"public",
"static",
"String",
"UserLibraryWizardPage_error_alreadyoncp",
";",
"public",
"static",
"String",
"UserLibraryMarkerResolutionGenerator_changetouserlib_label",
";",
"public",
"static",
"String",
"UserLibraryMarkerResolutionGenerator_createuserlib_label",
";",
"public",
"static",
"String",
"UserLibraryMarkerResolutionGenerator_changetoother",
";",
"public",
"static",
"String",
"UserLibraryMarkerResolutionGenerator_error_creationfailed_message",
";",
"public",
"static",
"String",
"UserLibraryMarkerResolutionGenerator_error_title",
";",
"public",
"static",
"String",
"UserLibraryMarkerResolutionGenerator_error_applyingfailed_message",
";",
"public",
"static",
"String",
"ChangeComplianceDialog_title",
";",
"public",
"static",
"String",
"ChangeComplianceDialog_message",
";",
"public",
"static",
"String",
"ChangeComplianceDialog_project_selection",
";",
"public",
"static",
"String",
"ChangeComplianceDialog_workspace_selection",
";",
"public",
"static",
"String",
"GenerateBuildPathActionGroup_no_action_available",
";",
"public",
"static",
"String",
"GroovyProjectWizard_BuildSettings",
";",
"public",
"static",
"String",
"GroovyProjectWizard_BuildSettingsDesc",
";",
"public",
"static",
"String",
"GroovyProjectWizard_CreateGroovyProject",
";",
"public",
"static",
"String",
"GroovyProjectWizard_CreateGroovyProjectDesc",
";",
"public",
"static",
"String",
"GroovyProjectWizard_NewGroovyProject",
";",
"public",
"static",
"String",
"GroovyProjectWizard_OpErrorCreateMessage",
";",
"public",
"static",
"String",
"GroovyProjectWizard_OpErrorTitle",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_extfiledialog_text",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_intfiledialog_title",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_intfiledialog_message",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_location_label",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_workspace_browse",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_external_browse",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_description",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_title",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_error_external_not_existing",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_error_internal_not_existing",
";",
"public",
"static",
"String",
"NewContainerWizardPage_warning_inside_classfolder",
";",
"public",
"static",
"String",
"CPListLabelProvider_non_modifiable_attribute",
";",
"public",
"static",
"String",
"CPListLabelProvider_access_rules_label",
";",
"public",
"static",
"String",
"CPListLabelProvider_container_access_rules",
";",
"public",
"static",
"String",
"CPListLabelProvider_container_no_access_rules",
";",
"public",
"static",
"String",
"NativeLibrariesDialog_external_message",
";",
"public",
"static",
"String",
"SourceAttachmentBlock_extfolderdialog_message",
";",
"public",
"static",
"String",
"AccessRulesDialog_severity_info_with_link",
";",
"public",
"static",
"String",
"AccessRulesDialog_severity_info_no_link",
";",
"public",
"static",
"String",
"AccessRulesDialog_severity_error",
";",
"public",
"static",
"String",
"AccessRulesDialog_severity_warning",
";",
"public",
"static",
"String",
"AccessRulesDialog_severity_ignore",
";",
"public",
"static",
"String",
"AccessRulesDialog_switch_dialog_title",
";",
"public",
"static",
"String",
"AccessRulesDialog_switch_dialog_message",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_LayoutGroup_link_description",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_JREGroup_title",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_JREGroup_default_compliance",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_JREGroup_link_description",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_JREGroup_specific_compliance",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_JREGroup_compliance_13",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_JREGroup_compliance_14",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_JREGroup_compliance_50",
";",
"public",
"static",
"String",
"ClasspathModifierQueries_confirm_remove_linked_folder_label",
";",
"public",
"static",
"String",
"ClasspathModifierQueries_confirm_remove_linked_folder_message",
";",
"public",
"static",
"String",
"ClasspathModifierQueries_delete_linked_folder",
";",
"public",
"static",
"String",
"ClasspathModifierQueries_do_not_delete_linked_folder",
";",
"public",
"static",
"String",
"EditVariableEntryDialog_filename_empty",
";",
"public",
"static",
"String",
"JavaProjectWizardFirstPage_DetectGroup_jre_message",
";",
"static",
"{",
"NLS",
".",
"initializeMessages",
"(",
"BUNDLE_NAME",
",",
"NewWizardMessages",
".",
"class",
")",
";",
"}",
"}",
"</s>"
] |
6,286 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"wizards",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"wizards",
".",
"NewTestCaseCreationWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"junit",
".",
"wizards",
".",
"NewTestCaseWizardPageTwo",
";",
"public",
"class",
"NewGroovyTestCaseWizard",
"extends",
"NewTestCaseCreationWizard",
"{",
"public",
"NewGroovyTestCaseWizard",
"(",
")",
"{",
"super",
"(",
")",
";",
"setWindowTitle",
"(",
"\"\"",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"addPages",
"(",
")",
"{",
"NewTestCaseWizardPageTwo",
"fPage2",
"=",
"new",
"NewTestCaseWizardPageTwo",
"(",
")",
";",
"NewGroovyTestTypeWizardPage",
"fPage1",
"=",
"new",
"NewGroovyTestTypeWizardPage",
"(",
"fPage2",
")",
";",
"addPage",
"(",
"fPage1",
")",
";",
"fPage1",
".",
"init",
"(",
"getSelection",
"(",
")",
")",
";",
"addPage",
"(",
"fPage2",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"NewTestCaseCreationWizard",
".",
"class",
",",
"\"fPage1\"",
",",
"this",
",",
"fPage1",
")",
";",
"ReflectionUtils",
".",
"setPrivateField",
"(",
"NewTestCaseCreationWizard",
".",
"class",
",",
"\"fPage2\"",
",",
"this",
",",
"fPage2",
")",
";",
"}",
"}",
"</s>"
] |
6,287 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"wizards",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"JavaPluginImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"NewElementWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"wizard",
".",
"Wizard",
";",
"public",
"class",
"NewClassWizard",
"extends",
"NewElementWizard",
"{",
"private",
"NewClassWizardPage",
"fPage",
";",
"public",
"NewClassWizard",
"(",
")",
"{",
"super",
"(",
")",
";",
"setDefaultPageImageDescriptor",
"(",
"JavaPluginImages",
".",
"DESC_WIZBAN_NEWCLASS",
")",
";",
"setDialogSettings",
"(",
"JavaPlugin",
".",
"getDefault",
"(",
")",
".",
"getDialogSettings",
"(",
")",
")",
";",
"setWindowTitle",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"addPages",
"(",
")",
"{",
"super",
".",
"addPages",
"(",
")",
";",
"fPage",
"=",
"new",
"NewClassWizardPage",
"(",
")",
";",
"addPage",
"(",
"fPage",
")",
";",
"fPage",
".",
"init",
"(",
"getSelection",
"(",
")",
")",
";",
"}",
"protected",
"boolean",
"canRunForked",
"(",
")",
"{",
"return",
"!",
"fPage",
".",
"isEnclosingTypeSelected",
"(",
")",
";",
"}",
"protected",
"void",
"finishPage",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"InterruptedException",
",",
"CoreException",
"{",
"fPage",
".",
"createType",
"(",
"monitor",
")",
";",
"}",
"public",
"boolean",
"performFinish",
"(",
")",
"{",
"warnAboutTypeCommentDeprecation",
"(",
")",
";",
"boolean",
"res",
"=",
"super",
".",
"performFinish",
"(",
")",
";",
"if",
"(",
"res",
")",
"{",
"IResource",
"resource",
"=",
"fPage",
".",
"getModifiedResource",
"(",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"selectAndReveal",
"(",
"resource",
")",
";",
"openResource",
"(",
"(",
"IFile",
")",
"resource",
")",
";",
"}",
"}",
"return",
"res",
";",
"}",
"public",
"IJavaElement",
"getCreatedElement",
"(",
")",
"{",
"return",
"fPage",
".",
"getCreatedType",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,288 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"wizards",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"actions",
".",
"AbstractOpenWizardAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"action",
".",
"IAction",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"StructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"INewWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchWindow",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkbenchWindowActionDelegate",
";",
"public",
"class",
"OpenGroovyProjectWizardAction",
"extends",
"AbstractOpenWizardAction",
"implements",
"IWorkbenchWindowActionDelegate",
"{",
"public",
"OpenGroovyProjectWizardAction",
"(",
")",
"{",
"}",
"protected",
"final",
"INewWizard",
"createWizard",
"(",
")",
"throws",
"CoreException",
"{",
"return",
"new",
"GroovyProjectWizard",
"(",
")",
";",
"}",
"protected",
"boolean",
"doCreateProjectFirstOnEmptyWorkspace",
"(",
"Shell",
"shell",
")",
"{",
"return",
"true",
";",
"}",
"public",
"void",
"dispose",
"(",
")",
"{",
"}",
"public",
"void",
"init",
"(",
"IWorkbenchWindow",
"window",
")",
"{",
"setShell",
"(",
"window",
".",
"getShell",
"(",
")",
")",
";",
"}",
"public",
"void",
"run",
"(",
"IAction",
"action",
")",
"{",
"super",
".",
"run",
"(",
")",
";",
"}",
"public",
"void",
"selectionChanged",
"(",
"IAction",
"action",
",",
"ISelection",
"selection",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"setSelection",
"(",
"(",
"IStructuredSelection",
")",
"selection",
")",
";",
"}",
"else",
"{",
"setSelection",
"(",
"StructuredSelection",
".",
"EMPTY",
")",
";",
"}",
"}",
"}",
"</s>"
] |
6,289 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"wizards",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyRuntime",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"SubProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IImportDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"dialogs",
".",
"StatusInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"NewWizardMessages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"dialogfields",
".",
"SelectionButtonDialogFieldGroup",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"wizards",
".",
"NewTypeWizardPage",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"DeleteEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MultiTextEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"ReplaceEdit",
";",
"public",
"class",
"NewClassWizardPage",
"extends",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"wizards",
".",
"NewClassWizardPage",
"{",
"private",
"static",
"final",
"int",
"FINAL_INDEX",
"=",
"1",
";",
"private",
"IStatus",
"fStatus",
";",
"public",
"NewClassWizardPage",
"(",
")",
"{",
"super",
"(",
")",
";",
"setTitle",
"(",
"\"Groovy",
"Class\"",
")",
";",
"setDescription",
"(",
"\"\"",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"createModifierControls",
"(",
"Composite",
"composite",
",",
"int",
"nColumns",
")",
"{",
"super",
".",
"createModifierControls",
"(",
"composite",
",",
"nColumns",
")",
";",
"SelectionButtonDialogFieldGroup",
"group",
"=",
"getOtherModifierButtonsFieldGroup",
"(",
")",
";",
"group",
".",
"getSelectionButton",
"(",
"FINAL_INDEX",
")",
".",
"setText",
"(",
"\"\"",
")",
";",
"}",
"@",
"Override",
"protected",
"String",
"getCompilationUnitName",
"(",
"String",
"typeName",
")",
"{",
"return",
"typeName",
"+",
"\".groovy\"",
";",
"}",
"@",
"Override",
"protected",
"void",
"createTypeMembers",
"(",
"IType",
"type",
",",
"ImportsManager",
"imports",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"super",
".",
"createTypeMembers",
"(",
"type",
",",
"imports",
",",
"monitor",
")",
";",
"if",
"(",
"isCreateMain",
"(",
")",
")",
"{",
"IMethod",
"main",
"=",
"type",
".",
"getMethod",
"(",
"\"main\"",
",",
"new",
"String",
"[",
"]",
"{",
"\"[QString;\"",
"}",
")",
";",
"if",
"(",
"main",
"!=",
"null",
"&&",
"main",
".",
"exists",
"(",
")",
")",
"{",
"main",
".",
"delete",
"(",
"true",
",",
"monitor",
")",
";",
"type",
".",
"createMethod",
"(",
"\"\"",
",",
"null",
",",
"true",
",",
"monitor",
")",
";",
"}",
"}",
"}",
"@",
"Override",
"protected",
"IStatus",
"typeNameChanged",
"(",
")",
"{",
"StatusInfo",
"status",
"=",
"(",
"StatusInfo",
")",
"super",
".",
"typeNameChanged",
"(",
")",
";",
"IPackageFragment",
"pack",
"=",
"getPackageFragment",
"(",
")",
";",
"if",
"(",
"pack",
"==",
"null",
")",
"{",
"return",
"status",
";",
"}",
"IJavaProject",
"project",
"=",
"pack",
".",
"getJavaProject",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"project",
".",
"getProject",
"(",
")",
".",
"hasNature",
"(",
"GroovyNature",
".",
"GROOVY_NATURE",
")",
")",
"{",
"status",
".",
"setWarning",
"(",
"project",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"status",
".",
"setError",
"(",
"\"\"",
"+",
"project",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"String",
"typeName",
"=",
"getTypeNameWithoutParameters",
"(",
")",
";",
"if",
"(",
"!",
"isEnclosingTypeSelected",
"(",
")",
"&&",
"(",
"status",
".",
"getSeverity",
"(",
")",
"<",
"IStatus",
".",
"ERROR",
")",
")",
"{",
"if",
"(",
"pack",
"!=",
"null",
")",
"{",
"IType",
"type",
"=",
"null",
";",
"try",
"{",
"type",
"=",
"project",
".",
"findType",
"(",
"pack",
".",
"getElementName",
"(",
")",
",",
"typeName",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"if",
"(",
"type",
"!=",
"null",
"&&",
"type",
".",
"getPackageFragment",
"(",
")",
".",
"equals",
"(",
"pack",
")",
")",
"{",
"status",
".",
"setError",
"(",
"NewWizardMessages",
".",
"NewTypeWizardPage_error_TypeNameExists",
")",
";",
"}",
"}",
"}",
"if",
"(",
"status",
".",
"getSeverity",
"(",
")",
"<",
"IStatus",
".",
"ERROR",
")",
"{",
"try",
"{",
"ClasspathEntry",
"entry",
"=",
"(",
"ClasspathEntry",
")",
"(",
"(",
"IPackageFragmentRoot",
")",
"pack",
".",
"getParent",
"(",
")",
")",
".",
"getRawClasspathEntry",
"(",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"entry",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"entry",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"pack",
".",
"getResource",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"append",
"(",
"getCompilationUnitName",
"(",
"typeName",
")",
")",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"false",
")",
")",
"{",
"status",
".",
"setError",
"(",
"\"\"",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"status",
".",
"setError",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
";",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"status",
";",
"}",
"@",
"Override",
"public",
"void",
"createType",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
",",
"InterruptedException",
"{",
"IPackageFragment",
"pack",
"=",
"getPackageFragment",
"(",
")",
";",
"if",
"(",
"pack",
"!=",
"null",
")",
"{",
"IProject",
"project",
"=",
"pack",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
";",
"if",
"(",
"!",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"project",
")",
")",
"{",
"GroovyRuntime",
".",
"addGroovyNature",
"(",
"project",
")",
";",
"}",
"}",
"super",
".",
"createType",
"(",
"monitor",
")",
";",
"monitor",
"=",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"pack",
".",
"getCompilationUnit",
"(",
"getCompilationUnitName",
"(",
"getTypeName",
"(",
")",
")",
")",
";",
"try",
"{",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"1",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"IPackageDeclaration",
"[",
"]",
"packs",
"=",
"unit",
".",
"getPackageDeclarations",
"(",
")",
";",
"char",
"[",
"]",
"contents",
"=",
"unit",
".",
"getContents",
"(",
")",
";",
"MultiTextEdit",
"multi",
"=",
"new",
"MultiTextEdit",
"(",
")",
";",
"if",
"(",
"packs",
".",
"length",
">",
"0",
")",
"{",
"ISourceRange",
"range",
"=",
"packs",
"[",
"0",
"]",
".",
"getSourceRange",
"(",
")",
";",
"int",
"position",
"=",
"range",
".",
"getOffset",
"(",
")",
"+",
"range",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"contents",
"[",
"position",
"]",
"==",
"';'",
")",
"{",
"multi",
".",
"addChild",
"(",
"new",
"ReplaceEdit",
"(",
"position",
",",
"1",
",",
"\"\"",
")",
")",
";",
"}",
"}",
"IImportDeclaration",
"[",
"]",
"imports",
"=",
"unit",
".",
"getImports",
"(",
")",
";",
"if",
"(",
"imports",
"!=",
"null",
"&&",
"imports",
".",
"length",
">",
"0",
")",
"{",
"ISourceRange",
"range",
"=",
"imports",
"[",
"0",
"]",
".",
"getSourceRange",
"(",
")",
";",
"int",
"position",
"=",
"range",
".",
"getOffset",
"(",
")",
"+",
"range",
".",
"getLength",
"(",
")",
"-",
"1",
";",
"if",
"(",
"contents",
"[",
"position",
"]",
"==",
"';'",
")",
"{",
"multi",
".",
"addChild",
"(",
"new",
"ReplaceEdit",
"(",
"position",
",",
"1",
",",
"\"\"",
")",
")",
";",
"}",
"}",
"if",
"(",
"isScript",
"(",
")",
")",
"{",
"ISourceRange",
"range",
"=",
"unit",
".",
"getTypes",
"(",
")",
"[",
"0",
"]",
".",
"getSourceRange",
"(",
")",
";",
"multi",
".",
"addChild",
"(",
"new",
"DeleteEdit",
"(",
"range",
".",
"getOffset",
"(",
")",
",",
"range",
".",
"getLength",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"multi",
".",
"hasChildren",
"(",
")",
")",
"{",
"unit",
".",
"applyTextEdit",
"(",
"multi",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"unit",
".",
"commitWorkingCopy",
"(",
"true",
",",
"new",
"SubProgressMonitor",
"(",
"monitor",
",",
"1",
")",
")",
";",
"}",
"monitor",
".",
"worked",
"(",
"1",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"unit",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"private",
"boolean",
"isScript",
"(",
")",
"{",
"SelectionButtonDialogFieldGroup",
"group",
"=",
"getOtherModifierButtonsFieldGroup",
"(",
")",
";",
"return",
"group",
".",
"isSelected",
"(",
"FINAL_INDEX",
")",
";",
"}",
"public",
"SelectionButtonDialogFieldGroup",
"getOtherModifierButtonsFieldGroup",
"(",
")",
"{",
"return",
"(",
"SelectionButtonDialogFieldGroup",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"NewTypeWizardPage",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"}",
"private",
"String",
"getTypeNameWithoutParameters",
"(",
")",
"{",
"String",
"typeNameWithParameters",
"=",
"getTypeName",
"(",
")",
";",
"int",
"angleBracketOffset",
"=",
"typeNameWithParameters",
".",
"indexOf",
"(",
"'<'",
")",
";",
"if",
"(",
"angleBracketOffset",
"==",
"-",
"1",
")",
"{",
"return",
"typeNameWithParameters",
";",
"}",
"else",
"{",
"return",
"typeNameWithParameters",
".",
"substring",
"(",
"0",
",",
"angleBracketOffset",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"int",
"getModifiers",
"(",
")",
"{",
"int",
"modifiers",
"=",
"super",
".",
"getModifiers",
"(",
")",
";",
"modifiers",
"&=",
"~",
"F_PUBLIC",
";",
"modifiers",
"&=",
"~",
"F_PRIVATE",
";",
"modifiers",
"&=",
"~",
"F_PROTECTED",
";",
"modifiers",
"&=",
"~",
"F_FINAL",
";",
"return",
"modifiers",
";",
"}",
"public",
"IStatus",
"getStatus",
"(",
")",
"{",
"return",
"fStatus",
";",
"}",
"@",
"Override",
"protected",
"void",
"updateStatus",
"(",
"IStatus",
"status",
")",
"{",
"super",
".",
"updateStatus",
"(",
"status",
")",
";",
"fStatus",
"=",
"status",
";",
"}",
"}",
"</s>"
] |
6,290 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"wizards",
";",
"import",
"java",
".",
"lang",
".",
"reflect",
".",
"InvocationTargetException",
";",
"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",
".",
"ui",
".",
"decorators",
".",
"GroovyPluginImages",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IncrementalProjectBuilder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IConfigurationElement",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IExecutableExtension",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"util",
".",
"ExceptionHandler",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"wizards",
".",
"NewElementWizard",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"wizards",
".",
"NewJavaProjectWizardPageOne",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"wizards",
".",
"NewJavaProjectWizardPageTwo",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IWorkingSet",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"wizards",
".",
"newresource",
".",
"BasicNewProjectResourceWizard",
";",
"public",
"class",
"GroovyProjectWizard",
"extends",
"NewElementWizard",
"implements",
"IExecutableExtension",
"{",
"protected",
"NewJavaProjectWizardPageOne",
"fFirstPage",
";",
"protected",
"NewJavaProjectWizardPageTwo",
"fSecondPage",
";",
"private",
"IConfigurationElement",
"fConfigElement",
";",
"public",
"GroovyProjectWizard",
"(",
")",
"{",
"setDefaultPageImageDescriptor",
"(",
"GroovyPluginImages",
".",
"DESC_NEW_GROOVY_PROJECT",
")",
";",
"setDialogSettings",
"(",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getDialogSettings",
"(",
")",
")",
";",
"setWindowTitle",
"(",
"NewWizardMessages",
".",
"GroovyProjectWizard_NewGroovyProject",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"addPages",
"(",
")",
"{",
"super",
".",
"addPages",
"(",
")",
";",
"fFirstPage",
"=",
"new",
"NewJavaProjectWizardPageOne",
"(",
")",
";",
"addPage",
"(",
"fFirstPage",
")",
";",
"fFirstPage",
".",
"setTitle",
"(",
"NewWizardMessages",
".",
"GroovyProjectWizard_CreateGroovyProject",
")",
";",
"fFirstPage",
".",
"setDescription",
"(",
"NewWizardMessages",
".",
"GroovyProjectWizard_CreateGroovyProjectDesc",
")",
";",
"fSecondPage",
"=",
"new",
"NewJavaProjectWizardPageTwo",
"(",
"fFirstPage",
")",
";",
"fSecondPage",
".",
"setTitle",
"(",
"NewWizardMessages",
".",
"GroovyProjectWizard_BuildSettings",
")",
";",
"fSecondPage",
".",
"setDescription",
"(",
"NewWizardMessages",
".",
"GroovyProjectWizard_BuildSettingsDesc",
")",
";",
"addPage",
"(",
"fSecondPage",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"finishPage",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"InterruptedException",
",",
"CoreException",
"{",
"fSecondPage",
".",
"performFinish",
"(",
"monitor",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"performFinish",
"(",
")",
"{",
"boolean",
"res",
"=",
"super",
".",
"performFinish",
"(",
")",
";",
"if",
"(",
"res",
")",
"{",
"BasicNewProjectResourceWizard",
".",
"updatePerspective",
"(",
"fConfigElement",
")",
";",
"IProject",
"project",
"=",
"fSecondPage",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
";",
"selectAndReveal",
"(",
"project",
")",
";",
"IWorkingSet",
"[",
"]",
"workingSets",
"=",
"fFirstPage",
".",
"getWorkingSets",
"(",
")",
";",
"if",
"(",
"workingSets",
".",
"length",
">",
"0",
")",
"{",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getWorkingSetManager",
"(",
")",
".",
"addToWorkingSets",
"(",
"project",
",",
"workingSets",
")",
";",
"}",
"boolean",
"completed",
"=",
"finalizeNewProject",
"(",
"project",
")",
";",
"res",
"=",
"completed",
";",
"}",
"return",
"res",
";",
"}",
"@",
"Override",
"protected",
"void",
"handleFinishException",
"(",
"Shell",
"shell",
",",
"InvocationTargetException",
"e",
")",
"{",
"String",
"title",
"=",
"NewWizardMessages",
".",
"GroovyProjectWizard_OpErrorTitle",
";",
"String",
"message",
"=",
"NewWizardMessages",
".",
"GroovyProjectWizard_OpErrorCreateMessage",
";",
"ExceptionHandler",
".",
"handle",
"(",
"e",
",",
"getShell",
"(",
")",
",",
"title",
",",
"message",
")",
";",
"}",
"private",
"boolean",
"finalizeNewProject",
"(",
"IProject",
"project",
")",
"{",
"final",
"IProject",
"thisProject",
"=",
"project",
";",
"try",
"{",
"GroovyRuntime",
".",
"addGroovyRuntime",
"(",
"thisProject",
")",
";",
"thisProject",
".",
"build",
"(",
"IncrementalProjectBuilder",
".",
"FULL_BUILD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"project",
"=",
"thisProject",
";",
"selectAndReveal",
"(",
"project",
")",
";",
"GroovyCore",
".",
"trace",
"(",
"\"\"",
"+",
"thisProject",
".",
"getName",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"public",
"void",
"setInitializationData",
"(",
"IConfigurationElement",
"cfig",
",",
"String",
"propertyName",
",",
"Object",
"data",
")",
"{",
"fConfigElement",
"=",
"cfig",
";",
"}",
"@",
"Override",
"public",
"boolean",
"performCancel",
"(",
")",
"{",
"fSecondPage",
".",
"performCancel",
"(",
")",
";",
"return",
"super",
".",
"performCancel",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"canFinish",
"(",
")",
"{",
"return",
"super",
".",
"canFinish",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"IJavaElement",
"getCreatedElement",
"(",
")",
"{",
"return",
"fSecondPage",
".",
"getJavaProject",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,291 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"wizards",
";",
"import",
"greclipse",
".",
"org",
".",
"eclipse",
".",
"jdt",
".",
"junit",
".",
"wizards",
".",
"NewTestCaseWizardPageOne",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"junit",
".",
"util",
".",
"JUnitStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"junit",
".",
"wizards",
".",
"NewTestCaseWizardPageTwo",
";",
"public",
"class",
"NewGroovyTestTypeWizardPage",
"extends",
"NewTestCaseWizardPageOne",
"{",
"private",
"static",
"final",
"String",
"DOT_GROOVY",
"=",
"\".groovy\"",
";",
"private",
"static",
"final",
"String",
"GROOVY_TEST_CASE",
"=",
"\"\"",
";",
"protected",
"static",
"final",
"String",
"GROOVY_NATURE_ERROR_MSG",
"=",
"\"\"",
";",
"private",
"IType",
"maybeCreatedType",
";",
"public",
"NewGroovyTestTypeWizardPage",
"(",
"NewTestCaseWizardPageTwo",
"page2",
")",
"{",
"super",
"(",
"page2",
")",
";",
"}",
"@",
"Override",
"protected",
"String",
"getCompilationUnitName",
"(",
"String",
"typeName",
")",
"{",
"return",
"typeName",
"+",
"DOT_GROOVY",
";",
"}",
"@",
"Override",
"protected",
"String",
"getJUnit3TestSuperclassName",
"(",
")",
"{",
"return",
"GROOVY_TEST_CASE",
";",
"}",
"@",
"Override",
"public",
"IType",
"getCreatedType",
"(",
")",
"{",
"return",
"maybeCreatedType",
"!=",
"null",
"?",
"maybeCreatedType",
":",
"super",
".",
"getCreatedType",
"(",
")",
";",
"}",
"protected",
"boolean",
"hasGroovyNature",
"(",
")",
"{",
"IProject",
"project",
"=",
"getProject",
"(",
")",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
"return",
"GroovyNature",
".",
"hasGroovyNature",
"(",
"project",
")",
";",
"}",
"return",
"false",
";",
"}",
"protected",
"IProject",
"getProject",
"(",
")",
"{",
"IJavaProject",
"javaProject",
"=",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"javaProject",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"javaProject",
".",
"getProject",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"IStatus",
"superClassChanged",
"(",
")",
"{",
"if",
"(",
"isJUnit4",
"(",
")",
")",
"{",
"return",
"super",
".",
"superClassChanged",
"(",
")",
";",
"}",
"String",
"superClassName",
"=",
"getSuperClass",
"(",
")",
";",
"if",
"(",
"GROOVY_TEST_CASE",
".",
"equals",
"(",
"superClassName",
")",
")",
"{",
"return",
"new",
"JUnitStatus",
"(",
")",
";",
"}",
"return",
"super",
".",
"superClassChanged",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getModifiers",
"(",
")",
"{",
"int",
"modifiers",
"=",
"super",
".",
"getModifiers",
"(",
")",
";",
"modifiers",
"&=",
"~",
"F_PUBLIC",
";",
"modifiers",
"&=",
"~",
"F_PRIVATE",
";",
"modifiers",
"&=",
"~",
"F_PROTECTED",
";",
"return",
"modifiers",
";",
"}",
"@",
"Override",
"protected",
"void",
"updateStatus",
"(",
"IStatus",
"status",
")",
"{",
"if",
"(",
"!",
"hasGroovyNature",
"(",
")",
")",
"{",
"super",
".",
"updateStatus",
"(",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"GroovyPlugin",
".",
"PLUGIN_ID",
",",
"GROOVY_NATURE_ERROR_MSG",
")",
")",
";",
"return",
";",
"}",
"super",
".",
"updateStatus",
"(",
"status",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"createType",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"hasGroovyNature",
"(",
")",
")",
"{",
"GroovyCore",
".",
"logWarning",
"(",
"GROOVY_NATURE_ERROR_MSG",
")",
";",
"return",
";",
"}",
"IPackageFragment",
"pack",
"=",
"getPackageFragment",
"(",
")",
";",
"if",
"(",
"pack",
"==",
"null",
")",
"{",
"pack",
"=",
"getPackageFragmentRoot",
"(",
")",
".",
"getPackageFragment",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"!",
"isJUnit4",
"(",
")",
"&&",
"getPackageFragment",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"createTypeInDefaultPackageJUnit3",
"(",
"pack",
",",
"monitor",
")",
";",
"}",
"else",
"{",
"super",
".",
"createType",
"(",
"monitor",
")",
";",
"}",
"}",
"private",
"void",
"createTypeInDefaultPackageJUnit3",
"(",
"IPackageFragment",
"pack",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"superClass",
"=",
"getSuperClass",
"(",
")",
";",
"String",
"typeName",
"=",
"getTypeName",
"(",
")",
";",
"String",
"[",
"]",
"splits",
"=",
"superClass",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"if",
"(",
"superClass",
"!=",
"null",
"&&",
"!",
"superClass",
".",
"equals",
"(",
"GROOVY_TEST_CASE",
")",
")",
"{",
"if",
"(",
"splits",
".",
"length",
">",
"1",
")",
"{",
"sb",
".",
"append",
"(",
"\"import",
"\"",
"+",
"superClass",
"+",
"\"nn\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\"class",
"\"",
")",
".",
"append",
"(",
"typeName",
")",
".",
"append",
"(",
"\"",
"extends",
"\"",
")",
".",
"append",
"(",
"splits",
"[",
"splits",
".",
"length",
"-",
"1",
"]",
")",
";",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"\"class",
"\"",
")",
".",
"append",
"(",
"typeName",
")",
".",
"append",
"(",
"\"",
"extends",
"\"",
")",
".",
"append",
"(",
"splits",
"[",
"splits",
".",
"length",
"-",
"1",
"]",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\"",
"{nn\"",
")",
";",
"sb",
".",
"append",
"(",
"\"}\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"pack",
".",
"createCompilationUnit",
"(",
"typeName",
"+",
"DOT_GROOVY",
",",
"sb",
".",
"toString",
"(",
")",
",",
"true",
",",
"monitor",
")",
";",
"maybeCreatedType",
"=",
"unit",
".",
"getType",
"(",
"typeName",
")",
";",
"}",
"}",
"</s>"
] |
6,292 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"launchers",
".",
"GroovyShellLaunchDelegate",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"util",
".",
"ListUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"DebugPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfigurationType",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfigurationWorkingCopy",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchManager",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"DebugUITools",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ILaunchShortcut",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"launching",
".",
"IJavaLaunchConfigurationConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"launching",
".",
"JavaRuntime",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"public",
"class",
"GroovyShellLaunchShortcut",
"implements",
"ILaunchShortcut",
"{",
"public",
"static",
"final",
"String",
"GROOVY_SHELL_LAUNCH_CONFIG_ID",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"SELECT_CONFIG_DIALOG_TITLE",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"SELECT_CONFIG_DIALOG_TEXT",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"GROOVY_FILE_NOT_RUNNABLE_MESSAGE",
"=",
"\"\"",
";",
"public",
"void",
"launch",
"(",
"ISelection",
"selection",
",",
"String",
"mode",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
"&&",
"(",
"(",
"IStructuredSelection",
")",
"selection",
")",
".",
"getFirstElement",
"(",
")",
"instanceof",
"IJavaElement",
")",
"{",
"IStructuredSelection",
"structredSelection",
"=",
"(",
"IStructuredSelection",
")",
"selection",
";",
"IJavaElement",
"elt",
"=",
"(",
"IJavaElement",
")",
"structredSelection",
".",
"getFirstElement",
"(",
")",
";",
"launchGroovy",
"(",
"elt",
".",
"getJavaProject",
"(",
")",
",",
"mode",
")",
";",
"}",
"}",
"public",
"void",
"launch",
"(",
"IEditorPart",
"editor",
",",
"String",
"mode",
")",
"{",
"editor",
".",
"getEditorSite",
"(",
")",
".",
"getPage",
"(",
")",
".",
"saveEditor",
"(",
"editor",
",",
"false",
")",
";",
"IEditorInput",
"input",
"=",
"editor",
".",
"getEditorInput",
"(",
")",
";",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"input",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"if",
"(",
"unit",
".",
"getJavaProject",
"(",
")",
"!=",
"null",
")",
"{",
"launchGroovy",
"(",
"unit",
".",
"getJavaProject",
"(",
")",
",",
"mode",
")",
";",
"}",
"}",
"private",
"void",
"launchGroovy",
"(",
"IJavaProject",
"project",
",",
"String",
"mode",
")",
"{",
"String",
"className",
"=",
"org",
".",
"codehaus",
".",
"groovy",
".",
"tools",
".",
"shell",
".",
"Main",
".",
"class",
".",
"getName",
"(",
")",
";",
"try",
"{",
"String",
"launchName",
"=",
"getLaunchManager",
"(",
")",
".",
"generateLaunchConfigurationName",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"ILaunchConfigurationWorkingCopy",
"launchConfig",
"=",
"getGroovyLaunchConfigType",
"(",
")",
".",
"newInstance",
"(",
"null",
",",
"launchName",
")",
";",
"launchConfig",
".",
"setAttribute",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_MAIN_TYPE_NAME",
",",
"className",
")",
";",
"launchConfig",
".",
"setAttribute",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_PROJECT_NAME",
",",
"project",
".",
"getElementName",
"(",
")",
")",
";",
"launchConfig",
".",
"setAttribute",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_VM_ARGUMENTS",
",",
"\"\"",
")",
";",
"List",
"<",
"String",
">",
"classpath",
"=",
"ListUtil",
".",
"newList",
"(",
"JavaRuntime",
".",
"computeDefaultRuntimeClassPath",
"(",
"project",
")",
")",
";",
"classpath",
".",
"addAll",
"(",
"0",
",",
"GroovyShellLaunchDelegate",
".",
"getExtraClasspathElements",
"(",
")",
")",
";",
"launchConfig",
".",
"setAttribute",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_CLASSPATH",
",",
"classpath",
")",
";",
"DebugUITools",
".",
"launch",
"(",
"launchConfig",
",",
"mode",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"public",
"static",
"ILaunchConfigurationType",
"getGroovyLaunchConfigType",
"(",
")",
"{",
"return",
"getLaunchManager",
"(",
")",
".",
"getLaunchConfigurationType",
"(",
"GROOVY_SHELL_LAUNCH_CONFIG_ID",
")",
";",
"}",
"public",
"static",
"ILaunchManager",
"getLaunchManager",
"(",
")",
"{",
"return",
"DebugPlugin",
".",
"getDefault",
"(",
")",
".",
"getLaunchManager",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,293 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyProjectFacade",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ILaunchConfigurationTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"GroovyScriptLauncherTab",
"extends",
"AbstractGroovyLauncherTab",
"implements",
"ILaunchConfigurationTab",
"{",
"@",
"Override",
"protected",
"List",
"<",
"IType",
">",
"findAllRunnableTypes",
"(",
"IJavaProject",
"javaProject",
")",
"throws",
"JavaModelException",
"{",
"return",
"new",
"GroovyProjectFacade",
"(",
"javaProject",
")",
".",
"findAllScripts",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,294 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"ui",
".",
"viewsupport",
".",
"JavaUILabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ILabelProvider",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"window",
".",
"Window",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"dialogs",
".",
"ElementListSelectionDialog",
";",
"public",
"class",
"LaunchShortcutHelper",
"{",
"public",
"static",
"final",
"String",
"SELECT_CLASS_DIALOG_TITLE",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"SELECT_CLASS_DIALOG_TEXT",
"=",
"\"\"",
";",
"public",
"static",
"IType",
"chooseClassNode",
"(",
"List",
"<",
"IType",
">",
"types",
")",
"{",
"return",
"chooseFromList",
"(",
"types",
",",
"new",
"JavaUILabelProvider",
"(",
")",
",",
"SELECT_CLASS_DIALOG_TITLE",
",",
"SELECT_CLASS_DIALOG_TEXT",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"chooseFromList",
"(",
"List",
"<",
"T",
">",
"options",
",",
"ILabelProvider",
"labelProvider",
",",
"String",
"title",
",",
"String",
"message",
")",
"{",
"ElementListSelectionDialog",
"dialog",
"=",
"new",
"ElementListSelectionDialog",
"(",
"GroovyPlugin",
".",
"getActiveWorkbenchShell",
"(",
")",
",",
"labelProvider",
")",
";",
"dialog",
".",
"setElements",
"(",
"options",
".",
"toArray",
"(",
")",
")",
";",
"dialog",
".",
"setTitle",
"(",
"title",
")",
";",
"dialog",
".",
"setMessage",
"(",
"message",
")",
";",
"dialog",
".",
"setMultipleSelection",
"(",
"false",
")",
";",
"int",
"result",
"=",
"dialog",
".",
"open",
"(",
")",
";",
"labelProvider",
".",
"dispose",
"(",
")",
";",
"if",
"(",
"result",
"==",
"Window",
".",
"OK",
")",
"{",
"return",
"(",
"T",
")",
"dialog",
".",
"getFirstResult",
"(",
")",
";",
"}",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"}",
"}",
"</s>"
] |
6,295 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"SortedSet",
";",
"import",
"java",
".",
"util",
".",
"TreeSet",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"GroovyPlugin",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"GroovyCore",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"model",
".",
"GroovyProjectFacade",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"preferences",
".",
"PreferenceConstants",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"core",
".",
"util",
".",
"ListUtil",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IAdaptable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"DebugPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfiguration",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfigurationType",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfigurationWorkingCopy",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchManager",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"DebugUITools",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"IDebugModelPresentation",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ILaunchShortcut",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaLaunchShortcut",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"launching",
".",
"IJavaLaunchConfigurationConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"launching",
".",
"JavaRuntime",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"dialogs",
".",
"MessageDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"ISelection",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"viewers",
".",
"IStructuredSelection",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorInput",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"IEditorPart",
";",
"import",
"org",
".",
"eclipse",
".",
"ui",
".",
"PlatformUI",
";",
"public",
"abstract",
"class",
"AbstractGroovyLaunchShortcut",
"implements",
"ILaunchShortcut",
"{",
"public",
"static",
"final",
"String",
"SELECT_CONFIG_DIALOG_TITLE",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"SELECT_CONFIG_DIALOG_TEXT",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"GROOVY_FILE_NOT_RUNNABLE_MESSAGE",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"GROOVY_TYPE_TO_RUN",
"=",
"\"\"",
";",
"private",
"final",
"String",
"title",
";",
"private",
"final",
"String",
"text",
";",
"private",
"final",
"String",
"msg",
";",
"public",
"AbstractGroovyLaunchShortcut",
"(",
")",
"{",
"title",
"=",
"SELECT_CONFIG_DIALOG_TITLE",
".",
"replace",
"(",
"\"{0}\"",
",",
"applicationOrConsole",
"(",
")",
")",
";",
"text",
"=",
"SELECT_CONFIG_DIALOG_TEXT",
".",
"replace",
"(",
"\"{0}\"",
",",
"applicationOrConsole",
"(",
")",
")",
";",
"msg",
"=",
"GROOVY_FILE_NOT_RUNNABLE_MESSAGE",
".",
"replace",
"(",
"\"{0}\"",
",",
"applicationOrConsole",
"(",
")",
")",
";",
"}",
"public",
"void",
"launch",
"(",
"ISelection",
"selection",
",",
"String",
"mode",
")",
"{",
"ICompilationUnit",
"unit",
"=",
"extractCompilationUnit",
"(",
"selection",
")",
";",
"IJavaProject",
"javaProject",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"javaProject",
"=",
"unit",
".",
"getJavaProject",
"(",
")",
";",
"}",
"else",
"{",
"javaProject",
"=",
"extractJavaProject",
"(",
"selection",
")",
";",
"}",
"if",
"(",
"javaProject",
"==",
"null",
"&&",
"unit",
"==",
"null",
")",
"{",
"MessageDialog",
".",
"openError",
"(",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
",",
"\"\"",
",",
"\"\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"unit",
"!=",
"null",
"||",
"canLaunchWithNoType",
"(",
")",
")",
"{",
"launchGroovy",
"(",
"unit",
",",
"javaProject",
",",
"mode",
")",
";",
"}",
"else",
"{",
"MessageDialog",
".",
"openError",
"(",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
".",
"getShell",
"(",
")",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"}",
"private",
"IJavaProject",
"extractJavaProject",
"(",
"ISelection",
"selection",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"IStructuredSelection",
"struct",
"=",
"(",
"IStructuredSelection",
")",
"selection",
";",
"Object",
"obj",
"=",
"struct",
".",
"getFirstElement",
"(",
")",
";",
"IJavaProject",
"javaProject",
";",
"if",
"(",
"obj",
"instanceof",
"IAdaptable",
")",
"{",
"javaProject",
"=",
"(",
"IJavaProject",
")",
"(",
"(",
"IAdaptable",
")",
"obj",
")",
".",
"getAdapter",
"(",
"IJavaProject",
".",
"class",
")",
";",
"if",
"(",
"javaProject",
"!=",
"null",
")",
"{",
"return",
"javaProject",
";",
"}",
"IProject",
"project",
"=",
"(",
"IProject",
")",
"(",
"(",
"IAdaptable",
")",
"obj",
")",
".",
"getAdapter",
"(",
"IProject",
".",
"class",
")",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
"return",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"ICompilationUnit",
"extractCompilationUnit",
"(",
"ISelection",
"selection",
")",
"{",
"if",
"(",
"selection",
"instanceof",
"IStructuredSelection",
")",
"{",
"IStructuredSelection",
"struct",
"=",
"(",
"IStructuredSelection",
")",
"selection",
";",
"Object",
"obj",
"=",
"struct",
".",
"getFirstElement",
"(",
")",
";",
"ICompilationUnit",
"unit",
";",
"if",
"(",
"obj",
"instanceof",
"IAdaptable",
")",
"{",
"unit",
"=",
"(",
"ICompilationUnit",
")",
"(",
"(",
"IAdaptable",
")",
"obj",
")",
".",
"getAdapter",
"(",
"ICompilationUnit",
".",
"class",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"return",
"unit",
";",
"}",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"(",
"(",
"IAdaptable",
")",
"obj",
")",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"return",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"void",
"launchGroovy",
"(",
"ICompilationUnit",
"unit",
",",
"IJavaProject",
"javaProject",
",",
"String",
"mode",
")",
"{",
"IType",
"runType",
"=",
"null",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"IType",
"[",
"]",
"types",
"=",
"null",
";",
"try",
"{",
"types",
"=",
"unit",
".",
"getAllTypes",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"errorRunningGroovy",
"(",
"e",
")",
";",
"return",
";",
"}",
"runType",
"=",
"findClassToRun",
"(",
"types",
")",
";",
"if",
"(",
"runType",
"==",
"null",
")",
"{",
"GroovyCore",
".",
"errorRunningGroovy",
"(",
"new",
"Exception",
"(",
"msg",
")",
")",
";",
"return",
";",
"}",
"}",
"Map",
"<",
"String",
",",
"String",
">",
"launchConfigProperties",
"=",
"createLaunchProperties",
"(",
"runType",
",",
"javaProject",
")",
";",
"try",
"{",
"ILaunchConfigurationWorkingCopy",
"workingConfig",
"=",
"findOrCreateLaunchConfig",
"(",
"launchConfigProperties",
",",
"runType",
"!=",
"null",
"?",
"runType",
".",
"getElementName",
"(",
")",
":",
"javaProject",
".",
"getElementName",
"(",
")",
")",
";",
"workingConfig",
".",
"setAttribute",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_CLASSPATH",
",",
"Arrays",
".",
"asList",
"(",
"JavaRuntime",
".",
"computeDefaultRuntimeClassPath",
"(",
"javaProject",
")",
")",
")",
";",
"ILaunchConfiguration",
"config",
"=",
"workingConfig",
".",
"doSave",
"(",
")",
";",
"DebugUITools",
".",
"launch",
"(",
"config",
",",
"mode",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"GroovyCore",
".",
"errorRunningGroovyFile",
"(",
"(",
"IFile",
")",
"unit",
".",
"getResource",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"protected",
"abstract",
"String",
"classToRun",
"(",
")",
";",
"protected",
"Map",
"<",
"String",
",",
"String",
">",
"createLaunchProperties",
"(",
"IType",
"runType",
",",
"IJavaProject",
"javaProject",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"launchConfigProperties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"String",
"pathToClass",
";",
"if",
"(",
"runType",
"!=",
"null",
")",
"{",
"try",
"{",
"pathToClass",
"=",
"\"\"",
"+",
"runType",
".",
"getResource",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"toPortableString",
"(",
")",
"+",
"\"}\\\"\"",
";",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"pathToClass",
"=",
"\"\"",
";",
"GroovyCore",
".",
"errorRunningGroovy",
"(",
"new",
"IllegalArgumentException",
"(",
"\"\"",
"+",
"runType",
")",
")",
";",
"}",
"}",
"else",
"{",
"pathToClass",
"=",
"\"\"",
";",
"}",
"launchConfigProperties",
".",
"put",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_MAIN_TYPE_NAME",
",",
"\"\"",
")",
";",
"launchConfigProperties",
".",
"put",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_PROJECT_NAME",
",",
"javaProject",
".",
"getElementName",
"(",
")",
")",
";",
"launchConfigProperties",
".",
"put",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_VM_ARGUMENTS",
",",
"\"\"",
"+",
"getGroovyConf",
"(",
")",
"+",
"\"\"",
"+",
"getGroovyHome",
"(",
")",
")",
";",
"launchConfigProperties",
".",
"put",
"(",
"GROOVY_TYPE_TO_RUN",
",",
"runType",
"==",
"null",
"?",
"\"\"",
":",
"runType",
".",
"getFullyQualifiedName",
"(",
")",
")",
";",
"launchConfigProperties",
".",
"put",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_PROGRAM_ARGUMENTS",
",",
"\"--classpath",
"\"",
"+",
"generateClasspath",
"(",
"javaProject",
")",
"+",
"\"",
"--main",
"\"",
"+",
"classToRun",
"(",
")",
"+",
"pathToClass",
")",
";",
"launchConfigProperties",
".",
"put",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_WORKING_DIRECTORY",
",",
"getWorkingDirectory",
"(",
"runType",
",",
"javaProject",
")",
")",
";",
"return",
"launchConfigProperties",
";",
"}",
"private",
"String",
"getGroovyConf",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"private",
"String",
"getGroovyHome",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"private",
"String",
"getWorkingDirectory",
"(",
"IType",
"runType",
",",
"IJavaProject",
"javaProject",
")",
"{",
"String",
"workingDirSetting",
"=",
"GroovyPlugin",
".",
"getDefault",
"(",
")",
".",
"getPreferenceStore",
"(",
")",
".",
"getString",
"(",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_DEFAULT_WORKING_DIRECTORY",
")",
";",
"if",
"(",
"workingDirSetting",
".",
"equals",
"(",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_ECLIPSE_HOME",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"else",
"if",
"(",
"workingDirSetting",
".",
"equals",
"(",
"PreferenceConstants",
".",
"GROOVY_SCRIPT_SCRIPT_LOC",
")",
"&&",
"runType",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"runType",
".",
"getResource",
"(",
")",
".",
"getParent",
"(",
")",
".",
"getLocation",
"(",
")",
".",
"toOSString",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
"+",
"runType",
".",
"getElementName",
"(",
")",
",",
"e",
")",
";",
"return",
"getProjectLocation",
"(",
"runType",
")",
";",
"}",
"}",
"else",
"{",
"return",
"getProjectLocation",
"(",
"javaProject",
")",
";",
"}",
"}",
"private",
"String",
"getProjectLocation",
"(",
"IJavaElement",
"elt",
")",
"{",
"return",
"\"\"",
"+",
"elt",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"}\"",
";",
"}",
"private",
"String",
"getProjectLocation",
"(",
"IPath",
"path",
")",
"{",
"if",
"(",
"path",
".",
"segmentCount",
"(",
")",
">",
"0",
")",
"{",
"return",
"\"\"",
"+",
"path",
".",
"segment",
"(",
"0",
")",
"+",
"\"}\"",
";",
"}",
"else",
"{",
"return",
"\"\"",
";",
"}",
"}",
"protected",
"String",
"generateClasspath",
"(",
"IJavaProject",
"javaProject",
")",
"{",
"SortedSet",
"<",
"String",
">",
"sourceEntries",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
")",
";",
"SortedSet",
"<",
"String",
">",
"binEntries",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
")",
";",
"addClasspathEntriesForProject",
"(",
"javaProject",
",",
"sourceEntries",
",",
"binEntries",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\\\"\"",
")",
";",
"for",
"(",
"String",
"entry",
":",
"sourceEntries",
")",
"{",
"sb",
".",
"append",
"(",
"entry",
")",
";",
"sb",
".",
"append",
"(",
"File",
".",
"pathSeparator",
")",
";",
"}",
"for",
"(",
"String",
"entry",
":",
"binEntries",
")",
"{",
"sb",
".",
"append",
"(",
"entry",
")",
";",
"sb",
".",
"append",
"(",
"File",
".",
"pathSeparator",
")",
";",
"}",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"sb",
".",
"replace",
"(",
"sb",
".",
"length",
"(",
")",
"-",
"1",
",",
"sb",
".",
"length",
"(",
")",
",",
"\"\\\"\"",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"private",
"void",
"addClasspathEntriesForProject",
"(",
"IJavaProject",
"javaProject",
",",
"SortedSet",
"<",
"String",
">",
"sourceEntries",
",",
"SortedSet",
"<",
"String",
">",
"binEntries",
")",
"{",
"List",
"<",
"IJavaProject",
">",
"dependingProjects",
"=",
"new",
"ArrayList",
"<",
"IJavaProject",
">",
"(",
")",
";",
"try",
"{",
"IClasspathEntry",
"[",
"]",
"entries",
"=",
"javaProject",
".",
"getRawClasspath",
"(",
")",
";",
"for",
"(",
"IClasspathEntry",
"entry",
":",
"entries",
")",
"{",
"int",
"kind",
"=",
"entry",
".",
"getEntryKind",
"(",
")",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"IPath",
"libPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"!",
"isPathInWorkspace",
"(",
"libPath",
")",
")",
"{",
"sourceEntries",
".",
"add",
"(",
"libPath",
".",
"toOSString",
"(",
")",
")",
";",
"break",
";",
"}",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"IPath",
"srcPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"String",
"sloc",
"=",
"getProjectLocation",
"(",
"srcPath",
")",
";",
"if",
"(",
"srcPath",
".",
"segmentCount",
"(",
")",
">",
"1",
")",
"{",
"sloc",
"+=",
"File",
".",
"separator",
"+",
"srcPath",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"toOSString",
"(",
")",
";",
"}",
"sourceEntries",
".",
"add",
"(",
"sloc",
")",
";",
"IPath",
"outPath",
"=",
"entry",
".",
"getOutputLocation",
"(",
")",
";",
"if",
"(",
"outPath",
"!=",
"null",
")",
"{",
"String",
"bloc",
"=",
"getProjectLocation",
"(",
"outPath",
")",
";",
"if",
"(",
"outPath",
".",
"segmentCount",
"(",
")",
">",
"1",
")",
"{",
"bloc",
"+=",
"File",
".",
"separator",
"+",
"outPath",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"toOSString",
"(",
")",
";",
"}",
"binEntries",
".",
"add",
"(",
"bloc",
")",
";",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"dependingProjects",
".",
"add",
"(",
"javaProject",
".",
"getJavaModel",
"(",
")",
".",
"getJavaProject",
"(",
"entry",
".",
"getPath",
"(",
")",
".",
"lastSegment",
"(",
")",
")",
")",
";",
"break",
";",
"}",
"}",
"IPath",
"defaultOutPath",
"=",
"javaProject",
".",
"getOutputLocation",
"(",
")",
";",
"if",
"(",
"defaultOutPath",
"!=",
"null",
")",
"{",
"String",
"bloc",
"=",
"getProjectLocation",
"(",
"javaProject",
")",
";",
"if",
"(",
"defaultOutPath",
".",
"segmentCount",
"(",
")",
">",
"1",
")",
"{",
"bloc",
"+=",
"File",
".",
"separator",
"+",
"defaultOutPath",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"toOSString",
"(",
")",
";",
"}",
"binEntries",
".",
"add",
"(",
"bloc",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"GroovyCore",
".",
"logException",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"for",
"(",
"IJavaProject",
"dependingProject",
":",
"dependingProjects",
")",
"{",
"if",
"(",
"dependingProject",
".",
"getProject",
"(",
")",
".",
"isAccessible",
"(",
")",
")",
"{",
"addClasspathEntriesForProject",
"(",
"dependingProject",
",",
"sourceEntries",
",",
"binEntries",
")",
";",
"}",
"}",
"}",
"private",
"boolean",
"isPathInWorkspace",
"(",
"IPath",
"libPath",
")",
"{",
"if",
"(",
"!",
"libPath",
".",
"isAbsolute",
"(",
")",
"||",
"libPath",
".",
"segmentCount",
"(",
")",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"libPath",
".",
"segment",
"(",
"0",
")",
")",
".",
"exists",
"(",
")",
";",
"}",
"public",
"void",
"launch",
"(",
"IEditorPart",
"editor",
",",
"String",
"mode",
")",
"{",
"editor",
".",
"getEditorSite",
"(",
")",
".",
"getPage",
"(",
")",
".",
"saveEditor",
"(",
"editor",
",",
"false",
")",
";",
"IEditorInput",
"input",
"=",
"editor",
".",
"getEditorInput",
"(",
")",
";",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"input",
".",
"getAdapter",
"(",
"IFile",
".",
"class",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"launchGroovy",
"(",
"unit",
",",
"unit",
".",
"getJavaProject",
"(",
")",
",",
"mode",
")",
";",
"}",
"}",
"public",
"IType",
"findClassToRun",
"(",
"IType",
"[",
"]",
"types",
")",
"{",
"IType",
"returnValue",
"=",
"null",
";",
"List",
"<",
"IType",
">",
"candidates",
"=",
"new",
"ArrayList",
"<",
"IType",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"GroovyProjectFacade",
".",
"hasRunnableMain",
"(",
"types",
"[",
"i",
"]",
")",
")",
"{",
"candidates",
".",
"add",
"(",
"types",
"[",
"i",
"]",
")",
";",
"}",
"}",
"if",
"(",
"candidates",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"returnValue",
"=",
"candidates",
".",
"get",
"(",
"0",
")",
";",
"}",
"else",
"{",
"returnValue",
"=",
"LaunchShortcutHelper",
".",
"chooseClassNode",
"(",
"candidates",
")",
";",
"}",
"return",
"returnValue",
";",
"}",
"public",
"ILaunchConfigurationWorkingCopy",
"findOrCreateLaunchConfig",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"configProperties",
",",
"String",
"simpleMainTypeName",
")",
"throws",
"CoreException",
"{",
"ILaunchConfigurationWorkingCopy",
"returnConfig",
";",
"ILaunchConfiguration",
"config",
"=",
"findConfiguration",
"(",
"configProperties",
".",
"get",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_PROJECT_NAME",
")",
",",
"configProperties",
".",
"get",
"(",
"GROOVY_TYPE_TO_RUN",
")",
")",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"returnConfig",
"=",
"createLaunchConfig",
"(",
"configProperties",
",",
"simpleMainTypeName",
")",
";",
"}",
"else",
"{",
"returnConfig",
"=",
"config",
".",
"getWorkingCopy",
"(",
")",
";",
"}",
"return",
"returnConfig",
";",
"}",
"public",
"ILaunchConfigurationWorkingCopy",
"createLaunchConfig",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"configProperties",
",",
"String",
"classUnderTest",
")",
"throws",
"CoreException",
"{",
"String",
"launchName",
"=",
"getLaunchManager",
"(",
")",
".",
"generateLaunchConfigurationName",
"(",
"classUnderTest",
")",
";",
"ILaunchConfigurationWorkingCopy",
"returnConfig",
"=",
"getGroovyLaunchConfigType",
"(",
")",
".",
"newInstance",
"(",
"null",
",",
"launchName",
")",
";",
"for",
"(",
"Iterator",
"<",
"String",
">",
"it",
"=",
"configProperties",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"String",
"key",
"=",
"it",
".",
"next",
"(",
")",
";",
"String",
"value",
"=",
"configProperties",
".",
"get",
"(",
"key",
")",
";",
"returnConfig",
".",
"setAttribute",
"(",
"key",
",",
"value",
")",
";",
"}",
"return",
"returnConfig",
";",
"}",
"private",
"ILaunchConfiguration",
"findConfiguration",
"(",
"String",
"projectName",
",",
"String",
"mainTypeName",
")",
"throws",
"CoreException",
"{",
"ILaunchConfiguration",
"returnValue",
"=",
"null",
";",
"ILaunchConfigurationType",
"configType",
"=",
"getGroovyLaunchConfigType",
"(",
")",
";",
"List",
"<",
"ILaunchConfiguration",
">",
"candidateConfigs",
"=",
"ListUtil",
".",
"newEmptyList",
"(",
")",
";",
"ILaunchConfiguration",
"[",
"]",
"configs",
"=",
"getLaunchManager",
"(",
")",
".",
"getLaunchConfigurations",
"(",
"configType",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"configs",
".",
"length",
";",
"i",
"++",
")",
"{",
"ILaunchConfiguration",
"config",
"=",
"configs",
"[",
"i",
"]",
";",
"if",
"(",
"config",
".",
"getAttribute",
"(",
"GROOVY_TYPE_TO_RUN",
",",
"\"\"",
")",
".",
"equals",
"(",
"mainTypeName",
")",
"&&",
"config",
".",
"getAttribute",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_PROJECT_NAME",
",",
"\"\"",
")",
".",
"equals",
"(",
"projectName",
")",
")",
"{",
"candidateConfigs",
".",
"add",
"(",
"config",
")",
";",
"}",
"}",
"int",
"candidateCount",
"=",
"candidateConfigs",
".",
"size",
"(",
")",
";",
"if",
"(",
"candidateCount",
"==",
"1",
")",
"{",
"returnValue",
"=",
"candidateConfigs",
".",
"get",
"(",
"0",
")",
";",
"}",
"else",
"if",
"(",
"candidateCount",
">",
"1",
")",
"{",
"returnValue",
"=",
"chooseConfiguration",
"(",
"candidateConfigs",
")",
";",
"}",
"return",
"returnValue",
";",
"}",
"public",
"ILaunchConfiguration",
"chooseConfiguration",
"(",
"List",
"<",
"ILaunchConfiguration",
">",
"configList",
")",
"{",
"IDebugModelPresentation",
"labelProvider",
"=",
"DebugUITools",
".",
"newDebugModelPresentation",
"(",
")",
";",
"return",
"LaunchShortcutHelper",
".",
"chooseFromList",
"(",
"configList",
",",
"labelProvider",
",",
"title",
",",
"text",
")",
";",
"}",
"protected",
"abstract",
"ILaunchConfigurationType",
"getGroovyLaunchConfigType",
"(",
")",
";",
"public",
"static",
"ILaunchManager",
"getLaunchManager",
"(",
")",
"{",
"return",
"DebugPlugin",
".",
"getDefault",
"(",
")",
".",
"getLaunchManager",
"(",
")",
";",
"}",
"protected",
"abstract",
"String",
"applicationOrConsole",
"(",
")",
";",
"protected",
"abstract",
"boolean",
"canLaunchWithNoType",
"(",
")",
";",
"}",
"</s>"
] |
6,296 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfigurationType",
";",
"public",
"class",
"GroovyConsoleLaunchShortcut",
"extends",
"AbstractGroovyLaunchShortcut",
"{",
"public",
"static",
"final",
"String",
"GROOVY_CONSOLE_LAUNCH_CONFIG_ID",
"=",
"\"\"",
";",
"@",
"Override",
"public",
"ILaunchConfigurationType",
"getGroovyLaunchConfigType",
"(",
")",
"{",
"return",
"getLaunchManager",
"(",
")",
".",
"getLaunchConfigurationType",
"(",
"GROOVY_CONSOLE_LAUNCH_CONFIG_ID",
")",
";",
"}",
"@",
"Override",
"protected",
"String",
"applicationOrConsole",
"(",
")",
"{",
"return",
"\"console\"",
";",
"}",
"@",
"Override",
"protected",
"String",
"classToRun",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"protected",
"boolean",
"canLaunchWithNoType",
"(",
")",
"{",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
6,297 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"AbstractLaunchConfigurationTabGroup",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"CommonTab",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"EnvironmentTab",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ILaunchConfigurationDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ILaunchConfigurationTab",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"sourcelookup",
".",
"SourceLookupTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaArgumentsTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaClasspathTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaJRETab",
";",
"public",
"class",
"GroovyScriptLaunchConfigurationTabGroup",
"extends",
"AbstractLaunchConfigurationTabGroup",
"{",
"public",
"void",
"createTabs",
"(",
"ILaunchConfigurationDialog",
"dialog",
",",
"String",
"mode",
")",
"{",
"ILaunchConfigurationTab",
"[",
"]",
"tabs",
"=",
"new",
"ILaunchConfigurationTab",
"[",
"]",
"{",
"new",
"GroovyScriptLauncherTab",
"(",
")",
",",
"new",
"JavaArgumentsTab",
"(",
")",
",",
"new",
"JavaJRETab",
"(",
")",
",",
"new",
"JavaClasspathTab",
"(",
")",
",",
"new",
"SourceLookupTab",
"(",
")",
",",
"new",
"EnvironmentTab",
"(",
")",
",",
"new",
"CommonTab",
"(",
")",
"}",
";",
"setTabs",
"(",
"tabs",
")",
";",
"}",
"}",
"</s>"
] |
6,298 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"AbstractLaunchConfigurationTabGroup",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"CommonTab",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"EnvironmentTab",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ILaunchConfigurationDialog",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"ui",
".",
"ILaunchConfigurationTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaArgumentsTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaClasspathTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaJRETab",
";",
"public",
"class",
"GroovyShellLaunchConfigurationTabGroup",
"extends",
"AbstractLaunchConfigurationTabGroup",
"{",
"public",
"void",
"createTabs",
"(",
"ILaunchConfigurationDialog",
"dialog",
",",
"String",
"mode",
")",
"{",
"ILaunchConfigurationTab",
"[",
"]",
"tabs",
"=",
"new",
"ILaunchConfigurationTab",
"[",
"]",
"{",
"new",
"GroovyShellLauncherTab",
"(",
")",
",",
"new",
"JavaArgumentsTab",
"(",
")",
",",
"new",
"JavaJRETab",
"(",
")",
",",
"new",
"JavaClasspathTab",
"(",
")",
",",
"new",
"EnvironmentTab",
"(",
")",
",",
"new",
"CommonTab",
"(",
")",
"}",
";",
"setTabs",
"(",
"tabs",
")",
";",
"}",
"}",
"</s>"
] |
6,299 | [
"<s>",
"package",
"org",
".",
"codehaus",
".",
"groovy",
".",
"eclipse",
".",
"launchers",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"debug",
".",
"core",
".",
"ILaunchConfiguration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaLaunchTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"debug",
".",
"ui",
".",
"launchConfigurations",
".",
"JavaMainTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"debug",
".",
"ui",
".",
"launcher",
".",
"SharedJavaMainTab",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"launching",
".",
"IJavaLaunchConfigurationConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"ISharedImages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"ui",
".",
"JavaUI",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Image",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Button",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Composite",
";",
"public",
"class",
"GroovyShellLauncherTab",
"extends",
"JavaMainTab",
"{",
"@",
"Override",
"protected",
"void",
"handleSearchButtonSelected",
"(",
")",
"{",
"}",
"@",
"Override",
"protected",
"void",
"createMainTypeEditor",
"(",
"Composite",
"parent",
",",
"String",
"text",
")",
"{",
"super",
".",
"createMainTypeEditor",
"(",
"parent",
",",
"text",
")",
";",
"fMainText",
".",
"getParent",
"(",
")",
".",
"setVisible",
"(",
"false",
")",
";",
"fMainText",
".",
"setText",
"(",
"org",
".",
"codehaus",
".",
"groovy",
".",
"tools",
".",
"shell",
".",
"Main",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"Button",
"fSearchButton",
"=",
"(",
"Button",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"SharedJavaMainTab",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"fSearchButton",
".",
"setVisible",
"(",
"false",
")",
";",
"Button",
"fSearchExternalJarsCheckButton",
"=",
"(",
"Button",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaMainTab",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"fSearchExternalJarsCheckButton",
".",
"setVisible",
"(",
"false",
")",
";",
"Button",
"fConsiderInheritedMainButton",
"=",
"(",
"Button",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaMainTab",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"fConsiderInheritedMainButton",
".",
"setVisible",
"(",
"false",
")",
";",
"Button",
"fStopInMainCheckButton",
"=",
"(",
"Button",
")",
"ReflectionUtils",
".",
"getPrivateField",
"(",
"JavaMainTab",
".",
"class",
",",
"\"\"",
",",
"this",
")",
";",
"fStopInMainCheckButton",
".",
"setVisible",
"(",
"false",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"updateMainTypeFromConfig",
"(",
"ILaunchConfiguration",
"config",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"initializeFrom",
"(",
"ILaunchConfiguration",
"config",
")",
"{",
"String",
"projectName",
"=",
"EMPTY_STRING",
";",
"try",
"{",
"projectName",
"=",
"config",
".",
"getAttribute",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_PROJECT_NAME",
",",
"EMPTY_STRING",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"setErrorMessage",
"(",
"ce",
".",
"getStatus",
"(",
")",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"fProjText",
".",
"setText",
"(",
"projectName",
")",
";",
"ReflectionUtils",
".",
"executePrivateMethod",
"(",
"JavaLaunchTab",
".",
"class",
",",
"\"\"",
",",
"new",
"Class",
"[",
"]",
"{",
"ILaunchConfiguration",
".",
"class",
"}",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"config",
"}",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"\"Groovy",
"Shell\"",
";",
"}",
"@",
"Override",
"public",
"Image",
"getImage",
"(",
")",
"{",
"return",
"JavaUI",
".",
"getSharedImages",
"(",
")",
".",
"getImage",
"(",
"ISharedImages",
".",
"IMG_OBJS_CLASS",
")",
";",
"}",
"}",
"</s>"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.