id
int32
0
12.9k
code
sequencelengths
2
264k
1,500
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "public", "interface", "OptionHandler", "{", "public", "String", "getNature", "(", ")", ";", "public", "Map", "<", "String", ",", "String", ">", "getValues", "(", ")", "throws", "Exception", ";", "public", "Map", "<", "String", ",", "String", ">", "getValues", "(", "IProject", "project", ")", "throws", "Exception", ";", "public", "void", "setOption", "(", "String", "name", ",", "String", "value", ")", "throws", "Exception", ";", "public", "void", "setOption", "(", "IProject", "project", ",", "String", "name", ",", "String", "value", ")", "throws", "Exception", ";", "}", "</s>" ]
1,501
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ";", "import", "org", ".", "eclim", ".", "Services", ";", "public", "class", "RegexValidator", "implements", "Validator", "{", "private", "String", "regex", ";", "public", "RegexValidator", "(", "String", "regex", ")", "{", "this", ".", "regex", "=", "regex", ";", "}", "public", "boolean", "isValid", "(", "Object", "value", ")", "{", "return", "value", "!=", "null", "&&", "(", "(", "String", ")", "value", ")", ".", "matches", "(", "regex", ")", ";", "}", "public", "String", "getMessage", "(", "String", "name", ",", "Object", "value", ")", "{", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "value", ",", "regex", ")", ";", "}", "}", "</s>" ]
1,502
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ";", "import", "com", ".", "google", ".", "gson", ".", "Gson", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonParseException", ";", "public", "class", "JsonValidator", "implements", "Validator", "{", "private", "static", "final", "Gson", "GSON", "=", "new", "Gson", "(", ")", ";", "private", "Class", "<", "?", ">", "type", ";", "private", "Validator", "itemValidator", ";", "public", "JsonValidator", "(", "Class", "<", "?", ">", "type", ",", "Validator", "itemValidator", ")", "{", "this", ".", "type", "=", "type", ";", "this", ".", "itemValidator", "=", "itemValidator", ";", "}", "@", "Override", "public", "boolean", "isValid", "(", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "try", "{", "Object", "result", "=", "GSON", ".", "fromJson", "(", "(", "String", ")", "value", ",", "type", ")", ";", "if", "(", "result", "!=", "null", "&&", "type", ".", "isArray", "(", ")", "&&", "itemValidator", "!=", "null", ")", "{", "Object", "[", "]", "results", "=", "(", "Object", "[", "]", ")", "result", ";", "for", "(", "Object", "v", ":", "results", ")", "{", "if", "(", "!", "itemValidator", ".", "isValid", "(", "v", ")", ")", "{", "return", "false", ";", "}", "}", "}", "}", "catch", "(", "JsonParseException", "jpe", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "@", "Override", "public", "String", "getMessage", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "try", "{", "Object", "result", "=", "GSON", ".", "fromJson", "(", "(", "String", ")", "value", ",", "type", ")", ";", "if", "(", "type", ".", "isArray", "(", ")", "&&", "itemValidator", "!=", "null", ")", "{", "Object", "[", "]", "results", "=", "(", "Object", "[", "]", ")", "result", ";", "for", "(", "Object", "v", ":", "results", ")", "{", "if", "(", "!", "itemValidator", ".", "isValid", "(", "v", ")", ")", "{", "return", "itemValidator", ".", "getMessage", "(", "name", ",", "v", ")", ";", "}", "}", "}", "}", "catch", "(", "JsonParseException", "jpe", ")", "{", "Throwable", "cause", "=", "jpe", ".", "getCause", "(", ")", ";", "if", "(", "cause", "!=", "null", "&&", "cause", ".", "getMessage", "(", ")", "!=", "null", ")", "{", "return", "cause", ".", "getMessage", "(", ")", ";", "}", "return", "jpe", ".", "getMessage", "(", ")", ";", "}", "}", "return", "null", ";", "}", "}", "</s>" ]
1,503
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ";", "import", "org", ".", "eclim", ".", "Services", ";", "public", "class", "Option", "implements", "Comparable", "<", "Option", ">", "{", "private", "static", "final", "String", "GENERAL", "=", "\"General\"", ";", "private", "String", "nature", ";", "private", "String", "path", ";", "private", "String", "name", ";", "private", "String", "description", ";", "private", "Validator", "validator", ";", "public", "String", "getNature", "(", ")", "{", "return", "this", ".", "nature", ";", "}", "public", "void", "setNature", "(", "String", "nature", ")", "{", "this", ".", "nature", "=", "nature", ";", "}", "public", "String", "getPath", "(", ")", "{", "return", "this", ".", "path", ";", "}", "public", "void", "setPath", "(", "String", "path", ")", "{", "this", ".", "path", "=", "path", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "this", ".", "description", ";", "}", "public", "void", "setDescription", "(", "String", "description", ")", "{", "this", ".", "description", "=", "Services", ".", "getMessage", "(", "description", ")", ";", "}", "public", "Validator", "getValidator", "(", ")", "{", "return", "this", ".", "validator", ";", "}", "public", "void", "setValidator", "(", "Validator", "validator", ")", "{", "this", ".", "validator", "=", "validator", ";", "}", "public", "int", "compareTo", "(", "Option", "obj", ")", "{", "if", "(", "obj", "==", "this", ")", "{", "return", "0", ";", "}", "int", "compare", "=", "0", ";", "if", "(", "this", ".", "getPath", "(", ")", ".", "equals", "(", "obj", ".", "getPath", "(", ")", ")", ")", "{", "compare", "=", "0", ";", "}", "if", "(", "this", ".", "getPath", "(", ")", ".", "startsWith", "(", "GENERAL", ")", "&&", "!", "obj", ".", "getPath", "(", ")", ".", "startsWith", "(", "GENERAL", ")", ")", "{", "return", "-", "1", ";", "}", "if", "(", "obj", ".", "getPath", "(", ")", ".", "startsWith", "(", "GENERAL", ")", "&&", "!", "this", ".", "getPath", "(", ")", ".", "startsWith", "(", "GENERAL", ")", ")", "{", "return", "1", ";", "}", "compare", "=", "this", ".", "getPath", "(", ")", ".", "compareTo", "(", "obj", ".", "getPath", "(", ")", ")", ";", "if", "(", "compare", "==", "0", ")", "{", "compare", "=", "this", ".", "getName", "(", ")", ".", "compareTo", "(", "obj", ".", "getName", "(", ")", ")", ";", "}", "return", "compare", ";", "}", "}", "</s>" ]
1,504
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ";", "public", "interface", "Validator", "{", "public", "boolean", "isValid", "(", "Object", "value", ")", ";", "public", "String", "getMessage", "(", "String", "name", ",", "Object", "value", ")", ";", "}", "</s>" ]
1,505
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ";", "import", "java", ".", "util", ".", "regex", ".", "Matcher", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "public", "class", "PreferenceFactory", "{", "private", "static", "final", "Pattern", "JSON_ARRAY", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "public", "static", "Preferences", "addOptions", "(", "String", "nature", ",", "String", "optionsString", ")", "{", "Preferences", "preferences", "=", "Preferences", ".", "getInstance", "(", ")", ";", "String", "[", "]", "strings", "=", "StringUtils", ".", "split", "(", "optionsString", ",", "'\\n'", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "strings", ".", "length", ";", "ii", "++", ")", "{", "if", "(", "strings", "[", "ii", "]", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "String", "[", "]", "attrs", "=", "parseOptionAttributes", "(", "strings", "[", "ii", "]", ")", ";", "Option", "option", "=", "new", "Option", "(", ")", ";", "option", ".", "setNature", "(", "nature", ")", ";", "option", ".", "setPath", "(", "attrs", "[", "0", "]", ")", ";", "option", ".", "setName", "(", "attrs", "[", "1", "]", ")", ";", "if", "(", "attrs", "[", "2", "]", "!=", "null", "&&", "!", "attrs", "[", "2", "]", ".", "trim", "(", ")", ".", "equals", "(", "StringUtils", ".", "EMPTY", ")", ")", "{", "option", ".", "setValidator", "(", "new", "RegexValidator", "(", "attrs", "[", "2", "]", ")", ")", ";", "}", "preferences", ".", "addOption", "(", "option", ")", ";", "}", "}", "return", "preferences", ";", "}", "public", "static", "Preferences", "addPreferences", "(", "String", "nature", ",", "String", "preferencesString", ")", "{", "Preferences", "preferences", "=", "Preferences", ".", "getInstance", "(", ")", ";", "String", "[", "]", "strings", "=", "StringUtils", ".", "split", "(", "preferencesString", ",", "'\\n'", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "strings", ".", "length", ";", "ii", "++", ")", "{", "if", "(", "strings", "[", "ii", "]", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "String", "[", "]", "attrs", "=", "parsePreferenceAttributes", "(", "strings", "[", "ii", "]", ")", ";", "Preference", "preference", "=", "new", "Preference", "(", ")", ";", "preference", ".", "setNature", "(", "nature", ")", ";", "preference", ".", "setPath", "(", "attrs", "[", "0", "]", ")", ";", "preference", ".", "setName", "(", "attrs", "[", "1", "]", ")", ";", "preference", ".", "setDefaultValue", "(", "attrs", "[", "2", "]", ")", ";", "if", "(", "attrs", "[", "3", "]", "!=", "null", "&&", "!", "attrs", "[", "3", "]", ".", "trim", "(", ")", ".", "equals", "(", "StringUtils", ".", "EMPTY", ")", ")", "{", "Matcher", "jsonArrayMatcher", "=", "JSON_ARRAY", ".", "matcher", "(", "attrs", "[", "3", "]", ")", ";", "if", "(", "jsonArrayMatcher", ".", "matches", "(", ")", ")", "{", "String", "pattern", "=", "jsonArrayMatcher", ".", "group", "(", "1", ")", ";", "preference", ".", "setValidator", "(", "new", "JsonValidator", "(", "String", "[", "]", ".", "class", ",", "pattern", ".", "length", "(", ")", "!=", "0", "?", "new", "RegexValidator", "(", "pattern", ")", ":", "null", ")", ")", ";", "}", "else", "{", "preference", ".", "setValidator", "(", "new", "RegexValidator", "(", "attrs", "[", "3", "]", ")", ")", ";", "}", "}", "preferences", ".", "addPreference", "(", "preference", ")", ";", "}", "}", "return", "preferences", ";", "}", "private", "static", "String", "[", "]", "parsePreferenceAttributes", "(", "String", "attrString", ")", "{", "attrString", "=", "attrString", ".", "trim", "(", ")", ";", "String", "[", "]", "attrs", "=", "new", "String", "[", "4", "]", ";", "int", "index", "=", "attrString", ".", "indexOf", "(", "'", "'", ")", ";", "attrs", "[", "0", "]", "=", "attrString", ".", "substring", "(", "0", ",", "index", ")", ";", "attrString", "=", "attrString", ".", "substring", "(", "index", "+", "1", ")", ";", "index", "=", "attrString", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "attrs", "[", "1", "]", "=", "attrString", ";", "}", "else", "{", "attrs", "[", "1", "]", "=", "attrString", ".", "substring", "(", "0", ",", "index", ")", ";", "attrString", "=", "attrString", ".", "substring", "(", "index", "+", "1", ")", ";", "index", "=", "attrString", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "attrs", "[", "2", "]", "=", "attrString", ".", "substring", "(", "0", ",", "index", ")", ";", "attrs", "[", "3", "]", "=", "attrString", ".", "substring", "(", "index", "+", "1", ")", ";", "}", "else", "{", "attrs", "[", "2", "]", "=", "attrString", ";", "}", "}", "return", "attrs", ";", "}", "private", "static", "String", "[", "]", "parseOptionAttributes", "(", "String", "attrString", ")", "{", "attrString", "=", "attrString", ".", "trim", "(", ")", ";", "String", "[", "]", "attrs", "=", "new", "String", "[", "3", "]", ";", "int", "index", "=", "attrString", ".", "indexOf", "(", "'", "'", ")", ";", "attrs", "[", "0", "]", "=", "attrString", ".", "substring", "(", "0", ",", "index", ")", ";", "attrString", "=", "attrString", ".", "substring", "(", "index", "+", "1", ")", ";", "index", "=", "attrString", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "attrs", "[", "1", "]", "=", "attrString", ".", "substring", "(", "0", ",", "index", ")", ";", "attrs", "[", "2", "]", "=", "attrString", ".", "substring", "(", "index", "+", "1", ")", ";", "}", "else", "{", "attrs", "[", "1", "]", "=", "attrString", ";", "}", "return", "attrs", ";", "}", "}", "</s>" ]
1,506
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ";", "public", "class", "OptionInstance", "extends", "Option", "{", "private", "String", "value", ";", "public", "OptionInstance", "(", "Option", "option", ",", "String", "value", ")", "{", "this", ".", "value", "=", "value", ";", "setPath", "(", "option", ".", "getPath", "(", ")", ")", ";", "setName", "(", "option", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "super", ".", "setName", "(", "name", ")", ";", "super", ".", "setDescription", "(", "name", ")", ";", "}", "public", "String", "getValue", "(", ")", "{", "return", "this", ".", "value", ";", "}", "public", "void", "setValue", "(", "String", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "}", "</s>" ]
1,507
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "ArrayUtils", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "logging", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ProjectScope", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "IEclipsePreferences", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "IScopeContext", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "InstanceScope", ";", "import", "com", ".", "google", ".", "gson", ".", "Gson", ";", "public", "class", "Preferences", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "Preferences", ".", "class", ")", ";", "public", "static", "final", "String", "USERNAME_PREFERENCE", "=", "\"\"", ";", "public", "static", "final", "String", "USEREMAIL_PREFERENCE", "=", "\"\"", ";", "public", "static", "final", "String", "PROJECT_COPYRIGHT_PREFERENCE", "=", "\"\"", ";", "private", "static", "final", "String", "NODE_NAME", "=", "\"org.eclim\"", ";", "private", "static", "final", "String", "CORE", "=", "\"core\"", ";", "private", "static", "final", "String", "GLOBAL", "=", "\"_global_\"", ";", "private", "static", "Preferences", "instance", "=", "new", "Preferences", "(", ")", ";", "private", "static", "Map", "<", "String", ",", "OptionHandler", ">", "optionHandlers", "=", "new", "HashMap", "<", "String", ",", "OptionHandler", ">", "(", ")", ";", "private", "Map", "<", "String", ",", "Preference", ">", "preferences", "=", "new", "HashMap", "<", "String", ",", "Preference", ">", "(", ")", ";", "private", "Map", "<", "String", ",", "Option", ">", "options", "=", "new", "HashMap", "<", "String", ",", "Option", ">", "(", ")", ";", "private", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "preferenceValues", "=", "new", "HashMap", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "(", ")", ";", "private", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "optionValues", "=", "new", "HashMap", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "(", ")", ";", "private", "Preferences", "(", ")", "{", "}", "public", "static", "Preferences", "getInstance", "(", ")", "{", "return", "instance", ";", "}", "public", "static", "OptionHandler", "addOptionHandler", "(", "String", "prefix", ",", "OptionHandler", "handler", ")", "{", "optionHandlers", ".", "put", "(", "prefix", ",", "handler", ")", ";", "return", "handler", ";", "}", "public", "void", "addPreference", "(", "Preference", "preference", ")", "{", "preferences", ".", "put", "(", "preference", ".", "getName", "(", ")", ",", "preference", ")", ";", "preferenceValues", ".", "clear", "(", ")", ";", "}", "public", "String", "[", "]", "getPreferenceNames", "(", ")", "{", "return", "preferences", ".", "keySet", "(", ")", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ";", "}", "public", "void", "addOption", "(", "Option", "option", ")", "{", "options", ".", "put", "(", "option", ".", "getName", "(", ")", ",", "option", ")", ";", "optionValues", ".", "clear", "(", ")", ";", "}", "public", "String", "[", "]", "getOptionNames", "(", ")", "{", "return", "options", ".", "keySet", "(", ")", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ";", "}", "public", "void", "clearProjectValueCache", "(", "IProject", "project", ")", "{", "preferenceValues", ".", "remove", "(", "project", ".", "getName", "(", ")", ")", ";", "optionValues", ".", "remove", "(", "project", ".", "getName", "(", ")", ")", ";", "}", "public", "Map", "<", "String", ",", "String", ">", "getValues", "(", ")", "throws", "Exception", "{", "return", "getValues", "(", "null", ")", ";", "}", "public", "Map", "<", "String", ",", "String", ">", "getValues", "(", "IProject", "project", ")", "throws", "Exception", "{", "String", "cacheKey", "=", "project", "!=", "null", "?", "project", ".", "getName", "(", ")", ":", "GLOBAL", ";", "Map", "<", "String", ",", "String", ">", "prefVals", "=", "preferenceValues", ".", "get", "(", "cacheKey", ")", ";", "if", "(", "prefVals", "==", "null", ")", "{", "prefVals", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "preferenceValues", ".", "put", "(", "cacheKey", ",", "prefVals", ")", ";", "IScopeContext", "context", "=", "InstanceScope", ".", "INSTANCE", ";", "IEclipsePreferences", "globalPrefs", "=", "context", ".", "getNode", "(", "NODE_NAME", ")", ";", "initializeDefaultPreferences", "(", "globalPrefs", ")", ";", "for", "(", "String", "key", ":", "globalPrefs", ".", "keys", "(", ")", ")", "{", "prefVals", ".", "put", "(", "key", ",", "globalPrefs", ".", "get", "(", "key", ",", "null", ")", ")", ";", "}", "if", "(", "project", "!=", "null", ")", "{", "context", "=", "new", "ProjectScope", "(", "project", ")", ";", "IEclipsePreferences", "projectPrefs", "=", "context", ".", "getNode", "(", "NODE_NAME", ")", ";", "for", "(", "String", "key", ":", "projectPrefs", ".", "keys", "(", ")", ")", "{", "prefVals", ".", "put", "(", "key", ",", "projectPrefs", ".", "get", "(", "key", ",", "null", ")", ")", ";", "}", "}", "}", "Map", "<", "String", ",", "String", ">", "optVals", "=", "optionValues", ".", "get", "(", "cacheKey", ")", ";", "if", "(", "optVals", "==", "null", ")", "{", "optVals", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "optionValues", ".", "put", "(", "cacheKey", ",", "optVals", ")", ";", "for", "(", "OptionHandler", "handler", ":", "optionHandlers", ".", "values", "(", ")", ")", "{", "String", "nature", "=", "handler", ".", "getNature", "(", ")", ";", "if", "(", "CORE", ".", "equals", "(", "nature", ")", "||", "project", "==", "null", "||", "project", ".", "getNature", "(", "nature", ")", "!=", "null", ")", "{", "Map", "<", "String", ",", "String", ">", "ops", "=", "project", "==", "null", "?", "handler", ".", "getValues", "(", ")", ":", "handler", ".", "getValues", "(", "project", ")", ";", "if", "(", "ops", "!=", "null", ")", "{", "optVals", ".", "putAll", "(", "ops", ")", ";", "}", "}", "}", "}", "Map", "<", "String", ",", "String", ">", "all", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", "preferenceValues", ".", "size", "(", ")", "+", "optionValues", ".", "size", "(", ")", ")", ";", "all", ".", "putAll", "(", "optVals", ")", ";", "all", ".", "putAll", "(", "prefVals", ")", ";", "return", "all", ";", "}", "public", "String", "getValue", "(", "String", "name", ")", "throws", "Exception", "{", "return", "getValues", "(", "null", ")", ".", "get", "(", "name", ")", ";", "}", "public", "String", "getValue", "(", "IProject", "project", ",", "String", "name", ")", "throws", "Exception", "{", "return", "getValues", "(", "project", ")", ".", "get", "(", "name", ")", ";", "}", "public", "int", "getIntValue", "(", "String", "name", ")", "throws", "Exception", "{", "return", "getIntValue", "(", "null", ",", "name", ")", ";", "}", "public", "int", "getIntValue", "(", "IProject", "project", ",", "String", "name", ")", "throws", "Exception", "{", "String", "value", "=", "getValues", "(", "project", ")", ".", "get", "(", "name", ")", ";", "return", "value", "!=", "null", "?", "Integer", ".", "parseInt", "(", "value", ")", ":", "-", "1", ";", "}", "public", "String", "[", "]", "getArrayValue", "(", "String", "name", ")", "throws", "Exception", "{", "return", "getArrayValue", "(", "null", ",", "name", ")", ";", "}", "public", "String", "[", "]", "getArrayValue", "(", "IProject", "project", ",", "String", "name", ")", "throws", "Exception", "{", "String", "value", "=", "getValues", "(", "project", ")", ".", "get", "(", "name", ")", ";", "if", "(", "value", "!=", "null", "&&", "value", ".", "trim", "(", ")", ".", "length", "(", ")", "!=", "0", ")", "{", "return", "new", "Gson", "(", ")", ".", "fromJson", "(", "value", ",", "String", "[", "]", ".", "class", ")", ";", "}", "return", "ArrayUtils", ".", "EMPTY_STRING_ARRAY", ";", "}", "public", "Option", "[", "]", "getOptions", "(", ")", "throws", "Exception", "{", "return", "getOptions", "(", "null", ")", ";", "}", "public", "Option", "[", "]", "getOptions", "(", "IProject", "project", ")", "throws", "Exception", "{", "ArrayList", "<", "OptionInstance", ">", "results", "=", "new", "ArrayList", "<", "OptionInstance", ">", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "options", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "IScopeContext", "context", "=", "InstanceScope", ".", "INSTANCE", ";", "IEclipsePreferences", "globalPrefs", "=", "context", ".", "getNode", "(", "NODE_NAME", ")", ";", "initializeDefaultPreferences", "(", "globalPrefs", ")", ";", "for", "(", "String", "key", ":", "globalPrefs", ".", "keys", "(", ")", ")", "{", "options", ".", "put", "(", "key", ",", "globalPrefs", ".", "get", "(", "key", ",", "null", ")", ")", ";", "}", "if", "(", "project", "!=", "null", ")", "{", "context", "=", "new", "ProjectScope", "(", "project", ")", ";", "IEclipsePreferences", "projectPrefs", "=", "context", ".", "getNode", "(", "NODE_NAME", ")", ";", "for", "(", "String", "key", ":", "projectPrefs", ".", "keys", "(", ")", ")", "{", "options", ".", "put", "(", "key", ",", "projectPrefs", ".", "get", "(", "key", ",", "null", ")", ")", ";", "}", "}", "for", "(", "OptionHandler", "handler", ":", "optionHandlers", ".", "values", "(", ")", ")", "{", "String", "nature", "=", "handler", ".", "getNature", "(", ")", ";", "if", "(", "CORE", ".", "equals", "(", "nature", ")", "||", "project", "==", "null", "||", "project", ".", "getNature", "(", "nature", ")", "!=", "null", ")", "{", "Map", "<", "String", ",", "String", ">", "ops", "=", "project", "==", "null", "?", "handler", ".", "getValues", "(", ")", ":", "handler", ".", "getValues", "(", "project", ")", ";", "if", "(", "ops", "!=", "null", ")", "{", "options", ".", "putAll", "(", "ops", ")", ";", "}", "}", "}", "for", "(", "String", "key", ":", "options", ".", "keySet", "(", ")", ")", "{", "String", "value", "=", "options", ".", "get", "(", "key", ")", ";", "Option", "option", "=", "this", ".", "options", ".", "get", "(", "key", ")", ";", "if", "(", "option", "==", "null", ")", "{", "option", "=", "this", ".", "preferences", ".", "get", "(", "key", ")", ";", "}", "if", "(", "option", "!=", "null", "&&", "value", "!=", "null", ")", "{", "String", "nature", "=", "option", ".", "getNature", "(", ")", ";", "if", "(", "CORE", ".", "equals", "(", "nature", ")", "||", "project", "==", "null", "||", "project", ".", "getNature", "(", "nature", ")", "!=", "null", ")", "{", "OptionInstance", "instance", "=", "new", "OptionInstance", "(", "option", ",", "value", ")", ";", "results", ".", "add", "(", "instance", ")", ";", "}", "}", "}", "return", "results", ".", "toArray", "(", "new", "Option", "[", "results", ".", "size", "(", ")", "]", ")", ";", "}", "public", "void", "setValue", "(", "String", "name", ",", "String", "value", ")", "throws", "Exception", "{", "setValue", "(", "null", ",", "name", ",", "value", ")", ";", "}", "public", "void", "setValue", "(", "IProject", "project", ",", "String", "name", ",", "String", "value", ")", "throws", "IllegalArgumentException", ",", "Exception", "{", "if", "(", "name", ".", "startsWith", "(", "NODE_NAME", ")", ")", "{", "setPreference", "(", "NODE_NAME", ",", "project", ",", "name", ",", "value", ")", ";", "}", "else", "{", "validateValue", "(", "options", ".", "get", "(", "name", ")", ",", "name", ",", "value", ")", ";", "OptionHandler", "handler", "=", "null", ";", "for", "(", "Object", "k", ":", "optionHandlers", ".", "keySet", "(", ")", ")", "{", "String", "key", "=", "(", "String", ")", "k", ";", "if", "(", "name", ".", "startsWith", "(", "key", ")", ")", "{", "handler", "=", "(", "OptionHandler", ")", "optionHandlers", ".", "get", "(", "key", ")", ";", "break", ";", "}", "}", "if", "(", "handler", "!=", "null", ")", "{", "if", "(", "project", "==", "null", ")", "{", "handler", ".", "setOption", "(", "name", ",", "value", ")", ";", "}", "else", "{", "handler", ".", "setOption", "(", "project", ",", "name", ",", "value", ")", ";", "}", "optionValues", ".", "clear", "(", ")", ";", "}", "else", "{", "logger", ".", "warn", "(", "\"\"", ",", "name", ")", ";", "}", "}", "}", "public", "void", "setPreference", "(", "String", "nodeName", ",", "IProject", "project", ",", "String", "name", ",", "String", "value", ")", "throws", "IllegalArgumentException", ",", "Exception", "{", "IScopeContext", "context", "=", "InstanceScope", ".", "INSTANCE", ";", "IEclipsePreferences", "globalPrefs", "=", "context", ".", "getNode", "(", "nodeName", ")", ";", "initializeDefaultPreferences", "(", "globalPrefs", ")", ";", "Option", "pref", "=", "preferences", ".", "get", "(", "name", ")", ";", "if", "(", "pref", "==", "null", ")", "{", "pref", "=", "options", ".", "get", "(", "name", ")", ";", "}", "if", "(", "project", "==", "null", ")", "{", "validateValue", "(", "pref", ",", "name", ",", "value", ")", ";", "globalPrefs", ".", "put", "(", "name", ",", "value", ")", ";", "globalPrefs", ".", "flush", "(", ")", ";", "}", "else", "{", "context", "=", "new", "ProjectScope", "(", "project", ")", ";", "IEclipsePreferences", "projectPrefs", "=", "context", ".", "getNode", "(", "nodeName", ")", ";", "if", "(", "value", ".", "equals", "(", "globalPrefs", ".", "get", "(", "name", ",", "null", ")", ")", ")", "{", "projectPrefs", ".", "remove", "(", "name", ")", ";", "projectPrefs", ".", "flush", "(", ")", ";", "}", "else", "{", "validateValue", "(", "pref", ",", "name", ",", "value", ")", ";", "projectPrefs", ".", "put", "(", "name", ",", "value", ")", ";", "projectPrefs", ".", "flush", "(", ")", ";", "}", "}", "preferenceValues", ".", "clear", "(", ")", ";", "}", "private", "void", "initializeDefaultPreferences", "(", "IEclipsePreferences", "preferences", ")", "throws", "Exception", "{", "String", "node", "=", "preferences", ".", "name", "(", ")", ";", "for", "(", "Preference", "preference", ":", "this", ".", "preferences", ".", "values", "(", ")", ")", "{", "String", "name", "=", "preference", ".", "getName", "(", ")", ";", "if", "(", "name", ".", "startsWith", "(", "node", ")", "&&", "preferences", ".", "get", "(", "name", ",", "null", ")", "==", "null", ")", "{", "preferences", ".", "put", "(", "preference", ".", "getName", "(", ")", ",", "preference", ".", "getDefaultValue", "(", ")", ")", ";", "}", "}", "preferences", ".", "flush", "(", ")", ";", "}", "private", "void", "validateValue", "(", "Option", "option", ",", "String", "name", ",", "String", "value", ")", "throws", "IllegalArgumentException", "{", "if", "(", "option", "!=", "null", ")", "{", "Validator", "validator", "=", "option", ".", "getValidator", "(", ")", ";", "if", "(", "validator", "==", "null", "||", "validator", ".", "isValid", "(", "value", ")", ")", "{", "return", ";", "}", "throw", "new", "IllegalArgumentException", "(", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ",", "validator", ".", "getMessage", "(", "name", ",", "value", ")", ")", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ")", ";", "}", "}", "</s>" ]
1,508
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "ArrayUtils", ";", "import", "org", ".", "eclim", ".", "logging", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "public", "class", "ProjectNatureFactory", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "ProjectNatureFactory", ".", "class", ")", ";", "public", "static", "String", "NONE", "=", "\"none\"", ";", "private", "static", "Map", "<", "String", ",", "String", "[", "]", ">", "natureAliases", "=", "new", "HashMap", "<", "String", ",", "String", "[", "]", ">", "(", ")", ";", "public", "static", "void", "addNature", "(", "String", "alias", ",", "String", "nature", ")", "{", "logger", ".", "debug", "(", "\"\"", ",", "alias", ",", "nature", ")", ";", "natureAliases", ".", "put", "(", "alias", ",", "new", "String", "[", "]", "{", "nature", "}", ")", ";", "}", "public", "static", "void", "addNature", "(", "String", "alias", ",", "String", "[", "]", "natures", ")", "{", "logger", ".", "debug", "(", "\"\"", ",", "alias", ",", "Arrays", ".", "toString", "(", "natures", ")", ")", ";", "natureAliases", ".", "put", "(", "alias", ",", "natures", ")", ";", "}", "public", "static", "String", "[", "]", "getNatureAliases", "(", ")", "{", "return", "natureAliases", ".", "keySet", "(", ")", ".", "toArray", "(", "ArrayUtils", ".", "EMPTY_STRING_ARRAY", ")", ";", "}", "public", "static", "Map", "<", "String", ",", "String", "[", "]", ">", "getNatureAliasesMap", "(", ")", "{", "return", "Collections", ".", "unmodifiableMap", "(", "natureAliases", ")", ";", "}", "public", "static", "String", "getNatureForAlias", "(", "String", "alias", ")", "{", "String", "[", "]", "natures", "=", "natureAliases", ".", "get", "(", "alias", ")", ";", "return", "natures", "!=", "null", "?", "natures", "[", "natures", ".", "length", "-", "1", "]", ":", "null", ";", "}", "public", "static", "String", "[", "]", "getNaturesForAlias", "(", "String", "alias", ")", "{", "return", "natureAliases", ".", "get", "(", "alias", ")", ";", "}", "public", "static", "String", "getAliasForNature", "(", "String", "natureId", ")", "{", "for", "(", "String", "key", ":", "natureAliases", ".", "keySet", "(", ")", ")", "{", "if", "(", "natureId", ".", "equals", "(", "getNatureForAlias", "(", "key", ")", ")", ")", "{", "return", "key", ";", "}", "}", "return", "null", ";", "}", "public", "static", "String", "[", "]", "getProjectNatureAliases", "(", "IProject", "project", ")", "throws", "Exception", "{", "ArrayList", "<", "String", ">", "aliases", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "key", ":", "natureAliases", ".", "keySet", "(", ")", ")", "{", "if", "(", "project", ".", "hasNature", "(", "getNatureForAlias", "(", "key", ")", ")", ")", "{", "aliases", ".", "add", "(", "key", ")", ";", "}", "}", "return", "aliases", ".", "toArray", "(", "new", "String", "[", "aliases", ".", "size", "(", ")", "]", ")", ";", "}", "public", "static", "String", "[", "]", "getProjectNatures", "(", "IProject", "project", ")", "throws", "Exception", "{", "ArrayList", "<", "String", ">", "natures", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "key", ":", "natureAliases", ".", "keySet", "(", ")", ")", "{", "String", "[", "]", "ids", "=", "natureAliases", ".", "get", "(", "key", ")", ";", "for", "(", "String", "id", ":", "ids", ")", "{", "if", "(", "project", ".", "hasNature", "(", "id", ")", ")", "{", "natures", ".", "add", "(", "id", ")", ";", "}", "}", "}", "return", "natures", ".", "toArray", "(", "new", "String", "[", "natures", ".", "size", "(", ")", "]", ")", ";", "}", "}", "</s>" ]
1,509
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "public", "interface", "ProjectManager", "{", "public", "void", "create", "(", "IProject", "project", ",", "CommandLine", "commandLine", ")", "throws", "Exception", ";", "public", "List", "<", "Error", ">", "update", "(", "IProject", "project", ",", "CommandLine", "commandLine", ")", "throws", "Exception", ";", "public", "void", "delete", "(", "IProject", "project", ",", "CommandLine", "commandLine", ")", "throws", "Exception", ";", "public", "void", "refresh", "(", "IProject", "project", ",", "CommandLine", "commandLine", ")", "throws", "Exception", ";", "public", "void", "refresh", "(", "IProject", "project", ",", "IFile", "file", ")", "throws", "Exception", ";", "}", "</s>" ]
1,510
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilderFactory", ";", "import", "javax", ".", "xml", ".", "xpath", ".", "XPathExpression", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "logging", ".", "Logger", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ".", "Preferences", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "XmlUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "CollectionUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProjectDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Document", ";", "public", "class", "ProjectManagement", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "ProjectManagement", ".", "class", ")", ";", "private", "static", "HashMap", "<", "String", ",", "ProjectManager", ">", "managers", "=", "new", "HashMap", "<", "String", ",", "ProjectManager", ">", "(", ")", ";", "private", "static", "XPathExpression", "xpath", ";", "private", "static", "DocumentBuilderFactory", "factory", ";", "public", "static", "ProjectManager", "addProjectManager", "(", "String", "nature", ",", "ProjectManager", "manager", ")", "{", "logger", ".", "debug", "(", "\"\"", ",", "nature", ",", "manager", ")", ";", "managers", ".", "put", "(", "nature", ",", "manager", ")", ";", "return", "manager", ";", "}", "public", "static", "ProjectManager", "getProjectManager", "(", "String", "nature", ")", "{", "return", "managers", ".", "get", "(", "nature", ")", ";", "}", "public", "static", "String", "[", "]", "getProjectManagerNatures", "(", ")", "{", "Set", "<", "String", ">", "registered", "=", "managers", ".", "keySet", "(", ")", ";", "return", "registered", ".", "toArray", "(", "new", "String", "[", "registered", ".", "size", "(", ")", "]", ")", ";", "}", "public", "static", "ProjectManager", "[", "]", "getProjectManagers", "(", ")", "{", "Collection", "<", "ProjectManager", ">", "registered", "=", "managers", ".", "values", "(", ")", ";", "return", "registered", ".", "toArray", "(", "new", "ProjectManager", "[", "registered", ".", "size", "(", ")", "]", ")", ";", "}", "public", "static", "void", "create", "(", "String", "name", ",", "String", "folder", ",", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "[", "]", "aliases", "=", "StringUtils", ".", "split", "(", "commandLine", ".", "getValue", "(", "Options", ".", "NATURE_OPTION", ")", ",", "','", ")", ";", "ArrayList", "<", "String", ">", "natures", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "aliases", ".", "length", ";", "ii", "++", ")", "{", "if", "(", "!", "ProjectNatureFactory", ".", "NONE", ".", "equals", "(", "aliases", "[", "ii", "]", ")", ")", "{", "String", "[", "]", "ids", "=", "ProjectNatureFactory", ".", "getNaturesForAlias", "(", "aliases", "[", "ii", "]", ")", ";", "if", "(", "ids", "!=", "null", ")", "{", "for", "(", "String", "id", ":", "ids", ")", "{", "natures", ".", "add", "(", "id", ")", ";", "}", "}", "else", "{", "String", "[", "]", "registered", "=", "ProjectNatureFactory", ".", "getNatureAliases", "(", ")", ";", "StringBuffer", "supported", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "String", "key", ":", "registered", ")", "{", "if", "(", "supported", ".", "length", "(", ")", ">", "0", ")", "{", "supported", ".", "append", "(", "\",", "\"", ")", ";", "}", "supported", ".", "append", "(", "key", ")", ".", "append", "(", "'='", ")", ".", "append", "(", "ProjectNatureFactory", ".", "getNatureForAlias", "(", "key", ")", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "aliases", "[", "ii", "]", "+", "\"'.", "\"", "+", "\"\"", "+", "supported", ")", ";", "}", "}", "}", "deleteStaleProject", "(", "name", ",", "folder", ")", ";", "IProject", "project", "=", "createProject", "(", "name", ",", "folder", ",", "(", "String", "[", "]", ")", "natures", ".", "toArray", "(", "new", "String", "[", "natures", ".", "size", "(", ")", "]", ")", ")", ";", "project", ".", "open", "(", "null", ")", ";", "refresh", "(", "project", ",", "commandLine", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "natures", ".", "size", "(", ")", ";", "ii", "++", ")", "{", "ProjectManager", "manager", "=", "getProjectManager", "(", "(", "String", ")", "natures", ".", "get", "(", "ii", ")", ")", ";", "if", "(", "manager", "!=", "null", ")", "{", "manager", ".", "create", "(", "project", ",", "commandLine", ")", ";", "}", "}", "Preferences", ".", "getInstance", "(", ")", ".", "clearProjectValueCache", "(", "project", ")", ";", "}", "protected", "static", "IProject", "createProject", "(", "String", "name", ",", "String", "folder", ",", "String", "[", "]", "natures", ")", "throws", "Exception", "{", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ",", "true", ")", ";", "if", "(", "!", "project", ".", "exists", "(", ")", ")", "{", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "IPath", "location", "=", "new", "Path", "(", "folder", ")", ";", "IPath", "workspaceLocation", "=", "workspace", ".", "getRoot", "(", ")", ".", "getRawLocation", "(", ")", ";", "if", "(", "location", ".", "toOSString", "(", ")", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "workspaceLocation", ".", "toOSString", "(", ")", ".", "toLowerCase", "(", ")", ")", ")", "{", "IPath", "tmpLocation", "=", "location", ".", "removeFirstSegments", "(", "location", ".", "matchingFirstSegments", "(", "workspaceLocation", ")", ")", ";", "if", "(", "tmpLocation", ".", "segmentCount", "(", ")", ">", "1", ")", "{", "throw", "new", "RuntimeException", "(", "Services", ".", "getMessage", "(", "\"\"", ")", ")", ";", "}", "String", "tmpName", "=", "tmpLocation", ".", "toString", "(", ")", ";", "tmpName", "=", "tmpName", ".", "replaceFirst", "(", "\"^[a-zA-Z]:\"", ",", "\"\"", ")", ";", "project", "=", "ProjectUtils", ".", "getProject", "(", "tmpName", ",", "true", ")", ";", "if", "(", "!", "project", ".", "exists", "(", ")", ")", "{", "IProjectDescription", "description", "=", "workspace", ".", "newProjectDescription", "(", "tmpName", ")", ";", "description", ".", "setNatureIds", "(", "natures", ")", ";", "project", ".", "create", "(", "description", ",", "null", ")", ";", "}", "}", "else", "{", "IProjectDescription", "description", "=", "workspace", ".", "newProjectDescription", "(", "name", ")", ";", "description", ".", "setLocation", "(", "location", ")", ";", "description", ".", "setNatureIds", "(", "natures", ")", ";", "project", ".", "create", "(", "description", ",", "null", ")", ";", "}", "}", "else", "{", "IProjectDescription", "desc", "=", "project", ".", "getDescription", "(", ")", ";", "String", "[", "]", "natureIds", "=", "desc", ".", "getNatureIds", "(", ")", ";", "ArrayList", "<", "String", ">", "modified", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "ArrayList", "<", "String", ">", "newNatures", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "CollectionUtils", ".", "addAll", "(", "modified", ",", "natureIds", ")", ";", "for", "(", "String", "natureId", ":", "natures", ")", "{", "if", "(", "!", "modified", ".", "contains", "(", "natureId", ")", ")", "{", "modified", ".", "add", "(", "natureId", ")", ";", "newNatures", ".", "add", "(", "natureId", ")", ";", "}", "}", "desc", ".", "setNatureIds", "(", "(", "String", "[", "]", ")", "modified", ".", "toArray", "(", "new", "String", "[", "modified", ".", "size", "(", ")", "]", ")", ")", ";", "project", ".", "setDescription", "(", "desc", ",", "new", "NullProgressMonitor", "(", ")", ")", ";", "}", "return", "project", ";", "}", "protected", "static", "void", "deleteStaleProject", "(", "String", "name", ",", "String", "folder", ")", "throws", "Exception", "{", "File", "projectFile", "=", "new", "File", "(", "folder", "+", "File", ".", "separator", "+", "\".project\"", ")", ";", "if", "(", "projectFile", ".", "exists", "(", ")", ")", "{", "if", "(", "xpath", "==", "null", ")", "{", "xpath", "=", "XmlUtils", ".", "createXPathExpression", "(", "\"\"", ")", ";", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "}", "Document", "document", "=", "factory", ".", "newDocumentBuilder", "(", ")", ".", "parse", "(", "projectFile", ")", ";", "String", "projectName", "=", "(", "String", ")", "xpath", ".", "evaluate", "(", "document", ")", ";", "if", "(", "!", "projectName", ".", "equals", "(", "name", ")", ")", "{", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ")", ";", "if", "(", "project", ".", "exists", "(", ")", ")", "{", "project", ".", "delete", "(", "false", ",", "true", ",", "null", ")", ";", "}", "else", "{", "projectFile", ".", "delete", "(", ")", ";", "}", "}", "}", "}", "public", "static", "List", "<", "Error", ">", "update", "(", "IProject", "project", ",", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "ProjectUtils", ".", "assertExists", "(", "project", ")", ";", "ArrayList", "<", "Error", ">", "errors", "=", "new", "ArrayList", "<", "Error", ">", "(", ")", ";", "for", "(", "String", "nature", ":", "managers", ".", "keySet", "(", ")", ")", "{", "if", "(", "project", ".", "hasNature", "(", "nature", ")", ")", "{", "ProjectManager", "manager", "=", "ProjectManagement", ".", "getProjectManager", "(", "nature", ")", ";", "List", "<", "Error", ">", "errs", "=", "manager", ".", "update", "(", "project", ",", "commandLine", ")", ";", "if", "(", "errs", "!=", "null", ")", "{", "errors", ".", "addAll", "(", "errs", ")", ";", "}", "}", "}", "return", "errors", ";", "}", "public", "static", "void", "delete", "(", "IProject", "project", ",", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "ProjectUtils", ".", "assertExists", "(", "project", ")", ";", "try", "{", "if", "(", "!", "project", ".", "isOpen", "(", ")", ")", "{", "project", ".", "open", "(", "null", ")", ";", "}", "Preferences", ".", "getInstance", "(", ")", ".", "clearProjectValueCache", "(", "project", ")", ";", "for", "(", "String", "nature", ":", "managers", ".", "keySet", "(", ")", ")", "{", "if", "(", "project", ".", "hasNature", "(", "nature", ")", ")", "{", "ProjectManager", "manager", "=", "ProjectManagement", ".", "getProjectManager", "(", "nature", ")", ";", "manager", ".", "delete", "(", "project", ",", "commandLine", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "debug", "(", "\"\"", ",", "e", ")", ";", "}", "finally", "{", "project", ".", "delete", "(", "false", ",", "true", ",", "null", ")", ";", "}", "}", "public", "static", "void", "refresh", "(", "IProject", "project", ",", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "ProjectUtils", ".", "assertExists", "(", "project", ")", ";", "project", ".", "refreshLocal", "(", "IResource", ".", "DEPTH_INFINITE", ",", "null", ")", ";", "for", "(", "String", "nature", ":", "managers", ".", "keySet", "(", ")", ")", "{", "if", "(", "project", ".", "hasNature", "(", "nature", ")", ")", "{", "ProjectManager", "manager", "=", "ProjectManagement", ".", "getProjectManager", "(", "nature", ")", ";", "manager", ".", "refresh", "(", "project", ",", "commandLine", ")", ";", "}", "}", "Preferences", ".", "getInstance", "(", ")", ".", "clearProjectValueCache", "(", "project", ")", ";", "}", "}", "</s>" ]
1,511
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "complete", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "eclipse", ".", "jface", ".", "text", ".", "DummyTextViewer", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "complete", ".", "CodeCompleteResult", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "ITextViewer", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "contentassist", ".", "ICompletionProposal", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "contentassist", ".", "IContentAssistProcessor", ";", "public", "abstract", "class", "AbstractCodeCompleteCommand", "extends", "AbstractCommand", "{", "private", "static", "String", "COMPACT", "=", "\"compact\"", ";", "@", "Override", "public", "Object", "execute", "(", "final", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "int", "offset", "=", "getOffset", "(", "commandLine", ")", ";", "ICompletionProposal", "[", "]", "proposals", "=", "getCompletionProposals", "(", "commandLine", ",", "project", ",", "file", ",", "offset", ")", ";", "ArrayList", "<", "CodeCompleteResult", ">", "results", "=", "new", "ArrayList", "<", "CodeCompleteResult", ">", "(", ")", ";", "if", "(", "proposals", "!=", "null", ")", "{", "for", "(", "ICompletionProposal", "proposal", ":", "proposals", ")", "{", "if", "(", "acceptProposal", "(", "proposal", ")", ")", "{", "CodeCompleteResult", "ccresult", "=", "createCodeCompletionResult", "(", "proposal", ")", ";", "if", "(", "!", "results", ".", "contains", "(", "ccresult", ")", ")", "{", "results", ".", "add", "(", "ccresult", ")", ";", "}", "}", "}", "}", "String", "layout", "=", "commandLine", ".", "getValue", "(", "Options", ".", "LAYOUT_OPTION", ")", ";", "if", "(", "COMPACT", ".", "equals", "(", "layout", ")", "&&", "results", ".", "size", "(", ")", ">", "0", ")", "{", "results", "=", "compact", "(", "results", ")", ";", "}", "return", "results", ";", "}", "protected", "CodeCompleteResult", "createCodeCompletionResult", "(", "ICompletionProposal", "proposal", ")", "{", "return", "new", "CodeCompleteResult", "(", "getCompletion", "(", "proposal", ")", ",", "getMenu", "(", "proposal", ")", ",", "getInfo", "(", "proposal", ")", ")", ";", "}", "protected", "ICompletionProposal", "[", "]", "getCompletionProposals", "(", "CommandLine", "commandLine", ",", "String", "project", ",", "String", "file", ",", "int", "offset", ")", "throws", "Exception", "{", "IContentAssistProcessor", "processor", "=", "getContentAssistProcessor", "(", "commandLine", ",", "project", ",", "file", ")", ";", "ITextViewer", "viewer", "=", "getTextViewer", "(", "commandLine", ",", "project", ",", "file", ")", ";", "if", "(", "processor", "!=", "null", "&&", "viewer", "!=", "null", ")", "{", "return", "processor", ".", "computeCompletionProposals", "(", "viewer", ",", "offset", ")", ";", "}", "return", "new", "ICompletionProposal", "[", "0", "]", ";", "}", "protected", "IContentAssistProcessor", "getContentAssistProcessor", "(", "CommandLine", "commandLine", ",", "String", "project", ",", "String", "file", ")", "throws", "Exception", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "protected", "ITextViewer", "getTextViewer", "(", "CommandLine", "commandLine", ",", "String", "project", ",", "String", "file", ")", "throws", "Exception", "{", "int", "offset", "=", "getOffset", "(", "commandLine", ")", ";", "return", "new", "DummyTextViewer", "(", "ProjectUtils", ".", "getDocument", "(", "project", ",", "file", ")", ",", "offset", ",", "1", ")", ";", "}", "protected", "boolean", "acceptProposal", "(", "ICompletionProposal", "proposal", ")", "{", "return", "true", ";", "}", "protected", "String", "getCompletion", "(", "ICompletionProposal", "proposal", ")", "{", "return", "proposal", ".", "getDisplayString", "(", ")", ";", "}", "protected", "String", "getMenu", "(", "ICompletionProposal", "proposal", ")", "{", "return", "StringUtils", ".", "EMPTY", ";", "}", "protected", "String", "getInfo", "(", "ICompletionProposal", "proposal", ")", "{", "String", "info", "=", "proposal", ".", "getAdditionalProposalInfo", "(", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "info", "=", "info", ".", "trim", "(", ")", ";", "}", "else", "{", "info", "=", "StringUtils", ".", "EMPTY", ";", "}", "return", "info", ";", "}", "protected", "ArrayList", "<", "CodeCompleteResult", ">", "compact", "(", "ArrayList", "<", "CodeCompleteResult", ">", "results", ")", "{", "ArrayList", "<", "CodeCompleteResult", ">", "compactResults", "=", "new", "ArrayList", "<", "CodeCompleteResult", ">", "(", ")", ";", "CodeCompleteResult", "first", "=", "results", ".", "get", "(", "0", ")", ";", "String", "lastWord", "=", "first", ".", "getCompletion", "(", ")", ";", "String", "lastType", "=", "first", ".", "getType", "(", ")", ";", "ArrayList", "<", "CodeCompleteResult", ">", "overloaded", "=", "new", "ArrayList", "<", "CodeCompleteResult", ">", "(", ")", ";", "for", "(", "CodeCompleteResult", "result", ":", "results", ")", "{", "if", "(", "!", "result", ".", "getCompletion", "(", ")", ".", "equals", "(", "lastWord", ")", "||", "!", "result", ".", "getType", "(", ")", ".", "equals", "(", "lastType", ")", ")", "{", "compactResults", ".", "add", "(", "compactOverloaded", "(", "overloaded", ")", ")", ";", "overloaded", ".", "clear", "(", ")", ";", "}", "overloaded", ".", "add", "(", "result", ")", ";", "lastWord", "=", "result", ".", "getCompletion", "(", ")", ";", "lastType", "=", "result", ".", "getType", "(", ")", ";", "}", "if", "(", "overloaded", ".", "size", "(", ")", ">", "0", ")", "{", "compactResults", ".", "add", "(", "compactOverloaded", "(", "overloaded", ")", ")", ";", "}", "return", "compactResults", ";", "}", "private", "CodeCompleteResult", "compactOverloaded", "(", "ArrayList", "<", "CodeCompleteResult", ">", "overloaded", ")", "{", "CodeCompleteResult", "r", "=", "overloaded", ".", "get", "(", "0", ")", ";", "if", "(", "overloaded", ".", "size", "(", ")", "==", "1", ")", "{", "return", "r", ";", "}", "StringBuffer", "info", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "CodeCompleteResult", "o", ":", "overloaded", ")", "{", "if", "(", "info", ".", "length", "(", ")", ">", "0", ")", "{", "info", ".", "append", "(", "\"<br/>\"", ")", ";", "}", "info", ".", "append", "(", "o", ".", "getMenu", "(", ")", ")", ";", "}", "return", "new", "CodeCompleteResult", "(", "r", ".", "getCompletion", "(", ")", ",", "\"\"", ",", "info", ".", "toString", "(", ")", ",", "r", ".", "getType", "(", ")", ")", ";", "}", "}", "</s>" ]
1,512
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "complete", ";", "import", "java", ".", "util", ".", "regex", ".", "Matcher", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "builder", ".", "EqualsBuilder", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "builder", ".", "HashCodeBuilder", ";", "public", "class", "CodeCompleteResult", "{", "private", "static", "final", "Pattern", "FIRST_LINE", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "private", "static", "final", "int", "MAX_SHORT_DESCRIPTION_LENGTH", "=", "74", ";", "public", "static", "final", "String", "VARIABLE", "=", "\"v\"", ";", "public", "static", "final", "String", "FUNCTION", "=", "\"f\"", ";", "public", "static", "final", "String", "TYPE", "=", "\"t\"", ";", "public", "static", "final", "String", "KEYWORD", "=", "\"k\"", ";", "private", "String", "completion", ";", "private", "String", "menu", ";", "private", "String", "info", ";", "private", "String", "type", ";", "public", "CodeCompleteResult", "(", "String", "completion", ",", "String", "menu", ",", "String", "info", ")", "{", "this", "(", "completion", ",", "menu", ",", "info", ",", "StringUtils", ".", "EMPTY", ")", ";", "}", "public", "CodeCompleteResult", "(", "String", "completion", ",", "String", "menu", ",", "String", "info", ",", "String", "type", ")", "{", "this", ".", "completion", "=", "completion", ";", "this", ".", "menu", "=", "menu", ";", "this", ".", "info", "=", "info", ";", "this", ".", "type", "=", "type", "!=", "null", "?", "type", ":", "StringUtils", ".", "EMPTY", ";", "if", "(", "this", ".", "info", "!=", "null", ")", "{", "this", ".", "info", "=", "StringUtils", ".", "replace", "(", "this", ".", "info", ",", "\"n\"", ",", "\"<br/>\"", ")", ";", "}", "if", "(", "this", ".", "menu", "!=", "null", ")", "{", "this", ".", "menu", "=", "StringUtils", ".", "replace", "(", "this", ".", "menu", ",", "\"n\"", ",", "\"<br/>\"", ")", ";", "}", "if", "(", "this", ".", "info", "!=", "null", "&&", "this", ".", "menu", "==", "null", ")", "{", "this", ".", "menu", "=", "menuFromInfo", "(", "this", ".", "info", ")", ";", "}", "}", "public", "String", "getCompletion", "(", ")", "{", "return", "completion", ";", "}", "public", "String", "getInfo", "(", ")", "{", "return", "info", ";", "}", "public", "String", "getMenu", "(", ")", "{", "return", "menu", ";", "}", "public", "String", "getType", "(", ")", "{", "return", "this", ".", "type", ";", "}", "public", "static", "String", "menuFromInfo", "(", "String", "info", ")", "{", "if", "(", "info", "==", "null", ")", "{", "return", "null", ";", "}", "String", "menu", "=", "info", ";", "Matcher", "matcher", "=", "FIRST_LINE", ".", "matcher", "(", "menu", ")", ";", "if", "(", "menu", ".", "length", "(", ")", ">", "1", "&&", "matcher", ".", "find", "(", "1", ")", ")", "{", "menu", "=", "menu", ".", "substring", "(", "0", ",", "matcher", ".", "start", "(", ")", "+", "1", ")", ";", "if", "(", "menu", ".", "endsWith", "(", "\"<\"", ")", ")", "{", "menu", "=", "menu", ".", "substring", "(", "0", ",", "menu", ".", "length", "(", ")", "-", "1", ")", ";", "}", "}", "menu", "=", "menu", ".", "replaceAll", "(", "\"n\"", ",", "StringUtils", ".", "EMPTY", ")", ";", "menu", "=", "menu", ".", "replaceAll", "(", "\"<.*?>\"", ",", "StringUtils", ".", "EMPTY", ")", ";", "return", "StringUtils", ".", "abbreviate", "(", "menu", ",", "MAX_SHORT_DESCRIPTION_LENGTH", ")", ";", "}", "public", "boolean", "equals", "(", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "CodeCompleteResult", ")", ")", "{", "return", "false", ";", "}", "if", "(", "this", "==", "other", ")", "{", "return", "true", ";", "}", "CodeCompleteResult", "result", "=", "(", "CodeCompleteResult", ")", "other", ";", "boolean", "equal", "=", "new", "EqualsBuilder", "(", ")", ".", "append", "(", "getCompletion", "(", ")", ",", "result", ".", "getCompletion", "(", ")", ")", ".", "append", "(", "getMenu", "(", ")", ",", "result", ".", "getMenu", "(", ")", ")", ".", "append", "(", "getType", "(", ")", ",", "result", ".", "getType", "(", ")", ")", ".", "isEquals", "(", ")", ";", "return", "equal", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "new", "HashCodeBuilder", "(", "18", ",", "38", ")", ".", "append", "(", "completion", ")", ".", "append", "(", "menu", ")", ".", "toHashCode", "(", ")", ";", "}", "}", "</s>" ]
1,513
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "org", ".", "eclim", ".", "command", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "logging", ".", "Logger", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ".", "Preferences", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "file", ".", "FileUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "com", ".", "martiansoftware", ".", "nailgun", ".", "NGContext", ";", "public", "abstract", "class", "AbstractCommand", "implements", "Command", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "AbstractCommand", ".", "class", ")", ";", "private", "NGContext", "context", ";", "public", "Preferences", "getPreferences", "(", ")", "{", "return", "Preferences", ".", "getInstance", "(", ")", ";", "}", "public", "int", "getOffset", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "return", "getOffset", "(", "commandLine", ",", "Options", ".", "OFFSET_OPTION", ")", ";", "}", "public", "int", "getOffset", "(", "CommandLine", "commandLine", ",", "String", "option", ")", "throws", "Exception", "{", "int", "offset", "=", "commandLine", ".", "getIntValue", "(", "option", ")", ";", "if", "(", "offset", "==", "-", "1", ")", "{", "return", "offset", ";", "}", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "if", "(", "project", "==", "null", ")", "{", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "NAME_OPTION", ")", ";", "}", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "String", "encoding", "=", "commandLine", ".", "getValue", "(", "Options", ".", "ENCODING_OPTION", ")", ";", "file", "=", "ProjectUtils", ".", "getFilePath", "(", "project", ",", "file", ")", ";", "return", "FileUtils", ".", "byteOffsetToCharOffset", "(", "file", ",", "offset", ",", "encoding", ")", ";", "}", "public", "NGContext", "getContext", "(", ")", "{", "return", "context", ";", "}", "public", "void", "setContext", "(", "NGContext", "context", ")", "{", "this", ".", "context", "=", "context", ";", "}", "public", "void", "cleanup", "(", "CommandLine", "commandLine", ")", "{", "try", "{", "if", "(", "commandLine", ".", "hasOption", "(", "Options", ".", "FILE_OPTION", ")", "&&", "(", "commandLine", ".", "hasOption", "(", "Options", ".", "PROJECT_OPTION", ")", "||", "commandLine", ".", "hasOption", "(", "Options", ".", "NAME_OPTION", ")", ")", ")", "{", "IProject", "project", "=", "null", ";", "String", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "if", "(", "projectName", "==", "null", ")", "{", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "NAME_OPTION", ")", ";", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ")", ";", "}", "else", "{", "try", "{", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ")", ";", "if", "(", "!", "project", ".", "exists", "(", ")", ")", "{", "project", "=", "null", ";", "}", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "}", "if", "(", "project", "==", "null", ")", "{", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "NAME_OPTION", ")", ";", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ")", ";", "}", "}", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "if", "(", "project", "!=", "null", "&&", "project", ".", "exists", "(", ")", "&&", "file", "!=", "null", ")", "{", "IFile", "temp", "=", "ProjectUtils", ".", "getFile", "(", "project", ",", "file", ")", ";", "if", "(", "temp", ".", "exists", "(", ")", "&&", "temp", ".", "getName", "(", ")", ".", "startsWith", "(", "\"\"", ")", ")", "{", "temp", ".", "delete", "(", "true", ",", "false", ",", "null", ")", ";", "}", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", "+", "Arrays", ".", "toString", "(", "context", ".", "getArgs", "(", ")", ")", ",", "e", ")", ";", "}", "}", "public", "void", "println", "(", ")", "{", "context", ".", "out", ".", "println", "(", ")", ";", "}", "public", "void", "println", "(", "boolean", "x", ")", "{", "context", ".", "out", ".", "println", "(", "x", ")", ";", "}", "public", "void", "println", "(", "char", "x", ")", "{", "context", ".", "out", ".", "println", "(", "x", ")", ";", "}", "public", "void", "println", "(", "char", "[", "]", "x", ")", "{", "context", ".", "out", ".", "println", "(", "x", ")", ";", "}", "public", "void", "println", "(", "double", "x", ")", "{", "context", ".", "out", ".", "println", "(", "x", ")", ";", "}", "public", "void", "println", "(", "float", "x", ")", "{", "context", ".", "out", ".", "println", "(", "x", ")", ";", "}", "public", "void", "println", "(", "int", "x", ")", "{", "context", ".", "out", ".", "println", "(", "x", ")", ";", "}", "public", "void", "println", "(", "long", "x", ")", "{", "context", ".", "out", ".", "println", "(", "x", ")", ";", "}", "public", "void", "println", "(", "Object", "x", ")", "{", "context", ".", "out", ".", "println", "(", "x", ")", ";", "}", "public", "void", "println", "(", "String", "x", ")", "{", "context", ".", "out", ".", "println", "(", "x", ")", ";", "}", "}", "</s>" ]
1,514
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "admin", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "PluginResources", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Platform", ";", "import", "org", ".", "osgi", ".", "framework", ".", "Bundle", ";", "@", "Command", "(", "name", "=", "\"ping\"", ")", "public", "class", "PingCommand", "extends", "AbstractCommand", "{", "private", "HashMap", "<", "String", ",", "String", ">", "versions", ";", "@", "Override", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "if", "(", "versions", "==", "null", ")", "{", "PluginResources", "resources", "=", "Services", ".", "getPluginResources", "(", "\"org.eclim\"", ")", ";", "versions", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "versions", ".", "put", "(", "\"eclim\"", ",", "resources", ".", "getProperty", "(", "\"\"", ")", ")", ";", "versions", ".", "put", "(", "\"eclipse\"", ",", "getVersion", "(", ")", ")", ";", "}", "return", "versions", ";", "}", "private", "String", "getVersion", "(", ")", "{", "Bundle", "bundle", "=", "Platform", ".", "getBundle", "(", "\"\"", ")", ";", "if", "(", "bundle", "!=", "null", ")", "{", "String", "eclipse_version", "=", "(", "String", ")", "bundle", ".", "getHeaders", "(", ")", ".", "get", "(", "\"\"", ")", ";", "if", "(", "eclipse_version", "!=", "null", ")", "{", "eclipse_version", "=", "eclipse_version", ".", "replaceFirst", "(", "\"([0-9.]+).*\"", ",", "\"$1\"", ")", ";", "return", "eclipse_version", ".", "replaceFirst", "(", "\"\\\\.$\"", ",", "\"\"", ")", ";", "}", "}", "return", "null", ";", "}", "}", "</s>" ]
1,515
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "admin", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "@", "Command", "(", "name", "=", "\"setting\"", ",", "options", "=", "\"\"", ")", "public", "class", "SettingCommand", "extends", "AbstractCommand", "{", "@", "Override", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "setting", "=", "commandLine", ".", "getValue", "(", "Options", ".", "SETTING_OPTION", ")", ";", "return", "getPreferences", "(", ")", ".", "getValue", "(", "setting", ")", ";", "}", "}", "</s>" ]
1,516
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "admin", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "eclipse", ".", "EclimApplication", ";", "import", "org", ".", "eclim", ".", "eclipse", ".", "EclimDaemon", ";", "import", "org", ".", "eclim", ".", "logging", ".", "Logger", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "@", "Command", "(", "name", "=", "\"shutdown\"", ")", "public", "class", "ShutdownCommand", "extends", "AbstractCommand", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "ShutdownCommand", ".", "class", ")", ";", "@", "Override", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "try", "{", "EclimDaemon", ".", "getInstance", "(", ")", ".", "stop", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "if", "(", "EclimApplication", ".", "isEnabled", "(", ")", ")", "{", "EclimApplication", ".", "shutdown", "(", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
1,517
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "admin", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ".", "Option", ";", "@", "Command", "(", "name", "=", "\"settings\"", ")", "public", "class", "SettingsCommand", "extends", "AbstractCommand", "{", "@", "Override", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "Option", "[", "]", "options", "=", "getPreferences", "(", ")", ".", "getOptions", "(", ")", ";", "Arrays", ".", "sort", "(", "options", ")", ";", "return", "options", ";", "}", "}", "</s>" ]
1,518
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "admin", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "logging", ".", "Logger", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ".", "Preferences", ";", "import", "org", ".", "eclim", ".", "util", ".", "IOUtils", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonElement", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonObject", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonStreamParser", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "SettingsUpdateCommand", "extends", "AbstractCommand", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "SettingsUpdateCommand", ".", "class", ")", ";", "@", "Override", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "settings", "=", "commandLine", ".", "getValue", "(", "Options", ".", "SETTINGS_OPTION", ")", ";", "FileReader", "in", "=", "null", ";", "File", "file", "=", "new", "File", "(", "settings", ")", ";", "ArrayList", "<", "String", ">", "errors", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "try", "{", "in", "=", "new", "FileReader", "(", "file", ")", ";", "JsonStreamParser", "parser", "=", "new", "JsonStreamParser", "(", "in", ")", ";", "JsonObject", "obj", "=", "(", "JsonObject", ")", "parser", ".", "next", "(", ")", ";", "Preferences", "preferences", "=", "getPreferences", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "JsonElement", ">", "entry", ":", "obj", ".", "entrySet", "(", ")", ")", "{", "String", "name", "=", "entry", ".", "getKey", "(", ")", ";", "String", "value", "=", "entry", ".", "getValue", "(", ")", ".", "getAsString", "(", ")", ";", "try", "{", "preferences", ".", "setValue", "(", "name", ",", "value", ")", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "errors", ".", "add", "(", "iae", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "in", ")", ";", "try", "{", "file", ".", "delete", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "warn", "(", "\"\"", "+", "file", ",", "e", ")", ";", "}", "}", "if", "(", "errors", ".", "size", "(", ")", ">", "0", ")", "{", "return", "errors", ";", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
1,519
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "logging", ".", "Logger", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ".", "Preferences", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectManagement", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "IOUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonElement", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonObject", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonStreamParser", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "ProjectUpdateCommand", "extends", "AbstractCommand", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "ProjectUpdateCommand", ".", "class", ")", ";", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "settings", "=", "commandLine", ".", "getValue", "(", "Options", ".", "SETTINGS_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ")", ";", "if", "(", "settings", "!=", "null", ")", "{", "List", "<", "String", ">", "errors", "=", "updateSettings", "(", "project", ",", "settings", ")", ";", "if", "(", "errors", ".", "size", "(", ")", ">", "0", ")", "{", "return", "errors", ";", "}", "}", "else", "{", "List", "<", "Error", ">", "errors", "=", "ProjectManagement", ".", "update", "(", "project", ",", "commandLine", ")", ";", "if", "(", "errors", ".", "size", "(", ")", ">", "0", ")", "{", "return", "errors", ";", "}", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "private", "List", "<", "String", ">", "updateSettings", "(", "IProject", "project", ",", "String", "settings", ")", "throws", "Exception", "{", "FileReader", "in", "=", "null", ";", "File", "file", "=", "new", "File", "(", "settings", ")", ";", "ArrayList", "<", "String", ">", "errors", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "try", "{", "in", "=", "new", "FileReader", "(", "file", ")", ";", "JsonStreamParser", "parser", "=", "new", "JsonStreamParser", "(", "in", ")", ";", "JsonObject", "obj", "=", "(", "JsonObject", ")", "parser", ".", "next", "(", ")", ";", "Preferences", "preferences", "=", "getPreferences", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "JsonElement", ">", "entry", ":", "obj", ".", "entrySet", "(", ")", ")", "{", "String", "name", "=", "entry", ".", "getKey", "(", ")", ";", "String", "value", "=", "entry", ".", "getValue", "(", ")", ".", "getAsString", "(", ")", ";", "try", "{", "preferences", ".", "setValue", "(", "project", ",", "name", ",", "value", ")", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "errors", ".", "add", "(", "iae", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "in", ")", ";", "try", "{", "file", ".", "delete", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "warn", "(", "\"\"", "+", "file", ",", "e", ")", ";", "}", "}", "return", "errors", ";", "}", "}", "</s>" ]
1,520
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectManagement", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectManager", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "CollectionUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProjectDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "ProjectNatureRemoveCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ")", ";", "String", "[", "]", "aliases", "=", "StringUtils", ".", "split", "(", "commandLine", ".", "getValue", "(", "Options", ".", "NATURE_OPTION", ")", ",", "','", ")", ";", "IProjectDescription", "desc", "=", "project", ".", "getDescription", "(", ")", ";", "String", "[", "]", "natureIds", "=", "desc", ".", "getNatureIds", "(", ")", ";", "ArrayList", "<", "String", ">", "modified", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "ArrayList", "<", "String", ">", "removed", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "CollectionUtils", ".", "addAll", "(", "modified", ",", "natureIds", ")", ";", "for", "(", "String", "alias", ":", "aliases", ")", "{", "String", "natureId", "=", "ProjectNatureFactory", ".", "getNatureForAlias", "(", "alias", ")", ";", "if", "(", "natureId", "!=", "null", "&&", "modified", ".", "contains", "(", "natureId", ")", ")", "{", "modified", ".", "remove", "(", "natureId", ")", ";", "removed", ".", "add", "(", "natureId", ")", ";", "}", "}", "desc", ".", "setNatureIds", "(", "(", "String", "[", "]", ")", "modified", ".", "toArray", "(", "new", "String", "[", "modified", ".", "size", "(", ")", "]", ")", ")", ";", "project", ".", "setDescription", "(", "desc", ",", "new", "NullProgressMonitor", "(", ")", ")", ";", "for", "(", "String", "nature", ":", "removed", ")", "{", "ProjectManager", "manager", "=", "ProjectManagement", ".", "getProjectManager", "(", "nature", ")", ";", "if", "(", "manager", "!=", "null", ")", "{", "manager", ".", "delete", "(", "project", ",", "commandLine", ")", ";", "}", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
1,521
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "@", "Command", "(", "name", "=", "\"project_info\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectInfoCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ")", ";", "if", "(", "project", ".", "exists", "(", ")", ")", "{", "String", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getRawLocation", "(", ")", ".", "toOSString", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "info", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "info", ".", "put", "(", "\"name\"", ",", "name", ")", ";", "info", ".", "put", "(", "\"path\"", ",", "ProjectUtils", ".", "getPath", "(", "project", ")", ")", ";", "info", ".", "put", "(", "\"workspace\"", ",", "workspace", ")", ";", "info", ".", "put", "(", "\"open\"", ",", "project", ".", "isOpen", "(", ")", ")", ";", "if", "(", "project", ".", "isOpen", "(", ")", ")", "{", "String", "[", "]", "aliases", "=", "ProjectNatureFactory", ".", "getProjectNatureAliases", "(", "project", ")", ";", "if", "(", "aliases", ".", "length", "==", "0", ")", "{", "aliases", "=", "new", "String", "[", "]", "{", "\"none\"", "}", ";", "}", "info", ".", "put", "(", "\"natures\"", ",", "aliases", ")", ";", "IProject", "[", "]", "depends", "=", "project", ".", "getReferencedProjects", "(", ")", ";", "if", "(", "depends", ".", "length", ">", "0", ")", "{", "String", "[", "]", "names", "=", "new", "String", "[", "depends", ".", "length", "]", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "depends", ".", "length", ";", "ii", "++", ")", "{", "names", "[", "ii", "]", "=", "depends", "[", "ii", "]", ".", "getName", "(", ")", ";", "}", "info", ".", "put", "(", "\"depends\"", ",", "names", ")", ";", "}", "IProject", "[", "]", "references", "=", "project", ".", "getReferencingProjects", "(", ")", ";", "if", "(", "references", ".", "length", ">", "0", ")", "{", "String", "[", "]", "names", "=", "new", "String", "[", "references", ".", "length", "]", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "references", ".", "length", ";", "ii", "++", ")", "{", "names", "[", "ii", "]", "=", "references", "[", "ii", "]", ".", "getName", "(", ")", ";", "}", "info", ".", "put", "(", "\"references\"", ",", "names", ")", ";", "}", "}", "return", "info", ";", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "}", "</s>" ]
1,522
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectNatureAliasesCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "if", "(", "commandLine", ".", "hasOption", "(", "\"m\"", ")", ")", "{", "return", "ProjectNatureFactory", ".", "getNatureAliasesMap", "(", ")", ";", "}", "return", "ProjectNatureFactory", ".", "getNatureAliases", "(", ")", ";", "}", "}", "</s>" ]
1,523
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectCloseCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ")", ";", "if", "(", "project", ".", "exists", "(", ")", ")", "{", "project", ".", "close", "(", "null", ")", ";", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "}", "</s>" ]
1,524
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "@", "Command", "(", "name", "=", "\"project_list\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectListCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "IProject", "[", "]", "projects", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProjects", "(", ")", ";", "String", "natureId", "=", "null", ";", "if", "(", "commandLine", ".", "hasOption", "(", "Options", ".", "NATURE_OPTION", ")", ")", "{", "String", "alias", "=", "commandLine", ".", "getValue", "(", "Options", ".", "NATURE_OPTION", ")", ";", "natureId", "=", "ProjectNatureFactory", ".", "getNatureForAlias", "(", "alias", ")", ";", "ArrayList", "<", "IProject", ">", "filtered", "=", "new", "ArrayList", "<", "IProject", ">", "(", ")", ";", "for", "(", "IProject", "project", ":", "projects", ")", "{", "if", "(", "project", ".", "isOpen", "(", ")", "&&", "project", ".", "hasNature", "(", "natureId", ")", ")", "{", "filtered", ".", "add", "(", "project", ")", ";", "}", "}", "projects", "=", "(", "IProject", "[", "]", ")", "filtered", ".", "toArray", "(", "new", "IProject", "[", "filtered", ".", "size", "(", ")", "]", ")", ";", "}", "ArrayList", "<", "HashMap", "<", "String", ",", "Object", ">", ">", "results", "=", "new", "ArrayList", "<", "HashMap", "<", "String", ",", "Object", ">", ">", "(", ")", ";", "for", "(", "IProject", "project", ":", "projects", ")", "{", "if", "(", "project", ".", "exists", "(", ")", ")", "{", "HashMap", "<", "String", ",", "Object", ">", "result", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "result", ".", "put", "(", "\"name\"", ",", "project", ".", "getName", "(", ")", ")", ";", "result", ".", "put", "(", "\"path\"", ",", "ProjectUtils", ".", "getPath", "(", "project", ")", ")", ";", "result", ".", "put", "(", "\"open\"", ",", "project", ".", "isOpen", "(", ")", ")", ";", "results", ".", "add", "(", "result", ")", ";", "}", "}", "return", "results", ";", "}", "}", "</s>" ]
1,525
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "io", ".", "File", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProjectDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "@", "Command", "(", "name", "=", "\"project_move\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "ProjectMoveCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "newDir", "=", "commandLine", ".", "getValue", "(", "Options", ".", "DIR_OPTION", ")", ";", "if", "(", "new", "File", "(", "newDir", ")", ".", "exists", "(", ")", ")", "{", "newDir", "=", "newDir", "+", "'/'", "+", "projectName", ";", "}", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ")", ";", "if", "(", "project", ".", "exists", "(", ")", ")", "{", "IProjectDescription", "desc", "=", "project", ".", "getDescription", "(", ")", ";", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "IPath", "workspaceLocation", "=", "workspace", ".", "getRoot", "(", ")", ".", "getRawLocation", "(", ")", ";", "IPath", "location", "=", "new", "Path", "(", "newDir", ")", ";", "if", "(", "location", ".", "toOSString", "(", ")", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "workspaceLocation", ".", "toOSString", "(", ")", ".", "toLowerCase", "(", ")", ")", ")", "{", "String", "name", "=", "location", ".", "removeFirstSegments", "(", "location", ".", "matchingFirstSegments", "(", "workspaceLocation", ")", ")", ".", "toString", "(", ")", ";", "name", "=", "name", ".", "replaceFirst", "(", "\"^[A-Z]:\"", ",", "\"\"", ")", ";", "name", "=", "name", ".", "replaceFirst", "(", "\"/$\"", ",", "\"\"", ")", ";", "location", "=", "null", ";", "desc", ".", "setName", "(", "name", ")", ";", "}", "desc", ".", "setLocation", "(", "location", ")", ";", "project", ".", "move", "(", "desc", ",", "true", ",", "null", ")", ";", "project", "=", "ProjectUtils", ".", "getProject", "(", "desc", ".", "getName", "(", ")", ")", ";", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "projectName", ",", "ProjectUtils", ".", "getPath", "(", "project", ")", ")", ";", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "projectName", ")", ";", "}", "}", "</s>" ]
1,526
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectManagement", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectManager", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "CollectionUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProjectDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "ProjectNatureAddCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ")", ";", "String", "[", "]", "aliases", "=", "StringUtils", ".", "split", "(", "commandLine", ".", "getValue", "(", "Options", ".", "NATURE_OPTION", ")", ",", "','", ")", ";", "IProjectDescription", "desc", "=", "project", ".", "getDescription", "(", ")", ";", "String", "[", "]", "natureIds", "=", "desc", ".", "getNatureIds", "(", ")", ";", "ArrayList", "<", "String", ">", "modified", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "ArrayList", "<", "String", ">", "newNatures", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "CollectionUtils", ".", "addAll", "(", "modified", ",", "natureIds", ")", ";", "for", "(", "String", "alias", ":", "aliases", ")", "{", "String", "natureId", "=", "ProjectNatureFactory", ".", "getNatureForAlias", "(", "alias", ")", ";", "if", "(", "natureId", "!=", "null", "&&", "!", "modified", ".", "contains", "(", "natureId", ")", ")", "{", "modified", ".", "add", "(", "natureId", ")", ";", "newNatures", ".", "add", "(", "natureId", ")", ";", "}", "}", "desc", ".", "setNatureIds", "(", "(", "String", "[", "]", ")", "modified", ".", "toArray", "(", "new", "String", "[", "modified", ".", "size", "(", ")", "]", ")", ")", ";", "project", ".", "setDescription", "(", "desc", ",", "new", "NullProgressMonitor", "(", ")", ")", ";", "for", "(", "String", "nature", ":", "newNatures", ")", "{", "ProjectManager", "manager", "=", "ProjectManagement", ".", "getProjectManager", "(", "nature", ")", ";", "if", "(", "manager", "!=", "null", ")", "{", "manager", ".", "create", "(", "project", ",", "commandLine", ")", ";", "}", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
1,527
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "ProjectRefreshFileCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "filename", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "ProjectUtils", ".", "getFile", "(", "name", ",", "filename", ")", ";", "return", "null", ";", "}", "}", "</s>" ]
1,528
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectLinkResource", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "URI", "uri", "=", "new", "URI", "(", "\"file://\"", "+", "file", ".", "replaceAll", "(", "\"", "\"", ",", "\"%20\"", ")", ")", ";", "IFile", "[", "]", "files", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "findFilesForLocationURI", "(", "uri", ")", ";", "if", "(", "files", ".", "length", ">", "0", ")", "{", "return", "files", "[", "0", "]", ".", "getProjectRelativePath", "(", ")", ".", "toString", "(", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
1,529
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Constructor", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Field", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "ui", ".", "internal", ".", "wizards", ".", "datatransfer", ".", "WizardProjectsImportPage", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectImportCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "folder", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FOLDER_OPTION", ")", ";", "if", "(", "folder", ".", "endsWith", "(", "\"/\"", ")", "||", "folder", ".", "endsWith", "(", "\"\\\\\"", ")", ")", "{", "folder", "=", "folder", ".", "substring", "(", "0", ",", "folder", ".", "length", "(", ")", "-", "1", ")", ";", "}", "if", "(", "!", "new", "File", "(", "folder", ")", ".", "exists", "(", ")", ")", "{", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "folder", ")", ";", "}", "File", "dotproject", "=", "new", "File", "(", "folder", "+", "\"/.project\"", ")", ";", "if", "(", "!", "dotproject", ".", "exists", "(", ")", ")", "{", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "folder", ")", ";", "}", "WizardProjectsImportPage", "page", "=", "new", "WizardProjectsImportPage", "(", ")", ";", "Constructor", "<", "WizardProjectsImportPage", ".", "ProjectRecord", ">", "construct", "=", "WizardProjectsImportPage", ".", "ProjectRecord", ".", "class", ".", "getDeclaredConstructor", "(", "WizardProjectsImportPage", ".", "class", ",", "File", ".", "class", ")", ";", "construct", ".", "setAccessible", "(", "true", ")", ";", "WizardProjectsImportPage", ".", "ProjectRecord", "record", "=", "construct", ".", "newInstance", "(", "page", ",", "dotproject", ")", ";", "String", "projectName", "=", "record", ".", "getProjectName", "(", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ")", ";", "if", "(", "project", ".", "exists", "(", ")", ")", "{", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "projectName", ",", "folder", ")", ";", "}", "Field", "field", "=", "page", ".", "getClass", "(", ")", ".", "getDeclaredField", "(", "\"\"", ")", ";", "field", ".", "setAccessible", "(", "true", ")", ";", "field", ".", "set", "(", "page", ",", "new", "ArrayList", "<", "IProject", ">", "(", ")", ")", ";", "Method", "method", "=", "page", ".", "getClass", "(", ")", ".", "getDeclaredMethod", "(", "\"\"", ",", "WizardProjectsImportPage", ".", "ProjectRecord", ".", "class", ",", "IProgressMonitor", ".", "class", ")", ";", "method", ".", "setAccessible", "(", "true", ")", ";", "Boolean", "result", "=", "(", "Boolean", ")", "method", ".", "invoke", "(", "page", ",", "record", ",", "new", "NullProgressMonitor", "(", ")", ")", ";", "if", "(", "!", "result", ".", "booleanValue", "(", ")", ")", "{", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "projectName", ")", ";", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "projectName", ")", ";", "}", "}", "</s>" ]
1,530
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "@", "Command", "(", "name", "=", "\"project_open\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectOpenCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ")", ";", "if", "(", "project", ".", "exists", "(", ")", ")", "{", "project", ".", "open", "(", "null", ")", ";", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "}", "</s>" ]
1,531
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectManagement", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectDeleteCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ")", ";", "if", "(", "!", "project", ".", "exists", "(", ")", ")", "{", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "ProjectManagement", ".", "delete", "(", "project", ",", "commandLine", ")", ";", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "}", "</s>" ]
1,532
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ".", "Option", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectSettingsCommand", "extends", "AbstractCommand", "{", "@", "Override", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ",", "true", ")", ";", "Option", "[", "]", "options", "=", "getPreferences", "(", ")", ".", "getOptions", "(", "project", ")", ";", "Arrays", ".", "sort", "(", "options", ")", ";", "return", "options", ";", "}", "}", "</s>" ]
1,533
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectByResource", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "URI", "uri", "=", "new", "URI", "(", "\"file://\"", "+", "file", ".", "replaceAll", "(", "\"", "\"", ",", "\"%20\"", ")", ")", ";", "IFile", "[", "]", "files", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "findFilesForLocationURI", "(", "uri", ")", ";", "if", "(", "files", ".", "length", ">", "0", ")", "{", "return", "files", "[", "0", "]", ".", "getProject", "(", ")", ".", "getName", "(", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
1,534
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProjectDescription", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "ProjectRenameCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "newName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "NAME_OPTION", ")", ";", "newName", "=", "newName", ".", "replace", "(", "'", "'", ",", "'_'", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ")", ";", "if", "(", "project", ".", "exists", "(", ")", ")", "{", "IProjectDescription", "desc", "=", "project", ".", "getDescription", "(", ")", ";", "desc", ".", "setName", "(", "newName", ")", ";", "project", ".", "move", "(", "desc", ",", "true", ",", "null", ")", ";", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "projectName", ",", "newName", ")", ";", "}", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "projectName", ")", ";", "}", "}", "</s>" ]
1,535
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectNaturesCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "ArrayList", "<", "HashMap", "<", "String", ",", "Object", ">", ">", "results", "=", "new", "ArrayList", "<", "HashMap", "<", "String", ",", "Object", ">", ">", "(", ")", ";", "if", "(", "name", "==", "null", ")", "{", "IProject", "[", "]", "projects", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProjects", "(", ")", ";", "for", "(", "IProject", "project", ":", "projects", ")", "{", "if", "(", "project", ".", "isOpen", "(", ")", ")", "{", "String", "[", "]", "aliases", "=", "ProjectNatureFactory", ".", "getProjectNatureAliases", "(", "project", ")", ";", "if", "(", "aliases", ".", "length", "==", "0", ")", "{", "aliases", "=", "new", "String", "[", "]", "{", "\"none\"", "}", ";", "}", "HashMap", "<", "String", ",", "Object", ">", "result", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "result", ".", "put", "(", "\"name\"", ",", "project", ".", "getName", "(", ")", ")", ";", "result", ".", "put", "(", "\"natures\"", ",", "aliases", ")", ";", "results", ".", "add", "(", "result", ")", ";", "}", "}", "}", "else", "{", "String", "[", "]", "aliases", "=", "ProjectNatureFactory", ".", "getProjectNatureAliases", "(", "ProjectUtils", ".", "getProject", "(", "name", ")", ")", ";", "if", "(", "aliases", ".", "length", "==", "0", ")", "{", "aliases", "=", "new", "String", "[", "]", "{", "\"none\"", "}", ";", "}", "HashMap", "<", "String", ",", "Object", ">", "result", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "result", ".", "put", "(", "\"name\"", ",", "name", ")", ";", "result", ".", "put", "(", "\"natures\"", ",", "aliases", ")", ";", "results", ".", "add", "(", "result", ")", ";", "}", "return", "results", ";", "}", "}", "</s>" ]
1,536
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IncrementalProjectBuilder", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectBuildCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ",", "true", ")", ";", "project", ".", "build", "(", "IncrementalProjectBuilder", ".", "FULL_BUILD", ",", "new", "NullProgressMonitor", "(", ")", ")", ";", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "}", "</s>" ]
1,537
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "logging", ".", "Logger", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectManagement", ";", "import", "org", ".", "eclim", ".", "util", ".", "file", ".", "FileUtils", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "ProjectCreateCommand", "extends", "AbstractCommand", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "ProjectCreateCommand", ".", "class", ")", ";", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "folder", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FOLDER_OPTION", ")", ";", "if", "(", "folder", ".", "endsWith", "(", "\"/\"", ")", "||", "folder", ".", "endsWith", "(", "\"\\\\\"", ")", ")", "{", "folder", "=", "folder", ".", "substring", "(", "0", ",", "folder", ".", "length", "(", ")", "-", "1", ")", ";", "}", "String", "name", "=", "commandLine", ".", "hasOption", "(", "Options", ".", "PROJECT_OPTION", ")", "?", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ":", "FileUtils", ".", "getBaseName", "(", "folder", ")", ".", "replace", "(", "'", "'", ",", "'_'", ")", ";", "logger", ".", "debug", "(", "\"\"", ",", "name", ",", "folder", ")", ";", "ProjectManagement", ".", "create", "(", "name", ",", "folder", ",", "commandLine", ")", ";", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "}", "</s>" ]
1,538
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "preference", ".", "Preferences", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "ProjectSettingCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ",", "true", ")", ";", "String", "setting", "=", "commandLine", ".", "getValue", "(", "Options", ".", "SETTING_OPTION", ")", ";", "Preferences", "preferences", "=", "getPreferences", "(", ")", ";", "if", "(", "commandLine", ".", "hasOption", "(", "Options", ".", "VALUE_OPTION", ")", ")", "{", "String", "value", "=", "commandLine", ".", "getValue", "(", "Options", ".", "VALUE_OPTION", ")", ";", "preferences", ".", "setValue", "(", "project", ",", "setting", ",", "value", ")", ";", "return", "null", ";", "}", "return", "preferences", ".", "getValue", "(", "project", ",", "setting", ")", ";", "}", "}", "</s>" ]
1,539
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectManagement", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "ProjectRefreshCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ",", "true", ")", ";", "ProjectManagement", ".", "refresh", "(", "project", ",", "commandLine", ")", ";", "return", "Services", ".", "getMessage", "(", "\"\"", ",", "name", ")", ";", "}", "}", "</s>" ]
1,540
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "filesystem", ".", "EFS", ";", "import", "org", ".", "eclipse", ".", "core", ".", "filesystem", ".", "IFileStore", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "LinkDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "Project", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "ProjectDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "ProjectInfo", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "ResourceInfo", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "@", "Command", "(", "name", "=", "\"projects\"", ")", "public", "class", "ProjectsCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "ArrayList", "<", "HashMap", "<", "String", ",", "Object", ">", ">", "results", "=", "new", "ArrayList", "<", "HashMap", "<", "String", ",", "Object", ">", ">", "(", ")", ";", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "IProject", "[", "]", "projects", "=", "workspace", ".", "getRoot", "(", ")", ".", "getProjects", "(", ")", ";", "for", "(", "IProject", "project", ":", "projects", ")", "{", "HashMap", "<", "String", ",", "Object", ">", "info", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "info", ".", "put", "(", "\"name\"", ",", "project", ".", "getName", "(", ")", ")", ";", "if", "(", "project", ".", "isOpen", "(", ")", ")", "{", "String", "[", "]", "aliases", "=", "ProjectNatureFactory", ".", "getProjectNatureAliases", "(", "project", ")", ";", "if", "(", "aliases", ".", "length", "==", "0", ")", "{", "aliases", "=", "new", "String", "[", "]", "{", "\"none\"", "}", ";", "}", "info", ".", "put", "(", "\"natures\"", ",", "aliases", ")", ";", "}", "else", "{", "info", ".", "put", "(", "\"natures\"", ",", "new", "String", "[", "0", "]", ")", ";", "}", "String", "projectPath", "=", "ProjectUtils", ".", "getPath", "(", "project", ")", ";", "info", ".", "put", "(", "\"path\"", ",", "projectPath", ")", ";", "if", "(", "project", ".", "isOpen", "(", ")", ")", "{", "HashMap", "<", "String", ",", "String", ">", "links", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "if", "(", "new", "File", "(", "projectPath", ")", ".", "exists", "(", ")", ")", "{", "ResourceInfo", "pinfo", "=", "(", "(", "Project", ")", "project", ")", ".", "getResourceInfo", "(", "false", ",", "false", ")", ";", "ProjectDescription", "desc", "=", "(", "(", "ProjectInfo", ")", "pinfo", ")", ".", "getDescription", "(", ")", ";", "if", "(", "desc", "!=", "null", ")", "{", "HashMap", "<", "IPath", ",", "LinkDescription", ">", "linfo", "=", "(", "HashMap", "<", "IPath", ",", "LinkDescription", ">", ")", "desc", ".", "getLinks", "(", ")", ";", "if", "(", "linfo", "!=", "null", ")", "{", "for", "(", "IPath", "path", ":", "linfo", ".", "keySet", "(", ")", ")", "{", "LinkDescription", "link", "=", "linfo", ".", "get", "(", "path", ")", ";", "IResource", "member", "=", "project", ".", "findMember", "(", "link", ".", "getProjectRelativePath", "(", ")", ")", ";", "IFileStore", "store", "=", "EFS", ".", "getStore", "(", "member", ".", "getLocationURI", "(", ")", ")", ";", "String", "resolvedPath", "=", "store", "!=", "null", "?", "store", ".", "toString", "(", ")", ":", "link", ".", "getLocationURI", "(", ")", ".", "getPath", "(", ")", ";", "links", ".", "put", "(", "path", ".", "toString", "(", ")", ",", "resolvedPath", ")", ";", "}", "}", "}", "}", "info", ".", "put", "(", "\"links\"", ",", "links", ")", ";", "}", "results", ".", "add", "(", "info", ")", ";", "}", "return", "results", ";", "}", "}", "</s>" ]
1,541
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "search", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "Comparator", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "regex", ".", "Matcher", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "IOUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "file", ".", "FileUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceProxy", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceProxyVisitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "com", ".", "wcohen", ".", "ss", ".", "Levenstein", ";", "import", "com", ".", "wcohen", ".", "ss", ".", "api", ".", "StringDistance", ";", "@", "Command", "(", "name", "=", "\"locate_file\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "LocateFileCommand", "extends", "AbstractCommand", "{", "public", "static", "final", "String", "SCOPE_PROJECT", "=", "\"project\"", ";", "public", "static", "final", "String", "SCOPE_WORKSPACE", "=", "\"workspace\"", ";", "public", "static", "final", "String", "SCOPE_LIST", "=", "\"list\"", ";", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "pattern", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PATTERN_OPTION", ")", ";", "String", "scope", "=", "commandLine", ".", "getValue", "(", "Options", ".", "SCOPE_OPTION", ")", ";", "String", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "NAME_OPTION", ")", ";", "List", "<", "Result", ">", "results", "=", "null", ";", "if", "(", "SCOPE_LIST", ".", "equals", "(", "scope", ")", ")", "{", "results", "=", "executeLocateFromFileList", "(", "commandLine", ",", "pattern", ",", "scope", ")", ";", "}", "else", "{", "results", "=", "executeLocateFromEclipse", "(", "commandLine", ",", "pattern", ",", "scope", ")", ";", "}", "FilePathComparator", "comparator", "=", "new", "FilePathComparator", "(", "pattern", ",", "projectName", ")", ";", "Collections", ".", "sort", "(", "results", ",", "comparator", ")", ";", "return", "results", ";", "}", "private", "List", "<", "Result", ">", "executeLocateFromFileList", "(", "CommandLine", "commandLine", ",", "String", "pattern", ",", "String", "scope", ")", "throws", "Exception", "{", "ArrayList", "<", "Result", ">", "results", "=", "new", "ArrayList", "<", "Result", ">", "(", ")", ";", "String", "fileName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "BufferedReader", "reader", "=", "null", ";", "try", "{", "reader", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "fileName", ")", ")", ";", "int", "flags", "=", "0", ";", "if", "(", "commandLine", ".", "hasOption", "(", "Options", ".", "CASE_INSENSITIVE_OPTION", ")", ")", "{", "flags", "=", "Pattern", ".", "CASE_INSENSITIVE", ";", "}", "Matcher", "matcher", "=", "Pattern", ".", "compile", "(", "pattern", ",", "flags", ")", ".", "matcher", "(", "\"\"", ")", ";", "String", "line", "=", "null", ";", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "matcher", ".", "reset", "(", "line", ")", ".", "find", "(", ")", ")", "{", "results", ".", "add", "(", "new", "Result", "(", "FileUtils", ".", "getBaseName", "(", "line", ")", ",", "line", ",", "null", ",", "null", ")", ")", ";", "}", "}", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "reader", ")", ";", "}", "return", "results", ";", "}", "private", "List", "<", "Result", ">", "executeLocateFromEclipse", "(", "CommandLine", "commandLine", ",", "String", "pattern", ",", "String", "scope", ")", "throws", "Exception", "{", "ArrayList", "<", "IProject", ">", "projects", "=", "new", "ArrayList", "<", "IProject", ">", "(", ")", ";", "String", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "NAME_OPTION", ")", ";", "if", "(", "projectName", "!=", "null", ")", "{", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ",", "true", ")", ";", "projects", ".", "add", "(", "project", ")", ";", "IProject", "[", "]", "depends", "=", "project", ".", "getReferencedProjects", "(", ")", ";", "for", "(", "IProject", "p", ":", "depends", ")", "{", "if", "(", "!", "p", ".", "isOpen", "(", ")", ")", "{", "p", ".", "open", "(", "null", ")", ";", "}", "projects", ".", "add", "(", "p", ")", ";", "}", "}", "if", "(", "SCOPE_WORKSPACE", ".", "equals", "(", "scope", ")", ")", "{", "IProject", "[", "]", "all", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProjects", "(", ")", ";", "for", "(", "IProject", "p", ":", "all", ")", "{", "if", "(", "p", ".", "isOpen", "(", ")", "&&", "!", "projects", ".", "contains", "(", "p", ")", ")", "{", "projects", ".", "add", "(", "p", ")", ";", "}", "}", "}", "FileMatcher", "matcher", "=", "new", "FileMatcher", "(", "pattern", ",", "commandLine", ".", "hasOption", "(", "Options", ".", "CASE_INSENSITIVE_OPTION", ")", ")", ";", "for", "(", "IProject", "resource", ":", "projects", ")", "{", "resource", ".", "accept", "(", "matcher", ",", "0", ")", ";", "}", "return", "matcher", ".", "getResults", "(", ")", ";", "}", "public", "static", "class", "Result", "{", "public", "String", "name", ";", "public", "String", "path", ";", "public", "String", "project", ";", "public", "String", "projectPath", ";", "public", "Result", "(", "String", "name", ",", "String", "path", ",", "String", "project", ",", "String", "projectPath", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "path", "=", "path", ";", "this", ".", "project", "=", "project", ";", "this", ".", "projectPath", "=", "projectPath", ";", "}", "}", "private", "static", "class", "FileMatcher", "implements", "IResourceProxyVisitor", "{", "private", "static", "final", "Pattern", "FIND_BASE", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "private", "static", "final", "ArrayList", "<", "String", ">", "IGNORE_DIRS", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "static", "{", "IGNORE_DIRS", ".", "add", "(", "\"CVS\"", ")", ";", "IGNORE_DIRS", ".", "add", "(", "\".bzr\"", ")", ";", "IGNORE_DIRS", ".", "add", "(", "\".git\"", ")", ";", "IGNORE_DIRS", ".", "add", "(", "\".hg\"", ")", ";", "IGNORE_DIRS", ".", "add", "(", "\".svn\"", ")", ";", "}", "private", "static", "final", "ArrayList", "<", "String", ">", "IGNORE_EXTS", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "static", "{", "IGNORE_EXTS", ".", "add", "(", "\"class\"", ")", ";", "IGNORE_EXTS", ".", "add", "(", "\"gif\"", ")", ";", "IGNORE_EXTS", ".", "add", "(", "\"jpeg\"", ")", ";", "IGNORE_EXTS", ".", "add", "(", "\"jpg\"", ")", ";", "IGNORE_EXTS", ".", "add", "(", "\"png\"", ")", ";", "IGNORE_EXTS", ".", "add", "(", "\"pyc\"", ")", ";", "IGNORE_EXTS", ".", "add", "(", "\"swp\"", ")", ";", "}", "private", "Matcher", "matcher", ";", "private", "boolean", "includesPath", ";", "private", "Matcher", "baseMatcher", ";", "private", "ArrayList", "<", "Result", ">", "results", "=", "new", "ArrayList", "<", "Result", ">", "(", ")", ";", "private", "ArrayList", "<", "String", ">", "seen", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "public", "FileMatcher", "(", "String", "pattern", ",", "boolean", "ignoreCase", ")", "{", "int", "flags", "=", "0", ";", "if", "(", "ignoreCase", ")", "{", "flags", "=", "Pattern", ".", "CASE_INSENSITIVE", ";", "}", "this", ".", "matcher", "=", "Pattern", ".", "compile", "(", "pattern", ",", "flags", ")", ".", "matcher", "(", "\"\"", ")", ";", "Matcher", "baseMatcher", "=", "FIND_BASE", ".", "matcher", "(", "pattern", ")", ";", "if", "(", "baseMatcher", ".", "find", "(", ")", ")", "{", "String", "base", "=", "baseMatcher", ".", "group", "(", "1", ")", ";", "this", ".", "baseMatcher", "=", "Pattern", ".", "compile", "(", "base", ")", ".", "matcher", "(", "\"\"", ")", ";", "this", ".", "includesPath", "=", "true", ";", "}", "}", "public", "boolean", "visit", "(", "IResourceProxy", "proxy", ")", "throws", "CoreException", "{", "if", "(", "results", ".", "size", "(", ")", ">=", "100", ")", "{", "return", "false", ";", "}", "int", "type", "=", "proxy", ".", "getType", "(", ")", ";", "String", "name", "=", "proxy", ".", "getName", "(", ")", ";", "if", "(", "type", "==", "IResource", ".", "PROJECT", ")", "{", "return", "true", ";", "}", "else", "if", "(", "type", "==", "IResource", ".", "FOLDER", "&&", "IGNORE_DIRS", ".", "contains", "(", "name", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "type", "==", "IResource", ".", "FOLDER", ")", "{", "return", "true", ";", "}", "else", "if", "(", "type", "==", "IResource", ".", "FILE", ")", "{", "String", "ext", "=", "FileUtils", ".", "getExtension", "(", "name", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "IGNORE_EXTS", ".", "contains", "(", "ext", ")", ")", "{", "return", "false", ";", "}", "}", "IResource", "resource", "=", "null", ";", "if", "(", "includesPath", ")", "{", "if", "(", "!", "baseMatcher", ".", "reset", "(", "name", ")", ".", "matches", "(", ")", ")", "{", "return", "true", ";", "}", "resource", "=", "proxy", ".", "requestResource", "(", ")", ";", "name", "=", "resource", ".", "getFullPath", "(", ")", ".", "toOSString", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "}", "if", "(", "matcher", ".", "reset", "(", "name", ")", ".", "matches", "(", ")", ")", "{", "if", "(", "resource", "==", "null", ")", "{", "resource", "=", "proxy", ".", "requestResource", "(", ")", ";", "}", "IPath", "raw", "=", "resource", ".", "getLocation", "(", ")", ";", "if", "(", "raw", "!=", "null", ")", "{", "String", "rel", "=", "resource", ".", "getFullPath", "(", ")", ".", "toOSString", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "String", "path", "=", "raw", ".", "toOSString", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "Result", "entry", "=", "new", "Result", "(", "FileUtils", ".", "getBaseName", "(", "rel", ")", ",", "path", ",", "resource", ".", "getProject", "(", ")", ".", "getName", "(", ")", ",", "rel", ")", ";", "if", "(", "!", "seen", ".", "contains", "(", "path", ")", ")", "{", "results", ".", "add", "(", "entry", ")", ";", "seen", ".", "add", "(", "path", ")", ";", "}", "}", "}", "return", "true", ";", "}", "public", "List", "<", "Result", ">", "getResults", "(", ")", "{", "return", "results", ";", "}", "}", "private", "static", "class", "FilePathComparator", "implements", "Comparator", "<", "Result", ">", "{", "private", "StringDistance", "distance", ";", "private", "String", "pattern", ";", "private", "String", "projectName", ";", "private", "Map", "<", "String", ",", "Double", ">", "scores", "=", "new", "HashMap", "<", "String", ",", "Double", ">", "(", ")", ";", "public", "FilePathComparator", "(", "String", "pattern", ",", "String", "projectName", ")", "{", "this", ".", "distance", "=", "new", "Levenstein", "(", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "this", ".", "pattern", "=", "this", ".", "pattern", ".", "replaceAll", "(", "\"\\\\.\\\\*\\\\??\"", ",", "\"\"", ")", ";", "this", ".", "projectName", "=", "projectName", ";", "}", "public", "int", "compare", "(", "Result", "o1", ",", "Result", "o2", ")", "{", "double", "score1", "=", "score", "(", "o1", ")", ";", "double", "score2", "=", "score", "(", "o2", ")", ";", "return", "(", "int", ")", "Math", ".", "round", "(", "score1", "-", "score2", ")", ";", "}", "public", "double", "score", "(", "Result", "result", ")", "{", "String", "path", "=", "result", ".", "projectPath", "!=", "null", "?", "result", ".", "projectPath", ":", "result", ".", "path", ";", "if", "(", "this", ".", "scores", ".", "containsKey", "(", "path", ")", ")", "{", "return", "this", ".", "scores", ".", "get", "(", "path", ")", ";", "}", "double", "score", "=", "0", "-", "this", ".", "distance", ".", "score", "(", "this", ".", "pattern", ",", "path", ")", ";", "if", "(", "projectName", "!=", "null", "&&", "result", ".", "project", "!=", "null", ")", "{", "if", "(", "result", ".", "project", ".", "equals", "(", "projectName", ")", ")", "{", "score", "-=", "score", "*", ".1", ";", "}", "}", "this", ".", "scores", ".", "put", "(", "path", ",", "score", ")", ";", "return", "score", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "return", "super", ".", "equals", "(", "obj", ")", ";", "}", "}", "}", "</s>" ]
1,542
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "history", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "File", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "HistoryClearCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "filename", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "File", "file", "=", "(", "File", ")", "ProjectUtils", ".", "getFile", "(", "project", ",", "filename", ")", ";", "file", ".", "getLocalManager", "(", ")", ".", "getHistoryStore", "(", ")", ".", "remove", "(", "file", ".", "getFullPath", "(", ")", ",", "new", "NullProgressMonitor", "(", ")", ")", ";", "return", "Services", ".", "getMessage", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
1,543
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "history", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "filesystem", ".", "IFileInfo", ";", "import", "org", ".", "eclipse", ".", "core", ".", "filesystem", ".", "IFileStore", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "localstore", ".", "FileSystemResourceManager", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "File", ";", "@", "Command", "(", "name", "=", "\"history_add\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "HistoryAddCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "filename", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "File", "file", "=", "(", "File", ")", "ProjectUtils", ".", "getFile", "(", "name", ",", "filename", ")", ";", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "FileSystemResourceManager", "localManager", "=", "file", ".", "getLocalManager", "(", ")", ";", "IFileStore", "store", "=", "localManager", ".", "getStore", "(", "file", ")", ";", "IFileInfo", "fileInfo", "=", "store", ".", "fetchInfo", "(", ")", ";", "localManager", ".", "getHistoryStore", "(", ")", ".", "addState", "(", "file", ".", "getFullPath", "(", ")", ",", "store", ",", "fileInfo", ",", "false", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
1,544
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "history", ";", "import", "java", ".", "text", ".", "SimpleDateFormat", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Comparator", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "StringUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "File", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "team", ".", "core", ".", "history", ".", "IFileRevision", ";", "import", "org", ".", "eclipse", ".", "team", ".", "internal", ".", "core", ".", "history", ".", "LocalFileHistory", ";", "import", "org", ".", "joda", ".", "time", ".", "Period", ";", "@", "Command", "(", "name", "=", "\"history_list\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "HistoryListCommand", "extends", "AbstractCommand", "{", "private", "static", "final", "SimpleDateFormat", "DATE_FORMATTER", "=", "new", "SimpleDateFormat", "(", "\"\"", ")", ";", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "filename", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "File", "file", "=", "(", "File", ")", "ProjectUtils", ".", "getFile", "(", "project", ",", "filename", ")", ";", "LocalFileHistory", "history", "=", "new", "LocalFileHistory", "(", "file", ",", "false", ")", ";", "history", ".", "refresh", "(", "new", "NullProgressMonitor", "(", ")", ")", ";", "IFileRevision", "[", "]", "revisions", "=", "history", ".", "getFileRevisions", "(", ")", ";", "Arrays", ".", "sort", "(", "revisions", ",", "new", "Comparator", "<", "IFileRevision", ">", "(", ")", "{", "public", "int", "compare", "(", "IFileRevision", "r1", ",", "IFileRevision", "r2", ")", "{", "return", "(", "int", ")", "(", "r2", ".", "getTimestamp", "(", ")", "-", "r1", ".", "getTimestamp", "(", ")", ")", ";", "}", "}", ")", ";", "ArrayList", "<", "HashMap", "<", "String", ",", "Object", ">", ">", "results", "=", "new", "ArrayList", "<", "HashMap", "<", "String", ",", "Object", ">", ">", "(", ")", ";", "for", "(", "IFileRevision", "revision", ":", "revisions", ")", "{", "HashMap", "<", "String", ",", "Object", ">", "result", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "result", ".", "put", "(", "\"timestamp\"", ",", "String", ".", "valueOf", "(", "revision", ".", "getTimestamp", "(", ")", ")", ")", ";", "result", ".", "put", "(", "\"datetime\"", ",", "DATE_FORMATTER", ".", "format", "(", "new", "Date", "(", "revision", ".", "getTimestamp", "(", ")", ")", ")", ")", ";", "result", ".", "put", "(", "\"delta\"", ",", "delta", "(", "revision", ".", "getTimestamp", "(", ")", ")", ")", ";", "results", ".", "add", "(", "result", ")", ";", "}", "return", "results", ";", "}", "private", "String", "delta", "(", "long", "time", ")", "{", "Period", "period", "=", "new", "Period", "(", "time", ",", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "ArrayList", "<", "String", ">", "parts", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "int", "years", "=", "period", ".", "getYears", "(", ")", ";", "if", "(", "years", ">", "0", ")", "{", "parts", ".", "add", "(", "years", "+", "\"", "year\"", "+", "(", "years", "==", "1", "?", "\"\"", ":", "\"s\"", ")", ")", ";", "}", "int", "months", "=", "period", ".", "getMonths", "(", ")", ";", "if", "(", "months", ">", "0", ")", "{", "parts", ".", "add", "(", "months", "+", "\"", "month\"", "+", "(", "months", "==", "1", "?", "\"\"", ":", "\"s\"", ")", ")", ";", "}", "int", "weeks", "=", "period", ".", "getWeeks", "(", ")", ";", "if", "(", "weeks", ">", "0", ")", "{", "parts", ".", "add", "(", "weeks", "+", "\"", "week\"", "+", "(", "weeks", "==", "1", "?", "\"\"", ":", "\"s\"", ")", ")", ";", "}", "int", "days", "=", "period", ".", "getDays", "(", ")", ";", "if", "(", "days", ">", "0", ")", "{", "parts", ".", "add", "(", "days", "+", "\"", "day\"", "+", "(", "days", "==", "1", "?", "\"\"", ":", "\"s\"", ")", ")", ";", "}", "int", "hours", "=", "period", ".", "getHours", "(", ")", ";", "if", "(", "hours", ">", "0", ")", "{", "parts", ".", "add", "(", "hours", "+", "\"", "hour\"", "+", "(", "hours", "==", "1", "?", "\"\"", ":", "\"s\"", ")", ")", ";", "}", "int", "minutes", "=", "period", ".", "getMinutes", "(", ")", ";", "if", "(", "minutes", ">", "0", ")", "{", "parts", ".", "add", "(", "minutes", "+", "\"", "minute\"", "+", "(", "minutes", "==", "1", "?", "\"\"", ":", "\"s\"", ")", ")", ";", "}", "int", "seconds", "=", "period", ".", "getSeconds", "(", ")", ";", "if", "(", "seconds", ">", "0", ")", "{", "parts", ".", "add", "(", "seconds", "+", "\"", "second\"", "+", "(", "seconds", "==", "1", "?", "\"\"", ":", "\"s\"", ")", ")", ";", "}", "if", "(", "parts", ".", "size", "(", ")", "==", "0", ")", "{", "int", "millis", "=", "period", ".", "getMillis", "(", ")", ";", "if", "(", "millis", ">", "0", ")", "{", "parts", ".", "add", "(", "millis", "+", "\"", "millis\"", ")", ";", "}", "}", "return", "StringUtils", ".", "join", "(", "parts", ".", "toArray", "(", ")", ",", "'", "'", ")", "+", "\"", "ago\"", ";", "}", "}", "</s>" ]
1,545
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "history", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "IOUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "File", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "team", ".", "core", ".", "history", ".", "IFileRevision", ";", "import", "org", ".", "eclipse", ".", "team", ".", "internal", ".", "core", ".", "history", ".", "LocalFileHistory", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "HistoryRevisionCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "filename", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "long", "revision", "=", "commandLine", ".", "getLongValue", "(", "Options", ".", "REVISION_OPTION", ")", ";", "File", "file", "=", "(", "File", ")", "ProjectUtils", ".", "getFile", "(", "project", ",", "filename", ")", ";", "LocalFileHistory", "history", "=", "new", "LocalFileHistory", "(", "file", ",", "false", ")", ";", "history", ".", "refresh", "(", "new", "NullProgressMonitor", "(", ")", ")", ";", "IFileRevision", "[", "]", "revisions", "=", "history", ".", "getFileRevisions", "(", ")", ";", "for", "(", "IFileRevision", "rev", ":", "revisions", ")", "{", "if", "(", "rev", ".", "getTimestamp", "(", ")", "==", "revision", ")", "{", "return", "IOUtils", ".", "toString", "(", "rev", ".", "getStorage", "(", "new", "NullProgressMonitor", "(", ")", ")", ".", "getContents", "(", ")", ")", ";", "}", "}", "return", "null", ";", "}", "}", "</s>" ]
1,546
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "eclipse", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "@", "Command", "(", "name", "=", "\"\"", ")", "public", "class", "WorkspaceCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "return", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getRawLocation", "(", ")", ".", "toOSString", "(", ")", ";", "}", "}", "</s>" ]
1,547
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "eclipse", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "util", ".", "StringUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "IJobManager", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "Job", ";", "@", "Command", "(", "name", "=", "\"jobs\"", ",", "options", "=", "\"\"", ")", "public", "class", "JobsCommand", "extends", "AbstractCommand", "{", "public", "static", "final", "String", "AUTO_BUILD", "=", "\"auto_build\"", ";", "public", "static", "final", "String", "AUTO_REFRESH", "=", "\"auto_refresh\"", ";", "public", "static", "final", "String", "MANUAL_BUILD", "=", "\"manual_build\"", ";", "public", "static", "final", "String", "MANUAL_REFRESH", "=", "\"\"", ";", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "Object", "family", "=", "getFamily", "(", "commandLine", ".", "getValue", "(", "Options", ".", "FAMILY_OPTION", ")", ")", ";", "IJobManager", "manager", "=", "Job", ".", "getJobManager", "(", ")", ";", "Job", "[", "]", "jobs", "=", "manager", ".", "find", "(", "family", ")", ";", "ArrayList", "<", "HashMap", "<", "String", ",", "String", ">", ">", "results", "=", "new", "ArrayList", "<", "HashMap", "<", "String", ",", "String", ">", ">", "(", ")", ";", "for", "(", "Job", "job", ":", "jobs", ")", "{", "HashMap", "<", "String", ",", "String", ">", "result", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "result", ".", "put", "(", "\"job\"", ",", "job", ".", "toString", "(", ")", ")", ";", "result", ".", "put", "(", "\"status\"", ",", "getStatus", "(", "job", ")", ")", ";", "results", ".", "add", "(", "result", ")", ";", "}", "return", "results", ";", "}", "private", "Object", "getFamily", "(", "String", "name", ")", "{", "if", "(", "name", "!=", "null", ")", "{", "if", "(", "AUTO_BUILD", ".", "equals", "(", "name", ")", ")", "{", "return", "ResourcesPlugin", ".", "FAMILY_AUTO_BUILD", ";", "}", "else", "if", "(", "AUTO_REFRESH", ".", "equals", "(", "name", ")", ")", "{", "return", "ResourcesPlugin", ".", "FAMILY_AUTO_REFRESH", ";", "}", "else", "if", "(", "MANUAL_BUILD", ".", "equals", "(", "name", ")", ")", "{", "return", "ResourcesPlugin", ".", "FAMILY_MANUAL_BUILD", ";", "}", "else", "if", "(", "MANUAL_REFRESH", ".", "equals", "(", "name", ")", ")", "{", "return", "ResourcesPlugin", ".", "FAMILY_MANUAL_REFRESH", ";", "}", "}", "return", "null", ";", "}", "private", "String", "getStatus", "(", "Job", "job", ")", "{", "int", "status", "=", "job", ".", "getState", "(", ")", ";", "switch", "(", "status", ")", "{", "case", "Job", ".", "RUNNING", ":", "return", "\"running\"", ";", "case", "Job", ".", "SLEEPING", ":", "return", "\"sleeping\"", ";", "case", "Job", ".", "WAITING", ":", "return", "\"waiting\"", ";", "case", "Job", ".", "NONE", ":", "return", "\"none\"", ";", "}", "return", "StringUtils", ".", "EMPTY", ";", "}", "}", "</s>" ]
1,548
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "xml", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "javax", ".", "xml", ".", "transform", ".", "OutputKeys", ";", "import", "javax", ".", "xml", ".", "transform", ".", "Transformer", ";", "import", "javax", ".", "xml", ".", "transform", ".", "TransformerFactory", ";", "import", "javax", ".", "xml", ".", "transform", ".", "sax", ".", "SAXSource", ";", "import", "javax", ".", "xml", ".", "transform", ".", "stream", ".", "StreamResult", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "util", ".", "IOUtils", ";", "import", "org", ".", "xml", ".", "sax", ".", "InputSource", ";", "@", "Command", "(", "name", "=", "\"xml_format\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "FormatCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "restoreNewline", "=", "null", ";", "FileInputStream", "in", "=", "null", ";", "try", "{", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "int", "indent", "=", "commandLine", ".", "getIntValue", "(", "Options", ".", "INDENT_OPTION", ")", ";", "String", "format", "=", "commandLine", ".", "getValue", "(", "\"m\"", ")", ";", "String", "newline", "=", "System", ".", "getProperty", "(", "\"\"", ")", ";", "if", "(", "newline", ".", "equals", "(", "\"rn\"", ")", "&&", "format", ".", "equals", "(", "\"unix\"", ")", ")", "{", "restoreNewline", "=", "newline", ";", "System", ".", "setProperty", "(", "\"\"", ",", "\"n\"", ")", ";", "}", "else", "if", "(", "newline", ".", "equals", "(", "\"n\"", ")", "&&", "format", ".", "equals", "(", "\"dos\"", ")", ")", "{", "restoreNewline", "=", "newline", ";", "System", ".", "setProperty", "(", "\"\"", ",", "\"rn\"", ")", ";", "}", "TransformerFactory", "factory", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "factory", ".", "setAttribute", "(", "\"\"", ",", "Integer", ".", "valueOf", "(", "indent", ")", ")", ";", "Transformer", "serializer", "=", "factory", ".", "newTransformer", "(", ")", ";", "serializer", ".", "setOutputProperty", "(", "OutputKeys", ".", "INDENT", ",", "\"yes\"", ")", ";", "StringWriter", "out", "=", "new", "StringWriter", "(", ")", ";", "in", "=", "new", "FileInputStream", "(", "file", ")", ";", "serializer", ".", "transform", "(", "new", "SAXSource", "(", "new", "InputSource", "(", "in", ")", ")", ",", "new", "StreamResult", "(", "out", ")", ")", ";", "return", "out", ".", "toString", "(", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "in", ")", ";", "if", "(", "restoreNewline", "!=", "null", ")", "{", "System", ".", "setProperty", "(", "\"\"", ",", "restoreNewline", ")", ";", "}", "}", "}", "}", "</s>" ]
1,549
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "xml", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "XmlUtils", ";", "import", "org", ".", "xml", ".", "sax", ".", "helpers", ".", "DefaultHandler", ";", "@", "Command", "(", "name", "=", "\"xml_validate\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "ValidateCommand", "extends", "AbstractCommand", "{", "private", "static", "final", "String", "NO_GRAMMER", "=", "\"\"", ";", "private", "static", "final", "String", "DOCTYPE_ROOT_NULL", "=", "\"\"", ";", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "boolean", "schema", "=", "commandLine", ".", "hasOption", "(", "Options", ".", "SCHEMA_OPTION", ")", ";", "List", "<", "Error", ">", "errors", "=", "validate", "(", "project", ",", "file", ",", "schema", ",", "null", ")", ";", "return", "errors", ";", "}", "protected", "List", "<", "Error", ">", "validate", "(", "String", "project", ",", "String", "file", ",", "boolean", "schema", ",", "DefaultHandler", "handler", ")", "throws", "Exception", "{", "List", "<", "Error", ">", "errors", "=", "XmlUtils", ".", "validateXml", "(", "project", ",", "file", ",", "schema", ",", "handler", ")", ";", "for", "(", "Iterator", "<", "Error", ">", "ii", "=", "errors", ".", "iterator", "(", ")", ";", "ii", ".", "hasNext", "(", ")", ";", ")", "{", "Error", "error", "=", "ii", ".", "next", "(", ")", ";", "if", "(", "error", ".", "getMessage", "(", ")", ".", "indexOf", "(", "NO_GRAMMER", ")", "!=", "-", "1", "||", "error", ".", "getMessage", "(", ")", ".", "indexOf", "(", "DOCTYPE_ROOT_NULL", ")", "!=", "-", "1", ")", "{", "ii", ".", "remove", "(", ")", ";", "}", "}", "return", "errors", ";", "}", "}", "</s>" ]
1,550
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "refactoring", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "Refactoring", ";", "public", "class", "Refactor", "{", "public", "String", "name", ";", "public", "Refactoring", "refactoring", ";", "public", "Refactor", "(", "String", "name", ",", "Refactoring", "refactoring", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "refactoring", "=", "refactoring", ";", "}", "public", "Refactor", "(", "Refactoring", "refactoring", ")", "{", "this", ".", "name", "=", "refactoring", ".", "getName", "(", ")", ";", "this", ".", "refactoring", "=", "refactoring", ";", "}", "}", "</s>" ]
1,551
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "refactoring", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Field", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectManagement", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "SubProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "Change", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "CompositeChange", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "PerformChangeOperation", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "Refactoring", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "RefactoringCore", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "RefactoringStatus", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "RefactoringStatusEntry", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "TextFileChange", ";", "public", "abstract", "class", "AbstractRefactorCommand", "extends", "AbstractCommand", "{", "private", "static", "final", "String", "PREVIEW_OPTION", "=", "\"v\"", ";", "private", "static", "final", "String", "DIFF_OPTION", "=", "\"d\"", ";", "@", "Override", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "if", "(", "!", "commandLine", ".", "hasOption", "(", "PREVIEW_OPTION", ")", ")", "{", "String", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ",", "true", ")", ";", "ProjectManagement", ".", "refresh", "(", "project", ",", "commandLine", ")", ";", "IProject", "[", "]", "references", "=", "project", ".", "getReferencingProjects", "(", ")", ";", "for", "(", "IProject", "p", ":", "references", ")", "{", "ProjectManagement", ".", "refresh", "(", "p", ",", "commandLine", ")", ";", "}", "}", "try", "{", "NullProgressMonitor", "monitor", "=", "new", "NullProgressMonitor", "(", ")", ";", "Refactor", "refactor", "=", "createRefactoring", "(", "commandLine", ")", ";", "Refactoring", "refactoring", "=", "refactor", ".", "refactoring", ";", "RefactoringStatus", "status", "=", "refactoring", ".", "checkAllConditions", "(", "new", "SubProgressMonitor", "(", "monitor", ",", "4", ")", ")", ";", "int", "stopSeverity", "=", "RefactoringCore", ".", "getConditionCheckingFailedSeverity", "(", ")", ";", "if", "(", "status", ".", "getSeverity", "(", ")", ">=", "stopSeverity", ")", "{", "throw", "new", "RefactorException", "(", "status", ")", ";", "}", "Change", "change", "=", "refactoring", ".", "createChange", "(", "new", "SubProgressMonitor", "(", "monitor", ",", "2", ")", ")", ";", "change", ".", "initializeValidationData", "(", "new", "SubProgressMonitor", "(", "monitor", ",", "1", ")", ")", ";", "if", "(", "commandLine", ".", "hasOption", "(", "PREVIEW_OPTION", ")", ")", "{", "if", "(", "commandLine", ".", "hasOption", "(", "DIFF_OPTION", ")", ")", "{", "return", "previewChange", "(", "change", ",", "commandLine", ".", "getValue", "(", "\"d\"", ")", ")", ";", "}", "HashMap", "<", "String", ",", "Object", ">", "preview", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "String", "previewOpt", "=", "\"-\"", "+", "PREVIEW_OPTION", ";", "String", "[", "]", "args", "=", "commandLine", ".", "getArgs", "(", ")", ";", "StringBuffer", "apply", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "String", "arg", ":", "args", ")", "{", "if", "(", "arg", ".", "equals", "(", "previewOpt", ")", ")", "{", "continue", ";", "}", "if", "(", "apply", ".", "length", "(", ")", ">", "0", ")", "{", "apply", ".", "append", "(", "'", "'", ")", ";", "}", "if", "(", "arg", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "apply", ".", "append", "(", "arg", ")", ";", "}", "else", "{", "apply", ".", "append", "(", "'\"'", ")", ".", "append", "(", "arg", ")", ".", "append", "(", "'\"'", ")", ";", "}", "}", "preview", ".", "put", "(", "\"apply\"", ",", "apply", ".", "toString", "(", ")", ".", "replaceFirst", "(", "\"-\"", "+", "Options", ".", "EDITOR_OPTION", "+", "\"\\\\s\\\"\\\\w+\\\"", "\"", ",", "\"\"", ")", ".", "replaceFirst", "(", "\"-\"", "+", "Options", ".", "PRETTY_OPTION", "+", "'", "'", ",", "\"\"", ")", ")", ";", "preview", ".", "put", "(", "\"changes\"", ",", "previewChanges", "(", "change", ")", ")", ";", "return", "preview", ";", "}", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "ResourceChangeListener", "rcl", "=", "new", "ResourceChangeListener", "(", ")", ";", "workspace", ".", "addResourceChangeListener", "(", "rcl", ")", ";", "try", "{", "PerformChangeOperation", "changeOperation", "=", "new", "PerformChangeOperation", "(", "change", ")", ";", "if", "(", "change", "instanceof", "CompositeChange", ")", "{", "try", "{", "Field", "fName", "=", "CompositeChange", ".", "class", ".", "getDeclaredField", "(", "\"fName\"", ")", ";", "fName", ".", "setAccessible", "(", "true", ")", ";", "fName", ".", "set", "(", "change", ",", "refactor", ".", "name", ")", ";", "}", "catch", "(", "NoSuchFieldException", "nsfe", ")", "{", "}", "}", "changeOperation", ".", "setUndoManager", "(", "RefactoringCore", ".", "getUndoManager", "(", ")", ",", "change", ".", "getName", "(", ")", ")", ";", "changeOperation", ".", "run", "(", "new", "SubProgressMonitor", "(", "monitor", ",", "4", ")", ")", ";", "return", "rcl", ".", "getChangedFiles", "(", ")", ";", "}", "finally", "{", "workspace", ".", "removeResourceChangeListener", "(", "rcl", ")", ";", "}", "}", "catch", "(", "RefactorException", "re", ")", "{", "HashMap", "<", "String", ",", "List", "<", "String", ">", ">", "result", "=", "new", "HashMap", "<", "String", ",", "List", "<", "String", ">", ">", "(", ")", ";", "List", "<", "String", ">", "errors", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "re", ".", "getMessage", "(", ")", "!=", "null", ")", "{", "errors", ".", "add", "(", "re", ".", "getMessage", "(", ")", ")", ";", "}", "RefactoringStatus", "status", "=", "re", ".", "getStatus", "(", ")", ";", "if", "(", "status", "!=", "null", ")", "{", "for", "(", "RefactoringStatusEntry", "entry", ":", "status", ".", "getEntries", "(", ")", ")", "{", "String", "message", "=", "entry", ".", "getMessage", "(", ")", ";", "if", "(", "!", "errors", ".", "contains", "(", "message", ")", "&&", "!", "message", ".", "startsWith", "(", "\"\"", ")", ")", "{", "errors", ".", "add", "(", "message", ")", ";", "}", "}", "}", "result", ".", "put", "(", "\"errors\"", ",", "errors", ")", ";", "return", "result", ";", "}", "}", "public", "abstract", "Refactor", "createRefactoring", "(", "CommandLine", "commandLine", ")", "throws", "Exception", ";", "private", "ArrayList", "<", "HashMap", "<", "String", ",", "String", ">", ">", "previewChanges", "(", "Change", "change", ")", "throws", "Exception", "{", "ArrayList", "<", "HashMap", "<", "String", ",", "String", ">", ">", "results", "=", "new", "ArrayList", "<", "HashMap", "<", "String", ",", "String", ">", ">", "(", ")", ";", "if", "(", "change", "instanceof", "CompositeChange", ")", "{", "for", "(", "Change", "c", ":", "(", "(", "CompositeChange", ")", "change", ")", ".", "getChildren", "(", ")", ")", "{", "results", ".", "addAll", "(", "previewChanges", "(", "c", ")", ")", ";", "}", "}", "else", "{", "HashMap", "<", "String", ",", "String", ">", "result", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "if", "(", "change", "instanceof", "TextFileChange", ")", "{", "TextFileChange", "text", "=", "(", "TextFileChange", ")", "change", ";", "result", ".", "put", "(", "\"type\"", ",", "\"diff\"", ")", ";", "result", ".", "put", "(", "\"file\"", ",", "text", ".", "getFile", "(", ")", ".", "getLocation", "(", ")", ".", "toOSString", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ")", ";", "}", "else", "{", "result", ".", "put", "(", "\"type\"", ",", "\"other\"", ")", ";", "result", ".", "put", "(", "\"message\"", ",", "change", ".", "toString", "(", ")", ")", ";", "}", "results", ".", "add", "(", "result", ")", ";", "}", "return", "results", ";", "}", "private", "String", "previewChange", "(", "Change", "change", ",", "String", "file", ")", "throws", "Exception", "{", "if", "(", "change", "instanceof", "CompositeChange", ")", "{", "for", "(", "Change", "c", ":", "(", "(", "CompositeChange", ")", "change", ")", ".", "getChildren", "(", ")", ")", "{", "String", "preview", "=", "previewChange", "(", "c", ",", "file", ")", ";", "if", "(", "preview", "!=", "null", ")", "{", "return", "preview", ";", "}", "}", "}", "else", "{", "if", "(", "change", "instanceof", "TextFileChange", ")", "{", "TextFileChange", "text", "=", "(", "TextFileChange", ")", "change", ";", "String", "path", "=", "text", ".", "getFile", "(", ")", ".", "getLocation", "(", ")", ".", "toOSString", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "if", "(", "path", ".", "equals", "(", "file", ")", ")", "{", "return", "text", ".", "getPreviewContent", "(", "new", "NullProgressMonitor", "(", ")", ")", ";", "}", "}", "}", "return", "null", ";", "}", "}", "</s>" ]
1,552
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "refactoring", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "IUndoManager", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "RefactoringCore", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "RedoCommand", "extends", "AbstractCommand", "{", "@", "Override", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "ResourceChangeListener", "rcl", "=", "new", "ResourceChangeListener", "(", ")", ";", "workspace", ".", "addResourceChangeListener", "(", "rcl", ")", ";", "try", "{", "IUndoManager", "manager", "=", "RefactoringCore", ".", "getUndoManager", "(", ")", ";", "if", "(", "commandLine", ".", "hasOption", "(", "Options", ".", "PEEK_OPTION", ")", ")", "{", "return", "manager", ".", "peekUndoName", "(", ")", ";", "}", "manager", ".", "performRedo", "(", "null", ",", "null", ")", ";", "return", "rcl", ".", "getChangedFiles", "(", ")", ";", "}", "finally", "{", "workspace", ".", "removeResourceChangeListener", "(", "rcl", ")", ";", "}", "}", "}", "</s>" ]
1,553
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "refactoring", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "IUndoManager", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "RefactoringCore", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", ")", "public", "class", "UndoCommand", "extends", "AbstractCommand", "{", "@", "Override", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "ResourceChangeListener", "rcl", "=", "new", "ResourceChangeListener", "(", ")", ";", "workspace", ".", "addResourceChangeListener", "(", "rcl", ")", ";", "try", "{", "IUndoManager", "manager", "=", "RefactoringCore", ".", "getUndoManager", "(", ")", ";", "if", "(", "commandLine", ".", "hasOption", "(", "Options", ".", "PEEK_OPTION", ")", ")", "{", "return", "manager", ".", "peekUndoName", "(", ")", ";", "}", "manager", ".", "performUndo", "(", "null", ",", "null", ")", ";", "return", "rcl", ".", "getChangedFiles", "(", ")", ";", "}", "finally", "{", "workspace", ".", "removeResourceChangeListener", "(", "rcl", ")", ";", "}", "}", "}", "</s>" ]
1,554
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "refactoring", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "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", ".", "CoreException", ";", "public", "class", "ResourceChangeListener", "implements", "IResourceChangeListener", ",", "IResourceDeltaVisitor", "{", "private", "List", "<", "IResourceDelta", ">", "deltas", "=", "new", "ArrayList", "<", "IResourceDelta", ">", "(", ")", ";", "@", "Override", "public", "void", "resourceChanged", "(", "IResourceChangeEvent", "event", ")", "{", "try", "{", "event", ".", "getDelta", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "throw", "new", "RuntimeException", "(", "ce", ")", ";", "}", "}", "@", "Override", "public", "boolean", "visit", "(", "IResourceDelta", "delta", ")", "throws", "CoreException", "{", "IResource", "resource", "=", "delta", ".", "getResource", "(", ")", ";", "if", "(", "delta", ".", "getKind", "(", ")", "!=", "IResourceDelta", ".", "NO_CHANGE", "&&", "(", "resource", ".", "getType", "(", ")", "==", "IResource", ".", "FILE", "||", "resource", ".", "getType", "(", ")", "==", "IResource", ".", "FOLDER", ")", ")", "{", "deltas", ".", "add", "(", "delta", ")", ";", "}", "return", "true", ";", "}", "public", "List", "<", "IResourceDelta", ">", "getResourceDeltas", "(", ")", "{", "return", "deltas", ";", "}", "public", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "getChangedFiles", "(", ")", "throws", "Exception", "{", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "results", "=", "new", "ArrayList", "<", "Map", "<", "String", ",", "String", ">", ">", "(", ")", ";", "HashSet", "<", "String", ">", "seen", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "IResourceDelta", "delta", ":", "getResourceDeltas", "(", ")", ")", "{", "int", "flags", "=", "delta", ".", "getFlags", "(", ")", ";", "if", "(", "(", "flags", "&", "IResourceDelta", ".", "MOVED_TO", ")", "!=", "0", ")", "{", "continue", ";", "}", "HashMap", "<", "String", ",", "String", ">", "result", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "IResource", "resource", "=", "delta", ".", "getResource", "(", ")", ";", "String", "file", "=", "resource", ".", "getLocation", "(", ")", ".", "toOSString", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "if", "(", "(", "flags", "&", "IResourceDelta", ".", "MOVED_FROM", ")", "!=", "0", ")", "{", "String", "path", "=", "ProjectUtils", ".", "getFilePath", "(", "resource", ".", "getProject", "(", ")", ",", "delta", ".", "getMovedFromPath", "(", ")", ".", "toOSString", "(", ")", ")", ";", "result", ".", "put", "(", "\"from\"", ",", "path", ")", ";", "result", ".", "put", "(", "\"to\"", ",", "file", ")", ";", "}", "else", "if", "(", "resource", ".", "getLocation", "(", ")", ".", "getFileExtension", "(", ")", "!=", "null", ")", "{", "if", "(", "!", "seen", ".", "contains", "(", "file", ")", ")", "{", "result", ".", "put", "(", "\"file\"", ",", "file", ")", ";", "seen", ".", "add", "(", "file", ")", ";", "}", "}", "if", "(", "result", ".", "size", "(", ")", ">", "0", ")", "{", "results", ".", "add", "(", "result", ")", ";", "}", "}", "return", "results", ";", "}", "}", "</s>" ]
1,555
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "refactoring", ";", "import", "org", ".", "eclipse", ".", "ltk", ".", "core", ".", "refactoring", ".", "RefactoringStatus", ";", "public", "class", "RefactorException", "extends", "RuntimeException", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "private", "RefactoringStatus", "status", ";", "public", "RefactorException", "(", ")", "{", "super", "(", ")", ";", "}", "public", "RefactorException", "(", "String", "message", ")", "{", "super", "(", "message", ")", ";", "}", "public", "RefactorException", "(", "RefactoringStatus", "status", ")", "{", "super", "(", ")", ";", "this", ".", "status", "=", "status", ";", "}", "public", "RefactoringStatus", "getStatus", "(", ")", "{", "return", "status", ";", "}", "}", "</s>" ]
1,556
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "archive", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "OutputStream", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "SystemUtils", ";", "import", "org", ".", "apache", ".", "commons", ".", "vfs", ".", "FileObject", ";", "import", "org", ".", "apache", ".", "commons", ".", "vfs", ".", "FileSystemManager", ";", "import", "org", ".", "apache", ".", "commons", ".", "vfs", ".", "VFS", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "util", ".", "IOUtils", ";", "@", "Command", "(", "name", "=", "\"archive_read\"", ",", "options", "=", "\"\"", ")", "public", "class", "ArchiveReadCommand", "extends", "AbstractCommand", "{", "private", "static", "final", "String", "URI_PREFIX", "=", "\"file://\"", ";", "private", "static", "final", "Pattern", "WIN_PATH", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "public", "String", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "InputStream", "in", "=", "null", ";", "OutputStream", "out", "=", "null", ";", "FileSystemManager", "fsManager", "=", "null", ";", "try", "{", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "fsManager", "=", "VFS", ".", "getManager", "(", ")", ";", "FileObject", "fileObject", "=", "fsManager", ".", "resolveFile", "(", "file", ")", ";", "FileObject", "tempFile", "=", "fsManager", ".", "resolveFile", "(", "SystemUtils", ".", "JAVA_IO_TMPDIR", "+", "\"/eclim/\"", "+", "fileObject", ".", "getName", "(", ")", ".", "getPath", "(", ")", ")", ";", "fsManager", ".", "getFilesCache", "(", ")", ".", "clear", "(", "fileObject", ".", "getFileSystem", "(", ")", ")", ";", "fsManager", ".", "getFilesCache", "(", ")", ".", "clear", "(", "tempFile", ".", "getFileSystem", "(", ")", ")", ";", "String", "path", "=", "tempFile", ".", "getName", "(", ")", ".", "getURI", "(", ")", ".", "substring", "(", "URI_PREFIX", ".", "length", "(", ")", ")", ";", "if", "(", "WIN_PATH", ".", "matcher", "(", "path", ")", ".", "matches", "(", ")", ")", "{", "path", "=", "path", ".", "substring", "(", "1", ")", ";", "}", "tempFile", ".", "createFile", "(", ")", ";", "in", "=", "fileObject", ".", "getContent", "(", ")", ".", "getInputStream", "(", ")", ";", "out", "=", "tempFile", ".", "getContent", "(", ")", ".", "getOutputStream", "(", ")", ";", "IOUtils", ".", "copy", "(", "in", ",", "out", ")", ";", "new", "File", "(", "path", ")", ".", "deleteOnExit", "(", ")", ";", "return", "path", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "in", ")", ";", "IOUtils", ".", "closeQuietly", "(", "out", ")", ";", "}", "}", "}", "</s>" ]
1,557
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "problems", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Field", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "text", ".", "Collator", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "Comparator", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "CorePlugin", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "CollectionUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "file", ".", "FileUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "internal", ".", "resources", ".", "ResourceException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IMarker", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "ui", ".", "IPageLayout", ";", "import", "org", ".", "eclipse", ".", "ui", ".", "internal", ".", "views", ".", "markers", ".", "CachedMarkerBuilder", ";", "import", "org", ".", "eclipse", ".", "ui", ".", "internal", ".", "views", ".", "markers", ".", "ExtendedMarkersView", ";", "import", "org", ".", "eclipse", ".", "ui", ".", "internal", ".", "views", ".", "markers", ".", "MarkerContentGenerator", ";", "import", "org", ".", "eclipse", ".", "ui", ".", "views", ".", "markers", ".", "internal", ".", "ContentGeneratorDescriptor", ";", "import", "org", ".", "eclipse", ".", "ui", ".", "views", ".", "markers", ".", "internal", ".", "MarkerSupportRegistry", ";", "@", "Command", "(", "name", "=", "\"problems\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "ProblemsCommand", "extends", "AbstractCommand", "{", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "waitOnBuild", "(", ")", ";", "String", "name", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "boolean", "errorsOnly", "=", "commandLine", ".", "hasOption", "(", "Options", ".", "ERRORS_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "name", ")", ";", "ContentGeneratorDescriptor", "descriptor", "=", "MarkerSupportRegistry", ".", "getInstance", "(", ")", ".", "getDefaultContentGenDescriptor", "(", ")", ";", "ExtendedMarkersView", "view", "=", "new", "ExtendedMarkersView", "(", "descriptor", ".", "getId", "(", ")", ")", ";", "String", "viewId", "=", "IPageLayout", ".", "ID_PROBLEM_VIEW", ";", "MarkerContentGenerator", "generator", "=", "new", "MarkerContentGenerator", "(", "descriptor", ",", "new", "CachedMarkerBuilder", "(", "view", ")", ",", "viewId", ")", ";", "Field", "enabledFilters", "=", "MarkerContentGenerator", ".", "class", ".", "getDeclaredField", "(", "\"\"", ")", ";", "enabledFilters", ".", "setAccessible", "(", "true", ")", ";", "enabledFilters", ".", "set", "(", "generator", ",", "new", "HashSet", "(", ")", ")", ";", "Method", "gatherMarkers", "=", "MarkerContentGenerator", ".", "class", ".", "getDeclaredMethod", "(", "\"\"", ",", "String", "[", "]", ".", "class", ",", "Boolean", ".", "TYPE", ",", "Collection", ".", "class", ",", "IProgressMonitor", ".", "class", ")", ";", "gatherMarkers", ".", "setAccessible", "(", "true", ")", ";", "ArrayList", "markers", "=", "new", "ArrayList", "(", ")", ";", "gatherMarkers", ".", "invoke", "(", "generator", ",", "generator", ".", "getTypes", "(", ")", ",", "true", ",", "markers", ",", "new", "NullProgressMonitor", "(", ")", ")", ";", "ArrayList", "<", "Error", ">", "problems", "=", "new", "ArrayList", "<", "Error", ">", "(", ")", ";", "if", "(", "markers", ".", "size", "(", ")", "==", "0", ")", "{", "return", "problems", ";", "}", "ArrayList", "<", "IProject", ">", "projects", "=", "new", "ArrayList", "<", "IProject", ">", "(", ")", ";", "projects", ".", "add", "(", "project", ")", ";", "CollectionUtils", ".", "addAll", "(", "projects", ",", "project", ".", "getReferencedProjects", "(", ")", ")", ";", "CollectionUtils", ".", "addAll", "(", "projects", ",", "project", ".", "getReferencingProjects", "(", ")", ")", ";", "Method", "getMarker", "=", "null", ";", "for", "(", "Object", "markerEntry", ":", "markers", ")", "{", "if", "(", "getMarker", "==", "null", ")", "{", "getMarker", "=", "markerEntry", ".", "getClass", "(", ")", ".", "getDeclaredMethod", "(", "\"getMarker\"", ")", ";", "getMarker", ".", "setAccessible", "(", "true", ")", ";", "}", "try", "{", "IMarker", "marker", "=", "(", "IMarker", ")", "getMarker", ".", "invoke", "(", "markerEntry", ")", ";", "Map", "<", "String", ",", "Object", ">", "attributes", "=", "marker", ".", "getAttributes", "(", ")", ";", "int", "severity", "=", "attributes", ".", "containsKey", "(", "\"severity\"", ")", "?", "(", "(", "Integer", ")", "attributes", ".", "get", "(", "\"severity\"", ")", ")", ".", "intValue", "(", ")", ":", "IMarker", ".", "SEVERITY_WARNING", ";", "if", "(", "errorsOnly", "&&", "severity", "!=", "IMarker", ".", "SEVERITY_ERROR", ")", "{", "continue", ";", "}", "IResource", "resource", "=", "marker", ".", "getResource", "(", ")", ";", "if", "(", "resource", "==", "null", "||", "resource", ".", "getRawLocation", "(", ")", "==", "null", ")", "{", "continue", ";", "}", "if", "(", "!", "projects", ".", "contains", "(", "resource", ".", "getProject", "(", ")", ")", ")", "{", "continue", ";", "}", "int", "offset", "=", "attributes", ".", "containsKey", "(", "\"charStart\"", ")", "?", "(", "(", "Integer", ")", "attributes", ".", "get", "(", "\"charStart\"", ")", ")", ".", "intValue", "(", ")", ":", "1", ";", "int", "line", "=", "attributes", ".", "containsKey", "(", "\"lineNumber\"", ")", "?", "(", "(", "Integer", ")", "attributes", ".", "get", "(", "\"lineNumber\"", ")", ")", ".", "intValue", "(", ")", ":", "1", ";", "int", "[", "]", "pos", "=", "{", "1", ",", "1", "}", ";", "String", "message", "=", "(", "String", ")", "attributes", ".", "get", "(", "\"message\"", ")", ";", "String", "path", "=", "resource", ".", "getLocation", "(", ")", ".", "toOSString", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "File", "file", "=", "new", "File", "(", "path", ")", ";", "if", "(", "file", ".", "isFile", "(", ")", "&&", "file", ".", "exists", "(", ")", "&&", "offset", ">", "0", ")", "{", "pos", "=", "FileUtils", ".", "offsetToLineColumn", "(", "path", ",", "offset", ")", ";", "}", "problems", ".", "add", "(", "new", "Error", "(", "message", ",", "path", ",", "Math", ".", "max", "(", "pos", "[", "0", "]", ",", "line", ")", ",", "pos", "[", "1", "]", ",", "severity", "!=", "IMarker", ".", "SEVERITY_ERROR", ")", ")", ";", "}", "catch", "(", "ResourceException", "ignore", ")", "{", "}", "}", "Collections", ".", "sort", "(", "problems", ",", "new", "ProblemComparator", "(", "project", ")", ")", ";", "return", "problems", ";", "}", "private", "void", "waitOnBuild", "(", ")", "{", "CorePlugin", "plugin", "=", "CorePlugin", ".", "getDefault", "(", ")", ";", "int", "tries", "=", "0", ";", "while", "(", "tries", "<", "30", "&&", "plugin", ".", "isBuildRunning", "(", ")", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "100", ")", ";", "}", "catch", "(", "Exception", "ignore", ")", "{", "}", "tries", "++", ";", "}", "}", "private", "static", "class", "ProblemComparator", "implements", "Comparator", "<", "Error", ">", "{", "private", "Pattern", "projectPattern", ";", "private", "Collator", "collator", "=", "Collator", ".", "getInstance", "(", ")", ";", "public", "ProblemComparator", "(", "IProject", "project", ")", "throws", "Exception", "{", "this", ".", "projectPattern", "=", "Pattern", ".", "compile", "(", "\"^\\\\Q\"", "+", "ProjectUtils", ".", "getPath", "(", "project", ")", "+", "\"\\\\E\\\\b.*\"", ")", ";", "}", "public", "int", "compare", "(", "Error", "e1", ",", "Error", "e2", ")", "{", "String", "ef1", "=", "e1", ".", "getFilename", "(", ")", ";", "boolean", "e1InProject", "=", "projectPattern", ".", "matcher", "(", "ef1", ")", ".", "matches", "(", ")", ";", "String", "ef2", "=", "e2", ".", "getFilename", "(", ")", ";", "boolean", "e2InProject", "=", "projectPattern", ".", "matcher", "(", "ef2", ")", ".", "matches", "(", ")", ";", "if", "(", "e1InProject", "&&", "!", "e2InProject", ")", "{", "return", "-", "1", ";", "}", "if", "(", "e2InProject", "&&", "!", "e1InProject", ")", "{", "return", "1", ";", "}", "int", "result", "=", "collator", ".", "compare", "(", "ef1", ",", "ef2", ")", ";", "if", "(", "result", "==", "0", ")", "{", "result", "=", "e1", ".", "getLine", "(", ")", "-", "e2", ".", "getLine", "(", ")", ";", "}", "if", "(", "result", "==", "0", ")", "{", "result", "=", "e1", ".", "getColumn", "(", ")", "-", "e2", ".", "getColumn", "(", ")", ";", "}", "return", "result", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "return", "super", ".", "equals", "(", "obj", ")", ";", "}", "}", "}", "</s>" ]
1,558
[ "<s>", "package", "org", ".", "eclim", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "taskdefs", ".", "condition", ".", "Os", ";", "import", "org", ".", "eclim", ".", "util", ".", "CommandExecutor", ";", "import", "org", ".", "eclim", ".", "util", ".", "IOUtils", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNotNull", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonElement", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonParser", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonPrimitive", ";", "import", "com", ".", "google", ".", "gson", ".", "JsonSyntaxException", ";", "public", "class", "Eclim", "{", "public", "static", "final", "String", "TEST_PROJECT", "=", "\"\"", ";", "private", "static", "final", "String", "ECLIM", "=", "System", ".", "getProperty", "(", "\"eclipse.home\"", ")", "+", "\"/eclim\"", ";", "private", "static", "final", "String", "PORT", "=", "System", ".", "getProperty", "(", "\"eclimd.port\"", ")", ";", "private", "static", "final", "String", "PRETTY", "=", "\"-pretty\"", ";", "private", "static", "final", "String", "COMMAND", "=", "\"-command\"", ";", "private", "static", "final", "JsonParser", "JSON_PARSER", "=", "new", "JsonParser", "(", ")", ";", "private", "static", "String", "workspace", ";", "public", "static", "Object", "execute", "(", "String", "[", "]", "args", ")", "{", "return", "execute", "(", "args", ",", "-", "1", ",", "true", ")", ";", "}", "public", "static", "Object", "execute", "(", "String", "[", "]", "args", ",", "boolean", "failOnError", ")", "{", "return", "execute", "(", "args", ",", "-", "1", ",", "failOnError", ")", ";", "}", "public", "static", "Object", "execute", "(", "String", "[", "]", "args", ",", "long", "timeout", ")", "{", "return", "execute", "(", "args", ",", "timeout", ",", "true", ")", ";", "}", "public", "static", "Object", "execute", "(", "String", "[", "]", "args", ",", "long", "timeout", ",", "boolean", "failOnError", ")", "{", "assertNotNull", "(", "\"\"", ",", "PORT", ")", ";", "assertNotNull", "(", "\"\"", ",", "ECLIM", ")", ";", "String", "[", "]", "arguments", "=", "null", ";", "if", "(", "Os", ".", "isFamily", "(", "Os", ".", "FAMILY_WINDOWS", ")", ")", "{", "String", "eclimCmd", "=", "ECLIM", "+", "\".cmd\"", ";", "String", "drive", "=", "eclimCmd", ".", "substring", "(", "0", ",", "2", ")", ";", "arguments", "=", "new", "String", "[", "3", "]", ";", "arguments", "[", "0", "]", "=", "\"cmd.exe\"", ";", "arguments", "[", "1", "]", "=", "\"/c\"", ";", "arguments", "[", "2", "]", "=", "drive", "+", "\"", "&&", "\\\"\"", "+", "eclimCmd", "+", "\"\"", "+", "PORT", "+", "\"", "\"", "+", "PRETTY", "+", "\"", "\"", "+", "COMMAND", "+", "\"", "\\\"\"", "+", "StringUtils", ".", "join", "(", "args", ",", "\"\\\"", "\\\"\"", ")", "+", "\"\\\"\"", ";", "}", "else", "{", "arguments", "=", "new", "String", "[", "args", ".", "length", "+", "5", "]", ";", "System", ".", "arraycopy", "(", "args", ",", "0", ",", "arguments", ",", "5", ",", "args", ".", "length", ")", ";", "arguments", "[", "0", "]", "=", "ECLIM", ";", "arguments", "[", "1", "]", "=", "\"\"", ";", "arguments", "[", "2", "]", "=", "PORT", ";", "arguments", "[", "3", "]", "=", "PRETTY", ";", "arguments", "[", "4", "]", "=", "COMMAND", ";", "}", "System", ".", "out", ".", "println", "(", "\"Command:", "\"", "+", "StringUtils", ".", "join", "(", "arguments", ",", "'", "'", ")", ")", ";", "CommandExecutor", "process", "=", "null", ";", "try", "{", "process", "=", "CommandExecutor", ".", "execute", "(", "arguments", ",", "timeout", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "if", "(", "process", ".", "getReturnCode", "(", ")", "==", "-", "1", ")", "{", "process", ".", "destroy", "(", ")", ";", "throw", "new", "RuntimeException", "(", "\"\"", ")", ";", "}", "String", "result", "=", "process", ".", "getResult", "(", ")", ".", "trim", "(", ")", ";", "String", "error", "=", "process", ".", "getErrorMessage", "(", ")", ";", "if", "(", "process", ".", "getReturnCode", "(", ")", "!=", "0", ")", "{", "if", "(", "!", "failOnError", ")", "{", "System", ".", "out", ".", "println", "(", "\"Result:", "\"", "+", "result", ")", ";", "if", "(", "!", "StringUtils", ".", "EMPTY", ".", "equals", "(", "error", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Error:", "\"", "+", "error", ")", ";", "}", "return", "result", ";", "}", "System", ".", "out", ".", "println", "(", "\"OUT:", "\"", "+", "result", ")", ";", "System", ".", "out", ".", "println", "(", "\"ERR:", "\"", "+", "error", ")", ";", "throw", "new", "RuntimeException", "(", "\"\"", "+", "process", ".", "getReturnCode", "(", ")", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"Result:", "\"", "+", "result", ")", ";", "if", "(", "!", "StringUtils", ".", "EMPTY", ".", "equals", "(", "error", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Error:", "\"", "+", "error", ")", ";", "}", "if", "(", "result", ".", "equals", "(", "StringUtils", ".", "EMPTY", ")", ")", "{", "result", "=", "\"\\\"\\\"\"", ";", "}", "try", "{", "return", "toType", "(", "JSON_PARSER", ".", "parse", "(", "result", ")", ")", ";", "}", "catch", "(", "JsonSyntaxException", "jse", ")", "{", "if", "(", "!", "failOnError", ")", "{", "return", "result", ";", "}", "throw", "jse", ";", "}", "}", "public", "static", "Object", "toType", "(", "JsonElement", "json", ")", "{", "if", "(", "json", ".", "isJsonNull", "(", ")", ")", "{", "return", "null", ";", "}", "else", "if", "(", "json", ".", "isJsonPrimitive", "(", ")", ")", "{", "JsonPrimitive", "prim", "=", "json", ".", "getAsJsonPrimitive", "(", ")", ";", "if", "(", "prim", ".", "isBoolean", "(", ")", ")", "{", "return", "prim", ".", "getAsBoolean", "(", ")", ";", "}", "else", "if", "(", "prim", ".", "isString", "(", ")", ")", "{", "return", "prim", ".", "getAsString", "(", ")", ";", "}", "else", "if", "(", "prim", ".", "isNumber", "(", ")", ")", "{", "if", "(", "prim", ".", "getAsString", "(", ")", ".", "indexOf", "(", "'.'", ")", "!=", "-", "1", ")", "{", "return", "prim", ".", "getAsDouble", "(", ")", ";", "}", "return", "prim", ".", "getAsInt", "(", ")", ";", "}", "}", "else", "if", "(", "json", ".", "isJsonArray", "(", ")", ")", "{", "ArrayList", "<", "Object", ">", "type", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "for", "(", "JsonElement", "element", ":", "json", ".", "getAsJsonArray", "(", ")", ")", "{", "type", ".", "add", "(", "toType", "(", "element", ")", ")", ";", "}", "return", "type", ";", "}", "else", "if", "(", "json", ".", "isJsonObject", "(", ")", ")", "{", "HashMap", "<", "String", ",", "Object", ">", "type", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "JsonElement", ">", "entry", ":", "json", ".", "getAsJsonObject", "(", ")", ".", "entrySet", "(", ")", ")", "{", "type", ".", "put", "(", "entry", ".", "getKey", "(", ")", ",", "toType", "(", "entry", ".", "getValue", "(", ")", ")", ")", ";", "}", "return", "type", ";", "}", "return", "null", ";", "}", "public", "static", "String", "getWorkspace", "(", ")", "{", "if", "(", "workspace", "==", "null", ")", "{", "workspace", "=", "(", "(", "String", ")", "execute", "(", "new", "String", "[", "]", "{", "\"\"", "}", ")", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "}", "return", "workspace", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "String", "getProjectPath", "(", "String", "name", ")", "{", "Object", "result", "=", "execute", "(", "new", "String", "[", "]", "{", "\"project_info\"", ",", "\"-p\"", ",", "name", "}", ")", ";", "if", "(", "result", "instanceof", "Map", ")", "{", "Map", "<", "String", ",", "String", ">", "info", "=", "(", "Map", "<", "String", ",", "String", ">", ")", "result", ";", "if", "(", "info", ".", "containsKey", "(", "\"path\"", ")", ")", "{", "return", "info", ".", "get", "(", "\"path\"", ")", ";", "}", "}", "return", "null", ";", "}", "public", "static", "boolean", "projectExists", "(", "String", "name", ")", "{", "return", "getProjectPath", "(", "name", ")", "!=", "null", ";", "}", "public", "static", "String", "getProjectSetting", "(", "String", "project", ",", "String", "name", ")", "{", "return", "(", "String", ")", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "project", ",", "\"-s\"", ",", "name", ",", "}", ")", ";", "}", "public", "static", "void", "setProjectSetting", "(", "String", "project", ",", "String", "name", ",", "String", "value", ")", "{", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "project", ",", "\"-s\"", ",", "name", ",", "\"-v\"", ",", "value", ",", "}", ")", ";", "}", "public", "static", "String", "resolveFile", "(", "String", "file", ")", "{", "return", "resolveFile", "(", "TEST_PROJECT", ",", "file", ")", ";", "}", "public", "static", "String", "resolveFile", "(", "String", "project", ",", "String", "file", ")", "{", "return", "new", "StringBuffer", "(", ")", ".", "append", "(", "getProjectPath", "(", "project", ")", ")", ".", "append", "(", "'/'", ")", ".", "append", "(", "file", ")", ".", "toString", "(", ")", ";", "}", "public", "static", "String", "fileToString", "(", "String", "project", ",", "String", "file", ")", "{", "String", "path", "=", "resolveFile", "(", "project", ",", "file", ")", ";", "FileInputStream", "fin", "=", "null", ";", "try", "{", "fin", "=", "new", "FileInputStream", "(", "path", ")", ";", "return", "IOUtils", ".", "toString", "(", "fin", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "fin", ")", ";", "}", "}", "public", "static", "void", "deleteDirectory", "(", "File", "dir", ")", "{", "if", "(", "!", "dir", ".", "exists", "(", ")", ")", "{", "return", ";", "}", "for", "(", "File", "f", ":", "dir", ".", "listFiles", "(", ")", ")", "{", "if", "(", "f", ".", "isDirectory", "(", ")", ")", "{", "deleteDirectory", "(", "f", ")", ";", "}", "else", "{", "f", ".", "delete", "(", ")", ";", "}", "}", "dir", ".", "delete", "(", ")", ";", "}", "}", "</s>" ]
1,559
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "xml", ".", "validate", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "ValidateCommandTest", "{", "private", "static", "final", "String", "TEST_FILE", "=", "\"\"", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "execute", "(", ")", "{", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"xml_validate\"", ",", "\"-p\"", ",", "Eclim", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "2", ",", "results", ".", "size", "(", ")", ")", ";", "String", "file", "=", "Eclim", ".", "resolveFile", "(", "Eclim", ".", "TEST_PROJECT", ",", "TEST_FILE", ")", ";", "Map", "<", "String", ",", "Object", ">", "error", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertTrue", "(", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ".", "indexOf", "(", "\"\"", ")", "!=", "-", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "12", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "11", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "false", ")", ";", "error", "=", "results", ".", "get", "(", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertTrue", "(", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ".", "indexOf", "(", "\"\"", ")", "!=", "-", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "13", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "9", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "false", ")", ";", "}", "}", "</s>" ]
1,560
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "xml", ".", "format", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "FormatCommandTest", "{", "private", "static", "final", "String", "TEST_FILE", "=", "\"\"", ";", "@", "Test", "public", "void", "execute", "(", ")", "{", "String", "result", "=", "(", "String", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"xml_format\"", ",", "\"-f\"", ",", "Eclim", ".", "resolveFile", "(", "TEST_FILE", ")", ",", "\"-w\"", ",", "\"80\"", ",", "\"-i\"", ",", "\"2\"", ",", "\"-m\"", ",", "\"unix\"", "}", ")", ";", "String", "[", "]", "lines", "=", "StringUtils", ".", "split", "(", "result", ",", "'\\n'", ")", ";", "assertEquals", "(", "\"\"", ",", "5", ",", "lines", ".", "length", ")", ";", "assertEquals", "(", "\"\"", ",", "lines", "[", "1", "]", ")", ";", "assertEquals", "(", "\"\"", ",", "lines", "[", "2", "]", ")", ";", "assertEquals", "(", "\"", "<two/>\"", ",", "lines", "[", "3", "]", ")", ";", "assertEquals", "(", "\"</blah>\"", ",", "lines", "[", "4", "]", ")", ";", "}", "}", "</s>" ]
1,561
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "admin", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "SettingsCommandTest", "{", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "execute", "(", ")", "throws", "Exception", "{", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "String", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"settings\"", "}", ")", ";", "HashMap", "<", "String", ",", "String", ">", "properties", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "Map", "<", "String", ",", "String", ">", "result", ":", "results", ")", "{", "properties", ".", "put", "(", "result", ".", "get", "(", "\"name\"", ")", ",", "result", ".", "get", "(", "\"value\"", ")", ")", ";", "}", "assertTrue", "(", "\"\"", ",", "properties", ".", "containsKey", "(", "\"\"", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "properties", ".", "containsKey", "(", "\"\"", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "properties", ".", "containsKey", "(", "\"\"", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "properties", ".", "containsKey", "(", "\"\"", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "properties", ".", "containsKey", "(", "\"\"", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "properties", ".", "containsKey", "(", "\"\"", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "properties", ".", "containsKey", "(", "\"\"", ")", ")", ";", "}", "}", "</s>" ]
1,562
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "admin", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "PingCommandTest", "{", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "execute", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "result", "=", "(", "Map", "<", "String", ",", "String", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"ping\"", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "System", ".", "getProperty", "(", "\"\"", ")", ",", "result", ".", "get", "(", "\"eclim\"", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "result", ".", "get", "(", "\"eclipse\"", ")", ".", "startsWith", "(", "\"4.\"", ")", ")", ";", "}", "}", "</s>" ]
1,563
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "project", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "ProjectCommandsTest", "{", "private", "static", "final", "String", "TEST_PROJECT", "=", "\"\"", ";", "private", "static", "final", "String", "TEST_PROJECT_IMPORT", "=", "\"\"", ";", "@", "Test", "public", "void", "createProject", "(", ")", "{", "if", "(", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", "{", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "TEST_PROJECT", "}", ")", ";", "}", "assertFalse", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-f\"", ",", "Eclim", ".", "getWorkspace", "(", ")", "+", "\"/\"", "+", "TEST_PROJECT", ",", "\"-n\"", ",", "\"java\"", "}", ")", ";", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "}", "@", "Test", "public", "void", "closeProject", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "TEST_PROJECT", "}", ")", ";", "assertFalse", "(", "\"\"", ",", "projectOpen", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "openProject", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"project_open\"", ",", "\"-p\"", ",", "TEST_PROJECT", "}", ")", ";", "assertTrue", "(", "\"\"", ",", "projectOpen", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "renameProject", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "String", "renamed", "=", "TEST_PROJECT", "+", "\"_renamed\"", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "TEST_PROJECT", ",", "\"-n\"", ",", "renamed", "}", ")", ";", "assertFalse", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "renamed", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "renamed", ",", "\"-n\"", ",", "TEST_PROJECT", "}", ")", ";", "assertFalse", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "renamed", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "}", "@", "Test", "public", "void", "moveProject", "(", ")", "throws", "Exception", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "String", "path", "=", "new", "File", "(", "Eclim", ".", "getWorkspace", "(", ")", "+", "\"/../\"", ")", ".", "getCanonicalPath", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"project_move\"", ",", "\"-p\"", ",", "TEST_PROJECT", ",", "\"-d\"", ",", "path", "}", ")", ";", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "path", "+", "'/'", "+", "TEST_PROJECT", ",", "Eclim", ".", "getProjectPath", "(", "TEST_PROJECT", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"project_move\"", ",", "\"-p\"", ",", "TEST_PROJECT", ",", "\"-d\"", ",", "Eclim", ".", "getWorkspace", "(", ")", "}", ")", ";", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "path", "=", "new", "File", "(", "Eclim", ".", "getWorkspace", "(", ")", "+", "'/'", "+", "TEST_PROJECT", ")", ".", "getCanonicalPath", "(", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "assertEquals", "(", "\"\"", ",", "path", ",", "Eclim", ".", "getProjectPath", "(", "TEST_PROJECT", ")", ")", ";", "}", "@", "Test", "public", "void", "deleteProject", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "TEST_PROJECT", "}", ")", ";", "assertFalse", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT", ")", ")", ";", "File", "dir", "=", "new", "File", "(", "Eclim", ".", "getWorkspace", "(", ")", "+", "\"/\"", "+", "TEST_PROJECT", ")", ";", "for", "(", "File", "f", ":", "dir", ".", "listFiles", "(", ")", ")", "{", "f", ".", "delete", "(", ")", ";", "}", "dir", ".", "delete", "(", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "importProject", "(", ")", "{", "if", "(", "Eclim", ".", "projectExists", "(", "TEST_PROJECT_IMPORT", ")", ")", "{", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "TEST_PROJECT_IMPORT", "}", ")", ";", "}", "assertFalse", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT_IMPORT", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-f\"", ",", "Eclim", ".", "getWorkspace", "(", ")", "+", "\"/\"", "+", "TEST_PROJECT_IMPORT", ",", "\"-n\"", ",", "\"java\"", "}", ")", ";", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT_IMPORT", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "TEST_PROJECT_IMPORT", "}", ")", ";", "assertFalse", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT_IMPORT", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-f\"", ",", "Eclim", ".", "getWorkspace", "(", ")", "+", "\"/\"", "+", "TEST_PROJECT_IMPORT", ",", "}", ")", ";", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "TEST_PROJECT_IMPORT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "TEST_PROJECT_IMPORT", ",", "}", ")", ";", "assertEquals", "(", "1", ",", "results", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "(", "(", "List", ")", "results", ".", "get", "(", "0", ")", ".", "get", "(", "\"natures\"", ")", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"java\"", ",", "(", "(", "List", ")", "results", ".", "get", "(", "0", ")", ".", "get", "(", "\"natures\"", ")", ")", ".", "get", "(", "0", ")", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "TEST_PROJECT_IMPORT", "}", ")", ";", "File", "dir", "=", "new", "File", "(", "Eclim", ".", "getWorkspace", "(", ")", "+", "\"/\"", "+", "TEST_PROJECT_IMPORT", ")", ";", "for", "(", "File", "f", ":", "dir", ".", "listFiles", "(", ")", ")", "{", "f", ".", "delete", "(", ")", ";", "}", "dir", ".", "delete", "(", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "boolean", "projectOpen", "(", ")", "{", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "projects", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"project_list\"", "}", ")", ";", "for", "(", "Map", "<", "String", ",", "Object", ">", "project", ":", "projects", ")", "{", "if", "(", "project", ".", "get", "(", "\"name\"", ")", ".", "equals", "(", "TEST_PROJECT", ")", "&&", "project", ".", "get", "(", "\"open\"", ")", ".", "equals", "(", "Boolean", ".", "TRUE", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "}", "</s>" ]
1,564
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "history", ";", "import", "java", ".", "io", ".", "BufferedWriter", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "OutputStreamWriter", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "HistoryCommandTest", "{", "private", "static", "final", "String", "TEST_FILE", "=", "\"\"", ";", "private", "static", "final", "Pattern", "ENTRY_TIMESTAMP", "=", "Pattern", ".", "compile", "(", "\"\\\\d+\"", ")", ";", "private", "static", "final", "Pattern", "ENTRY_DATETIME", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "private", "static", "final", "Pattern", "ENTRY_DELTA", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "execute", "(", ")", "throws", "Exception", "{", "String", "result", "=", "(", "String", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "Eclim", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "assertEquals", "(", "result", ",", "\"\"", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"history_list\"", ",", "\"-p\"", ",", "Eclim", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "assertEquals", "(", "0", ",", "results", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "Eclim", ".", "fileToString", "(", "Eclim", ".", "TEST_PROJECT", ",", "TEST_FILE", ")", ",", "\"line", "1n\"", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"history_add\"", ",", "\"-p\"", ",", "Eclim", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "Eclim", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "BufferedWriter", "out", "=", "null", ";", "try", "{", "out", "=", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "new", "FileOutputStream", "(", "Eclim", ".", "resolveFile", "(", "TEST_FILE", ")", ",", "true", ")", ")", ")", ";", "out", ".", "write", "(", "\"line", "2\"", ")", ";", "}", "finally", "{", "try", "{", "out", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "ignore", ")", "{", "}", "}", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"history_add\"", ",", "\"-p\"", ",", "Eclim", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "Eclim", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"history_list\"", ",", "\"-p\"", ",", "Eclim", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "assertEquals", "(", "2", ",", "results", ".", "size", "(", ")", ")", ";", "for", "(", "Map", "<", "String", ",", "Object", ">", "entry", ":", "results", ")", "{", "assertTrue", "(", "ENTRY_TIMESTAMP", ".", "matcher", "(", "entry", ".", "get", "(", "\"timestamp\"", ")", ".", "toString", "(", ")", ")", ".", "matches", "(", ")", ")", ";", "assertTrue", "(", "ENTRY_DATETIME", ".", "matcher", "(", "entry", ".", "get", "(", "\"datetime\"", ")", ".", "toString", "(", ")", ")", ".", "matches", "(", ")", ")", ";", "assertTrue", "(", "ENTRY_DELTA", ".", "matcher", "(", "entry", ".", "get", "(", "\"delta\"", ")", ".", "toString", "(", ")", ")", ".", "matches", "(", ")", ")", ";", "}", "result", "=", "(", "String", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "Eclim", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", ",", "\"-r\"", ",", "results", ".", "get", "(", "1", ")", ".", "get", "(", "\"timestamp\"", ")", ".", "toString", "(", ")", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ",", "\"line", "1n\"", ")", ";", "}", "}", "</s>" ]
1,565
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "problems", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "ProblemsCommandTest", "{", "private", "static", "final", "String", "TEST_PROJECT", "=", "\"\"", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "execute", "(", ")", "{", "List", "<", "Object", ">", "results", "=", "(", "List", "<", "Object", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"problems\"", ",", "\"-p\"", ",", "TEST_PROJECT", "}", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "error", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "error", ".", "put", "(", "\"message\"", ",", "\"\"", ")", ";", "error", ".", "put", "(", "\"filename\"", ",", "Eclim", ".", "getWorkspace", "(", ")", "+", "\"/\"", "+", "TEST_PROJECT", "+", "\"\"", ")", ";", "error", ".", "put", "(", "\"line\"", ",", "5", ")", ";", "error", ".", "put", "(", "\"column\"", ",", "11", ")", ";", "error", ".", "put", "(", "\"endLine\"", ",", "-", "1", ")", ";", "error", ".", "put", "(", "\"endColumn\"", ",", "-", "1", ")", ";", "error", ".", "put", "(", "\"warning\"", ",", "false", ")", ";", "assertTrue", "(", "results", ".", "contains", "(", "error", ")", ")", ";", "}", "}", "</s>" ]
1,566
[ "<s>", "package", "org", ".", "eclim", ".", "test", ";", "public", "class", "Test", "{", "private", "ArrayList", "list", "=", "new", "ArrayList", "(", ")", ";", "}", "</s>" ]
1,567
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "complete", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "Wst", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "CssCodeCompleteCommandTest", "{", "private", "static", "final", "String", "TEST_FILE", "=", "\"\"", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "complete", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"css_complete\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", ",", "\"-o\"", ",", "\"52\"", ",", "\"-e\"", ",", "\"utf-8\"", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "8", ",", "results", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "results", ".", "get", "(", "0", ")", ".", "get", "(", "\"completion\"", ")", ",", "\"font\"", ")", ";", "assertEquals", "(", "results", ".", "get", "(", "1", ")", ".", "get", "(", "\"completion\"", ")", ",", "\"font-family\"", ")", ";", "assertEquals", "(", "results", ".", "get", "(", "2", ")", ".", "get", "(", "\"completion\"", ")", ",", "\"font-size\"", ")", ";", "assertEquals", "(", "results", ".", "get", "(", "3", ")", ".", "get", "(", "\"completion\"", ")", ",", "\"\"", ")", ";", "assertEquals", "(", "results", ".", "get", "(", "4", ")", ".", "get", "(", "\"completion\"", ")", ",", "\"font-stretch\"", ")", ";", "assertEquals", "(", "results", ".", "get", "(", "5", ")", ".", "get", "(", "\"completion\"", ")", ",", "\"font-style\"", ")", ";", "assertEquals", "(", "results", ".", "get", "(", "6", ")", ".", "get", "(", "\"completion\"", ")", ",", "\"font-variant\"", ")", ";", "assertEquals", "(", "results", ".", "get", "(", "7", ")", ".", "get", "(", "\"completion\"", ")", ",", "\"font-weight\"", ")", ";", "}", "}", "</s>" ]
1,568
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "complete", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "Wst", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "XmlCodeCompleteCommandTest", "{", "private", "static", "final", "String", "TEST_FILE_XSD", "=", "\"xsd/test.xsd\"", ";", "private", "static", "final", "String", "TEST_FILE_WSDL", "=", "\"\"", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "completeXsd", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"xml_complete\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE_XSD", ",", "\"-o\"", ",", "\"584\"", ",", "\"-e\"", ",", "\"utf-8\"", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "1", ",", "results", ".", "size", "(", ")", ")", ";", "Map", "<", "String", ",", "Object", ">", "result", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"completion\"", ")", ",", "\"xs:unique\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"menu\"", ")", ",", "\"\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"info\"", ")", ",", "\"\"", "+", "\"\"", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "completeWsdl", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"xml_complete\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE_WSDL", ",", "\"-o\"", ",", "\"516\"", ",", "\"-e\"", ",", "\"utf-8\"", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "3", ",", "results", ".", "size", "(", ")", ")", ";", "Map", "<", "String", ",", "Object", ">", "result", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"completion\"", ")", ",", "\"\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"menu\"", ")", ",", "\"\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"info\"", ")", ",", "\"\"", "+", "\"\"", ")", ";", "}", "}", "</s>" ]
1,569
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "complete", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "taskdefs", ".", "condition", ".", "Os", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "Wst", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "HtmlCodeCompleteCommandTest", "{", "private", "static", "final", "String", "TEST_FILE", "=", "\"\"", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "completeAttribute", "(", ")", "{", "if", "(", "Os", ".", "isFamily", "(", "Os", ".", "FAMILY_WINDOWS", ")", ")", "{", "return", ";", "}", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", ",", "\"-o\"", ",", "\"152\"", ",", "\"-e\"", ",", "\"utf-8\"", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "2", ",", "results", ".", "size", "(", ")", ")", ";", "Map", "<", "String", ",", "Object", ">", "result", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"completion\"", ")", ",", "\"href\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"menu\"", ")", ",", "\"\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"info\"", ")", ",", "\"\"", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "completeElement", "(", ")", "{", "if", "(", "Os", ".", "isFamily", "(", "Os", ".", "FAMILY_WINDOWS", ")", ")", "{", "return", ";", "}", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", ",", "\"-o\"", ",", "\"141\"", ",", "\"-e\"", ",", "\"utf-8\"", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "7", ",", "results", ".", "size", "(", ")", ")", ";", "Map", "<", "String", ",", "Object", ">", "result", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"completion\"", ")", ",", "\"h1\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"menu\"", ")", ",", "\"\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"info\"", ")", ",", "\"\"", ")", ";", "result", "=", "results", ".", "get", "(", "1", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"completion\"", ")", ",", "\"h2\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"menu\"", ")", ",", "\"\"", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"info\"", ")", ",", "\"\"", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "completeCss", "(", ")", "{", "if", "(", "Os", ".", "isFamily", "(", "Os", ".", "FAMILY_WINDOWS", ")", ")", "{", "return", ";", "}", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", ",", "\"-o\"", ",", "\"131\"", ",", "\"-e\"", ",", "\"utf-8\"", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "8", ",", "results", ".", "size", "(", ")", ")", ";", "Map", "<", "String", ",", "Object", ">", "result", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"completion\"", ")", ",", "\"font\"", ")", ";", "result", "=", "results", ".", "get", "(", "1", ")", ";", "assertEquals", "(", "result", ".", "get", "(", "\"completion\"", ")", ",", "\"font-family\"", ")", ";", "}", "}", "</s>" ]
1,570
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "Wst", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "HtmlValidateCommandTest", "{", "private", "static", "final", "String", "TEST_FILE", "=", "\"\"", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "validate", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "3", ",", "results", ".", "size", "(", ")", ")", ";", "String", "file", "=", "Eclim", ".", "resolveFile", "(", "Wst", ".", "TEST_PROJECT", ",", "TEST_FILE", ")", ";", "Map", "<", "String", ",", "Object", ">", "error", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertTrue", "(", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ".", "indexOf", "(", "\"\"", ")", "!=", "-", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "5", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "5", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "false", ")", ";", "error", "=", "results", ".", "get", "(", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertTrue", "(", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ".", "indexOf", "(", "\"\"", ")", "!=", "-", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "5", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "5", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "true", ")", ";", "error", "=", "results", ".", "get", "(", "2", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertTrue", "(", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ".", "indexOf", "(", "\"\"", ")", "!=", "-", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "8", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "5", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "true", ")", ";", "}", "}", "</s>" ]
1,571
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "Wst", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "CssValidateCommandTest", "{", "private", "static", "final", "String", "TEST_FILE", "=", "\"\"", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "validate", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"css_validate\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "2", ",", "results", ".", "size", "(", ")", ")", ";", "String", "file", "=", "Eclim", ".", "resolveFile", "(", "Wst", ".", "TEST_PROJECT", ",", "TEST_FILE", ")", ";", "Map", "<", "String", ",", "Object", ">", "error", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertTrue", "(", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ".", "indexOf", "(", "\"\"", ")", "!=", "-", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "2", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "false", ")", ";", "error", "=", "results", ".", "get", "(", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertTrue", "(", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ".", "indexOf", "(", "\"\"", ")", "!=", "-", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "6", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "false", ")", ";", "}", "}", "</s>" ]
1,572
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "Wst", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "XsdValidateCommandTest", "{", "private", "static", "final", "String", "TEST_FILE", "=", "\"xsd/test.xsd\"", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "validate", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"xsd_validate\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "2", ",", "results", ".", "size", "(", ")", ")", ";", "String", "file", "=", "Eclim", ".", "resolveFile", "(", "Wst", ".", "TEST_PROJECT", ",", "TEST_FILE", ")", ";", "Map", "<", "String", ",", "Object", ">", "error", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertTrue", "(", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ".", "indexOf", "(", "\"\"", ")", "!=", "-", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "3", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "43", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "false", ")", ";", "error", "=", "results", ".", "get", "(", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertTrue", "(", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ".", "indexOf", "(", "\"\"", ")", "!=", "-", "1", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "11", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "12", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "false", ")", ";", "}", "}", "</s>" ]
1,573
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclim", ".", "Eclim", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "Wst", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "DtdValidateCommandTest", "{", "private", "static", "final", "String", "TEST_FILE", "=", "\"dtd/test.dtd\"", ";", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "validate", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "Eclim", ".", "projectExists", "(", "Wst", ".", "TEST_PROJECT", ")", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "results", "=", "(", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ")", "Eclim", ".", "execute", "(", "new", "String", "[", "]", "{", "\"dtd_validate\"", ",", "\"-p\"", ",", "Wst", ".", "TEST_PROJECT", ",", "\"-f\"", ",", "TEST_FILE", "}", ")", ";", "assertEquals", "(", "\"\"", ",", "1", ",", "results", ".", "size", "(", ")", ")", ";", "String", "file", "=", "Eclim", ".", "resolveFile", "(", "Wst", ".", "TEST_PROJECT", ",", "TEST_FILE", ")", ";", "Map", "<", "String", ",", "Object", ">", "error", "=", "results", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"filename\"", ")", ",", "file", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"message\"", ")", ",", "\"\"", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"line\"", ")", ",", "3", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"column\"", ")", ",", "45", ")", ";", "assertEquals", "(", "error", ".", "get", "(", "\"warning\"", ")", ",", "false", ")", ";", "}", "}", "</s>" ]
1,574
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ";", "public", "class", "Wst", "{", "public", "static", "final", "String", "TEST_PROJECT", "=", "\"\"", ";", "}", "</s>" ]
1,575
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "AbstractPluginResources", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "JavaScriptCore", ";", "public", "class", "PluginResources", "extends", "AbstractPluginResources", "{", "public", "static", "final", "String", "NAME", "=", "\"\"", ";", "public", "static", "final", "String", "JAVASCRIPT_NATURE", "=", "JavaScriptCore", ".", "NATURE_ID", ";", "public", "void", "initialize", "(", "String", "name", ")", "{", "super", ".", "initialize", "(", "name", ")", ";", "ProjectNatureFactory", ".", "addNature", "(", "\"javascript\"", ",", "JAVASCRIPT_NATURE", ")", ";", "}", "protected", "String", "getBundleBaseName", "(", ")", "{", "return", "\"\"", ";", "}", "}", "</s>" ]
1,576
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "util", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "project", ".", "ProjectNatureFactory", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "PluginResources", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "IJavaScriptProject", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "IJavaScriptUnit", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "JavaScriptCore", ";", "public", "class", "JavaScriptUtils", "{", "public", "static", "IJavaScriptProject", "getJavaScriptProject", "(", "String", "project", ")", "throws", "Exception", "{", "return", "getJavaScriptProject", "(", "ProjectUtils", ".", "getProject", "(", "project", ",", "true", ")", ")", ";", "}", "public", "static", "IJavaScriptProject", "getJavaScriptProject", "(", "IProject", "project", ")", "throws", "Exception", "{", "if", "(", "ProjectUtils", ".", "getPath", "(", "project", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Services", ".", "getMessage", "(", "\"\"", ",", "project", ".", "getName", "(", ")", ")", ")", ";", "}", "if", "(", "!", "project", ".", "hasNature", "(", "PluginResources", ".", "JAVASCRIPT_NATURE", ")", ")", "{", "String", "alias", "=", "ProjectNatureFactory", ".", "getAliasForNature", "(", "PluginResources", ".", "JAVASCRIPT_NATURE", ")", ";", "throw", "new", "IllegalArgumentException", "(", "Services", ".", "getMessage", "(", "\"\"", ",", "project", ".", "getName", "(", ")", ",", "alias", ")", ")", ";", "}", "IJavaScriptProject", "javascriptProject", "=", "JavaScriptCore", ".", "create", "(", "project", ")", ";", "if", "(", "javascriptProject", "==", "null", "||", "!", "javascriptProject", ".", "exists", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Services", ".", "getMessage", "(", "\"\"", ",", "project", ")", ")", ";", "}", "return", "javascriptProject", ";", "}", "public", "static", "IJavaScriptUnit", "getJavaScriptUnit", "(", "String", "project", ",", "String", "file", ")", "throws", "Exception", "{", "IJavaScriptProject", "javascriptProject", "=", "getJavaScriptProject", "(", "project", ")", ";", "return", "getJavaScriptUnit", "(", "javascriptProject", ",", "file", ")", ";", "}", "public", "static", "IJavaScriptUnit", "getJavaScriptUnit", "(", "IJavaScriptProject", "project", ",", "String", "file", ")", "throws", "Exception", "{", "if", "(", "!", "project", ".", "isOpen", "(", ")", ")", "{", "project", ".", "open", "(", "null", ")", ";", "}", "return", "JavaScriptCore", ".", "createCompilationUnitFrom", "(", "ProjectUtils", ".", "getFile", "(", "project", ".", "getProject", "(", ")", ",", "file", ")", ")", ";", "}", "}", "</s>" ]
1,577
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "complete", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "complete", ".", "CodeCompleteResult", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "util", ".", "JavaScriptUtils", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "CompletionProposal", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "IJavaScriptUnit", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "Signature", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "JavaScriptCodeCompleteCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "int", "offset", "=", "getOffset", "(", "commandLine", ")", ";", "IJavaScriptUnit", "src", "=", "JavaScriptUtils", ".", "getJavaScriptUnit", "(", "project", ",", "file", ")", ";", "CompletionRequestor", "collector", "=", "new", "CompletionRequestor", "(", ")", ";", "src", ".", "codeComplete", "(", "offset", ",", "collector", ")", ";", "return", "collector", ".", "getResults", "(", ")", ";", "}", "public", "static", "class", "CompletionRequestor", "extends", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "CompletionRequestor", "{", "private", "ArrayList", "<", "CodeCompleteResult", ">", "results", "=", "new", "ArrayList", "<", "CodeCompleteResult", ">", "(", ")", ";", "@", "Override", "public", "void", "accept", "(", "CompletionProposal", "proposal", ")", "{", "String", "completion", "=", "String", ".", "valueOf", "(", "proposal", ".", "getCompletion", "(", ")", ")", ";", "String", "type", "=", "String", ".", "valueOf", "(", "proposal", ".", "getDeclarationTypeName", "(", ")", ")", ";", "StringBuffer", "desc", "=", "new", "StringBuffer", "(", ")", ";", "desc", ".", "append", "(", "type", ")", ".", "append", "(", "'.'", ")", ";", "if", "(", "proposal", ".", "getKind", "(", ")", "==", "CompletionProposal", ".", "METHOD_REF", ")", "{", "String", "sig", "=", "String", ".", "valueOf", "(", "Signature", ".", "getSignatureSimpleName", "(", "proposal", ".", "getSignature", "(", ")", ")", ")", ";", "String", "name", "=", "completion", ".", "replaceFirst", "(", "\"\\\\(\\\\)\"", ",", "\"\"", ")", ";", "int", "index", "=", "sig", ".", "indexOf", "(", "\"", "(\"", ")", ";", "String", "ret", "=", "sig", ".", "substring", "(", "0", ",", "index", ")", ";", "String", "params", "=", "sig", ".", "substring", "(", "index", ")", ".", "trim", "(", ")", ";", "desc", ".", "append", "(", "name", ")", ".", "append", "(", "params", ")", ".", "append", "(", "\"", ":", "\"", ")", ".", "append", "(", "ret", ")", ";", "if", "(", "params", ".", "lastIndexOf", "(", "')'", ")", ">", "params", ".", "lastIndexOf", "(", "'('", ")", "+", "1", "&&", "(", "completion", ".", "length", "(", ")", ">", "0", "&&", "completion", ".", "charAt", "(", "completion", ".", "length", "(", ")", "-", "1", ")", "==", "')'", ")", ")", "{", "completion", "=", "completion", ".", "substring", "(", "0", ",", "completion", ".", "length", "(", ")", "-", "1", ")", ";", "}", "}", "else", "{", "desc", ".", "append", "(", "completion", ")", ";", "}", "String", "info", "=", "desc", ".", "toString", "(", ")", ";", "results", ".", "add", "(", "new", "CodeCompleteResult", "(", "completion", ",", "null", ",", "info", ")", ")", ";", "}", "public", "List", "<", "CodeCompleteResult", ">", "getResults", "(", ")", "{", "return", "results", ";", "}", "}", "}", "</s>" ]
1,578
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "complete", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "eclipse", ".", "EclimPlugin", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "complete", ".", "AbstractCodeCompleteCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "ITextViewer", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "contentassist", ".", "IContentAssistProcessor", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "css", ".", "ui", ".", "internal", ".", "contentassist", ".", "CSSContentAssistProcessor", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "sse", ".", "core", ".", "StructuredModelManager", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "sse", ".", "core", ".", "internal", ".", "provisional", ".", "IStructuredModel", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "sse", ".", "ui", ".", "internal", ".", "StructuredTextViewer", ";", "@", "Command", "(", "name", "=", "\"css_complete\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "CssCodeCompleteCommand", "extends", "WstCodeCompleteCommand", "{", "private", "static", "StructuredTextViewer", "viewer", ";", "@", "Override", "protected", "IContentAssistProcessor", "getContentAssistProcessor", "(", "CommandLine", "commandLine", ",", "String", "project", ",", "String", "file", ")", "throws", "Exception", "{", "return", "new", "CSSContentAssistProcessor", "(", ")", ";", "}", "@", "Override", "protected", "ITextViewer", "getTextViewer", "(", "CommandLine", "commandLine", ",", "String", "project", ",", "String", "file", ")", "throws", "Exception", "{", "IFile", "ifile", "=", "ProjectUtils", ".", "getFile", "(", "ProjectUtils", ".", "getProject", "(", "project", ",", "true", ")", ",", "file", ")", ";", "ifile", ".", "refreshLocal", "(", "IResource", ".", "DEPTH_INFINITE", ",", "null", ")", ";", "IStructuredModel", "model", "=", "StructuredModelManager", ".", "getModelManager", "(", ")", ".", "getModelForRead", "(", "ifile", ")", ";", "if", "(", "viewer", "==", "null", ")", "{", "viewer", "=", "new", "StructuredTextViewer", "(", "EclimPlugin", ".", "getShell", "(", ")", ",", "null", ",", "null", ",", "false", ",", "0", ")", "{", "protected", "void", "createControl", "(", "Composite", "parent", ",", "int", "styles", ")", "{", "}", "}", ";", "}", "viewer", ".", "setDocument", "(", "model", ".", "getStructuredDocument", "(", ")", ")", ";", "return", "viewer", ";", "}", "}", "</s>" ]
1,579
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "complete", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "eclipse", ".", "EclimPlugin", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "complete", ".", "AbstractCodeCompleteCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "contentassist", ".", "ICompletionProposal", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "contentassist", ".", "IContentAssistProcessor", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "Point", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "sse", ".", "core", ".", "StructuredModelManager", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "sse", ".", "core", ".", "internal", ".", "provisional", ".", "IStructuredModel", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "sse", ".", "ui", ".", "internal", ".", "StructuredTextViewer", ";", "public", "abstract", "class", "WstCodeCompleteCommand", "extends", "AbstractCodeCompleteCommand", "{", "@", "Override", "protected", "ICompletionProposal", "[", "]", "getCompletionProposals", "(", "CommandLine", "commandLine", ",", "String", "project", ",", "String", "file", ",", "int", "offset", ")", "throws", "Exception", "{", "IContentAssistProcessor", "processor", "=", "getContentAssistProcessor", "(", "commandLine", ",", "project", ",", "file", ")", ";", "IFile", "ifile", "=", "ProjectUtils", ".", "getFile", "(", "ProjectUtils", ".", "getProject", "(", "project", ",", "true", ")", ",", "file", ")", ";", "IStructuredModel", "model", "=", "StructuredModelManager", ".", "getModelManager", "(", ")", ".", "getModelForRead", "(", "ifile", ")", ";", "if", "(", "model", "!=", "null", ")", "{", "StructuredTextViewer", "viewer", "=", "new", "StructuredTextViewer", "(", "EclimPlugin", ".", "getShell", "(", ")", ",", "null", ",", "null", ",", "false", ",", "0", ")", "{", "private", "Point", "point", ";", "public", "Point", "getSelectedRange", "(", ")", "{", "return", "point", ";", "}", "public", "void", "setSelectedRange", "(", "int", "x", ",", "int", "y", ")", "{", "point", "=", "new", "Point", "(", "x", ",", "y", ")", ";", "}", "}", ";", "viewer", ".", "setDocument", "(", "model", ".", "getStructuredDocument", "(", ")", ")", ";", "viewer", ".", "setSelectedRange", "(", "offset", ",", "0", ")", ";", "ICompletionProposal", "[", "]", "proposals", "=", "processor", ".", "computeCompletionProposals", "(", "viewer", ",", "offset", ")", ";", "model", ".", "releaseFromRead", "(", ")", ";", "return", "proposals", ";", "}", "return", "new", "ICompletionProposal", "[", "0", "]", ";", "}", "}", "</s>" ]
1,580
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "complete", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "complete", ".", "CodeCompleteResult", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "contentassist", ".", "ICompletionProposal", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "contentassist", ".", "IContentAssistProcessor", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "xml", ".", "ui", ".", "internal", ".", "contentassist", ".", "XMLContentAssistProcessor", ";", "@", "Command", "(", "name", "=", "\"xml_complete\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "XmlCodeCompleteCommand", "extends", "WstCodeCompleteCommand", "{", "private", "static", "final", "ArrayList", "<", "String", ">", "IGNORE", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "static", "{", "IGNORE", ".", "add", "(", "\"\"", ")", ";", "IGNORE", ".", "add", "(", "\"\"", ")", ";", "}", "@", "Override", "protected", "IContentAssistProcessor", "getContentAssistProcessor", "(", "CommandLine", "commandLine", ",", "String", "project", ",", "String", "file", ")", "throws", "Exception", "{", "return", "new", "XMLContentAssistProcessor", "(", ")", ";", "}", "@", "Override", "protected", "boolean", "acceptProposal", "(", "ICompletionProposal", "proposal", ")", "{", "String", "display", "=", "proposal", ".", "getDisplayString", "(", ")", ";", "return", "!", "display", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "\"close", "with\"", ")", "&&", "!", "display", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "\"end", "with\"", ")", "&&", "!", "IGNORE", ".", "contains", "(", "display", ")", ";", "}", "@", "Override", "protected", "String", "getMenu", "(", "ICompletionProposal", "proposal", ")", "{", "String", "menu", "=", "proposal", ".", "getAdditionalProposalInfo", "(", ")", ";", "if", "(", "menu", "!=", "null", ")", "{", "int", "index", "=", "menu", ".", "indexOf", "(", "\"</p>\"", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "menu", "=", "menu", ".", "substring", "(", "index", "+", "4", ")", ";", "menu", "=", "CodeCompleteResult", ".", "menuFromInfo", "(", "menu", ")", ";", "}", "}", "return", "menu", ";", "}", "}", "</s>" ]
1,581
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "complete", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "contentassist", ".", "ICompletionProposal", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "contentassist", ".", "IContentAssistProcessor", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "html", ".", "ui", ".", "internal", ".", "contentassist", ".", "HTMLContentAssistProcessor", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "HtmlCodeCompleteCommand", "extends", "WstCodeCompleteCommand", "{", "@", "Override", "protected", "IContentAssistProcessor", "getContentAssistProcessor", "(", "CommandLine", "commandLine", ",", "String", "project", ",", "String", "file", ")", "throws", "Exception", "{", "return", "new", "HTMLContentAssistProcessor", "(", ")", ";", "}", "@", "Override", "protected", "boolean", "acceptProposal", "(", "ICompletionProposal", "proposal", ")", "{", "String", "display", "=", "proposal", ".", "getDisplayString", "(", ")", ";", "return", "!", "display", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "\"close", "with\"", ")", ";", "}", "}", "</s>" ]
1,582
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "src", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "util", ".", "JavaScriptUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "file", ".", "FileOffsets", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "IJavaScriptUnit", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "compiler", ".", "IProblem", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", "+", "\"\"", ")", "public", "class", "JavaScriptSrcUpdateCommand", "extends", "AbstractCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "String", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "if", "(", "!", "commandLine", ".", "hasOption", "(", "Options", ".", "VALIDATE_OPTION", ")", ")", "{", "ProjectUtils", ".", "getFile", "(", "projectName", ",", "file", ")", ";", "}", "else", "{", "IJavaScriptUnit", "src", "=", "JavaScriptUtils", ".", "getJavaScriptUnit", "(", "projectName", ",", "file", ")", ";", "IJavaScriptUnit", "workingCopy", "=", "src", ".", "getWorkingCopy", "(", "null", ")", ";", "ProblemRequestor", "requestor", "=", "new", "ProblemRequestor", "(", ")", ";", "try", "{", "workingCopy", ".", "discardWorkingCopy", "(", ")", ";", "workingCopy", ".", "becomeWorkingCopy", "(", "requestor", ",", "null", ")", ";", "}", "finally", "{", "workingCopy", ".", "discardWorkingCopy", "(", ")", ";", "}", "List", "<", "IProblem", ">", "problems", "=", "requestor", ".", "getProblems", "(", ")", ";", "ArrayList", "<", "Error", ">", "errors", "=", "new", "ArrayList", "<", "Error", ">", "(", ")", ";", "String", "filename", "=", "src", ".", "getResource", "(", ")", ".", "getLocation", "(", ")", ".", "toOSString", "(", ")", ";", "FileOffsets", "offsets", "=", "FileOffsets", ".", "compile", "(", "filename", ")", ";", "for", "(", "IProblem", "problem", ":", "problems", ")", "{", "int", "[", "]", "lineColumn", "=", "offsets", ".", "offsetToLineColumn", "(", "problem", ".", "getSourceStart", "(", ")", ")", ";", "errors", ".", "add", "(", "new", "Error", "(", "problem", ".", "getMessage", "(", ")", ",", "filename", ",", "lineColumn", "[", "0", "]", ",", "lineColumn", "[", "1", "]", ",", "problem", ".", "isWarning", "(", ")", ")", ")", ";", "}", "return", "errors", ";", "}", "return", "null", ";", "}", "public", "static", "class", "ProblemRequestor", "implements", "org", ".", "eclipse", ".", "wst", ".", "jsdt", ".", "core", ".", "IProblemRequestor", "{", "private", "ArrayList", "<", "IProblem", ">", "problems", "=", "new", "ArrayList", "<", "IProblem", ">", "(", ")", ";", "public", "List", "<", "IProblem", ">", "getProblems", "(", ")", "{", "return", "problems", ";", "}", "public", "void", "acceptProblem", "(", "IProblem", "problem", ")", "{", "problems", ".", "add", "(", "problem", ")", ";", "}", "public", "void", "beginReporting", "(", ")", "{", "}", "public", "void", "endReporting", "(", ")", "{", "}", "public", "boolean", "isActive", "(", ")", "{", "return", "true", ";", "}", "}", "}", "</s>" ]
1,583
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "dtd", ".", "core", ".", "internal", ".", "validation", ".", "eclipse", ".", "DTDValidator", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "xml", ".", "core", ".", "internal", ".", "validation", ".", "core", ".", "ValidationMessage", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "xml", ".", "core", ".", "internal", ".", "validation", ".", "core", ".", "ValidationReport", ";", "@", "Command", "(", "name", "=", "\"dtd_validate\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "DtdValidateCommand", "extends", "WstValidateCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "ArrayList", "<", "Error", ">", "results", "=", "new", "ArrayList", "<", "Error", ">", "(", ")", ";", "DTDValidator", "validator", "=", "DTDValidator", ".", "getInstance", "(", ")", ";", "ValidationReport", "result", "=", "validator", ".", "validate", "(", "toUri", "(", "project", ",", "file", ")", ")", ";", "ValidationMessage", "[", "]", "messages", "=", "result", ".", "getValidationMessages", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "messages", ".", "length", ";", "ii", "++", ")", "{", "StringBuffer", "message", "=", "new", "StringBuffer", "(", "messages", "[", "ii", "]", ".", "getMessage", "(", ")", ")", ";", "for", "(", "Object", "o", ":", "messages", "[", "ii", "]", ".", "getNestedMessages", "(", ")", ")", "{", "ValidationMessage", "nested", "=", "(", "ValidationMessage", ")", "o", ";", "message", ".", "append", "(", "'", "'", ")", ".", "append", "(", "nested", ".", "getMessage", "(", ")", ")", ";", "}", "results", ".", "add", "(", "new", "Error", "(", "message", ".", "toString", "(", ")", ",", "toFile", "(", "messages", "[", "ii", "]", ".", "getUri", "(", ")", ")", ",", "messages", "[", "ii", "]", ".", "getLineNumber", "(", ")", ",", "messages", "[", "ii", "]", ".", "getColumnNumber", "(", ")", ",", "false", ")", ")", ";", "}", "return", "results", ";", "}", "}", "</s>" ]
1,584
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "validation", ".", "internal", ".", "provisional", ".", "core", ".", "IMessage", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "validation", ".", "internal", ".", "provisional", ".", "core", ".", "IReporter", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "validation", ".", "internal", ".", "provisional", ".", "core", ".", "IValidator", ";", "public", "class", "Reporter", "implements", "IReporter", "{", "private", "ArrayList", "<", "IMessage", ">", "messages", "=", "new", "ArrayList", "<", "IMessage", ">", "(", ")", ";", "public", "List", "<", "IMessage", ">", "getMessages", "(", ")", "{", "return", "messages", ";", "}", "public", "void", "addMessage", "(", "IValidator", "origin", ",", "IMessage", "message", ")", "{", "messages", ".", "add", "(", "message", ")", ";", "}", "public", "void", "displaySubtask", "(", "IValidator", "validator", ",", "IMessage", "message", ")", "{", "}", "public", "boolean", "isCancelled", "(", ")", "{", "return", "false", ";", "}", "public", "void", "removeAllMessages", "(", "IValidator", "origin", ")", "{", "}", "public", "void", "removeAllMessages", "(", "IValidator", "origin", ",", "Object", "object", ")", "{", "}", "public", "void", "removeMessageSubset", "(", "IValidator", "validator", ",", "Object", "obj", ",", "String", "groupName", ")", "{", "}", "}", "</s>" ]
1,585
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclim", ".", "util", ".", "IOUtils", ";", "import", "org", ".", "w3c", ".", "tidy", ".", "Tidy", ";", "@", "Command", "(", "name", "=", "\"\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "HtmlValidateCommand", "extends", "WstValidateCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "final", "String", "file", "=", "ProjectUtils", ".", "getFilePath", "(", "project", ",", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ")", ";", "Tidy", "tidy", "=", "new", "Tidy", "(", ")", ";", "tidy", ".", "setEmacs", "(", "true", ")", ";", "tidy", ".", "setOnlyErrors", "(", "true", ")", ";", "tidy", ".", "setQuiet", "(", "true", ")", ";", "FileInputStream", "in", "=", "new", "FileInputStream", "(", "file", ")", ";", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "PrintWriter", "writer", "=", "new", "PrintWriter", "(", "out", ",", "true", ")", ";", "try", "{", "tidy", ".", "setErrout", "(", "writer", ")", ";", "tidy", ".", "parse", "(", "in", ",", "out", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "in", ")", ";", "IOUtils", ".", "closeQuietly", "(", "out", ")", ";", "}", "ArrayList", "<", "Error", ">", "results", "=", "new", "ArrayList", "<", "Error", ">", "(", ")", ";", "String", "[", "]", "lines", "=", "StringUtils", ".", "split", "(", "out", ".", "toString", "(", ")", ",", "'\\n'", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "lines", ".", "length", ";", "ii", "++", ")", "{", "if", "(", "accept", "(", "lines", "[", "ii", "]", ")", ")", "{", "Error", "error", "=", "parseError", "(", "file", ",", "lines", "[", "ii", "]", ")", ";", "if", "(", "error", "!=", "null", ")", "{", "results", ".", "add", "(", "error", ")", ";", "}", "}", "}", "return", "results", ";", "}", "private", "boolean", "accept", "(", "String", "line", ")", "{", "return", "line", ".", "indexOf", "(", "\":", "inserting\"", ")", "==", "-", "1", "&&", "line", ".", "indexOf", "(", "\":", "trimming\"", ")", "==", "-", "1", ";", "}", "private", "Error", "parseError", "(", "String", "file", ",", "String", "line", ")", "throws", "Exception", "{", "String", "[", "]", "parts", "=", "StringUtils", ".", "split", "(", "line", ",", "':'", ")", ";", "if", "(", "parts", ".", "length", "==", "5", ")", "{", "int", "lnum", "=", "Integer", ".", "parseInt", "(", "parts", "[", "1", "]", ".", "replaceAll", "(", "\",\"", ",", "\"\"", ")", ")", ";", "int", "cnum", "=", "Integer", ".", "parseInt", "(", "parts", "[", "2", "]", ".", "replaceAll", "(", "\",\"", ",", "\"\"", ")", ")", ";", "return", "new", "Error", "(", "parts", "[", "4", "]", ".", "trim", "(", ")", ",", "file", ",", "lnum", ",", "cnum", ",", "parts", "[", "3", "]", ".", "trim", "(", ")", ".", "equals", "(", "\"Warning\"", ")", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
1,586
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "eclim", ".", "Services", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "w3c", ".", "css", ".", "css", ".", "DocumentParser", ";", "import", "org", ".", "w3c", ".", "css", ".", "css", ".", "StyleSheet", ";", "import", "org", ".", "w3c", ".", "css", ".", "parser", ".", "CssError", ";", "import", "org", ".", "w3c", ".", "css", ".", "parser", ".", "analyzer", ".", "TokenMgrError", ";", "import", "org", ".", "w3c", ".", "css", ".", "util", ".", "ApplContext", ";", "import", "org", ".", "w3c", ".", "css", ".", "util", ".", "Warning", ";", "@", "Command", "(", "name", "=", "\"css_validate\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "CssValidateCommand", "extends", "WstValidateCommand", "{", "private", "static", "final", "String", "URI_PREFIX", "=", "\"file:/\"", ";", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "projectName", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "IProject", "project", "=", "ProjectUtils", ".", "getProject", "(", "projectName", ")", ";", "if", "(", "!", "project", ".", "exists", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "Services", ".", "getMessage", "(", "\"\"", ",", "projectName", ")", ")", ";", "}", "String", "uri", "=", "toUri", "(", "projectName", ",", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ")", ";", "ApplContext", "context", "=", "new", "ApplContext", "(", "\"en\"", ")", ";", "context", ".", "setCssVersion", "(", "\"css3\"", ")", ";", "context", ".", "setMedium", "(", "\"all\"", ")", ";", "ArrayList", "<", "Error", ">", "errors", "=", "new", "ArrayList", "<", "Error", ">", "(", ")", ";", "try", "{", "DocumentParser", "parser", "=", "new", "DocumentParser", "(", "context", ",", "uri", ")", ";", "StyleSheet", "css", "=", "parser", ".", "getStyleSheet", "(", ")", ";", "css", ".", "findConflicts", "(", "context", ")", ";", "for", "(", "CssError", "error", ":", "css", ".", "getErrors", "(", ")", ".", "getErrors", "(", ")", ")", "{", "if", "(", "!", "StringUtils", ".", "EMPTY", ".", "equals", "(", "error", ".", "getException", "(", ")", ".", "getMessage", "(", ")", ")", ")", "{", "errors", ".", "add", "(", "new", "Error", "(", "error", ".", "getException", "(", ")", ".", "getMessage", "(", ")", ",", "toFile", "(", "error", ".", "getSourceFile", "(", ")", ")", ",", "error", ".", "getLine", "(", ")", ",", "1", ",", "false", ")", ")", ";", "}", "}", "for", "(", "Warning", "warning", ":", "css", ".", "getWarnings", "(", ")", ".", "getWarnings", "(", ")", ")", "{", "if", "(", "!", "StringUtils", ".", "EMPTY", ".", "equals", "(", "warning", ".", "getWarningMessage", "(", ")", ")", ")", "{", "errors", ".", "add", "(", "new", "Error", "(", "warning", ".", "getWarningMessage", "(", ")", ",", "toFile", "(", "warning", ".", "getSourceFile", "(", ")", ")", ",", "warning", ".", "getLine", "(", ")", ",", "1", ",", "true", ")", ")", ";", "}", "}", "}", "catch", "(", "TokenMgrError", "tme", ")", "{", "errors", ".", "add", "(", "new", "Error", "(", "tme", ".", "getMessage", "(", ")", ",", "super", ".", "toFile", "(", "uri", ")", ",", "1", ",", "1", ",", "false", ")", ")", ";", "}", "return", "errors", ";", "}", "@", "Override", "protected", "String", "toFile", "(", "String", "uri", ")", "{", "uri", "=", "uri", ".", "startsWith", "(", "URI_PREFIX", ")", "?", "uri", ".", "substring", "(", "URI_PREFIX", ".", "length", "(", ")", ")", ":", "uri", ";", "uri", "=", "uri", ".", "replaceFirst", "(", "\"^/+\"", ",", "\"/\"", ")", ";", "return", "uri", ";", "}", "}", "</s>" ]
1,587
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "validation", ".", "internal", ".", "provisional", ".", "core", ".", "IValidationContext", ";", "public", "class", "ValidationContext", "implements", "IValidationContext", "{", "private", "String", "[", "]", "uris", ";", "public", "ValidationContext", "(", "String", "uri", ")", "{", "this", ".", "uris", "=", "new", "String", "[", "]", "{", "uri", "}", ";", "}", "public", "String", "[", "]", "getURIs", "(", ")", "{", "return", "uris", ";", "}", "public", "Object", "loadModel", "(", "String", "name", ")", "{", "return", "null", ";", "}", "public", "Object", "loadModel", "(", "String", "name", ",", "Object", "[", "]", "params", ")", "{", "return", "null", ";", "}", "}", "</s>" ]
1,588
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclim", ".", "annotation", ".", "Command", ";", "import", "org", ".", "eclim", ".", "command", ".", "CommandLine", ";", "import", "org", ".", "eclim", ".", "command", ".", "Error", ";", "import", "org", ".", "eclim", ".", "command", ".", "Options", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "xml", ".", "core", ".", "internal", ".", "validation", ".", "core", ".", "ValidationMessage", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "xml", ".", "core", ".", "internal", ".", "validation", ".", "core", ".", "ValidationReport", ";", "import", "org", ".", "eclipse", ".", "wst", ".", "xsd", ".", "core", ".", "internal", ".", "validation", ".", "eclipse", ".", "XSDValidator", ";", "@", "Command", "(", "name", "=", "\"xsd_validate\"", ",", "options", "=", "\"\"", "+", "\"\"", ")", "public", "class", "XsdValidateCommand", "extends", "WstValidateCommand", "{", "public", "Object", "execute", "(", "CommandLine", "commandLine", ")", "throws", "Exception", "{", "String", "project", "=", "commandLine", ".", "getValue", "(", "Options", ".", "PROJECT_OPTION", ")", ";", "String", "file", "=", "commandLine", ".", "getValue", "(", "Options", ".", "FILE_OPTION", ")", ";", "ArrayList", "<", "Error", ">", "results", "=", "new", "ArrayList", "<", "Error", ">", "(", ")", ";", "XSDValidator", "validator", "=", "XSDValidator", ".", "getInstance", "(", ")", ";", "ValidationReport", "result", "=", "validator", ".", "validate", "(", "toUri", "(", "project", ",", "file", ")", ")", ";", "ValidationMessage", "[", "]", "messages", "=", "result", ".", "getValidationMessages", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "messages", ".", "length", ";", "ii", "++", ")", "{", "StringBuffer", "message", "=", "new", "StringBuffer", "(", "messages", "[", "ii", "]", ".", "getMessage", "(", ")", ")", ";", "for", "(", "Object", "o", ":", "messages", "[", "ii", "]", ".", "getNestedMessages", "(", ")", ")", "{", "ValidationMessage", "nested", "=", "(", "ValidationMessage", ")", "o", ";", "message", ".", "append", "(", "'", "'", ")", ".", "append", "(", "nested", ".", "getMessage", "(", ")", ")", ";", "}", "results", ".", "add", "(", "new", "Error", "(", "message", ".", "toString", "(", ")", ",", "toFile", "(", "messages", "[", "ii", "]", ".", "getUri", "(", ")", ")", ",", "messages", "[", "ii", "]", ".", "getLineNumber", "(", ")", ",", "messages", "[", "ii", "]", ".", "getColumnNumber", "(", ")", ",", "false", ")", ")", ";", "}", "return", "results", ";", "}", "}", "</s>" ]
1,589
[ "<s>", "package", "org", ".", "eclim", ".", "plugin", ".", "wst", ".", "command", ".", "validate", ";", "import", "java", ".", "net", ".", "URLDecoder", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "command", ".", "AbstractCommand", ";", "import", "org", ".", "eclim", ".", "plugin", ".", "core", ".", "util", ".", "ProjectUtils", ";", "public", "abstract", "class", "WstValidateCommand", "extends", "AbstractCommand", "{", "private", "static", "final", "String", "URI_PREFIX", "=", "\"file:///\"", ";", "protected", "String", "toUri", "(", "String", "project", ",", "String", "filename", ")", "throws", "Exception", "{", "if", "(", "filename", ".", "indexOf", "(", "\"://\"", ")", "==", "-", "1", ")", "{", "filename", "=", "URI_PREFIX", "+", "ProjectUtils", ".", "getFilePath", "(", "project", ",", "filename", ")", ";", "}", "return", "filename", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "}", "protected", "String", "toFile", "(", "String", "uri", ")", "{", "String", "file", "=", "uri", ".", "startsWith", "(", "URI_PREFIX", ")", "?", "uri", ".", "substring", "(", "URI_PREFIX", ".", "length", "(", ")", ")", ":", "uri", ";", "try", "{", "return", "URLDecoder", ".", "decode", "(", "file", ",", "\"utf-8\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "}", "</s>" ]
1,590
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "ant", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "BufferedWriter", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "org", ".", "apache", ".", "commons", ".", "io", ".", "IOUtils", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "BuildException", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "Task", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "taskdefs", ".", "Move", ";", "import", "org", ".", "eclim", ".", "installer", ".", "step", ".", "EclipseInfo", ";", "import", "org", ".", "eclim", ".", "installer", ".", "step", ".", "command", ".", "Command", ";", "import", "org", ".", "eclim", ".", "installer", ".", "step", ".", "command", ".", "OutputHandler", ";", "import", "org", ".", "eclim", ".", "installer", ".", "step", ".", "command", ".", "UninstallCommand", ";", "import", "org", ".", "formic", ".", "Installer", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "public", "class", "UninstallIUTask", "extends", "Task", "implements", "OutputHandler", "{", "private", "static", "final", "Logger", "logger", "=", "LoggerFactory", ".", "getLogger", "(", "UninstallIUTask", ".", "class", ")", ";", "private", "String", "repository", ";", "private", "String", "iu", ";", "private", "boolean", "failonerror", "=", "true", ";", "public", "void", "execute", "(", ")", "throws", "BuildException", "{", "if", "(", "iu", "==", "null", ")", "{", "throw", "new", "BuildException", "(", "\"\"", ")", ";", "}", "EclipseInfo", "info", "=", "(", "EclipseInfo", ")", "Installer", ".", "getContext", "(", ")", ".", "getValue", "(", "\"eclipse.info\"", ")", ";", "runCommand", "(", "new", "UninstallCommand", "(", "this", ",", "repository", ",", "iu", ",", "\"\"", ")", ",", "\"\"", "+", "iu", ")", ";", "runCommand", "(", "new", "Command", "(", "this", ",", "new", "String", "[", "]", "{", "\"-profile\"", ",", "info", ".", "getProfileName", "(", ")", "}", ",", "\"\"", ")", ",", "\"\"", ")", ";", "if", "(", "iu", ".", "equals", "(", "\"\"", ")", ")", "{", "String", "prefs", "=", "info", ".", "getLocalPath", "(", ")", "+", "\"\"", "+", "info", ".", "getProfileName", "(", ")", "+", "\"\"", ";", "logger", ".", "info", "(", "\"\"", "+", "prefs", ")", ";", "File", "prefFile", "=", "new", "File", "(", "prefs", ")", ";", "File", "prefFileNew", "=", "new", "File", "(", "prefs", "+", "\".tmp\"", ")", ";", "if", "(", "!", "prefFile", ".", "exists", "(", ")", ")", "{", "logger", ".", "warn", "(", "\"\"", ")", ";", "}", "else", "{", "BufferedReader", "in", "=", "null", ";", "BufferedWriter", "out", "=", "null", ";", "try", "{", "in", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "prefFile", ")", ")", ";", "out", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "prefFileNew", ")", ")", ";", "String", "line", "=", "null", ";", "while", "(", "(", "line", "=", "in", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "line", ".", "indexOf", "(", "\"formic_\"", ")", "!=", "-", "1", ")", "{", "continue", ";", "}", "out", ".", "write", "(", "line", ")", ";", "out", ".", "newLine", "(", ")", ";", "}", "IOUtils", ".", "closeQuietly", "(", "in", ")", ";", "IOUtils", ".", "closeQuietly", "(", "out", ")", ";", "Move", "move", "=", "new", "Move", "(", ")", ";", "move", ".", "setTaskName", "(", "\"move\"", ")", ";", "move", ".", "setProject", "(", "getProject", "(", ")", ")", ";", "move", ".", "setFile", "(", "prefFileNew", ")", ";", "move", ".", "setTofile", "(", "prefFile", ")", ";", "move", ".", "setFailOnError", "(", "false", ")", ";", "move", ".", "setForce", "(", "true", ")", ";", "move", ".", "setOverwrite", "(", "true", ")", ";", "move", ".", "execute", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "in", ")", ";", "IOUtils", ".", "closeQuietly", "(", "out", ")", ";", "}", "}", "}", "}", "private", "void", "runCommand", "(", "Command", "command", ",", "String", "message", ")", "{", "log", "(", "StringUtils", ".", "capitalize", "(", "message", ")", "+", "\"...\"", ")", ";", "try", "{", "command", ".", "start", "(", ")", ";", "command", ".", "join", "(", ")", ";", "if", "(", "command", ".", "getReturnCode", "(", ")", "!=", "0", ")", "{", "logger", ".", "warn", "(", "\"error:", "\"", "+", "command", ".", "getErrorMessage", "(", ")", "+", "\"", "out:", "\"", "+", "command", ".", "getResult", "(", ")", ")", ";", "if", "(", "failonerror", ")", "{", "throw", "new", "BuildException", "(", "\"error:", "\"", "+", "command", ".", "getErrorMessage", "(", ")", "+", "\"", "out:", "\"", "+", "command", ".", "getResult", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "failonerror", ")", "{", "throw", "new", "BuildException", "(", "e", ")", ";", "}", "else", "{", "logger", ".", "error", "(", "\"Error", "\"", "+", "message", ",", "e", ")", ";", "return", ";", "}", "}", "finally", "{", "if", "(", "command", "!=", "null", ")", "{", "command", ".", "destroy", "(", ")", ";", "}", "}", "}", "public", "void", "process", "(", "String", "line", ")", "{", "logger", ".", "info", "(", "line", ")", ";", "}", "public", "void", "setRepository", "(", "String", "repository", ")", "{", "this", ".", "repository", "=", "repository", ";", "}", "public", "void", "setIU", "(", "String", "iu", ")", "{", "this", ".", "iu", "=", "iu", ";", "}", "public", "void", "setFailonerror", "(", "boolean", "failonerror", ")", "{", "this", ".", "failonerror", "=", "failonerror", ";", "}", "}", "</s>" ]
1,591
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "ant", ";", "public", "class", "UnzipTask", "extends", "org", ".", "formic", ".", "ant", ".", "UnzipTask", "{", "public", "void", "addFeatureset", "(", "FeatureSet", "set", ")", "{", "addPatternset", "(", "set", ")", ";", "}", "}", "</s>" ]
1,592
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "ant", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "types", ".", "PatternSet", ";", "import", "org", ".", "formic", ".", "InstallContext", ";", "import", "org", ".", "formic", ".", "Installer", ";", "public", "class", "FeatureSet", "extends", "PatternSet", "{", "public", "FeatureSet", "(", ")", "{", "super", "(", ")", ";", "createInclude", "(", ")", ".", "setName", "(", "\"\"", ")", ";", "createInclude", "(", ")", ".", "setName", "(", "\"\"", ")", ";", "createInclude", "(", ")", ".", "setName", "(", "\"\"", ")", ";", "createInclude", "(", ")", ".", "setName", "(", "\"\"", ")", ";", "createInclude", "(", ")", ".", "setName", "(", "\"\"", ")", ";", "createInclude", "(", ")", ".", "setName", "(", "\"\"", ")", ";", "InstallContext", "context", "=", "Installer", ".", "getContext", "(", ")", ";", "String", "[", "]", "keys", "=", "context", ".", "getKeysByPrefix", "(", "\"featureList\"", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "keys", ".", "length", ";", "ii", "++", ")", "{", "String", "key", "=", "keys", "[", "ii", "]", ";", "Boolean", "value", "=", "Boolean", ".", "valueOf", "(", "context", ".", "getValue", "(", "key", ")", ".", "toString", "(", ")", ")", ";", "if", "(", "value", ".", "booleanValue", "(", ")", ")", "{", "String", "name", "=", "\"\"", "+", "key", ".", "substring", "(", "key", ".", "indexOf", "(", "'.'", ")", "+", "1", ")", ";", "createInclude", "(", ")", ".", "setName", "(", "name", "+", "\"/**/*\"", ")", ";", "createInclude", "(", ")", ".", "setName", "(", "name", "+", "\"_*/**/*\"", ")", ";", "}", "}", "}", "}", "</s>" ]
1,593
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "ant", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileNotFoundException", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "OutputStream", ";", "import", "java", ".", "net", ".", "Socket", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "apache", ".", "commons", ".", "io", ".", "IOUtils", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "BuildException", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "Task", ";", "public", "class", "ShutdownTask", "extends", "Task", "{", "private", "static", "final", "long", "WAIT_TIME", "=", "3000", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "execute", "(", ")", "throws", "BuildException", "{", "FileReader", "reader", "=", "null", ";", "try", "{", "File", "instances", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"user.home\"", ")", "+", "\"\"", ")", ";", "int", "count", "=", "0", ";", "if", "(", "instances", ".", "exists", "(", ")", ")", "{", "reader", "=", "new", "FileReader", "(", "instances", ")", ";", "for", "(", "Iterator", "<", "String", ">", "ii", "=", "IOUtils", ".", "lineIterator", "(", "reader", ")", ";", "ii", ".", "hasNext", "(", ")", ";", ")", "{", "count", "++", ";", "String", "instance", "=", "ii", ".", "next", "(", ")", ";", "try", "{", "log", "(", "\"\"", "+", "instance", ")", ";", "int", "port", "=", "Integer", ".", "parseInt", "(", "instance", ".", "replaceFirst", "(", "\".*:\"", ",", "\"\"", ")", ")", ";", "shutdown", "(", "port", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", "(", "\"\"", "+", "instance", "+", "\"):", "\"", "+", "e", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "-", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "if", "(", "count", "==", "0", ")", "{", "try", "{", "shutdown", "(", "9091", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", "(", "\"\"", "+", "e", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "-", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "FileNotFoundException", "fnfe", ")", "{", "log", "(", "\"\"", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "reader", ")", ";", "}", "}", "private", "void", "shutdown", "(", "int", "port", ")", "throws", "Exception", "{", "Socket", "socket", "=", "null", ";", "try", "{", "socket", "=", "new", "Socket", "(", "\"localhost\"", ",", "port", ")", ";", "OutputStream", "out", "=", "socket", ".", "getOutputStream", "(", ")", ";", "out", ".", "write", "(", "nailgunPacket", "(", "'A'", ",", "\"-command\"", ")", ")", ";", "out", ".", "write", "(", "nailgunPacket", "(", "'A'", ",", "\"shutdown\"", ")", ")", ";", "out", ".", "write", "(", "nailgunPacket", "(", "'C'", ",", "\"\"", ")", ")", ";", "out", ".", "flush", "(", ")", ";", "Thread", ".", "sleep", "(", "WAIT_TIME", ")", ";", "}", "finally", "{", "try", "{", "socket", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "}", "}", "}", "private", "byte", "[", "]", "nailgunPacket", "(", "char", "type", ",", "String", "value", ")", "{", "int", "length", "=", "value", ".", "length", "(", ")", ";", "byte", "[", "]", "packet", "=", "new", "byte", "[", "5", "+", "length", "]", ";", "packet", "[", "0", "]", "=", "(", "byte", ")", "(", "(", "length", ">>", "24", ")", "&", "0xff", ")", ";", "packet", "[", "1", "]", "=", "(", "byte", ")", "(", "(", "length", ">>", "16", ")", "&", "0xff", ")", ";", "packet", "[", "2", "]", "=", "(", "byte", ")", "(", "(", "length", ">>", "8", ")", "&", "0xff", ")", ";", "packet", "[", "3", "]", "=", "(", "byte", ")", "(", "length", "&", "0xff", ")", ";", "packet", "[", "4", "]", "=", "(", "byte", ")", "type", ";", "System", ".", "arraycopy", "(", "value", ".", "getBytes", "(", ")", ",", "0", ",", "packet", ",", "5", ",", "length", ")", ";", "return", "packet", ";", "}", "}", "</s>" ]
1,594
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "ant", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "BuildException", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "Task", ";", "import", "org", ".", "eclim", ".", "installer", ".", "step", ".", "command", ".", "Command", ";", "import", "org", ".", "eclim", ".", "installer", ".", "step", ".", "command", ".", "InstallCommand", ";", "public", "class", "InstallIUTask", "extends", "Task", "{", "private", "String", "repository", ";", "private", "String", "iu", ";", "public", "void", "execute", "(", ")", "throws", "BuildException", "{", "if", "(", "iu", "==", "null", "||", "repository", "==", "null", ")", "{", "throw", "new", "BuildException", "(", "\"\"", ")", ";", "}", "Command", "command", "=", "null", ";", "try", "{", "log", "(", "\"Installing", "\"", "+", "iu", "+", "\"...\"", ")", ";", "command", "=", "new", "InstallCommand", "(", "null", ",", "repository", ",", "iu", ",", "\"\"", ")", ";", "command", ".", "start", "(", ")", ";", "command", ".", "join", "(", ")", ";", "if", "(", "command", ".", "getReturnCode", "(", ")", "!=", "0", ")", "{", "throw", "new", "BuildException", "(", "\"error:", "\"", "+", "command", ".", "getErrorMessage", "(", ")", "+", "\"", "out:", "\"", "+", "command", ".", "getResult", "(", ")", ")", ";", "}", "}", "catch", "(", "BuildException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "BuildException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "command", "!=", "null", ")", "{", "command", ".", "destroy", "(", ")", ";", "}", "}", "}", "public", "void", "setRepository", "(", "String", "repository", ")", "{", "this", ".", "repository", "=", "repository", ";", "}", "public", "void", "setIU", "(", "String", "iu", ")", "{", "this", ".", "iu", "=", "iu", ";", "}", "}", "</s>" ]
1,595
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "ant", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FilenameFilter", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "BuildException", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "Project", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "ProjectComponent", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "taskdefs", ".", "condition", ".", "Condition", ";", "import", "org", ".", "eclim", ".", "installer", ".", "step", ".", "EclipseInfo", ";", "import", "org", ".", "formic", ".", "Installer", ";", "public", "class", "IsInstalled", "extends", "ProjectComponent", "implements", "Condition", "{", "private", "String", "feature", ";", "public", "boolean", "eval", "(", ")", "throws", "BuildException", "{", "if", "(", "feature", "==", "null", ")", "{", "throw", "new", "BuildException", "(", "\"\"", ")", ";", "}", "EclipseInfo", "info", "=", "(", "EclipseInfo", ")", "Installer", ".", "getContext", "(", ")", ".", "getValue", "(", "\"eclipse.info\"", ")", ";", "if", "(", "info", "!=", "null", "&&", "info", ".", "hasFeature", "(", "feature", ")", ")", "{", "return", "true", ";", "}", "Project", "project", "=", "Installer", ".", "getProject", "(", ")", ";", "String", "[", "]", "names", "=", "new", "File", "(", "project", ".", "replaceProperties", "(", "\"\"", ")", ")", ".", "list", "(", "new", "FilenameFilter", "(", ")", "{", "public", "boolean", "accept", "(", "File", "dir", ",", "String", "name", ")", "{", "return", "name", ".", "startsWith", "(", "feature", "+", "\"_\"", ")", ";", "}", "}", ")", ";", "return", "names", "!=", "null", "&&", "names", ".", "length", ">", "0", ";", "}", "public", "void", "setFeature", "(", "String", "feature", ")", "{", "this", ".", "feature", "=", "feature", ";", "}", "}", "</s>" ]
1,596
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "ant", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "BuildException", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "MagicNames", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "Task", ";", "import", "org", ".", "eclim", ".", "installer", ".", "step", ".", "EclipseInfo", ";", "import", "org", ".", "eclim", ".", "installer", ".", "step", ".", "FeatureProvider", ";", "import", "org", ".", "formic", ".", "Installer", ";", "import", "org", ".", "formic", ".", "wizard", ".", "step", ".", "shared", ".", "Feature", ";", "public", "class", "UnattendedInstallTask", "extends", "Task", "{", "public", "void", "execute", "(", ")", "throws", "BuildException", "{", "boolean", "uninstall", "=", "false", ";", "if", "(", "Installer", ".", "getProject", "(", ")", "==", "null", ")", "{", "Installer", ".", "setProject", "(", "getProject", "(", ")", ")", ";", "String", "targets", "=", "getProject", "(", ")", ".", "getProperty", "(", "MagicNames", ".", "PROJECT_INVOKED_TARGETS", ")", ";", "uninstall", "=", "\"uninstall\"", ".", "equals", "(", "targets", ")", ";", "}", "else", "{", "uninstall", "=", "Installer", ".", "isUninstall", "(", ")", ";", "}", "EclipseInfo", "info", "=", "(", "EclipseInfo", ")", "Installer", ".", "getContext", "(", ")", ".", "getValue", "(", "\"eclipse.info\"", ")", ";", "if", "(", "info", "==", "null", ")", "{", "try", "{", "log", "(", "\"\"", ")", ";", "if", "(", "EclipseInfo", ".", "installInstallerPlugin", "(", ")", ")", "{", "log", "(", "\"\"", ")", ";", "info", "=", "EclipseInfo", ".", "gatherEclipseInfo", "(", ")", ";", "log", "(", "\"\"", ")", ";", "Installer", ".", "getContext", "(", ")", ".", "setValue", "(", "\"eclipse.info\"", ",", "info", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "BuildException", "(", "e", ")", ";", "}", "if", "(", "!", "uninstall", ")", "{", "FeatureProvider", "provider", "=", "new", "FeatureProvider", "(", ")", ";", "Feature", "[", "]", "features", "=", "provider", ".", "getFeatures", "(", ")", ";", "HashMap", "<", "String", ",", "Feature", ">", "featureMap", "=", "new", "HashMap", "<", "String", ",", "Feature", ">", "(", ")", ";", "for", "(", "Feature", "feature", ":", "features", ")", "{", "featureMap", ".", "put", "(", "feature", ".", "getKey", "(", ")", ",", "feature", ")", ";", "}", "log", "(", "\"\"", ")", ";", "for", "(", "Feature", "feature", ":", "features", ")", "{", "boolean", "enabled", "=", "feature", ".", "isEnabled", "(", ")", ";", "if", "(", "\"python\"", ".", "equals", "(", "feature", ".", "getKey", "(", ")", ")", ")", "{", "enabled", "=", "\"true\"", ".", "equals", "(", "Installer", ".", "getContext", "(", ")", ".", "getValue", "(", "\"\"", ")", ")", ";", "}", "if", "(", "enabled", ")", "{", "enabled", "=", "dependenciesEnabled", "(", "feature", ",", "featureMap", ")", ";", "}", "Installer", ".", "getContext", "(", ")", ".", "setValue", "(", "\"featureList.\"", "+", "feature", ".", "getKey", "(", ")", ",", "enabled", ")", ";", "if", "(", "enabled", ")", "{", "log", "(", "\"", "\"", "+", "feature", ".", "getKey", "(", ")", ")", ";", "}", "}", "}", "}", "}", "private", "boolean", "dependenciesEnabled", "(", "Feature", "feature", ",", "HashMap", "<", "String", ",", "Feature", ">", "featureMap", ")", "{", "boolean", "enabled", "=", "true", ";", "String", "[", "]", "dependencies", "=", "feature", ".", "getDependencies", "(", ")", ";", "if", "(", "dependencies", "!=", "null", ")", "{", "for", "(", "String", "dep", ":", "dependencies", ")", "{", "Feature", "dependency", "=", "featureMap", ".", "get", "(", "dep", ")", ";", "if", "(", "!", "dependency", ".", "isEnabled", "(", ")", "||", "!", "dependenciesEnabled", "(", "dependency", ",", "featureMap", ")", ")", "{", "enabled", "=", "false", ";", "break", ";", "}", "}", "}", "return", "enabled", ";", "}", "}", "</s>" ]
1,597
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "step", ";", "import", "java", ".", "awt", ".", "Component", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "javax", ".", "swing", ".", "JFileChooser", ";", "import", "javax", ".", "swing", ".", "JLabel", ";", "import", "javax", ".", "swing", ".", "JPanel", ";", "import", "org", ".", "apache", ".", "commons", ".", "io", ".", "FilenameUtils", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "SystemUtils", ";", "import", "org", ".", "apache", ".", "tools", ".", "ant", ".", "taskdefs", ".", "condition", ".", "Os", ";", "import", "org", ".", "formic", ".", "Installer", ";", "import", "org", ".", "formic", ".", "wizard", ".", "form", ".", "GuiForm", ";", "import", "org", ".", "formic", ".", "wizard", ".", "form", ".", "Validator", ";", "import", "org", ".", "formic", ".", "wizard", ".", "form", ".", "gui", ".", "component", ".", "FileChooser", ";", "import", "org", ".", "formic", ".", "wizard", ".", "form", ".", "validator", ".", "ValidatorBuilder", ";", "import", "org", ".", "formic", ".", "wizard", ".", "step", ".", "AbstractGuiStep", ";", "import", "net", ".", "miginfocom", ".", "swing", ".", "MigLayout", ";", "public", "class", "EclipseStep", "extends", "AbstractGuiStep", "{", "private", "static", "final", "String", "[", "]", "WINDOWS_ECLIPSES", "=", "{", "\"C:/eclipse\"", ",", "\"\"", ",", "\"\"", ",", "}", ";", "private", "static", "final", "String", "[", "]", "UNIX_ECLIPSES", "=", "{", "\"/opt/eclipse\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "SystemUtils", ".", "USER_HOME", "+", "\"/eclipse\"", ",", "\"\"", ",", "}", ";", "private", "FileChooser", "eclipseHomeChooser", ";", "public", "EclipseStep", "(", "String", "name", ",", "Properties", "properties", ")", "{", "super", "(", "name", ",", "properties", ")", ";", "}", "public", "Component", "init", "(", ")", "{", "final", "JPanel", "panel", "=", "new", "JPanel", "(", "new", "MigLayout", "(", "\"\"", ",", "\"\"", ")", ")", ";", "GuiForm", "form", "=", "createForm", "(", ")", ";", "String", "home", "=", "fieldName", "(", "\"home\"", ")", ";", "eclipseHomeChooser", "=", "new", "FileChooser", "(", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "panel", ".", "add", "(", "form", ".", "createMessagePanel", "(", ")", ",", "\"span\"", ")", ";", "panel", ".", "add", "(", "new", "JLabel", "(", "Installer", ".", "getString", "(", "home", ")", ")", ")", ";", "panel", ".", "add", "(", "eclipseHomeChooser", ")", ";", "form", ".", "bind", "(", "home", ",", "eclipseHomeChooser", ".", "getTextField", "(", ")", ",", "new", "ValidatorBuilder", "(", ")", ".", "required", "(", ")", ".", "isDirectory", "(", ")", ".", "validator", "(", "new", "EclipseHomeValidator", "(", ")", ")", ".", "validator", "(", ")", ")", ";", "String", "eclipseHomeDefault", "=", "getDefaultEclipseHome", "(", ")", ";", "eclipseHomeChooser", ".", "getTextField", "(", ")", ".", "setText", "(", "eclipseHomeDefault", ")", ";", "return", "panel", ";", "}", "public", "void", "displayed", "(", ")", "{", "eclipseHomeChooser", ".", "getTextField", "(", ")", ".", "requestFocus", "(", ")", ";", "}", "public", "boolean", "proceed", "(", ")", "{", "boolean", "proceed", "=", "super", ".", "proceed", "(", ")", ";", "String", "home", "=", "(", "String", ")", "Installer", ".", "getContext", "(", ")", ".", "getValue", "(", "\"eclipse.home\"", ")", ";", "home", "=", "FilenameUtils", ".", "normalizeNoEndSeparator", "(", "home", ")", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ";", "Installer", ".", "getContext", "(", ")", ".", "setValue", "(", "\"eclipse.home\"", ",", "home", ")", ";", "return", "proceed", ";", "}", "private", "String", "getDefaultEclipseHome", "(", ")", "{", "String", "home", "=", "Installer", ".", "getEnvironmentVariable", "(", "\"ECLIPSE_HOME\"", ")", ";", "if", "(", "home", "==", "null", "||", "home", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "if", "(", "Os", ".", "isFamily", "(", "Os", ".", "FAMILY_WINDOWS", ")", ")", "{", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "WINDOWS_ECLIPSES", ".", "length", ";", "ii", "++", ")", "{", "if", "(", "new", "File", "(", "WINDOWS_ECLIPSES", "[", "ii", "]", ")", ".", "exists", "(", ")", ")", "{", "home", "=", "WINDOWS_ECLIPSES", "[", "ii", "]", ";", "break", ";", "}", "}", "}", "else", "{", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "UNIX_ECLIPSES", ".", "length", ";", "ii", "++", ")", "{", "if", "(", "new", "File", "(", "UNIX_ECLIPSES", "[", "ii", "]", ")", ".", "exists", "(", ")", ")", "{", "home", "=", "UNIX_ECLIPSES", "[", "ii", "]", ";", "break", ";", "}", "}", "}", "}", "return", "home", ";", "}", "private", "class", "EclipseHomeValidator", "implements", "Validator", "{", "public", "boolean", "isValid", "(", "Object", "value", ")", "{", "String", "folder", "=", "(", "String", ")", "value", ";", "if", "(", "folder", "!=", "null", "&&", "folder", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "File", "plugins", "=", "new", "File", "(", "FilenameUtils", ".", "concat", "(", "folder", ",", "\"plugins\"", ")", ")", ";", "if", "(", "plugins", ".", "exists", "(", ")", "&&", "plugins", ".", "isDirectory", "(", ")", ")", "{", "return", "EclipseUtils", ".", "findEclipseLauncherJar", "(", "folder", ")", "!=", "null", ";", "}", "}", "return", "false", ";", "}", "public", "String", "getErrorMessage", "(", ")", "{", "return", "getName", "(", ")", "+", "\"\"", ";", "}", "}", "}", "</s>" ]
1,598
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "step", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "org", ".", "formic", ".", "Installer", ";", "import", "org", ".", "formic", ".", "wizard", ".", "step", ".", "gui", ".", "InstallStep", ";", "import", "foxtrot", ".", "Worker", ";", "public", "class", "EclipseInfoStep", "extends", "InstallStep", "{", "public", "EclipseInfoStep", "(", "String", "name", ",", "Properties", "properties", ")", "{", "super", "(", "name", ",", "properties", ")", ";", "}", "public", "void", "displayed", "(", ")", "{", "setBusy", "(", "true", ")", ";", "setPreviousEnabled", "(", "false", ")", ";", "EclipseInfo", "info", "=", "null", ";", "try", "{", "overallLabel", ".", "setText", "(", "\"\"", ")", ";", "overallProgress", ".", "setValue", "(", "0", ")", ";", "taskLabel", ".", "setText", "(", "\"\"", ")", ";", "taskProgress", ".", "setValue", "(", "0", ")", ";", "taskProgress", ".", "setIndeterminate", "(", "true", ")", ";", "info", "=", "(", "EclipseInfo", ")", "Worker", ".", "post", "(", "new", "foxtrot", ".", "Task", "(", ")", "{", "public", "Object", "run", "(", ")", "throws", "Exception", "{", "overallLabel", ".", "setText", "(", "\"\"", ")", ";", "if", "(", "EclipseInfo", ".", "installInstallerPlugin", "(", ")", ")", "{", "overallProgress", ".", "setMaximum", "(", "2", ")", ";", "overallProgress", ".", "setValue", "(", "1", ")", ";", "overallLabel", ".", "setText", "(", "\"\"", ")", ";", "EclipseInfo", "info", "=", "EclipseInfo", ".", "gatherEclipseInfo", "(", ")", ";", "overallLabel", ".", "setText", "(", "\"\"", ")", ";", "overallProgress", ".", "setValue", "(", "2", ")", ";", "taskProgress", ".", "setIndeterminate", "(", "false", ")", ";", "taskProgress", ".", "setMaximum", "(", "1", ")", ";", "taskProgress", ".", "setValue", "(", "1", ")", ";", "return", "info", ";", "}", "return", "null", ";", "}", "}", ")", ";", "Installer", ".", "getContext", "(", ")", ".", "setValue", "(", "\"eclipse.info\"", ",", "info", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "setError", "(", "e", ")", ";", "}", "finally", "{", "setValid", "(", "info", "!=", "null", ")", ";", "setBusy", "(", "false", ")", ";", "taskProgress", ".", "setIndeterminate", "(", "false", ")", ";", "}", "}", "}", "</s>" ]
1,599
[ "<s>", "package", "org", ".", "eclim", ".", "installer", ".", "step", ";", "import", "java", ".", "util", ".", "Properties", ";", "public", "class", "FeatureListStep", "extends", "org", ".", "formic", ".", "wizard", ".", "step", ".", "gui", ".", "FeatureListStep", "{", "public", "FeatureListStep", "(", "String", "name", ",", "Properties", "properties", ")", "{", "super", "(", "name", ",", "properties", ")", ";", "setPreviousEnabled", "(", "false", ")", ";", "}", "}", "</s>" ]