id
int32
0
12.9k
code
sequencelengths
2
264k
1,900
[ "<s>", "package", "org", ".", "agetac", ".", "handler", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "public", "interface", "IHandler", "{", "public", "void", "handle", "(", "IEntity", "e", ")", ";", "}", "</s>" ]
1,901
[ "<s>", "package", "org", ".", "agetac", ".", "entity", ";", "import", "java", ".", "io", ".", "Serializable", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "IModel", ";", "import", "org", ".", "agetac", ".", "entity", ".", "Entity", ".", "EntityState", ";", "import", "org", ".", "agetac", ".", "view", ".", "IPictogram", ";", "import", "org", ".", "osmdroid", ".", "api", ".", "IGeoPoint", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "MapView", ";", "import", "android", ".", "graphics", ".", "Canvas", ";", "public", "interface", "IEntity", "extends", "Serializable", "{", "public", "IModel", "getModel", "(", ")", ";", "public", "IPictogram", "getPictogram", "(", ")", ";", "public", "IGeoPoint", "getGeoPoint", "(", ")", ";", "public", "boolean", "isCloseTo", "(", "IGeoPoint", "pt", ",", "int", "precision", ")", ";", "public", "IEntity", "clone", "(", ")", ";", "public", "EntityState", "getState", "(", ")", ";", "public", "void", "draw", "(", "Canvas", "canvas", ",", "MapView", "mapV", ",", "boolean", "shadow", ")", ";", "public", "void", "setModel", "(", "IModel", "model", ")", ";", "public", "void", "setState", "(", "EntityState", "s", ")", ";", "}", "</s>" ]
1,902
[ "<s>", "package", "org", ".", "agetac", ".", "entity", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "IModel", ";", "public", "class", "EntityList", "extends", "ArrayList", "<", "IEntity", ">", "{", "private", "static", "final", "long", "serialVersionUID", "=", "6192402122463398955L", ";", "public", "<", "T", "extends", "IModel", ">", "IEntity", "find", "(", "long", "uid", ",", "Class", "<", "T", ">", "theModel", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "get", "(", "i", ")", ".", "getModel", "(", ")", ".", "getClass", "(", ")", "==", "theModel", ")", "{", "if", "(", "get", "(", "i", ")", ".", "getModel", "(", ")", ".", "getId", "(", ")", "==", "(", "uid", ")", ")", "{", "return", "get", "(", "i", ")", ";", "}", "}", "}", "return", "null", ";", "}", "}", "</s>" ]
1,903
[ "<s>", "package", "org", ".", "agetac", ".", "entity", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "ActionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "AgentDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "BarrackDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "GroupDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "IModel", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "InterventionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "PositionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "SourceDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "TargetDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDemandDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VictimDTO", ";", "import", "org", ".", "agetac", ".", "view", ".", "IPictogram", ";", "import", "org", ".", "osmdroid", ".", "api", ".", "IGeoPoint", ";", "import", "org", ".", "osmdroid", ".", "util", ".", "GeoPoint", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "MapView", ";", "import", "android", ".", "graphics", ".", "Canvas", ";", "import", "android", ".", "graphics", ".", "Point", ";", "public", "class", "Entity", "implements", "IEntity", "{", "private", "static", "final", "long", "serialVersionUID", "=", "9102938L", ";", "private", "static", "final", "int", "EARTH_RADIUS_METERS", "=", "6378137", ";", "public", "enum", "EntityState", "{", "ON_SITAC", ",", "OFF_SITAC", "}", "private", "IModel", "model", ";", "private", "IPictogram", "picto", ";", "private", "IGeoPoint", "geoP", ";", "private", "EntityState", "state", ";", "public", "Entity", "(", "IModel", "model", ",", "IPictogram", "picto", ",", "EntityState", "state", ")", "{", "this", ".", "model", "=", "model", ";", "this", ".", "picto", "=", "picto", ";", "this", ".", "state", "=", "state", ";", "if", "(", "model", "==", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "model", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "if", "(", "model", ".", "getPosition", "(", ")", "==", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "model", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "model", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "}", "}", "int", "latE6", "=", "(", "int", ")", "model", ".", "getPosition", "(", ")", ".", "getLatitude", "(", ")", ";", "int", "longE6", "=", "(", "int", ")", "model", ".", "getPosition", "(", ")", ".", "getLongitude", "(", ")", ";", "this", ".", "geoP", "=", "new", "GeoPoint", "(", "latE6", ",", "longE6", ")", ";", "}", "@", "Override", "public", "IGeoPoint", "getGeoPoint", "(", ")", "{", "return", "geoP", ";", "}", "@", "Override", "public", "IModel", "getModel", "(", ")", "{", "return", "model", ";", "}", "@", "Override", "public", "IPictogram", "getPictogram", "(", ")", "{", "return", "picto", ";", "}", "@", "Override", "public", "IEntity", "clone", "(", ")", "{", "if", "(", "model", "instanceof", "ActionDTO", ")", "{", "return", "new", "Entity", "(", "new", "ActionDTO", "(", "new", "PositionDTO", "(", "model", ".", "getPosition", "(", ")", ")", ",", "(", "(", "ActionDTO", ")", "model", ")", ".", "getType", "(", ")", ",", "new", "PositionDTO", "(", "(", "(", "ActionDTO", ")", "model", ")", ".", "getOrigin", "(", ")", ")", ",", "new", "PositionDTO", "(", "(", "(", "ActionDTO", ")", "model", ")", ".", "getAim", "(", ")", ")", ")", ",", "picto", ".", "clone", "(", ")", ",", "state", ")", ";", "}", "else", "if", "(", "model", "instanceof", "AgentDTO", ")", "{", "}", "else", "if", "(", "model", "instanceof", "BarrackDTO", ")", "{", "}", "else", "if", "(", "model", "instanceof", "TargetDTO", ")", "{", "return", "new", "Entity", "(", "new", "TargetDTO", "(", "new", "PositionDTO", "(", "model", ".", "getPosition", "(", ")", ")", ",", "(", "(", "TargetDTO", ")", "model", ")", ".", "getType", "(", ")", ")", ",", "picto", ".", "clone", "(", ")", ",", "state", ")", ";", "}", "else", "if", "(", "model", "instanceof", "VehicleDemandDTO", ")", "{", "return", "new", "Entity", "(", "new", "VehicleDemandDTO", "(", "model", ".", "getName", "(", ")", ",", "new", "PositionDTO", "(", "model", ".", "getPosition", "(", ")", ")", ",", "(", "(", "VehicleDemandDTO", ")", "model", ")", ".", "getState", "(", ")", ",", "(", "(", "VehicleDemandDTO", ")", "model", ")", ".", "getGroup", "(", ")", ")", ",", "picto", ".", "clone", "(", ")", ",", "state", ")", ";", "}", "else", "if", "(", "model", "instanceof", "GroupDTO", ")", "{", "}", "else", "if", "(", "model", "instanceof", "VictimDTO", ")", "{", "}", "else", "if", "(", "model", "instanceof", "InterventionDTO", ")", "{", "}", "else", "if", "(", "model", "instanceof", "SourceDTO", ")", "{", "return", "new", "Entity", "(", "new", "SourceDTO", "(", "new", "PositionDTO", "(", "model", ".", "getPosition", "(", ")", ")", ",", "(", "(", "SourceDTO", ")", "model", ")", ".", "getType", "(", ")", ")", ",", "picto", ".", "clone", "(", ")", ",", "state", ")", ";", "}", "else", "if", "(", "model", "instanceof", "VehicleDTO", ")", "{", "return", "new", "Entity", "(", "new", "VehicleDTO", "(", "new", "PositionDTO", "(", "model", ".", "getPosition", "(", ")", ")", ",", "(", "(", "VehicleDTO", ")", "model", ")", ".", "getType", "(", ")", ",", "(", "(", "VehicleDTO", ")", "model", ")", ".", "getBarrackName", "(", ")", ",", "(", "(", "VehicleDTO", ")", "model", ")", ".", "getState", "(", ")", ",", "(", "(", "VehicleDTO", ")", "model", ")", ".", "getGroup", "(", ")", ",", "\"Tsoin", "tsoin\"", ")", ",", "picto", ".", "clone", "(", ")", ",", "state", ")", ";", "}", "return", "null", ";", "}", "@", "Override", "public", "EntityState", "getState", "(", ")", "{", "return", "state", ";", "}", "@", "Override", "public", "void", "setState", "(", "EntityState", "state", ")", "{", "this", ".", "state", "=", "state", ";", "}", "@", "Override", "public", "boolean", "isCloseTo", "(", "IGeoPoint", "pt", ",", "int", "precision", ")", "{", "double", "distance", "=", "getDistanceInMeter", "(", "geoP", ",", "pt", ")", ";", "return", "(", "distance", "<=", "precision", ")", ";", "}", "@", "Override", "public", "void", "draw", "(", "Canvas", "canvas", ",", "MapView", "mapV", ",", "boolean", "shadow", ")", "{", "Point", "p", ";", "p", "=", "mapV", ".", "getProjection", "(", ")", ".", "toMapPixels", "(", "geoP", ",", "null", ")", ";", "picto", ".", "draw", "(", "canvas", ",", "p", ",", "shadow", ",", "mapV", ".", "getProjection", "(", ")", ")", ";", "}", "@", "Override", "public", "void", "setModel", "(", "IModel", "model", ")", "{", "this", ".", "model", "=", "model", ";", "int", "latE6", "=", "(", "int", ")", "model", ".", "getPosition", "(", ")", ".", "getLatitude", "(", ")", ";", "int", "longE6", "=", "(", "int", ")", "model", ".", "getPosition", "(", ")", ".", "getLongitude", "(", ")", ";", "this", ".", "geoP", "=", "new", "GeoPoint", "(", "latE6", ",", "longE6", ")", ";", "if", "(", "latE6", "!=", "0", "&&", "longE6", "!=", "0", ")", "{", "state", "=", "EntityState", ".", "ON_SITAC", ";", "}", "}", "public", "static", "double", "getDistanceInMeter", "(", "final", "IGeoPoint", "src", ",", "IGeoPoint", "dest", ")", "{", "double", "distance", "=", "0", ";", "double", "srcLat", "=", "src", ".", "getLatitudeE6", "(", ")", "*", "(", "1E-6", ")", ";", "double", "srcLong", "=", "src", ".", "getLongitudeE6", "(", ")", "*", "(", "1E-6", ")", ";", "double", "destLat", "=", "dest", ".", "getLatitudeE6", "(", ")", "*", "(", "1E-6", ")", ";", "double", "destLong", "=", "dest", ".", "getLongitudeE6", "(", ")", "*", "(", "1E-6", ")", ";", "double", "rlo1", "=", "Math", ".", "toRadians", "(", "srcLong", ")", ";", "double", "rla1", "=", "Math", ".", "toRadians", "(", "srcLat", ")", ";", "double", "rlo2", "=", "Math", ".", "toRadians", "(", "destLong", ")", ";", "double", "rla2", "=", "Math", ".", "toRadians", "(", "destLat", ")", ";", "double", "dlo", "=", "(", "rlo2", "-", "rlo1", ")", "/", "2", ";", "double", "dla", "=", "(", "rla2", "-", "rla1", ")", "/", "2", ";", "double", "angle", "=", "(", "Math", ".", "sin", "(", "dla", ")", "*", "Math", ".", "sin", "(", "dla", ")", ")", "+", "Math", ".", "cos", "(", "rla1", ")", "*", "Math", ".", "cos", "(", "rla2", ")", "*", "(", "Math", ".", "sin", "(", "dlo", ")", "*", "Math", ".", "sin", "(", "dlo", ")", ")", ";", "distance", "=", "EARTH_RADIUS_METERS", "*", "(", "2", "*", "Math", ".", "atan2", "(", "Math", ".", "sqrt", "(", "angle", ")", ",", "Math", ".", "sqrt", "(", "1", "-", "angle", ")", ")", ")", ";", "return", "distance", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"[\"", "+", "state", ".", "name", "(", ")", "+", "\"]", "\"", "+", "model", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
1,904
[ "<s>", "package", "org", ".", "agetac", ".", "entity", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "ActionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "GroupDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "IModel", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "SourceDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "SourceDTO", ".", "SourceType", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "TargetDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "TargetDTO", ".", "TargetType", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDemandDTO", ";", "import", "org", ".", "agetac", ".", "entity", ".", "Entity", ".", "EntityState", ";", "import", "org", ".", "agetac", ".", "view", ".", "Color", ";", "import", "org", ".", "agetac", ".", "view", ".", "GraphicalOverload", ";", "import", "org", ".", "agetac", ".", "view", ".", "LinePicto", ";", "import", "org", ".", "agetac", ".", "view", ".", "Pictogram", ";", "import", "org", ".", "agetac", ".", "view", ".", "Shape", ";", "import", "org", ".", "agetac", ".", "view", ".", "State", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "res", ".", "Resources", ";", "import", "android", ".", "graphics", ".", "BitmapFactory", ";", "import", "android", ".", "graphics", ".", "BitmapFactory", ".", "Options", ";", "import", "android", ".", "graphics", ".", "Point", ";", "public", "class", "EntityHolder", "{", "public", "static", "final", "String", "RED_UP", "=", "\"\"", ";", "public", "static", "final", "String", "RED_DOWN", "=", "\"red_down\"", ";", "public", "static", "final", "String", "GREEN_UP", "=", "\"green_up\"", ";", "public", "static", "final", "String", "GREEN_DOWN", "=", "\"green_down\"", ";", "public", "static", "final", "String", "BLUE_UP", "=", "\"\"", ";", "public", "static", "final", "String", "BLUE_DOWN", "=", "\"blue_down\"", ";", "public", "static", "final", "String", "ORANGE_UP", "=", "\"\"", ";", "public", "static", "final", "String", "ORANGE_DOWN", "=", "\"orange_down\"", ";", "public", "static", "final", "String", "BLUE_NONE", "=", "\"blue_none\"", ";", "public", "static", "final", "String", "BLUE_GRP", "=", "\"blue_grp\"", ";", "public", "static", "final", "String", "BLUE_COL", "=", "\"blue_col\"", ";", "public", "static", "final", "String", "BLUE_ISOLE", "=", "\"blue_isole\"", ";", "public", "static", "final", "String", "GREEN_NONE", "=", "\"green_none\"", ";", "public", "static", "final", "String", "GREEN_GRP", "=", "\"green_grp\"", ";", "public", "static", "final", "String", "GREEN_COL", "=", "\"green_col\"", ";", "public", "static", "final", "String", "GREEN_ISOLE", "=", "\"green_isole\"", ";", "public", "static", "final", "String", "RED_DOTTED_SINGLE", "=", "\"\"", ";", "public", "static", "final", "String", "RED_DOTTED_NONE", "=", "\"\"", ";", "public", "static", "final", "String", "RED_NONE", "=", "\"red_none\"", ";", "public", "static", "final", "String", "RED_GRP", "=", "\"red_grp\"", ";", "public", "static", "final", "String", "RED_COL", "=", "\"red_col\"", ";", "public", "static", "final", "String", "RED_ISOLE", "=", "\"red_isole\"", ";", "public", "static", "final", "String", "LINE", "=", "\"Ligne\"", ";", "public", "static", "final", "String", "POINT", "=", "\"Point\"", ";", "public", "static", "final", "String", "ZONE", "=", "\"Zone\"", ";", "private", "static", "EntityHolder", "instance", ";", "private", "Resources", "res", ";", "private", "ArrayList", "<", "IEntity", ">", "entities", ";", "private", "EntityHolder", "(", "Context", "context", ")", "{", "this", ".", "res", "=", "context", ".", "getResources", "(", ")", ";", "entities", "=", "new", "ArrayList", "<", "IEntity", ">", "(", ")", ";", "Options", "options", "=", "new", "Options", "(", ")", ";", "options", ".", "inPurgeable", "=", "false", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "SourceDTO", "(", "SourceType", ".", "FIRE", ")", ",", "new", "Pictogram", "(", "RED_UP", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_red_up", ",", "options", ")", ",", "Color", ".", "RED", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "TRIANGLE_UP", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "TargetDTO", "(", "TargetType", ".", "FIRE", ")", ",", "new", "Pictogram", "(", "RED_DOWN", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_red_down", ",", "options", ")", ",", "Color", ".", "RED", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "TRIANGLE_DOWN", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "TargetDTO", "(", "TargetType", ".", "HUMAN", ")", ",", "new", "Pictogram", "(", "GREEN_DOWN", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_green_down", ")", ",", "Color", ".", "GREEN", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "TRIANGLE_DOWN", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "SourceDTO", "(", "SourceType", ".", "CHEM", ")", ",", "new", "Pictogram", "(", "ORANGE_UP", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_orange_up", ")", ",", "Color", ".", "ORANGE", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "TRIANGLE_UP", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "TargetDTO", "(", "TargetType", ".", "CHEM", ")", ",", "new", "Pictogram", "(", "ORANGE_DOWN", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_orange_down", ")", ",", "Color", ".", "ORANGE", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "TRIANGLE_DOWN", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "SourceDTO", "(", "SourceType", ".", "WATER", ")", ",", "new", "Pictogram", "(", "BLUE_UP", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_blue_up", ")", ",", "Color", ".", "BLUE", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "TRIANGLE_UP", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "TargetDTO", "(", "TargetType", ".", "WATER", ")", ",", "new", "Pictogram", "(", "BLUE_DOWN", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_blue_down", ")", ",", "Color", ".", "BLUE", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "TRIANGLE_DOWN", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "VehicleDemandDTO", "(", ")", ",", "new", "Pictogram", "(", "BLUE_NONE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_blue_none", ")", ",", "Color", ".", "BLUE", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "VehicleDemandDTO", "(", ")", ",", "new", "Pictogram", "(", "BLUE_ISOLE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_blue_isole", ")", ",", "Color", ".", "BLUE", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "ISOLE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "GroupDTO", "(", ")", ",", "new", "Pictogram", "(", "BLUE_GRP", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_blue_grp", ")", ",", "Color", ".", "BLUE", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "GROUPE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "GroupDTO", "(", ")", ",", "new", "Pictogram", "(", "BLUE_COL", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_blue_col", ")", ",", "Color", ".", "BLUE", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "COLONNE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "VehicleDemandDTO", "(", ")", ",", "new", "Pictogram", "(", "GREEN_NONE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_green_none", ")", ",", "Color", ".", "GREEN", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "VehicleDemandDTO", "(", ")", ",", "new", "Pictogram", "(", "GREEN_ISOLE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_green_isole", ")", ",", "Color", ".", "GREEN", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "ISOLE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "GroupDTO", "(", ")", ",", "new", "Pictogram", "(", "GREEN_GRP", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_green_grp", ")", ",", "Color", ".", "GREEN", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "GROUPE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "GroupDTO", "(", ")", ",", "new", "Pictogram", "(", "GREEN_COL", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_green_col", ")", ",", "Color", ".", "GREEN", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "COLONNE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "VehicleDemandDTO", "(", ")", ",", "new", "Pictogram", "(", "RED_DOTTED_SINGLE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_red_dotted_isole", ")", ",", "Color", ".", "RED", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "ISOLE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "GroupDTO", "(", ")", ",", "new", "Pictogram", "(", "RED_DOTTED_NONE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_red_dotted_none", ")", ",", "Color", ".", "RED", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "VehicleDemandDTO", "(", ")", ",", "new", "Pictogram", "(", "RED_NONE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_red_none", ")", ",", "Color", ".", "RED", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "VehicleDemandDTO", "(", ")", ",", "new", "Pictogram", "(", "RED_ISOLE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_red_isole", ")", ",", "Color", ".", "RED", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "ISOLE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "GroupDTO", "(", ")", ",", "new", "Pictogram", "(", "RED_GRP", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_red_grp", ")", ",", "Color", ".", "RED", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "GROUPE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "GroupDTO", "(", ")", ",", "new", "Pictogram", "(", "RED_COL", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_red_col", ")", ",", "Color", ".", "RED", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "SQUARE", ",", "GraphicalOverload", ".", "COLONNE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "ActionDTO", "(", ")", ",", "new", "LinePicto", "(", "LINE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_line", ")", ",", "Color", ".", "BLACK", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "LINEAR_SHAPE", ",", "GraphicalOverload", ".", "NONE", ",", "new", "Point", "(", "0", ",", "0", ")", ",", "new", "Point", "(", "0", ",", "0", ")", ",", "1", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "SourceDTO", "(", ")", ",", "new", "Pictogram", "(", "POINT", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_point", ")", ",", "Color", ".", "BLACK", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "CIRCLE", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "new", "SourceDTO", "(", ")", ",", "new", "Pictogram", "(", "ZONE", ",", "BitmapFactory", ".", "decodeResource", "(", "res", ",", "R", ".", "drawable", ".", "picto_zone", ")", ",", "Color", ".", "BLACK", ",", "State", ".", "STATE_HAPPENING", ",", "Shape", ".", "STAR_SHAPE", ",", "GraphicalOverload", ".", "NONE", ")", ",", "EntityState", ".", "OFF_SITAC", ")", ")", ";", "}", "public", "static", "EntityHolder", "getInstance", "(", "Context", "context", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "instance", "=", "new", "EntityHolder", "(", "context", ")", ";", "}", "return", "instance", ";", "}", "public", "ArrayList", "<", "IEntity", ">", "getEntities", "(", ")", "{", "return", "entities", ";", "}", "public", "ArrayList", "<", "IEntity", ">", "getEntities", "(", "Shape", "s", ")", "{", "ArrayList", "<", "IEntity", ">", "list", "=", "new", "ArrayList", "<", "IEntity", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entities", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "entities", ".", "get", "(", "i", ")", ".", "getPictogram", "(", ")", ".", "getShape", "(", ")", "==", "s", ")", "list", ".", "add", "(", "entities", ".", "get", "(", "i", ")", ")", ";", "}", "return", "list", ";", "}", "public", "ArrayList", "<", "IEntity", ">", "getEntities", "(", "Color", "c", ")", "{", "ArrayList", "<", "IEntity", ">", "list", "=", "new", "ArrayList", "<", "IEntity", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entities", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "entities", ".", "get", "(", "i", ")", ".", "getPictogram", "(", ")", ".", "getColor", "(", ")", "==", "c", ")", "list", ".", "add", "(", "entities", ".", "get", "(", "i", ")", ")", ";", "}", "return", "list", ";", "}", "public", "ArrayList", "<", "IEntity", ">", "getEntities", "(", "State", "s", ")", "{", "ArrayList", "<", "IEntity", ">", "list", "=", "new", "ArrayList", "<", "IEntity", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entities", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "entities", ".", "get", "(", "i", ")", ".", "getPictogram", "(", ")", ".", "getState", "(", ")", "==", "s", ")", "list", ".", "add", "(", "entities", ".", "get", "(", "i", ")", ")", ";", "}", "return", "list", ";", "}", "public", "ArrayList", "<", "IEntity", ">", "getEntities", "(", "GraphicalOverload", "go", ")", "{", "ArrayList", "<", "IEntity", ">", "list", "=", "new", "ArrayList", "<", "IEntity", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entities", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "entities", ".", "get", "(", "i", ")", ".", "getPictogram", "(", ")", ".", "getGraphicalOverload", "(", ")", "==", "go", ")", "list", ".", "add", "(", "entities", ".", "get", "(", "i", ")", ")", ";", "}", "return", "list", ";", "}", "public", "String", "[", "]", "getEntitiesName", "(", ")", "{", "String", "[", "]", "names", "=", "new", "String", "[", "entities", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entities", ".", "size", "(", ")", ";", "i", "++", ")", "{", "names", "[", "i", "]", "=", "entities", ".", "get", "(", "i", ")", ".", "getPictogram", "(", ")", ".", "getName", "(", ")", ";", "}", "return", "names", ";", "}", "public", "IEntity", "getEntity", "(", "String", "name", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entities", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "entities", ".", "get", "(", "i", ")", ".", "getPictogram", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", ")", "return", "entities", ".", "get", "(", "i", ")", ";", "}", "return", "null", ";", "}", "public", "IEntity", "generateEntity", "(", "IModel", "model", ")", "{", "IEntity", "ent", "=", "getEntity", "(", "EntityHolder", ".", "RED_ISOLE", ")", ".", "clone", "(", ")", ";", "if", "(", "model", "instanceof", "VehicleDTO", ")", "{", "switch", "(", "(", "(", "VehicleDTO", ")", "model", ")", ".", "getType", "(", ")", ")", "{", "case", "FPT", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "RED_ISOLE", ")", ".", "clone", "(", ")", ";", "break", ";", "case", "VSAV", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "GREEN_ISOLE", ")", ".", "clone", "(", ")", ";", "break", ";", "}", "}", "else", "if", "(", "model", "instanceof", "SourceDTO", ")", "{", "switch", "(", "(", "(", "SourceDTO", ")", "model", ")", ".", "getType", "(", ")", ")", "{", "case", "CHEM", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "ORANGE_UP", ")", ".", "clone", "(", ")", ";", "break", ";", "case", "WATER", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "BLUE_UP", ")", ".", "clone", "(", ")", ";", "break", ";", "case", "FIRE", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "RED_UP", ")", ".", "clone", "(", ")", ";", "break", ";", "}", "}", "else", "if", "(", "model", "instanceof", "TargetDTO", ")", "{", "switch", "(", "(", "(", "TargetDTO", ")", "model", ")", ".", "getType", "(", ")", ")", "{", "case", "CHEM", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "ORANGE_DOWN", ")", ".", "clone", "(", ")", ";", "break", ";", "case", "WATER", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "BLUE_DOWN", ")", ".", "clone", "(", ")", ";", "break", ";", "case", "FIRE", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "RED_DOWN", ")", ".", "clone", "(", ")", ";", "break", ";", "case", "HUMAN", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "GREEN_DOWN", ")", ".", "clone", "(", ")", ";", "break", ";", "}", "}", "else", "if", "(", "model", "instanceof", "VehicleDemandDTO", ")", "{", "switch", "(", "(", "(", "VehicleDemandDTO", ")", "model", ")", ".", "getType", "(", ")", ")", "{", "case", "FPT", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "RED_ISOLE", ")", ".", "clone", "(", ")", ";", "break", ";", "case", "VSAV", ":", "ent", "=", "getEntity", "(", "EntityHolder", ".", "GREEN_ISOLE", ")", ".", "clone", "(", ")", ";", "break", ";", "}", "}", "if", "(", "model", ".", "getPosition", "(", ")", ".", "getLatitude", "(", ")", "==", "0", "&&", "model", ".", "getPosition", "(", ")", ".", "getLongitude", "(", ")", "==", "0", ")", "{", "ent", ".", "setState", "(", "EntityState", ".", "OFF_SITAC", ")", ";", "}", "else", "{", "ent", ".", "setState", "(", "EntityState", ".", "ON_SITAC", ")", ";", "}", "ent", ".", "setModel", "(", "model", ")", ";", "return", "ent", ";", "}", "}", "</s>" ]
1,905
[ "<s>", "package", "org", ".", "agetac", ".", "command", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ";", "import", "org", ".", "agetac", ".", "engine", ".", "IInterventionEngine", ";", "import", "org", ".", "agetac", ".", "memento", ".", "IMemento", ";", "public", "class", "EditEntityCommand", "implements", "IRecordableCommand", "{", "public", "static", "final", "String", "NAME", "=", "\"EditEntity\"", ";", "private", "IInterventionEngine", "engine", ";", "private", "Controller", "controller", ";", "public", "EditEntityCommand", "(", "Controller", "controller", ")", "{", "this", ".", "controller", "=", "controller", ";", "this", ".", "engine", "=", "controller", ".", "getInterventionEngine", "(", ")", ";", "}", "@", "Override", "public", "void", "execute", "(", ")", "{", "engine", ".", "editEntity", "(", "controller", ".", "getLastEntity", "(", ")", ")", ";", "}", "@", "Override", "public", "IMemento", "saveMemento", "(", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "void", "restoreMemento", "(", "IMemento", "mem", ")", "{", "}", "}", "</s>" ]
1,906
[ "<s>", "package", "org", ".", "agetac", ".", "command", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ";", "import", "org", ".", "agetac", ".", "engine", ".", "IInterventionEngine", ";", "import", "org", ".", "agetac", ".", "memento", ".", "IMemento", ";", "public", "class", "AddEntityCommand", "implements", "IRecordableCommand", "{", "public", "static", "final", "String", "NAME", "=", "\"AddEntity\"", ";", "private", "IInterventionEngine", "engine", ";", "private", "Controller", "controller", ";", "public", "AddEntityCommand", "(", "Controller", "controller", ")", "{", "this", ".", "controller", "=", "controller", ";", "this", ".", "engine", "=", "controller", ".", "getInterventionEngine", "(", ")", ";", "}", "@", "Override", "public", "void", "execute", "(", ")", "{", "engine", ".", "addEntity", "(", "controller", ".", "getLastEntity", "(", ")", ")", ";", "}", "@", "Override", "public", "IMemento", "saveMemento", "(", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "void", "restoreMemento", "(", "IMemento", "mem", ")", "{", "}", "}", "</s>" ]
1,907
[ "<s>", "package", "org", ".", "agetac", ".", "command", ";", "import", "org", ".", "agetac", ".", "memento", ".", "IMemento", ";", "public", "interface", "IRecordableCommand", "extends", "ICommand", "{", "public", "IMemento", "saveMemento", "(", ")", ";", "public", "void", "restoreMemento", "(", "IMemento", "mem", ")", ";", "}", "</s>" ]
1,908
[ "<s>", "package", "org", ".", "agetac", ".", "command", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "MessageDTO", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ";", "import", "org", ".", "agetac", ".", "memento", ".", "IMemento", ";", "public", "class", "SendMessageCommand", "implements", "IRecordableCommand", "{", "public", "static", "final", "String", "NAME", "=", "\"\"", ";", "private", "static", "boolean", "messOk", "=", "false", ";", "private", "Controller", "controller", ";", "public", "SendMessageCommand", "(", "Controller", "controller", ")", "{", "this", ".", "controller", "=", "controller", ";", "}", "public", "static", "boolean", "getMessOk", "(", ")", "{", "return", "messOk", ";", "}", "public", "String", "getGroupeHoraire", "(", ")", "{", "Date", "d", "=", "new", "Date", "(", ")", ";", "String", "res", "=", "\"\"", ";", "int", "minutes", "=", "d", ".", "getMinutes", "(", ")", ";", "int", "heures", "=", "d", ".", "getHours", "(", ")", ";", "if", "(", "heures", "<", "10", ")", "{", "res", "=", "\"0\"", "+", "heures", ";", "}", "else", "{", "res", "=", "\"\"", "+", "heures", ";", "}", "if", "(", "minutes", "<", "10", ")", "{", "res", "=", "res", "+", "\"0\"", "+", "minutes", ";", "}", "else", "{", "res", "=", "res", "+", "minutes", ";", "}", "return", "res", ";", "}", "public", "void", "sendMessage", "(", "String", "message", ")", "{", "String", "date", "=", "getGroupeHoraire", "(", ")", ";", "MessageDTO", "mess", "=", "new", "MessageDTO", "(", "message", ",", "date", ")", ";", "System", ".", "out", ".", "println", "(", "\"Message", ":", "\"", "+", "message", "+", "\",\"", "+", "date", ")", ";", "messOk", "=", "controller", ".", "getInterventionEngine", "(", ")", ".", "sendMessage", "(", "mess", ")", ";", "}", "public", "void", "execute", "(", ")", "{", "sendMessage", "(", "controller", ".", "getMessage", "(", ")", ")", ";", "}", "@", "Override", "public", "IMemento", "saveMemento", "(", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "void", "restoreMemento", "(", "IMemento", "mem", ")", "{", "}", "}", "</s>" ]
1,909
[ "<s>", "package", "org", ".", "agetac", ".", "command", ";", "public", "interface", "ICommand", "{", "public", "void", "execute", "(", ")", ";", "}", "</s>" ]
1,910
[ "<s>", "package", "org", ".", "agetac", ".", "command", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ";", "import", "org", ".", "agetac", ".", "engine", ".", "IInterventionEngine", ";", "import", "org", ".", "agetac", ".", "memento", ".", "IMemento", ";", "public", "class", "RemoveEntityCommand", "implements", "IRecordableCommand", "{", "public", "static", "final", "String", "NAME", "=", "\"RemoveEntity\"", ";", "private", "IInterventionEngine", "engine", ";", "private", "Controller", "controller", ";", "public", "RemoveEntityCommand", "(", "Controller", "controller", ")", "{", "this", ".", "controller", "=", "controller", ";", "this", ".", "engine", "=", "controller", ".", "getInterventionEngine", "(", ")", ";", "}", "@", "Override", "public", "void", "execute", "(", ")", "{", "engine", ".", "removeEntity", "(", "controller", ".", "getLastEntity", "(", ")", ")", ";", "}", "@", "Override", "public", "IMemento", "saveMemento", "(", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "void", "restoreMemento", "(", "IMemento", "mem", ")", "{", "}", "}", "</s>" ]
1,911
[ "<s>", "package", "org", ".", "agetac", ".", "engine", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Observer", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "InterventionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "MessageDTO", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "public", "interface", "IInterventionEngine", "{", "public", "void", "addEntity", "(", "IEntity", "entity", ")", ";", "public", "void", "removeEntity", "(", "IEntity", "entity", ")", ";", "public", "void", "editEntity", "(", "IEntity", "entity", ")", ";", "public", "void", "updateIntervention", "(", ")", ";", "public", "boolean", "sendMessage", "(", "MessageDTO", "m", ")", ";", "public", "InterventionDTO", "getIntervention", "(", ")", ";", "public", "void", "addObserver", "(", "Observer", "o", ")", ";", "public", "ArrayList", "<", "IEntity", ">", "getEntities", "(", ")", ";", "public", "List", "<", "MessageDTO", ">", "getListMessages", "(", ")", ";", "public", "void", "stopUpdates", "(", ")", ";", "public", "int", "getInterventionId", "(", ")", ";", "}", "</s>" ]
1,912
[ "<s>", "package", "org", ".", "agetac", ".", "engine", ";", "public", "class", "UpdateInterventionThread", "extends", "Thread", "{", "private", "static", "final", "String", "TAG", "=", "\"\"", ";", "private", "InterventionEngine", "engine", ";", "private", "boolean", "doRun", "=", "true", ";", "public", "UpdateInterventionThread", "(", "InterventionEngine", "engine", ")", "{", "this", ".", "engine", "=", "engine", ";", "}", "@", "Override", "public", "void", "run", "(", ")", "{", "while", "(", "doRun", ")", "{", "try", "{", "sleep", "(", "5000", ")", ";", "engine", ".", "updateIntervention", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "android", ".", "util", ".", "Log", ".", "d", "(", "TAG", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "android", ".", "util", ".", "Log", ".", "d", "(", "TAG", ",", "\"\"", ")", ";", "}", "public", "void", "doStop", "(", ")", "{", "doRun", "=", "false", ";", "}", "}", "</s>" ]
1,913
[ "<s>", "package", "org", ".", "agetac", ".", "engine", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Observer", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "org", ".", "agetac", ".", "common", ".", "client", ".", "AgetacClient", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "ActionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "IModel", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "InterventionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "MessageDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "PositionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "SourceDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "TargetDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDemandDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDTO", ".", "VehicleType", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDemandDTO", ".", "DemandState", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VictimDTO", ";", "import", "org", ".", "agetac", ".", "entity", ".", "EntityHolder", ";", "import", "org", ".", "agetac", ".", "entity", ".", "EntityList", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "import", "org", ".", "agetac", ".", "handler", ".", "AddHandler", ";", "import", "org", ".", "agetac", ".", "handler", ".", "DeleteHandler", ";", "import", "org", ".", "agetac", ".", "handler", ".", "UpdateHandler", ";", "import", "org", ".", "agetac", ".", "observer", ".", "MyObservable", ";", "import", "org", ".", "restlet", ".", "engine", ".", "Engine", ";", "import", "org", ".", "restlet", ".", "ext", ".", "jackson", ".", "JacksonConverter", ";", "import", "android", ".", "content", ".", "Context", ";", "public", "class", "InterventionEngine", "implements", "IInterventionEngine", "{", "private", "static", "final", "String", "TAG", "=", "\"\"", ";", "private", "InterventionDTO", "intervention", ";", "private", "EntityList", "entities", ";", "private", "MyObservable", "observable", ";", "private", "AgetacClient", "client", ";", "private", "UpdateInterventionThread", "updateThread", ";", "private", "Context", "context", ";", "private", "AddHandler", "addHandler", ";", "private", "DeleteHandler", "delHandler", ";", "private", "UpdateHandler", "updateHandler", ";", "private", "List", "<", "MessageDTO", ">", "listMessages", ";", "private", "int", "interId", "=", "-", "1", ";", "public", "InterventionEngine", "(", "final", "Context", "c", ")", "{", "observable", "=", "new", "MyObservable", "(", ")", ";", "entities", "=", "new", "EntityList", "(", ")", ";", "this", ".", "context", "=", "c", ";", "String", "host", "=", "c", ".", "getString", "(", "R", ".", "string", ".", "host", ")", ";", "int", "port", "=", "Integer", ".", "valueOf", "(", "c", ".", "getString", "(", "R", ".", "string", ".", "port", ")", ")", ";", "Engine", ".", "getInstance", "(", ")", ".", "getRegisteredConverters", "(", ")", ".", "add", "(", "new", "JacksonConverter", "(", ")", ")", ";", "client", "=", "new", "AgetacClient", "(", "host", ",", "port", ")", ";", "interId", "=", "0", ";", "intervention", "=", "client", ".", "getIntervention", "(", "interId", ")", ";", "addHandler", "=", "new", "AddHandler", "(", "entities", ",", "client", ",", "interId", ")", ";", "delHandler", "=", "new", "DeleteHandler", "(", "entities", ",", "client", ")", ";", "updateHandler", "=", "new", "UpdateHandler", "(", "entities", ",", "client", ")", ";", "updateThread", "=", "new", "UpdateInterventionThread", "(", "this", ")", ";", "updateThread", ".", "start", "(", ")", ";", "}", "@", "Override", "public", "boolean", "sendMessage", "(", "MessageDTO", "m", ")", "{", "MessageDTO", "mess", "=", "client", ".", "addMessage", "(", "interId", ",", "m", ")", ";", "if", "(", "mess", "!=", "null", ")", "return", "true", ";", "return", "false", ";", "}", "@", "Override", "public", "void", "addEntity", "(", "IEntity", "entity", ")", "{", "addHandler", ".", "handle", "(", "entity", ")", ";", "notifyObservers", "(", ")", ";", "}", "@", "Override", "public", "void", "removeEntity", "(", "IEntity", "entity", ")", "{", "delHandler", ".", "handle", "(", "entity", ")", ";", "notifyObservers", "(", ")", ";", "}", "@", "Override", "public", "void", "editEntity", "(", "IEntity", "entity", ")", "{", "updateHandler", ".", "handle", "(", "entity", ")", ";", "notifyObservers", "(", ")", ";", "}", "@", "Override", "public", "void", "updateIntervention", "(", ")", "{", "EntityHolder", "holder", "=", "EntityHolder", ".", "getInstance", "(", "context", ")", ";", "List", "<", "VehicleDTO", ">", "vehList", "=", "new", "ArrayList", "<", "VehicleDTO", ">", "(", "client", ".", "getVehicles", "(", "interId", ")", ")", ";", "processUpdate", "(", "vehList", ",", "VehicleDTO", ".", "class", ")", ";", "List", "<", "ActionDTO", ">", "actList", "=", "new", "ArrayList", "<", "ActionDTO", ">", "(", "client", ".", "getActions", "(", "interId", ")", ")", ";", "processUpdate", "(", "actList", ",", "ActionDTO", ".", "class", ")", ";", "List", "<", "TargetDTO", ">", "cibList", "=", "new", "ArrayList", "<", "TargetDTO", ">", "(", "client", ".", "getTargets", "(", "interId", ")", ")", ";", "processUpdate", "(", "cibList", ",", "TargetDTO", ".", "class", ")", ";", "List", "<", "VehicleDemandDTO", ">", "dMoyList", "=", "new", "ArrayList", "<", "VehicleDemandDTO", ">", "(", "client", ".", "getVehicleDemands", "(", "interId", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dMoyList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "IEntity", "e", "=", "entities", ".", "find", "(", "dMoyList", ".", "get", "(", "i", ")", ".", "getId", "(", ")", ",", "VehicleDemandDTO", ".", "class", ")", ";", "if", "(", "e", "!=", "null", ")", "{", "e", ".", "setModel", "(", "dMoyList", ".", "get", "(", "i", ")", ")", ";", "if", "(", "dMoyList", ".", "get", "(", "i", ")", ".", "getState", "(", ")", "==", "DemandState", ".", "ACCEPTED", ")", "{", "ArrayList", "<", "VehicleDTO", ">", "vList", "=", "new", "ArrayList", "<", "VehicleDTO", ">", "(", "intervention", ".", "getVehicles", "(", ")", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "vList", ".", "size", "(", ")", ";", "k", "++", ")", "{", "if", "(", "vList", ".", "get", "(", "k", ")", ".", "getId", "(", ")", "==", "dMoyList", ".", "get", "(", "i", ")", ".", "getVehicleId", "(", ")", ")", "{", "VehicleDTO", "v", "=", "vList", ".", "get", "(", "k", ")", ";", "entities", ".", "add", "(", "holder", ".", "generateEntity", "(", "v", ")", ")", ";", "entities", ".", "remove", "(", "dMoyList", ".", "get", "(", "i", ")", ")", ";", "}", "}", "}", "}", "}", "List", "<", "VictimDTO", ">", "impList", "=", "new", "ArrayList", "<", "VictimDTO", ">", "(", "client", ".", "getVictims", "(", "interId", ")", ")", ";", "processUpdate", "(", "impList", ",", "VictimDTO", ".", "class", ")", ";", "listMessages", "=", "new", "ArrayList", "<", "MessageDTO", ">", "(", "client", ".", "getMessages", "(", "interId", ")", ")", ";", "List", "<", "SourceDTO", ">", "srcList", "=", "new", "ArrayList", "<", "SourceDTO", ">", "(", "client", ".", "getSources", "(", "interId", ")", ")", ";", "processUpdate", "(", "srcList", ",", "SourceDTO", ".", "class", ")", ";", "notifyObservers", "(", ")", ";", "}", "private", "void", "processUpdate", "(", "List", "<", "?", "extends", "IModel", ">", "list", ",", "Class", "<", "?", "extends", "IModel", ">", "aClass", ")", "{", "EntityHolder", "holder", "=", "EntityHolder", ".", "getInstance", "(", "context", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "{", "IEntity", "e", "=", "entities", ".", "find", "(", "list", ".", "get", "(", "i", ")", ".", "getId", "(", ")", ",", "aClass", ")", ";", "if", "(", "e", "!=", "null", ")", "{", "e", ".", "setModel", "(", "list", ".", "get", "(", "i", ")", ")", ";", "}", "else", "{", "IModel", "model", "=", "list", ".", "get", "(", "i", ")", ";", "entities", ".", "add", "(", "holder", ".", "generateEntity", "(", "model", ")", ")", ";", "}", "}", "}", "@", "Override", "public", "ArrayList", "<", "IEntity", ">", "getEntities", "(", ")", "{", "return", "entities", ";", "}", "@", "Override", "public", "InterventionDTO", "getIntervention", "(", ")", "{", "return", "intervention", ";", "}", "public", "List", "<", "MessageDTO", ">", "getListMessages", "(", ")", "{", "return", "listMessages", ";", "}", "private", "void", "notifyObservers", "(", ")", "{", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "intervention", ")", ";", "}", "public", "void", "addObserver", "(", "Observer", "observer", ")", "{", "observable", ".", "addObserver", "(", "observer", ")", ";", "}", "@", "Override", "public", "void", "stopUpdates", "(", ")", "{", "if", "(", "updateThread", "!=", "null", ")", "updateThread", ".", "doStop", "(", ")", ";", "}", "@", "Override", "public", "int", "getInterventionId", "(", ")", "{", "return", "interId", ";", "}", "}", "</s>" ]
1,914
[ "<s>", "package", "org", ".", "agetac", ".", "activity", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ".", "ActionFlag", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "public", "interface", "ITabActivity", "{", "public", "ActionFlag", "getActionFlag", "(", ")", ";", "public", "IEntity", "getTouchedEntity", "(", ")", ";", "public", "String", "getMessage", "(", ")", ";", "public", "void", "update", "(", ")", ";", "}", "</s>" ]
1,915
[ "<s>", "package", "org", ".", "agetac", ".", "activity", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "android", ".", "app", ".", "Activity", ";", "import", "android", ".", "app", ".", "ProgressDialog", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "view", ".", "KeyEvent", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "View", ".", "OnClickListener", ";", "import", "android", ".", "view", ".", "View", ".", "OnKeyListener", ";", "import", "android", ".", "view", ".", "inputmethod", ".", "InputMethodManager", ";", "import", "android", ".", "widget", ".", "Button", ";", "import", "android", ".", "widget", ".", "EditText", ";", "public", "class", "MainActivity", "extends", "Activity", "implements", "OnClickListener", "{", "private", "ProgressDialog", "connectionDialog", ";", "private", "InputMethodManager", "imm", ";", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "main", ")", ";", "(", "(", "Button", ")", "findViewById", "(", "R", ".", "id", ".", "connectBtn", ")", ")", ".", "setOnClickListener", "(", "this", ")", ";", "imm", "=", "(", "InputMethodManager", ")", "getSystemService", "(", "Context", ".", "INPUT_METHOD_SERVICE", ")", ";", "final", "EditText", "passField", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "passField", ")", ";", "passField", ".", "setOnKeyListener", "(", "new", "OnKeyListener", "(", ")", "{", "public", "boolean", "onKey", "(", "View", "v", ",", "int", "keyCode", ",", "KeyEvent", "event", ")", "{", "if", "(", "(", "event", ".", "getAction", "(", ")", "==", "KeyEvent", ".", "ACTION_DOWN", ")", "&&", "(", "keyCode", "==", "KeyEvent", ".", "KEYCODE_ENTER", ")", ")", "{", "imm", ".", "hideSoftInputFromWindow", "(", "passField", ".", "getWindowToken", "(", ")", ",", "0", ")", ";", "startTabHostActivity", "(", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "}", ")", ";", "}", "@", "Override", "protected", "void", "onStart", "(", ")", "{", "super", ".", "onStart", "(", ")", ";", "}", "@", "Override", "protected", "void", "onPause", "(", ")", "{", "super", ".", "onPause", "(", ")", ";", "if", "(", "connectionDialog", "!=", "null", ")", "connectionDialog", ".", "dismiss", "(", ")", ";", "}", "@", "Override", "public", "void", "onClick", "(", "View", "v", ")", "{", "String", "title", "=", "getString", "(", "R", ".", "string", ".", "progress_title_connection", ")", ";", "String", "message", "=", "getString", "(", "R", ".", "string", ".", "progress_connection", ")", ";", "connectionDialog", "=", "new", "ProgressDialog", "(", "MainActivity", ".", "this", ")", ";", "connectionDialog", ".", "setTitle", "(", "title", ")", ";", "connectionDialog", ".", "setMessage", "(", "message", ")", ";", "connectionDialog", ".", "setIndeterminate", "(", "true", ")", ";", "connectionDialog", ".", "show", "(", ")", ";", "startTabHostActivity", "(", ")", ";", "}", "private", "void", "startTabHostActivity", "(", ")", "{", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "startActivity", "(", "new", "Intent", "(", "MainActivity", ".", "this", ",", "TabsActivity", ".", "class", ")", ")", ";", "if", "(", "connectionDialog", "!=", "null", ")", "connectionDialog", ".", "dismiss", "(", ")", ";", "}", "}", ")", ".", "start", "(", ")", ";", "}", "}", "</s>" ]
1,916
[ "<s>", "package", "org", ".", "agetac", ".", "activity", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Random", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ".", "ActionFlag", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "import", "android", ".", "app", ".", "AlertDialog", ";", "import", "android", ".", "content", ".", "DialogInterface", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "View", ".", "OnClickListener", ";", "import", "android", ".", "widget", ".", "AdapterView", ";", "import", "android", ".", "widget", ".", "AdapterView", ".", "OnItemClickListener", ";", "import", "android", ".", "widget", ".", "ArrayAdapter", ";", "import", "android", ".", "widget", ".", "Button", ";", "import", "android", ".", "widget", ".", "ListView", ";", "import", "android", ".", "widget", ".", "TextView", ";", "public", "class", "SOEICActivity", "extends", "AbstractActivity", "implements", "OnClickListener", ",", "OnItemClickListener", "{", "private", "Button", "addEntityBtn", ";", "private", "TextView", "nbCurrentEntityView", ";", "private", "int", "nbCurrentEntity", ";", "private", "TextView", "nbFuturEntityView", ";", "private", "int", "nbFuturEntity", ";", "private", "ListView", "vehiculeList", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "soeic", ")", ";", "addEntityBtn", "=", "(", "Button", ")", "findViewById", "(", "R", ".", "id", ".", "addEntity", ")", ";", "addEntityBtn", ".", "setOnClickListener", "(", "this", ")", ";", "nbCurrentEntityView", "=", "(", "TextView", ")", "findViewById", "(", "R", ".", "id", ".", "nbCurrentEntity", ")", ";", "nbFuturEntityView", "=", "(", "TextView", ")", "findViewById", "(", "R", ".", "id", ".", "nbFuturEntity", ")", ";", "vehiculeList", "=", "(", "ListView", ")", "findViewById", "(", "R", ".", "id", ".", "vehicules_listview", ")", ";", "vehiculeList", ".", "setOnItemClickListener", "(", "this", ")", ";", "}", "@", "Override", "public", "void", "onClick", "(", "View", "v", ")", "{", "Random", "gen", "=", "new", "Random", "(", ")", ";", "switch", "(", "v", ".", "getId", "(", ")", ")", "{", "case", "R", ".", "id", ".", "addEntity", ":", "break", ";", "}", "}", "@", "Override", "public", "void", "onItemClick", "(", "AdapterView", "<", "?", ">", "adpt", ",", "View", "v", ",", "int", "index", ",", "long", "l", ")", "{", "try", "{", "final", "AdapterView", "adapter", "=", "adpt", ";", "final", "int", "position", "=", "index", ";", "AlertDialog", ".", "Builder", "confirmDelete", "=", "new", "AlertDialog", ".", "Builder", "(", "this", ")", ";", "confirmDelete", ".", "setTitle", "(", "R", ".", "string", ".", "dialog_title_deletevehicule", ")", ";", "confirmDelete", ".", "setMessage", "(", "R", ".", "string", ".", "dialog_deletevehicule", ")", ";", "confirmDelete", ".", "setPositiveButton", "(", "R", ".", "string", ".", "yes", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "ArrayAdapter", "<", "IEntity", ">", "vehicules", "=", "(", "ArrayAdapter", ")", "adapter", ".", "getAdapter", "(", ")", ";", "touchedEntity", "=", "vehicules", ".", "getItem", "(", "position", ")", ";", "flag", "=", "ActionFlag", ".", "REMOVE", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "SOEICActivity", ".", "this", ")", ";", "}", "}", ")", ";", "confirmDelete", ".", "setNegativeButton", "(", "R", ".", "string", ".", "no", ",", "null", ")", ";", "confirmDelete", ".", "show", "(", ")", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "}", "}", "@", "Override", "public", "void", "update", "(", ")", "{", "List", "<", "IEntity", ">", "entities", "=", "controller", ".", "getEntities", "(", ")", ";", "ArrayAdapter", "<", "IEntity", ">", "adapter", "=", "new", "ArrayAdapter", "<", "IEntity", ">", "(", "this", ",", "android", ".", "R", ".", "layout", ".", "simple_list_item_1", ",", "entities", ")", ";", "vehiculeList", ".", "setAdapter", "(", "adapter", ")", ";", "adapter", ".", "notifyDataSetChanged", "(", ")", ";", "nbCurrentEntity", "=", "0", ";", "nbFuturEntity", "=", "0", ";", "nbCurrentEntityView", ".", "setText", "(", "String", ".", "valueOf", "(", "nbCurrentEntity", ")", ")", ";", "nbFuturEntityView", ".", "setText", "(", "String", ".", "valueOf", "(", "nbFuturEntity", ")", ")", ";", "}", "@", "Override", "public", "String", "getMessage", "(", ")", "{", "return", "null", ";", "}", "}", "</s>" ]
1,917
[ "<s>", "package", "org", ".", "agetac", ".", "activity", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "android", ".", "app", ".", "TabActivity", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "res", ".", "Resources", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "widget", ".", "TabHost", ";", "import", "android", ".", "widget", ".", "TabWidget", ";", "public", "class", "TabsActivity", "extends", "TabActivity", "{", "private", "static", "final", "String", "TAB_SITAC", "=", "\"tab_sitac\"", ";", "private", "static", "final", "String", "TAB_SOEIC", "=", "\"tab_soeic\"", ";", "private", "static", "final", "String", "TAB_MOYENS", "=", "\"tab_moyens\"", ";", "private", "static", "final", "String", "TAB_MESSAGES", "=", "\"tab_messages\"", ";", "private", "static", "final", "String", "TAB_CRM", "=", "\"tab_crm\"", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "tabs", ")", ";", "TabHost", "tHost", "=", "getTabHost", "(", ")", ";", "TabHost", ".", "TabSpec", "spec", ";", "Resources", "res", "=", "getResources", "(", ")", ";", "Intent", "tabIntent", ";", "tabIntent", "=", "new", "Intent", "(", ")", ".", "setClass", "(", "this", ",", "SITACActivity", ".", "class", ")", ";", "spec", "=", "tHost", ".", "newTabSpec", "(", "TAB_SITAC", ")", ";", "spec", ".", "setIndicator", "(", "getString", "(", "R", ".", "string", ".", "sitac", ")", ",", "res", ".", "getDrawable", "(", "R", ".", "drawable", ".", "ic_tab_sitac", ")", ")", ";", "spec", ".", "setContent", "(", "tabIntent", ")", ";", "tHost", ".", "addTab", "(", "spec", ")", ";", "tabIntent", "=", "new", "Intent", "(", ")", ".", "setClass", "(", "this", ",", "MoyensActivity", ".", "class", ")", ";", "spec", "=", "tHost", ".", "newTabSpec", "(", "TAB_MOYENS", ")", ";", "spec", ".", "setIndicator", "(", "getString", "(", "R", ".", "string", ".", "moyens", ")", ",", "res", ".", "getDrawable", "(", "R", ".", "drawable", ".", "ic_tab_moyens", ")", ")", ";", "spec", ".", "setContent", "(", "tabIntent", ")", ";", "tHost", ".", "addTab", "(", "spec", ")", ";", "tabIntent", "=", "new", "Intent", "(", ")", ".", "setClass", "(", "this", ",", "MessagesActivity", ".", "class", ")", ";", "spec", "=", "tHost", ".", "newTabSpec", "(", "TAB_MESSAGES", ")", ";", "spec", ".", "setIndicator", "(", "getString", "(", "R", ".", "string", ".", "messages", ")", ",", "res", ".", "getDrawable", "(", "R", ".", "drawable", ".", "ic_tab_messages", ")", ")", ";", "spec", ".", "setContent", "(", "tabIntent", ")", ";", "tHost", ".", "addTab", "(", "spec", ")", ";", "TabWidget", "tWidget", "=", "tHost", ".", "getTabWidget", "(", ")", ";", "int", "nbTabs", "=", "tWidget", ".", "getChildCount", "(", ")", ";", "int", "tabMaxWidth", "=", "getWindowManager", "(", ")", ".", "getDefaultDisplay", "(", ")", ".", "getWidth", "(", ")", "/", "nbTabs", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nbTabs", ";", "i", "++", ")", "{", "tWidget", ".", "getChildAt", "(", "i", ")", ".", "getLayoutParams", "(", ")", ".", "width", "=", "tabMaxWidth", ";", "}", "tHost", ".", "setCurrentTab", "(", "0", ")", ";", "}", "}", "</s>" ]
1,918
[ "<s>", "package", "org", ".", "agetac", ".", "activity", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ".", "ActionFlag", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "import", "org", ".", "agetac", ".", "observer", ".", "MyObservable", ";", "import", "android", ".", "app", ".", "Activity", ";", "import", "android", ".", "os", ".", "Bundle", ";", "public", "abstract", "class", "AbstractActivity", "extends", "Activity", "implements", "ITabActivity", "{", "private", "static", "final", "String", "TOUCHED_ENTITY", "=", "\"\"", ";", "protected", "Controller", "controller", ";", "protected", "MyObservable", "observable", ";", "protected", "ActionFlag", "flag", ";", "protected", "IEntity", "touchedEntity", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "if", "(", "savedInstanceState", "!=", "null", ")", "{", "touchedEntity", "=", "(", "IEntity", ")", "savedInstanceState", ".", "getSerializable", "(", "TOUCHED_ENTITY", ")", ";", "}", "}", "@", "Override", "protected", "void", "onResume", "(", ")", "{", "super", ".", "onResume", "(", ")", ";", "controller", "=", "Controller", ".", "getInstance", "(", "this", ")", ";", "observable", "=", "new", "MyObservable", "(", ")", ";", "observable", ".", "addObserver", "(", "controller", ")", ";", "controller", ".", "setCurrentActivity", "(", "this", ")", ";", "}", "@", "Override", "public", "void", "onBackPressed", "(", ")", "{", "super", ".", "onBackPressed", "(", ")", ";", "controller", ".", "quit", "(", ")", ";", "}", "@", "Override", "public", "ActionFlag", "getActionFlag", "(", ")", "{", "return", "flag", ";", "}", "@", "Override", "public", "IEntity", "getTouchedEntity", "(", ")", "{", "return", "touchedEntity", ";", "}", "@", "Override", "public", "String", "getMessage", "(", ")", "{", "return", "null", ";", "}", "@", "Override", "protected", "void", "onSaveInstanceState", "(", "Bundle", "outState", ")", "{", "super", ".", "onSaveInstanceState", "(", "outState", ")", ";", "if", "(", "touchedEntity", "!=", "null", ")", "{", "}", "}", "}", "</s>" ]
1,919
[ "<s>", "package", "org", ".", "agetac", ".", "activity", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "android", ".", "os", ".", "Bundle", ";", "public", "class", "CRMActivity", "extends", "AbstractActivity", "{", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "crm", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "{", "}", "}", "</s>" ]
1,920
[ "<s>", "package", "org", ".", "agetac", ".", "activity", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "Hashtable", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDTO", ".", "VehicleState", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDTO", ".", "VehicleType", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDemandDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDemandDTO", ".", "DemandState", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ".", "ActionFlag", ";", "import", "org", ".", "agetac", ".", "entity", ".", "EntityHolder", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "import", "android", ".", "app", ".", "AlertDialog", ";", "import", "android", ".", "content", ".", "DialogInterface", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "text", ".", "format", ".", "Time", ";", "import", "android", ".", "view", ".", "Menu", ";", "import", "android", ".", "view", ".", "MenuInflater", ";", "import", "android", ".", "view", ".", "MenuItem", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "View", ".", "OnClickListener", ";", "import", "android", ".", "widget", ".", "AdapterView", ";", "import", "android", ".", "widget", ".", "AdapterView", ".", "OnItemClickListener", ";", "import", "android", ".", "widget", ".", "Button", ";", "import", "android", ".", "widget", ".", "ListView", ";", "import", "android", ".", "widget", ".", "PopupMenu", ";", "import", "android", ".", "widget", ".", "PopupMenu", ".", "OnMenuItemClickListener", ";", "import", "android", ".", "widget", ".", "SimpleAdapter", ";", "public", "class", "MoyensActivity", "extends", "AbstractActivity", "implements", "OnClickListener", ",", "OnMenuItemClickListener", ",", "OnItemClickListener", "{", "private", "static", "final", "String", "TAG", "=", "\"\"", ";", "private", "static", "final", "String", "DATA_IMG", "=", "\"data_img\"", ";", "private", "static", "final", "String", "DATA_TYPE", "=", "\"data_type\"", ";", "private", "static", "final", "String", "DATA_CASERNE", "=", "\"data_caserne\"", ";", "private", "static", "final", "String", "DATA_ETAT", "=", "\"data_etat\"", ";", "private", "static", "final", "String", "DATA_GHDEM", "=", "\"\"", ";", "private", "static", "final", "String", "DATA_GHARR", "=", "\"\"", ";", "private", "static", "final", "String", "DATA_GHRET", "=", "\"\"", ";", "private", "SimpleAdapter", "listAdapter", ";", "private", "ListView", "listView", ";", "private", "List", "<", "Hashtable", "<", "String", ",", "String", ">", ">", "data", ";", "private", "PopupMenu", "popupMenu", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "moyens", ")", ";", "listView", "=", "(", "ListView", ")", "findViewById", "(", "R", ".", "id", ".", "moyens_listview", ")", ";", "data", "=", "new", "ArrayList", "<", "Hashtable", "<", "String", ",", "String", ">", ">", "(", ")", ";", "listAdapter", "=", "new", "SimpleAdapter", "(", "this", ".", "getBaseContext", "(", ")", ",", "data", ",", "R", ".", "layout", ".", "moyens_list_item", ",", "new", "String", "[", "]", "{", "DATA_IMG", ",", "DATA_TYPE", ",", "DATA_CASERNE", ",", "DATA_ETAT", ",", "DATA_GHDEM", ",", "DATA_GHARR", ",", "DATA_GHRET", "}", ",", "new", "int", "[", "]", "{", "R", ".", "id", ".", "img", ",", "R", ".", "id", ".", "type_vehicule", ",", "R", ".", "id", ".", "caserne_vehicule", ",", "R", ".", "id", ".", "etat_vehicule", ",", "R", ".", "id", ".", "gh_demande", ",", "R", ".", "id", ".", "gh_arrivee", ",", "R", ".", "id", ".", "gh_retour", "}", ")", ";", "listView", ".", "setAdapter", "(", "listAdapter", ")", ";", "listView", ".", "setOnItemClickListener", "(", "this", ")", ";", "(", "(", "Button", ")", "findViewById", "(", "R", ".", "id", ".", "btn_demande_moyens", ")", ")", ".", "setOnClickListener", "(", "this", ")", ";", "popupMenu", "=", "new", "PopupMenu", "(", "MoyensActivity", ".", "this", ",", "findViewById", "(", "R", ".", "id", ".", "menu_moyens", ")", ")", ";", "Menu", "menu", "=", "popupMenu", ".", "getMenu", "(", ")", ";", "MenuInflater", "inflater", "=", "popupMenu", ".", "getMenuInflater", "(", ")", ";", "inflater", ".", "inflate", "(", "R", ".", "menu", ".", "moyens_context_menu", ",", "menu", ")", ";", "popupMenu", ".", "setOnMenuItemClickListener", "(", "this", ")", ";", "}", "@", "Override", "public", "void", "onClick", "(", "View", "v", ")", "{", "switch", "(", "v", ".", "getId", "(", ")", ")", "{", "case", "R", ".", "id", ".", "btn_demande_moyens", ":", "android", ".", "util", ".", "Log", ".", "d", "(", "TAG", ",", "\"\"", ")", ";", "popupMenu", ".", "show", "(", ")", ";", "break", ";", "}", "}", "@", "Override", "public", "void", "onItemClick", "(", "AdapterView", "<", "?", ">", "adpt", ",", "View", "v", ",", "int", "index", ",", "long", "l", ")", "{", "try", "{", "final", "List", "<", "IEntity", ">", "entities", "=", "controller", ".", "getEntities", "(", ")", ";", "final", "int", "position", "=", "index", ";", "final", "AlertDialog", ".", "Builder", "confirmDelete", "=", "new", "AlertDialog", ".", "Builder", "(", "this", ")", ";", "confirmDelete", ".", "setTitle", "(", "R", ".", "string", ".", "dialog_title_vehicule", ")", ";", "confirmDelete", ".", "setMessage", "(", "R", ".", "string", ".", "dialog_update_gh_ou_supprimer_vehicule", ")", ";", "confirmDelete", ".", "setPositiveButton", "(", "R", ".", "string", ".", "dialog_vehicule_supprimer", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "flag", "=", "ActionFlag", ".", "REMOVE", ";", "touchedEntity", "=", "(", "IEntity", ")", "entities", ".", "get", "(", "position", ")", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "MoyensActivity", ".", "this", ")", ";", "}", "}", ")", ";", "confirmDelete", ".", "setNegativeButton", "(", "R", ".", "string", ".", "annuler", ",", "null", ")", ";", "confirmDelete", ".", "show", "(", ")", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "android", ".", "util", ".", "Log", ".", "e", "(", "TAG", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "@", "Override", "public", "boolean", "onMenuItemClick", "(", "MenuItem", "item", ")", "{", "VehicleDemandDTO", "dm", ";", "flag", "=", "ActionFlag", ".", "ADD", ";", "switch", "(", "item", ".", "getItemId", "(", ")", ")", "{", "case", "R", ".", "id", ".", "FPT", ":", "dm", "=", "genVehicleDemandDTO", "(", "VehicleType", ".", "FPT", ")", ";", "break", ";", "case", "R", ".", "id", ".", "CCGC", ":", "dm", "=", "genVehicleDemandDTO", "(", "VehicleType", ".", "CCGC", ")", ";", "break", ";", "case", "R", ".", "id", ".", "VSAV", ":", "dm", "=", "genVehicleDemandDTO", "(", "VehicleType", ".", "VSAV", ")", ";", "break", ";", "case", "R", ".", "id", ".", "menu_attaque", ":", "return", "false", ";", "default", ":", "return", "false", ";", "}", "touchedEntity", "=", "EntityHolder", ".", "getInstance", "(", "this", ")", ".", "generateEntity", "(", "dm", ")", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "MoyensActivity", ".", "this", ")", ";", "return", "super", ".", "onContextItemSelected", "(", "item", ")", ";", "}", "public", "boolean", "onCreateOptionsMenu", "(", "Menu", "menu", ")", "{", "MenuInflater", "inflater", "=", "getMenuInflater", "(", ")", ";", "inflater", ".", "inflate", "(", "R", ".", "menu", ".", "moyens_context_menu", ",", "menu", ")", ";", "menu", ".", "getItem", "(", "0", ")", ".", "getSubMenu", "(", ")", ".", "setHeaderIcon", "(", "R", ".", "drawable", ".", "firetruck", ")", ";", "return", "true", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "{", "List", "<", "IEntity", ">", "entities", "=", "controller", ".", "getEntities", "(", ")", ";", "data", ".", "clear", "(", ")", ";", "Hashtable", "<", "String", ",", "String", ">", "map", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entities", ".", "size", "(", ")", ";", "i", "++", ")", "{", "map", "=", "new", "Hashtable", "<", "String", ",", "String", ">", "(", ")", ";", "if", "(", "entities", ".", "get", "(", "i", ")", ".", "getModel", "(", ")", "instanceof", "VehicleDTO", ")", "{", "VehicleDTO", "v", "=", "(", "VehicleDTO", ")", "entities", ".", "get", "(", "i", ")", ".", "getModel", "(", ")", ";", "map", ".", "put", "(", "DATA_IMG", ",", "\"\"", "+", "R", ".", "drawable", ".", "firetruck", ")", ";", "map", ".", "put", "(", "DATA_TYPE", ",", "v", ".", "getName", "(", ")", ")", ";", "map", ".", "put", "(", "DATA_CASERNE", ",", "v", ".", "getBarrackName", "(", ")", ")", ";", "VehicleState", "ev", "=", "v", ".", "getState", "(", ")", ";", "map", ".", "put", "(", "DATA_ETAT", ",", "ev", ".", "toString", "(", ")", ")", ";", "map", ".", "put", "(", "DATA_GHDEM", ",", "getString", "(", "R", ".", "string", ".", "unknown", ")", ")", ";", "map", ".", "put", "(", "DATA_GHARR", ",", "getString", "(", "R", ".", "string", ".", "unknown", ")", ")", ";", "map", ".", "put", "(", "DATA_GHRET", ",", "getString", "(", "R", ".", "string", ".", "unknown", ")", ")", ";", "data", ".", "add", "(", "map", ")", ";", "}", "else", "if", "(", "entities", ".", "get", "(", "i", ")", ".", "getModel", "(", ")", "instanceof", "VehicleDemandDTO", ")", "{", "VehicleDemandDTO", "dm", "=", "(", "VehicleDemandDTO", ")", "entities", ".", "get", "(", "i", ")", ".", "getModel", "(", ")", ";", "if", "(", "dm", ".", "getState", "(", ")", "!=", "DemandState", ".", "ACCEPTED", ")", "{", "map", ".", "put", "(", "DATA_IMG", ",", "\"\"", "+", "R", ".", "drawable", ".", "firetruck", ")", ";", "map", ".", "put", "(", "DATA_TYPE", ",", "dm", ".", "getType", "(", ")", ".", "name", "(", ")", ")", ";", "map", ".", "put", "(", "DATA_CASERNE", ",", "getString", "(", "R", ".", "string", ".", "unknown", ")", ")", ";", "map", ".", "put", "(", "DATA_ETAT", ",", "dm", ".", "getState", "(", ")", ".", "name", "(", ")", ")", ";", "map", ".", "put", "(", "DATA_GHDEM", ",", "getString", "(", "R", ".", "string", ".", "unknown", ")", ")", ";", "map", ".", "put", "(", "DATA_GHARR", ",", "getString", "(", "R", ".", "string", ".", "unknown", ")", ")", ";", "map", ".", "put", "(", "DATA_GHRET", ",", "getString", "(", "R", ".", "string", ".", "unknown", ")", ")", ";", "data", ".", "add", "(", "map", ")", ";", "}", "}", "}", "runOnUiThread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "listAdapter", ".", "notifyDataSetChanged", "(", ")", ";", "}", "}", ")", ";", "}", "public", "VehicleDemandDTO", "genVehicleDemandDTO", "(", "VehicleType", "type", ")", "{", "VehicleDemandDTO", "dm", "=", "new", "VehicleDemandDTO", "(", ")", ";", "dm", ".", "setType", "(", "type", ")", ";", "dm", ".", "setState", "(", "DemandState", ".", "ASKED", ")", ";", "dm", ".", "setTimestamp", "(", "new", "Date", "(", ")", ")", ";", "return", "dm", ";", "}", "public", "String", "getTime", "(", ")", "{", "Time", "t", "=", "new", "Time", "(", ")", ";", "t", ".", "setToNow", "(", ")", ";", "return", "(", "String", ")", "t", ".", "toString", "(", ")", ".", "subSequence", "(", "9", ",", "13", ")", ";", "}", "}", "</s>" ]
1,921
[ "<s>", "package", "org", ".", "agetac", ".", "activity", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Hashtable", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "org", ".", "agetac", ".", "command", ".", "SendMessageCommand", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "MessageDTO", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ".", "ActionFlag", ";", "import", "android", ".", "app", ".", "AlertDialog", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "View", ".", "OnClickListener", ";", "import", "android", ".", "widget", ".", "EditText", ";", "import", "android", ".", "widget", ".", "ListView", ";", "import", "android", ".", "widget", ".", "SimpleAdapter", ";", "public", "class", "MessagesActivity", "extends", "AbstractActivity", "implements", "OnClickListener", "{", "private", "static", "final", "String", "TAG", "=", "\"\"", ";", "private", "String", "message", ";", "private", "SimpleAdapter", "listAdapter", ";", "private", "ListView", "listView", ";", "private", "List", "<", "Hashtable", "<", "String", ",", "String", ">", ">", "listMessages", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "messages", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonEnvoyer", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonAnnuler", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonRetMess", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonConsMess", ")", ".", "setOnClickListener", "(", "this", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "{", "}", "@", "Override", "public", "String", "getMessage", "(", ")", "{", "return", "message", ";", "}", "@", "Override", "public", "void", "onClick", "(", "View", "v", ")", "{", "switch", "(", "v", ".", "getId", "(", ")", ")", "{", "case", "R", ".", "id", ".", "messAnnuler", ":", "EditText", "et", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_message_normal", ")", ";", "et", ".", "setText", "(", "\"\"", ")", ";", "break", ";", "case", "R", ".", "id", ".", "messEnvoyer", ":", "EditText", "texteAEnvoyer", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_message_normal", ")", ";", "message", "=", "texteAEnvoyer", ".", "getText", "(", ")", ".", "toString", "(", ")", ";", "flag", "=", "ActionFlag", ".", "SEND_MESSAGE", ";", "texteAEnvoyer", ".", "setText", "(", "\"\"", ")", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "MessagesActivity", ".", "this", ")", ";", "if", "(", "SendMessageCommand", ".", "getMessOk", "(", ")", ")", "{", "AlertDialog", ".", "Builder", "confirmSend", "=", "new", "AlertDialog", ".", "Builder", "(", "this", ")", ";", "confirmSend", ".", "setMessage", "(", "\"\"", ")", ";", "confirmSend", ".", "setNeutralButton", "(", "\"OK\"", ",", "null", ")", ";", "confirmSend", ".", "show", "(", ")", ";", "}", "else", "{", "AlertDialog", ".", "Builder", "confirmSend", "=", "new", "AlertDialog", ".", "Builder", "(", "this", ")", ";", "confirmSend", ".", "setMessage", "(", "\"\"", ")", ";", "confirmSend", ".", "setNeutralButton", "(", "\"Ok\"", ",", "null", ")", ";", "confirmSend", ".", "show", "(", ")", ";", "}", "break", ";", "case", "R", ".", "id", ".", "buttonEnvoyer", ":", "EditText", "TexteJeSuis", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_suis", ")", ";", "String", "jeSuis", "=", "TexteJeSuis", ".", "getText", "(", ")", ".", "toString", "(", ")", ";", "EditText", "TexteJeVois", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_vois", ")", ";", "String", "jeVois", "=", "TexteJeVois", ".", "getText", "(", ")", ".", "toString", "(", ")", ";", "EditText", "TexteJePrevois", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_prevois", ")", ";", "String", "jePrevois", "=", "TexteJePrevois", ".", "getText", "(", ")", ".", "toString", "(", ")", ";", "EditText", "TexteJeProcede", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_procede", ")", ";", "String", "jeProcede", "=", "TexteJeProcede", ".", "getText", "(", ")", ".", "toString", "(", ")", ";", "EditText", "TexteJeDemande", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_demande", ")", ";", "String", "jeDemande", "=", "TexteJeDemande", ".", "getText", "(", ")", ".", "toString", "(", ")", ";", "message", "=", "\"Je", "suis", ":", "\"", "+", "jeSuis", "+", "\"n\"", "+", "\"Je", "vois", ":", "\"", "+", "jeVois", "+", "\"n\"", "+", "\"\"", "+", "jePrevois", "+", "\"n\"", "+", "\"\"", "+", "jeProcede", "+", "\"n\"", "+", "\"\"", "+", "jeDemande", "+", "\"n\"", ";", "flag", "=", "ActionFlag", ".", "SEND_MESSAGE", ";", "TexteJeSuis", ".", "setText", "(", "\"\"", ")", ";", "TexteJeVois", ".", "setText", "(", "\"\"", ")", ";", "TexteJePrevois", ".", "setText", "(", "\"\"", ")", ";", "TexteJeProcede", ".", "setText", "(", "\"\"", ")", ";", "TexteJeDemande", ".", "setText", "(", "\"\"", ")", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "MessagesActivity", ".", "this", ")", ";", "if", "(", "SendMessageCommand", ".", "getMessOk", "(", ")", ")", "{", "AlertDialog", ".", "Builder", "confirmSend", "=", "new", "AlertDialog", ".", "Builder", "(", "this", ")", ";", "confirmSend", ".", "setMessage", "(", "\"\"", ")", ";", "confirmSend", ".", "setNeutralButton", "(", "\"OK\"", ",", "null", ")", ";", "confirmSend", ".", "show", "(", ")", ";", "}", "else", "{", "AlertDialog", ".", "Builder", "confirmSend", "=", "new", "AlertDialog", ".", "Builder", "(", "this", ")", ";", "confirmSend", ".", "setMessage", "(", "\"\"", ")", ";", "confirmSend", ".", "setNeutralButton", "(", "\"Ok\"", ",", "null", ")", ";", "confirmSend", ".", "show", "(", ")", ";", "}", "break", ";", "case", "R", ".", "id", ".", "buttonAnnuler", ":", "EditText", "jeSuisA", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_suis", ")", ";", "jeSuisA", ".", "setText", "(", "\"\"", ")", ";", "EditText", "jeVoisA", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_vois", ")", ";", "jeVoisA", ".", "setText", "(", "\"\"", ")", ";", "EditText", "jePrevoisA", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_prevois", ")", ";", "jePrevoisA", ".", "setText", "(", "\"\"", ")", ";", "EditText", "jeProcedeA", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_procede", ")", ";", "jeProcedeA", ".", "setText", "(", "\"\"", ")", ";", "EditText", "jeDemandeA", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "edittext_je_demande", ")", ";", "jeDemandeA", ".", "setText", "(", "\"\"", ")", ";", "break", ";", "case", "R", ".", "id", ".", "retMessAmb", ":", "setContentView", "(", "R", ".", "layout", ".", "messages", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonEnvoyer", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonAnnuler", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonRetMess", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonConsMess", ")", ".", "setOnClickListener", "(", "this", ")", ";", "break", ";", "case", "R", ".", "id", ".", "buttonRetMess", ":", "setContentView", "(", "R", ".", "layout", ".", "mess", ")", ";", "findViewById", "(", "R", ".", "id", ".", "messEnvoyer", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "messAnnuler", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "retMessAmb", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonConsMess", ")", ".", "setOnClickListener", "(", "this", ")", ";", "break", ";", "case", "R", ".", "id", ".", "buttonConsMess", ":", "setContentView", "(", "R", ".", "layout", ".", "reception_mess", ")", ";", "findViewById", "(", "R", ".", "id", ".", "retMessAmb", ")", ".", "setOnClickListener", "(", "this", ")", ";", "findViewById", "(", "R", ".", "id", ".", "buttonRetMess", ")", ".", "setOnClickListener", "(", "this", ")", ";", "listView", "=", "(", "ListView", ")", "findViewById", "(", "R", ".", "id", ".", "listMess", ")", ";", "listMessages", "=", "new", "ArrayList", "<", "Hashtable", "<", "String", ",", "String", ">", ">", "(", ")", ";", "listAdapter", "=", "new", "SimpleAdapter", "(", "this", ".", "getBaseContext", "(", ")", ",", "listMessages", ",", "R", ".", "layout", ".", "liste_message", ",", "new", "String", "[", "]", "{", "\"titre\"", ",", "\"description\"", "}", ",", "new", "int", "[", "]", "{", "R", ".", "id", ".", "titre", ",", "R", ".", "id", ".", "description", "}", ")", ";", "listView", ".", "setAdapter", "(", "listAdapter", ")", ";", "listMessages", ".", "clear", "(", ")", ";", "List", "<", "MessageDTO", ">", "messagesRecus", "=", "controller", ".", "getInterventionEngine", "(", ")", ".", "getListMessages", "(", ")", ";", "Hashtable", "<", "String", ",", "String", ">", "map", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "messagesRecus", ".", "size", "(", ")", ";", "i", "++", ")", "{", "map", "=", "new", "Hashtable", "<", "String", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "\"titre\"", ",", "messagesRecus", ".", "get", "(", "i", ")", ".", "getDate", "(", ")", ".", "toString", "(", ")", ")", ";", "map", ".", "put", "(", "\"description\"", ",", "messagesRecus", ".", "get", "(", "i", ")", ".", "getText", "(", ")", ".", "toString", "(", ")", ")", ";", "listMessages", ".", "add", "(", "map", ")", ";", "}", "break", ";", "}", "}", "}", "</s>" ]
1,922
[ "<s>", "package", "org", ".", "agetac", ".", "activity", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "ActionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "ActionDTO", ".", "ActionType", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "PositionDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDTO", ".", "VehicleType", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDemandDTO", ";", "import", "org", ".", "agetac", ".", "common", ".", "dto", ".", "VehicleDemandDTO", ".", "DemandState", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ";", "import", "org", ".", "agetac", ".", "controller", ".", "Controller", ".", "ActionFlag", ";", "import", "org", ".", "agetac", ".", "entity", ".", "Entity", ".", "EntityState", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "import", "org", ".", "agetac", ".", "fragment", ".", "HiddenMenuFragment", ";", "import", "org", ".", "agetac", ".", "fragment", ".", "OpenedMenuFragment", ";", "import", "org", ".", "agetac", ".", "listener", ".", "IOnMenuEventListener", ";", "import", "org", ".", "agetac", ".", "listener", ".", "IOnOverlayEventListener", ";", "import", "org", ".", "agetac", ".", "view", ".", "LinePicto", ";", "import", "org", ".", "agetac", ".", "view", ".", "MapOverlay", ";", "import", "org", ".", "agetac", ".", "view", ".", "MenuGroup", ";", "import", "org", ".", "agetac", ".", "view", ".", "Shape", ";", "import", "org", ".", "osmdroid", ".", "tileprovider", ".", "tilesource", ".", "TileSourceFactory", ";", "import", "org", ".", "osmdroid", ".", "util", ".", "GeoPoint", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "MapController", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "MapView", ";", "import", "android", ".", "app", ".", "AlertDialog", ";", "import", "android", ".", "app", ".", "FragmentManager", ";", "import", "android", ".", "app", ".", "FragmentTransaction", ";", "import", "android", ".", "content", ".", "DialogInterface", ";", "import", "android", ".", "content", ".", "DialogInterface", ".", "OnClickListener", ";", "import", "android", ".", "graphics", ".", "Point", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "view", ".", "LayoutInflater", ";", "import", "android", ".", "view", ".", "Menu", ";", "import", "android", ".", "view", ".", "MenuInflater", ";", "import", "android", ".", "view", ".", "MenuItem", ";", "import", "android", ".", "view", ".", "MotionEvent", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "widget", ".", "EditText", ";", "import", "android", ".", "widget", ".", "PopupMenu", ";", "import", "android", ".", "widget", ".", "PopupMenu", ".", "OnMenuItemClickListener", ";", "public", "class", "SITACActivity", "extends", "AbstractActivity", "implements", "IOnMenuEventListener", ",", "IOnOverlayEventListener", ",", "OnMenuItemClickListener", "{", "private", "static", "final", "String", "TAG", "=", "\"\"", ";", "private", "static", "final", "String", "EDIT_ITEM", "=", "\"edit_item\"", ";", "private", "MapView", "mapView", ";", "private", "MapOverlay", "mapOverlay", ";", "private", "MapController", "mapCtrl", ";", "private", "FragmentManager", "fManager", ";", "private", "OpenedMenuFragment", "openedMenuFrag", ";", "private", "HiddenMenuFragment", "hiddenMenuFrag", ";", "private", "IEntity", "currentEntity", ";", "private", "PopupMenu", "popupMenu", ";", "private", "AlertDialog", "editItemDialog", ";", "private", "GeoPoint", "lineBeginGeop", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "sitac", ")", ";", "mapView", "=", "(", "MapView", ")", "findViewById", "(", "R", ".", "id", ".", "mapview", ")", ";", "mapView", ".", "setTileSource", "(", "TileSourceFactory", ".", "MAPNIK", ")", ";", "mapCtrl", "=", "mapView", ".", "getController", "(", ")", ";", "mapCtrl", ".", "setZoom", "(", "18", ")", ";", "GeoPoint", "geoP", "=", "new", "GeoPoint", "(", "48115436", ",", "-", "1638084", ")", ";", "mapCtrl", ".", "setCenter", "(", "geoP", ")", ";", "fManager", "=", "getFragmentManager", "(", ")", ";", "openedMenuFrag", "=", "(", "OpenedMenuFragment", ")", "fManager", ".", "findFragmentById", "(", "R", ".", "id", ".", "fragment_menu_opened", ")", ";", "openedMenuFrag", ".", "setOnMenuEventListener", "(", "this", ")", ";", "hiddenMenuFrag", "=", "(", "HiddenMenuFragment", ")", "fManager", ".", "findFragmentById", "(", "R", ".", "id", ".", "fragment_menu_hidden", ")", ";", "hiddenMenuFrag", ".", "setOnMenuEventListener", "(", "this", ")", ";", "fManager", ".", "beginTransaction", "(", ")", ".", "hide", "(", "hiddenMenuFrag", ")", ".", "commit", "(", ")", ";", "mapOverlay", "=", "new", "MapOverlay", "(", "this", ")", ";", "mapOverlay", ".", "setOnOverlayEventListener", "(", "this", ")", ";", "mapView", ".", "getOverlays", "(", ")", ".", "add", "(", "mapOverlay", ")", ";", "mapView", ".", "setBuiltInZoomControls", "(", "true", ")", ";", "popupMenu", "=", "new", "PopupMenu", "(", "SITACActivity", ".", "this", ",", "findViewById", "(", "R", ".", "id", ".", "menu_anchor", ")", ")", ";", "Menu", "menu", "=", "popupMenu", ".", "getMenu", "(", ")", ";", "MenuInflater", "inflater", "=", "popupMenu", ".", "getMenuInflater", "(", ")", ";", "inflater", ".", "inflate", "(", "R", ".", "menu", ".", "sitac_context_menu", ",", "menu", ")", ";", "popupMenu", ".", "setOnMenuItemClickListener", "(", "this", ")", ";", "if", "(", "savedInstanceState", "!=", "null", ")", "{", "if", "(", "savedInstanceState", ".", "getBoolean", "(", "EDIT_ITEM", ",", "false", ")", ")", "{", "showEditItemDialog", "(", ")", ";", "}", "}", "}", "@", "Override", "public", "void", "update", "(", ")", "{", "List", "<", "IEntity", ">", "entities", "=", "controller", ".", "getEntities", "(", ")", ";", "android", ".", "util", ".", "Log", ".", "d", "(", "TAG", ",", "entities", ".", "toString", "(", ")", ")", ";", "mapOverlay", ".", "clearEntities", "(", ")", ";", "final", "ArrayList", "<", "IEntity", ">", "offSitacEntities", "=", "new", "ArrayList", "<", "IEntity", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entities", ".", "size", "(", ")", ";", "i", "++", ")", "{", "IEntity", "e", "=", "entities", ".", "get", "(", "i", ")", ";", "if", "(", "e", ".", "getModel", "(", ")", "instanceof", "VehicleDemandDTO", ")", "{", "VehicleDemandDTO", "dm", "=", "(", "VehicleDemandDTO", ")", "e", ".", "getModel", "(", ")", ";", "if", "(", "dm", ".", "getState", "(", ")", "==", "DemandState", ".", "ASKED", ")", "{", "if", "(", "e", ".", "getState", "(", ")", "==", "EntityState", ".", "ON_SITAC", ")", "{", "mapOverlay", ".", "addEntity", "(", "e", ")", ";", "}", "else", "{", "offSitacEntities", ".", "add", "(", "e", ")", ";", "}", "}", "}", "else", "{", "if", "(", "e", ".", "getState", "(", ")", "==", "EntityState", ".", "ON_SITAC", ")", "{", "mapOverlay", ".", "addEntity", "(", "e", ")", ";", "}", "else", "{", "offSitacEntities", ".", "add", "(", "e", ")", ";", "}", "}", "}", "runOnUiThread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "mapView", ".", "invalidate", "(", ")", ";", "openedMenuFrag", ".", "addOffSitacEntities", "(", "offSitacEntities", ")", ";", "}", "}", ")", ";", "}", "@", "Override", "public", "void", "onHideMenu", "(", ")", "{", "FragmentTransaction", "fTransac", "=", "fManager", ".", "beginTransaction", "(", ")", ";", "fTransac", ".", "hide", "(", "openedMenuFrag", ")", ";", "fTransac", ".", "show", "(", "hiddenMenuFrag", ")", ";", "fTransac", ".", "commit", "(", ")", ";", "}", "@", "Override", "public", "void", "onShowMenu", "(", ")", "{", "FragmentTransaction", "fTransac", "=", "fManager", ".", "beginTransaction", "(", ")", ";", "fTransac", ".", "hide", "(", "hiddenMenuFrag", ")", ";", "fTransac", ".", "show", "(", "openedMenuFrag", ")", ";", "fTransac", ".", "commit", "(", ")", ";", "openedMenuFrag", ".", "startShowMenuAnim", "(", ")", ";", "}", "@", "Override", "public", "void", "onEntitySelected", "(", "IEntity", "e", ",", "MenuGroup", "grp", ")", "{", "this", ".", "currentEntity", "=", "e", ";", "android", ".", "util", ".", "Log", ".", "d", "(", "TAG", ",", "\"\"", "+", "e", ".", "getModel", "(", ")", ".", "getName", "(", ")", "+", "\"", "\"", "+", "e", ".", "getModel", "(", ")", ".", "getId", "(", ")", ")", ";", "}", "@", "Override", "public", "void", "onEntityLongPressed", "(", "final", "IEntity", "entity", ")", "{", "runOnUiThread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "touchedEntity", "=", "entity", ";", "popupMenu", ".", "show", "(", ")", ";", "}", "}", ")", ";", "}", "@", "Override", "public", "void", "onOverlayLongPressed", "(", "MotionEvent", "e", ",", "MapView", "mapView", ")", "{", "if", "(", "currentEntity", "!=", "null", "&&", "currentEntity", ".", "getPictogram", "(", ")", ".", "getShape", "(", ")", "!=", "Shape", ".", "LINEAR_SHAPE", ")", "{", "GeoPoint", "m", "=", "(", "GeoPoint", ")", "mapView", ".", "getProjection", "(", ")", ".", "fromPixels", "(", "e", ".", "getX", "(", ")", ",", "e", ".", "getY", "(", ")", ")", ";", "PositionDTO", "p", "=", "new", "PositionDTO", "(", "m", ".", "getLatitudeE6", "(", ")", ",", "m", ".", "getLongitudeE6", "(", ")", ")", ";", "flag", "=", "ActionFlag", ".", "ADD", ";", "touchedEntity", "=", "currentEntity", ".", "clone", "(", ")", ";", "touchedEntity", ".", "getModel", "(", ")", ".", "setPosition", "(", "p", ")", ";", "if", "(", "touchedEntity", ".", "getModel", "(", ")", "instanceof", "VehicleDemandDTO", ")", "{", "(", "(", "VehicleDemandDTO", ")", "touchedEntity", ".", "getModel", "(", ")", ")", ".", "setState", "(", "DemandState", ".", "ASKED", ")", ";", "(", "(", "VehicleDemandDTO", ")", "touchedEntity", ".", "getModel", "(", ")", ")", ".", "setType", "(", "VehicleType", ".", "FPT", ")", ";", "}", "touchedEntity", ".", "setState", "(", "EntityState", ".", "ON_SITAC", ")", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "SITACActivity", ".", "this", ")", ";", "currentEntity", "=", "null", ";", "}", "}", "@", "Override", "public", "boolean", "onMenuItemClick", "(", "MenuItem", "item", ")", "{", "switch", "(", "item", ".", "getItemId", "(", ")", ")", "{", "case", "R", ".", "id", ".", "menu_item_delete", ":", "flag", "=", "ActionFlag", ".", "REMOVE", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "SITACActivity", ".", "this", ")", ";", "break", ";", "case", "R", ".", "id", ".", "menu_item_edit", ":", "showEditItemDialog", "(", ")", ";", "break", ";", "}", "return", "super", ".", "onContextItemSelected", "(", "item", ")", ";", "}", "private", "void", "showEditItemDialog", "(", ")", "{", "AlertDialog", ".", "Builder", "builder", "=", "new", "AlertDialog", ".", "Builder", "(", "SITACActivity", ".", "this", ")", ";", "builder", ".", "setTitle", "(", "getString", "(", "R", ".", "string", ".", "dialog_title_edit_item", ",", "touchedEntity", ".", "getModel", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "LayoutInflater", "inflater", "=", "getLayoutInflater", "(", ")", ";", "final", "View", "dialogView", "=", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "edit_item_dialog", ",", "null", ")", ";", "builder", ".", "setView", "(", "dialogView", ")", ";", "final", "EditText", "nameField", "=", "(", "EditText", ")", "dialogView", ".", "findViewById", "(", "R", ".", "id", ".", "name", ")", ";", "nameField", ".", "setHint", "(", "touchedEntity", ".", "getModel", "(", ")", ".", "getName", "(", ")", ")", ";", "builder", ".", "setPositiveButton", "(", "R", ".", "string", ".", "save", ",", "new", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "flag", "=", "ActionFlag", ".", "REMOVE", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "SITACActivity", ".", "this", ")", ";", "touchedEntity", ".", "getModel", "(", ")", ".", "setName", "(", "nameField", ".", "getText", "(", ")", ".", "toString", "(", ")", ".", "trim", "(", ")", ")", ";", "flag", "=", "ActionFlag", ".", "ADD", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "SITACActivity", ".", "this", ")", ";", "}", "}", ")", ";", "builder", ".", "setNegativeButton", "(", "R", ".", "string", ".", "cancel", ",", "null", ")", ";", "editItemDialog", "=", "builder", ".", "create", "(", ")", ";", "editItemDialog", ".", "show", "(", ")", ";", "}", "@", "Override", "protected", "void", "onSaveInstanceState", "(", "Bundle", "outState", ")", "{", "super", ".", "onSaveInstanceState", "(", "outState", ")", ";", "if", "(", "editItemDialog", "!=", "null", "&&", "editItemDialog", ".", "isShowing", "(", ")", ")", "{", "outState", ".", "putBoolean", "(", "EDIT_ITEM", ",", "true", ")", ";", "editItemDialog", ".", "dismiss", "(", ")", ";", "}", "}", "@", "Override", "public", "boolean", "onTouchEvent", "(", "MotionEvent", "event", ",", "MapView", "mapView", ")", "{", "return", "false", ";", "}", "@", "Override", "public", "boolean", "onUp", "(", "MotionEvent", "end", ",", "MapView", "mapView", ")", "{", "if", "(", "currentEntity", "!=", "null", "&&", "currentEntity", ".", "getPictogram", "(", ")", ".", "getShape", "(", ")", "==", "Shape", ".", "LINEAR_SHAPE", ")", "{", "Point", "start", ",", "stop", ";", "GeoPoint", "stopGeoP", "=", "(", "GeoPoint", ")", "mapView", ".", "getProjection", "(", ")", ".", "fromPixels", "(", "end", ".", "getX", "(", ")", ",", "end", ".", "getY", "(", ")", ")", ";", "PositionDTO", "lineBeginPos", "=", "new", "PositionDTO", "(", "lineBeginGeop", ".", "getLongitudeE6", "(", ")", ",", "lineBeginGeop", ".", "getLatitudeE6", "(", ")", ")", ";", "PositionDTO", "lineEndPos", "=", "new", "PositionDTO", "(", "stopGeoP", ".", "getLongitudeE6", "(", ")", ",", "stopGeoP", ".", "getLatitudeE6", "(", ")", ")", ";", "PositionDTO", "lineMiddlePos", "=", "new", "PositionDTO", "(", "(", "lineBeginGeop", ".", "getLongitudeE6", "(", ")", "+", "stopGeoP", ".", "getLongitudeE6", "(", ")", ")", "/", "2", ",", "(", "lineBeginGeop", ".", "getLatitudeE6", "(", ")", "+", "stopGeoP", ".", "getLatitudeE6", "(", ")", ")", "/", "2", ")", ";", "GeoPoint", "lineMiddleGeoP", "=", "new", "GeoPoint", "(", "(", "int", ")", "lineMiddlePos", ".", "getLatitude", "(", ")", ",", "(", "int", ")", "lineMiddlePos", ".", "getLongitude", "(", ")", ")", ";", "Point", "lineMiddlePoint", "=", "mapView", ".", "getProjection", "(", ")", ".", "toMapPixels", "(", "lineMiddleGeoP", ",", "null", ")", ";", "GeoPoint", "me", "=", "(", "GeoPoint", ")", "mapView", ".", "getProjection", "(", ")", ".", "fromPixels", "(", "end", ".", "getX", "(", ")", ",", "end", ".", "getY", "(", ")", ")", ";", "stop", "=", "mapView", ".", "getProjection", "(", ")", ".", "toMapPixels", "(", "me", ",", "null", ")", ";", "stop", ".", "set", "(", "stop", ".", "x", "-", "lineMiddlePoint", ".", "x", ",", "stop", ".", "y", "-", "lineMiddlePoint", ".", "y", ")", ";", "start", "=", "mapView", ".", "getProjection", "(", ")", ".", "toMapPixels", "(", "lineBeginGeop", ",", "null", ")", ";", "start", ".", "set", "(", "start", ".", "x", "-", "lineMiddlePoint", ".", "x", ",", "start", ".", "y", "-", "lineMiddlePoint", ".", "y", ")", ";", "LinePicto", "lp", "=", "new", "LinePicto", "(", "currentEntity", ".", "getPictogram", "(", ")", ".", "getName", "(", ")", ",", "currentEntity", ".", "getPictogram", "(", ")", ".", "getBitmap", "(", ")", ",", "currentEntity", ".", "getPictogram", "(", ")", ".", "getColor", "(", ")", ",", "currentEntity", ".", "getPictogram", "(", ")", ".", "getState", "(", ")", ",", "currentEntity", ".", "getPictogram", "(", ")", ".", "getShape", "(", ")", ",", "currentEntity", ".", "getPictogram", "(", ")", ".", "getGraphicalOverload", "(", ")", ",", "start", ",", "stop", ",", "mapView", ".", "getProjection", "(", ")", ".", "metersToEquatorPixels", "(", "1.0f", ")", ")", ";", "touchedEntity", "=", "currentEntity", ".", "clone", "(", ")", ";", "touchedEntity", ".", "getModel", "(", ")", ".", "setPosition", "(", "lineMiddlePos", ")", ";", "(", "(", "ActionDTO", ")", "touchedEntity", ".", "getModel", "(", ")", ")", ".", "setPosition", "(", "lineBeginPos", ")", ";", "(", "(", "ActionDTO", ")", "touchedEntity", ".", "getModel", "(", ")", ")", ".", "setAim", "(", "lineEndPos", ")", ";", "(", "(", "ActionDTO", ")", "touchedEntity", ".", "getModel", "(", ")", ")", ".", "setType", "(", "ActionType", ".", "FIRE", ")", ";", "(", "(", "LinePicto", ")", "touchedEntity", ".", "getPictogram", "(", ")", ")", ".", "setscaleRef", "(", "mapView", ".", "getProjection", "(", ")", ".", "metersToEquatorPixels", "(", "1.0f", ")", ")", ";", "(", "(", "LinePicto", ")", "touchedEntity", ".", "getPictogram", "(", ")", ")", ".", "setStart", "(", "start", ")", ";", "(", "(", "LinePicto", ")", "touchedEntity", ".", "getPictogram", "(", ")", ")", ".", "setStop", "(", "stop", ")", ";", "touchedEntity", ".", "setState", "(", "EntityState", ".", "ON_SITAC", ")", ";", "flag", "=", "ActionFlag", ".", "ADD", ";", "observable", ".", "setChanged", "(", ")", ";", "observable", ".", "notifyObservers", "(", "SITACActivity", ".", "this", ")", ";", "currentEntity", "=", "null", ";", "return", "true", ";", "}", "return", "false", ";", "}", "@", "Override", "public", "boolean", "lineBegin", "(", "MotionEvent", "start", ",", "MapView", "mapView", ")", "{", "if", "(", "currentEntity", "!=", "null", "&&", "currentEntity", ".", "getPictogram", "(", ")", ".", "getShape", "(", ")", "==", "Shape", ".", "LINEAR_SHAPE", ")", "{", "lineBeginGeop", "=", "(", "GeoPoint", ")", "mapView", ".", "getProjection", "(", ")", ".", "fromPixels", "(", "start", ".", "getX", "(", ")", ",", "start", ".", "getY", "(", ")", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "}", "</s>" ]
1,923
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "public", "enum", "Color", "{", "BLACK", ",", "GREEN", ",", "RED", ",", "BLUE", ",", "ORANGE", ",", "VIOLET", "}", "</s>" ]
1,924
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "MapView", ".", "Projection", ";", "import", "android", ".", "graphics", ".", "Bitmap", ";", "import", "android", ".", "graphics", ".", "Canvas", ";", "import", "android", ".", "graphics", ".", "Point", ";", "public", "interface", "IPictogram", "{", "public", "Bitmap", "getBitmap", "(", ")", ";", "public", "String", "getName", "(", ")", ";", "public", "Color", "getColor", "(", ")", ";", "public", "Shape", "getShape", "(", ")", ";", "public", "State", "getState", "(", ")", ";", "public", "GraphicalOverload", "getGraphicalOverload", "(", ")", ";", "public", "void", "draw", "(", "Canvas", "canvas", ",", "Point", "p", ",", "boolean", "shadow", ",", "Projection", "mapProjection", ")", ";", "public", "IPictogram", "clone", "(", ")", ";", "}", "</s>" ]
1,925
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "public", "enum", "Shape", "{", "SQUARE", ",", "TRIANGLE_UP", ",", "TRIANGLE_DOWN", ",", "CONTINUUM", ",", "CIRCLE", ",", "STAR_SHAPE", ",", "LINEAR_SHAPE", "}", "</s>" ]
1,926
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "agetac", ".", "R", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "view", ".", "LayoutInflater", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "ViewGroup", ";", "import", "android", ".", "widget", ".", "BaseExpandableListAdapter", ";", "import", "android", ".", "widget", ".", "ImageView", ";", "import", "android", ".", "widget", ".", "TextView", ";", "public", "class", "MenuExpandableListAdapter", "extends", "BaseExpandableListAdapter", "{", "private", "ArrayList", "<", "MenuGroup", ">", "groups", ";", "private", "LayoutInflater", "inflater", ";", "private", "int", "numChildSelected", "=", "-", "1", ";", "private", "int", "numGroupSelected", "=", "-", "1", ";", "public", "MenuExpandableListAdapter", "(", "Context", "context", ",", "ArrayList", "<", "MenuGroup", ">", "groups", ")", "{", "this", ".", "groups", "=", "groups", ";", "inflater", "=", "LayoutInflater", ".", "from", "(", "context", ")", ";", "}", "@", "Override", "public", "Object", "getChild", "(", "int", "groupPosition", ",", "int", "childPosition", ")", "{", "return", "groups", ".", "get", "(", "groupPosition", ")", ".", "getEntities", "(", ")", ".", "get", "(", "childPosition", ")", ".", "getPictogram", "(", ")", ";", "}", "@", "Override", "public", "long", "getChildId", "(", "int", "groupPosition", ",", "int", "childPosition", ")", "{", "return", "childPosition", ";", "}", "@", "Override", "public", "View", "getChildView", "(", "int", "groupPosition", ",", "int", "childPosition", ",", "boolean", "isLastChild", ",", "View", "convertView", ",", "ViewGroup", "parent", ")", "{", "final", "IPictogram", "picto", "=", "(", "IPictogram", ")", "getChild", "(", "groupPosition", ",", "childPosition", ")", ";", "ChildViewHolder", "childView", ";", "if", "(", "convertView", "==", "null", ")", "{", "childView", "=", "new", "ChildViewHolder", "(", ")", ";", "convertView", "=", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "menu_sitac_childs", ",", "null", ")", ";", "childView", ".", "imgChild", "=", "(", "ImageView", ")", "convertView", ".", "findViewById", "(", "R", ".", "id", ".", "menu_child_img", ")", ";", "childView", ".", "textViewChild", "=", "(", "TextView", ")", "convertView", ".", "findViewById", "(", "R", ".", "id", ".", "menu_child_text", ")", ";", "convertView", ".", "setTag", "(", "childView", ")", ";", "}", "else", "{", "childView", "=", "(", "ChildViewHolder", ")", "convertView", ".", "getTag", "(", ")", ";", "}", "childView", ".", "imgChild", ".", "setImageBitmap", "(", "picto", ".", "getBitmap", "(", ")", ")", ";", "childView", ".", "textViewChild", ".", "setText", "(", "picto", ".", "getName", "(", ")", ")", ";", "return", "convertView", ";", "}", "@", "Override", "public", "int", "getChildrenCount", "(", "int", "groupPosition", ")", "{", "return", "groups", ".", "get", "(", "groupPosition", ")", ".", "getEntities", "(", ")", ".", "size", "(", ")", ";", "}", "@", "Override", "public", "Object", "getGroup", "(", "int", "groupPosition", ")", "{", "return", "groups", ".", "get", "(", "groupPosition", ")", ";", "}", "@", "Override", "public", "int", "getGroupCount", "(", ")", "{", "return", "groups", ".", "size", "(", ")", ";", "}", "@", "Override", "public", "long", "getGroupId", "(", "int", "groupPosition", ")", "{", "return", "groupPosition", ";", "}", "@", "Override", "public", "View", "getGroupView", "(", "int", "groupPosition", ",", "boolean", "isExpanded", ",", "View", "convertView", ",", "ViewGroup", "parent", ")", "{", "GroupViewHolder", "groupView", ";", "MenuGroup", "group", "=", "(", "MenuGroup", ")", "getGroup", "(", "groupPosition", ")", ";", "if", "(", "convertView", "==", "null", ")", "{", "groupView", "=", "new", "GroupViewHolder", "(", ")", ";", "convertView", "=", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "menu_sitac_groups", ",", "null", ")", ";", "groupView", ".", "textViewGroup", "=", "(", "TextView", ")", "convertView", ".", "findViewById", "(", "R", ".", "id", ".", "sitac_group", ")", ";", "convertView", ".", "setTag", "(", "groupView", ")", ";", "}", "else", "{", "groupView", "=", "(", "GroupViewHolder", ")", "convertView", ".", "getTag", "(", ")", ";", "}", "groupView", ".", "textViewGroup", ".", "setText", "(", "group", ".", "getGroupName", "(", ")", ")", ";", "return", "convertView", ";", "}", "@", "Override", "public", "boolean", "hasStableIds", "(", ")", "{", "return", "false", ";", "}", "@", "Override", "public", "boolean", "isChildSelectable", "(", "int", "groupPosition", ",", "int", "childPosition", ")", "{", "return", "true", ";", "}", "public", "int", "getNumChildSelected", "(", ")", "{", "return", "numChildSelected", ";", "}", "public", "int", "getNumGroupSelected", "(", ")", "{", "return", "numGroupSelected", ";", "}", "public", "void", "setChildSelected", "(", "int", "numChild", ",", "int", "numGroup", ")", "{", "numChildSelected", "=", "numChild", ";", "numGroupSelected", "=", "numGroup", ";", "}", "class", "GroupViewHolder", "{", "public", "TextView", "textViewGroup", ";", "}", "class", "ChildViewHolder", "{", "public", "ImageView", "imgChild", ";", "public", "TextView", "textViewChild", ";", "}", "}", "</s>" ]
1,927
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "import", "org", ".", "agetac", ".", "listener", ".", "IOnOverlayEventListener", ";", "import", "org", ".", "osmdroid", ".", "api", ".", "IGeoPoint", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "MapView", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "overlay", ".", "Overlay", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "graphics", ".", "Bitmap", ";", "import", "android", ".", "graphics", ".", "Canvas", ";", "import", "android", ".", "graphics", ".", "Color", ";", "import", "android", ".", "graphics", ".", "Paint", ";", "import", "android", ".", "graphics", ".", "Point", ";", "import", "android", ".", "view", ".", "MotionEvent", ";", "public", "class", "MapOverlay", "extends", "Overlay", "{", "private", "static", "final", "String", "TAG", "=", "\"MapOverlay\"", ";", "private", "List", "<", "IEntity", ">", "items", ";", "private", "Paint", "itemPaint", ";", "private", "IOnOverlayEventListener", "listener", ";", "private", "int", "precision", ";", "private", "boolean", "lineTracingBegin", ",", "hasMoved", ";", "public", "MapOverlay", "(", "Context", "context", ")", "{", "super", "(", "context", ")", ";", "items", "=", "new", "ArrayList", "<", "IEntity", ">", "(", ")", ";", "itemPaint", "=", "new", "Paint", "(", ")", ";", "itemPaint", ".", "setColor", "(", "Color", ".", "RED", ")", ";", "itemPaint", ".", "setAntiAlias", "(", "true", ")", ";", "precision", "=", "5", ";", "lineTracingBegin", "=", "hasMoved", "=", "false", ";", "}", "private", "boolean", "checkNoItemSelected", "(", "MotionEvent", "e", ",", "MapView", "mapView", ")", "{", "IGeoPoint", "clickedP", "=", "mapView", ".", "getProjection", "(", ")", ".", "fromPixels", "(", "e", ".", "getX", "(", ")", ",", "e", ".", "getY", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "items", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "items", ".", "get", "(", "i", ")", ".", "isCloseTo", "(", "clickedP", ",", "precision", ")", ")", "{", "if", "(", "listener", "!=", "null", ")", "{", "listener", ".", "onEntityLongPressed", "(", "items", ".", "get", "(", "i", ")", ")", ";", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}", "@", "Override", "public", "boolean", "onLongPress", "(", "MotionEvent", "e", ",", "MapView", "mapView", ")", "{", "if", "(", "checkNoItemSelected", "(", "e", ",", "mapView", ")", "&&", "listener", "!=", "null", ")", "{", "listener", ".", "onOverlayLongPressed", "(", "e", ",", "mapView", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "@", "Override", "public", "boolean", "onDown", "(", "MotionEvent", "event", ",", "MapView", "mapView", ")", "{", "lineTracingBegin", "=", "listener", ".", "lineBegin", "(", "event", ",", "mapView", ")", ";", "return", "false", ";", "}", "@", "Override", "public", "boolean", "onTouchEvent", "(", "MotionEvent", "event", ",", "MapView", "mapView", ")", "{", "if", "(", "event", ".", "getAction", "(", ")", "==", "MotionEvent", ".", "ACTION_UP", ")", "{", "if", "(", "lineTracingBegin", "&&", "hasMoved", "&&", "listener", ".", "onUp", "(", "event", ",", "mapView", ")", ")", "{", "lineTracingBegin", "=", "false", ";", "hasMoved", "=", "false", ";", "}", "else", "{", "lineTracingBegin", "=", "false", ";", "return", "false", ";", "}", "}", "if", "(", "lineTracingBegin", ")", "{", "hasMoved", "=", "true", ";", "}", "return", "lineTracingBegin", ";", "}", "@", "Override", "protected", "void", "draw", "(", "Canvas", "canvas", ",", "MapView", "mapV", ",", "boolean", "shadow", ")", "{", "IEntity", "item", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "items", ".", "size", "(", ")", ";", "i", "++", ")", "{", "item", "=", "items", ".", "get", "(", "i", ")", ";", "item", ".", "draw", "(", "canvas", ",", "mapV", ",", "shadow", ")", ";", "}", "}", "public", "void", "addEntities", "(", "List", "<", "IEntity", ">", "entities", ")", "{", "items", ".", "clear", "(", ")", ";", "items", ".", "addAll", "(", "entities", ")", ";", "}", "public", "void", "addEntity", "(", "IEntity", "entity", ")", "{", "items", ".", "add", "(", "entity", ")", ";", "}", "public", "void", "setOnOverlayEventListener", "(", "IOnOverlayEventListener", "listener", ")", "{", "this", ".", "listener", "=", "listener", ";", "}", "public", "void", "removeOnOverlayEventListener", "(", ")", "{", "this", ".", "listener", "=", "null", ";", "}", "public", "void", "clearEntities", "(", ")", "{", "items", ".", "clear", "(", ")", ";", "}", "}", "</s>" ]
1,928
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "public", "enum", "State", "{", "PLANNED", ",", "STATE_HAPPENING", "}", "</s>" ]
1,929
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "MapView", ".", "Projection", ";", "import", "android", ".", "graphics", ".", "Bitmap", ";", "import", "android", ".", "graphics", ".", "Canvas", ";", "import", "android", ".", "graphics", ".", "Paint", ";", "import", "android", ".", "graphics", ".", "Point", ";", "public", "class", "LinePicto", "implements", "IPictogram", "{", "private", "Point", "start", ",", "stop", ";", "private", "float", "scaleRef", ";", "private", "Bitmap", "bmp", ";", "private", "String", "name", ";", "private", "Color", "color", ";", "private", "State", "state", ";", "private", "Shape", "shape", ";", "private", "GraphicalOverload", "graphicalOverload", ";", "Paint", "paint", ";", "public", "LinePicto", "(", "String", "name", ",", "Bitmap", "bmp", ",", "Point", "start", ",", "Point", "stop", ",", "float", "scaleRef", ")", "{", "this", ".", "start", "=", "start", ";", "this", ".", "stop", "=", "stop", ";", "this", ".", "scaleRef", "=", "scaleRef", ";", "this", ".", "color", "=", "null", ";", "this", ".", "state", "=", "null", ";", "this", ".", "shape", "=", "null", ";", "this", ".", "graphicalOverload", "=", "null", ";", "this", ".", "name", "=", "name", ";", "this", ".", "bmp", "=", "bmp", ";", "this", ".", "paint", "=", "new", "Paint", "(", ")", ";", "}", "public", "LinePicto", "(", "String", "name", ",", "Bitmap", "bmp", ",", "Color", "color", ",", "State", "state", ",", "Shape", "shape", ",", "GraphicalOverload", "graphicalOverload", ",", "Point", "start", ",", "Point", "stop", ",", "float", "scaleRef", ")", "{", "this", ".", "start", "=", "start", ";", "this", ".", "stop", "=", "stop", ";", "this", ".", "scaleRef", "=", "scaleRef", ";", "this", ".", "color", "=", "color", ";", "this", ".", "state", "=", "state", ";", "this", ".", "shape", "=", "shape", ";", "this", ".", "graphicalOverload", "=", "graphicalOverload", ";", "this", ".", "name", "=", "name", ";", "this", ".", "bmp", "=", "bmp", ";", "this", ".", "paint", "=", "new", "Paint", "(", ")", ";", "}", "public", "void", "setStart", "(", "Point", "start", ")", "{", "this", ".", "start", "=", "start", ";", "}", "public", "void", "setStop", "(", "Point", "stop", ")", "{", "this", ".", "stop", "=", "stop", ";", "}", "public", "void", "setscaleRef", "(", "float", "scaleRef", ")", "{", "this", ".", "scaleRef", "=", "scaleRef", ";", "}", "public", "Point", "getStart", "(", ")", "{", "return", "this", ".", "start", ";", "}", "public", "Point", "getStop", "(", ")", "{", "return", "this", ".", "stop", ";", "}", "public", "float", "getscaleRef", "(", ")", "{", "return", "this", ".", "scaleRef", ";", "}", "@", "Override", "public", "Bitmap", "getBitmap", "(", ")", "{", "return", "bmp", ";", "}", "@", "Override", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "@", "Override", "public", "Color", "getColor", "(", ")", "{", "return", "color", ";", "}", "@", "Override", "public", "Shape", "getShape", "(", ")", "{", "return", "shape", ";", "}", "@", "Override", "public", "State", "getState", "(", ")", "{", "return", "state", ";", "}", "@", "Override", "public", "GraphicalOverload", "getGraphicalOverload", "(", ")", "{", "return", "graphicalOverload", ";", "}", "@", "Override", "public", "void", "draw", "(", "Canvas", "canvas", ",", "Point", "p", ",", "boolean", "shadow", ",", "Projection", "mapProjection", ")", "{", "float", "s", "=", "mapProjection", ".", "metersToEquatorPixels", "(", "1.0f", ")", "/", "scaleRef", ";", "canvas", ".", "drawLine", "(", "p", ".", "x", "+", "s", "*", "start", ".", "x", ",", "p", ".", "y", "+", "s", "*", "start", ".", "y", ",", "p", ".", "x", "+", "s", "*", "stop", ".", "x", ",", "p", ".", "y", "+", "s", "*", "stop", ".", "y", ",", "paint", ")", ";", "canvas", ".", "drawLine", "(", "p", ".", "x", "+", "s", "*", "stop", ".", "x", ",", "p", ".", "y", "+", "s", "*", "stop", ".", "y", ",", "p", ".", "x", "+", "s", "*", "(", "stop", ".", "x", "+", "(", "start", ".", "x", "-", "stop", ".", "x", ")", "/", "16", "+", "(", "start", ".", "y", "-", "stop", ".", "y", ")", "/", "16", ")", ",", "p", ".", "y", "+", "s", "*", "(", "stop", ".", "y", "+", "(", "start", ".", "y", "-", "stop", ".", "y", ")", "/", "16", "+", "(", "-", "start", ".", "x", "+", "stop", ".", "x", ")", "/", "16", ")", ",", "paint", ")", ";", "canvas", ".", "drawLine", "(", "p", ".", "x", "+", "s", "*", "stop", ".", "x", ",", "p", ".", "y", "+", "s", "*", "stop", ".", "y", ",", "p", ".", "x", "+", "s", "*", "(", "stop", ".", "x", "+", "(", "start", ".", "x", "-", "stop", ".", "x", ")", "/", "16", "-", "(", "start", ".", "y", "-", "stop", ".", "y", ")", "/", "16", ")", ",", "p", ".", "y", "+", "s", "*", "(", "stop", ".", "y", "+", "(", "start", ".", "y", "-", "stop", ".", "y", ")", "/", "16", "-", "(", "-", "start", ".", "x", "+", "stop", ".", "x", ")", "/", "16", ")", ",", "paint", ")", ";", "}", "@", "Override", "public", "LinePicto", "clone", "(", ")", "{", "return", "new", "LinePicto", "(", "name", ",", "bmp", ",", "color", ",", "state", ",", "shape", ",", "graphicalOverload", ",", "new", "Point", "(", "start", ")", ",", "new", "Point", "(", "stop", ")", ",", "scaleRef", ")", ";", "}", "}", "</s>" ]
1,930
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "public", "enum", "GraphicalOverload", "{", "NONE", ",", "ISOLE", ",", "GROUPE", ",", "COLONNE", ",", "}", "</s>" ]
1,931
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "public", "class", "MenuGroup", "{", "private", "String", "groupName", ";", "private", "ArrayList", "<", "IEntity", ">", "entities", ";", "public", "MenuGroup", "(", "String", "name", ")", "{", "this", ".", "groupName", "=", "name", ";", "this", ".", "entities", "=", "new", "ArrayList", "<", "IEntity", ">", "(", ")", ";", "}", "public", "String", "getGroupName", "(", ")", "{", "return", "groupName", ";", "}", "public", "void", "setGroupName", "(", "String", "groupName", ")", "{", "this", ".", "groupName", "=", "groupName", ";", "}", "public", "ArrayList", "<", "IEntity", ">", "getEntities", "(", ")", "{", "return", "entities", ";", "}", "public", "void", "setEntities", "(", "ArrayList", "<", "IEntity", ">", "entities", ")", "{", "this", ".", "entities", "=", "entities", ";", "}", "}", "</s>" ]
1,932
[ "<s>", "package", "org", ".", "agetac", ".", "view", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "MapView", ".", "Projection", ";", "import", "android", ".", "graphics", ".", "Bitmap", ";", "import", "android", ".", "graphics", ".", "Canvas", ";", "import", "android", ".", "graphics", ".", "Point", ";", "public", "class", "Pictogram", "implements", "IPictogram", "{", "private", "Bitmap", "bmp", ";", "private", "String", "name", ";", "private", "Color", "color", ";", "private", "State", "state", ";", "private", "Shape", "shape", ";", "private", "GraphicalOverload", "graphicalOverload", ";", "public", "Pictogram", "(", "String", "name", ",", "Bitmap", "bmp", ")", "{", "this", ".", "color", "=", "null", ";", "this", ".", "state", "=", "null", ";", "this", ".", "shape", "=", "null", ";", "this", ".", "graphicalOverload", "=", "null", ";", "this", ".", "name", "=", "name", ";", "this", ".", "bmp", "=", "bmp", ";", "}", "public", "Pictogram", "(", "String", "name", ",", "Bitmap", "bmp", ",", "Color", "color", ",", "State", "state", ",", "Shape", "shape", ",", "GraphicalOverload", "graphicalOverload", ")", "{", "this", ".", "color", "=", "color", ";", "this", ".", "state", "=", "state", ";", "this", ".", "shape", "=", "shape", ";", "this", ".", "graphicalOverload", "=", "graphicalOverload", ";", "this", ".", "name", "=", "name", ";", "this", ".", "bmp", "=", "bmp", ";", "}", "@", "Override", "public", "Bitmap", "getBitmap", "(", ")", "{", "return", "bmp", ";", "}", "@", "Override", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "name", ";", "}", "@", "Override", "public", "Color", "getColor", "(", ")", "{", "return", "color", ";", "}", "@", "Override", "public", "Shape", "getShape", "(", ")", "{", "return", "shape", ";", "}", "@", "Override", "public", "State", "getState", "(", ")", "{", "return", "state", ";", "}", "@", "Override", "public", "GraphicalOverload", "getGraphicalOverload", "(", ")", "{", "return", "graphicalOverload", ";", "}", "@", "Override", "public", "void", "draw", "(", "Canvas", "canvas", ",", "Point", "p", ",", "boolean", "shadow", ",", "Projection", "mapProjection", ")", "{", "canvas", ".", "drawBitmap", "(", "bmp", ",", "p", ".", "x", "-", "(", "bmp", ".", "getWidth", "(", ")", "/", "2", ")", ",", "p", ".", "y", "-", "(", "bmp", ".", "getHeight", "(", ")", "/", "2", ")", ",", "null", ")", ";", "}", "@", "Override", "public", "Pictogram", "clone", "(", ")", "{", "return", "this", ";", "}", "}", "</s>" ]
1,933
[ "<s>", "package", "org", ".", "agetac", ".", "listener", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "import", "org", ".", "agetac", ".", "view", ".", "MenuGroup", ";", "public", "interface", "IOnMenuEventListener", "{", "public", "void", "onHideMenu", "(", ")", ";", "public", "void", "onShowMenu", "(", ")", ";", "public", "void", "onEntitySelected", "(", "IEntity", "e", ",", "MenuGroup", "grp", ")", ";", "}", "</s>" ]
1,934
[ "<s>", "package", "org", ".", "agetac", ".", "listener", ";", "import", "org", ".", "agetac", ".", "entity", ".", "IEntity", ";", "import", "org", ".", "osmdroid", ".", "views", ".", "MapView", ";", "import", "android", ".", "view", ".", "MotionEvent", ";", "public", "interface", "IOnOverlayEventListener", "{", "public", "void", "onEntityLongPressed", "(", "final", "IEntity", "entity", ")", ";", "public", "void", "onOverlayLongPressed", "(", "final", "MotionEvent", "event", ",", "final", "MapView", "mapView", ")", ";", "public", "boolean", "onTouchEvent", "(", "final", "MotionEvent", "event", ",", "final", "MapView", "mapView", ")", ";", "public", "boolean", "lineBegin", "(", "final", "MotionEvent", "event", ",", "final", "MapView", "mapView", ")", ";", "public", "boolean", "onUp", "(", "final", "MotionEvent", "end", ",", "final", "MapView", "mapView", ")", ";", "}", "</s>" ]
1,935
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "Activity", ";", "import", "android", ".", "app", ".", "AlertDialog", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "DialogInterface", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "SharedPreferences", ";", "import", "android", ".", "content", ".", "res", ".", "Configuration", ";", "import", "android", ".", "database", ".", "Cursor", ";", "import", "android", ".", "net", ".", "Uri", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "os", ".", "Handler", ";", "import", "android", ".", "view", ".", "ContextMenu", ";", "import", "android", ".", "view", ".", "ContextMenu", ".", "ContextMenuInfo", ";", "import", "android", ".", "view", ".", "LayoutInflater", ";", "import", "android", ".", "view", ".", "Menu", ";", "import", "android", ".", "view", ".", "MenuItem", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "View", ".", "OnClickListener", ";", "import", "android", ".", "view", ".", "ViewGroup", ";", "import", "android", ".", "widget", ".", "AdapterView", ";", "import", "android", ".", "widget", ".", "AdapterView", ".", "AdapterContextMenuInfo", ";", "import", "android", ".", "widget", ".", "AdapterView", ".", "OnItemClickListener", ";", "import", "android", ".", "widget", ".", "CheckBox", ";", "import", "android", ".", "widget", ".", "CursorAdapter", ";", "import", "android", ".", "widget", ".", "ListView", ";", "import", "android", ".", "widget", ".", "TextView", ";", "import", "java", ".", "text", ".", "DateFormatSymbols", ";", "import", "java", ".", "util", ".", "Calendar", ";", "public", "class", "AlarmClock", "extends", "Activity", "implements", "OnItemClickListener", "{", "static", "final", "String", "PREFERENCES", "=", "\"AlarmClock\"", ";", "static", "final", "String", "PREF_CLOCK_FACE", "=", "\"face\"", ";", "static", "final", "String", "PREF_SHOW_CLOCK", "=", "\"show_clock\"", ";", "static", "final", "int", "MAX_ALARM_COUNT", "=", "12", ";", "static", "final", "boolean", "DEBUG", "=", "false", ";", "private", "SharedPreferences", "mPrefs", ";", "private", "LayoutInflater", "mFactory", ";", "private", "ViewGroup", "mClockLayout", ";", "private", "View", "mClock", "=", "null", ";", "private", "ListView", "mAlarmsList", ";", "private", "Cursor", "mCursor", ";", "private", "String", "mAm", ",", "mPm", ";", "private", "int", "mFace", "=", "-", "1", ";", "static", "final", "int", "[", "]", "CLOCKS", "=", "{", "R", ".", "layout", ".", "clock_basic_bw", ",", "R", ".", "layout", ".", "clock_googly", ",", "R", ".", "layout", ".", "clock_droid2", ",", "R", ".", "layout", ".", "clock_droids", ",", "R", ".", "layout", ".", "digital_clock", "}", ";", "private", "class", "AlarmTimeAdapter", "extends", "CursorAdapter", "{", "public", "AlarmTimeAdapter", "(", "Context", "context", ",", "Cursor", "cursor", ")", "{", "super", "(", "context", ",", "cursor", ")", ";", "}", "public", "View", "newView", "(", "Context", "context", ",", "Cursor", "cursor", ",", "ViewGroup", "parent", ")", "{", "View", "ret", "=", "mFactory", ".", "inflate", "(", "R", ".", "layout", ".", "alarm_time", ",", "parent", ",", "false", ")", ";", "(", "(", "TextView", ")", "ret", ".", "findViewById", "(", "R", ".", "id", ".", "am", ")", ")", ".", "setText", "(", "mAm", ")", ";", "(", "(", "TextView", ")", "ret", ".", "findViewById", "(", "R", ".", "id", ".", "pm", ")", ")", ".", "setText", "(", "mPm", ")", ";", "DigitalClock", "digitalClock", "=", "(", "DigitalClock", ")", "ret", ".", "findViewById", "(", "R", ".", "id", ".", "digitalClock", ")", ";", "digitalClock", ".", "setLive", "(", "false", ")", ";", "return", "ret", ";", "}", "public", "void", "bindView", "(", "View", "view", ",", "Context", "context", ",", "Cursor", "cursor", ")", "{", "final", "Alarm", "alarm", "=", "new", "Alarm", "(", "cursor", ")", ";", "CheckBox", "onButton", "=", "(", "CheckBox", ")", "view", ".", "findViewById", "(", "R", ".", "id", ".", "alarmButton", ")", ";", "onButton", ".", "setChecked", "(", "alarm", ".", "enabled", ")", ";", "onButton", ".", "setOnClickListener", "(", "new", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "View", "v", ")", "{", "boolean", "isChecked", "=", "(", "(", "CheckBox", ")", "v", ")", ".", "isChecked", "(", ")", ";", "Alarms", ".", "enableAlarm", "(", "AlarmClock", ".", "this", ",", "alarm", ".", "id", ",", "isChecked", ")", ";", "if", "(", "isChecked", ")", "{", "SetAlarm", ".", "popAlarmSetToast", "(", "AlarmClock", ".", "this", ",", "alarm", ".", "hour", ",", "alarm", ".", "minutes", ",", "alarm", ".", "daysOfWeek", ")", ";", "}", "}", "}", ")", ";", "DigitalClock", "digitalClock", "=", "(", "DigitalClock", ")", "view", ".", "findViewById", "(", "R", ".", "id", ".", "digitalClock", ")", ";", "final", "Calendar", "c", "=", "Calendar", ".", "getInstance", "(", ")", ";", "c", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "alarm", ".", "hour", ")", ";", "c", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "alarm", ".", "minutes", ")", ";", "digitalClock", ".", "updateTime", "(", "c", ")", ";", "TextView", "daysOfWeekView", "=", "(", "TextView", ")", "digitalClock", ".", "findViewById", "(", "R", ".", "id", ".", "daysOfWeek", ")", ";", "final", "String", "daysOfWeekStr", "=", "alarm", ".", "daysOfWeek", ".", "toString", "(", "AlarmClock", ".", "this", ",", "false", ")", ";", "if", "(", "daysOfWeekStr", "!=", "null", "&&", "daysOfWeekStr", ".", "length", "(", ")", "!=", "0", ")", "{", "daysOfWeekView", ".", "setText", "(", "daysOfWeekStr", ")", ";", "daysOfWeekView", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}", "else", "{", "daysOfWeekView", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "}", "TextView", "labelView", "=", "(", "TextView", ")", "digitalClock", ".", "findViewById", "(", "R", ".", "id", ".", "label", ")", ";", "if", "(", "alarm", ".", "label", "!=", "null", "&&", "alarm", ".", "label", ".", "length", "(", ")", "!=", "0", ")", "{", "labelView", ".", "setText", "(", "alarm", ".", "label", ")", ";", "labelView", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}", "else", "{", "labelView", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "}", "}", "}", ";", "@", "Override", "public", "boolean", "onContextItemSelected", "(", "final", "MenuItem", "item", ")", "{", "final", "AdapterContextMenuInfo", "info", "=", "(", "AdapterContextMenuInfo", ")", "item", ".", "getMenuInfo", "(", ")", ";", "final", "int", "id", "=", "(", "int", ")", "info", ".", "id", ";", "switch", "(", "item", ".", "getItemId", "(", ")", ")", "{", "case", "R", ".", "id", ".", "delete_alarm", ":", "new", "AlertDialog", ".", "Builder", "(", "this", ")", ".", "setTitle", "(", "getString", "(", "R", ".", "string", ".", "delete_alarm", ")", ")", ".", "setMessage", "(", "getString", "(", "R", ".", "string", ".", "delete_alarm_confirm", ")", ")", ".", "setPositiveButton", "(", "android", ".", "R", ".", "string", ".", "ok", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "d", ",", "int", "w", ")", "{", "Alarms", ".", "deleteAlarm", "(", "AlarmClock", ".", "this", ",", "id", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "android", ".", "R", ".", "string", ".", "cancel", ",", "null", ")", ".", "show", "(", ")", ";", "return", "true", ";", "case", "R", ".", "id", ".", "enable_alarm", ":", "final", "Cursor", "c", "=", "(", "Cursor", ")", "mAlarmsList", ".", "getAdapter", "(", ")", ".", "getItem", "(", "info", ".", "position", ")", ";", "final", "Alarm", "alarm", "=", "new", "Alarm", "(", "c", ")", ";", "Alarms", ".", "enableAlarm", "(", "this", ",", "alarm", ".", "id", ",", "!", "alarm", ".", "enabled", ")", ";", "if", "(", "!", "alarm", ".", "enabled", ")", "{", "SetAlarm", ".", "popAlarmSetToast", "(", "this", ",", "alarm", ".", "hour", ",", "alarm", ".", "minutes", ",", "alarm", ".", "daysOfWeek", ")", ";", "}", "return", "true", ";", "default", ":", "break", ";", "}", "return", "super", ".", "onContextItemSelected", "(", "item", ")", ";", "}", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "icicle", ")", "{", "super", ".", "onCreate", "(", "icicle", ")", ";", "String", "[", "]", "ampm", "=", "new", "DateFormatSymbols", "(", ")", ".", "getAmPmStrings", "(", ")", ";", "mAm", "=", "ampm", "[", "0", "]", ";", "mPm", "=", "ampm", "[", "1", "]", ";", "mFactory", "=", "LayoutInflater", ".", "from", "(", "this", ")", ";", "mPrefs", "=", "getSharedPreferences", "(", "PREFERENCES", ",", "0", ")", ";", "mCursor", "=", "Alarms", ".", "getAlarmsCursor", "(", "getContentResolver", "(", ")", ")", ";", "updateLayout", "(", ")", ";", "setClockVisibility", "(", "mPrefs", ".", "getBoolean", "(", "PREF_SHOW_CLOCK", ",", "true", ")", ")", ";", "}", "private", "final", "Handler", "mHandler", "=", "new", "Handler", "(", ")", ";", "@", "Override", "public", "void", "onConfigurationChanged", "(", "Configuration", "newConfig", ")", "{", "super", ".", "onConfigurationChanged", "(", "newConfig", ")", ";", "mHandler", ".", "post", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "updateLayout", "(", ")", ";", "inflateClock", "(", ")", ";", "setClockVisibility", "(", "mPrefs", ".", "getBoolean", "(", "PREF_SHOW_CLOCK", ",", "true", ")", ")", ";", "}", "}", ")", ";", "}", "private", "void", "updateLayout", "(", ")", "{", "setContentView", "(", "R", ".", "layout", ".", "alarm_clock", ")", ";", "mAlarmsList", "=", "(", "ListView", ")", "findViewById", "(", "R", ".", "id", ".", "alarms_list", ")", ";", "mAlarmsList", ".", "setAdapter", "(", "new", "AlarmTimeAdapter", "(", "this", ",", "mCursor", ")", ")", ";", "mAlarmsList", ".", "setVerticalScrollBarEnabled", "(", "true", ")", ";", "mAlarmsList", ".", "setOnItemClickListener", "(", "this", ")", ";", "mAlarmsList", ".", "setOnCreateContextMenuListener", "(", "this", ")", ";", "mClockLayout", "=", "(", "ViewGroup", ")", "findViewById", "(", "R", ".", "id", ".", "clock_layout", ")", ";", "mClockLayout", ".", "setOnClickListener", "(", "new", "View", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "View", "v", ")", "{", "final", "Intent", "intent", "=", "new", "Intent", "(", "AlarmClock", ".", "this", ",", "ClockPicker", ".", "class", ")", ";", "intent", ".", "setFlags", "(", "Intent", ".", "FLAG_ACTIVITY_NEW_TASK", ")", ";", "startActivity", "(", "intent", ")", ";", "}", "}", ")", ";", "}", "@", "Override", "protected", "void", "onResume", "(", ")", "{", "super", ".", "onResume", "(", ")", ";", "int", "face", "=", "mPrefs", ".", "getInt", "(", "PREF_CLOCK_FACE", ",", "0", ")", ";", "if", "(", "mFace", "!=", "face", ")", "{", "if", "(", "face", "<", "0", "||", "face", ">=", "AlarmClock", ".", "CLOCKS", ".", "length", ")", "{", "mFace", "=", "0", ";", "}", "else", "{", "mFace", "=", "face", ";", "}", "inflateClock", "(", ")", ";", "}", "}", "@", "Override", "protected", "void", "onDestroy", "(", ")", "{", "super", ".", "onDestroy", "(", ")", ";", "ToastMaster", ".", "cancelToast", "(", ")", ";", "mCursor", ".", "deactivate", "(", ")", ";", "}", "protected", "void", "inflateClock", "(", ")", "{", "if", "(", "mClock", "!=", "null", ")", "{", "mClockLayout", ".", "removeView", "(", "mClock", ")", ";", "}", "LayoutInflater", ".", "from", "(", "this", ")", ".", "inflate", "(", "CLOCKS", "[", "mFace", "]", ",", "mClockLayout", ")", ";", "mClock", "=", "findViewById", "(", "R", ".", "id", ".", "clock", ")", ";", "TextView", "am", "=", "(", "TextView", ")", "findViewById", "(", "R", ".", "id", ".", "am", ")", ";", "TextView", "pm", "=", "(", "TextView", ")", "findViewById", "(", "R", ".", "id", ".", "pm", ")", ";", "if", "(", "am", "!=", "null", ")", "{", "am", ".", "setText", "(", "mAm", ")", ";", "}", "if", "(", "pm", "!=", "null", ")", "{", "pm", ".", "setText", "(", "mPm", ")", ";", "}", "}", "@", "Override", "public", "boolean", "onCreateOptionsMenu", "(", "Menu", "menu", ")", "{", "getMenuInflater", "(", ")", ".", "inflate", "(", "R", ".", "menu", ".", "main_menu", ",", "menu", ")", ";", "return", "super", ".", "onCreateOptionsMenu", "(", "menu", ")", ";", "}", "@", "Override", "public", "void", "onCreateContextMenu", "(", "ContextMenu", "menu", ",", "View", "view", ",", "ContextMenuInfo", "menuInfo", ")", "{", "getMenuInflater", "(", ")", ".", "inflate", "(", "R", ".", "menu", ".", "context_menu", ",", "menu", ")", ";", "final", "AdapterContextMenuInfo", "info", "=", "(", "AdapterContextMenuInfo", ")", "menuInfo", ";", "final", "Cursor", "c", "=", "(", "Cursor", ")", "mAlarmsList", ".", "getAdapter", "(", ")", ".", "getItem", "(", "(", "int", ")", "info", ".", "position", ")", ";", "final", "Alarm", "alarm", "=", "new", "Alarm", "(", "c", ")", ";", "final", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "alarm", ".", "hour", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "alarm", ".", "minutes", ")", ";", "final", "String", "time", "=", "Alarms", ".", "formatTime", "(", "this", ",", "cal", ")", ";", "final", "View", "v", "=", "mFactory", ".", "inflate", "(", "R", ".", "layout", ".", "context_menu_header", ",", "null", ")", ";", "TextView", "textView", "=", "(", "TextView", ")", "v", ".", "findViewById", "(", "R", ".", "id", ".", "header_time", ")", ";", "textView", ".", "setText", "(", "time", ")", ";", "textView", "=", "(", "TextView", ")", "v", ".", "findViewById", "(", "R", ".", "id", ".", "header_label", ")", ";", "textView", ".", "setText", "(", "alarm", ".", "label", ")", ";", "menu", ".", "setHeaderView", "(", "v", ")", ";", "if", "(", "alarm", ".", "enabled", ")", "{", "menu", ".", "findItem", "(", "R", ".", "id", ".", "enable_alarm", ")", ".", "setTitle", "(", "R", ".", "string", ".", "disable_alarm", ")", ";", "}", "}", "public", "void", "onItemClick", "(", "AdapterView", "parent", ",", "View", "v", ",", "int", "pos", ",", "long", "id", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "this", ",", "SetAlarm", ".", "class", ")", ";", "intent", ".", "putExtra", "(", "Alarms", ".", "ALARM_ID", ",", "(", "int", ")", "id", ")", ";", "startActivity", "(", "intent", ")", ";", "}", "@", "Override", "public", "boolean", "onPrepareOptionsMenu", "(", "Menu", "menu", ")", "{", "menu", ".", "findItem", "(", "R", ".", "id", ".", "menu_add_alarm", ")", ".", "setVisible", "(", "mAlarmsList", ".", "getAdapter", "(", ")", ".", "getCount", "(", ")", "<", "MAX_ALARM_COUNT", ")", ";", "menu", ".", "findItem", "(", "R", ".", "id", ".", "menu_toggle_clock", ")", ".", "setTitle", "(", "getClockVisibility", "(", ")", "?", "R", ".", "string", ".", "hide_clock", ":", "R", ".", "string", ".", "show_clock", ")", ";", "return", "super", ".", "onPrepareOptionsMenu", "(", "menu", ")", ";", "}", "@", "Override", "public", "boolean", "onOptionsItemSelected", "(", "MenuItem", "item", ")", "{", "switch", "(", "item", ".", "getItemId", "(", ")", ")", "{", "case", "R", ".", "id", ".", "menu_add_alarm", ":", "Uri", "uri", "=", "Alarms", ".", "addAlarm", "(", "getContentResolver", "(", ")", ")", ";", "String", "segment", "=", "uri", ".", "getPathSegments", "(", ")", ".", "get", "(", "1", ")", ";", "int", "newId", "=", "Integer", ".", "parseInt", "(", "segment", ")", ";", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"\"", "+", "newId", ")", ";", "}", "Intent", "intent", "=", "new", "Intent", "(", "this", ",", "SetAlarm", ".", "class", ")", ";", "intent", ".", "putExtra", "(", "Alarms", ".", "ALARM_ID", ",", "newId", ")", ";", "startActivity", "(", "intent", ")", ";", "return", "true", ";", "case", "R", ".", "id", ".", "menu_toggle_clock", ":", "setClockVisibility", "(", "!", "getClockVisibility", "(", ")", ")", ";", "saveClockVisibility", "(", ")", ";", "return", "true", ";", "case", "R", ".", "id", ".", "menu_settings", ":", "startActivity", "(", "new", "Intent", "(", "this", ",", "SettingsActivity", ".", "class", ")", ")", ";", "return", "true", ";", "}", "return", "super", ".", "onOptionsItemSelected", "(", "item", ")", ";", "}", "private", "boolean", "getClockVisibility", "(", ")", "{", "return", "mClockLayout", ".", "getVisibility", "(", ")", "==", "View", ".", "VISIBLE", ";", "}", "private", "void", "setClockVisibility", "(", "boolean", "visible", ")", "{", "mClockLayout", ".", "setVisibility", "(", "visible", "?", "View", ".", "VISIBLE", ":", "View", ".", "GONE", ")", ";", "}", "private", "void", "saveClockVisibility", "(", ")", "{", "mPrefs", ".", "edit", "(", ")", ".", "putBoolean", "(", "PREF_SHOW_CLOCK", ",", "getClockVisibility", "(", ")", ")", ".", "commit", "(", ")", ";", "}", "}", "</s>" ]
1,936
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "os", ".", "PowerManager", ";", "class", "AlarmAlertWakeLock", "{", "private", "static", "PowerManager", ".", "WakeLock", "sCpuWakeLock", ";", "static", "void", "acquireCpuWakeLock", "(", "Context", "context", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "if", "(", "sCpuWakeLock", "!=", "null", ")", "{", "return", ";", "}", "PowerManager", "pm", "=", "(", "PowerManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "POWER_SERVICE", ")", ";", "sCpuWakeLock", "=", "pm", ".", "newWakeLock", "(", "PowerManager", ".", "PARTIAL_WAKE_LOCK", "|", "PowerManager", ".", "ACQUIRE_CAUSES_WAKEUP", "|", "PowerManager", ".", "ON_AFTER_RELEASE", ",", "Log", ".", "LOGTAG", ")", ";", "sCpuWakeLock", ".", "acquire", "(", ")", ";", "}", "static", "void", "releaseCpuLock", "(", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "if", "(", "sCpuWakeLock", "!=", "null", ")", "{", "sCpuWakeLock", ".", "release", "(", ")", ";", "sCpuWakeLock", "=", "null", ";", "}", "}", "}", "</s>" ]
1,937
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "Service", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "res", ".", "AssetFileDescriptor", ";", "import", "android", ".", "content", ".", "res", ".", "Resources", ";", "import", "android", ".", "media", ".", "AudioManager", ";", "import", "android", ".", "media", ".", "MediaPlayer", ";", "import", "android", ".", "media", ".", "MediaPlayer", ".", "OnErrorListener", ";", "import", "android", ".", "media", ".", "RingtoneManager", ";", "import", "android", ".", "net", ".", "Uri", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "os", ".", "Handler", ";", "import", "android", ".", "os", ".", "IBinder", ";", "import", "android", ".", "os", ".", "Message", ";", "import", "android", ".", "os", ".", "Vibrator", ";", "import", "android", ".", "telephony", ".", "PhoneStateListener", ";", "import", "android", ".", "telephony", ".", "TelephonyManager", ";", "public", "class", "AlarmKlaxon", "extends", "Service", "{", "private", "static", "final", "int", "ALARM_TIMEOUT_SECONDS", "=", "10", "*", "60", ";", "private", "static", "final", "long", "[", "]", "sVibratePattern", "=", "new", "long", "[", "]", "{", "500", ",", "500", "}", ";", "private", "boolean", "mPlaying", "=", "false", ";", "private", "Vibrator", "mVibrator", ";", "private", "MediaPlayer", "mMediaPlayer", ";", "private", "Alarm", "mCurrentAlarm", ";", "private", "long", "mStartTime", ";", "private", "TelephonyManager", "mTelephonyManager", ";", "private", "int", "mInitialCallState", ";", "private", "static", "final", "int", "KILLER", "=", "1000", ";", "private", "Handler", "mHandler", "=", "new", "Handler", "(", ")", "{", "public", "void", "handleMessage", "(", "Message", "msg", ")", "{", "switch", "(", "msg", ".", "what", ")", "{", "case", "KILLER", ":", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "}", "sendKillBroadcast", "(", "(", "Alarm", ")", "msg", ".", "obj", ")", ";", "stopSelf", "(", ")", ";", "break", ";", "}", "}", "}", ";", "private", "PhoneStateListener", "mPhoneStateListener", "=", "new", "PhoneStateListener", "(", ")", "{", "@", "Override", "public", "void", "onCallStateChanged", "(", "int", "state", ",", "String", "ignored", ")", "{", "if", "(", "state", "!=", "TelephonyManager", ".", "CALL_STATE_IDLE", "&&", "state", "!=", "mInitialCallState", ")", "{", "sendKillBroadcast", "(", "mCurrentAlarm", ")", ";", "stopSelf", "(", ")", ";", "}", "}", "}", ";", "@", "Override", "public", "void", "onCreate", "(", ")", "{", "mVibrator", "=", "new", "Vibrator", "(", ")", ";", "mTelephonyManager", "=", "(", "TelephonyManager", ")", "getSystemService", "(", "Context", ".", "TELEPHONY_SERVICE", ")", ";", "mTelephonyManager", ".", "listen", "(", "mPhoneStateListener", ",", "PhoneStateListener", ".", "LISTEN_CALL_STATE", ")", ";", "AlarmAlertWakeLock", ".", "acquireCpuWakeLock", "(", "this", ")", ";", "}", "@", "Override", "public", "void", "onDestroy", "(", ")", "{", "stop", "(", ")", ";", "mTelephonyManager", ".", "listen", "(", "mPhoneStateListener", ",", "0", ")", ";", "AlarmAlertWakeLock", ".", "releaseCpuLock", "(", ")", ";", "}", "@", "Override", "public", "IBinder", "onBind", "(", "Intent", "intent", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "int", "onStartCommand", "(", "Intent", "intent", ",", "int", "flags", ",", "int", "startId", ")", "{", "if", "(", "intent", "==", "null", ")", "{", "stopSelf", "(", ")", ";", "return", "START_NOT_STICKY", ";", "}", "final", "Alarm", "alarm", "=", "intent", ".", "getParcelableExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ")", ";", "if", "(", "alarm", "==", "null", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "stopSelf", "(", ")", ";", "return", "START_NOT_STICKY", ";", "}", "if", "(", "mCurrentAlarm", "!=", "null", ")", "{", "sendKillBroadcast", "(", "mCurrentAlarm", ")", ";", "}", "play", "(", "alarm", ")", ";", "mCurrentAlarm", "=", "alarm", ";", "mInitialCallState", "=", "mTelephonyManager", ".", "getCallState", "(", ")", ";", "return", "START_STICKY", ";", "}", "private", "void", "sendKillBroadcast", "(", "Alarm", "alarm", ")", "{", "long", "millis", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "mStartTime", ";", "int", "minutes", "=", "(", "int", ")", "Math", ".", "round", "(", "millis", "/", "60000.0", ")", ";", "Intent", "alarmKilled", "=", "new", "Intent", "(", "Alarms", ".", "ALARM_KILLED", ")", ";", "alarmKilled", ".", "putExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ",", "alarm", ")", ";", "alarmKilled", ".", "putExtra", "(", "Alarms", ".", "ALARM_KILLED_TIMEOUT", ",", "minutes", ")", ";", "sendBroadcast", "(", "alarmKilled", ")", ";", "}", "private", "static", "final", "float", "IN_CALL_VOLUME", "=", "0.125f", ";", "private", "void", "play", "(", "Alarm", "alarm", ")", "{", "stop", "(", ")", ";", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"\"", "+", "alarm", ".", "id", "+", "\"", "alert", "\"", "+", "alarm", ".", "alert", ")", ";", "}", "if", "(", "!", "alarm", ".", "silent", ")", "{", "Uri", "alert", "=", "alarm", ".", "alert", ";", "if", "(", "alert", "==", "null", ")", "{", "alert", "=", "RingtoneManager", ".", "getDefaultUri", "(", "RingtoneManager", ".", "TYPE_ALARM", ")", ";", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"\"", "+", "alert", ".", "toString", "(", ")", ")", ";", "}", "}", "mMediaPlayer", "=", "new", "MediaPlayer", "(", ")", ";", "mMediaPlayer", ".", "setOnErrorListener", "(", "new", "OnErrorListener", "(", ")", "{", "public", "boolean", "onError", "(", "MediaPlayer", "mp", ",", "int", "what", ",", "int", "extra", ")", "{", "Log", ".", "e", "(", "\"\"", ")", ";", "mp", ".", "stop", "(", ")", ";", "mp", ".", "release", "(", ")", ";", "mMediaPlayer", "=", "null", ";", "return", "true", ";", "}", "}", ")", ";", "try", "{", "if", "(", "mTelephonyManager", ".", "getCallState", "(", ")", "!=", "TelephonyManager", ".", "CALL_STATE_IDLE", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "mMediaPlayer", ".", "setVolume", "(", "IN_CALL_VOLUME", ",", "IN_CALL_VOLUME", ")", ";", "setDataSourceFromResource", "(", "getResources", "(", ")", ",", "mMediaPlayer", ",", "R", ".", "raw", ".", "in_call_alarm", ")", ";", "}", "else", "{", "mMediaPlayer", ".", "setDataSource", "(", "this", ",", "alert", ")", ";", "}", "startAlarm", "(", "mMediaPlayer", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "try", "{", "mMediaPlayer", ".", "reset", "(", ")", ";", "setDataSourceFromResource", "(", "getResources", "(", ")", ",", "mMediaPlayer", ",", "com", ".", "android", ".", "internal", ".", "R", ".", "raw", ".", "fallbackring", ")", ";", "startAlarm", "(", "mMediaPlayer", ")", ";", "}", "catch", "(", "Exception", "ex2", ")", "{", "Log", ".", "e", "(", "\"\"", ",", "ex2", ")", ";", "}", "}", "}", "if", "(", "alarm", ".", "vibrate", ")", "{", "mVibrator", ".", "vibrate", "(", "sVibratePattern", ",", "0", ")", ";", "}", "else", "{", "mVibrator", ".", "cancel", "(", ")", ";", "}", "enableKiller", "(", "alarm", ")", ";", "mPlaying", "=", "true", ";", "mStartTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "private", "void", "startAlarm", "(", "MediaPlayer", "player", ")", "throws", "java", ".", "io", ".", "IOException", ",", "IllegalArgumentException", ",", "IllegalStateException", "{", "final", "AudioManager", "audioManager", "=", "(", "AudioManager", ")", "getSystemService", "(", "Context", ".", "AUDIO_SERVICE", ")", ";", "if", "(", "audioManager", ".", "getStreamVolume", "(", "AudioManager", ".", "STREAM_ALARM", ")", "!=", "0", ")", "{", "player", ".", "setAudioStreamType", "(", "AudioManager", ".", "STREAM_ALARM", ")", ";", "player", ".", "setLooping", "(", "true", ")", ";", "player", ".", "prepare", "(", ")", ";", "player", ".", "start", "(", ")", ";", "}", "}", "private", "void", "setDataSourceFromResource", "(", "Resources", "resources", ",", "MediaPlayer", "player", ",", "int", "res", ")", "throws", "java", ".", "io", ".", "IOException", "{", "AssetFileDescriptor", "afd", "=", "resources", ".", "openRawResourceFd", "(", "res", ")", ";", "if", "(", "afd", "!=", "null", ")", "{", "player", ".", "setDataSource", "(", "afd", ".", "getFileDescriptor", "(", ")", ",", "afd", ".", "getStartOffset", "(", ")", ",", "afd", ".", "getLength", "(", ")", ")", ";", "afd", ".", "close", "(", ")", ";", "}", "}", "public", "void", "stop", "(", ")", "{", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", ")", ";", "if", "(", "mPlaying", ")", "{", "mPlaying", "=", "false", ";", "if", "(", "mMediaPlayer", "!=", "null", ")", "{", "mMediaPlayer", ".", "stop", "(", ")", ";", "mMediaPlayer", ".", "release", "(", ")", ";", "mMediaPlayer", "=", "null", ";", "}", "mVibrator", ".", "cancel", "(", ")", ";", "}", "disableKiller", "(", ")", ";", "}", "private", "void", "enableKiller", "(", "Alarm", "alarm", ")", "{", "mHandler", ".", "sendMessageDelayed", "(", "mHandler", ".", "obtainMessage", "(", "KILLER", ",", "alarm", ")", ",", "1000", "*", "ALARM_TIMEOUT_SECONDS", ")", ";", "}", "private", "void", "disableKiller", "(", ")", "{", "mHandler", ".", "removeMessages", "(", "KILLER", ")", ";", "}", "}", "</s>" ]
1,938
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "widget", ".", "Toast", ";", "public", "class", "ToastMaster", "{", "private", "static", "Toast", "sToast", "=", "null", ";", "private", "ToastMaster", "(", ")", "{", "}", "public", "static", "void", "setToast", "(", "Toast", "toast", ")", "{", "if", "(", "sToast", "!=", "null", ")", "sToast", ".", "cancel", "(", ")", ";", "sToast", "=", "toast", ";", "}", "public", "static", "void", "cancelToast", "(", ")", "{", "if", "(", "sToast", "!=", "null", ")", "sToast", ".", "cancel", "(", ")", ";", "sToast", "=", "null", ";", "}", "}", "</s>" ]
1,939
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "KeyguardManager", ";", "import", "android", ".", "content", ".", "BroadcastReceiver", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "IntentFilter", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "os", ".", "Handler", ";", "import", "android", ".", "os", ".", "Message", ";", "import", "android", ".", "view", ".", "WindowManager", ";", "public", "class", "AlarmAlert", "extends", "AlarmAlertFullScreen", "{", "private", "int", "mKeyguardRetryCount", ";", "private", "final", "int", "MAX_KEYGUARD_CHECKS", "=", "5", ";", "private", "final", "Handler", "mHandler", "=", "new", "Handler", "(", ")", "{", "@", "Override", "public", "void", "handleMessage", "(", "Message", "msg", ")", "{", "handleScreenOff", "(", "(", "KeyguardManager", ")", "msg", ".", "obj", ")", ";", "}", "}", ";", "private", "final", "BroadcastReceiver", "mScreenOffReceiver", "=", "new", "BroadcastReceiver", "(", ")", "{", "@", "Override", "public", "void", "onReceive", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "KeyguardManager", "km", "=", "(", "KeyguardManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "KEYGUARD_SERVICE", ")", ";", "handleScreenOff", "(", "km", ")", ";", "}", "}", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "icicle", ")", "{", "super", ".", "onCreate", "(", "icicle", ")", ";", "registerReceiver", "(", "mScreenOffReceiver", ",", "new", "IntentFilter", "(", "Intent", ".", "ACTION_SCREEN_OFF", ")", ")", ";", "}", "@", "Override", "public", "void", "onDestroy", "(", ")", "{", "super", ".", "onDestroy", "(", ")", ";", "unregisterReceiver", "(", "mScreenOffReceiver", ")", ";", "mHandler", ".", "removeMessages", "(", "0", ")", ";", "}", "@", "Override", "public", "void", "onBackPressed", "(", ")", "{", "finish", "(", ")", ";", "}", "private", "boolean", "checkRetryCount", "(", ")", "{", "if", "(", "mKeyguardRetryCount", "++", ">=", "MAX_KEYGUARD_CHECKS", ")", "{", "Log", ".", "e", "(", "\"\"", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}", "private", "void", "handleScreenOff", "(", "final", "KeyguardManager", "km", ")", "{", "if", "(", "!", "km", ".", "inKeyguardRestrictedInputMode", "(", ")", "&&", "checkRetryCount", "(", ")", ")", "{", "if", "(", "checkRetryCount", "(", ")", ")", "{", "mHandler", ".", "sendMessageDelayed", "(", "mHandler", ".", "obtainMessage", "(", "0", ",", "km", ")", ",", "500", ")", ";", "}", "}", "else", "{", "Intent", "i", "=", "new", "Intent", "(", "this", ",", "AlarmAlertFullScreen", ".", "class", ")", ";", "i", ".", "putExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ",", "mAlarm", ")", ";", "i", ".", "putExtra", "(", "SCREEN_OFF", ",", "true", ")", ";", "startActivity", "(", "i", ")", ";", "finish", "(", ")", ";", "}", "}", "}", "</s>" ]
1,940
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "TimePickerDialog", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "preference", ".", "CheckBoxPreference", ";", "import", "android", ".", "preference", ".", "EditTextPreference", ";", "import", "android", ".", "preference", ".", "Preference", ";", "import", "android", ".", "preference", ".", "PreferenceActivity", ";", "import", "android", ".", "preference", ".", "PreferenceScreen", ";", "import", "android", ".", "text", ".", "format", ".", "DateFormat", ";", "import", "android", ".", "view", ".", "LayoutInflater", ";", "import", "android", ".", "view", ".", "Menu", ";", "import", "android", ".", "view", ".", "MenuItem", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "ViewGroup", ".", "LayoutParams", ";", "import", "android", ".", "widget", ".", "Button", ";", "import", "android", ".", "widget", ".", "FrameLayout", ";", "import", "android", ".", "widget", ".", "LinearLayout", ";", "import", "android", ".", "widget", ".", "ListView", ";", "import", "android", ".", "widget", ".", "TimePicker", ";", "import", "android", ".", "widget", ".", "Toast", ";", "public", "class", "SetAlarm", "extends", "PreferenceActivity", "implements", "TimePickerDialog", ".", "OnTimeSetListener", "{", "private", "EditTextPreference", "mLabel", ";", "private", "Preference", "mTimePref", ";", "private", "AlarmPreference", "mAlarmPref", ";", "private", "CheckBoxPreference", "mVibratePref", ";", "private", "RepeatPreference", "mRepeatPref", ";", "private", "MenuItem", "mDeleteAlarmItem", ";", "private", "MenuItem", "mTestAlarmItem", ";", "private", "int", "mId", ";", "private", "boolean", "mEnabled", ";", "private", "int", "mHour", ";", "private", "int", "mMinutes", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "icicle", ")", "{", "super", ".", "onCreate", "(", "icicle", ")", ";", "addPreferencesFromResource", "(", "R", ".", "xml", ".", "alarm_prefs", ")", ";", "mLabel", "=", "(", "EditTextPreference", ")", "findPreference", "(", "\"label\"", ")", ";", "mLabel", ".", "setOnPreferenceChangeListener", "(", "new", "Preference", ".", "OnPreferenceChangeListener", "(", ")", "{", "public", "boolean", "onPreferenceChange", "(", "Preference", "p", ",", "Object", "newValue", ")", "{", "p", ".", "setSummary", "(", "(", "String", ")", "newValue", ")", ";", "return", "true", ";", "}", "}", ")", ";", "mTimePref", "=", "findPreference", "(", "\"time\"", ")", ";", "mAlarmPref", "=", "(", "AlarmPreference", ")", "findPreference", "(", "\"alarm\"", ")", ";", "mVibratePref", "=", "(", "CheckBoxPreference", ")", "findPreference", "(", "\"vibrate\"", ")", ";", "mRepeatPref", "=", "(", "RepeatPreference", ")", "findPreference", "(", "\"setRepeat\"", ")", ";", "Intent", "i", "=", "getIntent", "(", ")", ";", "mId", "=", "i", ".", "getIntExtra", "(", "Alarms", ".", "ALARM_ID", ",", "-", "1", ")", ";", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"\"", "+", "mId", ")", ";", "}", "Alarm", "alarm", "=", "Alarms", ".", "getAlarm", "(", "getContentResolver", "(", ")", ",", "mId", ")", ";", "if", "(", "alarm", "==", "null", ")", "{", "finish", "(", ")", ";", "return", ";", "}", "mEnabled", "=", "alarm", ".", "enabled", ";", "mLabel", ".", "setText", "(", "alarm", ".", "label", ")", ";", "mLabel", ".", "setSummary", "(", "alarm", ".", "label", ")", ";", "mHour", "=", "alarm", ".", "hour", ";", "mMinutes", "=", "alarm", ".", "minutes", ";", "mRepeatPref", ".", "setDaysOfWeek", "(", "alarm", ".", "daysOfWeek", ")", ";", "mVibratePref", ".", "setChecked", "(", "alarm", ".", "vibrate", ")", ";", "mAlarmPref", ".", "setAlert", "(", "alarm", ".", "alert", ")", ";", "updateTime", "(", ")", ";", "getListView", "(", ")", ".", "setItemsCanFocus", "(", "true", ")", ";", "FrameLayout", "content", "=", "(", "FrameLayout", ")", "getWindow", "(", ")", ".", "getDecorView", "(", ")", ".", "findViewById", "(", "com", ".", "android", ".", "internal", ".", "R", ".", "id", ".", "content", ")", ";", "ListView", "lv", "=", "getListView", "(", ")", ";", "content", ".", "removeView", "(", "lv", ")", ";", "LinearLayout", "ll", "=", "new", "LinearLayout", "(", "this", ")", ";", "ll", ".", "setOrientation", "(", "LinearLayout", ".", "VERTICAL", ")", ";", "LinearLayout", ".", "LayoutParams", "lp", "=", "new", "LinearLayout", ".", "LayoutParams", "(", "LayoutParams", ".", "MATCH_PARENT", ",", "LayoutParams", ".", "WRAP_CONTENT", ")", ";", "lp", ".", "weight", "=", "1", ";", "ll", ".", "addView", "(", "lv", ",", "lp", ")", ";", "View", "v", "=", "LayoutInflater", ".", "from", "(", "this", ")", ".", "inflate", "(", "R", ".", "layout", ".", "save_cancel_alarm", ",", "ll", ")", ";", "Button", "b", "=", "(", "Button", ")", "v", ".", "findViewById", "(", "R", ".", "id", ".", "alarm_save", ")", ";", "b", ".", "setOnClickListener", "(", "new", "View", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "View", "v", ")", "{", "mEnabled", "=", "true", ";", "saveAlarm", "(", ")", ";", "finish", "(", ")", ";", "}", "}", ")", ";", "b", "=", "(", "Button", ")", "v", ".", "findViewById", "(", "R", ".", "id", ".", "alarm_cancel", ")", ";", "b", ".", "setOnClickListener", "(", "new", "View", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "View", "v", ")", "{", "finish", "(", ")", ";", "}", "}", ")", ";", "setContentView", "(", "ll", ")", ";", "}", "@", "Override", "public", "boolean", "onPreferenceTreeClick", "(", "PreferenceScreen", "preferenceScreen", ",", "Preference", "preference", ")", "{", "if", "(", "preference", "==", "mTimePref", ")", "{", "new", "TimePickerDialog", "(", "this", ",", "this", ",", "mHour", ",", "mMinutes", ",", "DateFormat", ".", "is24HourFormat", "(", "this", ")", ")", ".", "show", "(", ")", ";", "}", "return", "super", ".", "onPreferenceTreeClick", "(", "preferenceScreen", ",", "preference", ")", ";", "}", "@", "Override", "public", "void", "onBackPressed", "(", ")", "{", "saveAlarm", "(", ")", ";", "finish", "(", ")", ";", "}", "public", "void", "onTimeSet", "(", "TimePicker", "view", ",", "int", "hourOfDay", ",", "int", "minute", ")", "{", "mHour", "=", "hourOfDay", ";", "mMinutes", "=", "minute", ";", "updateTime", "(", ")", ";", "mEnabled", "=", "true", ";", "}", "private", "void", "updateTime", "(", ")", "{", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"updateTime", "\"", "+", "mId", ")", ";", "}", "mTimePref", ".", "setSummary", "(", "Alarms", ".", "formatTime", "(", "this", ",", "mHour", ",", "mMinutes", ",", "mRepeatPref", ".", "getDaysOfWeek", "(", ")", ")", ")", ";", "}", "private", "void", "saveAlarm", "(", ")", "{", "final", "String", "alert", "=", "mAlarmPref", ".", "getAlertString", "(", ")", ";", "long", "time", "=", "Alarms", ".", "setAlarm", "(", "this", ",", "mId", ",", "mEnabled", ",", "mHour", ",", "mMinutes", ",", "mRepeatPref", ".", "getDaysOfWeek", "(", ")", ",", "mVibratePref", ".", "isChecked", "(", ")", ",", "mLabel", ".", "getText", "(", ")", ",", "alert", ")", ";", "if", "(", "mEnabled", ")", "{", "popAlarmSetToast", "(", "this", ",", "time", ")", ";", "}", "}", "private", "static", "void", "saveAlarm", "(", "Context", "context", ",", "int", "id", ",", "boolean", "enabled", ",", "int", "hour", ",", "int", "minute", ",", "Alarm", ".", "DaysOfWeek", "daysOfWeek", ",", "boolean", "vibrate", ",", "String", "label", ",", "String", "alert", ",", "boolean", "popToast", ")", "{", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", "+", "id", "+", "\"", "\"", "+", "label", "+", "\"", "\"", "+", "enabled", "+", "\"", "\"", "+", "hour", "+", "\"", "\"", "+", "minute", "+", "\"", "vibe", "\"", "+", "vibrate", ")", ";", "long", "time", "=", "Alarms", ".", "setAlarm", "(", "context", ",", "id", ",", "enabled", ",", "hour", ",", "minute", ",", "daysOfWeek", ",", "vibrate", ",", "label", ",", "alert", ")", ";", "if", "(", "enabled", "&&", "popToast", ")", "{", "popAlarmSetToast", "(", "context", ",", "time", ")", ";", "}", "}", "static", "void", "popAlarmSetToast", "(", "Context", "context", ",", "int", "hour", ",", "int", "minute", ",", "Alarm", ".", "DaysOfWeek", "daysOfWeek", ")", "{", "popAlarmSetToast", "(", "context", ",", "Alarms", ".", "calculateAlarm", "(", "hour", ",", "minute", ",", "daysOfWeek", ")", ".", "getTimeInMillis", "(", ")", ")", ";", "}", "private", "static", "void", "popAlarmSetToast", "(", "Context", "context", ",", "long", "timeInMillis", ")", "{", "String", "toastText", "=", "formatToast", "(", "context", ",", "timeInMillis", ")", ";", "Toast", "toast", "=", "Toast", ".", "makeText", "(", "context", ",", "toastText", ",", "Toast", ".", "LENGTH_LONG", ")", ";", "ToastMaster", ".", "setToast", "(", "toast", ")", ";", "toast", ".", "show", "(", ")", ";", "}", "static", "String", "formatToast", "(", "Context", "context", ",", "long", "timeInMillis", ")", "{", "long", "delta", "=", "timeInMillis", "-", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "hours", "=", "delta", "/", "(", "1000", "*", "60", "*", "60", ")", ";", "long", "minutes", "=", "delta", "/", "(", "1000", "*", "60", ")", "%", "60", ";", "long", "days", "=", "hours", "/", "24", ";", "hours", "=", "hours", "%", "24", ";", "String", "daySeq", "=", "(", "days", "==", "0", ")", "?", "\"\"", ":", "(", "days", "==", "1", ")", "?", "context", ".", "getString", "(", "R", ".", "string", ".", "day", ")", ":", "context", ".", "getString", "(", "R", ".", "string", ".", "days", ",", "Long", ".", "toString", "(", "days", ")", ")", ";", "String", "minSeq", "=", "(", "minutes", "==", "0", ")", "?", "\"\"", ":", "(", "minutes", "==", "1", ")", "?", "context", ".", "getString", "(", "R", ".", "string", ".", "minute", ")", ":", "context", ".", "getString", "(", "R", ".", "string", ".", "minutes", ",", "Long", ".", "toString", "(", "minutes", ")", ")", ";", "String", "hourSeq", "=", "(", "hours", "==", "0", ")", "?", "\"\"", ":", "(", "hours", "==", "1", ")", "?", "context", ".", "getString", "(", "R", ".", "string", ".", "hour", ")", ":", "context", ".", "getString", "(", "R", ".", "string", ".", "hours", ",", "Long", ".", "toString", "(", "hours", ")", ")", ";", "boolean", "dispDays", "=", "days", ">", "0", ";", "boolean", "dispHour", "=", "hours", ">", "0", ";", "boolean", "dispMinute", "=", "minutes", ">", "0", ";", "int", "index", "=", "(", "dispDays", "?", "1", ":", "0", ")", "|", "(", "dispHour", "?", "2", ":", "0", ")", "|", "(", "dispMinute", "?", "4", ":", "0", ")", ";", "String", "[", "]", "formats", "=", "context", ".", "getResources", "(", ")", ".", "getStringArray", "(", "R", ".", "array", ".", "alarm_set", ")", ";", "return", "String", ".", "format", "(", "formats", "[", "index", "]", ",", "daySeq", ",", "hourSeq", ",", "minSeq", ")", ";", "}", "public", "boolean", "onCreateOptionsMenu", "(", "Menu", "menu", ")", "{", "super", ".", "onCreateOptionsMenu", "(", "menu", ")", ";", "mDeleteAlarmItem", "=", "menu", ".", "add", "(", "0", ",", "0", ",", "0", ",", "R", ".", "string", ".", "delete_alarm", ")", ";", "mDeleteAlarmItem", ".", "setIcon", "(", "android", ".", "R", ".", "drawable", ".", "ic_menu_delete", ")", ";", "if", "(", "AlarmClock", ".", "DEBUG", ")", "{", "mTestAlarmItem", "=", "menu", ".", "add", "(", "0", ",", "0", ",", "0", ",", "\"test", "alarm\"", ")", ";", "}", "return", "true", ";", "}", "public", "boolean", "onOptionsItemSelected", "(", "MenuItem", "item", ")", "{", "if", "(", "item", "==", "mDeleteAlarmItem", ")", "{", "Alarms", ".", "deleteAlarm", "(", "this", ",", "mId", ")", ";", "finish", "(", ")", ";", "return", "true", ";", "}", "if", "(", "AlarmClock", ".", "DEBUG", ")", "{", "if", "(", "item", "==", "mTestAlarmItem", ")", "{", "setTestAlarm", "(", ")", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}", "void", "setTestAlarm", "(", ")", "{", "java", ".", "util", ".", "Calendar", "c", "=", "java", ".", "util", ".", "Calendar", ".", "getInstance", "(", ")", ";", "c", ".", "setTimeInMillis", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "int", "nowHour", "=", "c", ".", "get", "(", "java", ".", "util", ".", "Calendar", ".", "HOUR_OF_DAY", ")", ";", "int", "nowMinute", "=", "c", ".", "get", "(", "java", ".", "util", ".", "Calendar", ".", "MINUTE", ")", ";", "int", "minutes", "=", "(", "nowMinute", "+", "1", ")", "%", "60", ";", "int", "hour", "=", "nowHour", "+", "(", "nowMinute", "==", "0", "?", "1", ":", "0", ")", ";", "saveAlarm", "(", "this", ",", "mId", ",", "true", ",", "hour", ",", "minutes", ",", "mRepeatPref", ".", "getDaysOfWeek", "(", ")", ",", "true", ",", "mLabel", ".", "getText", "(", ")", ",", "mAlarmPref", ".", "getAlertString", "(", ")", ",", "true", ")", ";", "}", "}", "</s>" ]
1,941
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "database", ".", "Cursor", ";", "import", "android", ".", "media", ".", "RingtoneManager", ";", "import", "android", ".", "net", ".", "Uri", ";", "import", "android", ".", "os", ".", "Parcel", ";", "import", "android", ".", "os", ".", "Parcelable", ";", "import", "android", ".", "provider", ".", "BaseColumns", ";", "import", "android", ".", "text", ".", "format", ".", "DateFormat", ";", "import", "java", ".", "text", ".", "DateFormatSymbols", ";", "import", "java", ".", "util", ".", "Calendar", ";", "public", "final", "class", "Alarm", "implements", "Parcelable", "{", "public", "static", "final", "Parcelable", ".", "Creator", "<", "Alarm", ">", "CREATOR", "=", "new", "Parcelable", ".", "Creator", "<", "Alarm", ">", "(", ")", "{", "public", "Alarm", "createFromParcel", "(", "Parcel", "p", ")", "{", "return", "new", "Alarm", "(", "p", ")", ";", "}", "public", "Alarm", "[", "]", "newArray", "(", "int", "size", ")", "{", "return", "new", "Alarm", "[", "size", "]", ";", "}", "}", ";", "public", "int", "describeContents", "(", ")", "{", "return", "0", ";", "}", "public", "void", "writeToParcel", "(", "Parcel", "p", ",", "int", "flags", ")", "{", "p", ".", "writeInt", "(", "id", ")", ";", "p", ".", "writeInt", "(", "enabled", "?", "1", ":", "0", ")", ";", "p", ".", "writeInt", "(", "hour", ")", ";", "p", ".", "writeInt", "(", "minutes", ")", ";", "p", ".", "writeInt", "(", "daysOfWeek", ".", "getCoded", "(", ")", ")", ";", "p", ".", "writeLong", "(", "time", ")", ";", "p", ".", "writeInt", "(", "vibrate", "?", "1", ":", "0", ")", ";", "p", ".", "writeString", "(", "label", ")", ";", "p", ".", "writeParcelable", "(", "alert", ",", "flags", ")", ";", "p", ".", "writeInt", "(", "silent", "?", "1", ":", "0", ")", ";", "}", "public", "static", "class", "Columns", "implements", "BaseColumns", "{", "public", "static", "final", "Uri", "CONTENT_URI", "=", "Uri", ".", "parse", "(", "\"\"", ")", ";", "public", "static", "final", "String", "HOUR", "=", "\"hour\"", ";", "public", "static", "final", "String", "MINUTES", "=", "\"minutes\"", ";", "public", "static", "final", "String", "DAYS_OF_WEEK", "=", "\"daysofweek\"", ";", "public", "static", "final", "String", "ALARM_TIME", "=", "\"alarmtime\"", ";", "public", "static", "final", "String", "ENABLED", "=", "\"enabled\"", ";", "public", "static", "final", "String", "VIBRATE", "=", "\"vibrate\"", ";", "public", "static", "final", "String", "MESSAGE", "=", "\"message\"", ";", "public", "static", "final", "String", "ALERT", "=", "\"alert\"", ";", "public", "static", "final", "String", "DEFAULT_SORT_ORDER", "=", "HOUR", "+", "\",", "\"", "+", "MINUTES", "+", "\"", "ASC\"", ";", "public", "static", "final", "String", "WHERE_ENABLED", "=", "ENABLED", "+", "\"=1\"", ";", "static", "final", "String", "[", "]", "ALARM_QUERY_COLUMNS", "=", "{", "_ID", ",", "HOUR", ",", "MINUTES", ",", "DAYS_OF_WEEK", ",", "ALARM_TIME", ",", "ENABLED", ",", "VIBRATE", ",", "MESSAGE", ",", "ALERT", "}", ";", "public", "static", "final", "int", "ALARM_ID_INDEX", "=", "0", ";", "public", "static", "final", "int", "ALARM_HOUR_INDEX", "=", "1", ";", "public", "static", "final", "int", "ALARM_MINUTES_INDEX", "=", "2", ";", "public", "static", "final", "int", "ALARM_DAYS_OF_WEEK_INDEX", "=", "3", ";", "public", "static", "final", "int", "ALARM_TIME_INDEX", "=", "4", ";", "public", "static", "final", "int", "ALARM_ENABLED_INDEX", "=", "5", ";", "public", "static", "final", "int", "ALARM_VIBRATE_INDEX", "=", "6", ";", "public", "static", "final", "int", "ALARM_MESSAGE_INDEX", "=", "7", ";", "public", "static", "final", "int", "ALARM_ALERT_INDEX", "=", "8", ";", "}", "public", "int", "id", ";", "public", "boolean", "enabled", ";", "public", "int", "hour", ";", "public", "int", "minutes", ";", "public", "DaysOfWeek", "daysOfWeek", ";", "public", "long", "time", ";", "public", "boolean", "vibrate", ";", "public", "String", "label", ";", "public", "Uri", "alert", ";", "public", "boolean", "silent", ";", "public", "Alarm", "(", "Cursor", "c", ")", "{", "id", "=", "c", ".", "getInt", "(", "Columns", ".", "ALARM_ID_INDEX", ")", ";", "enabled", "=", "c", ".", "getInt", "(", "Columns", ".", "ALARM_ENABLED_INDEX", ")", "==", "1", ";", "hour", "=", "c", ".", "getInt", "(", "Columns", ".", "ALARM_HOUR_INDEX", ")", ";", "minutes", "=", "c", ".", "getInt", "(", "Columns", ".", "ALARM_MINUTES_INDEX", ")", ";", "daysOfWeek", "=", "new", "DaysOfWeek", "(", "c", ".", "getInt", "(", "Columns", ".", "ALARM_DAYS_OF_WEEK_INDEX", ")", ")", ";", "time", "=", "c", ".", "getLong", "(", "Columns", ".", "ALARM_TIME_INDEX", ")", ";", "vibrate", "=", "c", ".", "getInt", "(", "Columns", ".", "ALARM_VIBRATE_INDEX", ")", "==", "1", ";", "label", "=", "c", ".", "getString", "(", "Columns", ".", "ALARM_MESSAGE_INDEX", ")", ";", "String", "alertString", "=", "c", ".", "getString", "(", "Columns", ".", "ALARM_ALERT_INDEX", ")", ";", "if", "(", "Alarms", ".", "ALARM_ALERT_SILENT", ".", "equals", "(", "alertString", ")", ")", "{", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "}", "silent", "=", "true", ";", "}", "else", "{", "if", "(", "alertString", "!=", "null", "&&", "alertString", ".", "length", "(", ")", "!=", "0", ")", "{", "alert", "=", "Uri", ".", "parse", "(", "alertString", ")", ";", "}", "if", "(", "alert", "==", "null", ")", "{", "alert", "=", "RingtoneManager", ".", "getDefaultUri", "(", "RingtoneManager", ".", "TYPE_ALARM", ")", ";", "}", "}", "}", "public", "Alarm", "(", "Parcel", "p", ")", "{", "id", "=", "p", ".", "readInt", "(", ")", ";", "enabled", "=", "p", ".", "readInt", "(", ")", "==", "1", ";", "hour", "=", "p", ".", "readInt", "(", ")", ";", "minutes", "=", "p", ".", "readInt", "(", ")", ";", "daysOfWeek", "=", "new", "DaysOfWeek", "(", "p", ".", "readInt", "(", ")", ")", ";", "time", "=", "p", ".", "readLong", "(", ")", ";", "vibrate", "=", "p", ".", "readInt", "(", ")", "==", "1", ";", "label", "=", "p", ".", "readString", "(", ")", ";", "alert", "=", "(", "Uri", ")", "p", ".", "readParcelable", "(", "null", ")", ";", "silent", "=", "p", ".", "readInt", "(", ")", "==", "1", ";", "}", "public", "String", "getLabelOrDefault", "(", "Context", "context", ")", "{", "if", "(", "label", "==", "null", "||", "label", ".", "length", "(", ")", "==", "0", ")", "{", "return", "context", ".", "getString", "(", "R", ".", "string", ".", "default_label", ")", ";", "}", "return", "label", ";", "}", "static", "final", "class", "DaysOfWeek", "{", "private", "static", "int", "[", "]", "DAY_MAP", "=", "new", "int", "[", "]", "{", "Calendar", ".", "MONDAY", ",", "Calendar", ".", "TUESDAY", ",", "Calendar", ".", "WEDNESDAY", ",", "Calendar", ".", "THURSDAY", ",", "Calendar", ".", "FRIDAY", ",", "Calendar", ".", "SATURDAY", ",", "Calendar", ".", "SUNDAY", ",", "}", ";", "private", "int", "mDays", ";", "DaysOfWeek", "(", "int", "days", ")", "{", "mDays", "=", "days", ";", "}", "public", "String", "toString", "(", "Context", "context", ",", "boolean", "showNever", ")", "{", "StringBuilder", "ret", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "mDays", "==", "0", ")", "{", "return", "showNever", "?", "context", ".", "getText", "(", "R", ".", "string", ".", "never", ")", ".", "toString", "(", ")", ":", "\"\"", ";", "}", "if", "(", "mDays", "==", "0x7f", ")", "{", "return", "context", ".", "getText", "(", "R", ".", "string", ".", "every_day", ")", ".", "toString", "(", ")", ";", "}", "int", "dayCount", "=", "0", ",", "days", "=", "mDays", ";", "while", "(", "days", ">", "0", ")", "{", "if", "(", "(", "days", "&", "1", ")", "==", "1", ")", "dayCount", "++", ";", "days", ">>=", "1", ";", "}", "DateFormatSymbols", "dfs", "=", "new", "DateFormatSymbols", "(", ")", ";", "String", "[", "]", "dayList", "=", "(", "dayCount", ">", "1", ")", "?", "dfs", ".", "getShortWeekdays", "(", ")", ":", "dfs", ".", "getWeekdays", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "7", ";", "i", "++", ")", "{", "if", "(", "(", "mDays", "&", "(", "1", "<<", "i", ")", ")", "!=", "0", ")", "{", "ret", ".", "append", "(", "dayList", "[", "DAY_MAP", "[", "i", "]", "]", ")", ";", "dayCount", "-=", "1", ";", "if", "(", "dayCount", ">", "0", ")", "ret", ".", "append", "(", "context", ".", "getText", "(", "R", ".", "string", ".", "day_concat", ")", ")", ";", "}", "}", "return", "ret", ".", "toString", "(", ")", ";", "}", "private", "boolean", "isSet", "(", "int", "day", ")", "{", "return", "(", "(", "mDays", "&", "(", "1", "<<", "day", ")", ")", ">", "0", ")", ";", "}", "public", "void", "set", "(", "int", "day", ",", "boolean", "set", ")", "{", "if", "(", "set", ")", "{", "mDays", "|=", "(", "1", "<<", "day", ")", ";", "}", "else", "{", "mDays", "&=", "~", "(", "1", "<<", "day", ")", ";", "}", "}", "public", "void", "set", "(", "DaysOfWeek", "dow", ")", "{", "mDays", "=", "dow", ".", "mDays", ";", "}", "public", "int", "getCoded", "(", ")", "{", "return", "mDays", ";", "}", "public", "boolean", "[", "]", "getBooleanArray", "(", ")", "{", "boolean", "[", "]", "ret", "=", "new", "boolean", "[", "7", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "7", ";", "i", "++", ")", "{", "ret", "[", "i", "]", "=", "isSet", "(", "i", ")", ";", "}", "return", "ret", ";", "}", "public", "boolean", "isRepeatSet", "(", ")", "{", "return", "mDays", "!=", "0", ";", "}", "public", "int", "getNextAlarm", "(", "Calendar", "c", ")", "{", "if", "(", "mDays", "==", "0", ")", "{", "return", "-", "1", ";", "}", "int", "today", "=", "(", "c", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", "+", "5", ")", "%", "7", ";", "int", "day", "=", "0", ";", "int", "dayCount", "=", "0", ";", "for", "(", ";", "dayCount", "<", "7", ";", "dayCount", "++", ")", "{", "day", "=", "(", "today", "+", "dayCount", ")", "%", "7", ";", "if", "(", "isSet", "(", "day", ")", ")", "{", "break", ";", "}", "}", "return", "dayCount", ";", "}", "}", "}", "</s>" ]
1,942
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "content", ".", "ContentProvider", ";", "import", "android", ".", "content", ".", "ContentUris", ";", "import", "android", ".", "content", ".", "ContentValues", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "UriMatcher", ";", "import", "android", ".", "database", ".", "Cursor", ";", "import", "android", ".", "database", ".", "SQLException", ";", "import", "android", ".", "database", ".", "sqlite", ".", "SQLiteDatabase", ";", "import", "android", ".", "database", ".", "sqlite", ".", "SQLiteOpenHelper", ";", "import", "android", ".", "database", ".", "sqlite", ".", "SQLiteQueryBuilder", ";", "import", "android", ".", "net", ".", "Uri", ";", "import", "android", ".", "text", ".", "TextUtils", ";", "public", "class", "AlarmProvider", "extends", "ContentProvider", "{", "private", "SQLiteOpenHelper", "mOpenHelper", ";", "private", "static", "final", "int", "ALARMS", "=", "1", ";", "private", "static", "final", "int", "ALARMS_ID", "=", "2", ";", "private", "static", "final", "UriMatcher", "sURLMatcher", "=", "new", "UriMatcher", "(", "UriMatcher", ".", "NO_MATCH", ")", ";", "static", "{", "sURLMatcher", ".", "addURI", "(", "\"\"", ",", "\"alarm\"", ",", "ALARMS", ")", ";", "sURLMatcher", ".", "addURI", "(", "\"\"", ",", "\"alarm/#\"", ",", "ALARMS_ID", ")", ";", "}", "private", "static", "class", "DatabaseHelper", "extends", "SQLiteOpenHelper", "{", "private", "static", "final", "String", "DATABASE_NAME", "=", "\"alarms.db\"", ";", "private", "static", "final", "int", "DATABASE_VERSION", "=", "5", ";", "public", "DatabaseHelper", "(", "Context", "context", ")", "{", "super", "(", "context", ",", "DATABASE_NAME", ",", "null", ",", "DATABASE_VERSION", ")", ";", "}", "@", "Override", "public", "void", "onCreate", "(", "SQLiteDatabase", "db", ")", "{", "db", ".", "execSQL", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"alert", "TEXT);\"", ")", ";", "String", "insertMe", "=", "\"\"", "+", "\"\"", "+", "\"VALUES", "\"", ";", "db", ".", "execSQL", "(", "insertMe", "+", "\"\"", ")", ";", "db", ".", "execSQL", "(", "insertMe", "+", "\"\"", ")", ";", "db", ".", "execSQL", "(", "insertMe", "+", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "onUpgrade", "(", "SQLiteDatabase", "db", ",", "int", "oldVersion", ",", "int", "currentVersion", ")", "{", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", "+", "oldVersion", "+", "\"", "to", "\"", "+", "currentVersion", "+", "\"\"", ")", ";", "db", ".", "execSQL", "(", "\"\"", ")", ";", "onCreate", "(", "db", ")", ";", "}", "}", "public", "AlarmProvider", "(", ")", "{", "}", "@", "Override", "public", "boolean", "onCreate", "(", ")", "{", "mOpenHelper", "=", "new", "DatabaseHelper", "(", "getContext", "(", ")", ")", ";", "return", "true", ";", "}", "@", "Override", "public", "Cursor", "query", "(", "Uri", "url", ",", "String", "[", "]", "projectionIn", ",", "String", "selection", ",", "String", "[", "]", "selectionArgs", ",", "String", "sort", ")", "{", "SQLiteQueryBuilder", "qb", "=", "new", "SQLiteQueryBuilder", "(", ")", ";", "int", "match", "=", "sURLMatcher", ".", "match", "(", "url", ")", ";", "switch", "(", "match", ")", "{", "case", "ALARMS", ":", "qb", ".", "setTables", "(", "\"alarms\"", ")", ";", "break", ";", "case", "ALARMS_ID", ":", "qb", ".", "setTables", "(", "\"alarms\"", ")", ";", "qb", ".", "appendWhere", "(", "\"_id=\"", ")", ";", "qb", ".", "appendWhere", "(", "url", ".", "getPathSegments", "(", ")", ".", "get", "(", "1", ")", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unknown", "URL", "\"", "+", "url", ")", ";", "}", "SQLiteDatabase", "db", "=", "mOpenHelper", ".", "getReadableDatabase", "(", ")", ";", "Cursor", "ret", "=", "qb", ".", "query", "(", "db", ",", "projectionIn", ",", "selection", ",", "selectionArgs", ",", "null", ",", "null", ",", "sort", ")", ";", "if", "(", "ret", "==", "null", ")", "{", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", ")", ";", "}", "else", "{", "ret", ".", "setNotificationUri", "(", "getContext", "(", ")", ".", "getContentResolver", "(", ")", ",", "url", ")", ";", "}", "return", "ret", ";", "}", "@", "Override", "public", "String", "getType", "(", "Uri", "url", ")", "{", "int", "match", "=", "sURLMatcher", ".", "match", "(", "url", ")", ";", "switch", "(", "match", ")", "{", "case", "ALARMS", ":", "return", "\"\"", ";", "case", "ALARMS_ID", ":", "return", "\"\"", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unknown", "URL\"", ")", ";", "}", "}", "@", "Override", "public", "int", "update", "(", "Uri", "url", ",", "ContentValues", "values", ",", "String", "where", ",", "String", "[", "]", "whereArgs", ")", "{", "int", "count", ";", "long", "rowId", "=", "0", ";", "int", "match", "=", "sURLMatcher", ".", "match", "(", "url", ")", ";", "SQLiteDatabase", "db", "=", "mOpenHelper", ".", "getWritableDatabase", "(", ")", ";", "switch", "(", "match", ")", "{", "case", "ALARMS_ID", ":", "{", "String", "segment", "=", "url", ".", "getPathSegments", "(", ")", ".", "get", "(", "1", ")", ";", "rowId", "=", "Long", ".", "parseLong", "(", "segment", ")", ";", "count", "=", "db", ".", "update", "(", "\"alarms\"", ",", "values", ",", "\"_id=\"", "+", "rowId", ",", "null", ")", ";", "break", ";", "}", "default", ":", "{", "throw", "new", "UnsupportedOperationException", "(", "\"\"", "+", "url", ")", ";", "}", "}", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", "+", "rowId", "+", "\"", "url", "\"", "+", "url", ")", ";", "getContext", "(", ")", ".", "getContentResolver", "(", ")", ".", "notifyChange", "(", "url", ",", "null", ")", ";", "return", "count", ";", "}", "@", "Override", "public", "Uri", "insert", "(", "Uri", "url", ",", "ContentValues", "initialValues", ")", "{", "if", "(", "sURLMatcher", ".", "match", "(", "url", ")", "!=", "ALARMS", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "url", ")", ";", "}", "ContentValues", "values", ";", "if", "(", "initialValues", "!=", "null", ")", "values", "=", "new", "ContentValues", "(", "initialValues", ")", ";", "else", "values", "=", "new", "ContentValues", "(", ")", ";", "if", "(", "!", "values", ".", "containsKey", "(", "Alarm", ".", "Columns", ".", "HOUR", ")", ")", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "HOUR", ",", "0", ")", ";", "if", "(", "!", "values", ".", "containsKey", "(", "Alarm", ".", "Columns", ".", "MINUTES", ")", ")", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "MINUTES", ",", "0", ")", ";", "if", "(", "!", "values", ".", "containsKey", "(", "Alarm", ".", "Columns", ".", "DAYS_OF_WEEK", ")", ")", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "DAYS_OF_WEEK", ",", "0", ")", ";", "if", "(", "!", "values", ".", "containsKey", "(", "Alarm", ".", "Columns", ".", "ALARM_TIME", ")", ")", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "ALARM_TIME", ",", "0", ")", ";", "if", "(", "!", "values", ".", "containsKey", "(", "Alarm", ".", "Columns", ".", "ENABLED", ")", ")", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "ENABLED", ",", "0", ")", ";", "if", "(", "!", "values", ".", "containsKey", "(", "Alarm", ".", "Columns", ".", "VIBRATE", ")", ")", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "VIBRATE", ",", "1", ")", ";", "if", "(", "!", "values", ".", "containsKey", "(", "Alarm", ".", "Columns", ".", "MESSAGE", ")", ")", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "MESSAGE", ",", "\"\"", ")", ";", "if", "(", "!", "values", ".", "containsKey", "(", "Alarm", ".", "Columns", ".", "ALERT", ")", ")", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "ALERT", ",", "\"\"", ")", ";", "SQLiteDatabase", "db", "=", "mOpenHelper", ".", "getWritableDatabase", "(", ")", ";", "long", "rowId", "=", "db", ".", "insert", "(", "\"alarms\"", ",", "Alarm", ".", "Columns", ".", "MESSAGE", ",", "values", ")", ";", "if", "(", "rowId", "<", "0", ")", "{", "throw", "new", "SQLException", "(", "\"\"", "+", "url", ")", ";", "}", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", "+", "rowId", ")", ";", "Uri", "newUrl", "=", "ContentUris", ".", "withAppendedId", "(", "Alarm", ".", "Columns", ".", "CONTENT_URI", ",", "rowId", ")", ";", "getContext", "(", ")", ".", "getContentResolver", "(", ")", ".", "notifyChange", "(", "newUrl", ",", "null", ")", ";", "return", "newUrl", ";", "}", "public", "int", "delete", "(", "Uri", "url", ",", "String", "where", ",", "String", "[", "]", "whereArgs", ")", "{", "SQLiteDatabase", "db", "=", "mOpenHelper", ".", "getWritableDatabase", "(", ")", ";", "int", "count", ";", "long", "rowId", "=", "0", ";", "switch", "(", "sURLMatcher", ".", "match", "(", "url", ")", ")", "{", "case", "ALARMS", ":", "count", "=", "db", ".", "delete", "(", "\"alarms\"", ",", "where", ",", "whereArgs", ")", ";", "break", ";", "case", "ALARMS_ID", ":", "String", "segment", "=", "url", ".", "getPathSegments", "(", ")", ".", "get", "(", "1", ")", ";", "rowId", "=", "Long", ".", "parseLong", "(", "segment", ")", ";", "if", "(", "TextUtils", ".", "isEmpty", "(", "where", ")", ")", "{", "where", "=", "\"_id=\"", "+", "segment", ";", "}", "else", "{", "where", "=", "\"_id=\"", "+", "segment", "+", "\"", "AND", "(\"", "+", "where", "+", "\")\"", ";", "}", "count", "=", "db", ".", "delete", "(", "\"alarms\"", ",", "where", ",", "whereArgs", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "url", ")", ";", "}", "getContext", "(", ")", ".", "getContentResolver", "(", ")", ".", "notifyChange", "(", "url", ",", "null", ")", ";", "return", "count", ";", "}", "}", "</s>" ]
1,943
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "Activity", ";", "import", "android", ".", "app", ".", "Notification", ";", "import", "android", ".", "app", ".", "NotificationManager", ";", "import", "android", ".", "app", ".", "PendingIntent", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "BroadcastReceiver", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "IntentFilter", ";", "import", "android", ".", "content", ".", "SharedPreferences", ";", "import", "android", ".", "content", ".", "res", ".", "Configuration", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "preference", ".", "PreferenceManager", ";", "import", "android", ".", "view", ".", "KeyEvent", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "ViewGroup", ";", "import", "android", ".", "view", ".", "LayoutInflater", ";", "import", "android", ".", "view", ".", "Window", ";", "import", "android", ".", "view", ".", "WindowManager", ";", "import", "android", ".", "widget", ".", "Button", ";", "import", "android", ".", "widget", ".", "Toast", ";", "import", "android", ".", "widget", ".", "TextView", ";", "import", "java", ".", "util", ".", "Calendar", ";", "public", "class", "AlarmAlertFullScreen", "extends", "Activity", "{", "private", "static", "final", "String", "DEFAULT_SNOOZE", "=", "\"10\"", ";", "private", "static", "final", "String", "DEFAULT_VOLUME_BEHAVIOR", "=", "\"2\"", ";", "protected", "static", "final", "String", "SCREEN_OFF", "=", "\"screen_off\"", ";", "protected", "Alarm", "mAlarm", ";", "private", "int", "mVolumeBehavior", ";", "private", "BroadcastReceiver", "mReceiver", "=", "new", "BroadcastReceiver", "(", ")", "{", "@", "Override", "public", "void", "onReceive", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "Alarm", "alarm", "=", "intent", ".", "getParcelableExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ")", ";", "if", "(", "alarm", "!=", "null", "&&", "mAlarm", ".", "id", "==", "alarm", ".", "id", ")", "{", "dismiss", "(", "true", ")", ";", "}", "}", "}", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "icicle", ")", "{", "super", ".", "onCreate", "(", "icicle", ")", ";", "mAlarm", "=", "getIntent", "(", ")", ".", "getParcelableExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ")", ";", "final", "String", "vol", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "this", ")", ".", "getString", "(", "SettingsActivity", ".", "KEY_VOLUME_BEHAVIOR", ",", "DEFAULT_VOLUME_BEHAVIOR", ")", ";", "mVolumeBehavior", "=", "Integer", ".", "parseInt", "(", "vol", ")", ";", "requestWindowFeature", "(", "android", ".", "view", ".", "Window", ".", "FEATURE_NO_TITLE", ")", ";", "final", "Window", "win", "=", "getWindow", "(", ")", ";", "win", ".", "addFlags", "(", "WindowManager", ".", "LayoutParams", ".", "FLAG_SHOW_WHEN_LOCKED", "|", "WindowManager", ".", "LayoutParams", ".", "FLAG_DISMISS_KEYGUARD", ")", ";", "if", "(", "!", "getIntent", "(", ")", ".", "getBooleanExtra", "(", "SCREEN_OFF", ",", "false", ")", ")", "{", "win", ".", "addFlags", "(", "WindowManager", ".", "LayoutParams", ".", "FLAG_KEEP_SCREEN_ON", "|", "WindowManager", ".", "LayoutParams", ".", "FLAG_TURN_SCREEN_ON", ")", ";", "}", "updateLayout", "(", ")", ";", "registerReceiver", "(", "mReceiver", ",", "new", "IntentFilter", "(", "Alarms", ".", "ALARM_KILLED", ")", ")", ";", "}", "private", "void", "setTitle", "(", ")", "{", "String", "label", "=", "mAlarm", ".", "getLabelOrDefault", "(", "this", ")", ";", "TextView", "title", "=", "(", "TextView", ")", "findViewById", "(", "R", ".", "id", ".", "alertTitle", ")", ";", "title", ".", "setText", "(", "label", ")", ";", "}", "private", "void", "updateLayout", "(", ")", "{", "LayoutInflater", "inflater", "=", "LayoutInflater", ".", "from", "(", "this", ")", ";", "setContentView", "(", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "alarm_alert", ",", "null", ")", ")", ";", "SharedPreferences", "settings", "=", "getSharedPreferences", "(", "AlarmClock", ".", "PREFERENCES", ",", "0", ")", ";", "int", "face", "=", "settings", ".", "getInt", "(", "AlarmClock", ".", "PREF_CLOCK_FACE", ",", "0", ")", ";", "if", "(", "face", "<", "0", "||", "face", ">=", "AlarmClock", ".", "CLOCKS", ".", "length", ")", "{", "face", "=", "0", ";", "}", "ViewGroup", "clockView", "=", "(", "ViewGroup", ")", "findViewById", "(", "R", ".", "id", ".", "clockView", ")", ";", "inflater", ".", "inflate", "(", "AlarmClock", ".", "CLOCKS", "[", "face", "]", ",", "clockView", ")", ";", "View", "clockLayout", "=", "findViewById", "(", "R", ".", "id", ".", "clock", ")", ";", "if", "(", "clockLayout", "instanceof", "DigitalClock", ")", "{", "(", "(", "DigitalClock", ")", "clockLayout", ")", ".", "setAnimate", "(", ")", ";", "}", "Button", "snooze", "=", "(", "Button", ")", "findViewById", "(", "R", ".", "id", ".", "snooze", ")", ";", "snooze", ".", "requestFocus", "(", ")", ";", "snooze", ".", "setOnClickListener", "(", "new", "Button", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "View", "v", ")", "{", "snooze", "(", ")", ";", "}", "}", ")", ";", "findViewById", "(", "R", ".", "id", ".", "dismiss", ")", ".", "setOnClickListener", "(", "new", "Button", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "View", "v", ")", "{", "dismiss", "(", "false", ")", ";", "}", "}", ")", ";", "setTitle", "(", ")", ";", "}", "private", "void", "snooze", "(", ")", "{", "final", "String", "snooze", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "this", ")", ".", "getString", "(", "SettingsActivity", ".", "KEY_ALARM_SNOOZE", ",", "DEFAULT_SNOOZE", ")", ";", "int", "snoozeMinutes", "=", "Integer", ".", "parseInt", "(", "snooze", ")", ";", "final", "long", "snoozeTime", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "(", "1000", "*", "60", "*", "snoozeMinutes", ")", ";", "Alarms", ".", "saveSnoozeAlert", "(", "AlarmAlertFullScreen", ".", "this", ",", "mAlarm", ".", "id", ",", "snoozeTime", ")", ";", "final", "Calendar", "c", "=", "Calendar", ".", "getInstance", "(", ")", ";", "c", ".", "setTimeInMillis", "(", "snoozeTime", ")", ";", "String", "label", "=", "mAlarm", ".", "getLabelOrDefault", "(", "this", ")", ";", "label", "=", "getString", "(", "R", ".", "string", ".", "alarm_notify_snooze_label", ",", "label", ")", ";", "Intent", "cancelSnooze", "=", "new", "Intent", "(", "this", ",", "AlarmReceiver", ".", "class", ")", ";", "cancelSnooze", ".", "setAction", "(", "Alarms", ".", "CANCEL_SNOOZE", ")", ";", "cancelSnooze", ".", "putExtra", "(", "Alarms", ".", "ALARM_ID", ",", "mAlarm", ".", "id", ")", ";", "PendingIntent", "broadcast", "=", "PendingIntent", ".", "getBroadcast", "(", "this", ",", "mAlarm", ".", "id", ",", "cancelSnooze", ",", "0", ")", ";", "NotificationManager", "nm", "=", "getNotificationManager", "(", ")", ";", "Notification", "n", "=", "new", "Notification", "(", "R", ".", "drawable", ".", "stat_notify_alarm", ",", "label", ",", "0", ")", ";", "n", ".", "setLatestEventInfo", "(", "this", ",", "label", ",", "getString", "(", "R", ".", "string", ".", "alarm_notify_snooze_text", ",", "Alarms", ".", "formatTime", "(", "this", ",", "c", ")", ")", ",", "broadcast", ")", ";", "n", ".", "flags", "|=", "Notification", ".", "FLAG_AUTO_CANCEL", "|", "Notification", ".", "FLAG_ONGOING_EVENT", ";", "nm", ".", "notify", "(", "mAlarm", ".", "id", ",", "n", ")", ";", "String", "displayTime", "=", "getString", "(", "R", ".", "string", ".", "alarm_alert_snooze_set", ",", "snoozeMinutes", ")", ";", "Log", ".", "v", "(", "displayTime", ")", ";", "Toast", ".", "makeText", "(", "AlarmAlertFullScreen", ".", "this", ",", "displayTime", ",", "Toast", ".", "LENGTH_LONG", ")", ".", "show", "(", ")", ";", "stopService", "(", "new", "Intent", "(", "Alarms", ".", "ALARM_ALERT_ACTION", ")", ")", ";", "finish", "(", ")", ";", "}", "private", "NotificationManager", "getNotificationManager", "(", ")", "{", "return", "(", "NotificationManager", ")", "getSystemService", "(", "NOTIFICATION_SERVICE", ")", ";", "}", "private", "void", "dismiss", "(", "boolean", "killed", ")", "{", "if", "(", "!", "killed", ")", "{", "NotificationManager", "nm", "=", "getNotificationManager", "(", ")", ";", "nm", ".", "cancel", "(", "mAlarm", ".", "id", ")", ";", "stopService", "(", "new", "Intent", "(", "Alarms", ".", "ALARM_ALERT_ACTION", ")", ")", ";", "}", "finish", "(", ")", ";", "}", "@", "Override", "protected", "void", "onNewIntent", "(", "Intent", "intent", ")", "{", "super", ".", "onNewIntent", "(", "intent", ")", ";", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", ")", ";", "mAlarm", "=", "intent", ".", "getParcelableExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ")", ";", "setTitle", "(", ")", ";", "}", "@", "Override", "protected", "void", "onStop", "(", ")", "{", "super", ".", "onStop", "(", ")", ";", "if", "(", "!", "isFinishing", "(", ")", ")", "{", "finish", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "onDestroy", "(", ")", "{", "super", ".", "onDestroy", "(", ")", ";", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", ")", ";", "unregisterReceiver", "(", "mReceiver", ")", ";", "}", "@", "Override", "public", "boolean", "dispatchKeyEvent", "(", "KeyEvent", "event", ")", "{", "boolean", "up", "=", "event", ".", "getAction", "(", ")", "==", "KeyEvent", ".", "ACTION_UP", ";", "switch", "(", "event", ".", "getKeyCode", "(", ")", ")", "{", "case", "KeyEvent", ".", "KEYCODE_VOLUME_UP", ":", "case", "KeyEvent", ".", "KEYCODE_VOLUME_DOWN", ":", "case", "KeyEvent", ".", "KEYCODE_CAMERA", ":", "case", "KeyEvent", ".", "KEYCODE_FOCUS", ":", "if", "(", "up", ")", "{", "switch", "(", "mVolumeBehavior", ")", "{", "case", "1", ":", "snooze", "(", ")", ";", "break", ";", "case", "2", ":", "dismiss", "(", "false", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "return", "true", ";", "default", ":", "break", ";", "}", "return", "super", ".", "dispatchKeyEvent", "(", "event", ")", ";", "}", "@", "Override", "public", "void", "onBackPressed", "(", ")", "{", "return", ";", "}", "}", "</s>" ]
1,944
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "Activity", ";", "import", "android", ".", "content", ".", "SharedPreferences", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "view", ".", "LayoutInflater", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "ViewGroup", ";", "import", "android", ".", "view", ".", "Window", ";", "import", "android", ".", "widget", ".", "AdapterView", ";", "import", "android", ".", "widget", ".", "BaseAdapter", ";", "import", "android", ".", "widget", ".", "Gallery", ";", "public", "class", "ClockPicker", "extends", "Activity", "implements", "AdapterView", ".", "OnItemSelectedListener", ",", "AdapterView", ".", "OnItemClickListener", "{", "private", "LayoutInflater", "mFactory", ";", "private", "Gallery", "mGallery", ";", "private", "SharedPreferences", "mPrefs", ";", "private", "View", "mClock", ";", "private", "ViewGroup", "mClockLayout", ";", "private", "int", "mPosition", ";", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "icicle", ")", "{", "super", ".", "onCreate", "(", "icicle", ")", ";", "requestWindowFeature", "(", "Window", ".", "FEATURE_NO_TITLE", ")", ";", "mFactory", "=", "LayoutInflater", ".", "from", "(", "this", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "clockpicker", ")", ";", "mGallery", "=", "(", "Gallery", ")", "findViewById", "(", "R", ".", "id", ".", "gallery", ")", ";", "mGallery", ".", "setAdapter", "(", "new", "ClockAdapter", "(", ")", ")", ";", "mGallery", ".", "setOnItemSelectedListener", "(", "this", ")", ";", "mGallery", ".", "setOnItemClickListener", "(", "this", ")", ";", "mPrefs", "=", "getSharedPreferences", "(", "AlarmClock", ".", "PREFERENCES", ",", "0", ")", ";", "int", "face", "=", "mPrefs", ".", "getInt", "(", "AlarmClock", ".", "PREF_CLOCK_FACE", ",", "0", ")", ";", "if", "(", "face", "<", "0", "||", "face", ">=", "AlarmClock", ".", "CLOCKS", ".", "length", ")", "face", "=", "0", ";", "mClockLayout", "=", "(", "ViewGroup", ")", "findViewById", "(", "R", ".", "id", ".", "clock_layout", ")", ";", "mClockLayout", ".", "setOnClickListener", "(", "new", "View", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "View", "v", ")", "{", "selectClock", "(", "mPosition", ")", ";", "}", "}", ")", ";", "mGallery", ".", "setSelection", "(", "face", ",", "false", ")", ";", "}", "public", "void", "onItemSelected", "(", "AdapterView", "parent", ",", "View", "v", ",", "int", "position", ",", "long", "id", ")", "{", "if", "(", "mClock", "!=", "null", ")", "{", "mClockLayout", ".", "removeView", "(", "mClock", ")", ";", "}", "mClock", "=", "mFactory", ".", "inflate", "(", "AlarmClock", ".", "CLOCKS", "[", "position", "]", ",", "null", ")", ";", "mClockLayout", ".", "addView", "(", "mClock", ",", "0", ")", ";", "mPosition", "=", "position", ";", "}", "public", "void", "onItemClick", "(", "AdapterView", "parent", ",", "View", "v", ",", "int", "position", ",", "long", "id", ")", "{", "selectClock", "(", "position", ")", ";", "}", "private", "synchronized", "void", "selectClock", "(", "int", "position", ")", "{", "SharedPreferences", ".", "Editor", "ed", "=", "mPrefs", ".", "edit", "(", ")", ";", "ed", ".", "putInt", "(", "AlarmClock", ".", "PREF_CLOCK_FACE", ",", "position", ")", ";", "ed", ".", "commit", "(", ")", ";", "setResult", "(", "RESULT_OK", ")", ";", "finish", "(", ")", ";", "}", "public", "void", "onNothingSelected", "(", "AdapterView", "parent", ")", "{", "}", "class", "ClockAdapter", "extends", "BaseAdapter", "{", "public", "ClockAdapter", "(", ")", "{", "}", "public", "int", "getCount", "(", ")", "{", "return", "AlarmClock", ".", "CLOCKS", ".", "length", ";", "}", "public", "Object", "getItem", "(", "int", "position", ")", "{", "return", "position", ";", "}", "public", "long", "getItemId", "(", "int", "position", ")", "{", "return", "position", ";", "}", "public", "View", "getView", "(", "final", "int", "position", ",", "View", "convertView", ",", "ViewGroup", "parent", ")", "{", "View", "clock", "=", "mFactory", ".", "inflate", "(", "AlarmClock", ".", "CLOCKS", "[", "position", "]", ",", "null", ")", ";", "return", "clock", ";", "}", "}", "}", "</s>" ]
1,945
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "content", ".", "BroadcastReceiver", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "IntentFilter", ";", "import", "android", ".", "content", ".", "res", ".", "Resources", ";", "import", "android", ".", "database", ".", "ContentObserver", ";", "import", "android", ".", "graphics", ".", "drawable", ".", "AnimationDrawable", ";", "import", "android", ".", "graphics", ".", "drawable", ".", "Drawable", ";", "import", "android", ".", "os", ".", "Handler", ";", "import", "android", ".", "provider", ".", "Settings", ";", "import", "android", ".", "text", ".", "format", ".", "DateFormat", ";", "import", "android", ".", "util", ".", "AttributeSet", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "widget", ".", "LinearLayout", ";", "import", "android", ".", "widget", ".", "TextView", ";", "import", "java", ".", "util", ".", "Calendar", ";", "public", "class", "DigitalClock", "extends", "LinearLayout", "{", "private", "final", "static", "String", "M12", "=", "\"h:mm\"", ";", "private", "Calendar", "mCalendar", ";", "private", "String", "mFormat", ";", "private", "TextView", "mTimeDisplay", ";", "private", "AmPm", "mAmPm", ";", "private", "boolean", "mAnimate", ";", "private", "ContentObserver", "mFormatChangeObserver", ";", "private", "boolean", "mLive", "=", "true", ";", "private", "boolean", "mAttached", ";", "private", "final", "Handler", "mHandler", "=", "new", "Handler", "(", ")", ";", "private", "final", "BroadcastReceiver", "mIntentReceiver", "=", "new", "BroadcastReceiver", "(", ")", "{", "@", "Override", "public", "void", "onReceive", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "if", "(", "mLive", "&&", "intent", ".", "getAction", "(", ")", ".", "equals", "(", "Intent", ".", "ACTION_TIMEZONE_CHANGED", ")", ")", "{", "mCalendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "}", "updateTime", "(", ")", ";", "}", "}", ";", "static", "class", "AmPm", "{", "private", "int", "mColorOn", ",", "mColorOff", ";", "private", "LinearLayout", "mAmPmLayout", ";", "private", "TextView", "mAm", ",", "mPm", ";", "AmPm", "(", "View", "parent", ")", "{", "mAmPmLayout", "=", "(", "LinearLayout", ")", "parent", ".", "findViewById", "(", "R", ".", "id", ".", "am_pm", ")", ";", "mAm", "=", "(", "TextView", ")", "mAmPmLayout", ".", "findViewById", "(", "R", ".", "id", ".", "am", ")", ";", "mPm", "=", "(", "TextView", ")", "mAmPmLayout", ".", "findViewById", "(", "R", ".", "id", ".", "pm", ")", ";", "Resources", "r", "=", "parent", ".", "getResources", "(", ")", ";", "mColorOn", "=", "r", ".", "getColor", "(", "R", ".", "color", ".", "ampm_on", ")", ";", "mColorOff", "=", "r", ".", "getColor", "(", "R", ".", "color", ".", "ampm_off", ")", ";", "}", "void", "setShowAmPm", "(", "boolean", "show", ")", "{", "mAmPmLayout", ".", "setVisibility", "(", "show", "?", "View", ".", "VISIBLE", ":", "View", ".", "GONE", ")", ";", "}", "void", "setIsMorning", "(", "boolean", "isMorning", ")", "{", "mAm", ".", "setTextColor", "(", "isMorning", "?", "mColorOn", ":", "mColorOff", ")", ";", "mPm", ".", "setTextColor", "(", "isMorning", "?", "mColorOff", ":", "mColorOn", ")", ";", "}", "}", "private", "class", "FormatChangeObserver", "extends", "ContentObserver", "{", "public", "FormatChangeObserver", "(", ")", "{", "super", "(", "new", "Handler", "(", ")", ")", ";", "}", "@", "Override", "public", "void", "onChange", "(", "boolean", "selfChange", ")", "{", "setDateFormat", "(", ")", ";", "updateTime", "(", ")", ";", "}", "}", "public", "DigitalClock", "(", "Context", "context", ")", "{", "this", "(", "context", ",", "null", ")", ";", "}", "public", "DigitalClock", "(", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "super", "(", "context", ",", "attrs", ")", ";", "}", "@", "Override", "protected", "void", "onFinishInflate", "(", ")", "{", "super", ".", "onFinishInflate", "(", ")", ";", "mTimeDisplay", "=", "(", "TextView", ")", "findViewById", "(", "R", ".", "id", ".", "timeDisplay", ")", ";", "mAmPm", "=", "new", "AmPm", "(", "this", ")", ";", "mCalendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "setDateFormat", "(", ")", ";", "}", "@", "Override", "protected", "void", "onAttachedToWindow", "(", ")", "{", "super", ".", "onAttachedToWindow", "(", ")", ";", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", "+", "this", ")", ";", "if", "(", "mAttached", ")", "return", ";", "mAttached", "=", "true", ";", "if", "(", "mAnimate", ")", "{", "setBackgroundResource", "(", "R", ".", "drawable", ".", "animate_circle", ")", ";", "(", "(", "AnimationDrawable", ")", "getBackground", "(", ")", ")", ".", "start", "(", ")", ";", "}", "if", "(", "mLive", ")", "{", "IntentFilter", "filter", "=", "new", "IntentFilter", "(", ")", ";", "filter", ".", "addAction", "(", "Intent", ".", "ACTION_TIME_TICK", ")", ";", "filter", ".", "addAction", "(", "Intent", ".", "ACTION_TIME_CHANGED", ")", ";", "filter", ".", "addAction", "(", "Intent", ".", "ACTION_TIMEZONE_CHANGED", ")", ";", "mContext", ".", "registerReceiver", "(", "mIntentReceiver", ",", "filter", ",", "null", ",", "mHandler", ")", ";", "}", "mFormatChangeObserver", "=", "new", "FormatChangeObserver", "(", ")", ";", "mContext", ".", "getContentResolver", "(", ")", ".", "registerContentObserver", "(", "Settings", ".", "System", ".", "CONTENT_URI", ",", "true", ",", "mFormatChangeObserver", ")", ";", "updateTime", "(", ")", ";", "}", "@", "Override", "protected", "void", "onDetachedFromWindow", "(", ")", "{", "super", ".", "onDetachedFromWindow", "(", ")", ";", "if", "(", "!", "mAttached", ")", "return", ";", "mAttached", "=", "false", ";", "Drawable", "background", "=", "getBackground", "(", ")", ";", "if", "(", "background", "instanceof", "AnimationDrawable", ")", "{", "(", "(", "AnimationDrawable", ")", "background", ")", ".", "stop", "(", ")", ";", "}", "if", "(", "mLive", ")", "{", "mContext", ".", "unregisterReceiver", "(", "mIntentReceiver", ")", ";", "}", "mContext", ".", "getContentResolver", "(", ")", ".", "unregisterContentObserver", "(", "mFormatChangeObserver", ")", ";", "}", "void", "updateTime", "(", "Calendar", "c", ")", "{", "mCalendar", "=", "c", ";", "updateTime", "(", ")", ";", "}", "private", "void", "updateTime", "(", ")", "{", "if", "(", "mLive", ")", "{", "mCalendar", ".", "setTimeInMillis", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "}", "CharSequence", "newTime", "=", "DateFormat", ".", "format", "(", "mFormat", ",", "mCalendar", ")", ";", "mTimeDisplay", ".", "setText", "(", "newTime", ")", ";", "mAmPm", ".", "setIsMorning", "(", "mCalendar", ".", "get", "(", "Calendar", ".", "AM_PM", ")", "==", "0", ")", ";", "}", "private", "void", "setDateFormat", "(", ")", "{", "mFormat", "=", "Alarms", ".", "get24HourMode", "(", "mContext", ")", "?", "Alarms", ".", "M24", ":", "M12", ";", "mAmPm", ".", "setShowAmPm", "(", "mFormat", "==", "M12", ")", ";", "}", "void", "setAnimate", "(", ")", "{", "mAnimate", "=", "true", ";", "}", "void", "setLive", "(", "boolean", "live", ")", "{", "mLive", "=", "live", ";", "}", "}", "</s>" ]
1,946
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "BroadcastReceiver", ";", "public", "class", "AlarmInitReceiver", "extends", "BroadcastReceiver", "{", "@", "Override", "public", "void", "onReceive", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "String", "action", "=", "intent", ".", "getAction", "(", ")", ";", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", "+", "action", ")", ";", "if", "(", "context", ".", "getContentResolver", "(", ")", "==", "null", ")", "{", "Log", ".", "e", "(", "\"\"", ")", ";", "return", ";", "}", "if", "(", "action", ".", "equals", "(", "Intent", ".", "ACTION_BOOT_COMPLETED", ")", ")", "{", "Alarms", ".", "saveSnoozeAlert", "(", "context", ",", "-", "1", ",", "-", "1", ")", ";", "Alarms", ".", "disableExpiredAlarms", "(", "context", ")", ";", "}", "Alarms", ".", "setNextAlert", "(", "context", ")", ";", "}", "}", "</s>" ]
1,947
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "AlertDialog", ".", "Builder", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "DialogInterface", ";", "import", "android", ".", "preference", ".", "ListPreference", ";", "import", "android", ".", "util", ".", "AttributeSet", ";", "import", "java", ".", "text", ".", "DateFormatSymbols", ";", "import", "java", ".", "util", ".", "Calendar", ";", "public", "class", "RepeatPreference", "extends", "ListPreference", "{", "private", "Alarm", ".", "DaysOfWeek", "mDaysOfWeek", "=", "new", "Alarm", ".", "DaysOfWeek", "(", "0", ")", ";", "private", "Alarm", ".", "DaysOfWeek", "mNewDaysOfWeek", "=", "new", "Alarm", ".", "DaysOfWeek", "(", "0", ")", ";", "public", "RepeatPreference", "(", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "super", "(", "context", ",", "attrs", ")", ";", "String", "[", "]", "weekdays", "=", "new", "DateFormatSymbols", "(", ")", ".", "getWeekdays", "(", ")", ";", "String", "[", "]", "values", "=", "new", "String", "[", "]", "{", "weekdays", "[", "Calendar", ".", "MONDAY", "]", ",", "weekdays", "[", "Calendar", ".", "TUESDAY", "]", ",", "weekdays", "[", "Calendar", ".", "WEDNESDAY", "]", ",", "weekdays", "[", "Calendar", ".", "THURSDAY", "]", ",", "weekdays", "[", "Calendar", ".", "FRIDAY", "]", ",", "weekdays", "[", "Calendar", ".", "SATURDAY", "]", ",", "weekdays", "[", "Calendar", ".", "SUNDAY", "]", ",", "}", ";", "setEntries", "(", "values", ")", ";", "setEntryValues", "(", "values", ")", ";", "}", "@", "Override", "protected", "void", "onDialogClosed", "(", "boolean", "positiveResult", ")", "{", "if", "(", "positiveResult", ")", "{", "mDaysOfWeek", ".", "set", "(", "mNewDaysOfWeek", ")", ";", "setSummary", "(", "mDaysOfWeek", ".", "toString", "(", "getContext", "(", ")", ",", "true", ")", ")", ";", "}", "}", "@", "Override", "protected", "void", "onPrepareDialogBuilder", "(", "Builder", "builder", ")", "{", "CharSequence", "[", "]", "entries", "=", "getEntries", "(", ")", ";", "CharSequence", "[", "]", "entryValues", "=", "getEntryValues", "(", ")", ";", "builder", ".", "setMultiChoiceItems", "(", "entries", ",", "mDaysOfWeek", ".", "getBooleanArray", "(", ")", ",", "new", "DialogInterface", ".", "OnMultiChoiceClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ",", "boolean", "isChecked", ")", "{", "mNewDaysOfWeek", ".", "set", "(", "which", ",", "isChecked", ")", ";", "}", "}", ")", ";", "}", "public", "void", "setDaysOfWeek", "(", "Alarm", ".", "DaysOfWeek", "dow", ")", "{", "mDaysOfWeek", ".", "set", "(", "dow", ")", ";", "mNewDaysOfWeek", ".", "set", "(", "dow", ")", ";", "setSummary", "(", "dow", ".", "toString", "(", "getContext", "(", ")", ",", "true", ")", ")", ";", "}", "public", "Alarm", ".", "DaysOfWeek", "getDaysOfWeek", "(", ")", "{", "return", "mDaysOfWeek", ";", "}", "}", "</s>" ]
1,948
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "media", ".", "Ringtone", ";", "import", "android", ".", "media", ".", "RingtoneManager", ";", "import", "android", ".", "net", ".", "Uri", ";", "import", "android", ".", "preference", ".", "RingtonePreference", ";", "import", "android", ".", "provider", ".", "Settings", ";", "import", "android", ".", "util", ".", "AttributeSet", ";", "public", "class", "AlarmPreference", "extends", "RingtonePreference", "{", "private", "Uri", "mAlert", ";", "private", "boolean", "mChangeDefault", ";", "public", "AlarmPreference", "(", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "super", "(", "context", ",", "attrs", ")", ";", "}", "@", "Override", "protected", "void", "onSaveRingtone", "(", "Uri", "ringtoneUri", ")", "{", "setAlert", "(", "ringtoneUri", ")", ";", "if", "(", "mChangeDefault", ")", "{", "Settings", ".", "System", ".", "putString", "(", "getContext", "(", ")", ".", "getContentResolver", "(", ")", ",", "Settings", ".", "System", ".", "ALARM_ALERT", ",", "ringtoneUri", "==", "null", "?", "null", ":", "ringtoneUri", ".", "toString", "(", ")", ")", ";", "}", "}", "@", "Override", "protected", "Uri", "onRestoreRingtone", "(", ")", "{", "if", "(", "RingtoneManager", ".", "isDefault", "(", "mAlert", ")", ")", "{", "return", "RingtoneManager", ".", "getActualDefaultRingtoneUri", "(", "getContext", "(", ")", ",", "RingtoneManager", ".", "TYPE_ALARM", ")", ";", "}", "return", "mAlert", ";", "}", "public", "void", "setAlert", "(", "Uri", "alert", ")", "{", "mAlert", "=", "alert", ";", "if", "(", "alert", "!=", "null", ")", "{", "final", "Ringtone", "r", "=", "RingtoneManager", ".", "getRingtone", "(", "getContext", "(", ")", ",", "alert", ")", ";", "if", "(", "r", "!=", "null", ")", "{", "setSummary", "(", "r", ".", "getTitle", "(", "getContext", "(", ")", ")", ")", ";", "}", "}", "else", "{", "setSummary", "(", "R", ".", "string", ".", "silent_alarm_summary", ")", ";", "}", "}", "public", "String", "getAlertString", "(", ")", "{", "if", "(", "mAlert", "!=", "null", ")", "{", "return", "mAlert", ".", "toString", "(", ")", ";", "}", "return", "Alarms", ".", "ALARM_ALERT_SILENT", ";", "}", "public", "void", "setChangeDefault", "(", ")", "{", "mChangeDefault", "=", "true", ";", "}", "}", "</s>" ]
1,949
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "KeyguardManager", ";", "import", "android", ".", "app", ".", "Notification", ";", "import", "android", ".", "app", ".", "NotificationManager", ";", "import", "android", ".", "app", ".", "PendingIntent", ";", "import", "android", ".", "content", ".", "ContentUris", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "BroadcastReceiver", ";", "import", "android", ".", "database", ".", "Cursor", ";", "import", "android", ".", "os", ".", "Parcel", ";", "import", "java", ".", "text", ".", "SimpleDateFormat", ";", "import", "java", ".", "util", ".", "Date", ";", "public", "class", "AlarmReceiver", "extends", "BroadcastReceiver", "{", "private", "final", "static", "int", "STALE_WINDOW", "=", "60", "*", "30", ";", "@", "Override", "public", "void", "onReceive", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "if", "(", "Alarms", ".", "ALARM_KILLED", ".", "equals", "(", "intent", ".", "getAction", "(", ")", ")", ")", "{", "updateNotification", "(", "context", ",", "(", "Alarm", ")", "intent", ".", "getParcelableExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ")", ",", "intent", ".", "getIntExtra", "(", "Alarms", ".", "ALARM_KILLED_TIMEOUT", ",", "-", "1", ")", ")", ";", "return", ";", "}", "else", "if", "(", "Alarms", ".", "CANCEL_SNOOZE", ".", "equals", "(", "intent", ".", "getAction", "(", ")", ")", ")", "{", "Alarms", ".", "saveSnoozeAlert", "(", "context", ",", "-", "1", ",", "-", "1", ")", ";", "return", ";", "}", "Alarm", "alarm", "=", "null", ";", "final", "byte", "[", "]", "data", "=", "intent", ".", "getByteArrayExtra", "(", "Alarms", ".", "ALARM_RAW_DATA", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "Parcel", "in", "=", "Parcel", ".", "obtain", "(", ")", ";", "in", ".", "unmarshall", "(", "data", ",", "0", ",", "data", ".", "length", ")", ";", "in", ".", "setDataPosition", "(", "0", ")", ";", "alarm", "=", "Alarm", ".", "CREATOR", ".", "createFromParcel", "(", "in", ")", ";", "}", "if", "(", "alarm", "==", "null", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "return", ";", "}", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "SimpleDateFormat", "format", "=", "new", "SimpleDateFormat", "(", "\"\"", ")", ";", "Log", ".", "v", "(", "\"\"", "+", "alarm", ".", "id", "+", "\"", "setFor", "\"", "+", "format", ".", "format", "(", "new", "Date", "(", "alarm", ".", "time", ")", ")", ")", ";", "if", "(", "now", ">", "alarm", ".", "time", "+", "STALE_WINDOW", "*", "1000", ")", "{", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "}", "return", ";", "}", "AlarmAlertWakeLock", ".", "acquireCpuWakeLock", "(", "context", ")", ";", "Intent", "closeDialogs", "=", "new", "Intent", "(", "Intent", ".", "ACTION_CLOSE_SYSTEM_DIALOGS", ")", ";", "context", ".", "sendBroadcast", "(", "closeDialogs", ")", ";", "Class", "c", "=", "AlarmAlert", ".", "class", ";", "KeyguardManager", "km", "=", "(", "KeyguardManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "KEYGUARD_SERVICE", ")", ";", "if", "(", "km", ".", "inKeyguardRestrictedInputMode", "(", ")", ")", "{", "c", "=", "AlarmAlertFullScreen", ".", "class", ";", "}", "Intent", "alarmAlert", "=", "new", "Intent", "(", "context", ",", "c", ")", ";", "alarmAlert", ".", "putExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ",", "alarm", ")", ";", "alarmAlert", ".", "setFlags", "(", "Intent", ".", "FLAG_ACTIVITY_NEW_TASK", "|", "Intent", ".", "FLAG_ACTIVITY_NO_USER_ACTION", ")", ";", "context", ".", "startActivity", "(", "alarmAlert", ")", ";", "Alarms", ".", "disableSnoozeAlert", "(", "context", ",", "alarm", ".", "id", ")", ";", "if", "(", "!", "alarm", ".", "daysOfWeek", ".", "isRepeatSet", "(", ")", ")", "{", "Alarms", ".", "enableAlarm", "(", "context", ",", "alarm", ".", "id", ",", "false", ")", ";", "}", "else", "{", "Alarms", ".", "setNextAlert", "(", "context", ")", ";", "}", "Intent", "playAlarm", "=", "new", "Intent", "(", "Alarms", ".", "ALARM_ALERT_ACTION", ")", ";", "playAlarm", ".", "putExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ",", "alarm", ")", ";", "context", ".", "startService", "(", "playAlarm", ")", ";", "Intent", "notify", "=", "new", "Intent", "(", "context", ",", "AlarmAlert", ".", "class", ")", ";", "notify", ".", "putExtra", "(", "Alarms", ".", "ALARM_INTENT_EXTRA", ",", "alarm", ")", ";", "PendingIntent", "pendingNotify", "=", "PendingIntent", ".", "getActivity", "(", "context", ",", "alarm", ".", "id", ",", "notify", ",", "0", ")", ";", "String", "label", "=", "alarm", ".", "getLabelOrDefault", "(", "context", ")", ";", "Notification", "n", "=", "new", "Notification", "(", "R", ".", "drawable", ".", "stat_notify_alarm", ",", "label", ",", "alarm", ".", "time", ")", ";", "n", ".", "setLatestEventInfo", "(", "context", ",", "label", ",", "context", ".", "getString", "(", "R", ".", "string", ".", "alarm_notify_text", ")", ",", "pendingNotify", ")", ";", "n", ".", "flags", "|=", "Notification", ".", "FLAG_SHOW_LIGHTS", "|", "Notification", ".", "FLAG_ONGOING_EVENT", ";", "n", ".", "defaults", "|=", "Notification", ".", "DEFAULT_LIGHTS", ";", "NotificationManager", "nm", "=", "getNotificationManager", "(", "context", ")", ";", "nm", ".", "notify", "(", "alarm", ".", "id", ",", "n", ")", ";", "}", "private", "NotificationManager", "getNotificationManager", "(", "Context", "context", ")", "{", "return", "(", "NotificationManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "NOTIFICATION_SERVICE", ")", ";", "}", "private", "void", "updateNotification", "(", "Context", "context", ",", "Alarm", "alarm", ",", "int", "timeout", ")", "{", "NotificationManager", "nm", "=", "getNotificationManager", "(", "context", ")", ";", "if", "(", "alarm", "==", "null", ")", "{", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"\"", ")", ";", "}", "return", ";", "}", "Intent", "viewAlarm", "=", "new", "Intent", "(", "context", ",", "SetAlarm", ".", "class", ")", ";", "viewAlarm", ".", "putExtra", "(", "Alarms", ".", "ALARM_ID", ",", "alarm", ".", "id", ")", ";", "PendingIntent", "intent", "=", "PendingIntent", ".", "getActivity", "(", "context", ",", "alarm", ".", "id", ",", "viewAlarm", ",", "0", ")", ";", "String", "label", "=", "alarm", ".", "getLabelOrDefault", "(", "context", ")", ";", "Notification", "n", "=", "new", "Notification", "(", "R", ".", "drawable", ".", "stat_notify_alarm", ",", "label", ",", "alarm", ".", "time", ")", ";", "n", ".", "setLatestEventInfo", "(", "context", ",", "label", ",", "context", ".", "getString", "(", "R", ".", "string", ".", "alarm_alert_alert_silenced", ",", "timeout", ")", ",", "intent", ")", ";", "n", ".", "flags", "|=", "Notification", ".", "FLAG_AUTO_CANCEL", ";", "nm", ".", "cancel", "(", "alarm", ".", "id", ")", ";", "nm", ".", "notify", "(", "alarm", ".", "id", ",", "n", ")", ";", "}", "}", "</s>" ]
1,950
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "content", ".", "SharedPreferences", ";", "import", "android", ".", "media", ".", "AudioManager", ";", "import", "android", ".", "media", ".", "RingtoneManager", ";", "import", "android", ".", "net", ".", "Uri", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "preference", ".", "CheckBoxPreference", ";", "import", "android", ".", "preference", ".", "ListPreference", ";", "import", "android", ".", "preference", ".", "Preference", ";", "import", "android", ".", "preference", ".", "PreferenceActivity", ";", "import", "android", ".", "preference", ".", "PreferenceScreen", ";", "import", "android", ".", "preference", ".", "RingtonePreference", ";", "import", "android", ".", "provider", ".", "Settings", ";", "public", "class", "SettingsActivity", "extends", "PreferenceActivity", "implements", "Preference", ".", "OnPreferenceChangeListener", "{", "private", "static", "final", "int", "ALARM_STREAM_TYPE_BIT", "=", "1", "<<", "AudioManager", ".", "STREAM_ALARM", ";", "private", "static", "final", "String", "KEY_ALARM_IN_SILENT_MODE", "=", "\"\"", ";", "static", "final", "String", "KEY_ALARM_SNOOZE", "=", "\"\"", ";", "static", "final", "String", "KEY_VOLUME_BEHAVIOR", "=", "\"\"", ";", "static", "final", "String", "KEY_DEFAULT_RINGTONE", "=", "\"\"", ";", "@", "Override", "protected", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "addPreferencesFromResource", "(", "R", ".", "xml", ".", "settings", ")", ";", "final", "AlarmPreference", "ringtone", "=", "(", "AlarmPreference", ")", "findPreference", "(", "KEY_DEFAULT_RINGTONE", ")", ";", "Uri", "alert", "=", "RingtoneManager", ".", "getActualDefaultRingtoneUri", "(", "this", ",", "RingtoneManager", ".", "TYPE_ALARM", ")", ";", "if", "(", "alert", "!=", "null", ")", "{", "ringtone", ".", "setAlert", "(", "alert", ")", ";", "}", "ringtone", ".", "setChangeDefault", "(", ")", ";", "}", "@", "Override", "protected", "void", "onResume", "(", ")", "{", "super", ".", "onResume", "(", ")", ";", "refresh", "(", ")", ";", "}", "@", "Override", "public", "boolean", "onPreferenceTreeClick", "(", "PreferenceScreen", "preferenceScreen", ",", "Preference", "preference", ")", "{", "if", "(", "KEY_ALARM_IN_SILENT_MODE", ".", "equals", "(", "preference", ".", "getKey", "(", ")", ")", ")", "{", "CheckBoxPreference", "pref", "=", "(", "CheckBoxPreference", ")", "preference", ";", "int", "ringerModeStreamTypes", "=", "Settings", ".", "System", ".", "getInt", "(", "getContentResolver", "(", ")", ",", "Settings", ".", "System", ".", "MODE_RINGER_STREAMS_AFFECTED", ",", "0", ")", ";", "if", "(", "pref", ".", "isChecked", "(", ")", ")", "{", "ringerModeStreamTypes", "&=", "~", "ALARM_STREAM_TYPE_BIT", ";", "}", "else", "{", "ringerModeStreamTypes", "|=", "ALARM_STREAM_TYPE_BIT", ";", "}", "Settings", ".", "System", ".", "putInt", "(", "getContentResolver", "(", ")", ",", "Settings", ".", "System", ".", "MODE_RINGER_STREAMS_AFFECTED", ",", "ringerModeStreamTypes", ")", ";", "return", "true", ";", "}", "return", "super", ".", "onPreferenceTreeClick", "(", "preferenceScreen", ",", "preference", ")", ";", "}", "public", "boolean", "onPreferenceChange", "(", "Preference", "pref", ",", "Object", "newValue", ")", "{", "final", "ListPreference", "listPref", "=", "(", "ListPreference", ")", "pref", ";", "final", "int", "idx", "=", "listPref", ".", "findIndexOfValue", "(", "(", "String", ")", "newValue", ")", ";", "listPref", ".", "setSummary", "(", "listPref", ".", "getEntries", "(", ")", "[", "idx", "]", ")", ";", "return", "true", ";", "}", "private", "void", "refresh", "(", ")", "{", "final", "CheckBoxPreference", "alarmInSilentModePref", "=", "(", "CheckBoxPreference", ")", "findPreference", "(", "KEY_ALARM_IN_SILENT_MODE", ")", ";", "final", "int", "silentModeStreams", "=", "Settings", ".", "System", ".", "getInt", "(", "getContentResolver", "(", ")", ",", "Settings", ".", "System", ".", "MODE_RINGER_STREAMS_AFFECTED", ",", "0", ")", ";", "alarmInSilentModePref", ".", "setChecked", "(", "(", "silentModeStreams", "&", "ALARM_STREAM_TYPE_BIT", ")", "==", "0", ")", ";", "final", "ListPreference", "snooze", "=", "(", "ListPreference", ")", "findPreference", "(", "KEY_ALARM_SNOOZE", ")", ";", "snooze", ".", "setSummary", "(", "snooze", ".", "getEntry", "(", ")", ")", ";", "snooze", ".", "setOnPreferenceChangeListener", "(", "this", ")", ";", "}", "}", "</s>" ]
1,951
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "os", ".", "SystemClock", ";", "import", "android", ".", "util", ".", "Config", ";", "class", "Log", "{", "public", "final", "static", "String", "LOGTAG", "=", "\"AlarmClock\"", ";", "static", "final", "boolean", "LOGV", "=", "AlarmClock", ".", "DEBUG", "?", "Config", ".", "LOGD", ":", "Config", ".", "LOGV", ";", "static", "void", "v", "(", "String", "logMe", ")", "{", "android", ".", "util", ".", "Log", ".", "v", "(", "LOGTAG", ",", "logMe", ")", ";", "}", "static", "void", "e", "(", "String", "logMe", ")", "{", "android", ".", "util", ".", "Log", ".", "e", "(", "LOGTAG", ",", "logMe", ")", ";", "}", "static", "void", "e", "(", "String", "logMe", ",", "Exception", "ex", ")", "{", "android", ".", "util", ".", "Log", ".", "e", "(", "LOGTAG", ",", "logMe", ",", "ex", ")", ";", "}", "}", "</s>" ]
1,952
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "AlarmManager", ";", "import", "android", ".", "app", ".", "NotificationManager", ";", "import", "android", ".", "app", ".", "PendingIntent", ";", "import", "android", ".", "content", ".", "ContentResolver", ";", "import", "android", ".", "content", ".", "ContentValues", ";", "import", "android", ".", "content", ".", "ContentUris", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "SharedPreferences", ";", "import", "android", ".", "database", ".", "Cursor", ";", "import", "android", ".", "net", ".", "Uri", ";", "import", "android", ".", "os", ".", "Parcel", ";", "import", "android", ".", "provider", ".", "Settings", ";", "import", "android", ".", "text", ".", "format", ".", "DateFormat", ";", "import", "java", ".", "util", ".", "Calendar", ";", "import", "java", ".", "text", ".", "DateFormatSymbols", ";", "public", "class", "Alarms", "{", "public", "static", "final", "String", "ALARM_ALERT_ACTION", "=", "\"\"", ";", "public", "static", "final", "String", "ALARM_KILLED", "=", "\"alarm_killed\"", ";", "public", "static", "final", "String", "ALARM_KILLED_TIMEOUT", "=", "\"\"", ";", "public", "static", "final", "String", "ALARM_ALERT_SILENT", "=", "\"silent\"", ";", "public", "static", "final", "String", "CANCEL_SNOOZE", "=", "\"\"", ";", "public", "static", "final", "String", "ALARM_INTENT_EXTRA", "=", "\"\"", ";", "public", "static", "final", "String", "ALARM_RAW_DATA", "=", "\"\"", ";", "public", "static", "final", "String", "ALARM_ID", "=", "\"alarm_id\"", ";", "final", "static", "String", "PREF_SNOOZE_ID", "=", "\"snooze_id\"", ";", "final", "static", "String", "PREF_SNOOZE_TIME", "=", "\"snooze_time\"", ";", "private", "final", "static", "String", "DM12", "=", "\"E", "h:mm", "aa\"", ";", "private", "final", "static", "String", "DM24", "=", "\"E", "k:mm\"", ";", "private", "final", "static", "String", "M12", "=", "\"h:mm", "aa\"", ";", "final", "static", "String", "M24", "=", "\"kk:mm\"", ";", "public", "static", "Uri", "addAlarm", "(", "ContentResolver", "contentResolver", ")", "{", "ContentValues", "values", "=", "new", "ContentValues", "(", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "HOUR", ",", "8", ")", ";", "return", "contentResolver", ".", "insert", "(", "Alarm", ".", "Columns", ".", "CONTENT_URI", ",", "values", ")", ";", "}", "public", "static", "void", "deleteAlarm", "(", "Context", "context", ",", "int", "alarmId", ")", "{", "ContentResolver", "contentResolver", "=", "context", ".", "getContentResolver", "(", ")", ";", "disableSnoozeAlert", "(", "context", ",", "alarmId", ")", ";", "Uri", "uri", "=", "ContentUris", ".", "withAppendedId", "(", "Alarm", ".", "Columns", ".", "CONTENT_URI", ",", "alarmId", ")", ";", "contentResolver", ".", "delete", "(", "uri", ",", "\"\"", ",", "null", ")", ";", "setNextAlert", "(", "context", ")", ";", "}", "public", "static", "Cursor", "getAlarmsCursor", "(", "ContentResolver", "contentResolver", ")", "{", "return", "contentResolver", ".", "query", "(", "Alarm", ".", "Columns", ".", "CONTENT_URI", ",", "Alarm", ".", "Columns", ".", "ALARM_QUERY_COLUMNS", ",", "null", ",", "null", ",", "Alarm", ".", "Columns", ".", "DEFAULT_SORT_ORDER", ")", ";", "}", "private", "static", "Cursor", "getFilteredAlarmsCursor", "(", "ContentResolver", "contentResolver", ")", "{", "return", "contentResolver", ".", "query", "(", "Alarm", ".", "Columns", ".", "CONTENT_URI", ",", "Alarm", ".", "Columns", ".", "ALARM_QUERY_COLUMNS", ",", "Alarm", ".", "Columns", ".", "WHERE_ENABLED", ",", "null", ",", "null", ")", ";", "}", "public", "static", "Alarm", "getAlarm", "(", "ContentResolver", "contentResolver", ",", "int", "alarmId", ")", "{", "Cursor", "cursor", "=", "contentResolver", ".", "query", "(", "ContentUris", ".", "withAppendedId", "(", "Alarm", ".", "Columns", ".", "CONTENT_URI", ",", "alarmId", ")", ",", "Alarm", ".", "Columns", ".", "ALARM_QUERY_COLUMNS", ",", "null", ",", "null", ",", "null", ")", ";", "Alarm", "alarm", "=", "null", ";", "if", "(", "cursor", "!=", "null", ")", "{", "if", "(", "cursor", ".", "moveToFirst", "(", ")", ")", "{", "alarm", "=", "new", "Alarm", "(", "cursor", ")", ";", "}", "cursor", ".", "close", "(", ")", ";", "}", "return", "alarm", ";", "}", "public", "static", "long", "setAlarm", "(", "Context", "context", ",", "int", "id", ",", "boolean", "enabled", ",", "int", "hour", ",", "int", "minutes", ",", "Alarm", ".", "DaysOfWeek", "daysOfWeek", ",", "boolean", "vibrate", ",", "String", "message", ",", "String", "alert", ")", "{", "ContentValues", "values", "=", "new", "ContentValues", "(", "8", ")", ";", "ContentResolver", "resolver", "=", "context", ".", "getContentResolver", "(", ")", ";", "long", "time", "=", "0", ";", "if", "(", "!", "daysOfWeek", ".", "isRepeatSet", "(", ")", ")", "{", "time", "=", "calculateAlarm", "(", "hour", ",", "minutes", ",", "daysOfWeek", ")", ".", "getTimeInMillis", "(", ")", ";", "}", "if", "(", "Log", ".", "LOGV", ")", "Log", ".", "v", "(", "\"\"", "+", "id", "+", "\"", "hour", "\"", "+", "hour", "+", "\"", "minutes", "\"", "+", "minutes", "+", "\"", "enabled", "\"", "+", "enabled", "+", "\"", "time", "\"", "+", "time", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "ENABLED", ",", "enabled", "?", "1", ":", "0", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "HOUR", ",", "hour", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "MINUTES", ",", "minutes", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "ALARM_TIME", ",", "time", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "DAYS_OF_WEEK", ",", "daysOfWeek", ".", "getCoded", "(", ")", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "VIBRATE", ",", "vibrate", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "MESSAGE", ",", "message", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "ALERT", ",", "alert", ")", ";", "resolver", ".", "update", "(", "ContentUris", ".", "withAppendedId", "(", "Alarm", ".", "Columns", ".", "CONTENT_URI", ",", "id", ")", ",", "values", ",", "null", ",", "null", ")", ";", "long", "timeInMillis", "=", "calculateAlarm", "(", "hour", ",", "minutes", ",", "daysOfWeek", ")", ".", "getTimeInMillis", "(", ")", ";", "if", "(", "enabled", ")", "{", "SharedPreferences", "prefs", "=", "context", ".", "getSharedPreferences", "(", "AlarmClock", ".", "PREFERENCES", ",", "0", ")", ";", "long", "snoozeTime", "=", "prefs", ".", "getLong", "(", "PREF_SNOOZE_TIME", ",", "0", ")", ";", "if", "(", "timeInMillis", "<", "snoozeTime", ")", "{", "clearSnoozePreference", "(", "context", ",", "prefs", ")", ";", "}", "}", "setNextAlert", "(", "context", ")", ";", "return", "timeInMillis", ";", "}", "public", "static", "void", "enableAlarm", "(", "final", "Context", "context", ",", "final", "int", "id", ",", "boolean", "enabled", ")", "{", "enableAlarmInternal", "(", "context", ",", "id", ",", "enabled", ")", ";", "setNextAlert", "(", "context", ")", ";", "}", "private", "static", "void", "enableAlarmInternal", "(", "final", "Context", "context", ",", "final", "int", "id", ",", "boolean", "enabled", ")", "{", "enableAlarmInternal", "(", "context", ",", "getAlarm", "(", "context", ".", "getContentResolver", "(", ")", ",", "id", ")", ",", "enabled", ")", ";", "}", "private", "static", "void", "enableAlarmInternal", "(", "final", "Context", "context", ",", "final", "Alarm", "alarm", ",", "boolean", "enabled", ")", "{", "ContentResolver", "resolver", "=", "context", ".", "getContentResolver", "(", ")", ";", "ContentValues", "values", "=", "new", "ContentValues", "(", "2", ")", ";", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "ENABLED", ",", "enabled", "?", "1", ":", "0", ")", ";", "if", "(", "enabled", ")", "{", "long", "time", "=", "0", ";", "if", "(", "!", "alarm", ".", "daysOfWeek", ".", "isRepeatSet", "(", ")", ")", "{", "time", "=", "calculateAlarm", "(", "alarm", ".", "hour", ",", "alarm", ".", "minutes", ",", "alarm", ".", "daysOfWeek", ")", ".", "getTimeInMillis", "(", ")", ";", "}", "values", ".", "put", "(", "Alarm", ".", "Columns", ".", "ALARM_TIME", ",", "time", ")", ";", "}", "resolver", ".", "update", "(", "ContentUris", ".", "withAppendedId", "(", "Alarm", ".", "Columns", ".", "CONTENT_URI", ",", "alarm", ".", "id", ")", ",", "values", ",", "null", ",", "null", ")", ";", "}", "public", "static", "Alarm", "calculateNextAlert", "(", "final", "Context", "context", ")", "{", "Alarm", "alarm", "=", "null", ";", "long", "minTime", "=", "Long", ".", "MAX_VALUE", ";", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Cursor", "cursor", "=", "getFilteredAlarmsCursor", "(", "context", ".", "getContentResolver", "(", ")", ")", ";", "if", "(", "cursor", "!=", "null", ")", "{", "if", "(", "cursor", ".", "moveToFirst", "(", ")", ")", "{", "do", "{", "Alarm", "a", "=", "new", "Alarm", "(", "cursor", ")", ";", "if", "(", "a", ".", "time", "==", "0", ")", "{", "a", ".", "time", "=", "calculateAlarm", "(", "a", ".", "hour", ",", "a", ".", "minutes", ",", "a", ".", "daysOfWeek", ")", ".", "getTimeInMillis", "(", ")", ";", "}", "else", "if", "(", "a", ".", "time", "<", "now", ")", "{", "enableAlarmInternal", "(", "context", ",", "a", ",", "false", ")", ";", "continue", ";", "}", "if", "(", "a", ".", "time", "<", "minTime", ")", "{", "minTime", "=", "a", ".", "time", ";", "alarm", "=", "a", ";", "}", "}", "while", "(", "cursor", ".", "moveToNext", "(", ")", ")", ";", "}", "cursor", ".", "close", "(", ")", ";", "}", "return", "alarm", ";", "}", "public", "static", "void", "disableExpiredAlarms", "(", "final", "Context", "context", ")", "{", "Cursor", "cur", "=", "getFilteredAlarmsCursor", "(", "context", ".", "getContentResolver", "(", ")", ")", ";", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "cur", ".", "moveToFirst", "(", ")", ")", "{", "do", "{", "Alarm", "alarm", "=", "new", "Alarm", "(", "cur", ")", ";", "if", "(", "alarm", ".", "time", "!=", "0", "&&", "alarm", ".", "time", "<", "now", ")", "{", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"**", "DISABLE", "\"", "+", "alarm", ".", "id", "+", "\"", "now", "\"", "+", "now", "+", "\"", "set", "\"", "+", "alarm", ".", "time", ")", ";", "}", "enableAlarmInternal", "(", "context", ",", "alarm", ",", "false", ")", ";", "}", "}", "while", "(", "cur", ".", "moveToNext", "(", ")", ")", ";", "}", "cur", ".", "close", "(", ")", ";", "}", "public", "static", "void", "setNextAlert", "(", "final", "Context", "context", ")", "{", "if", "(", "!", "enableSnoozeAlert", "(", "context", ")", ")", "{", "Alarm", "alarm", "=", "calculateNextAlert", "(", "context", ")", ";", "if", "(", "alarm", "!=", "null", ")", "{", "enableAlert", "(", "context", ",", "alarm", ",", "alarm", ".", "time", ")", ";", "}", "else", "{", "disableAlert", "(", "context", ")", ";", "}", "}", "}", "private", "static", "void", "enableAlert", "(", "Context", "context", ",", "final", "Alarm", "alarm", ",", "final", "long", "atTimeInMillis", ")", "{", "AlarmManager", "am", "=", "(", "AlarmManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "ALARM_SERVICE", ")", ";", "if", "(", "Log", ".", "LOGV", ")", "{", "Log", ".", "v", "(", "\"\"", "+", "alarm", ".", "id", "+", "\"", "atTime", "\"", "+", "atTimeInMillis", ")", ";", "}", "Intent", "intent", "=", "new", "Intent", "(", "ALARM_ALERT_ACTION", ")", ";", "Parcel", "out", "=", "Parcel", ".", "obtain", "(", ")", ";", "alarm", ".", "writeToParcel", "(", "out", ",", "0", ")", ";", "out", ".", "setDataPosition", "(", "0", ")", ";", "intent", ".", "putExtra", "(", "ALARM_RAW_DATA", ",", "out", ".", "marshall", "(", ")", ")", ";", "PendingIntent", "sender", "=", "PendingIntent", ".", "getBroadcast", "(", "context", ",", "0", ",", "intent", ",", "PendingIntent", ".", "FLAG_CANCEL_CURRENT", ")", ";", "am", ".", "set", "(", "AlarmManager", ".", "RTC_WAKEUP", ",", "atTimeInMillis", ",", "sender", ")", ";", "setStatusBarIcon", "(", "context", ",", "true", ")", ";", "Calendar", "c", "=", "Calendar", ".", "getInstance", "(", ")", ";", "c", ".", "setTime", "(", "new", "java", ".", "util", ".", "Date", "(", "atTimeInMillis", ")", ")", ";", "String", "timeString", "=", "formatDayAndTime", "(", "context", ",", "c", ")", ";", "saveNextAlarm", "(", "context", ",", "timeString", ")", ";", "}", "static", "void", "disableAlert", "(", "Context", "context", ")", "{", "AlarmManager", "am", "=", "(", "AlarmManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "ALARM_SERVICE", ")", ";", "PendingIntent", "sender", "=", "PendingIntent", ".", "getBroadcast", "(", "context", ",", "0", ",", "new", "Intent", "(", "ALARM_ALERT_ACTION", ")", ",", "PendingIntent", ".", "FLAG_CANCEL_CURRENT", ")", ";", "am", ".", "cancel", "(", "sender", ")", ";", "setStatusBarIcon", "(", "context", ",", "false", ")", ";", "saveNextAlarm", "(", "context", ",", "\"\"", ")", ";", "}", "static", "void", "saveSnoozeAlert", "(", "final", "Context", "context", ",", "final", "int", "id", ",", "final", "long", "time", ")", "{", "SharedPreferences", "prefs", "=", "context", ".", "getSharedPreferences", "(", "AlarmClock", ".", "PREFERENCES", ",", "0", ")", ";", "if", "(", "id", "==", "-", "1", ")", "{", "clearSnoozePreference", "(", "context", ",", "prefs", ")", ";", "}", "else", "{", "SharedPreferences", ".", "Editor", "ed", "=", "prefs", ".", "edit", "(", ")", ";", "ed", ".", "putInt", "(", "PREF_SNOOZE_ID", ",", "id", ")", ";", "ed", ".", "putLong", "(", "PREF_SNOOZE_TIME", ",", "time", ")", ";", "ed", ".", "commit", "(", ")", ";", "}", "setNextAlert", "(", "context", ")", ";", "}", "static", "void", "disableSnoozeAlert", "(", "final", "Context", "context", ",", "final", "int", "id", ")", "{", "SharedPreferences", "prefs", "=", "context", ".", "getSharedPreferences", "(", "AlarmClock", ".", "PREFERENCES", ",", "0", ")", ";", "int", "snoozeId", "=", "prefs", ".", "getInt", "(", "PREF_SNOOZE_ID", ",", "-", "1", ")", ";", "if", "(", "snoozeId", "==", "-", "1", ")", "{", "return", ";", "}", "else", "if", "(", "snoozeId", "==", "id", ")", "{", "clearSnoozePreference", "(", "context", ",", "prefs", ")", ";", "}", "}", "private", "static", "void", "clearSnoozePreference", "(", "final", "Context", "context", ",", "final", "SharedPreferences", "prefs", ")", "{", "final", "int", "alarmId", "=", "prefs", ".", "getInt", "(", "PREF_SNOOZE_ID", ",", "-", "1", ")", ";", "if", "(", "alarmId", "!=", "-", "1", ")", "{", "NotificationManager", "nm", "=", "(", "NotificationManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "NOTIFICATION_SERVICE", ")", ";", "nm", ".", "cancel", "(", "alarmId", ")", ";", "}", "final", "SharedPreferences", ".", "Editor", "ed", "=", "prefs", ".", "edit", "(", ")", ";", "ed", ".", "remove", "(", "PREF_SNOOZE_ID", ")", ";", "ed", ".", "remove", "(", "PREF_SNOOZE_TIME", ")", ";", "ed", ".", "commit", "(", ")", ";", "}", ";", "private", "static", "boolean", "enableSnoozeAlert", "(", "final", "Context", "context", ")", "{", "SharedPreferences", "prefs", "=", "context", ".", "getSharedPreferences", "(", "AlarmClock", ".", "PREFERENCES", ",", "0", ")", ";", "int", "id", "=", "prefs", ".", "getInt", "(", "PREF_SNOOZE_ID", ",", "-", "1", ")", ";", "if", "(", "id", "==", "-", "1", ")", "{", "return", "false", ";", "}", "long", "time", "=", "prefs", ".", "getLong", "(", "PREF_SNOOZE_TIME", ",", "-", "1", ")", ";", "final", "Alarm", "alarm", "=", "getAlarm", "(", "context", ".", "getContentResolver", "(", ")", ",", "id", ")", ";", "alarm", ".", "time", "=", "time", ";", "enableAlert", "(", "context", ",", "alarm", ",", "time", ")", ";", "return", "true", ";", "}", "private", "static", "void", "setStatusBarIcon", "(", "Context", "context", ",", "boolean", "enabled", ")", "{", "Intent", "alarmChanged", "=", "new", "Intent", "(", "Intent", ".", "ACTION_ALARM_CHANGED", ")", ";", "alarmChanged", ".", "putExtra", "(", "\"alarmSet\"", ",", "enabled", ")", ";", "context", ".", "sendBroadcast", "(", "alarmChanged", ")", ";", "}", "static", "Calendar", "calculateAlarm", "(", "int", "hour", ",", "int", "minute", ",", "Alarm", ".", "DaysOfWeek", "daysOfWeek", ")", "{", "Calendar", "c", "=", "Calendar", ".", "getInstance", "(", ")", ";", "c", ".", "setTimeInMillis", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "int", "nowHour", "=", "c", ".", "get", "(", "Calendar", ".", "HOUR_OF_DAY", ")", ";", "int", "nowMinute", "=", "c", ".", "get", "(", "Calendar", ".", "MINUTE", ")", ";", "if", "(", "hour", "<", "nowHour", "||", "hour", "==", "nowHour", "&&", "minute", "<=", "nowMinute", ")", "{", "c", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "1", ")", ";", "}", "c", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hour", ")", ";", "c", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "minute", ")", ";", "c", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "c", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "int", "addDays", "=", "daysOfWeek", ".", "getNextAlarm", "(", "c", ")", ";", "if", "(", "addDays", ">", "0", ")", "c", ".", "add", "(", "Calendar", ".", "DAY_OF_WEEK", ",", "addDays", ")", ";", "return", "c", ";", "}", "static", "String", "formatTime", "(", "final", "Context", "context", ",", "int", "hour", ",", "int", "minute", ",", "Alarm", ".", "DaysOfWeek", "daysOfWeek", ")", "{", "Calendar", "c", "=", "calculateAlarm", "(", "hour", ",", "minute", ",", "daysOfWeek", ")", ";", "return", "formatTime", "(", "context", ",", "c", ")", ";", "}", "static", "String", "formatTime", "(", "final", "Context", "context", ",", "Calendar", "c", ")", "{", "String", "format", "=", "get24HourMode", "(", "context", ")", "?", "M24", ":", "M12", ";", "return", "(", "c", "==", "null", ")", "?", "\"\"", ":", "(", "String", ")", "DateFormat", ".", "format", "(", "format", ",", "c", ")", ";", "}", "private", "static", "String", "formatDayAndTime", "(", "final", "Context", "context", ",", "Calendar", "c", ")", "{", "String", "format", "=", "get24HourMode", "(", "context", ")", "?", "DM24", ":", "DM12", ";", "return", "(", "c", "==", "null", ")", "?", "\"\"", ":", "(", "String", ")", "DateFormat", ".", "format", "(", "format", ",", "c", ")", ";", "}", "static", "void", "saveNextAlarm", "(", "final", "Context", "context", ",", "String", "timeString", ")", "{", "Settings", ".", "System", ".", "putString", "(", "context", ".", "getContentResolver", "(", ")", ",", "Settings", ".", "System", ".", "NEXT_ALARM_FORMATTED", ",", "timeString", ")", ";", "}", "static", "boolean", "get24HourMode", "(", "final", "Context", "context", ")", "{", "return", "android", ".", "text", ".", "format", ".", "DateFormat", ".", "is24HourFormat", "(", "context", ")", ";", "}", "}", "</s>" ]
1,953
[ "<s>", "package", "com", ".", "android", ".", "alarmclock", ";", "import", "android", ".", "app", ".", "PendingIntent", ";", "import", "android", ".", "appwidget", ".", "AppWidgetManager", ";", "import", "android", ".", "content", ".", "BroadcastReceiver", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "widget", ".", "RemoteViews", ";", "public", "class", "AnalogAppWidgetProvider", "extends", "BroadcastReceiver", "{", "static", "final", "String", "TAG", "=", "\"\"", ";", "public", "void", "onReceive", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "String", "action", "=", "intent", ".", "getAction", "(", ")", ";", "if", "(", "AppWidgetManager", ".", "ACTION_APPWIDGET_UPDATE", ".", "equals", "(", "action", ")", ")", "{", "RemoteViews", "views", "=", "new", "RemoteViews", "(", "context", ".", "getPackageName", "(", ")", ",", "R", ".", "layout", ".", "analog_appwidget", ")", ";", "views", ".", "setOnClickPendingIntent", "(", "R", ".", "id", ".", "analog_appwidget", ",", "PendingIntent", ".", "getActivity", "(", "context", ",", "0", ",", "new", "Intent", "(", "context", ",", "AlarmClock", ".", "class", ")", ",", "PendingIntent", ".", "FLAG_CANCEL_CURRENT", ")", ")", ";", "int", "[", "]", "appWidgetIds", "=", "intent", ".", "getIntArrayExtra", "(", "AppWidgetManager", ".", "EXTRA_APPWIDGET_IDS", ")", ";", "AppWidgetManager", "gm", "=", "AppWidgetManager", ".", "getInstance", "(", "context", ")", ";", "gm", ".", "updateAppWidget", "(", "appWidgetIds", ",", "views", ")", ";", "}", "}", "}", "</s>" ]
1,954
[ "<s>", "package", "com", ".", "wuntee", ".", "aat", ";", "import", "junit", ".", "framework", ".", "Test", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "import", "junit", ".", "framework", ".", "TestSuite", ";", "public", "class", "AppTest", "extends", "TestCase", "{", "public", "AppTest", "(", "String", "testName", ")", "{", "super", "(", "testName", ")", ";", "}", "public", "static", "Test", "suite", "(", ")", "{", "return", "new", "TestSuite", "(", "AppTest", ".", "class", ")", ";", "}", "public", "void", "testApp", "(", ")", "{", "assertTrue", "(", "true", ")", ";", "}", "}", "</s>" ]
1,955
[ "<s>", "package", "org", ".", "eclipse", ".", "wb", ".", "swt", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "Color", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "Cursor", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "Font", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "FontData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "GC", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "Image", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "ImageData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "RGB", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "Rectangle", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Display", ";", "public", "class", "SWTResourceManager", "{", "private", "static", "Map", "<", "RGB", ",", "Color", ">", "m_colorMap", "=", "new", "HashMap", "<", "RGB", ",", "Color", ">", "(", ")", ";", "public", "static", "Color", "getColor", "(", "int", "systemColorID", ")", "{", "Display", "display", "=", "Display", ".", "getCurrent", "(", ")", ";", "return", "display", ".", "getSystemColor", "(", "systemColorID", ")", ";", "}", "public", "static", "Color", "getColor", "(", "int", "r", ",", "int", "g", ",", "int", "b", ")", "{", "return", "getColor", "(", "new", "RGB", "(", "r", ",", "g", ",", "b", ")", ")", ";", "}", "public", "static", "Color", "getColor", "(", "RGB", "rgb", ")", "{", "Color", "color", "=", "m_colorMap", ".", "get", "(", "rgb", ")", ";", "if", "(", "color", "==", "null", ")", "{", "Display", "display", "=", "Display", ".", "getCurrent", "(", ")", ";", "color", "=", "new", "Color", "(", "display", ",", "rgb", ")", ";", "m_colorMap", ".", "put", "(", "rgb", ",", "color", ")", ";", "}", "return", "color", ";", "}", "public", "static", "void", "disposeColors", "(", ")", "{", "for", "(", "Color", "color", ":", "m_colorMap", ".", "values", "(", ")", ")", "{", "color", ".", "dispose", "(", ")", ";", "}", "m_colorMap", ".", "clear", "(", ")", ";", "}", "private", "static", "Map", "<", "String", ",", "Image", ">", "m_imageMap", "=", "new", "HashMap", "<", "String", ",", "Image", ">", "(", ")", ";", "protected", "static", "Image", "getImage", "(", "InputStream", "stream", ")", "throws", "IOException", "{", "try", "{", "Display", "display", "=", "Display", ".", "getCurrent", "(", ")", ";", "ImageData", "data", "=", "new", "ImageData", "(", "stream", ")", ";", "if", "(", "data", ".", "transparentPixel", ">", "0", ")", "{", "return", "new", "Image", "(", "display", ",", "data", ",", "data", ".", "getTransparencyMask", "(", ")", ")", ";", "}", "return", "new", "Image", "(", "display", ",", "data", ")", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "}", "}", "public", "static", "Image", "getImage", "(", "String", "path", ")", "{", "Image", "image", "=", "m_imageMap", ".", "get", "(", "path", ")", ";", "if", "(", "image", "==", "null", ")", "{", "try", "{", "image", "=", "getImage", "(", "new", "FileInputStream", "(", "path", ")", ")", ";", "m_imageMap", ".", "put", "(", "path", ",", "image", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "image", "=", "getMissingImage", "(", ")", ";", "m_imageMap", ".", "put", "(", "path", ",", "image", ")", ";", "}", "}", "return", "image", ";", "}", "public", "static", "Image", "getImage", "(", "Class", "<", "?", ">", "clazz", ",", "String", "path", ")", "{", "String", "key", "=", "clazz", ".", "getName", "(", ")", "+", "'|'", "+", "path", ";", "Image", "image", "=", "m_imageMap", ".", "get", "(", "key", ")", ";", "if", "(", "image", "==", "null", ")", "{", "try", "{", "image", "=", "getImage", "(", "clazz", ".", "getResourceAsStream", "(", "path", ")", ")", ";", "m_imageMap", ".", "put", "(", "key", ",", "image", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "image", "=", "getMissingImage", "(", ")", ";", "m_imageMap", ".", "put", "(", "key", ",", "image", ")", ";", "}", "}", "return", "image", ";", "}", "private", "static", "final", "int", "MISSING_IMAGE_SIZE", "=", "10", ";", "private", "static", "Image", "getMissingImage", "(", ")", "{", "Image", "image", "=", "new", "Image", "(", "Display", ".", "getCurrent", "(", ")", ",", "MISSING_IMAGE_SIZE", ",", "MISSING_IMAGE_SIZE", ")", ";", "GC", "gc", "=", "new", "GC", "(", "image", ")", ";", "gc", ".", "setBackground", "(", "getColor", "(", "SWT", ".", "COLOR_RED", ")", ")", ";", "gc", ".", "fillRectangle", "(", "0", ",", "0", ",", "MISSING_IMAGE_SIZE", ",", "MISSING_IMAGE_SIZE", ")", ";", "gc", ".", "dispose", "(", ")", ";", "return", "image", ";", "}", "public", "static", "final", "int", "TOP_LEFT", "=", "1", ";", "public", "static", "final", "int", "TOP_RIGHT", "=", "2", ";", "public", "static", "final", "int", "BOTTOM_LEFT", "=", "3", ";", "public", "static", "final", "int", "BOTTOM_RIGHT", "=", "4", ";", "protected", "static", "final", "int", "LAST_CORNER_KEY", "=", "5", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "Map", "<", "Image", ",", "Map", "<", "Image", ",", "Image", ">", ">", "[", "]", "m_decoratedImageMap", "=", "new", "Map", "[", "LAST_CORNER_KEY", "]", ";", "public", "static", "Image", "decorateImage", "(", "Image", "baseImage", ",", "Image", "decorator", ")", "{", "return", "decorateImage", "(", "baseImage", ",", "decorator", ",", "BOTTOM_RIGHT", ")", ";", "}", "public", "static", "Image", "decorateImage", "(", "final", "Image", "baseImage", ",", "final", "Image", "decorator", ",", "final", "int", "corner", ")", "{", "if", "(", "corner", "<=", "0", "||", "corner", ">=", "LAST_CORNER_KEY", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "Map", "<", "Image", ",", "Map", "<", "Image", ",", "Image", ">", ">", "cornerDecoratedImageMap", "=", "m_decoratedImageMap", "[", "corner", "]", ";", "if", "(", "cornerDecoratedImageMap", "==", "null", ")", "{", "cornerDecoratedImageMap", "=", "new", "HashMap", "<", "Image", ",", "Map", "<", "Image", ",", "Image", ">", ">", "(", ")", ";", "m_decoratedImageMap", "[", "corner", "]", "=", "cornerDecoratedImageMap", ";", "}", "Map", "<", "Image", ",", "Image", ">", "decoratedMap", "=", "cornerDecoratedImageMap", ".", "get", "(", "baseImage", ")", ";", "if", "(", "decoratedMap", "==", "null", ")", "{", "decoratedMap", "=", "new", "HashMap", "<", "Image", ",", "Image", ">", "(", ")", ";", "cornerDecoratedImageMap", ".", "put", "(", "baseImage", ",", "decoratedMap", ")", ";", "}", "Image", "result", "=", "decoratedMap", ".", "get", "(", "decorator", ")", ";", "if", "(", "result", "==", "null", ")", "{", "Rectangle", "bib", "=", "baseImage", ".", "getBounds", "(", ")", ";", "Rectangle", "dib", "=", "decorator", ".", "getBounds", "(", ")", ";", "result", "=", "new", "Image", "(", "Display", ".", "getCurrent", "(", ")", ",", "bib", ".", "width", ",", "bib", ".", "height", ")", ";", "GC", "gc", "=", "new", "GC", "(", "result", ")", ";", "gc", ".", "drawImage", "(", "baseImage", ",", "0", ",", "0", ")", ";", "if", "(", "corner", "==", "TOP_LEFT", ")", "{", "gc", ".", "drawImage", "(", "decorator", ",", "0", ",", "0", ")", ";", "}", "else", "if", "(", "corner", "==", "TOP_RIGHT", ")", "{", "gc", ".", "drawImage", "(", "decorator", ",", "bib", ".", "width", "-", "dib", ".", "width", ",", "0", ")", ";", "}", "else", "if", "(", "corner", "==", "BOTTOM_LEFT", ")", "{", "gc", ".", "drawImage", "(", "decorator", ",", "0", ",", "bib", ".", "height", "-", "dib", ".", "height", ")", ";", "}", "else", "if", "(", "corner", "==", "BOTTOM_RIGHT", ")", "{", "gc", ".", "drawImage", "(", "decorator", ",", "bib", ".", "width", "-", "dib", ".", "width", ",", "bib", ".", "height", "-", "dib", ".", "height", ")", ";", "}", "gc", ".", "dispose", "(", ")", ";", "decoratedMap", ".", "put", "(", "decorator", ",", "result", ")", ";", "}", "return", "result", ";", "}", "public", "static", "void", "disposeImages", "(", ")", "{", "{", "for", "(", "Image", "image", ":", "m_imageMap", ".", "values", "(", ")", ")", "{", "image", ".", "dispose", "(", ")", ";", "}", "m_imageMap", ".", "clear", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_decoratedImageMap", ".", "length", ";", "i", "++", ")", "{", "Map", "<", "Image", ",", "Map", "<", "Image", ",", "Image", ">", ">", "cornerDecoratedImageMap", "=", "m_decoratedImageMap", "[", "i", "]", ";", "if", "(", "cornerDecoratedImageMap", "!=", "null", ")", "{", "for", "(", "Map", "<", "Image", ",", "Image", ">", "decoratedMap", ":", "cornerDecoratedImageMap", ".", "values", "(", ")", ")", "{", "for", "(", "Image", "image", ":", "decoratedMap", ".", "values", "(", ")", ")", "{", "image", ".", "dispose", "(", ")", ";", "}", "decoratedMap", ".", "clear", "(", ")", ";", "}", "cornerDecoratedImageMap", ".", "clear", "(", ")", ";", "}", "}", "}", "private", "static", "Map", "<", "String", ",", "Font", ">", "m_fontMap", "=", "new", "HashMap", "<", "String", ",", "Font", ">", "(", ")", ";", "private", "static", "Map", "<", "Font", ",", "Font", ">", "m_fontToBoldFontMap", "=", "new", "HashMap", "<", "Font", ",", "Font", ">", "(", ")", ";", "public", "static", "Font", "getFont", "(", "String", "name", ",", "int", "height", ",", "int", "style", ")", "{", "return", "getFont", "(", "name", ",", "height", ",", "style", ",", "false", ",", "false", ")", ";", "}", "public", "static", "Font", "getFont", "(", "String", "name", ",", "int", "size", ",", "int", "style", ",", "boolean", "strikeout", ",", "boolean", "underline", ")", "{", "String", "fontName", "=", "name", "+", "'|'", "+", "size", "+", "'|'", "+", "style", "+", "'|'", "+", "strikeout", "+", "'|'", "+", "underline", ";", "Font", "font", "=", "m_fontMap", ".", "get", "(", "fontName", ")", ";", "if", "(", "font", "==", "null", ")", "{", "FontData", "fontData", "=", "new", "FontData", "(", "name", ",", "size", ",", "style", ")", ";", "if", "(", "strikeout", "||", "underline", ")", "{", "try", "{", "Class", "<", "?", ">", "logFontClass", "=", "Class", ".", "forName", "(", "\"\"", ")", ";", "Object", "logFont", "=", "FontData", ".", "class", ".", "getField", "(", "\"data\"", ")", ".", "get", "(", "fontData", ")", ";", "if", "(", "logFont", "!=", "null", "&&", "logFontClass", "!=", "null", ")", "{", "if", "(", "strikeout", ")", "{", "logFontClass", ".", "getField", "(", "\"lfStrikeOut\"", ")", ".", "set", "(", "logFont", ",", "Byte", ".", "valueOf", "(", "(", "byte", ")", "1", ")", ")", ";", "}", "if", "(", "underline", ")", "{", "logFontClass", ".", "getField", "(", "\"lfUnderline\"", ")", ".", "set", "(", "logFont", ",", "Byte", ".", "valueOf", "(", "(", "byte", ")", "1", ")", ")", ";", "}", "}", "}", "catch", "(", "Throwable", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "e", ")", ";", "}", "}", "font", "=", "new", "Font", "(", "Display", ".", "getCurrent", "(", ")", ",", "fontData", ")", ";", "m_fontMap", ".", "put", "(", "fontName", ",", "font", ")", ";", "}", "return", "font", ";", "}", "public", "static", "Font", "getBoldFont", "(", "Font", "baseFont", ")", "{", "Font", "font", "=", "m_fontToBoldFontMap", ".", "get", "(", "baseFont", ")", ";", "if", "(", "font", "==", "null", ")", "{", "FontData", "fontDatas", "[", "]", "=", "baseFont", ".", "getFontData", "(", ")", ";", "FontData", "data", "=", "fontDatas", "[", "0", "]", ";", "font", "=", "new", "Font", "(", "Display", ".", "getCurrent", "(", ")", ",", "data", ".", "getName", "(", ")", ",", "data", ".", "getHeight", "(", ")", ",", "SWT", ".", "BOLD", ")", ";", "m_fontToBoldFontMap", ".", "put", "(", "baseFont", ",", "font", ")", ";", "}", "return", "font", ";", "}", "public", "static", "void", "disposeFonts", "(", ")", "{", "for", "(", "Font", "font", ":", "m_fontMap", ".", "values", "(", ")", ")", "{", "font", ".", "dispose", "(", ")", ";", "}", "m_fontMap", ".", "clear", "(", ")", ";", "for", "(", "Font", "font", ":", "m_fontToBoldFontMap", ".", "values", "(", ")", ")", "{", "font", ".", "dispose", "(", ")", ";", "}", "m_fontToBoldFontMap", ".", "clear", "(", ")", ";", "}", "private", "static", "Map", "<", "Integer", ",", "Cursor", ">", "m_idToCursorMap", "=", "new", "HashMap", "<", "Integer", ",", "Cursor", ">", "(", ")", ";", "public", "static", "Cursor", "getCursor", "(", "int", "id", ")", "{", "Integer", "key", "=", "Integer", ".", "valueOf", "(", "id", ")", ";", "Cursor", "cursor", "=", "m_idToCursorMap", ".", "get", "(", "key", ")", ";", "if", "(", "cursor", "==", "null", ")", "{", "cursor", "=", "new", "Cursor", "(", "Display", ".", "getDefault", "(", ")", ",", "id", ")", ";", "m_idToCursorMap", ".", "put", "(", "key", ",", "cursor", ")", ";", "}", "return", "cursor", ";", "}", "public", "static", "void", "disposeCursors", "(", ")", "{", "for", "(", "Cursor", "cursor", ":", "m_idToCursorMap", ".", "values", "(", ")", ")", "{", "cursor", ".", "dispose", "(", ")", ";", "}", "m_idToCursorMap", ".", "clear", "(", ")", ";", "}", "public", "static", "void", "dispose", "(", ")", "{", "disposeColors", "(", ")", ";", "disposeImages", "(", ")", ";", "disposeFonts", "(", ")", ";", "disposeCursors", "(", ")", ";", "}", "}", "</s>" ]
1,956
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "packagemanager", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "OterStatics", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "adb", ".", "AdbWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "command", ".", "TerminatingCommand", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "exception", ".", "CommandFailedException", ";", "public", "class", "PackageManagerWorkshop", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "AdbWorkshop", ".", "class", ")", ";", "public", "static", "List", "<", "String", ">", "getDetailedPackageInfo", "(", "File", "apk", ")", "throws", "IOException", ",", "InterruptedException", ",", "CommandFailedException", "{", "logger", ".", "debug", "(", "\"\"", "+", "apk", ")", ";", "TerminatingCommand", "cmd", "=", "new", "TerminatingCommand", "(", "new", "String", "[", "]", "{", "OterStatics", ".", "getAaptCommand", "(", ")", ",", "\"l\"", ",", "\"-a\"", ",", "apk", ".", "getAbsolutePath", "(", ")", "}", ")", ";", "int", "r", "=", "cmd", ".", "executeNoErrorMonitor", "(", ")", ";", "logger", ".", "debug", "(", "\"\"", "+", "r", ")", ";", "return", "(", "cmd", ".", "getOutput", "(", ")", ")", ";", "}", "}", "</s>" ]
1,957
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "packagemanager", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "exception", ".", "ParseException", ";", "public", "class", "PackageBean", "{", "private", "String", "apk", ";", "private", "String", "clazz", ";", "public", "static", "PackageBean", "parse", "(", "String", "s", ")", "throws", "ParseException", "{", "String", "[", "]", "sSplit", "=", "s", ".", "split", "(", "\"=\"", ")", ";", "PackageBean", "b", "=", "new", "PackageBean", "(", ")", ";", "if", "(", "sSplit", ".", "length", "==", "2", ")", "{", "b", ".", "setClazz", "(", "sSplit", "[", "1", "]", ")", ";", "b", ".", "setApk", "(", "sSplit", "[", "0", "]", ".", "substring", "(", "sSplit", "[", "0", "]", ".", "indexOf", "(", "':'", ")", "+", "1", ")", ")", ";", "return", "(", "b", ")", ";", "}", "else", "{", "throw", "new", "ParseException", "(", "\"\"", "+", "s", "+", "\"'\"", ")", ";", "}", "}", "public", "String", "getApk", "(", ")", "{", "return", "apk", ";", "}", "public", "void", "setApk", "(", "String", "apk", ")", "{", "this", ".", "apk", "=", "apk", ";", "}", "public", "String", "getClazz", "(", ")", "{", "return", "clazz", ";", "}", "public", "void", "setClazz", "(", "String", "clazz", ")", "{", "this", ".", "clazz", "=", "clazz", ";", "}", "}", "</s>" ]
1,958
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "packagemanager", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "sql", ".", "SQLException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableItem", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ".", "AndroidManifestObject", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ".", "AndroidManifestWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "adb", ".", "AdbWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "exception", ".", "CommandFailedException", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "fs", ".", "FsDiffController", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "fs", ".", "FsNode", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "fs", ".", "FsWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "Gui", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "GuiWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ".", "CTabItemWithDatabase", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ".", "CTabItemWithHexViewer", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ".", "CTabItemWithStyledText", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ".", "runnable", ".", "FileToStyledTextRunnable", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ".", "runnable", ".", "FsListToTreeRunnable", ";", "public", "class", "PackageManagerController", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "FsDiffController", ".", "class", ")", ";", "private", "Gui", "gui", ";", "public", "static", "final", "String", "[", "]", "ALL_KEYS", "=", "{", "PackageBean", ".", "class", ".", "getName", "(", ")", "}", ";", "public", "PackageManagerController", "(", "Gui", "gui", ")", "{", "this", ".", "gui", "=", "gui", ";", "}", "public", "void", "pullPackages", "(", "String", "destinationDirectory", ")", "{", "String", "error", "=", "\"\"", ";", "for", "(", "TableItem", "tableItem", ":", "gui", ".", "getApkTable", "(", ")", ".", "getTable", "(", ")", ".", "getSelection", "(", ")", ")", "{", "PackageBean", "bean", "=", "(", "PackageBean", ")", "tableItem", ".", "getData", "(", "PackageBean", ".", "class", ".", "getName", "(", ")", ")", ";", "gui", ".", "setStatusBlocking", "(", "\"Pulling:", "\"", "+", "bean", ".", "getClazz", "(", ")", ")", ";", "try", "{", "File", "dst", "=", "new", "File", "(", "destinationDirectory", ",", "bean", ".", "getClazz", "(", ")", "+", "\".apk\"", ")", ";", "dst", "=", "AdbWorkshop", ".", "pullFileTo", "(", "bean", ".", "getApk", "(", ")", ",", "dst", ".", "getAbsolutePath", "(", ")", ")", ";", "logger", ".", "debug", "(", "\"Pulled:", "\"", "+", "dst", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "error", "=", "error", "+", "\"nt\"", "+", "bean", ".", "getClazz", "(", ")", ";", "}", "}", "if", "(", "error", ".", "equals", "(", "\"\"", ")", ")", "{", "GuiWorkshop", ".", "messageDialog", "(", "gui", ".", "getShell", "(", ")", ",", "\"\"", ")", ";", "}", "else", "{", "GuiWorkshop", ".", "messageError", "(", "gui", ".", "getShell", "(", ")", ",", "\"\"", "+", "error", ")", ";", "}", "gui", ".", "clearStatus", "(", ")", ";", "}", "public", "void", "uninstallPackages", "(", "TableItem", "[", "]", "selected", ")", "{", "String", "msg", "=", "\"\"", ";", "for", "(", "TableItem", "t", ":", "selected", ")", "{", "PackageBean", "bean", "=", "(", "PackageBean", ")", "t", ".", "getData", "(", "PackageBean", ".", "class", ".", "getName", "(", ")", ")", ";", "String", "packageClazz", "=", "bean", ".", "getClazz", "(", ")", ";", "try", "{", "AdbWorkshop", ".", "uninstallPackage", "(", "packageClazz", ")", ";", "msg", "=", "msg", "+", "\"nt\"", "+", "packageClazz", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "gui", ".", "getShell", "(", ")", ",", "\"\"", "+", "packageClazz", "+", "\",", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "\"\"", "+", "packageClazz", ",", "e", ")", ";", "}", "}", "GuiWorkshop", ".", "messageDialog", "(", "gui", ".", "getShell", "(", ")", ",", "msg", ")", ";", "}", "public", "void", "loadFileContentsToTab", "(", "FsNode", "node", ")", "throws", "IOException", ",", "InterruptedException", ",", "CommandFailedException", ",", "ClassNotFoundException", ",", "SQLException", "{", "logger", ".", "debug", "(", "\"\"", "+", "node", ".", "getFullPath", "(", ")", ")", ";", "if", "(", "!", "node", ".", "isDirectory", "(", ")", ")", "{", "gui", ".", "setStatus", "(", "\"\"", "+", "node", ".", "getName", "(", ")", ")", ";", "File", "f", "=", "AdbWorkshop", ".", "pullFile", "(", "node", ".", "getFullPath", "(", ")", ")", ";", "if", "(", "node", ".", "getName", "(", ")", ".", "endsWith", "(", "\".db\"", ")", ")", "{", "CTabItemWithDatabase", "item", "=", "new", "CTabItemWithDatabase", "(", "gui", ".", "getPackageManagerFilesTabs", "(", ")", ",", "node", ".", "getName", "(", ")", ",", "f", ",", "SWT", ".", "CLOSE", ")", ";", "}", "else", "if", "(", "node", ".", "getName", "(", ")", ".", "endsWith", "(", "\".xml\"", ")", "||", "node", ".", "getName", "(", ")", ".", "endsWith", "(", "\".txt\"", ")", ")", "{", "CTabItemWithStyledText", "a", "=", "new", "CTabItemWithStyledText", "(", "gui", ".", "getPackageManagerFilesTabs", "(", ")", ",", "node", ".", "getName", "(", ")", ",", "SWT", ".", "CLOSE", ")", ";", "gui", ".", "runRunnableAsync", "(", "new", "FileToStyledTextRunnable", "(", "f", ",", "a", ".", "getStyledText", "(", ")", ")", ")", ";", "}", "else", "{", "CTabItemWithHexViewer", "hexTab", "=", "new", "CTabItemWithHexViewer", "(", "gui", ".", "getPackageManagerFilesTabs", "(", ")", ",", "node", ".", "getName", "(", ")", ",", "f", ",", "SWT", ".", "CLOSE", ")", ";", "}", "gui", ".", "clearStatus", "(", ")", ";", "}", "}", "public", "void", "loadFileContentsToSQLiteTab", "(", "FsNode", "node", ")", "throws", "ClassNotFoundException", ",", "SQLException", ",", "IOException", ",", "InterruptedException", ",", "CommandFailedException", "{", "gui", ".", "setStatus", "(", "\"\"", "+", "node", ".", "getName", "(", ")", ")", ";", "File", "f", "=", "AdbWorkshop", ".", "pullFile", "(", "node", ".", "getFullPath", "(", ")", ")", ";", "CTabItemWithDatabase", "item", "=", "new", "CTabItemWithDatabase", "(", "gui", ".", "getPackageManagerFilesTabs", "(", ")", ",", "node", ".", "getName", "(", ")", ",", "f", ",", "SWT", ".", "CLOSE", ")", ";", "gui", ".", "clearStatus", "(", ")", ";", "}", "public", "void", "loadFileContentsToTextTab", "(", "FsNode", "node", ")", "throws", "IOException", ",", "InterruptedException", ",", "CommandFailedException", "{", "gui", ".", "setStatus", "(", "\"\"", "+", "node", ".", "getName", "(", ")", ")", ";", "File", "f", "=", "AdbWorkshop", ".", "pullFile", "(", "node", ".", "getFullPath", "(", ")", ")", ";", "CTabItemWithStyledText", "a", "=", "new", "CTabItemWithStyledText", "(", "gui", ".", "getPackageManagerFilesTabs", "(", ")", ",", "node", ".", "getName", "(", ")", ",", "SWT", ".", "CLOSE", ")", ";", "gui", ".", "runRunnableAsync", "(", "new", "FileToStyledTextRunnable", "(", "f", ",", "a", ".", "getStyledText", "(", ")", ")", ")", ";", "gui", ".", "clearStatus", "(", ")", ";", "}", "public", "void", "loadFileContentsToHexTab", "(", "FsNode", "node", ")", "throws", "IOException", ",", "InterruptedException", ",", "CommandFailedException", "{", "gui", ".", "setStatus", "(", "\"\"", "+", "node", ".", "getName", "(", ")", ")", ";", "File", "f", "=", "AdbWorkshop", ".", "pullFile", "(", "node", ".", "getFullPath", "(", ")", ")", ";", "CTabItemWithHexViewer", "hexTab", "=", "new", "CTabItemWithHexViewer", "(", "gui", ".", "getPackageManagerFilesTabs", "(", ")", ",", "node", ".", "getName", "(", ")", ",", "f", ",", "SWT", ".", "CLOSE", ")", ";", "gui", ".", "clearStatus", "(", ")", ";", "}", "public", "void", "loadPackageDetails", "(", "TableItem", "[", "]", "selection", ")", "{", "if", "(", "selection", ".", "length", ">", "1", ")", "{", "return", ";", "}", "TableItem", "item", "=", "selection", "[", "0", "]", ";", "final", "PackageBean", "bean", "=", "(", "PackageBean", ")", "item", ".", "getData", "(", "PackageBean", ".", "class", ".", "getName", "(", ")", ")", ";", "logger", ".", "info", "(", "\"\"", "+", "bean", ".", "getApk", "(", ")", ")", ";", "gui", ".", "setStatus", "(", "\"\"", "+", "bean", ".", "getApk", "(", ")", ")", ";", "Thread", "details", "=", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "File", "apk", "=", "null", ";", "try", "{", "apk", "=", "AdbWorkshop", ".", "pullFile", "(", "bean", ".", "getApk", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageErrorThreaded", "(", "gui", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "if", "(", "apk", "!=", "null", ")", "{", "try", "{", "final", "AndroidManifestObject", "root", "=", "AndroidManifestWorkshop", ".", "getAndroidManifestObjectsForApk", "(", "apk", ")", ";", "gui", ".", "runRunnableAsync", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "gui", ".", "getPackageManagerAndroidManifestTab", "(", ")", ".", "loadAndroidManifestObjects", "(", "root", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageErrorThreaded", "(", "gui", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "List", "<", "String", ">", "details", "=", "null", ";", "try", "{", "details", "=", "PackageManagerWorkshop", ".", "getDetailedPackageInfo", "(", "apk", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageErrorThreaded", "(", "gui", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "final", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "details", "!=", "null", ")", "{", "for", "(", "String", "det", ":", "details", ")", "{", "sb", ".", "append", "(", "det", ")", ".", "append", "(", "\"n\"", ")", ";", "}", "}", "gui", ".", "runRunnableAsync", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "gui", ".", "getPackageManagerStyledText", "(", ")", ".", "setText", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "}", ")", ";", "}", "List", "<", "FsNode", ">", "files", "=", "null", ";", "try", "{", "files", "=", "FsWorkshop", ".", "getDirectoryRecursive", "(", "\"/data/data/\"", "+", "bean", ".", "getClazz", "(", ")", "+", "\"/\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageErrorThreaded", "(", "gui", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "if", "(", "files", "!=", "null", ")", "{", "gui", ".", "runRunnableAsync", "(", "new", "FsListToTreeRunnable", "(", "files", ",", "gui", ".", "getPackageManagerFilesTree", "(", ")", ")", ")", ";", "}", "gui", ".", "clearStatus", "(", ")", ";", "}", "}", ")", ";", "details", ".", "start", "(", ")", ";", "}", "}", "</s>" ]
1,959
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ";", "import", "java", ".", "util", ".", "LinkedList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "public", "abstract", "class", "AndroidManifestObject", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "AndroidManifestObject", ".", "class", ")", ";", "private", "String", "name", ";", "private", "AndroidManifestObject", "parent", ";", "private", "List", "<", "AndroidManifestObject", ">", "children", ";", "public", "AndroidManifestObject", "(", ")", "{", "name", "=", "\"\"", ";", "children", "=", "new", "LinkedList", "<", "AndroidManifestObject", ">", "(", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "AndroidManifestObject", "getParent", "(", ")", "{", "return", "parent", ";", "}", "public", "void", "setParent", "(", "AndroidManifestObject", "parent", ")", "{", "this", ".", "parent", "=", "parent", ";", "}", "public", "List", "<", "AndroidManifestObject", ">", "getChildren", "(", ")", "{", "return", "children", ";", "}", "public", "void", "setChildren", "(", "List", "<", "AndroidManifestObject", ">", "children", ")", "{", "this", ".", "children", "=", "children", ";", "}", "public", "void", "addChild", "(", "AndroidManifestObject", "child", ")", "{", "this", ".", "children", ".", "add", "(", "child", ")", ";", "}", "}", "</s>" ]
1,960
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ";", "public", "class", "AndroidManifestAttribute", "extends", "AndroidManifestObjectWithValue", "{", "private", "String", "raw", ";", "private", "String", "type", ";", "public", "AndroidManifestAttribute", "(", ")", "{", "super", "(", ")", ";", "raw", "=", "\"\"", ";", "type", "=", "\"\"", ";", "}", "public", "static", "AndroidManifestAttribute", "parse", "(", "String", "line", ")", "{", "AndroidManifestAttribute", "ret", "=", "new", "AndroidManifestAttribute", "(", ")", ";", "line", "=", "line", ".", "trim", "(", ")", ".", "substring", "(", "3", ")", ";", "String", "[", "]", "splitLine", "=", "line", ".", "split", "(", "\"=\"", ")", ";", "if", "(", "splitLine", "[", "0", "]", ".", "indexOf", "(", "\"(\"", ")", "!=", "-", "1", ")", "{", "ret", ".", "setName", "(", "splitLine", "[", "0", "]", ".", "substring", "(", "0", ",", "splitLine", "[", "0", "]", ".", "indexOf", "(", "\"(\"", ")", ")", ")", ";", "}", "else", "{", "ret", ".", "setName", "(", "splitLine", "[", "0", "]", ")", ";", "}", "if", "(", "splitLine", "[", "1", "]", ".", "startsWith", "(", "\"(\"", ")", ")", "{", "ret", ".", "setType", "(", "splitLine", "[", "1", "]", ".", "substring", "(", "splitLine", "[", "1", "]", ".", "indexOf", "(", "\"", "\"", ")", "+", "1", ",", "splitLine", "[", "1", "]", ".", "indexOf", "(", "\")\"", ")", ")", ")", ";", "ret", ".", "setValue", "(", "splitLine", "[", "1", "]", ".", "substring", "(", "splitLine", "[", "1", "]", ".", "indexOf", "(", "\")\"", ")", "+", "1", ")", ")", ";", "}", "else", "if", "(", "splitLine", "[", "1", "]", ".", "startsWith", "(", "\"\\\"\"", ")", ")", "{", "String", "[", "]", "valueSplit", "=", "splitLine", "[", "1", "]", ".", "split", "(", "\"", "\\\\(\"", ")", ";", "ret", ".", "setValue", "(", "valueSplit", "[", "0", "]", ".", "trim", "(", ")", ".", "replaceAll", "(", "\"\\\"\"", ",", "\"\"", ")", ")", ";", "ret", ".", "setRaw", "(", "valueSplit", "[", "1", "]", ".", "substring", "(", "6", ",", "valueSplit", "[", "1", "]", ".", "length", "(", ")", "-", "2", ")", ")", ";", "}", "else", "{", "ret", ".", "setValue", "(", "splitLine", "[", "1", "]", ")", ";", "}", "return", "(", "ret", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"],", "value[\"", "+", "this", ".", "getValue", "(", ")", "+", "\"],", "raw[\"", "+", "this", ".", "getRaw", "(", ")", "+", "\"],", "type[\"", "+", "this", ".", "getType", "(", ")", "+", "\"]\"", ")", ";", "}", "public", "String", "getRaw", "(", ")", "{", "return", "raw", ";", "}", "public", "void", "setRaw", "(", "String", "raw", ")", "{", "this", ".", "raw", "=", "raw", ";", "}", "public", "String", "getType", "(", ")", "{", "return", "type", ";", "}", "public", "void", "setType", "(", "String", "type", ")", "{", "this", ".", "type", "=", "type", ";", "}", "}", "</s>" ]
1,961
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ";", "public", "class", "AndroidManifestElement", "extends", "AndroidManifestObject", "{", "private", "int", "line", "=", "-", "1", ";", "public", "int", "getLine", "(", ")", "{", "return", "line", ";", "}", "public", "void", "setLine", "(", "int", "line", ")", "{", "this", ".", "line", "=", "line", ";", "}", "public", "static", "AndroidManifestElement", "parse", "(", "String", "line", ")", "{", "AndroidManifestElement", "ret", "=", "new", "AndroidManifestElement", "(", ")", ";", "line", "=", "line", ".", "trim", "(", ")", ".", "substring", "(", "3", ")", ";", "ret", ".", "setName", "(", "line", ".", "split", "(", "\"", "\"", ")", "[", "0", "]", ")", ";", "String", "lineNumber", "=", "line", ".", "substring", "(", "line", ".", "lastIndexOf", "(", "'='", ")", "+", "1", ",", "line", ".", "length", "(", ")", "-", "1", ")", ";", "ret", ".", "setLine", "(", "Integer", ".", "parseInt", "(", "lineNumber", ")", ")", ";", "return", "(", "ret", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"],", "line[\"", "+", "this", ".", "getLine", "(", ")", "+", "\"]\"", ")", ";", "}", "}", "</s>" ]
1,962
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ";", "public", "class", "AndroidManifestObjectWithValue", "extends", "AndroidManifestObject", "{", "private", "String", "value", ";", "public", "AndroidManifestObjectWithValue", "(", ")", "{", "super", "(", ")", ";", "value", "=", "\"\"", ";", "}", "public", "String", "getValue", "(", ")", "{", "return", "value", ";", "}", "public", "void", "setValue", "(", "String", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "}", "</s>" ]
1,963
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "OterStatics", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "command", ".", "TerminatingCommand", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "exception", ".", "CommandFailedException", ";", "public", "class", "AndroidManifestWorkshop", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "AndroidManifestWorkshop", ".", "class", ")", ";", "public", "static", "void", "printTree", "(", "AndroidManifestObject", "o", ")", "{", "printRecur", "(", "o", ",", "\"\"", ")", ";", "}", "private", "static", "void", "printRecur", "(", "AndroidManifestObject", "o", ",", "String", "prefix", ")", "{", "logger", ".", "debug", "(", "prefix", "+", "o", ")", ";", "if", "(", "o", ".", "getChildren", "(", ")", ".", "size", "(", ")", ">", "0", ")", "{", "for", "(", "AndroidManifestObject", "child", ":", "o", ".", "getChildren", "(", ")", ")", "{", "printRecur", "(", "child", ",", "prefix", "+", "\"", "\"", ")", ";", "}", "}", "}", "public", "static", "AndroidManifestObject", "getAndroidManifestObjectsForApk", "(", "File", "apkFile", ")", "throws", "CommandFailedException", ",", "InterruptedException", ",", "IOException", "{", "AndroidManifestObject", "root", "=", "null", ";", "TerminatingCommand", "cmd", "=", "new", "TerminatingCommand", "(", "new", "String", "[", "]", "{", "OterStatics", ".", "getAaptCommand", "(", ")", ",", "\"d\"", ",", "\"xmltree\"", ",", "apkFile", ".", "getAbsolutePath", "(", ")", ",", "\"\"", "}", ")", ";", "int", "r", "=", "cmd", ".", "executeNoErrorMonitor", "(", ")", ";", "logger", ".", "debug", "(", "\"\"", "+", "r", ")", ";", "AndroidManifestObject", "lastObject", "=", "null", ";", "int", "lastDepth", "=", "0", ";", "int", "currentDepth", "=", "0", ";", "for", "(", "String", "line", ":", "cmd", ".", "getOutput", "(", ")", ")", "{", "logger", ".", "debug", "(", "line", ")", ";", "while", "(", "line", ".", "charAt", "(", "currentDepth", ")", "==", "'", "'", ")", "{", "currentDepth", "++", ";", "}", "currentDepth", "=", "currentDepth", "/", "2", ";", "String", "trimLine", "=", "line", ".", "trim", "(", ")", ";", "AndroidManifestObject", "o", "=", "null", ";", "if", "(", "trimLine", ".", "startsWith", "(", "\"E:\"", ")", ")", "{", "o", "=", "AndroidManifestElement", ".", "parse", "(", "trimLine", ")", ";", "}", "else", "if", "(", "trimLine", ".", "startsWith", "(", "\"A:\"", ")", ")", "{", "o", "=", "AndroidManifestAttribute", ".", "parse", "(", "trimLine", ")", ";", "}", "else", "if", "(", "trimLine", ".", "startsWith", "(", "\"N:\"", ")", ")", "{", "o", "=", "AndroidManifestNamespace", ".", "parse", "(", "trimLine", ")", ";", "}", "logger", ".", "debug", "(", "o", ".", "toString", "(", ")", ")", ";", "if", "(", "currentDepth", "==", "0", ")", "{", "root", "=", "o", ";", "}", "else", "if", "(", "currentDepth", ">", "lastDepth", ")", "{", "o", ".", "setParent", "(", "lastObject", ")", ";", "lastObject", ".", "addChild", "(", "o", ")", ";", "}", "else", "if", "(", "currentDepth", "<", "lastDepth", ")", "{", "int", "diff", "=", "lastDepth", "-", "currentDepth", ";", "AndroidManifestObject", "peer", "=", "lastObject", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "diff", ";", "i", "++", ")", "{", "peer", "=", "peer", ".", "getParent", "(", ")", ";", "}", "peer", ".", "getParent", "(", ")", ".", "addChild", "(", "o", ")", ";", "o", ".", "setParent", "(", "peer", ".", "getParent", "(", ")", ")", ";", "}", "else", "if", "(", "currentDepth", "==", "lastDepth", ")", "{", "o", ".", "setParent", "(", "lastObject", ".", "getParent", "(", ")", ")", ";", "lastObject", ".", "getParent", "(", ")", ".", "addChild", "(", "o", ")", ";", "}", "lastObject", "=", "o", ";", "lastDepth", "=", "currentDepth", ";", "}", "return", "(", "root", ")", ";", "}", "}", "</s>" ]
1,964
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ";", "public", "class", "AndroidManifestNamespace", "extends", "AndroidManifestObjectWithValue", "{", "public", "static", "AndroidManifestNamespace", "parse", "(", "String", "line", ")", "{", "AndroidManifestNamespace", "ret", "=", "new", "AndroidManifestNamespace", "(", ")", ";", "line", "=", "line", ".", "trim", "(", ")", ".", "substring", "(", "3", ")", ";", "String", "[", "]", "keyValue", "=", "line", ".", "split", "(", "\"=\"", ")", ";", "ret", ".", "setName", "(", "keyValue", "[", "0", "]", ")", ";", "ret", ".", "setValue", "(", "keyValue", "[", "1", "]", ")", ";", "return", "(", "ret", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"],", "value[\"", "+", "this", ".", "getValue", "(", ")", "+", "\"]\"", ")", ";", "}", "}", "</s>" ]
1,965
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "public", "class", "CommandExecutionException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "CommandExecutionException", "(", "String", "message", ")", "{", "super", "(", "message", ")", ";", "}", "}", "</s>" ]
1,966
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "public", "class", "NotRootedException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "NotRootedException", "(", ")", "{", "super", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
1,967
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "public", "class", "UnknownClassnameException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "UnknownClassnameException", "(", ")", "{", "super", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
1,968
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "public", "class", "JarSigningException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "JarSigningException", "(", "String", "message", ")", "{", "super", "(", "message", ")", ";", "}", "}", "</s>" ]
1,969
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "public", "class", "GenericException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "GenericException", "(", "String", "reason", ")", "{", "super", "(", "reason", ")", ";", "}", "}", "</s>" ]
1,970
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "CommandFailedException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "private", "List", "<", "String", ">", "output", ";", "public", "CommandFailedException", "(", "String", "command", ",", "List", "<", "String", ">", "output", ",", "String", "retCode", ")", "{", "super", "(", "formatError", "(", "command", ",", "output", ",", "retCode", ")", ")", ";", "}", "public", "CommandFailedException", "(", "String", "command", ",", "String", "output", ",", "String", "retCode", ")", "{", "super", "(", "formatError", "(", "command", ",", "output", ",", "retCode", ")", ")", ";", "}", "public", "CommandFailedException", "(", "String", "[", "]", "command", ",", "List", "<", "String", ">", "output", ",", "int", "returnCode", ")", "{", "super", "(", "formatError", "(", "command", ",", "output", ",", "Integer", ".", "toString", "(", "returnCode", ")", ")", ")", ";", "}", "public", "CommandFailedException", "(", "String", "[", "]", "command", ",", "List", "<", "String", ">", "output", ",", "String", "returnCode", ")", "{", "super", "(", "formatError", "(", "command", ",", "output", ",", "returnCode", ")", ")", ";", "}", "private", "static", "String", "formatError", "(", "String", "[", "]", "command", ",", "List", "<", "String", ">", "output", ",", "String", "retCode", ")", "{", "String", "c", "=", "\"\"", ";", "for", "(", "String", "arg", ":", "command", ")", "{", "c", "=", "c", "+", "arg", "+", "\"", "\"", ";", "}", "return", "(", "formatError", "(", "c", ",", "output", ",", "retCode", ")", ")", ";", "}", "private", "static", "String", "formatError", "(", "String", "command", ",", "List", "<", "String", ">", "output", ",", "String", "retCode", ")", "{", "String", "ret", "=", "\"'\"", "+", "command", "+", "\"\"", "+", "retCode", "+", "\"\"", ";", "for", "(", "String", "o", ":", "output", ")", "{", "ret", "=", "ret", "+", "\"nt\"", "+", "o", ";", "}", "return", "(", "ret", ")", ";", "}", "private", "static", "String", "formatError", "(", "String", "command", ",", "String", "output", ",", "String", "retCode", ")", "{", "String", "ret", "=", "\"'\"", "+", "command", "+", "\"\"", "+", "retCode", "+", "\"\"", "+", "output", ";", "return", "(", "ret", ")", ";", "}", "}", "</s>" ]
1,971
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "public", "class", "UninstallException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "UninstallException", "(", "String", "s", ")", "{", "super", "(", "s", ")", ";", "}", "}", "</s>" ]
1,972
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "public", "class", "AatException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "AatException", "(", "String", "message", ")", "{", "super", "(", "message", ")", ";", "}", "}", "</s>" ]
1,973
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "public", "class", "ParseException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "ParseException", "(", "String", "raw", ")", "{", "super", "(", "\"\"", "+", "raw", "+", "\"'\"", ")", ";", "}", "}", "</s>" ]
1,974
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "public", "class", "BuildApkException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "BuildApkException", "(", "String", "message", ")", "{", "super", "(", "message", ")", ";", "}", "}", "</s>" ]
1,975
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "import", "java", ".", "io", ".", "File", ";", "public", "class", "SmaliDexException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "SmaliDexException", "(", "File", "f", ",", "int", "errors", ")", "{", "super", "(", "\"\"", "+", "f", ".", "getName", "(", ")", "+", "\"\"", "+", "errors", ")", ";", "}", "}", "</s>" ]
1,976
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "exception", ";", "import", "java", ".", "io", ".", "File", ";", "public", "class", "SmaliSyntaxException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "SmaliSyntaxException", "(", "File", "f", ",", "int", "errors", ")", "{", "super", "(", "\"\"", "+", "f", ".", "getName", "(", ")", "+", "\"", "Errors:", "\"", "+", "errors", ")", ";", "}", "}", "</s>" ]
1,977
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Button", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Combo", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Dialog", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Display", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Label", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Shell", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Text", ";", "import", "com", ".", "android", ".", "prefs", ".", "AndroidLocation", ".", "AndroidLocationException", ";", "import", "com", ".", "android", ".", "sdklib", ".", "IAndroidTarget", ";", "import", "com", ".", "android", ".", "sdklib", ".", "ISdkLog", ";", "import", "com", ".", "android", ".", "sdklib", ".", "SdkManager", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "OterStatics", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "avd", ".", "AvdWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "bean", ".", "CreateAvdBean", ";", "public", "class", "CreateAvdDialog", "extends", "Dialog", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "CreateAvdDialog", ".", "class", ")", ";", "protected", "CreateAvdBean", "result", ";", "protected", "Shell", "shell", ";", "private", "Text", "text", ";", "private", "Button", "btnPersistantStorage", ";", "private", "Button", "btnLaunchAvdAfter", ";", "private", "Combo", "combo", ";", "private", "Composite", "composite", ";", "public", "CreateAvdDialog", "(", "Shell", "parent", ")", "{", "this", "(", "parent", ",", "SWT", ".", "DIALOG_TRIM", "|", "SWT", ".", "APPLICATION_MODAL", ")", ";", "}", "public", "CreateAvdDialog", "(", "Shell", "parent", ",", "int", "style", ")", "{", "super", "(", "parent", ",", "style", ")", ";", "setText", "(", "\"\"", ")", ";", "}", "public", "CreateAvdBean", "open", "(", ")", "{", "createContents", "(", ")", ";", "shell", ".", "open", "(", ")", ";", "shell", ".", "layout", "(", ")", ";", "Display", "display", "=", "getParent", "(", ")", ".", "getDisplay", "(", ")", ";", "while", "(", "!", "shell", ".", "isDisposed", "(", ")", ")", "{", "if", "(", "!", "display", ".", "readAndDispatch", "(", ")", ")", "{", "display", ".", "sleep", "(", ")", ";", "}", "}", "return", "result", ";", "}", "private", "void", "createContents", "(", ")", "{", "shell", "=", "new", "Shell", "(", "getParent", "(", ")", ",", "getStyle", "(", ")", ")", ";", "shell", ".", "setSize", "(", "335", ",", "236", ")", ";", "shell", ".", "setText", "(", "getText", "(", ")", ")", ";", "GridLayout", "gl_shell", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_shell", ".", "marginRight", "=", "5", ";", "gl_shell", ".", "marginLeft", "=", "5", ";", "gl_shell", ".", "marginTop", "=", "5", ";", "gl_shell", ".", "verticalSpacing", "=", "0", ";", "gl_shell", ".", "marginWidth", "=", "0", ";", "gl_shell", ".", "horizontalSpacing", "=", "0", ";", "gl_shell", ".", "marginHeight", "=", "0", ";", "shell", ".", "setLayout", "(", "gl_shell", ")", ";", "Label", "lblName", "=", "new", "Label", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "lblName", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblName", ".", "setText", "(", "\"Name:\"", ")", ";", "text", "=", "new", "Text", "(", "shell", ",", "SWT", ".", "BORDER", ")", ";", "text", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "2", ",", "1", ")", ")", ";", "new", "Label", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "Label", "lblTarget", "=", "new", "Label", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "lblTarget", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblTarget", ".", "setText", "(", "\"Target:\"", ")", ";", "combo", "=", "new", "Combo", "(", "shell", ",", "SWT", ".", "READ_ONLY", ")", ";", "combo", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "2", ",", "1", ")", ")", ";", "addTargets", "(", "combo", ")", ";", "new", "Label", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "btnPersistantStorage", "=", "new", "Button", "(", "shell", ",", "SWT", ".", "CHECK", ")", ";", "btnPersistantStorage", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "2", ",", "1", ")", ")", ";", "btnPersistantStorage", ".", "setText", "(", "\"\"", ")", ";", "btnLaunchAvdAfter", "=", "new", "Button", "(", "shell", ",", "SWT", ".", "CHECK", ")", ";", "btnLaunchAvdAfter", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "2", ",", "1", ")", ")", ";", "btnLaunchAvdAfter", ".", "setText", "(", "\"\"", ")", ";", "new", "Label", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "composite", "=", "new", "Composite", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite", "=", "new", "GridLayout", "(", "2", ",", "false", ")", ";", "gl_composite", ".", "marginWidth", "=", "0", ";", "gl_composite", ".", "marginHeight", "=", "0", ";", "gl_composite", ".", "horizontalSpacing", "=", "0", ";", "gl_composite", ".", "verticalSpacing", "=", "0", ";", "composite", ".", "setLayout", "(", "gl_composite", ")", ";", "composite", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "RIGHT", ",", "SWT", ".", "BOTTOM", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "Button", "btnCreateAvd", "=", "new", "Button", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "btnCreateAvd", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "true", ",", "1", ",", "1", ")", ")", ";", "btnCreateAvd", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "boolean", "exists", "=", "false", ";", "try", "{", "exists", "=", "AvdWorkshop", ".", "isAvdExist", "(", "text", ".", "getText", "(", ")", ")", ";", "}", "catch", "(", "AndroidLocationException", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "if", "(", "text", ".", "getText", "(", ")", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", "||", "combo", ".", "getText", "(", ")", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shell", ",", "\"\"", ")", ";", "}", "else", "if", "(", "exists", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shell", ",", "\"\"", ")", ";", "}", "else", "{", "result", "=", "new", "CreateAvdBean", "(", ")", ";", "result", ".", "setName", "(", "text", ".", "getText", "(", ")", ")", ";", "result", ".", "setPersistant", "(", "btnPersistantStorage", ".", "getSelection", "(", ")", ")", ";", ";", "result", ".", "setTarget", "(", "combo", ".", "getText", "(", ")", ")", ";", "result", ".", "setLaunch", "(", "btnLaunchAvdAfter", ".", "getSelection", "(", ")", ")", ";", "shell", ".", "close", "(", ")", ";", "}", "}", "}", ")", ";", "btnCreateAvd", ".", "setText", "(", "\"Create", "AVD\"", ")", ";", "Button", "btnCancel", "=", "new", "Button", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "btnCancel", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "CENTER", ",", "false", ",", "true", ",", "1", ",", "1", ")", ")", ";", "btnCancel", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "shell", ".", "close", "(", ")", ";", "}", "}", ")", ";", "btnCancel", ".", "setText", "(", "\"Cancel\"", ")", ";", "}", "private", "void", "addTargets", "(", "Combo", "combo", ")", "{", "ISdkLog", "sdkLogger", "=", "new", "ISdkLog", "(", ")", "{", "public", "void", "error", "(", "Throwable", "t", ",", "String", "errorFormat", ",", "Object", "[", "]", "args", ")", "{", "logger", ".", "error", "(", "\"Error:", "\"", ",", "t", ")", ";", "}", "public", "void", "warning", "(", "String", "warningFormat", ",", "Object", "[", "]", "args", ")", "{", "logger", ".", "warn", "(", "args", ")", ";", "}", "public", "void", "printf", "(", "String", "msgFormat", ",", "Object", "[", "]", "args", ")", "{", "logger", ".", "debug", "(", "args", ")", ";", "}", "}", ";", "SdkManager", "sdkManager", "=", "SdkManager", ".", "createManager", "(", "OterStatics", ".", "getAndroidHome", "(", ")", ",", "sdkLogger", ")", ";", "IAndroidTarget", "[", "]", "targets", "=", "sdkManager", ".", "getTargets", "(", ")", ";", "for", "(", "IAndroidTarget", "target", ":", "targets", ")", "{", "combo", ".", "add", "(", "target", ".", "hashString", "(", ")", ")", ";", "}", "}", "}", "</s>" ]
1,978
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "bean", ";", "public", "class", "BuildAndSignApkBean", "{", "private", "String", "apkFilename", ";", "private", "String", "certFilename", ";", "private", "String", "password", ";", "private", "String", "certAlias", ";", "private", "boolean", "sign", ";", "public", "String", "getApkFilename", "(", ")", "{", "return", "apkFilename", ";", "}", "public", "void", "setApkFilename", "(", "String", "apkFilename", ")", "{", "this", ".", "apkFilename", "=", "apkFilename", ";", "}", "public", "String", "getCertFilename", "(", ")", "{", "return", "certFilename", ";", "}", "public", "void", "setCertFilename", "(", "String", "certFilename", ")", "{", "this", ".", "certFilename", "=", "certFilename", ";", "}", "public", "String", "getPassword", "(", ")", "{", "return", "password", ";", "}", "public", "void", "setPassword", "(", "String", "password", ")", "{", "this", ".", "password", "=", "password", ";", "}", "public", "String", "getCertAlias", "(", ")", "{", "return", "certAlias", ";", "}", "public", "void", "setCertAlias", "(", "String", "certAlias", ")", "{", "this", ".", "certAlias", "=", "certAlias", ";", "}", "public", "boolean", "isSign", "(", ")", "{", "return", "sign", ";", "}", "public", "void", "setSign", "(", "boolean", "sign", ")", "{", "this", ".", "sign", "=", "sign", ";", "}", "}", "</s>" ]
1,979
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "bean", ";", "public", "class", "CreateAvdBean", "{", "private", "String", "name", ";", "private", "String", "target", ";", "private", "boolean", "persistant", ";", "private", "boolean", "launch", ";", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "String", "getTarget", "(", ")", "{", "return", "target", ";", "}", "public", "void", "setTarget", "(", "String", "target", ")", "{", "this", ".", "target", "=", "target", ";", "}", "public", "boolean", "isPersistant", "(", ")", "{", "return", "persistant", ";", "}", "public", "void", "setPersistant", "(", "boolean", "persistant", ")", "{", "this", ".", "persistant", "=", "persistant", ";", "}", "public", "boolean", "isLaunch", "(", ")", "{", "return", "launch", ";", "}", "public", "void", "setLaunch", "(", "boolean", "launch", ")", "{", "this", ".", "launch", "=", "launch", ";", "}", "}", "</s>" ]
1,980
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ";", "import", "java", ".", "awt", ".", "Toolkit", ";", "import", "java", ".", "awt", ".", "datatransfer", ".", "Clipboard", ";", "import", "java", ".", "awt", ".", "datatransfer", ".", "ClipboardOwner", ";", "import", "java", ".", "awt", ".", "datatransfer", ".", "StringSelection", ";", "import", "java", ".", "awt", ".", "datatransfer", ".", "Transferable", ";", "import", "java", ".", "text", ".", "Collator", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Locale", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "DirectoryDialog", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Event", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "FileDialog", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Listener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "MessageBox", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Shell", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Table", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableColumn", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableItem", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "bean", ".", "BuildAndSignApkBean", ";", "public", "class", "GuiWorkshop", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "GuiWorkshop", ".", "class", ")", ";", "public", "static", "BuildAndSignApkBean", "selectCertificate", "(", "Shell", "shell", ")", "{", "BuildAndSignApkDialog", "dialog", "=", "new", "BuildAndSignApkDialog", "(", "shell", ")", ";", "return", "(", "dialog", ".", "open", "(", ")", ")", ";", "}", "public", "static", "void", "addColumnSorter", "(", "final", "Table", "table", ",", "TableColumn", "column", ",", "final", "int", "index", ",", "final", "String", "[", "]", "dataKeys", ")", "{", "Listener", "sortListener", "=", "new", "Listener", "(", ")", "{", "public", "void", "handleEvent", "(", "Event", "e", ")", "{", "TableItem", "[", "]", "items", "=", "table", ".", "getItems", "(", ")", ";", "Collator", "collator", "=", "Collator", ".", "getInstance", "(", "Locale", ".", "getDefault", "(", ")", ")", ";", "TableColumn", "column", "=", "(", "TableColumn", ")", "e", ".", "widget", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "items", ".", "length", ";", "i", "++", ")", "{", "String", "value1", "=", "items", "[", "i", "]", ".", "getText", "(", "index", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "{", "String", "value2", "=", "items", "[", "j", "]", ".", "getText", "(", "index", ")", ";", "if", "(", "table", ".", "getSortDirection", "(", ")", "==", "SWT", ".", "UP", "||", "table", ".", "getSortDirection", "(", ")", "==", "SWT", ".", "NONE", "&&", "collator", ".", "compare", "(", "value1", ",", "value2", ")", "<", "0", ")", "{", "String", "[", "]", "values", "=", "new", "String", "[", "table", ".", "getColumnCount", "(", ")", "]", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "table", ".", "getColumnCount", "(", ")", ";", "k", "++", ")", "{", "values", "[", "k", "]", "=", "items", "[", "i", "]", ".", "getText", "(", "k", ")", ";", "}", "Map", "<", "String", ",", "Object", ">", "dataMap", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "for", "(", "String", "key", ":", "dataKeys", ")", "{", "dataMap", ".", "put", "(", "key", ",", "items", "[", "i", "]", ".", "getData", "(", "key", ")", ")", ";", "}", "items", "[", "i", "]", ".", "dispose", "(", ")", ";", "TableItem", "item", "=", "new", "TableItem", "(", "table", ",", "SWT", ".", "NONE", ",", "j", ")", ";", "item", ".", "setText", "(", "values", ")", ";", "for", "(", "String", "key", ":", "dataMap", ".", "keySet", "(", ")", ")", "{", "item", ".", "setData", "(", "key", ",", "dataMap", ".", "get", "(", "key", ")", ")", ";", "}", "items", "=", "table", ".", "getItems", "(", ")", ";", "break", ";", "}", "else", "if", "(", "table", ".", "getSortDirection", "(", ")", "==", "SWT", ".", "DOWN", "&&", "collator", ".", "compare", "(", "value1", ",", "value2", ")", ">", "0", ")", "{", "String", "[", "]", "values", "=", "new", "String", "[", "table", ".", "getColumnCount", "(", ")", "]", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "table", ".", "getColumnCount", "(", ")", ";", "k", "++", ")", "{", "values", "[", "k", "]", "=", "items", "[", "i", "]", ".", "getText", "(", "k", ")", ";", "}", "Map", "<", "String", ",", "Object", ">", "dataMap", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "for", "(", "String", "key", ":", "dataKeys", ")", "{", "dataMap", ".", "put", "(", "key", ",", "items", "[", "i", "]", ".", "getData", "(", "key", ")", ")", ";", "}", "items", "[", "i", "]", ".", "dispose", "(", ")", ";", "TableItem", "item", "=", "new", "TableItem", "(", "table", ",", "SWT", ".", "NONE", ",", "j", ")", ";", "item", ".", "setText", "(", "values", ")", ";", "for", "(", "String", "key", ":", "dataMap", ".", "keySet", "(", ")", ")", "{", "item", ".", "setData", "(", "key", ",", "dataMap", ".", "get", "(", "key", ")", ")", ";", "}", "items", "=", "table", ".", "getItems", "(", ")", ";", "break", ";", "}", "}", "}", "if", "(", "table", ".", "getSortDirection", "(", ")", "==", "SWT", ".", "NONE", "||", "table", ".", "getSortDirection", "(", ")", "==", "SWT", ".", "UP", ")", "{", "table", ".", "setSortDirection", "(", "SWT", ".", "DOWN", ")", ";", "}", "else", "{", "table", ".", "setSortDirection", "(", "SWT", ".", "UP", ")", ";", "}", "table", ".", "setSortColumn", "(", "column", ")", ";", "}", "}", ";", "column", ".", "addListener", "(", "SWT", ".", "Selection", ",", "sortListener", ")", ";", "}", "public", "static", "String", "selectDirectory", "(", "Shell", "shell", ")", "{", "DirectoryDialog", "directoryDialog", "=", "new", "DirectoryDialog", "(", "shell", ")", ";", "directoryDialog", ".", "setMessage", "(", "\"\"", ")", ";", "String", "dir", "=", "directoryDialog", ".", "open", "(", ")", ";", "return", "(", "dir", ")", ";", "}", "public", "static", "String", "selectFile", "(", "Shell", "shell", ",", "String", "[", "]", "filters", ")", "{", "FileDialog", "fileDialog", "=", "new", "FileDialog", "(", "shell", ")", ";", "fileDialog", ".", "setText", "(", "\"\"", ")", ";", "fileDialog", ".", "setFilterExtensions", "(", "filters", ")", ";", "return", "(", "fileDialog", ".", "open", "(", ")", ")", ";", "}", "public", "static", "String", "selectSaveFile", "(", "Shell", "shell", ",", "String", "[", "]", "filters", ")", "{", "FileDialog", "fileDialog", "=", "new", "FileDialog", "(", "shell", ",", "SWT", ".", "SAVE", ")", ";", "fileDialog", ".", "setText", "(", "\"\"", ")", ";", "fileDialog", ".", "setFilterExtensions", "(", "filters", ")", ";", "return", "(", "fileDialog", ".", "open", "(", ")", ")", ";", "}", "public", "static", "void", "messageDialog", "(", "Shell", "shell", ",", "String", "message", ")", "{", "MessageBox", "messageBox", "=", "new", "MessageBox", "(", "shell", ")", ";", "messageBox", ".", "setText", "(", "\"Alert\"", ")", ";", "messageBox", ".", "setMessage", "(", "message", ")", ";", "messageBox", ".", "open", "(", ")", ";", "}", "public", "static", "int", "yesNoDialog", "(", "Shell", "shell", ",", "String", "title", ",", "String", "message", ")", "{", "MessageBox", "messageBox", "=", "new", "MessageBox", "(", "shell", ",", "SWT", ".", "YES", "|", "SWT", ".", "NO", ")", ";", "messageBox", ".", "setText", "(", "title", ")", ";", "messageBox", ".", "setMessage", "(", "message", ")", ";", "return", "(", "messageBox", ".", "open", "(", ")", ")", ";", "}", "public", "static", "void", "setClipboardContents", "(", "String", "s", ")", "{", "StringSelection", "stringSelection", "=", "new", "StringSelection", "(", "s", ")", ";", "Clipboard", "clipboard", "=", "Toolkit", ".", "getDefaultToolkit", "(", ")", ".", "getSystemClipboard", "(", ")", ";", "clipboard", ".", "setContents", "(", "stringSelection", ",", "new", "ClipboardOwner", "(", ")", "{", "public", "void", "lostOwnership", "(", "Clipboard", "arg0", ",", "Transferable", "arg1", ")", "{", "}", "}", ")", ";", "}", "public", "static", "void", "messageError", "(", "Shell", "shell", ",", "String", "message", ")", "{", "MessageBox", "messageBox", "=", "new", "MessageBox", "(", "shell", ",", "SWT", ".", "ICON_ERROR", ")", ";", "messageBox", ".", "setText", "(", "\"Error\"", ")", ";", "messageBox", ".", "setMessage", "(", "message", ")", ";", "messageBox", ".", "open", "(", ")", ";", "}", "public", "static", "void", "messageErrorThreaded", "(", "final", "Gui", "gui", ",", "final", "String", "message", ")", "{", "gui", ".", "getDisplay", "(", ")", ".", "asyncExec", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "MessageBox", "messageBox", "=", "new", "MessageBox", "(", "gui", ".", "getShell", "(", ")", ",", "SWT", ".", "ICON_ERROR", ")", ";", "messageBox", ".", "setText", "(", "\"Error\"", ")", ";", "messageBox", ".", "setMessage", "(", "message", ")", ";", "messageBox", ".", "open", "(", ")", ";", "}", "}", ")", ";", "}", "}", "</s>" ]
1,981
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang3", ".", "StringUtils", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Button", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Dialog", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Display", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Label", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "List", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Shell", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Text", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "OterStatics", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "OterWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "adb", ".", "AdbWorkshop", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "Point", ";", "public", "class", "ConfigurationDialog", "extends", "Dialog", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "ConfigurationDialog", ".", "class", ")", ";", "protected", "Object", "result", ";", "protected", "Shell", "shell", ";", "private", "Text", "androidHomeText", ";", "private", "List", "javaToSmaliClasspath", ";", "private", "Text", "maxLogcatLinesText", ";", "private", "List", "devicesList", ";", "public", "ConfigurationDialog", "(", "Shell", "parent", ")", "{", "this", "(", "parent", ",", "SWT", ".", "DIALOG_TRIM", "|", "SWT", ".", "APPLICATION_MODAL", ")", ";", "}", "public", "ConfigurationDialog", "(", "Shell", "parent", ",", "int", "style", ")", "{", "super", "(", "parent", ",", "style", ")", ";", "setText", "(", "\"\"", ")", ";", "}", "public", "Object", "open", "(", ")", "{", "createContents", "(", ")", ";", "loadConfig", "(", ")", ";", "shell", ".", "open", "(", ")", ";", "shell", ".", "layout", "(", ")", ";", "Display", "display", "=", "getParent", "(", ")", ".", "getDisplay", "(", ")", ";", "while", "(", "!", "shell", ".", "isDisposed", "(", ")", ")", "{", "if", "(", "!", "display", ".", "readAndDispatch", "(", ")", ")", "{", "display", ".", "sleep", "(", ")", ";", "}", "}", "return", "result", ";", "}", "private", "void", "loadConfig", "(", ")", "{", "for", "(", "String", "d", ":", "AdbWorkshop", ".", "getDeviceList", "(", ")", ")", "{", "devicesList", ".", "add", "(", "d", ")", ";", "}", "androidHomeText", ".", "setText", "(", "OterWorkshop", ".", "getProperty", "(", "OterStatics", ".", "PROPERTY_ANDROID_HOME", ")", "==", "null", "?", "\"\"", ":", "OterWorkshop", ".", "getProperty", "(", "OterStatics", ".", "PROPERTY_ANDROID_HOME", ")", ")", ";", "maxLogcatLinesText", ".", "setText", "(", "OterWorkshop", ".", "getProperty", "(", "OterStatics", ".", "PROPERTY_LOGCAT_MAXLINES", ")", ")", ";", "String", "javaToSmaliClasspathString", "=", "OterWorkshop", ".", "getProperty", "(", "OterStatics", ".", "PROPERTY_JAVATOSMALI_CLASSPATH", ")", ";", "if", "(", "javaToSmaliClasspathString", "!=", "null", ")", "{", "for", "(", "String", "s", ":", "javaToSmaliClasspathString", ".", "split", "(", "\":\"", ")", ")", "{", "if", "(", "!", "s", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "javaToSmaliClasspath", ".", "add", "(", "s", ")", ";", "}", "}", "}", "String", "device", "=", "OterWorkshop", ".", "getProperty", "(", "OterStatics", ".", "PROPERTY_DEVICE", ")", ";", "if", "(", "device", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "devicesList", ".", "getItemCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "devicesList", ".", "getItem", "(", "i", ")", ".", "equals", "(", "device", ")", ")", "{", "devicesList", ".", "select", "(", "i", ")", ";", "}", "}", "}", "}", "private", "void", "createContents", "(", ")", "{", "shell", "=", "new", "Shell", "(", "getParent", "(", ")", ",", "SWT", ".", "DIALOG_TRIM", "|", "SWT", ".", "RESIZE", ")", ";", "shell", ".", "setMinimumSize", "(", "new", "Point", "(", "450", ",", "394", ")", ")", ";", "shell", ".", "setSize", "(", "450", ",", "394", ")", ";", "shell", ".", "setText", "(", "\"\"", ")", ";", "GridLayout", "gl_shell", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_shell", ".", "verticalSpacing", "=", "0", ";", "gl_shell", ".", "marginWidth", "=", "0", ";", "gl_shell", ".", "marginTop", "=", "5", ";", "gl_shell", ".", "marginRight", "=", "5", ";", "gl_shell", ".", "marginBottom", "=", "5", ";", "gl_shell", ".", "marginLeft", "=", "5", ";", "gl_shell", ".", "marginHeight", "=", "0", ";", "gl_shell", ".", "horizontalSpacing", "=", "0", ";", "shell", ".", "setLayout", "(", "gl_shell", ")", ";", "Composite", "composite_4", "=", "new", "Composite", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "composite_4", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "GridLayout", "gl_composite_4", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_4", ".", "verticalSpacing", "=", "0", ";", "gl_composite_4", ".", "marginWidth", "=", "0", ";", "gl_composite_4", ".", "marginHeight", "=", "0", ";", "gl_composite_4", ".", "horizontalSpacing", "=", "0", ";", "composite_4", ".", "setLayout", "(", "gl_composite_4", ")", ";", "Label", "lblAndroidHome", "=", "new", "Label", "(", "composite_4", ",", "SWT", ".", "SHADOW_NONE", ")", ";", "lblAndroidHome", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblAndroidHome", ".", "setBounds", "(", "0", ",", "0", ",", "124", ",", "14", ")", ";", "lblAndroidHome", ".", "setText", "(", "\"\"", ")", ";", "Composite", "composite", "=", "new", "Composite", "(", "composite_4", ",", "SWT", ".", "NONE", ")", ";", "composite", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "true", ",", "1", ",", "1", ")", ")", ";", "composite", ".", "setBounds", "(", "0", ",", "0", ",", "440", ",", "28", ")", ";", "GridLayout", "gl_composite", "=", "new", "GridLayout", "(", "2", ",", "false", ")", ";", "gl_composite", ".", "horizontalSpacing", "=", "0", ";", "gl_composite", ".", "marginHeight", "=", "0", ";", "gl_composite", ".", "marginWidth", "=", "0", ";", "gl_composite", ".", "verticalSpacing", "=", "0", ";", "composite", ".", "setLayout", "(", "gl_composite", ")", ";", "androidHomeText", "=", "new", "Text", "(", "composite", ",", "SWT", ".", "BORDER", ")", ";", "androidHomeText", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "androidHomeText", ".", "setBounds", "(", "0", ",", "0", ",", "64", ",", "19", ")", ";", "Button", "btnNewButton", "=", "new", "Button", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "btnNewButton", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "String", "dir", "=", "GuiWorkshop", ".", "selectDirectory", "(", "shell", ")", ";", "if", "(", "dir", "!=", "null", ")", "{", "androidHomeText", ".", "setText", "(", "dir", ")", ";", "}", "}", "}", ")", ";", "btnNewButton", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "CENTER", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "btnNewButton", ".", "setBounds", "(", "0", ",", "0", ",", "94", ",", "30", ")", ";", "btnNewButton", ".", "setText", "(", "\"Search\"", ")", ";", "Composite", "composite_5", "=", "new", "Composite", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_5", "=", "new", "GridLayout", "(", "2", ",", "false", ")", ";", "gl_composite_5", ".", "verticalSpacing", "=", "0", ";", "gl_composite_5", ".", "marginWidth", "=", "0", ";", "gl_composite_5", ".", "horizontalSpacing", "=", "0", ";", "gl_composite_5", ".", "marginHeight", "=", "0", ";", "composite_5", ".", "setLayout", "(", "gl_composite_5", ")", ";", "composite_5", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "Label", "lblMaxLogcatLines", "=", "new", "Label", "(", "composite_5", ",", "SWT", ".", "NONE", ")", ";", "lblMaxLogcatLines", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblMaxLogcatLines", ".", "setBounds", "(", "0", ",", "0", ",", "59", ",", "14", ")", ";", "lblMaxLogcatLines", ".", "setText", "(", "\"\"", ")", ";", "maxLogcatLinesText", "=", "new", "Text", "(", "composite_5", ",", "SWT", ".", "BORDER", ")", ";", "GridData", "gd_maxLogcatLinesText", "=", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "1", ",", "1", ")", ";", "gd_maxLogcatLinesText", ".", "widthHint", "=", "100", ";", "maxLogcatLinesText", ".", "setLayoutData", "(", "gd_maxLogcatLinesText", ")", ";", "maxLogcatLinesText", ".", "setBounds", "(", "0", ",", "0", ",", "64", ",", "19", ")", ";", "Composite", "composite_2", "=", "new", "Composite", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_2", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_2", ".", "marginTop", "=", "5", ";", "gl_composite_2", ".", "verticalSpacing", "=", "0", ";", "gl_composite_2", ".", "marginWidth", "=", "0", ";", "gl_composite_2", ".", "marginHeight", "=", "0", ";", "gl_composite_2", ".", "horizontalSpacing", "=", "0", ";", "composite_2", ".", "setLayout", "(", "gl_composite_2", ")", ";", "composite_2", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "Label", "lblJavaToSmali", "=", "new", "Label", "(", "composite_2", ",", "SWT", ".", "NONE", ")", ";", "lblJavaToSmali", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblJavaToSmali", ".", "setText", "(", "\"\"", ")", ";", "javaToSmaliClasspath", "=", "new", "List", "(", "composite_2", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "H_SCROLL", "|", "SWT", ".", "V_SCROLL", ")", ";", "GridData", "gd_javaToSmaliClasspath", "=", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ";", "gd_javaToSmaliClasspath", ".", "heightHint", "=", "100", ";", "javaToSmaliClasspath", ".", "setLayoutData", "(", "gd_javaToSmaliClasspath", ")", ";", "Composite", "composite_3", "=", "new", "Composite", "(", "composite_2", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_3", "=", "new", "GridLayout", "(", "2", ",", "false", ")", ";", "gl_composite_3", ".", "horizontalSpacing", "=", "0", ";", "gl_composite_3", ".", "marginHeight", "=", "0", ";", "gl_composite_3", ".", "marginWidth", "=", "0", ";", "gl_composite_3", ".", "verticalSpacing", "=", "0", ";", "composite_3", ".", "setLayout", "(", "gl_composite_3", ")", ";", "composite_3", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "Button", "btnAdd", "=", "new", "Button", "(", "composite_3", ",", "SWT", ".", "NONE", ")", ";", "btnAdd", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "String", "fileName", "=", "GuiWorkshop", ".", "selectFile", "(", "shell", ",", "new", "String", "[", "]", "{", "\"*.jar\"", "}", ")", ";", "if", "(", "fileName", "!=", "null", ")", "{", "javaToSmaliClasspath", ".", "add", "(", "fileName", ")", ";", "}", "}", "}", ")", ";", "btnAdd", ".", "setText", "(", "\"Add\"", ")", ";", "Button", "btnRemove", "=", "new", "Button", "(", "composite_3", ",", "SWT", ".", "NONE", ")", ";", "btnRemove", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "javaToSmaliClasspath", ".", "remove", "(", "javaToSmaliClasspath", ".", "getSelectionIndex", "(", ")", ")", ";", "}", "}", ")", ";", "btnRemove", ".", "setText", "(", "\"Remove\"", ")", ";", "Composite", "composite_6", "=", "new", "Composite", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_6", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_6", ".", "verticalSpacing", "=", "0", ";", "gl_composite_6", ".", "marginWidth", "=", "0", ";", "gl_composite_6", ".", "marginHeight", "=", "0", ";", "gl_composite_6", ".", "horizontalSpacing", "=", "0", ";", "composite_6", ".", "setLayout", "(", "gl_composite_6", ")", ";", "composite_6", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "Label", "lblDevice", "=", "new", "Label", "(", "composite_6", ",", "SWT", ".", "NONE", ")", ";", "lblDevice", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblDevice", ".", "setBounds", "(", "0", ",", "0", ",", "59", ",", "14", ")", ";", "lblDevice", ".", "setText", "(", "\"Device:\"", ")", ";", "devicesList", "=", "new", "List", "(", "composite_6", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "H_SCROLL", "|", "SWT", ".", "V_SCROLL", ")", ";", "GridData", "gd_list", "=", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ";", "gd_list", ".", "heightHint", "=", "75", ";", "devicesList", ".", "setLayoutData", "(", "gd_list", ")", ";", "devicesList", ".", "setBounds", "(", "0", ",", "0", ",", "3", ",", "66", ")", ";", "Composite", "composite_1", "=", "new", "Composite", "(", "shell", ",", "SWT", ".", "NONE", ")", ";", "composite_1", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "RIGHT", ",", "SWT", ".", "BOTTOM", ",", "false", ",", "true", ",", "1", ",", "1", ")", ")", ";", "composite_1", ".", "setBounds", "(", "0", ",", "0", ",", "64", ",", "64", ")", ";", "GridLayout", "gl_composite_1", "=", "new", "GridLayout", "(", "2", ",", "false", ")", ";", "gl_composite_1", ".", "horizontalSpacing", "=", "0", ";", "gl_composite_1", ".", "marginHeight", "=", "0", ";", "gl_composite_1", ".", "marginWidth", "=", "0", ";", "gl_composite_1", ".", "verticalSpacing", "=", "0", ";", "composite_1", ".", "setLayout", "(", "gl_composite_1", ")", ";", "Button", "btnSave", "=", "new", "Button", "(", "composite_1", ",", "SWT", ".", "NONE", ")", ";", "btnSave", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "BOTTOM", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "btnSave", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "String", "configFile", "=", "OterStatics", ".", "getConfigFileName", "(", ")", ";", "Properties", "prop", "=", "new", "Properties", "(", ")", ";", "prop", ".", "setProperty", "(", "OterStatics", ".", "PROPERTY_ANDROID_HOME", ",", "androidHomeText", ".", "getText", "(", ")", ")", ";", "String", "cp", "=", "StringUtils", ".", "join", "(", "javaToSmaliClasspath", ".", "getItems", "(", ")", ",", "\":\"", ")", ";", "prop", ".", "setProperty", "(", "OterStatics", ".", "PROPERTY_JAVATOSMALI_CLASSPATH", ",", "cp", ")", ";", "String", "max", "=", "maxLogcatLinesText", ".", "getText", "(", ")", ";", "prop", ".", "setProperty", "(", "OterStatics", ".", "PROPERTY_LOGCAT_MAXLINES", ",", "max", ")", ";", "String", "[", "]", "devices", "=", "devicesList", ".", "getSelection", "(", ")", ";", "if", "(", "devices", ".", "length", ">", "0", ")", "{", "prop", ".", "setProperty", "(", "OterStatics", ".", "PROPERTY_DEVICE", ",", "devices", "[", "0", "]", ")", ";", "}", "try", "{", "prop", ".", "store", "(", "new", "FileOutputStream", "(", "configFile", ")", ",", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shell", ",", "\"\"", "+", "configFile", "+", "\"):", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "shell", ".", "close", "(", ")", ";", "}", "}", ")", ";", "btnSave", ".", "setText", "(", "\"Save\"", ")", ";", "Button", "btnCancel", "=", "new", "Button", "(", "composite_1", ",", "SWT", ".", "NONE", ")", ";", "btnCancel", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "shell", ".", "close", "(", ")", ";", "}", "}", ")", ";", "btnCancel", ".", "setText", "(", "\"Cancel\"", ")", ";", "}", "}", "</s>" ]
1,982
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "security", ".", "KeyStore", ";", "import", "java", ".", "security", ".", "MessageDigest", ";", "import", "java", ".", "security", ".", "cert", ".", "Certificate", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Button", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Control", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Dialog", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Display", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Label", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Shell", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Table", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableColumn", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Text", ";", "import", "sun", ".", "security", ".", "tools", ".", "KeyStoreUtil", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "OterStatics", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "smali", ".", "SmaliWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "bean", ".", "BuildAndSignApkBean", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "CoolBar", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "ExpandBar", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "ExpandItem", ";", "public", "class", "BuildAndSignApkDialog", "extends", "Dialog", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "BuildAndSignApkDialog", ".", "class", ")", ";", "protected", "BuildAndSignApkBean", "result", ";", "protected", "Shell", "shlBuildAndSign", ";", "private", "Text", "certFileTextbox", ";", "private", "Text", "passwordTextbox", ";", "private", "Table", "aliasTable", ";", "private", "Text", "apkFileTextbox", ";", "private", "Button", "btnSelectFile", ";", "private", "Label", "lblKeystoreFile", ";", "private", "Label", "lblCertificate", ";", "private", "Label", "lblPassword", ";", "private", "Control", "[", "]", "keystoreObj", ";", "private", "Control", "[", "]", "signObj", ";", "private", "Composite", "composite_1", ";", "private", "Composite", "composite_2", ";", "private", "Composite", "composite_3", ";", "private", "Button", "btnSignApk", ";", "public", "BuildAndSignApkDialog", "(", "Shell", "parent", ")", "{", "this", "(", "parent", ",", "SWT", ".", "DIALOG_TRIM", "|", "SWT", ".", "APPLICATION_MODAL", ")", ";", "}", "public", "BuildAndSignApkDialog", "(", "Shell", "parent", ",", "int", "style", ")", "{", "super", "(", "parent", ",", "style", ")", ";", "setText", "(", "\"\"", ")", ";", "result", "=", "new", "BuildAndSignApkBean", "(", ")", ";", "}", "public", "BuildAndSignApkBean", "open", "(", ")", "{", "createContents", "(", ")", ";", "shlBuildAndSign", ".", "open", "(", ")", ";", "shlBuildAndSign", ".", "layout", "(", ")", ";", "Display", "display", "=", "getParent", "(", ")", ".", "getDisplay", "(", ")", ";", "while", "(", "!", "shlBuildAndSign", ".", "isDisposed", "(", ")", ")", "{", "if", "(", "!", "display", ".", "readAndDispatch", "(", ")", ")", "{", "display", ".", "sleep", "(", ")", ";", "}", "}", "return", "result", ";", "}", "private", "void", "createContents", "(", ")", "{", "shlBuildAndSign", "=", "new", "Shell", "(", "getParent", "(", ")", ",", "SWT", ".", "DIALOG_TRIM", "|", "SWT", ".", "RESIZE", ")", ";", "shlBuildAndSign", ".", "setSize", "(", "420", ",", "471", ")", ";", "shlBuildAndSign", ".", "setText", "(", "\"\"", ")", ";", "GridLayout", "gl_shlBuildAndSign", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_shlBuildAndSign", ".", "horizontalSpacing", "=", "0", ";", "gl_shlBuildAndSign", ".", "marginBottom", "=", "5", ";", "gl_shlBuildAndSign", ".", "marginRight", "=", "5", ";", "gl_shlBuildAndSign", ".", "marginLeft", "=", "5", ";", "gl_shlBuildAndSign", ".", "verticalSpacing", "=", "0", ";", "gl_shlBuildAndSign", ".", "marginWidth", "=", "0", ";", "gl_shlBuildAndSign", ".", "marginTop", "=", "5", ";", "gl_shlBuildAndSign", ".", "marginHeight", "=", "0", ";", "shlBuildAndSign", ".", "setLayout", "(", "gl_shlBuildAndSign", ")", ";", "Label", "lblDestinationApkFile", "=", "new", "Label", "(", "shlBuildAndSign", ",", "SWT", ".", "NONE", ")", ";", "lblDestinationApkFile", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblDestinationApkFile", ".", "setText", "(", "\"\"", ")", ";", "Composite", "composite", "=", "new", "Composite", "(", "shlBuildAndSign", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite", "=", "new", "GridLayout", "(", "2", ",", "false", ")", ";", "gl_composite", ".", "horizontalSpacing", "=", "0", ";", "gl_composite", ".", "verticalSpacing", "=", "0", ";", "gl_composite", ".", "marginWidth", "=", "0", ";", "gl_composite", ".", "marginHeight", "=", "0", ";", "composite", ".", "setLayout", "(", "gl_composite", ")", ";", "composite", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "apkFileTextbox", "=", "new", "Text", "(", "composite", ",", "SWT", ".", "BORDER", ")", ";", "apkFileTextbox", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "btnSelectFile", "=", "new", "Button", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "btnSelectFile", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "RIGHT", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "btnSelectFile", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "String", "file", "=", "GuiWorkshop", ".", "selectSaveFile", "(", "getParent", "(", ")", ",", "new", "String", "[", "]", "{", "\"*.apk\"", "}", ")", ";", "if", "(", "file", "!=", "null", ")", "{", "apkFileTextbox", ".", "setText", "(", "file", ")", ";", "}", "}", "}", ")", ";", "btnSelectFile", ".", "setText", "(", "\"Select", "File\"", ")", ";", "btnSignApk", "=", "new", "Button", "(", "shlBuildAndSign", ",", "SWT", ".", "CHECK", ")", ";", "btnSignApk", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "if", "(", "btnSignApk", ".", "getSelection", "(", ")", "==", "false", ")", "{", "for", "(", "Control", "c", ":", "signObj", ")", "{", "logger", ".", "debug", "(", "c", ")", ";", "c", ".", "setEnabled", "(", "false", ")", ";", "}", "}", "else", "{", "for", "(", "Control", "c", ":", "signObj", ")", "{", "c", ".", "setEnabled", "(", "true", ")", ";", "}", "}", "}", "}", ")", ";", "btnSignApk", ".", "setText", "(", "\"Sign", "APK\"", ")", ";", "new", "Label", "(", "shlBuildAndSign", ",", "SWT", ".", "NONE", ")", ";", "final", "Button", "btnGenerateKeystoreOn", "=", "new", "Button", "(", "shlBuildAndSign", ",", "SWT", ".", "CHECK", ")", ";", "btnGenerateKeystoreOn", ".", "setEnabled", "(", "false", ")", ";", "btnGenerateKeystoreOn", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "2", ",", "1", ")", ")", ";", "btnGenerateKeystoreOn", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "if", "(", "btnGenerateKeystoreOn", ".", "getSelection", "(", ")", "==", "true", ")", "{", "for", "(", "Control", "c", ":", "keystoreObj", ")", "{", "logger", ".", "debug", "(", "c", ")", ";", "c", ".", "setEnabled", "(", "false", ")", ";", "}", "}", "else", "{", "for", "(", "Control", "c", ":", "keystoreObj", ")", "{", "c", ".", "setEnabled", "(", "true", ")", ";", "}", "}", "}", "}", ")", ";", "btnGenerateKeystoreOn", ".", "setText", "(", "\"\"", ")", ";", "lblKeystoreFile", "=", "new", "Label", "(", "shlBuildAndSign", ",", "SWT", ".", "NONE", ")", ";", "lblKeystoreFile", ".", "setEnabled", "(", "false", ")", ";", "lblKeystoreFile", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblKeystoreFile", ".", "setText", "(", "\"\"", ")", ";", "composite_1", "=", "new", "Composite", "(", "shlBuildAndSign", ",", "SWT", ".", "NONE", ")", ";", "composite_1", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "GridLayout", "gl_composite_1", "=", "new", "GridLayout", "(", "3", ",", "false", ")", ";", "gl_composite_1", ".", "verticalSpacing", "=", "0", ";", "gl_composite_1", ".", "marginWidth", "=", "0", ";", "gl_composite_1", ".", "marginHeight", "=", "0", ";", "gl_composite_1", ".", "horizontalSpacing", "=", "0", ";", "composite_1", ".", "setLayout", "(", "gl_composite_1", ")", ";", "certFileTextbox", "=", "new", "Text", "(", "composite_1", ",", "SWT", ".", "BORDER", ")", ";", "certFileTextbox", ".", "setEnabled", "(", "false", ")", ";", "certFileTextbox", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "Button", "btnNewButton", "=", "new", "Button", "(", "composite_1", ",", "SWT", ".", "NONE", ")", ";", "btnNewButton", ".", "setEnabled", "(", "false", ")", ";", "btnNewButton", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "String", "file", "=", "GuiWorkshop", ".", "selectFile", "(", "getParent", "(", ")", ",", "new", "String", "[", "]", "{", "\"*\"", "}", ")", ";", "if", "(", "file", "!=", "null", ")", "{", "certFileTextbox", ".", "setText", "(", "file", ")", ";", "}", "}", "}", ")", ";", "btnNewButton", ".", "setText", "(", "\"Select", "File\"", ")", ";", "new", "Label", "(", "composite_1", ",", "SWT", ".", "NONE", ")", ";", "lblPassword", "=", "new", "Label", "(", "shlBuildAndSign", ",", "SWT", ".", "NONE", ")", ";", "lblPassword", ".", "setEnabled", "(", "false", ")", ";", "lblPassword", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblPassword", ".", "setText", "(", "\"Password:\"", ")", ";", "composite_2", "=", "new", "Composite", "(", "shlBuildAndSign", ",", "SWT", ".", "NONE", ")", ";", "composite_2", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "GridLayout", "gl_composite_2", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_2", ".", "marginBottom", "=", "5", ";", "gl_composite_2", ".", "marginTop", "=", "5", ";", "gl_composite_2", ".", "marginHeight", "=", "0", ";", "gl_composite_2", ".", "marginWidth", "=", "0", ";", "gl_composite_2", ".", "verticalSpacing", "=", "0", ";", "composite_2", ".", "setLayout", "(", "gl_composite_2", ")", ";", "passwordTextbox", "=", "new", "Text", "(", "composite_2", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "PASSWORD", ")", ";", "passwordTextbox", ".", "setEnabled", "(", "false", ")", ";", "passwordTextbox", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "passwordTextbox", ".", "addKeyListener", "(", "new", "KeyAdapter", "(", ")", "{", "@", "Override", "public", "void", "keyReleased", "(", "KeyEvent", "arg0", ")", "{", "try", "{", "KeyStore", "ks", "=", "KeyStore", ".", "getInstance", "(", "KeyStoreUtil", ".", "niceStoreTypeName", "(", "KeyStore", ".", "getDefaultType", "(", ")", ")", ")", ";", "ks", ".", "load", "(", "new", "File", "(", "certFileTextbox", ".", "getText", "(", ")", ")", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ".", "openStream", "(", ")", ",", "passwordTextbox", ".", "getTextChars", "(", ")", ")", ";", "Enumeration", "<", "String", ">", "aliases", "=", "ks", ".", "aliases", "(", ")", ";", "aliasTable", ".", "clearAll", "(", ")", ";", "while", "(", "aliases", ".", "hasMoreElements", "(", ")", ")", "{", "String", "alias", "=", "aliases", ".", "nextElement", "(", ")", ";", "Certificate", "cert", "=", "ks", ".", "getCertificate", "(", "alias", ")", ";", "byte", "[", "]", "encCertInfo", "=", "cert", ".", "getEncoded", "(", ")", ";", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "byte", "[", "]", "digest", "=", "md", ".", "digest", "(", "encCertInfo", ")", ";", "String", "key", "=", "toHexString", "(", "digest", ")", ";", "TableItem", "tableItem", "=", "new", "TableItem", "(", "aliasTable", ",", "SWT", ".", "NONE", ")", ";", "tableItem", ".", "setText", "(", "new", "String", "[", "]", "{", "alias", ",", "ks", ".", "getCreationDate", "(", "alias", ")", ".", "toString", "(", ")", ",", "key", "}", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}", ")", ";", "lblCertificate", "=", "new", "Label", "(", "shlBuildAndSign", ",", "SWT", ".", "NONE", ")", ";", "lblCertificate", ".", "setEnabled", "(", "false", ")", ";", "lblCertificate", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblCertificate", ".", "setText", "(", "\"Certificate:\"", ")", ";", "aliasTable", "=", "new", "Table", "(", "shlBuildAndSign", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "FULL_SELECTION", ")", ";", "aliasTable", ".", "setEnabled", "(", "false", ")", ";", "GridData", "gd_aliasTable", "=", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "3", ",", "1", ")", ";", "gd_aliasTable", ".", "heightHint", "=", "72", ";", "aliasTable", ".", "setLayoutData", "(", "gd_aliasTable", ")", ";", "aliasTable", ".", "setHeaderVisible", "(", "true", ")", ";", "aliasTable", ".", "setLinesVisible", "(", "true", ")", ";", "TableColumn", "tblclmnName", "=", "new", "TableColumn", "(", "aliasTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnName", ".", "setWidth", "(", "100", ")", ";", "tblclmnName", ".", "setText", "(", "\"Name\"", ")", ";", "TableColumn", "tblclmnDate", "=", "new", "TableColumn", "(", "aliasTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnDate", ".", "setWidth", "(", "100", ")", ";", "tblclmnDate", ".", "setText", "(", "\"Date\"", ")", ";", "TableColumn", "tblclmnChecksum", "=", "new", "TableColumn", "(", "aliasTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnChecksum", ".", "setWidth", "(", "149", ")", ";", "tblclmnChecksum", ".", "setText", "(", "\"Checksum\"", ")", ";", "composite_3", "=", "new", "Composite", "(", "shlBuildAndSign", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_3", "=", "new", "GridLayout", "(", "2", ",", "false", ")", ";", "gl_composite_3", ".", "horizontalSpacing", "=", "0", ";", "gl_composite_3", ".", "marginWidth", "=", "0", ";", "gl_composite_3", ".", "marginHeight", "=", "0", ";", "gl_composite_3", ".", "verticalSpacing", "=", "0", ";", "composite_3", ".", "setLayout", "(", "gl_composite_3", ")", ";", "composite_3", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "RIGHT", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "Button", "btnSelect", "=", "new", "Button", "(", "composite_3", ",", "SWT", ".", "NONE", ")", ";", "btnSelect", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "if", "(", "apkFileTextbox", ".", "getText", "(", ")", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlBuildAndSign", ",", "\"\"", ")", ";", "return", ";", "}", "if", "(", "btnSignApk", ".", "getSelection", "(", ")", "==", "true", ")", "{", "if", "(", "btnGenerateKeystoreOn", ".", "getSelection", "(", ")", "==", "true", ")", "{", "try", "{", "String", "alias", "=", "OterStatics", ".", "SOME_STRING", ";", "String", "password", "=", "OterStatics", ".", "SOME_STRING", ";", "KeyStore", "ks", "=", "SmaliWorkshop", ".", "createKeystoreWithSecretKey", "(", "alias", ")", ";", "File", "ksFile", "=", "SmaliWorkshop", ".", "writeKeystoreToTemporaryFile", "(", "ks", ",", "password", ")", ";", "result", ".", "setApkFilename", "(", "apkFileTextbox", ".", "getText", "(", ")", ")", ";", "result", ".", "setSign", "(", "btnSignApk", ".", "getSelection", "(", ")", ")", ";", "result", ".", "setCertFilename", "(", "ksFile", ".", "getAbsolutePath", "(", ")", ")", ";", "result", ".", "setPassword", "(", "password", ")", ";", "result", ".", "setCertAlias", "(", "alias", ")", ";", "shlBuildAndSign", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageError", "(", "shlBuildAndSign", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "else", "{", "if", "(", "aliasTable", ".", "getSelection", "(", ")", ".", "length", ">", "0", ")", "{", "result", ".", "setApkFilename", "(", "apkFileTextbox", ".", "getText", "(", ")", ")", ";", "result", ".", "setSign", "(", "btnSignApk", ".", "getSelection", "(", ")", ")", ";", "result", ".", "setCertFilename", "(", "certFileTextbox", ".", "getText", "(", ")", ")", ";", "result", ".", "setPassword", "(", "passwordTextbox", ".", "getText", "(", ")", ")", ";", "result", ".", "setCertAlias", "(", "aliasTable", ".", "getSelection", "(", ")", "[", "0", "]", ".", "getText", "(", "0", ")", ")", ";", "result", ".", "setSign", "(", "btnSignApk", ".", "getSelection", "(", ")", ")", ";", "shlBuildAndSign", ".", "close", "(", ")", ";", "}", "else", "{", "logger", ".", "error", "(", "\"\"", ")", ";", "GuiWorkshop", ".", "messageError", "(", "shlBuildAndSign", ",", "\"\"", ")", ";", "return", ";", "}", "}", "}", "else", "{", "result", ".", "setApkFilename", "(", "apkFileTextbox", ".", "getText", "(", ")", ")", ";", "result", ".", "setSign", "(", "btnSignApk", ".", "getSelection", "(", ")", ")", ";", "shlBuildAndSign", ".", "close", "(", ")", ";", "}", "}", "}", ")", ";", "btnSelect", ".", "setText", "(", "\"Save\"", ")", ";", "Button", "btnCancel", "=", "new", "Button", "(", "composite_3", ",", "SWT", ".", "NONE", ")", ";", "btnCancel", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "result", "=", "null", ";", "shlBuildAndSign", ".", "close", "(", ")", ";", "}", "}", ")", ";", "btnCancel", ".", "setText", "(", "\"Cancel\"", ")", ";", "keystoreObj", "=", "new", "Control", "[", "]", "{", "certFileTextbox", ",", "passwordTextbox", ",", "aliasTable", ",", "btnNewButton", ",", "lblKeystoreFile", ",", "lblCertificate", ",", "lblPassword", "}", ";", "signObj", "=", "new", "Control", "[", "]", "{", "btnGenerateKeystoreOn", ",", "certFileTextbox", ",", "passwordTextbox", ",", "aliasTable", ",", "btnNewButton", ",", "lblKeystoreFile", ",", "lblCertificate", ",", "lblPassword", "}", ";", "}", "private", "String", "toHexString", "(", "byte", "[", "]", "block", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "int", "len", "=", "block", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "byte2hex", "(", "block", "[", "i", "]", ",", "buf", ")", ";", "if", "(", "i", "<", "len", "-", "1", ")", "{", "buf", ".", "append", "(", "\":\"", ")", ";", "}", "}", "return", "buf", ".", "toString", "(", ")", ";", "}", "private", "void", "byte2hex", "(", "byte", "b", ",", "StringBuffer", "buf", ")", "{", "char", "[", "]", "hexChars", "=", "{", "'0'", ",", "'1'", ",", "'2'", ",", "'3'", ",", "'4'", ",", "'5'", ",", "'6'", ",", "'7'", ",", "'8'", ",", "'9'", ",", "'A'", ",", "'B'", ",", "'C'", ",", "'D'", ",", "'E'", ",", "'F'", "}", ";", "int", "high", "=", "(", "(", "b", "&", "0xf0", ")", ">>", "4", ")", ";", "int", "low", "=", "(", "b", "&", "0x0f", ")", ";", "buf", ".", "append", "(", "hexChars", "[", "high", "]", ")", ";", "buf", ".", "append", "(", "hexChars", "[", "low", "]", ")", ";", "}", "}", "</s>" ]
1,983
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "StyledText", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "Point", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Button", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Dialog", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Display", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Label", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Shell", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Text", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyEvent", ";", "public", "class", "FindDialog", "extends", "Dialog", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "FindDialog", ".", "class", ")", ";", "protected", "Object", "result", ";", "protected", "Shell", "shlFind", ";", "private", "Text", "searchText", ";", "private", "StyledText", "searchContext", ";", "private", "Button", "btnIgnoreCase", ";", "public", "FindDialog", "(", "Shell", "parent", ",", "StyledText", "searchContext", ")", "{", "this", "(", "parent", ",", "SWT", ".", "DIALOG_TRIM", "|", "SWT", ".", "APPLICATION_MODAL", ",", "searchContext", ")", ";", "}", "public", "FindDialog", "(", "Shell", "parent", ",", "int", "style", ",", "StyledText", "searchContext", ")", "{", "super", "(", "parent", ",", "style", ")", ";", "setText", "(", "\"Search\"", ")", ";", "this", ".", "searchContext", "=", "searchContext", ";", "}", "private", "void", "findNext", "(", ")", "{", "String", "search", "=", "searchText", ".", "getText", "(", ")", ";", "logger", ".", "debug", "(", "\"\"", "+", "search", ")", ";", "Point", "p", "=", "searchContext", ".", "getSelectionRange", "(", ")", ";", "String", "rest", "=", "searchContext", ".", "getTextRange", "(", "p", ".", "x", "+", "p", ".", "y", ",", "searchContext", ".", "getText", "(", ")", ".", "length", "(", ")", "-", "(", "p", ".", "x", "+", "p", ".", "y", ")", ")", ";", "int", "x", "=", "rest", ".", "indexOf", "(", "search", ")", ";", "if", "(", "x", "!=", "-", "1", ")", "{", "x", "=", "p", ".", "x", "+", "p", ".", "y", "+", "x", ";", "int", "y", "=", "x", "+", "search", ".", "length", "(", ")", ";", "searchContext", ".", "setSelection", "(", "x", ",", "y", ")", ";", "}", "else", "if", "(", "p", ".", "x", "!=", "0", "&&", "p", ".", "y", "!=", "0", ")", "{", "searchContext", ".", "setSelection", "(", "0", ",", "0", ")", ";", "findNext", "(", ")", ";", "}", "}", "private", "void", "findPrevious", "(", ")", "{", "String", "search", "=", "searchText", ".", "getText", "(", ")", ";", "logger", ".", "debug", "(", "\"\"", "+", "search", ")", ";", "Point", "p", "=", "searchContext", ".", "getSelectionRange", "(", ")", ";", "String", "rest", "=", "searchContext", ".", "getTextRange", "(", "0", ",", "p", ".", "x", ")", ";", "int", "x", "=", "rest", ".", "lastIndexOf", "(", "search", ")", ";", "if", "(", "x", "!=", "-", "1", ")", "{", "int", "y", "=", "x", "+", "search", ".", "length", "(", ")", ";", "searchContext", ".", "setSelection", "(", "x", ",", "y", ")", ";", "}", "else", "if", "(", "p", ".", "x", "!=", "searchContext", ".", "getText", "(", ")", ".", "length", "(", ")", "&&", "p", ".", "y", "!=", "0", ")", "{", "searchContext", ".", "setSelection", "(", "searchContext", ".", "getText", "(", ")", ".", "length", "(", ")", ",", "searchContext", ".", "getText", "(", ")", ".", "length", "(", ")", ")", ";", "findPrevious", "(", ")", ";", "}", "}", "public", "Object", "open", "(", ")", "{", "createContents", "(", ")", ";", "shlFind", ".", "open", "(", ")", ";", "shlFind", ".", "layout", "(", ")", ";", "Display", "display", "=", "getParent", "(", ")", ".", "getDisplay", "(", ")", ";", "while", "(", "!", "shlFind", ".", "isDisposed", "(", ")", ")", "{", "if", "(", "!", "display", ".", "readAndDispatch", "(", ")", ")", "{", "display", ".", "sleep", "(", ")", ";", "}", "}", "return", "result", ";", "}", "private", "void", "createContents", "(", ")", "{", "shlFind", "=", "new", "Shell", "(", "getParent", "(", ")", ",", "SWT", ".", "DIALOG_TRIM", ")", ";", "shlFind", ".", "setSize", "(", "450", ",", "128", ")", ";", "shlFind", ".", "setText", "(", "\"Find\"", ")", ";", "GridLayout", "gl_shlFind", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_shlFind", ".", "verticalSpacing", "=", "0", ";", "gl_shlFind", ".", "marginWidth", "=", "0", ";", "gl_shlFind", ".", "marginBottom", "=", "5", ";", "gl_shlFind", ".", "marginTop", "=", "5", ";", "gl_shlFind", ".", "marginRight", "=", "5", ";", "gl_shlFind", ".", "marginLeft", "=", "5", ";", "gl_shlFind", ".", "marginHeight", "=", "0", ";", "gl_shlFind", ".", "horizontalSpacing", "=", "0", ";", "shlFind", ".", "setLayout", "(", "gl_shlFind", ")", ";", "Label", "lblSearchString", "=", "new", "Label", "(", "shlFind", ",", "SWT", ".", "NONE", ")", ";", "lblSearchString", ".", "setBounds", "(", "0", ",", "0", ",", "59", ",", "14", ")", ";", "lblSearchString", ".", "setText", "(", "\"\"", ")", ";", "searchText", "=", "new", "Text", "(", "shlFind", ",", "SWT", ".", "BORDER", ")", ";", "searchText", ".", "addKeyListener", "(", "new", "KeyAdapter", "(", ")", "{", "@", "Override", "public", "void", "keyPressed", "(", "KeyEvent", "arg0", ")", "{", "if", "(", "arg0", ".", "character", "==", "13", ")", "{", "findNext", "(", ")", ";", "}", "}", "}", ")", ";", "searchText", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "btnIgnoreCase", "=", "new", "Button", "(", "shlFind", ",", "SWT", ".", "CHECK", ")", ";", "btnIgnoreCase", ".", "setText", "(", "\"Ignore", "Case\"", ")", ";", "Composite", "composite", "=", "new", "Composite", "(", "shlFind", ",", "SWT", ".", "NONE", ")", ";", "composite", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "RIGHT", ",", "SWT", ".", "BOTTOM", ",", "false", ",", "true", ",", "1", ",", "1", ")", ")", ";", "GridLayout", "gl_composite", "=", "new", "GridLayout", "(", "3", ",", "false", ")", ";", "gl_composite", ".", "horizontalSpacing", "=", "0", ";", "gl_composite", ".", "marginWidth", "=", "0", ";", "gl_composite", ".", "marginHeight", "=", "0", ";", "gl_composite", ".", "verticalSpacing", "=", "0", ";", "composite", ".", "setLayout", "(", "gl_composite", ")", ";", "Button", "btnPrevious", "=", "new", "Button", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "btnPrevious", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "findPrevious", "(", ")", ";", "}", "}", ")", ";", "btnPrevious", ".", "setText", "(", "\"Previous\"", ")", ";", "Button", "btnNext", "=", "new", "Button", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "btnNext", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "findNext", "(", ")", ";", "}", "}", ")", ";", "btnNext", ".", "setText", "(", "\"Next\"", ")", ";", "Button", "btnCancel", "=", "new", "Button", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "btnCancel", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "shlFind", ".", "close", "(", ")", ";", "}", "}", ")", ";", "btnCancel", ".", "setBounds", "(", "0", ",", "0", ",", "94", ",", "30", ")", ";", "btnCancel", ".", "setText", "(", "\"Cancel\"", ")", ";", "}", "}", "</s>" ]
1,984
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabFolder", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CaretEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CaretListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "StyledText", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "DragDetectEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "DragDetectListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseWheelListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Event", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Listener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "ScrollBar", ";", "import", "org", ".", "eclipse", ".", "wb", ".", "swt", ".", "SWTResourceManager", ";", "public", "class", "CTabItemWithHexViewer", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "CTabItemWithHexViewer", ".", "class", ")", ";", "private", "CTabFolder", "parent", ";", "private", "StyledText", "counter", ";", "private", "StyledText", "hexContent", ";", "private", "StyledText", "binContent", ";", "private", "String", "name", ";", "private", "File", "f", ";", "private", "int", "style", ";", "public", "CTabItemWithHexViewer", "(", "CTabFolder", "parent", ",", "String", "name", ",", "File", "f", ",", "int", "style", ")", "throws", "IOException", "{", "this", ".", "parent", "=", "parent", ";", "this", ".", "name", "=", "name", ";", "this", ".", "f", "=", "f", ";", "this", ".", "style", "=", "style", ";", "createEditor", "(", ")", ";", "loadFile", "(", "f", ")", ";", "}", "private", "void", "loadFile", "(", "File", "f", ")", "throws", "IOException", "{", "hexContent", ".", "setText", "(", "\"\"", ")", ";", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "f", ")", ";", "int", "size", "=", "fis", ".", "available", "(", ")", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "size", "]", ";", "fis", ".", "read", "(", "buffer", ")", ";", "fis", ".", "close", "(", ")", ";", "int", "ctr", "=", "0", ";", "StringBuffer", "hexContentStringBuffer", "=", "new", "StringBuffer", "(", ")", ";", "StringBuffer", "counterStringBuffer", "=", "new", "StringBuffer", "(", "\"000000\"", ")", ";", "StringBuffer", "binContentStringBuffer", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "byte", "c", ":", "buffer", ")", "{", "ctr", "++", ";", "String", "hex", "=", "String", ".", "format", "(", "\"%02X\"", ",", "c", ")", ";", "char", "ch", "=", "(", "char", ")", "c", ";", "if", "(", "ch", "<", "32", "||", "ch", ">", "126", ")", "{", "ch", "=", "'.'", ";", "}", "if", "(", "ctr", "%", "8", "==", "0", ")", "{", "hexContentStringBuffer", ".", "append", "(", "hex", ")", ".", "append", "(", "\"n\"", ")", ";", "binContentStringBuffer", ".", "append", "(", "ch", ")", ".", "append", "(", "\"n\"", ")", ";", "counterStringBuffer", ".", "append", "(", "\"n\"", ")", ".", "append", "(", "String", ".", "format", "(", "\"%06d\"", ",", "ctr", ")", ")", ";", "}", "else", "if", "(", "ctr", "%", "4", "==", "0", ")", "{", "hexContentStringBuffer", ".", "append", "(", "hex", ")", ".", "append", "(", "\"", "\"", ")", ";", "binContentStringBuffer", ".", "append", "(", "ch", ")", ".", "append", "(", "\"", "\"", ")", ";", "}", "else", "{", "hexContentStringBuffer", ".", "append", "(", "hex", ")", ".", "append", "(", "\"", "\"", ")", ";", "binContentStringBuffer", ".", "append", "(", "ch", ")", ";", "}", "}", "hexContent", ".", "setText", "(", "hexContentStringBuffer", ".", "toString", "(", ")", ")", ";", "binContent", ".", "setText", "(", "binContentStringBuffer", ".", "toString", "(", ")", ")", ";", "counter", ".", "setText", "(", "counterStringBuffer", ".", "toString", "(", ")", ")", ";", "}", "private", "void", "createEditor", "(", ")", "{", "CTabItem", "tabItem", "=", "new", "CTabItem", "(", "parent", ",", "style", ")", ";", "tabItem", ".", "setText", "(", "name", ")", ";", "Composite", "composite", "=", "new", "Composite", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", "tabItem", ".", "setControl", "(", "composite", ")", ";", "GridLayout", "gl_composite", "=", "new", "GridLayout", "(", "4", ",", "false", ")", ";", "gl_composite", ".", "marginWidth", "=", "0", ";", "gl_composite", ".", "verticalSpacing", "=", "0", ";", "gl_composite", ".", "marginHeight", "=", "0", ";", "gl_composite", ".", "horizontalSpacing", "=", "0", ";", "composite", ".", "setLayout", "(", "gl_composite", ")", ";", "counter", "=", "new", "StyledText", "(", "composite", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "READ_ONLY", ")", ";", "counter", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "FILL", ",", "false", ",", "true", ",", "1", ",", "1", ")", ")", ";", "counter", ".", "setFont", "(", "SWTResourceManager", ".", "getFont", "(", "\"Courier", "New\"", ",", "11", ",", "SWT", ".", "NORMAL", ")", ")", ";", "addListeners", "(", "counter", ")", ";", "hexContent", "=", "new", "StyledText", "(", "composite", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "READ_ONLY", "|", "SWT", ".", "V_SCROLL", ")", ";", "hexContent", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "2", ",", "1", ")", ")", ";", "hexContent", ".", "setFont", "(", "SWTResourceManager", ".", "getFont", "(", "\"Courier", "New\"", ",", "11", ",", "SWT", ".", "NORMAL", ")", ")", ";", "addListeners", "(", "hexContent", ")", ";", "binContent", "=", "new", "StyledText", "(", "composite", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "READ_ONLY", ")", ";", "binContent", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "binContent", ".", "setFont", "(", "SWTResourceManager", ".", "getFont", "(", "\"Courier", "New\"", ",", "11", ",", "SWT", ".", "NORMAL", ")", ")", ";", "addListeners", "(", "binContent", ")", ";", "parent", ".", "setSelection", "(", "tabItem", ")", ";", "}", "private", "void", "addListeners", "(", "final", "StyledText", "txt", ")", "{", "txt", ".", "addMouseWheelListener", "(", "new", "MouseWheelListener", "(", ")", "{", "public", "void", "mouseScrolled", "(", "MouseEvent", "arg0", ")", "{", "binContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "hexContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "counter", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "}", "}", ")", ";", "txt", ".", "addSelectionListener", "(", "new", "SelectionListener", "(", ")", "{", "@", "Override", "public", "void", "widgetDefaultSelected", "(", "SelectionEvent", "arg0", ")", "{", "binContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "hexContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "counter", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "}", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "binContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "hexContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "counter", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "}", "}", ")", ";", "txt", ".", "addKeyListener", "(", "new", "KeyAdapter", "(", ")", "{", "@", "Override", "public", "void", "keyPressed", "(", "KeyEvent", "arg0", ")", "{", "binContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "hexContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "counter", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "}", "}", ")", ";", "txt", ".", "addMouseListener", "(", "new", "MouseAdapter", "(", ")", "{", "@", "Override", "public", "void", "mouseDown", "(", "MouseEvent", "arg0", ")", "{", "binContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "hexContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "counter", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "}", "}", ")", ";", "txt", ".", "addCaretListener", "(", "new", "CaretListener", "(", ")", "{", "public", "void", "caretMoved", "(", "CaretEvent", "arg0", ")", "{", "binContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "hexContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "counter", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "}", "}", ")", ";", "txt", ".", "addDragDetectListener", "(", "new", "DragDetectListener", "(", ")", "{", "public", "void", "dragDetected", "(", "DragDetectEvent", "arg0", ")", "{", "binContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "hexContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "counter", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "}", "}", ")", ";", "ScrollBar", "vbar", "=", "txt", ".", "getVerticalBar", "(", ")", ";", "if", "(", "vbar", "!=", "null", ")", "{", "vbar", ".", "addListener", "(", "SWT", ".", "Selection", ",", "new", "Listener", "(", ")", "{", "@", "Override", "public", "void", "handleEvent", "(", "Event", "arg0", ")", "{", "binContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "hexContent", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "counter", ".", "setTopIndex", "(", "txt", ".", "getTopIndex", "(", ")", ")", ";", "}", "}", ")", ";", "}", "}", "}", "</s>" ]
1,985
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabFolder", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "StyledText", ";", "public", "class", "CTabItemWithStyledText", "extends", "CTabItem", "{", "private", "StyledText", "styledText", ";", "public", "CTabItemWithStyledText", "(", "CTabFolder", "parent", ",", "String", "name", ",", "int", "style", ")", "{", "this", "(", "parent", ",", "style", ")", ";", "this", ".", "setText", "(", "name", ")", ";", "}", "public", "CTabItemWithStyledText", "(", "CTabFolder", "parent", ",", "int", "style", ")", "{", "super", "(", "parent", ",", "style", ")", ";", "this", ".", "styledText", "=", "new", "StyledText", "(", "parent", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "V_SCROLL", "|", "SWT", ".", "H_SCROLL", ")", ";", "this", ".", "setData", "(", "StyledText", ".", "class", ".", "getName", "(", ")", ",", "this", ".", "styledText", ")", ";", "this", ".", "styledText", ".", "setEditable", "(", "true", ")", ";", "this", ".", "setControl", "(", "this", ".", "styledText", ")", ";", "parent", ".", "setSelection", "(", "this", ")", ";", "}", "public", "StyledText", "getStyledText", "(", ")", "{", "return", "styledText", ";", "}", "public", "void", "setStyledText", "(", "StyledText", "styledText", ")", "{", "this", ".", "styledText", "=", "styledText", ";", "}", "}", "</s>" ]
1,986
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabFolder", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Tree", ";", "public", "class", "CTabItemWithTree", "extends", "CTabItem", "{", "private", "Tree", "tree", ";", "public", "CTabItemWithTree", "(", "CTabFolder", "parent", ",", "int", "style", ")", "{", "super", "(", "parent", ",", "style", ")", ";", "this", ".", "tree", "=", "new", "Tree", "(", "parent", ",", "SWT", ".", "BORDER", ")", ";", "this", ".", "setControl", "(", "tree", ")", ";", "this", ".", "setData", "(", "Tree", ".", "class", ".", "getName", "(", ")", ",", "this", ".", "tree", ")", ";", "this", ".", "setControl", "(", "this", ".", "tree", ")", ";", "}", "public", "Tree", "getTree", "(", ")", "{", "return", "tree", ";", "}", "public", "void", "setTree", "(", "Tree", "tree", ")", "{", "this", ".", "tree", "=", "tree", ";", "}", "}", "</s>" ]
1,987
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Table", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableColumn", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableItem", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "adb", ".", "AdbWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "packagemanager", ".", "PackageBean", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "Gui", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "GuiWorkshop", ";", "public", "class", "ApkTable", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "ApkTable", ".", "class", ")", ";", "private", "Table", "table", ";", "public", "ApkTable", "(", "Composite", "parent", ")", "{", "this", "(", "parent", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "FULL_SELECTION", ")", ";", "}", "public", "ApkTable", "(", "Composite", "parent", ",", "int", "style", ")", "{", "this", ".", "table", "=", "new", "Table", "(", "parent", ",", "style", ")", ";", "table", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "table", ".", "setBounds", "(", "0", ",", "0", ",", "3", ",", "19", ")", ";", "table", ".", "setHeaderVisible", "(", "true", ")", ";", "table", ".", "setLinesVisible", "(", "true", ")", ";", "final", "TableColumn", "tblclmnApk", "=", "new", "TableColumn", "(", "table", ",", "SWT", ".", "NONE", ")", ";", "tblclmnApk", ".", "setWidth", "(", "200", ")", ";", "tblclmnApk", ".", "setText", "(", "\"APK\"", ")", ";", "final", "TableColumn", "tblclmnPackage", "=", "new", "TableColumn", "(", "table", ",", "SWT", ".", "NONE", ")", ";", "tblclmnPackage", ".", "setWidth", "(", "300", ")", ";", "tblclmnPackage", ".", "setText", "(", "\"Package\"", ")", ";", "final", "String", "[", "]", "keys", "=", "{", "PackageBean", ".", "class", ".", "getName", "(", ")", "}", ";", "GuiWorkshop", ".", "addColumnSorter", "(", "table", ",", "tblclmnApk", ",", "0", ",", "keys", ")", ";", "GuiWorkshop", ".", "addColumnSorter", "(", "table", ",", "tblclmnPackage", ",", "1", ",", "keys", ")", ";", "}", "public", "void", "loadPackages", "(", ")", "{", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "List", "<", "PackageBean", ">", "packageBeans", "=", "AdbWorkshop", ".", "listPackages", "(", ")", ";", "loadPackagesGui", "(", "packageBeans", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "}", "}", ")", ".", "start", "(", ")", ";", "}", "private", "void", "loadPackagesGui", "(", "List", "<", "PackageBean", ">", "packages", ")", "{", "table", ".", "getDisplay", "(", ")", ".", "asyncExec", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "table", ".", "removeAll", "(", ")", ";", "try", "{", "List", "<", "PackageBean", ">", "beans", "=", "AdbWorkshop", ".", "listPackages", "(", ")", ";", "for", "(", "PackageBean", "bean", ":", "beans", ")", "{", "String", "apk", "=", "bean", ".", "getApk", "(", ")", ".", "substring", "(", "bean", ".", "getApk", "(", ")", ".", "lastIndexOf", "(", "'/'", ")", "+", "1", ",", "bean", ".", "getApk", "(", ")", ".", "length", "(", ")", ")", ";", "TableItem", "tableItem", "=", "new", "TableItem", "(", "table", ",", "SWT", ".", "NONE", ")", ";", "tableItem", ".", "setText", "(", "new", "String", "[", "]", "{", "apk", ",", "bean", ".", "getClazz", "(", ")", "}", ")", ";", "tableItem", ".", "setData", "(", "PackageBean", ".", "class", ".", "getName", "(", ")", ",", "bean", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageError", "(", "table", ".", "getShell", "(", ")", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", ")", ";", "}", "public", "Table", "getTable", "(", ")", "{", "return", "table", ";", "}", "public", "void", "setTable", "(", "Table", "table", ")", "{", "this", ".", "table", "=", "table", ";", "}", "}", "</s>" ]
1,988
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ".", "runnable", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Tree", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TreeItem", ";", "import", "org", ".", "eclipse", ".", "wb", ".", "swt", ".", "SWTResourceManager", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "OterStatics", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "fs", ".", "FsNode", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "Gui", ";", "public", "class", "FsListToTreeRunnable", "implements", "Runnable", "{", "private", "List", "<", "FsNode", ">", "fs", ";", "private", "Tree", "tree", ";", "public", "FsListToTreeRunnable", "(", "List", "<", "FsNode", ">", "fs", ",", "Tree", "tree", ")", "{", "this", ".", "fs", "=", "fs", ";", "this", ".", "tree", "=", "tree", ";", "}", "public", "void", "run", "(", ")", "{", "tree", ".", "removeAll", "(", ")", ";", "for", "(", "FsNode", "node", ":", "fs", ")", "{", "TreeItem", "trtmTest", "=", "new", "TreeItem", "(", "tree", ",", "SWT", ".", "NONE", ")", ";", "trtmTest", ".", "setData", "(", "FsNode", ".", "class", ".", "getName", "(", ")", ",", "node", ")", ";", "if", "(", "node", ".", "isLink", "(", ")", ")", "trtmTest", ".", "setText", "(", "node", ".", "getName", "(", ")", "+", "\"", "->", "\"", "+", "node", ".", "getLink", "(", ")", ")", ";", "else", "trtmTest", ".", "setText", "(", "node", ".", "getName", "(", ")", ")", ";", "if", "(", "node", ".", "isDirectory", "(", ")", ")", "{", "addDirectory", "(", "trtmTest", ",", "node", ")", ";", "trtmTest", ".", "setImage", "(", "SWTResourceManager", ".", "getImage", "(", "Gui", ".", "class", ",", "OterStatics", ".", "ICON_DIRECTORY", ")", ")", ";", "}", "else", "{", "trtmTest", ".", "setImage", "(", "SWTResourceManager", ".", "getImage", "(", "Gui", ".", "class", ",", "OterStatics", ".", "ICON_FILE", ")", ")", ";", "}", "}", "}", "private", "void", "addDirectory", "(", "TreeItem", "ti", ",", "FsNode", "node", ")", "{", "for", "(", "FsNode", "child", ":", "node", ".", "getChildren", "(", ")", ")", "{", "TreeItem", "trtmTest", "=", "new", "TreeItem", "(", "ti", ",", "SWT", ".", "NONE", ")", ";", "trtmTest", ".", "setData", "(", "FsNode", ".", "class", ".", "getName", "(", ")", ",", "child", ")", ";", "trtmTest", ".", "setText", "(", "child", ".", "getName", "(", ")", ")", ";", "if", "(", "child", ".", "isDirectory", "(", ")", ")", "{", "trtmTest", ".", "setImage", "(", "SWTResourceManager", ".", "getImage", "(", "Gui", ".", "class", ",", "OterStatics", ".", "ICON_DIRECTORY", ")", ")", ";", "addDirectory", "(", "trtmTest", ",", "child", ")", ";", "}", "else", "{", "trtmTest", ".", "setImage", "(", "SWTResourceManager", ".", "getImage", "(", "Gui", ".", "class", ",", "OterStatics", ".", "ICON_FILE", ")", ")", ";", "}", "}", "}", "}", "</s>" ]
1,989
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ".", "runnable", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "StyledText", ";", "public", "class", "FileToStyledTextRunnable", "implements", "Runnable", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "FileToStyledTextRunnable", ".", "class", ")", ";", "private", "File", "f", ";", "private", "StyledText", "styledText", ";", "public", "FileToStyledTextRunnable", "(", "File", "f", ",", "StyledText", "styledText", ")", "{", "this", ".", "f", "=", "f", ";", "this", ".", "styledText", "=", "styledText", ";", "}", "@", "Override", "public", "void", "run", "(", ")", "{", "logger", ".", "debug", "(", "\"\"", "+", "f", ".", "getAbsolutePath", "(", ")", "+", "\")\"", ")", ";", "try", "{", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "f", ")", ")", ";", "char", "[", "]", "buf", "=", "new", "char", "[", "2048", "]", ";", "String", "file", "=", "\"\"", ";", "while", "(", "in", ".", "ready", "(", ")", ")", "{", "in", ".", "read", "(", "buf", ")", ";", "file", "=", "file", "+", "new", "String", "(", "buf", ")", ";", "}", "styledText", ".", "setText", "(", "file", ")", ";", "logger", ".", "debug", "(", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "styledText", ".", "setText", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "</s>" ]
1,990
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabFolder", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TreeItem", ";", "import", "org", ".", "eclipse", ".", "wb", ".", "swt", ".", "SWTResourceManager", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ".", "AndroidManifestAttribute", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ".", "AndroidManifestElement", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ".", "AndroidManifestNamespace", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "aapt", ".", "androidmanifest", ".", "AndroidManifestObject", ";", "public", "class", "CTabItemWithTreeForAndroidManifest", "extends", "CTabItemWithTree", "{", "public", "CTabItemWithTreeForAndroidManifest", "(", "CTabFolder", "parent", ",", "int", "style", ")", "{", "super", "(", "parent", ",", "style", ")", ";", "}", "public", "void", "loadAndroidManifestObjects", "(", "AndroidManifestObject", "root", ")", "{", "this", ".", "getTree", "(", ")", ".", "removeAll", "(", ")", ";", "loadRecur", "(", "root", ",", "null", ")", ";", "}", "private", "void", "loadRecur", "(", "AndroidManifestObject", "o", ",", "TreeItem", "parent", ")", "{", "TreeItem", "ti", "=", "null", ";", "if", "(", "parent", "==", "null", ")", "{", "ti", "=", "new", "TreeItem", "(", "this", ".", "getTree", "(", ")", ",", "SWT", ".", "NONE", ")", ";", "}", "else", "{", "ti", "=", "new", "TreeItem", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", "}", "if", "(", "o", "instanceof", "AndroidManifestElement", ")", "{", "AndroidManifestElement", "e", "=", "(", "AndroidManifestElement", ")", "o", ";", "ti", ".", "setText", "(", "e", ".", "getName", "(", ")", ")", ";", "if", "(", "e", ".", "getName", "(", ")", ".", "equalsIgnoreCase", "(", "\"\"", ")", ")", "{", "ti", ".", "setForeground", "(", "SWTResourceManager", ".", "getColor", "(", "SWT", ".", "COLOR_GREEN", ")", ")", ";", "}", "else", "if", "(", "e", ".", "getName", "(", ")", ".", "equalsIgnoreCase", "(", "\"activity\"", ")", ")", "{", "ti", ".", "setForeground", "(", "SWTResourceManager", ".", "getColor", "(", "SWT", ".", "COLOR_BLUE", ")", ")", ";", "}", "else", "if", "(", "e", ".", "getName", "(", ")", ".", "equalsIgnoreCase", "(", "\"receiver\"", ")", "||", "e", ".", "getName", "(", ")", ".", "equalsIgnoreCase", "(", "\"provider\"", ")", ")", "{", "ti", ".", "setForeground", "(", "SWTResourceManager", ".", "getColor", "(", "SWT", ".", "COLOR_RED", ")", ")", ";", "}", "}", "else", "if", "(", "o", "instanceof", "AndroidManifestNamespace", ")", "{", "AndroidManifestNamespace", "n", "=", "(", "AndroidManifestNamespace", ")", "o", ";", "ti", ".", "setText", "(", "n", ".", "getName", "(", ")", "+", "\"=\"", "+", "n", ".", "getValue", "(", ")", ")", ";", "}", "else", "if", "(", "o", "instanceof", "AndroidManifestAttribute", ")", "{", "AndroidManifestAttribute", "a", "=", "(", "AndroidManifestAttribute", ")", "o", ";", "if", "(", "a", ".", "getRaw", "(", ")", ".", "equals", "(", "\"\"", ")", "&&", "a", ".", "getType", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "ti", ".", "setText", "(", "a", ".", "getName", "(", ")", "+", "\"=\"", "+", "a", ".", "getValue", "(", ")", ")", ";", "}", "else", "if", "(", "a", ".", "getRaw", "(", ")", ".", "equals", "(", "\"\"", ")", "&&", "!", "a", ".", "getType", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "ti", ".", "setText", "(", "a", ".", "getName", "(", ")", "+", "\"[\"", "+", "a", ".", "getType", "(", ")", "+", "\"]=\"", "+", "a", ".", "getValue", "(", ")", ")", ";", "}", "else", "if", "(", "!", "a", ".", "getRaw", "(", ")", ".", "equals", "(", "\"\"", ")", "&&", "a", ".", "getType", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "ti", ".", "setText", "(", "a", ".", "getName", "(", ")", "+", "\"[\"", "+", "a", ".", "getRaw", "(", ")", "+", "\"]=\"", "+", "a", ".", "getValue", "(", ")", ")", ";", "}", "else", "{", "ti", ".", "setText", "(", "a", ".", "getName", "(", ")", "+", "\"[\"", "+", "a", ".", "getType", "(", ")", "+", "\":\"", "+", "a", ".", "getRaw", "(", ")", "+", "\"]=\"", "+", "a", ".", "getValue", "(", ")", ")", ";", "}", "}", "String", "attributes", "=", "\"", "[\"", ";", "for", "(", "AndroidManifestObject", "child", ":", "o", ".", "getChildren", "(", ")", ")", "{", "if", "(", "child", "instanceof", "AndroidManifestAttribute", ")", "{", "AndroidManifestAttribute", "a", "=", "(", "AndroidManifestAttribute", ")", "child", ";", "attributes", "=", "attributes", "+", "a", ".", "getName", "(", ")", "+", "\"=\"", "+", "a", ".", "getValue", "(", ")", "+", "\",", "\"", ";", "}", "else", "{", "loadRecur", "(", "child", ",", "ti", ")", ";", "}", "}", "if", "(", "!", "attributes", ".", "equals", "(", "\"", "[\"", ")", ")", "{", "ti", ".", "setText", "(", "ti", ".", "getText", "(", ")", "+", "attributes", ".", "substring", "(", "0", ",", "attributes", ".", "length", "(", ")", "-", "2", ")", "+", "\"]\"", ")", ";", "}", "ti", ".", "setExpanded", "(", "true", ")", ";", "}", "}", "</s>" ]
1,991
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabFolder", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabItem", ";", "public", "class", "CTabItemWithTreeTest", "extends", "CTabItem", "{", "public", "CTabItemWithTreeTest", "(", "CTabFolder", "arg0", ",", "int", "arg1", ")", "{", "super", "(", "arg0", ",", "arg1", ")", ";", "}", "}", "</s>" ]
1,992
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "sql", ".", "SQLException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabFolder", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "SashForm", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Table", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableColumn", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Tree", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TreeItem", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "sqlite", ".", "SqliteHelper", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "GuiWorkshop", ";", "public", "class", "CTabItemWithDatabase", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "CTabItemWithDatabase", ".", "class", ")", ";", "private", "CTabItem", "cTabItem", ";", "private", "CTabFolder", "parent", ";", "private", "String", "name", ";", "private", "SashForm", "databaseSashForm", ";", "private", "Tree", "tablesTree", ";", "private", "Table", "contentsTable", ";", "private", "SqliteHelper", "db", ";", "public", "CTabItemWithDatabase", "(", "CTabFolder", "parent", ",", "String", "name", ",", "File", "file", ",", "int", "style", ")", "throws", "ClassNotFoundException", ",", "SQLException", "{", "this", ".", "parent", "=", "parent", ";", "this", ".", "name", "=", "name", ";", "this", ".", "db", "=", "new", "SqliteHelper", "(", "file", ")", ";", "cTabItem", "=", "new", "CTabItem", "(", "parent", ",", "style", ")", ";", "cTabItem", ".", "setText", "(", "name", ")", ";", "databaseSashForm", "=", "new", "SashForm", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", "cTabItem", ".", "setControl", "(", "databaseSashForm", ")", ";", "tablesTree", "=", "new", "Tree", "(", "databaseSashForm", ",", "SWT", ".", "BORDER", ")", ";", "tablesTree", ".", "setHeaderVisible", "(", "true", ")", ";", "tablesTree", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "loadTableData", "(", "tablesTree", ".", "getSelection", "(", ")", "[", "0", "]", ".", "getText", "(", ")", ")", ";", "}", "}", ")", ";", "contentsTable", "=", "new", "Table", "(", "databaseSashForm", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "FULL_SELECTION", ")", ";", "contentsTable", ".", "setHeaderVisible", "(", "true", ")", ";", "contentsTable", ".", "setLinesVisible", "(", "true", ")", ";", "databaseSashForm", ".", "setWeights", "(", "new", "int", "[", "]", "{", "1", ",", "3", "}", ")", ";", "parent", ".", "setSelection", "(", "cTabItem", ")", ";", "loadTables", "(", ")", ";", "}", "public", "void", "loadTableData", "(", "final", "String", "tableName", ")", "{", "parent", ".", "getDisplay", "(", ")", ".", "asyncExec", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "try", "{", "contentsTable", ".", "removeAll", "(", ")", ";", "for", "(", "TableColumn", "c", ":", "contentsTable", ".", "getColumns", "(", ")", ")", "{", "c", ".", "dispose", "(", ")", ";", "}", "List", "<", "String", ">", "columns", "=", "db", ".", "getTableColumnNames", "(", "tableName", ")", ";", "if", "(", "columns", ".", "size", "(", ")", ">", "0", ")", "{", "for", "(", "String", "colName", ":", "columns", ")", "{", "TableColumn", "column", "=", "new", "TableColumn", "(", "contentsTable", ",", "SWT", ".", "NONE", ")", ";", "column", ".", "setText", "(", "colName", ")", ";", "column", ".", "pack", "(", ")", ";", "column", ".", "setWidth", "(", "column", ".", "getWidth", "(", ")", "+", "20", ")", ";", "}", "}", "List", "<", "List", "<", "String", ">", ">", "data", "=", "db", ".", "getTableData", "(", "tableName", ")", ";", "for", "(", "List", "<", "String", ">", "row", ":", "data", ")", "{", "TableItem", "tableItem", "=", "new", "TableItem", "(", "contentsTable", ",", "SWT", ".", "NONE", ")", ";", "tableItem", ".", "setText", "(", "row", ".", "toArray", "(", "new", "String", "[", "row", ".", "size", "(", ")", "]", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "}", "}", ")", ";", "}", "public", "void", "loadTables", "(", ")", "{", "parent", ".", "getDisplay", "(", ")", ".", "asyncExec", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "try", "{", "List", "<", "String", ">", "tables", "=", "db", ".", "getTables", "(", ")", ";", "tablesTree", ".", "removeAll", "(", ")", ";", "for", "(", "String", "table", ":", "tables", ")", "{", "TreeItem", "item", "=", "new", "TreeItem", "(", "tablesTree", ",", "SWT", ".", "NONE", ")", ";", "item", ".", "setText", "(", "table", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "cTabItem", ".", "dispose", "(", ")", ";", "GuiWorkshop", ".", "messageError", "(", "parent", ".", "getShell", "(", ")", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", ")", ";", "}", "public", "CTabItem", "getcTabItem", "(", ")", "{", "return", "cTabItem", ";", "}", "public", "void", "setcTabItem", "(", "CTabItem", "cTabItem", ")", "{", "this", ".", "cTabItem", "=", "cTabItem", ";", "}", "public", "CTabFolder", "getParent", "(", ")", "{", "return", "parent", ";", "}", "public", "void", "setParent", "(", "CTabFolder", "parent", ")", "{", "this", ".", "parent", "=", "parent", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "SashForm", "getDatabaseSashForm", "(", ")", "{", "return", "databaseSashForm", ";", "}", "public", "void", "setDatabaseSashForm", "(", "SashForm", "databaseSashForm", ")", "{", "this", ".", "databaseSashForm", "=", "databaseSashForm", ";", "}", "public", "Tree", "getTablesTree", "(", ")", "{", "return", "tablesTree", ";", "}", "public", "void", "setTablesTree", "(", "Tree", "tablesTree", ")", "{", "this", ".", "tablesTree", "=", "tablesTree", ";", "}", "public", "Table", "getContentsTable", "(", ")", "{", "return", "contentsTable", ";", "}", "public", "void", "setContentsTable", "(", "Table", "contentsTable", ")", "{", "this", ".", "contentsTable", "=", "contentsTable", ";", "}", "}", "</s>" ]
1,993
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ";", "import", "java", ".", "io", ".", "File", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabFolder", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "SashForm", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "StyledText", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "DisposeEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "DisposeListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseWheelListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "graphics", ".", "Point", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "FillLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "FormAttachment", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "FormData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "FormLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Button", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Display", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Label", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Menu", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "MenuItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Shell", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Table", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableColumn", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Text", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Tree", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TreeColumn", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TreeItem", ";", "import", "org", ".", "eclipse", ".", "wb", ".", "swt", ".", "SWTResourceManager", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "OterStatics", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "OterWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "adb", ".", "AdbWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "avd", ".", "AvdController", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "command", ".", "BackgroundCommand", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "fs", ".", "FsDiffController", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "fs", ".", "FsNode", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "javatosmali", ".", "JavaToSmaliController", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "logcat", ".", "LogCatController", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "packagemanager", ".", "PackageBean", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "packagemanager", ".", "PackageManagerController", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "smali", ".", "SmaliController", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "styler", ".", "SmaliLineStyler", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "bean", ".", "BuildAndSignApkBean", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "bean", ".", "CreateAvdBean", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ".", "ApkTable", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "view", ".", "widgets", ".", "CTabItemWithTreeForAndroidManifest", ";", "public", "class", "Gui", "{", "protected", "Shell", "shlOterTool", ";", "private", "Display", "display", ";", "private", "Label", "statusLabel", ";", "private", "Table", "logcatTable", ";", "private", "Text", "logcatTextFilter", ";", "private", "LogCatController", "logcatController", ";", "private", "Button", "logcatCheckAutoscroll", ";", "private", "Button", "logcatCheckDebug", ";", "private", "Button", "logcatCheckInfo", ";", "private", "Button", "logcatCheckWarn", ";", "private", "Button", "logcatCheckError", ";", "private", "Button", "logcatCheckVerbose", ";", "private", "FsDiffController", "fsDiffController", ";", "private", "Tree", "fsDifferencesTree", ";", "private", "Tree", "fsDiffFirstTree", ";", "private", "Tree", "fsDiffSecondTree", ";", "private", "SashForm", "fsDiffSashForm", ";", "private", "SmaliController", "smaliController", ";", "private", "Tree", "smaliTree", ";", "private", "CTabFolder", "smaliTabFolder", ";", "private", "Text", "smaliSearchText", ";", "private", "Table", "smaliSearchTable", ";", "private", "Button", "smaliSearchIgnoreCase", ";", "private", "Button", "smaliSearchRegex", ";", "private", "CTabItem", "smaliTabSearchTab", ";", "private", "AvdController", "avdController", ";", "private", "PackageManagerController", "packageManagerController", ";", "private", "StyledText", "packageManagerStyledText", ";", "private", "ApkTable", "apkTable", ";", "private", "CTabFolder", "packageManagerTabFolder", ";", "private", "Tree", "packageManagerFilesTree", ";", "private", "CTabFolder", "packageManagerFilesTabs", ";", "private", "CTabItemWithTreeForAndroidManifest", "packageManagerAndroidManifestTab", ";", "private", "JavaToSmaliController", "javaToSmaliController", ";", "private", "StyledText", "javaToSmaliSmaliStyledText", ";", "private", "StyledText", "javaToSmaliJavaStyledText", ";", "private", "CTabFolder", "tabFolder", ";", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "Gui", ".", "class", ")", ";", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "Display", ".", "setAppName", "(", "\"Otertool\"", ")", ";", "try", "{", "Gui", "window", "=", "new", "Gui", "(", ")", ";", "window", ".", "open", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "void", "open", "(", ")", "{", "this", ".", "display", "=", "Display", ".", "getDefault", "(", ")", ";", "createControllers", "(", ")", ";", "createContents", "(", ")", ";", "shlOterTool", ".", "open", "(", ")", ";", "shlOterTool", ".", "layout", "(", ")", ";", "loadConfig", "(", ")", ";", "while", "(", "!", "shlOterTool", ".", "isDisposed", "(", ")", ")", "{", "if", "(", "!", "display", ".", "readAndDispatch", "(", ")", ")", "{", "display", ".", "sleep", "(", ")", ";", "}", "}", "}", "public", "void", "createControllers", "(", ")", "{", "logcatController", "=", "new", "LogCatController", "(", "this", ")", ";", "avdController", "=", "new", "AvdController", "(", "this", ")", ";", "fsDiffController", "=", "new", "FsDiffController", "(", "this", ")", ";", "smaliController", "=", "new", "SmaliController", "(", "this", ")", ";", "packageManagerController", "=", "new", "PackageManagerController", "(", "this", ")", ";", "javaToSmaliController", "=", "new", "JavaToSmaliController", "(", "this", ")", ";", "}", "public", "void", "loadConfig", "(", ")", "{", "if", "(", "OterStatics", ".", "getAndroidHome", "(", ")", "==", "null", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "\"\"", ")", ";", "new", "ConfigurationDialog", "(", "shlOterTool", ")", ".", "open", "(", ")", ";", "}", "}", "protected", "void", "createContents", "(", ")", "{", "shlOterTool", "=", "new", "Shell", "(", ")", ";", "shlOterTool", ".", "setImage", "(", "SWTResourceManager", ".", "getImage", "(", "Gui", ".", "class", ",", "OterStatics", ".", "ICON_APP", ")", ")", ";", "shlOterTool", ".", "addDisposeListener", "(", "new", "DisposeListener", "(", ")", "{", "public", "void", "widgetDisposed", "(", "DisposeEvent", "arg0", ")", "{", "try", "{", "logcatController", ".", "stop", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}", ")", ";", "shlOterTool", ".", "setMinimumSize", "(", "new", "Point", "(", "550", ",", "250", ")", ")", ";", "shlOterTool", ".", "setSize", "(", "1000", ",", "600", ")", ";", "shlOterTool", ".", "setText", "(", "\"Otertool\"", ")", ";", "shlOterTool", ".", "setLayout", "(", "new", "FormLayout", "(", ")", ")", ";", "Menu", "menu", "=", "new", "Menu", "(", "shlOterTool", ",", "SWT", ".", "BAR", ")", ";", "shlOterTool", ".", "setMenuBar", "(", "menu", ")", ";", "MenuItem", "mntmFile", "=", "new", "MenuItem", "(", "menu", ",", "SWT", ".", "CASCADE", ")", ";", "mntmFile", ".", "setText", "(", "\"File\"", ")", ";", "Menu", "menu_1", "=", "new", "Menu", "(", "mntmFile", ")", ";", "mntmFile", ".", "setMenu", "(", "menu_1", ")", ";", "MenuItem", "mntmConfigure", "=", "new", "MenuItem", "(", "menu_1", ",", "SWT", ".", "NONE", ")", ";", "mntmConfigure", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "Object", "ret", "=", "new", "ConfigurationDialog", "(", "shlOterTool", ")", ".", "open", "(", ")", ";", "}", "}", ")", ";", "mntmConfigure", ".", "setText", "(", "\"Configure\"", ")", ";", "new", "MenuItem", "(", "menu_1", ",", "SWT", ".", "SEPARATOR", ")", ";", "MenuItem", "mntmExit", "=", "new", "MenuItem", "(", "menu_1", ",", "SWT", ".", "NONE", ")", ";", "mntmExit", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "System", ".", "exit", "(", "0", ")", ";", "}", "}", ")", ";", "mntmExit", ".", "setText", "(", "\"Exit\"", ")", ";", "MenuItem", "mntmLogcat", "=", "new", "MenuItem", "(", "menu", ",", "SWT", ".", "CASCADE", ")", ";", "mntmLogcat", ".", "setText", "(", "\"LogCat\"", ")", ";", "Menu", "menu_2", "=", "new", "Menu", "(", "mntmLogcat", ")", ";", "mntmLogcat", ".", "setMenu", "(", "menu_2", ")", ";", "MenuItem", "mntmStart", "=", "new", "MenuItem", "(", "menu_2", ",", "SWT", ".", "NONE", ")", ";", "mntmStart", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "try", "{", "logcatController", ".", "start", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "}", "}", ")", ";", "mntmStart", ".", "setText", "(", "\"Start\"", ")", ";", "MenuItem", "mntmStop", "=", "new", "MenuItem", "(", "menu_2", ",", "SWT", ".", "NONE", ")", ";", "mntmStop", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatController", ".", "stop", "(", ")", ";", "}", "}", ")", ";", "mntmStop", ".", "setText", "(", "\"Stop\"", ")", ";", "new", "MenuItem", "(", "menu_2", ",", "SWT", ".", "SEPARATOR", ")", ";", "MenuItem", "mntmClear", "=", "new", "MenuItem", "(", "menu_2", ",", "SWT", ".", "NONE", ")", ";", "mntmClear", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatTable", ".", "removeAll", "(", ")", ";", "}", "}", ")", ";", "mntmClear", ".", "setText", "(", "\"Clear\"", ")", ";", "MenuItem", "mntmFsdiff", "=", "new", "MenuItem", "(", "menu", ",", "SWT", ".", "CASCADE", ")", ";", "mntmFsdiff", ".", "setText", "(", "\"FsDiff\"", ")", ";", "Menu", "menu_3", "=", "new", "Menu", "(", "mntmFsdiff", ")", ";", "mntmFsdiff", ".", "setMenu", "(", "menu_3", ")", ";", "MenuItem", "mntmScanFirst", "=", "new", "MenuItem", "(", "menu_3", ",", "SWT", ".", "NONE", ")", ";", "mntmScanFirst", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "try", "{", "fsDiffController", ".", "scanFirst", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "}", "}", ")", ";", "mntmScanFirst", ".", "setText", "(", "\"Scan", "First\"", ")", ";", "MenuItem", "mntmScanSecond", "=", "new", "MenuItem", "(", "menu_3", ",", "SWT", ".", "NONE", ")", ";", "mntmScanSecond", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "try", "{", "fsDiffController", ".", "scanSecond", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "}", "}", ")", ";", "mntmScanSecond", ".", "setText", "(", "\"Scan", "Second\"", ")", ";", "MenuItem", "mntmGenerateDifferences", "=", "new", "MenuItem", "(", "menu_3", ",", "SWT", ".", "NONE", ")", ";", "mntmGenerateDifferences", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "fsDiffController", ".", "generateDifferences", "(", ")", ";", "}", "}", ")", ";", "mntmGenerateDifferences", ".", "setText", "(", "\"\"", ")", ";", "new", "MenuItem", "(", "menu_3", ",", "SWT", ".", "SEPARATOR", ")", ";", "MenuItem", "mntmClear_1", "=", "new", "MenuItem", "(", "menu_3", ",", "SWT", ".", "NONE", ")", ";", "mntmClear_1", ".", "setText", "(", "\"Clear\"", ")", ";", "MenuItem", "mntmApktool", "=", "new", "MenuItem", "(", "menu", ",", "SWT", ".", "CASCADE", ")", ";", "mntmApktool", ".", "setText", "(", "\"Smali\"", ")", ";", "Menu", "menu_4", "=", "new", "Menu", "(", "mntmApktool", ")", ";", "mntmApktool", ".", "setMenu", "(", "menu_4", ")", ";", "MenuItem", "mntmLoadFile", "=", "new", "MenuItem", "(", "menu_4", ",", "SWT", ".", "NONE", ")", ";", "mntmLoadFile", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "String", "file", "=", "GuiWorkshop", ".", "selectFile", "(", "shlOterTool", ",", "new", "String", "[", "]", "{", "\"*.apk\"", "}", ")", ";", "if", "(", "file", "!=", "null", ")", "{", "smaliController", ".", "loadApk", "(", "new", "File", "(", "file", ")", ")", ";", "}", "}", "}", ")", ";", "mntmLoadFile", ".", "setText", "(", "\"Load", "APK\"", ")", ";", "MenuItem", "mntmLoadApkDevice", "=", "new", "MenuItem", "(", "menu_4", ",", "SWT", ".", "NONE", ")", ";", "mntmLoadApkDevice", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "PackageBean", "apkBean", "=", "new", "LoadApkFromDeviceDialog", "(", "shlOterTool", ")", ".", "open", "(", ")", ";", "if", "(", "apkBean", "!=", "null", ")", "{", "smaliController", ".", "loadApkFromDevice", "(", "apkBean", ")", ";", "}", "}", "}", ")", ";", "mntmLoadApkDevice", ".", "setText", "(", "\"\"", ")", ";", "MenuItem", "mntmBuild", "=", "new", "MenuItem", "(", "menu_4", ",", "SWT", ".", "NONE", ")", ";", "mntmBuild", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "if", "(", "smaliController", ".", "unsavedFilesOpen", "(", ")", "==", "true", ")", "{", "int", "save", "=", "GuiWorkshop", ".", "yesNoDialog", "(", "getShell", "(", ")", ",", "\"\"", ",", "\"\"", ")", ";", "if", "(", "save", "==", "SWT", ".", "NO", ")", "{", "return", ";", "}", "}", "BuildAndSignApkBean", "bean", "=", "new", "BuildAndSignApkDialog", "(", "getShell", "(", ")", ")", ".", "open", "(", ")", ";", "if", "(", "bean", "!=", "null", "&&", "bean", ".", "getApkFilename", "(", ")", "!=", "null", ")", "{", "if", "(", "bean", ".", "isSign", "(", ")", ")", "{", "if", "(", "bean", ".", "getApkFilename", "(", ")", "!=", "null", "&&", "bean", ".", "getCertAlias", "(", ")", "!=", "null", "&&", "bean", ".", "getCertFilename", "(", ")", "!=", "null", "&&", "bean", ".", "getPassword", "(", ")", "!=", "null", ")", "{", "setStatus", "(", "\"\"", "+", "bean", ".", "getApkFilename", "(", ")", ")", ";", "smaliController", ".", "rebuildAndSignApk", "(", "bean", ")", ";", "}", "}", "else", "{", "smaliController", ".", "rebuildApk", "(", "bean", ".", "getApkFilename", "(", ")", ")", ";", "}", "}", "}", "}", ")", ";", "mntmBuild", ".", "setText", "(", "\"Build", "APK...\"", ")", ";", "MenuItem", "mntmJavaToSmali", "=", "new", "MenuItem", "(", "menu", ",", "SWT", ".", "CASCADE", ")", ";", "mntmJavaToSmali", ".", "setText", "(", "\"\"", ")", ";", "Menu", "menu_8", "=", "new", "Menu", "(", "mntmJavaToSmali", ")", ";", "mntmJavaToSmali", ".", "setMenu", "(", "menu_8", ")", ";", "MenuItem", "mntmCompile", "=", "new", "MenuItem", "(", "menu_8", ",", "SWT", ".", "NONE", ")", ";", "mntmCompile", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "javaToSmaliController", ".", "tryToCompileJava", "(", "javaToSmaliJavaStyledText", ",", "javaToSmaliSmaliStyledText", ")", ";", "}", "}", ")", ";", "mntmCompile", ".", "setText", "(", "\"\"", ")", ";", "new", "MenuItem", "(", "menu_8", ",", "SWT", ".", "SEPARATOR", ")", ";", "MenuItem", "mntmConfigureClasspath", "=", "new", "MenuItem", "(", "menu_8", ",", "SWT", ".", "NONE", ")", ";", "mntmConfigureClasspath", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "Object", "ret", "=", "new", "ConfigurationDialog", "(", "shlOterTool", ")", ".", "open", "(", ")", ";", "}", "}", ")", ";", "mntmConfigureClasspath", ".", "setText", "(", "\"\"", ")", ";", "MenuItem", "mntmAddAndroidjarTo", "=", "new", "MenuItem", "(", "menu_8", ",", "SWT", ".", "NONE", ")", ";", "mntmAddAndroidjarTo", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "try", "{", "OterWorkshop", ".", "addAndroidjarToClasspath", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "e", ".", "getMessage", "(", ")", ")", ";", "return", ";", "}", "GuiWorkshop", ".", "messageDialog", "(", "shlOterTool", ",", "\"\"", ")", ";", "}", "}", ")", ";", "mntmAddAndroidjarTo", ".", "setText", "(", "\"\"", ")", ";", "MenuItem", "mntmTools", "=", "new", "MenuItem", "(", "menu", ",", "SWT", ".", "CASCADE", ")", ";", "mntmTools", ".", "setText", "(", "\"Tools\"", ")", ";", "Menu", "menu_6", "=", "new", "Menu", "(", "mntmTools", ")", ";", "mntmTools", ".", "setMenu", "(", "menu_6", ")", ";", "MenuItem", "mntmLaunchAndroid", "=", "new", "MenuItem", "(", "menu_6", ",", "SWT", ".", "NONE", ")", ";", "mntmLaunchAndroid", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "setStatus", "(", "\"\"", ")", ";", "BackgroundCommand", "c", "=", "new", "BackgroundCommand", "(", "OterStatics", ".", "getAndroidCommand", "(", ")", ")", ";", "try", "{", "c", ".", "execute", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "clearStatus", "(", ")", ";", "}", "}", ")", ";", "mntmLaunchAndroid", ".", "setText", "(", "\"\"", ")", ";", "MenuItem", "mntmRestartAdb", "=", "new", "MenuItem", "(", "menu_6", ",", "SWT", ".", "NONE", ")", ";", "mntmRestartAdb", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "setStatus", "(", "\"\"", ")", ";", "try", "{", "AdbWorkshop", ".", "restartAdb", "(", ")", ";", "GuiWorkshop", ".", "messageDialog", "(", "shlOterTool", ",", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "clearStatus", "(", ")", ";", "}", "}", ")", ";", "mntmRestartAdb", ".", "setText", "(", "\"Restart", "ADB\"", ")", ";", "MenuItem", "mntmInstallCertificate", "=", "new", "MenuItem", "(", "menu_6", ",", "SWT", ".", "NONE", ")", ";", "mntmInstallCertificate", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "String", "certfile", "=", "GuiWorkshop", ".", "selectFile", "(", "shlOterTool", ",", "new", "String", "[", "]", "{", "\"*\"", "}", ")", ";", "if", "(", "certfile", "!=", "null", ")", "{", "setStatus", "(", "\"\"", "+", "certfile", ")", ";", "try", "{", "AdbWorkshop", ".", "installCert", "(", "new", "File", "(", "certfile", ")", ",", "\"changeit\"", ")", ";", "GuiWorkshop", ".", "messageDialog", "(", "shlOterTool", ",", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "clearStatus", "(", ")", ";", "}", "}", "}", ")", ";", "mntmInstallCertificate", ".", "setText", "(", "\"\"", ")", ";", "MenuItem", "mntmInstallApk", "=", "new", "MenuItem", "(", "menu_6", ",", "SWT", ".", "NONE", ")", ";", "mntmInstallApk", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "installApk", "(", ")", ";", "}", "}", ")", ";", "mntmInstallApk", ".", "setText", "(", "\"Install", "APK\"", ")", ";", "MenuItem", "mntmCreateAvd", "=", "new", "MenuItem", "(", "menu_6", ",", "SWT", ".", "NONE", ")", ";", "mntmCreateAvd", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "CreateAvdBean", "ret", "=", "new", "CreateAvdDialog", "(", "getShell", "(", ")", ")", ".", "open", "(", ")", ";", "if", "(", "ret", "!=", "null", ")", "{", "avdController", ".", "createAvd", "(", "ret", ")", ";", "}", "}", "}", ")", ";", "mntmCreateAvd", ".", "setText", "(", "\"\"", ")", ";", "tabFolder", "=", "new", "CTabFolder", "(", "shlOterTool", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "BOTTOM", ")", ";", "tabFolder", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "String", "selectedTab", "=", "tabFolder", ".", "getSelection", "(", ")", ".", "getText", "(", ")", ";", "if", "(", "selectedTab", ".", "equals", "(", "\"\"", ")", ")", "{", "if", "(", "packageManagerTabFolder", ".", "getSelection", "(", ")", "==", "null", ")", "{", "packageManagerTabFolder", ".", "setSelection", "(", "0", ")", ";", "}", "if", "(", "apkTable", ".", "getTable", "(", ")", ".", "getItemCount", "(", ")", "==", "0", ")", "{", "apkTable", ".", "loadPackages", "(", ")", ";", "}", "}", "else", "if", "(", "selectedTab", ".", "equals", "(", "\"Smali\"", ")", ")", "{", "if", "(", "smaliTabFolder", ".", "getSelection", "(", ")", "==", "null", ")", "{", "smaliTabFolder", ".", "setSelection", "(", "0", ")", ";", "}", "}", "}", "}", ")", ";", "FormData", "fd_tabFolder", "=", "new", "FormData", "(", ")", ";", "fd_tabFolder", ".", "top", "=", "new", "FormAttachment", "(", "0", ",", "3", ")", ";", "fd_tabFolder", ".", "right", "=", "new", "FormAttachment", "(", "100", ")", ";", "fd_tabFolder", ".", "left", "=", "new", "FormAttachment", "(", "0", ",", "3", ")", ";", "tabFolder", ".", "setLayoutData", "(", "fd_tabFolder", ")", ";", "tabFolder", ".", "setSimple", "(", "false", ")", ";", "tabFolder", ".", "setSelectionBackground", "(", "Display", ".", "getCurrent", "(", ")", ".", "getSystemColor", "(", "SWT", ".", "COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT", ")", ")", ";", "CTabItem", "tbtmLogcat", "=", "new", "CTabItem", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmLogcat", ".", "setText", "(", "\"LogCat\"", ")", ";", "Composite", "composite", "=", "new", "Composite", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmLogcat", ".", "setControl", "(", "composite", ")", ";", "composite", ".", "setLayout", "(", "new", "GridLayout", "(", "1", ",", "false", ")", ")", ";", "Composite", "composite_1", "=", "new", "Composite", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_1", "=", "new", "GridLayout", "(", "3", ",", "false", ")", ";", "gl_composite_1", ".", "horizontalSpacing", "=", "0", ";", "gl_composite_1", ".", "marginHeight", "=", "0", ";", "gl_composite_1", ".", "marginWidth", "=", "0", ";", "gl_composite_1", ".", "verticalSpacing", "=", "0", ";", "composite_1", ".", "setLayout", "(", "gl_composite_1", ")", ";", "composite_1", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "TOP", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "Composite", "composite_11", "=", "new", "Composite", "(", "composite_1", ",", "SWT", ".", "NONE", ")", ";", "composite_11", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "GridLayout", "gl_composite_11", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_11", ".", "horizontalSpacing", "=", "0", ";", "gl_composite_11", ".", "marginHeight", "=", "0", ";", "gl_composite_11", ".", "marginWidth", "=", "0", ";", "gl_composite_11", ".", "verticalSpacing", "=", "0", ";", "composite_11", ".", "setLayout", "(", "gl_composite_11", ")", ";", "Label", "lblFilter", "=", "new", "Label", "(", "composite_11", ",", "SWT", ".", "HORIZONTAL", ")", ";", "lblFilter", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "2", ",", "1", ")", ")", ";", "lblFilter", ".", "setText", "(", "\"\"", ")", ";", "logcatTextFilter", "=", "new", "Text", "(", "composite_11", ",", "SWT", ".", "BORDER", ")", ";", "logcatTextFilter", ".", "addKeyListener", "(", "new", "KeyAdapter", "(", ")", "{", "@", "Override", "public", "void", "keyReleased", "(", "KeyEvent", "arg0", ")", "{", "logcatController", ".", "reFilterTable", "(", ")", ";", "}", "}", ")", ";", "logcatTextFilter", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "Composite", "composite_2", "=", "new", "Composite", "(", "composite_1", ",", "SWT", ".", "NONE", ")", ";", "composite_2", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "BOTTOM", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "GridLayout", "gl_composite_2", "=", "new", "GridLayout", "(", "8", ",", "false", ")", ";", "gl_composite_2", ".", "verticalSpacing", "=", "0", ";", "gl_composite_2", ".", "horizontalSpacing", "=", "0", ";", "gl_composite_2", ".", "marginWidth", "=", "0", ";", "gl_composite_2", ".", "marginHeight", "=", "0", ";", "composite_2", ".", "setLayout", "(", "gl_composite_2", ")", ";", "logcatCheckDebug", "=", "new", "Button", "(", "composite_2", ",", "SWT", ".", "CHECK", ")", ";", "logcatCheckDebug", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatController", ".", "reFilterTable", "(", ")", ";", "}", "}", ")", ";", "logcatCheckDebug", ".", "setSize", "(", "57", ",", "18", ")", ";", "logcatCheckDebug", ".", "setSelection", "(", "true", ")", ";", "logcatCheckDebug", ".", "setText", "(", "\"Debug\"", ")", ";", "logcatCheckInfo", "=", "new", "Button", "(", "composite_2", ",", "SWT", ".", "CHECK", ")", ";", "logcatCheckInfo", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatController", ".", "reFilterTable", "(", ")", ";", "}", "}", ")", ";", "logcatCheckInfo", ".", "setSize", "(", "43", ",", "18", ")", ";", "logcatCheckInfo", ".", "setSelection", "(", "true", ")", ";", "logcatCheckInfo", ".", "setText", "(", "\"Info\"", ")", ";", "logcatCheckWarn", "=", "new", "Button", "(", "composite_2", ",", "SWT", ".", "CHECK", ")", ";", "logcatCheckWarn", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatController", ".", "reFilterTable", "(", ")", ";", "}", "}", ")", ";", "logcatCheckWarn", ".", "setSize", "(", "49", ",", "18", ")", ";", "logcatCheckWarn", ".", "setSelection", "(", "true", ")", ";", "logcatCheckWarn", ".", "setText", "(", "\"Warn\"", ")", ";", "logcatCheckError", "=", "new", "Button", "(", "composite_2", ",", "SWT", ".", "CHECK", ")", ";", "logcatCheckError", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatController", ".", "reFilterTable", "(", ")", ";", "}", "}", ")", ";", "logcatCheckError", ".", "setSize", "(", "49", ",", "18", ")", ";", "logcatCheckError", ".", "setSelection", "(", "true", ")", ";", "logcatCheckError", ".", "setText", "(", "\"Error\"", ")", ";", "logcatCheckVerbose", "=", "new", "Button", "(", "composite_2", ",", "SWT", ".", "CHECK", ")", ";", "logcatCheckVerbose", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatController", ".", "reFilterTable", "(", ")", ";", "}", "}", ")", ";", "logcatCheckVerbose", ".", "setSize", "(", "66", ",", "18", ")", ";", "logcatCheckVerbose", ".", "setSelection", "(", "true", ")", ";", "logcatCheckVerbose", ".", "setText", "(", "\"Verbose\"", ")", ";", "new", "Label", "(", "composite_2", ",", "SWT", ".", "NONE", ")", ";", "new", "Label", "(", "composite_2", ",", "SWT", ".", "NONE", ")", ";", "this", ".", "logcatCheckAutoscroll", "=", "new", "Button", "(", "composite_2", ",", "SWT", ".", "CHECK", ")", ";", "logcatCheckAutoscroll", ".", "setSize", "(", "83", ",", "18", ")", ";", "logcatCheckAutoscroll", ".", "setSelection", "(", "true", ")", ";", "logcatCheckAutoscroll", ".", "setText", "(", "\"Auto-scroll\"", ")", ";", "Composite", "composite_12", "=", "new", "Composite", "(", "composite_1", ",", "SWT", ".", "NONE", ")", ";", "composite_12", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "LEFT", ",", "SWT", ".", "BOTTOM", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "GridLayout", "gl_composite_12", "=", "new", "GridLayout", "(", "4", ",", "false", ")", ";", "gl_composite_12", ".", "marginLeft", "=", "5", ";", "gl_composite_12", ".", "verticalSpacing", "=", "0", ";", "gl_composite_12", ".", "marginWidth", "=", "0", ";", "gl_composite_12", ".", "horizontalSpacing", "=", "0", ";", "gl_composite_12", ".", "marginHeight", "=", "0", ";", "composite_12", ".", "setLayout", "(", "gl_composite_12", ")", ";", "Button", "btnClear", "=", "new", "Button", "(", "composite_12", ",", "SWT", ".", "NONE", ")", ";", "btnClear", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatTable", ".", "removeAll", "(", ")", ";", "}", "}", ")", ";", "btnClear", ".", "setText", "(", "\"Clear\"", ")", ";", "Button", "btnStart", "=", "new", "Button", "(", "composite_12", ",", "SWT", ".", "NONE", ")", ";", "btnStart", ".", "addSelectionListener", "(", "new", "SelectionListener", "(", ")", "{", "public", "void", "widgetDefaultSelected", "(", "SelectionEvent", "arg0", ")", "{", "}", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "try", "{", "logcatController", ".", "start", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "}", "}", ")", ";", "btnStart", ".", "setText", "(", "\"Start\"", ")", ";", "Button", "btnStop", "=", "new", "Button", "(", "composite_12", ",", "SWT", ".", "NONE", ")", ";", "btnStop", ".", "addSelectionListener", "(", "new", "SelectionListener", "(", ")", "{", "public", "void", "widgetDefaultSelected", "(", "SelectionEvent", "arg0", ")", "{", "}", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatController", ".", "stop", "(", ")", ";", "}", "}", ")", ";", "btnStop", ".", "setText", "(", "\"Stop\"", ")", ";", "new", "Label", "(", "composite_12", ",", "SWT", ".", "NONE", ")", ";", "logcatTable", "=", "new", "Table", "(", "composite", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "FULL_SELECTION", "|", "SWT", ".", "MULTI", ")", ";", "logcatTable", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "false", ",", "true", ",", "1", ",", "1", ")", ")", ";", "logcatTable", ".", "addMouseWheelListener", "(", "new", "MouseWheelListener", "(", ")", "{", "public", "void", "mouseScrolled", "(", "MouseEvent", "arg0", ")", "{", "}", "}", ")", ";", "logcatTable", ".", "addSelectionListener", "(", "new", "SelectionListener", "(", ")", "{", "public", "void", "widgetDefaultSelected", "(", "SelectionEvent", "arg0", ")", "{", "}", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatController", ".", "stopAutoscroll", "(", ")", ";", "}", "}", ")", ";", "logcatTable", ".", "setHeaderVisible", "(", "true", ")", ";", "logcatTable", ".", "setLinesVisible", "(", "true", ")", ";", "TableColumn", "tblclmnDate", "=", "new", "TableColumn", "(", "logcatTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnDate", ".", "setWidth", "(", "111", ")", ";", "tblclmnDate", ".", "setText", "(", "\"Timestamp\"", ")", ";", "TableColumn", "tblclmnNewColumn", "=", "new", "TableColumn", "(", "logcatTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnNewColumn", ".", "setWidth", "(", "55", ")", ";", "tblclmnNewColumn", ".", "setText", "(", "\"Level\"", ")", ";", "TableColumn", "tblclmnClass", "=", "new", "TableColumn", "(", "logcatTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnClass", ".", "setWidth", "(", "86", ")", ";", "tblclmnClass", ".", "setText", "(", "\"Class\"", ")", ";", "TableColumn", "tblclmnPid", "=", "new", "TableColumn", "(", "logcatTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnPid", ".", "setWidth", "(", "34", ")", ";", "tblclmnPid", ".", "setText", "(", "\"PID\"", ")", ";", "TableColumn", "tblclmnMessage", "=", "new", "TableColumn", "(", "logcatTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnMessage", ".", "setWidth", "(", "600", ")", ";", "tblclmnMessage", ".", "setText", "(", "\"Message\"", ")", ";", "Menu", "menu_7", "=", "new", "Menu", "(", "logcatTable", ")", ";", "logcatTable", ".", "setMenu", "(", "menu_7", ")", ";", "MenuItem", "mntmCopy", "=", "new", "MenuItem", "(", "menu_7", ",", "SWT", ".", "NONE", ")", ";", "mntmCopy", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatController", ".", "copy", "(", ")", ";", "}", "}", ")", ";", "mntmCopy", ".", "setText", "(", "\"Copy\"", ")", ";", "MenuItem", "mntmCle", "=", "new", "MenuItem", "(", "menu_7", ",", "SWT", ".", "NONE", ")", ";", "mntmCle", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logcatTable", ".", "removeAll", "(", ")", ";", "}", "}", ")", ";", "mntmCle", ".", "setText", "(", "\"Clear\"", ")", ";", "statusLabel", "=", "new", "Label", "(", "shlOterTool", ",", "SWT", ".", "NONE", ")", ";", "fd_tabFolder", ".", "bottom", "=", "new", "FormAttachment", "(", "statusLabel", ",", "-", "6", ")", ";", "CTabItem", "tbtmFsdiff", "=", "new", "CTabItem", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmFsdiff", ".", "setText", "(", "\"FsDiff\"", ")", ";", "Composite", "composite_5", "=", "new", "Composite", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmFsdiff", ".", "setControl", "(", "composite_5", ")", ";", "composite_5", ".", "setLayout", "(", "new", "FillLayout", "(", "SWT", ".", "HORIZONTAL", ")", ")", ";", "fsDiffSashForm", "=", "new", "SashForm", "(", "composite_5", ",", "SWT", ".", "NONE", ")", ";", "Composite", "composite_6", "=", "new", "Composite", "(", "fsDiffSashForm", ",", "SWT", ".", "NONE", ")", ";", "composite_6", ".", "setLayout", "(", "new", "FormLayout", "(", ")", ")", ";", "Label", "lblFirst", "=", "new", "Label", "(", "composite_6", ",", "SWT", ".", "NONE", ")", ";", "FormData", "fd_lblFirst", "=", "new", "FormData", "(", ")", ";", "fd_lblFirst", ".", "top", "=", "new", "FormAttachment", "(", "1", ")", ";", "fd_lblFirst", ".", "left", "=", "new", "FormAttachment", "(", "0", ")", ";", "lblFirst", ".", "setLayoutData", "(", "fd_lblFirst", ")", ";", "lblFirst", ".", "setText", "(", "\"First\"", ")", ";", "fsDiffFirstTree", "=", "new", "Tree", "(", "composite_6", ",", "SWT", ".", "BORDER", ")", ";", "FormData", "fd_tree_2", "=", "new", "FormData", "(", ")", ";", "fd_tree_2", ".", "bottom", "=", "new", "FormAttachment", "(", "100", ")", ";", "fd_tree_2", ".", "right", "=", "new", "FormAttachment", "(", "100", ")", ";", "fd_tree_2", ".", "top", "=", "new", "FormAttachment", "(", "lblFirst", ",", "0", ")", ";", "fd_tree_2", ".", "left", "=", "new", "FormAttachment", "(", "0", ")", ";", "fsDiffFirstTree", ".", "setLayoutData", "(", "fd_tree_2", ")", ";", "Composite", "composite_7", "=", "new", "Composite", "(", "fsDiffSashForm", ",", "SWT", ".", "NONE", ")", ";", "composite_7", ".", "setLayout", "(", "new", "FormLayout", "(", ")", ")", ";", "Label", "lblSecond", "=", "new", "Label", "(", "composite_7", ",", "SWT", ".", "NONE", ")", ";", "FormData", "fd_lblSecond", "=", "new", "FormData", "(", ")", ";", "fd_lblSecond", ".", "top", "=", "new", "FormAttachment", "(", "1", ")", ";", "fd_lblSecond", ".", "left", "=", "new", "FormAttachment", "(", "0", ")", ";", "lblSecond", ".", "setLayoutData", "(", "fd_lblSecond", ")", ";", "lblSecond", ".", "setText", "(", "\"Second\"", ")", ";", "fsDiffSecondTree", "=", "new", "Tree", "(", "composite_7", ",", "SWT", ".", "BORDER", ")", ";", "FormData", "fd_tree_3", "=", "new", "FormData", "(", ")", ";", "fd_tree_3", ".", "bottom", "=", "new", "FormAttachment", "(", "100", ")", ";", "fd_tree_3", ".", "right", "=", "new", "FormAttachment", "(", "100", ")", ";", "fd_tree_3", ".", "top", "=", "new", "FormAttachment", "(", "lblSecond", ",", "0", ")", ";", "fd_tree_3", ".", "left", "=", "new", "FormAttachment", "(", "lblSecond", ",", "0", ",", "SWT", ".", "LEFT", ")", ";", "fsDiffSecondTree", ".", "setLayoutData", "(", "fd_tree_3", ")", ";", "Composite", "composite_8", "=", "new", "Composite", "(", "fsDiffSashForm", ",", "SWT", ".", "NONE", ")", ";", "composite_8", ".", "setLayout", "(", "new", "FormLayout", "(", ")", ")", ";", "Label", "lblDifferences", "=", "new", "Label", "(", "composite_8", ",", "SWT", ".", "NONE", ")", ";", "FormData", "fd_lblDifferences", "=", "new", "FormData", "(", ")", ";", "fd_lblDifferences", ".", "top", "=", "new", "FormAttachment", "(", "1", ")", ";", "fd_lblDifferences", ".", "left", "=", "new", "FormAttachment", "(", "0", ")", ";", "lblDifferences", ".", "setLayoutData", "(", "fd_lblDifferences", ")", ";", "lblDifferences", ".", "setText", "(", "\"Differences\"", ")", ";", "fsDifferencesTree", "=", "new", "Tree", "(", "composite_8", ",", "SWT", ".", "BORDER", ")", ";", "fsDifferencesTree", ".", "setHeaderVisible", "(", "true", ")", ";", "FormData", "fd_tree_4", "=", "new", "FormData", "(", ")", ";", "fd_tree_4", ".", "bottom", "=", "new", "FormAttachment", "(", "100", ")", ";", "fd_tree_4", ".", "right", "=", "new", "FormAttachment", "(", "100", ")", ";", "fd_tree_4", ".", "top", "=", "new", "FormAttachment", "(", "lblDifferences", ",", "0", ")", ";", "fd_tree_4", ".", "left", "=", "new", "FormAttachment", "(", "lblDifferences", ",", "0", ",", "SWT", ".", "LEFT", ")", ";", "fsDifferencesTree", ".", "setLayoutData", "(", "fd_tree_4", ")", ";", "TreeColumn", "trclmnName", "=", "new", "TreeColumn", "(", "fsDifferencesTree", ",", "SWT", ".", "NONE", ")", ";", "trclmnName", ".", "setWidth", "(", "330", ")", ";", "trclmnName", ".", "setText", "(", "\"Name\"", ")", ";", "TreeColumn", "trclmnPermissions", "=", "new", "TreeColumn", "(", "fsDifferencesTree", ",", "SWT", ".", "NONE", ")", ";", "trclmnPermissions", ".", "setWidth", "(", "72", ")", ";", "trclmnPermissions", ".", "setText", "(", "\"Permissions\"", ")", ";", "TreeColumn", "trclmnGroup", "=", "new", "TreeColumn", "(", "fsDifferencesTree", ",", "SWT", ".", "NONE", ")", ";", "trclmnGroup", ".", "setWidth", "(", "50", ")", ";", "trclmnGroup", ".", "setText", "(", "\"Group\"", ")", ";", "TreeColumn", "trclmnUser", "=", "new", "TreeColumn", "(", "fsDifferencesTree", ",", "SWT", ".", "NONE", ")", ";", "trclmnUser", ".", "setWidth", "(", "50", ")", ";", "trclmnUser", ".", "setText", "(", "\"User\"", ")", ";", "TreeColumn", "trclmnSize", "=", "new", "TreeColumn", "(", "fsDifferencesTree", ",", "SWT", ".", "NONE", ")", ";", "trclmnSize", ".", "setWidth", "(", "40", ")", ";", "trclmnSize", ".", "setText", "(", "\"Size\"", ")", ";", "TreeColumn", "trclmnModified", "=", "new", "TreeColumn", "(", "fsDifferencesTree", ",", "SWT", ".", "NONE", ")", ";", "trclmnModified", ".", "setWidth", "(", "140", ")", ";", "trclmnModified", ".", "setText", "(", "\"Modified\"", ")", ";", "fsDiffSashForm", ".", "setWeights", "(", "new", "int", "[", "]", "{", "1", ",", "1", ",", "3", "}", ")", ";", "CTabItem", "tbtmApktool", "=", "new", "CTabItem", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmApktool", ".", "setText", "(", "\"Smali\"", ")", ";", "Composite", "composite_3", "=", "new", "Composite", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmApktool", ".", "setControl", "(", "composite_3", ")", ";", "composite_3", ".", "setLayout", "(", "new", "FillLayout", "(", "SWT", ".", "HORIZONTAL", ")", ")", ";", "SashForm", "sashForm_1", "=", "new", "SashForm", "(", "composite_3", ",", "SWT", ".", "NONE", ")", ";", "smaliTree", "=", "new", "Tree", "(", "sashForm_1", ",", "SWT", ".", "BORDER", ")", ";", "smaliTree", ".", "setLinesVisible", "(", "true", ")", ";", "smaliTree", ".", "setHeaderVisible", "(", "true", ")", ";", "smaliTree", ".", "addMouseListener", "(", "new", "MouseAdapter", "(", ")", "{", "@", "Override", "public", "void", "mouseDoubleClick", "(", "MouseEvent", "arg0", ")", "{", "TreeItem", "items", "[", "]", "=", "smaliTree", ".", "getSelection", "(", ")", ";", "if", "(", "items", ".", "length", ">", "0", ")", "{", "TreeItem", "sel", "=", "items", "[", "0", "]", ";", "if", "(", "sel", ".", "getItemCount", "(", ")", "==", "0", ")", "{", "String", "name", "=", "sel", ".", "getText", "(", ")", ";", "setStatus", "(", "\"Loading:", "\"", "+", "name", ")", ";", "TreeItem", "parent", "=", "sel", ".", "getParentItem", "(", ")", ";", "String", "pkg", "=", "(", "parent", "==", "null", ")", "?", "\"\"", ":", "parent", ".", "getText", "(", ")", ";", "smaliController", ".", "loadSmaliSource", "(", "pkg", ",", "name", ")", ";", "}", "else", "{", "sel", ".", "setExpanded", "(", "true", ")", ";", "}", "clearStatus", "(", ")", ";", "}", "}", "}", ")", ";", "smaliTabFolder", "=", "new", "CTabFolder", "(", "sashForm_1", ",", "SWT", ".", "BORDER", ")", ";", "smaliTabFolder", ".", "setSimple", "(", "false", ")", ";", "smaliTabFolder", ".", "setSelectionBackground", "(", "Display", ".", "getCurrent", "(", ")", ".", "getSystemColor", "(", "SWT", ".", "COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT", ")", ")", ";", "smaliTabSearchTab", "=", "new", "CTabItem", "(", "smaliTabFolder", ",", "SWT", ".", "NONE", ")", ";", "smaliTabSearchTab", ".", "setText", "(", "\"Search\"", ")", ";", "Composite", "composite_9", "=", "new", "Composite", "(", "smaliTabFolder", ",", "SWT", ".", "NONE", ")", ";", "smaliTabSearchTab", ".", "setControl", "(", "composite_9", ")", ";", "GridLayout", "gl_composite_9", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_9", ".", "marginTop", "=", "5", ";", "gl_composite_9", ".", "verticalSpacing", "=", "0", ";", "gl_composite_9", ".", "marginHeight", "=", "0", ";", "gl_composite_9", ".", "horizontalSpacing", "=", "0", ";", "composite_9", ".", "setLayout", "(", "gl_composite_9", ")", ";", "smaliSearchText", "=", "new", "Text", "(", "composite_9", ",", "SWT", ".", "BORDER", ")", ";", "smaliSearchText", ".", "addKeyListener", "(", "new", "KeyAdapter", "(", ")", "{", "@", "Override", "public", "void", "keyPressed", "(", "KeyEvent", "arg0", ")", "{", "if", "(", "arg0", ".", "character", "==", "13", ")", "{", "smaliController", ".", "search", "(", ")", ";", "}", "}", "}", ")", ";", "smaliSearchText", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "Composite", "composite_10", "=", "new", "Composite", "(", "composite_9", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_10", "=", "new", "GridLayout", "(", "2", ",", "false", ")", ";", "gl_composite_10", ".", "marginBottom", "=", "5", ";", "gl_composite_10", ".", "marginHeight", "=", "0", ";", "gl_composite_10", ".", "verticalSpacing", "=", "0", ";", "gl_composite_10", ".", "marginWidth", "=", "0", ";", "gl_composite_10", ".", "horizontalSpacing", "=", "0", ";", "composite_10", ".", "setLayout", "(", "gl_composite_10", ")", ";", "smaliSearchIgnoreCase", "=", "new", "Button", "(", "composite_10", ",", "SWT", ".", "CHECK", ")", ";", "smaliSearchIgnoreCase", ".", "setBounds", "(", "0", ",", "0", ",", "93", ",", "18", ")", ";", "smaliSearchIgnoreCase", ".", "setText", "(", "\"Ignore", "Case\"", ")", ";", "smaliSearchRegex", "=", "new", "Button", "(", "composite_10", ",", "SWT", ".", "CHECK", ")", ";", "smaliSearchRegex", ".", "setBounds", "(", "0", ",", "0", ",", "93", ",", "18", ")", ";", "smaliSearchRegex", ".", "setText", "(", "\"Regex\"", ")", ";", "smaliSearchTable", "=", "new", "Table", "(", "composite_9", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "FULL_SELECTION", ")", ";", "smaliSearchTable", ".", "addMouseListener", "(", "new", "MouseAdapter", "(", ")", "{", "@", "Override", "public", "void", "mouseDoubleClick", "(", "MouseEvent", "arg0", ")", "{", "TableItem", "[", "]", "selected", "=", "smaliSearchTable", ".", "getSelection", "(", ")", ";", "if", "(", "selected", ".", "length", ">", "0", ")", "{", "smaliController", ".", "loadSmaliSourceWithLineNumber", "(", "(", "String", ")", "selected", "[", "0", "]", ".", "getData", "(", "SmaliController", ".", "PACKAGE", ")", ",", "(", "String", ")", "selected", "[", "0", "]", ".", "getData", "(", "SmaliController", ".", "NAME", ")", ",", "(", "(", "Integer", ")", "selected", "[", "0", "]", ".", "getData", "(", "SmaliController", ".", "LINENUMBER", ")", ")", ".", "intValue", "(", ")", ")", ";", "}", "}", "}", ")", ";", "smaliSearchTable", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "smaliSearchTable", ".", "setBounds", "(", "0", ",", "0", ",", "3", ",", "19", ")", ";", "smaliSearchTable", ".", "setHeaderVisible", "(", "true", ")", ";", "smaliSearchTable", ".", "setLinesVisible", "(", "true", ")", ";", "TableColumn", "tblclmnClass_1", "=", "new", "TableColumn", "(", "smaliSearchTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnClass_1", ".", "setWidth", "(", "200", ")", ";", "tblclmnClass_1", ".", "setText", "(", "\"Class\"", ")", ";", "TableColumn", "tblclmnContents", "=", "new", "TableColumn", "(", "smaliSearchTable", ",", "SWT", ".", "NONE", ")", ";", "tblclmnContents", ".", "setWidth", "(", "750", ")", ";", "tblclmnContents", ".", "setText", "(", "\"Contents\"", ")", ";", "StyledText", "styledText", "=", "new", "StyledText", "(", "smaliTabFolder", ",", "SWT", ".", "BORDER", ")", ";", "sashForm_1", ".", "setWeights", "(", "new", "int", "[", "]", "{", "1", ",", "5", "}", ")", ";", "CTabItem", "tbtmJavaToSmali", "=", "new", "CTabItem", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmJavaToSmali", ".", "setText", "(", "\"\"", ")", ";", "Composite", "composite_13", "=", "new", "Composite", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmJavaToSmali", ".", "setControl", "(", "composite_13", ")", ";", "composite_13", ".", "setLayout", "(", "new", "FillLayout", "(", "SWT", ".", "HORIZONTAL", ")", ")", ";", "SashForm", "sashForm", "=", "new", "SashForm", "(", "composite_13", ",", "SWT", ".", "NONE", ")", ";", "Composite", "composite_14", "=", "new", "Composite", "(", "sashForm", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_14", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_14", ".", "verticalSpacing", "=", "0", ";", "gl_composite_14", ".", "marginWidth", "=", "0", ";", "gl_composite_14", ".", "marginHeight", "=", "0", ";", "gl_composite_14", ".", "horizontalSpacing", "=", "0", ";", "composite_14", ".", "setLayout", "(", "gl_composite_14", ")", ";", "Label", "lblJava", "=", "new", "Label", "(", "composite_14", ",", "SWT", ".", "NONE", ")", ";", "lblJava", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblJava", ".", "setText", "(", "\"Java\"", ")", ";", "javaToSmaliJavaStyledText", "=", "new", "StyledText", "(", "composite_14", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "WRAP", "|", "SWT", ".", "H_SCROLL", "|", "SWT", ".", "V_SCROLL", ")", ";", "javaToSmaliJavaStyledText", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "javaToSmaliJavaStyledText", ".", "setText", "(", "\"\"", ")", ";", "Composite", "composite_15", "=", "new", "Composite", "(", "sashForm", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_15", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_15", ".", "marginHeight", "=", "0", ";", "gl_composite_15", ".", "verticalSpacing", "=", "0", ";", "gl_composite_15", ".", "marginWidth", "=", "0", ";", "gl_composite_15", ".", "horizontalSpacing", "=", "0", ";", "composite_15", ".", "setLayout", "(", "gl_composite_15", ")", ";", "Label", "lblSmali", "=", "new", "Label", "(", "composite_15", ",", "SWT", ".", "NONE", ")", ";", "lblSmali", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "CENTER", ",", "true", ",", "false", ",", "1", ",", "1", ")", ")", ";", "lblSmali", ".", "setText", "(", "\"Smali\"", ")", ";", "javaToSmaliSmaliStyledText", "=", "new", "StyledText", "(", "composite_15", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "WRAP", "|", "SWT", ".", "H_SCROLL", "|", "SWT", ".", "V_SCROLL", ")", ";", "javaToSmaliSmaliStyledText", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "javaToSmaliSmaliStyledText", ".", "addLineStyleListener", "(", "new", "SmaliLineStyler", "(", ")", ")", ";", "sashForm", ".", "setWeights", "(", "new", "int", "[", "]", "{", "1", ",", "1", "}", ")", ";", "CTabItem", "tbtmPackageManager", "=", "new", "CTabItem", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmPackageManager", ".", "setText", "(", "\"\"", ")", ";", "Composite", "composite_4", "=", "new", "Composite", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmPackageManager", ".", "setControl", "(", "composite_4", ")", ";", "composite_4", ".", "setLayout", "(", "new", "FillLayout", "(", "SWT", ".", "HORIZONTAL", ")", ")", ";", "SashForm", "packageManagerSashForm", "=", "new", "SashForm", "(", "composite_4", ",", "SWT", ".", "NONE", ")", ";", "apkTable", "=", "new", "ApkTable", "(", "packageManagerSashForm", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "FULL_SELECTION", "|", "SWT", ".", "MULTI", ")", ";", "apkTable", ".", "getTable", "(", ")", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "logger", ".", "debug", "(", "apkTable", ".", "getTable", "(", ")", ".", "getSelection", "(", ")", ".", "length", ")", ";", "packageManagerController", ".", "loadPackageDetails", "(", "apkTable", ".", "getTable", "(", ")", ".", "getSelection", "(", ")", ")", ";", "}", "}", ")", ";", "Menu", "menu_5", "=", "new", "Menu", "(", "apkTable", ".", "getTable", "(", ")", ")", ";", "apkTable", ".", "getTable", "(", ")", ".", "setMenu", "(", "menu_5", ")", ";", "MenuItem", "mntmInstall", "=", "new", "MenuItem", "(", "menu_5", ",", "SWT", ".", "NONE", ")", ";", "mntmInstall", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "installApk", "(", ")", ";", "apkTable", ".", "loadPackages", "(", ")", ";", "}", "}", ")", ";", "mntmInstall", ".", "setText", "(", "\"Install", "APK\"", ")", ";", "MenuItem", "mntmUninstall", "=", "new", "MenuItem", "(", "menu_5", ",", "SWT", ".", "NONE", ")", ";", "mntmUninstall", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "setStatus", "(", "\"\"", "+", "apkTable", ".", "getTable", "(", ")", ".", "getSelection", "(", ")", "[", "0", "]", ".", "getText", "(", "0", ")", ")", ";", "packageManagerController", ".", "uninstallPackages", "(", "apkTable", ".", "getTable", "(", ")", ".", "getSelection", "(", ")", ")", ";", "clearStatus", "(", ")", ";", "apkTable", ".", "loadPackages", "(", ")", ";", "}", "}", ")", ";", "mntmUninstall", ".", "setText", "(", "\"\"", ")", ";", "MenuItem", "mntmPullPackages", "=", "new", "MenuItem", "(", "menu_5", ",", "SWT", ".", "NONE", ")", ";", "mntmPullPackages", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "String", "dir", "=", "GuiWorkshop", ".", "selectDirectory", "(", "shlOterTool", ")", ";", "if", "(", "dir", "!=", "null", ")", "{", "packageManagerController", ".", "pullPackages", "(", "dir", ")", ";", "}", "}", "}", ")", ";", "mntmPullPackages", ".", "setText", "(", "\"\"", ")", ";", "new", "MenuItem", "(", "menu_5", ",", "SWT", ".", "SEPARATOR", ")", ";", "MenuItem", "mntmRefreshList", "=", "new", "MenuItem", "(", "menu_5", ",", "SWT", ".", "NONE", ")", ";", "mntmRefreshList", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "apkTable", ".", "loadPackages", "(", ")", ";", "}", "}", ")", ";", "mntmRefreshList", ".", "setText", "(", "\"Refresh", "List\"", ")", ";", "packageManagerTabFolder", "=", "new", "CTabFolder", "(", "packageManagerSashForm", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "FLAT", ")", ";", "packageManagerTabFolder", ".", "setSimple", "(", "false", ")", ";", "packageManagerTabFolder", ".", "setSelectionBackground", "(", "Display", ".", "getCurrent", "(", ")", ".", "getSystemColor", "(", "SWT", ".", "COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT", ")", ")", ";", "CTabItem", "tbtmAapt", "=", "new", "CTabItem", "(", "packageManagerTabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmAapt", ".", "setText", "(", "\"Aapt\"", ")", ";", "Composite", "composite_16", "=", "new", "Composite", "(", "packageManagerTabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmAapt", ".", "setControl", "(", "composite_16", ")", ";", "GridLayout", "gl_composite_16", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_16", ".", "verticalSpacing", "=", "0", ";", "gl_composite_16", ".", "marginWidth", "=", "0", ";", "gl_composite_16", ".", "marginHeight", "=", "0", ";", "gl_composite_16", ".", "horizontalSpacing", "=", "0", ";", "composite_16", ".", "setLayout", "(", "gl_composite_16", ")", ";", "packageManagerStyledText", "=", "new", "StyledText", "(", "composite_16", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "READ_ONLY", "|", "SWT", ".", "H_SCROLL", "|", "SWT", ".", "V_SCROLL", ")", ";", "packageManagerStyledText", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "CTabItem", "tbtmFiles", "=", "new", "CTabItem", "(", "packageManagerTabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmFiles", ".", "setText", "(", "\"Files\"", ")", ";", "SashForm", "sashForm_2", "=", "new", "SashForm", "(", "packageManagerTabFolder", ",", "SWT", ".", "NONE", ")", ";", "tbtmFiles", ".", "setControl", "(", "sashForm_2", ")", ";", "Composite", "composite_17", "=", "new", "Composite", "(", "sashForm_2", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_17", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_17", ".", "verticalSpacing", "=", "0", ";", "gl_composite_17", ".", "marginWidth", "=", "0", ";", "gl_composite_17", ".", "marginHeight", "=", "0", ";", "gl_composite_17", ".", "horizontalSpacing", "=", "0", ";", "composite_17", ".", "setLayout", "(", "gl_composite_17", ")", ";", "packageManagerFilesTree", "=", "new", "Tree", "(", "composite_17", ",", "SWT", ".", "BORDER", ")", ";", "packageManagerFilesTree", ".", "setHeaderVisible", "(", "true", ")", ";", "packageManagerFilesTree", ".", "addMouseListener", "(", "new", "MouseAdapter", "(", ")", "{", "@", "Override", "public", "void", "mouseDoubleClick", "(", "MouseEvent", "arg0", ")", "{", "try", "{", "Tree", "tree", "=", "packageManagerFilesTree", ";", "if", "(", "tree", ".", "getSelectionCount", "(", ")", "==", "1", ")", "{", "TreeItem", "[", "]", "items", "=", "tree", ".", "getSelection", "(", ")", ";", "FsNode", "node", "=", "(", "FsNode", ")", "items", "[", "0", "]", ".", "getData", "(", "FsNode", ".", "class", ".", "getName", "(", ")", ")", ";", "for", "(", "CTabItem", "cti", ":", "packageManagerFilesTabs", ".", "getItems", "(", ")", ")", "{", "if", "(", "cti", ".", "getText", "(", ")", ".", "equals", "(", "node", ".", "getName", "(", ")", ")", ")", "{", "packageManagerFilesTabs", ".", "setSelection", "(", "cti", ")", ";", "return", ";", "}", "}", "logger", ".", "debug", "(", "\"\"", "+", "node", ".", "toString", "(", ")", ")", ";", "packageManagerController", ".", "loadFileContentsToTab", "(", "node", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageDialog", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", ")", ";", "packageManagerFilesTree", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "Menu", "menu_9", "=", "new", "Menu", "(", "packageManagerFilesTree", ")", ";", "packageManagerFilesTree", ".", "setMenu", "(", "menu_9", ")", ";", "MenuItem", "mntmSqlite", "=", "new", "MenuItem", "(", "menu_9", ",", "SWT", ".", "NONE", ")", ";", "mntmSqlite", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "if", "(", "packageManagerFilesTree", ".", "getSelectionCount", "(", ")", "==", "1", ")", "{", "try", "{", "TreeItem", "[", "]", "items", "=", "packageManagerFilesTree", ".", "getSelection", "(", ")", ";", "FsNode", "node", "=", "(", "FsNode", ")", "items", "[", "0", "]", ".", "getData", "(", "FsNode", ".", "class", ".", "getName", "(", ")", ")", ";", "packageManagerController", ".", "loadFileContentsToSQLiteTab", "(", "node", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageDialog", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "}", ")", ";", "mntmSqlite", ".", "setText", "(", "\"SQLite", "view\"", ")", ";", "MenuItem", "mntmHexView", "=", "new", "MenuItem", "(", "menu_9", ",", "SWT", ".", "NONE", ")", ";", "mntmHexView", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "if", "(", "packageManagerFilesTree", ".", "getSelectionCount", "(", ")", "==", "1", ")", "{", "try", "{", "TreeItem", "[", "]", "items", "=", "packageManagerFilesTree", ".", "getSelection", "(", ")", ";", "FsNode", "node", "=", "(", "FsNode", ")", "items", "[", "0", "]", ".", "getData", "(", "FsNode", ".", "class", ".", "getName", "(", ")", ")", ";", "packageManagerController", ".", "loadFileContentsToHexTab", "(", "node", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageDialog", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "}", ")", ";", "mntmHexView", ".", "setText", "(", "\"Hex", "view\"", ")", ";", "MenuItem", "mntmTextView", "=", "new", "MenuItem", "(", "menu_9", ",", "SWT", ".", "NONE", ")", ";", "mntmTextView", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "if", "(", "packageManagerFilesTree", ".", "getSelectionCount", "(", ")", "==", "1", ")", "{", "try", "{", "TreeItem", "[", "]", "items", "=", "packageManagerFilesTree", ".", "getSelection", "(", ")", ";", "FsNode", "node", "=", "(", "FsNode", ")", "items", "[", "0", "]", ".", "getData", "(", "FsNode", ".", "class", ".", "getName", "(", ")", ")", ";", "packageManagerController", ".", "loadFileContentsToTextTab", "(", "node", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageDialog", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "}", ")", ";", "mntmTextView", ".", "setText", "(", "\"Text", "view\"", ")", ";", "Composite", "composite_18", "=", "new", "Composite", "(", "sashForm_2", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "gl_composite_18", "=", "new", "GridLayout", "(", "1", ",", "false", ")", ";", "gl_composite_18", ".", "verticalSpacing", "=", "0", ";", "gl_composite_18", ".", "marginWidth", "=", "0", ";", "gl_composite_18", ".", "marginHeight", "=", "0", ";", "gl_composite_18", ".", "horizontalSpacing", "=", "0", ";", "composite_18", ".", "setLayout", "(", "gl_composite_18", ")", ";", "sashForm_2", ".", "setWeights", "(", "new", "int", "[", "]", "{", "197", ",", "525", "}", ")", ";", "packageManagerFilesTabs", "=", "new", "CTabFolder", "(", "composite_18", ",", "SWT", ".", "BORDER", ")", ";", "packageManagerFilesTabs", ".", "setSimple", "(", "false", ")", ";", "packageManagerFilesTabs", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "packageManagerFilesTabs", ".", "setSelectionBackground", "(", "Display", ".", "getCurrent", "(", ")", ".", "getSystemColor", "(", "SWT", ".", "COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT", ")", ")", ";", "packageManagerAndroidManifestTab", "=", "new", "CTabItemWithTreeForAndroidManifest", "(", "packageManagerTabFolder", ",", "SWT", ".", "NONE", ")", ";", "packageManagerAndroidManifestTab", ".", "setText", "(", "\"\"", ")", ";", "packageManagerSashForm", ".", "setWeights", "(", "new", "int", "[", "]", "{", "1", ",", "2", "}", ")", ";", "FormData", "fd_statusLabel", "=", "new", "FormData", "(", ")", ";", "fd_statusLabel", ".", "bottom", "=", "new", "FormAttachment", "(", "100", ",", "-", "2", ")", ";", "fd_statusLabel", ".", "left", "=", "new", "FormAttachment", "(", "tabFolder", ",", "0", ",", "SWT", ".", "LEFT", ")", ";", "fd_statusLabel", ".", "right", "=", "new", "FormAttachment", "(", "100", ")", ";", "statusLabel", ".", "setLayoutData", "(", "fd_statusLabel", ")", ";", "statusLabel", ".", "setText", "(", "\"Welcome\"", ")", ";", "}", "private", "void", "installApk", "(", ")", "{", "setStatus", "(", "\"\"", ")", ";", "String", "file", "=", "GuiWorkshop", ".", "selectFile", "(", "shlOterTool", ",", "new", "String", "[", "]", "{", "\"*.apk\"", "}", ")", ";", "if", "(", "file", "!=", "null", ")", "{", "this", ".", "display", ".", "asyncExec", "(", "new", "InstallApk", "(", "file", ")", ")", ";", "}", "}", "private", "class", "InstallApk", "implements", "Runnable", "{", "private", "String", "file", ";", "public", "InstallApk", "(", "String", "file", ")", "{", "this", ".", "file", "=", "file", ";", "}", "public", "void", "run", "(", ")", "{", "setStatus", "(", "\"\"", "+", "file", ")", ";", "try", "{", "AdbWorkshop", ".", "installApk", "(", "file", ")", ";", "GuiWorkshop", ".", "messageDialog", "(", "shlOterTool", ",", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "clearStatus", "(", ")", ";", "}", "}", "public", "void", "runRunnableAsync", "(", "Runnable", "r", ")", "{", "this", ".", "display", ".", "asyncExec", "(", "r", ")", ";", "}", "public", "void", "messageError", "(", "String", "error", ")", "{", "this", ".", "display", ".", "asyncExec", "(", "new", "MessageErrorRunnable", "(", "shlOterTool", ",", "error", ")", ")", ";", "}", "private", "class", "MessageErrorRunnable", "implements", "Runnable", "{", "private", "Shell", "shlOterTool", ";", "private", "String", "error", ";", "public", "MessageErrorRunnable", "(", "Shell", "shell", ",", "String", "error", ")", "{", "this", ".", "shlOterTool", "=", "shell", ";", "this", ".", "error", "=", "error", ";", "}", "public", "void", "run", "(", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlOterTool", ",", "error", ")", ";", "}", "}", "public", "void", "setSashFormWeights", "(", "SashForm", "sash", ",", "int", "[", "]", "weights", ")", "{", "this", ".", "getDisplay", "(", ")", ".", "asyncExec", "(", "new", "SetSashFormWeights", "(", "sash", ",", "weights", ")", ")", ";", "}", "private", "class", "SetSashFormWeights", "implements", "Runnable", "{", "private", "SashForm", "sash", ";", "private", "int", "[", "]", "weights", ";", "public", "SetSashFormWeights", "(", "SashForm", "sash", ",", "int", "[", "]", "weights", ")", "{", "this", ".", "sash", "=", "sash", ";", "this", ".", "weights", "=", "weights", ";", "}", "public", "void", "run", "(", ")", "{", "sash", ".", "setWeights", "(", "weights", ")", ";", "}", "}", "public", "void", "setStatus", "(", "final", "String", "status", ")", "{", "this", ".", "display", ".", "asyncExec", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "statusLabel", ".", "setText", "(", "status", ")", ";", "statusLabel", ".", "update", "(", ")", ";", "statusLabel", ".", "redraw", "(", ")", ";", "}", "}", ")", ";", "}", "public", "void", "setStatusBlocking", "(", "final", "String", "status", ")", "{", "statusLabel", ".", "setText", "(", "status", ")", ";", "statusLabel", ".", "update", "(", ")", ";", "statusLabel", ".", "redraw", "(", ")", ";", "}", "public", "void", "clearStatus", "(", ")", "{", "setStatus", "(", "\"\"", ")", ";", "}", "public", "class", "SetStatus", "implements", "Runnable", "{", "private", "String", "status", ";", "public", "SetStatus", "(", "String", "status", ")", "{", "this", ".", "status", "=", "status", ";", "}", "public", "void", "run", "(", ")", "{", "getDisplay", "(", ")", ".", "asyncExec", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "statusLabel", ".", "setText", "(", "status", ")", ";", "}", "}", ")", ";", "}", "}", "public", "Table", "getLogcatTable", "(", ")", "{", "return", "logcatTable", ";", "}", "public", "Display", "getDisplay", "(", ")", "{", "return", "display", ";", "}", "public", "Button", "getLogcatCheckAutoscroll", "(", ")", "{", "return", "logcatCheckAutoscroll", ";", "}", "public", "Button", "getLogcatCheckDebug", "(", ")", "{", "return", "logcatCheckDebug", ";", "}", "public", "Button", "getLogcatCheckInfo", "(", ")", "{", "return", "logcatCheckInfo", ";", "}", "public", "Button", "getLogcatCheckWarn", "(", ")", "{", "return", "logcatCheckWarn", ";", "}", "public", "Button", "getLogcatCheckError", "(", ")", "{", "return", "logcatCheckError", ";", "}", "public", "Button", "getLogcatCheckVerbose", "(", ")", "{", "return", "logcatCheckVerbose", ";", "}", "public", "Text", "getLogcatTextFilter", "(", ")", "{", "return", "logcatTextFilter", ";", "}", "public", "Label", "getStatusLabel", "(", ")", "{", "return", "statusLabel", ";", "}", "public", "Tree", "getFsDiffFirstTree", "(", ")", "{", "return", "fsDiffFirstTree", ";", "}", "public", "Tree", "getFsDiffSecondTree", "(", ")", "{", "return", "fsDiffSecondTree", ";", "}", "public", "Tree", "getFsDifferencesTree", "(", ")", "{", "return", "fsDifferencesTree", ";", "}", "public", "Shell", "getShell", "(", ")", "{", "return", "shlOterTool", ";", "}", "public", "SashForm", "getFsDiffSashForm", "(", ")", "{", "return", "fsDiffSashForm", ";", "}", "public", "Tree", "getSmaliTree", "(", ")", "{", "return", "smaliTree", ";", "}", "public", "CTabFolder", "getSmaliTabFolder", "(", ")", "{", "return", "smaliTabFolder", ";", "}", "public", "StyledText", "getPackageManagerStyledText", "(", ")", "{", "return", "packageManagerStyledText", ";", "}", "public", "ApkTable", "getApkTable", "(", ")", "{", "return", "apkTable", ";", "}", "public", "Text", "getSmaliSearchText", "(", ")", "{", "return", "smaliSearchText", ";", "}", "public", "Table", "getSmaliSearchTable", "(", ")", "{", "return", "smaliSearchTable", ";", "}", "public", "Button", "getSmaliSearchIgnoreCase", "(", ")", "{", "return", "smaliSearchIgnoreCase", ";", "}", "public", "Button", "getSmaliSearchRegex", "(", ")", "{", "return", "smaliSearchRegex", ";", "}", "public", "Tree", "getPackageManagerFilesTree", "(", ")", "{", "return", "packageManagerFilesTree", ";", "}", "public", "CTabFolder", "getPackageManagerFilesTabs", "(", ")", "{", "return", "packageManagerFilesTabs", ";", "}", "public", "CTabItem", "getSmaliTabSearchTab", "(", ")", "{", "return", "smaliTabSearchTab", ";", "}", "public", "CTabItemWithTreeForAndroidManifest", "getPackageManagerAndroidManifestTab", "(", ")", "{", "return", "packageManagerAndroidManifestTab", ";", "}", "}", "</s>" ]
1,994
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Button", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Dialog", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Display", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Shell", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Table", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableColumn", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TableItem", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "adb", ".", "AdbWorkshop", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "packagemanager", ".", "PackageBean", ";", "public", "class", "LoadApkFromDeviceDialog", "extends", "Dialog", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "LoadApkFromDeviceDialog", ".", "class", ")", ";", "protected", "PackageBean", "result", ";", "protected", "Shell", "shlSelectApk", ";", "private", "Table", "table", ";", "public", "static", "String", "PACKAGE_BEAN", "=", "\"bean\"", ";", "public", "LoadApkFromDeviceDialog", "(", "Shell", "parent", ")", "{", "this", "(", "parent", ",", "SWT", ".", "DIALOG_TRIM", "|", "SWT", ".", "APPLICATION_MODAL", ")", ";", "}", "public", "LoadApkFromDeviceDialog", "(", "Shell", "parent", ",", "int", "style", ")", "{", "super", "(", "parent", ",", "style", ")", ";", "setText", "(", "\"SWT", "Dialog\"", ")", ";", "}", "public", "void", "loadPackages", "(", ")", "{", "try", "{", "List", "<", "PackageBean", ">", "beans", "=", "AdbWorkshop", ".", "listPackages", "(", ")", ";", "for", "(", "PackageBean", "bean", ":", "beans", ")", "{", "String", "apk", "=", "bean", ".", "getApk", "(", ")", ".", "substring", "(", "bean", ".", "getApk", "(", ")", ".", "lastIndexOf", "(", "'/'", ")", "+", "1", ",", "bean", ".", "getApk", "(", ")", ".", "length", "(", ")", ")", ";", "TableItem", "tableItem", "=", "new", "TableItem", "(", "table", ",", "SWT", ".", "NONE", ")", ";", "tableItem", ".", "setText", "(", "new", "String", "[", "]", "{", "apk", ",", "bean", ".", "getClazz", "(", ")", "}", ")", ";", "tableItem", ".", "setData", "(", "PACKAGE_BEAN", ",", "bean", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "GuiWorkshop", ".", "messageError", "(", "shlSelectApk", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "PackageBean", "open", "(", ")", "{", "createContents", "(", ")", ";", "shlSelectApk", ".", "open", "(", ")", ";", "shlSelectApk", ".", "layout", "(", ")", ";", "Display", "display", "=", "getParent", "(", ")", ".", "getDisplay", "(", ")", ";", "shlSelectApk", ".", "update", "(", ")", ";", "shlSelectApk", ".", "redraw", "(", ")", ";", "loadPackages", "(", ")", ";", "while", "(", "!", "shlSelectApk", ".", "isDisposed", "(", ")", ")", "{", "if", "(", "!", "display", ".", "readAndDispatch", "(", ")", ")", "{", "display", ".", "sleep", "(", ")", ";", "}", "}", "return", "result", ";", "}", "private", "void", "createContents", "(", ")", "{", "shlSelectApk", "=", "new", "Shell", "(", "getParent", "(", ")", ",", "SWT", ".", "DIALOG_TRIM", "|", "SWT", ".", "RESIZE", ")", ";", "shlSelectApk", ".", "setSize", "(", "592", ",", "486", ")", ";", "shlSelectApk", ".", "setText", "(", "\"Select", "APK\"", ")", ";", "shlSelectApk", ".", "setLayout", "(", "new", "GridLayout", "(", "1", ",", "false", ")", ")", ";", "table", "=", "new", "Table", "(", "shlSelectApk", ",", "SWT", ".", "BORDER", "|", "SWT", ".", "FULL_SELECTION", ")", ";", "table", ".", "addMouseListener", "(", "new", "MouseAdapter", "(", ")", "{", "@", "Override", "public", "void", "mouseDoubleClick", "(", "MouseEvent", "arg0", ")", "{", "result", "=", "(", "PackageBean", ")", "table", ".", "getSelection", "(", ")", "[", "0", "]", ".", "getData", "(", "PACKAGE_BEAN", ")", ";", "shlSelectApk", ".", "close", "(", ")", ";", "}", "}", ")", ";", "table", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "table", ".", "setBounds", "(", "0", ",", "0", ",", "3", ",", "19", ")", ";", "table", ".", "setHeaderVisible", "(", "true", ")", ";", "table", ".", "setLinesVisible", "(", "true", ")", ";", "final", "TableColumn", "tblclmnApk", "=", "new", "TableColumn", "(", "table", ",", "SWT", ".", "NONE", ")", ";", "tblclmnApk", ".", "setWidth", "(", "240", ")", ";", "tblclmnApk", ".", "setText", "(", "\"APK\"", ")", ";", "final", "TableColumn", "tblclmnPackage", "=", "new", "TableColumn", "(", "table", ",", "SWT", ".", "NONE", ")", ";", "tblclmnPackage", ".", "setWidth", "(", "338", ")", ";", "tblclmnPackage", ".", "setText", "(", "\"Package\"", ")", ";", "final", "String", "[", "]", "keys", "=", "{", "PACKAGE_BEAN", "}", ";", "GuiWorkshop", ".", "addColumnSorter", "(", "table", ",", "tblclmnApk", ",", "0", ",", "keys", ")", ";", "GuiWorkshop", ".", "addColumnSorter", "(", "table", ",", "tblclmnPackage", ",", "1", ",", "keys", ")", ";", "Composite", "composite", "=", "new", "Composite", "(", "shlSelectApk", ",", "SWT", ".", "NONE", ")", ";", "composite", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "RIGHT", ",", "SWT", ".", "CENTER", ",", "false", ",", "false", ",", "1", ",", "1", ")", ")", ";", "composite", ".", "setBounds", "(", "0", ",", "0", ",", "64", ",", "64", ")", ";", "GridLayout", "gl_composite", "=", "new", "GridLayout", "(", "2", ",", "false", ")", ";", "gl_composite", ".", "verticalSpacing", "=", "0", ";", "gl_composite", ".", "marginWidth", "=", "0", ";", "gl_composite", ".", "marginHeight", "=", "0", ";", "gl_composite", ".", "horizontalSpacing", "=", "0", ";", "composite", ".", "setLayout", "(", "gl_composite", ")", ";", "Button", "btnLoad", "=", "new", "Button", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "btnLoad", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "if", "(", "table", ".", "getSelection", "(", ")", ".", "length", "==", "0", ")", "{", "GuiWorkshop", ".", "messageError", "(", "shlSelectApk", ",", "\"\"", ")", ";", "}", "else", "{", "result", "=", "(", "PackageBean", ")", "table", ".", "getSelection", "(", ")", "[", "0", "]", ".", "getData", "(", "PACKAGE_BEAN", ")", ";", "shlSelectApk", ".", "close", "(", ")", ";", "}", "}", "}", ")", ";", "btnLoad", ".", "setText", "(", "\"Load\"", ")", ";", "Button", "btnCancel", "=", "new", "Button", "(", "composite", ",", "SWT", ".", "NONE", ")", ";", "btnCancel", ".", "addSelectionListener", "(", "new", "SelectionAdapter", "(", ")", "{", "@", "Override", "public", "void", "widgetSelected", "(", "SelectionEvent", "arg0", ")", "{", "result", "=", "null", ";", "shlSelectApk", ".", "close", "(", ")", ";", "}", "}", ")", ";", "btnCancel", ".", "setText", "(", "\"Cancel\"", ")", ";", "}", "}", "</s>" ]
1,995
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "view", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "SWT", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "StyledText", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "SelectionEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridData", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "layout", ".", "GridLayout", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Composite", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Display", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Menu", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "MenuItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Shell", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Label", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabFolder", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CTabItem", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Text", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CLabel", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "ScrolledComposite", ";", "import", "org", ".", "eclipse", ".", "wb", ".", "swt", ".", "SWTResourceManager", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseWheelListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Slider", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "KeyEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "MouseAdapter", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CaretListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "custom", ".", "CaretEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "DragDetectListener", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "events", ".", "DragDetectEvent", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "Tree", ";", "import", "org", ".", "eclipse", ".", "swt", ".", "widgets", ".", "TreeItem", ";", "public", "class", "Test", "{", "protected", "Shell", "shell", ";", "private", "Tree", "tree", ";", "private", "TreeItem", "trtmTestTreeItem", ";", "private", "TreeItem", "trtmNewTreeitem", ";", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "try", "{", "Test", "window", "=", "new", "Test", "(", ")", ";", "window", ".", "open", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "void", "open", "(", ")", "{", "Display", "display", "=", "Display", ".", "getDefault", "(", ")", ";", "createContents", "(", ")", ";", "shell", ".", "open", "(", ")", ";", "shell", ".", "layout", "(", ")", ";", "while", "(", "!", "shell", ".", "isDisposed", "(", ")", ")", "{", "if", "(", "!", "display", ".", "readAndDispatch", "(", ")", ")", "{", "display", ".", "sleep", "(", ")", ";", "}", "}", "}", "protected", "void", "createContents", "(", ")", "{", "shell", "=", "new", "Shell", "(", ")", ";", "shell", ".", "setSize", "(", "450", ",", "300", ")", ";", "shell", ".", "setText", "(", "\"\"", ")", ";", "shell", ".", "setLayout", "(", "new", "GridLayout", "(", "1", ",", "false", ")", ")", ";", "CTabFolder", "tabFolder", "=", "new", "CTabFolder", "(", "shell", ",", "SWT", ".", "BORDER", ")", ";", "tabFolder", ".", "setSimple", "(", "false", ")", ";", "tabFolder", ".", "setLayoutData", "(", "new", "GridData", "(", "SWT", ".", "FILL", ",", "SWT", ".", "FILL", ",", "true", ",", "true", ",", "1", ",", "1", ")", ")", ";", "tabFolder", ".", "setSelectionBackground", "(", "Display", ".", "getCurrent", "(", ")", ".", "getSystemColor", "(", "SWT", ".", "COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT", ")", ")", ";", "CTabItem", "tabItem", "=", "new", "CTabItem", "(", "tabFolder", ",", "SWT", ".", "NONE", ")", ";", "tabItem", ".", "setText", "(", "\"New", "Item\"", ")", ";", "tree", "=", "new", "Tree", "(", "tabFolder", ",", "SWT", ".", "BORDER", ")", ";", "tabItem", ".", "setControl", "(", "tree", ")", ";", "trtmTestTreeItem", "=", "new", "TreeItem", "(", "tree", ",", "SWT", ".", "NONE", ")", ";", "trtmTestTreeItem", ".", "setText", "(", "\"\"", ")", ";", "trtmNewTreeitem", "=", "new", "TreeItem", "(", "trtmTestTreeItem", ",", "SWT", ".", "NONE", ")", ";", "trtmNewTreeitem", ".", "setText", "(", "\"New", "TreeItem\"", ")", ";", "trtmTestTreeItem", ".", "setExpanded", "(", "true", ")", ";", "}", "}", "</s>" ]
1,996
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "tools", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "class", "ToolsWorkshop", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "ToolsWorkshop", ".", "class", ")", ";", "}", "</s>" ]
1,997
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "debugger", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "com", ".", "sun", ".", "jdi", ".", "Bootstrap", ";", "import", "com", ".", "sun", ".", "jdi", ".", "VirtualMachine", ";", "import", "com", ".", "sun", ".", "jdi", ".", "connect", ".", "Connector", ";", "import", "com", ".", "sun", ".", "jdi", ".", "connect", ".", "IllegalConnectorArgumentsException", ";", "import", "com", ".", "sun", ".", "tools", ".", "jdi", ".", "SocketAttachingConnector", ";", "public", "class", "DebuggerWorkshop", "{", "@", "SuppressWarnings", "(", "{", "\"restriction\"", ",", "\"unchecked\"", "}", ")", "public", "VirtualMachine", "connectToRemoteVirtualMachine", "(", "String", "host", ",", "int", "port", ")", "throws", "IOException", ",", "IllegalConnectorArgumentsException", "{", "SocketAttachingConnector", "c", "=", "(", "SocketAttachingConnector", ")", "getRemoteConnector", "(", ")", ";", "Map", "<", "String", ",", "Connector", ".", "Argument", ">", "arguments", "=", "c", ".", "defaultArguments", "(", ")", ";", "Connector", ".", "Argument", "hostnameArgument", "=", "arguments", ".", "get", "(", "\"hostname\"", ")", ";", "hostnameArgument", ".", "setValue", "(", "host", ")", ";", "Connector", ".", "Argument", "portArgument", "=", "arguments", ".", "get", "(", "\"port\"", ")", ";", "portArgument", ".", "setValue", "(", "String", ".", "valueOf", "(", "port", ")", ")", ";", "arguments", ".", "put", "(", "\"hostname\"", ",", "hostnameArgument", ")", ";", "arguments", ".", "put", "(", "\"port\"", ",", "portArgument", ")", ";", "VirtualMachine", "vm", "=", "c", ".", "attach", "(", "arguments", ")", ";", "return", "(", "vm", ")", ";", "}", "@", "SuppressWarnings", "(", "\"restriction\"", ")", "public", "static", "Connector", "getRemoteConnector", "(", ")", "{", "List", "<", "Connector", ">", "connectors", "=", "Bootstrap", ".", "virtualMachineManager", "(", ")", ".", "allConnectors", "(", ")", ";", "for", "(", "Connector", "c", ":", "connectors", ")", "{", "if", "(", "c", ".", "name", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "System", ".", "out", ".", "println", "(", "c", ".", "getClass", "(", ")", ")", ";", "return", "(", "c", ")", ";", "}", "}", "return", "(", "null", ")", ";", "}", "}", "</s>" ]
1,998
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "debugger", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "jf", ".", "dexlib", ".", "Code", ".", "ReferenceType", ";", "import", "com", ".", "sun", ".", "jdi", ".", "AbsentInformationException", ";", "import", "com", ".", "sun", ".", "jdi", ".", "Bootstrap", ";", "import", "com", ".", "sun", ".", "jdi", ".", "IncompatibleThreadStateException", ";", "import", "com", ".", "sun", ".", "jdi", ".", "LocalVariable", ";", "import", "com", ".", "sun", ".", "jdi", ".", "Location", ";", "import", "com", ".", "sun", ".", "jdi", ".", "Method", ";", "import", "com", ".", "sun", ".", "jdi", ".", "StackFrame", ";", "import", "com", ".", "sun", ".", "jdi", ".", "Value", ";", "import", "com", ".", "sun", ".", "jdi", ".", "VirtualMachine", ";", "import", "com", ".", "sun", ".", "jdi", ".", "connect", ".", "Connector", ";", "import", "com", ".", "sun", ".", "jdi", ".", "connect", ".", "IllegalConnectorArgumentsException", ";", "import", "com", ".", "sun", ".", "jdi", ".", "event", ".", "BreakpointEvent", ";", "import", "com", ".", "sun", ".", "jdi", ".", "event", ".", "EventSet", ";", "import", "com", ".", "sun", ".", "jdi", ".", "request", ".", "BreakpointRequest", ";", "import", "com", ".", "sun", ".", "jdi", ".", "request", ".", "EventRequestManager", ";", "import", "com", ".", "sun", ".", "tools", ".", "jdi", ".", "SocketAttachingConnector", ";", "public", "class", "Testing", "{", "@", "SuppressWarnings", "(", "\"restriction\"", ")", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", ",", "IllegalConnectorArgumentsException", ",", "InterruptedException", ",", "IncompatibleThreadStateException", ",", "AbsentInformationException", "{", "SocketAttachingConnector", "c", "=", "(", "SocketAttachingConnector", ")", "getConnector", "(", ")", ";", "Map", "<", "String", ",", "Connector", ".", "Argument", ">", "arguments", "=", "c", ".", "defaultArguments", "(", ")", ";", "Connector", ".", "Argument", "hostnameArgument", "=", "arguments", ".", "get", "(", "\"hostname\"", ")", ";", "hostnameArgument", ".", "setValue", "(", "\"127.0.0.1\"", ")", ";", "Connector", ".", "Argument", "portArgument", "=", "arguments", ".", "get", "(", "\"port\"", ")", ";", "portArgument", ".", "setValue", "(", "\"8603\"", ")", ";", "arguments", ".", "put", "(", "\"hostname\"", ",", "hostnameArgument", ")", ";", "arguments", ".", "put", "(", "\"port\"", ",", "portArgument", ")", ";", "VirtualMachine", "vm", "=", "c", ".", "attach", "(", "arguments", ")", ";", "EventRequestManager", "mgr", "=", "vm", ".", "eventRequestManager", "(", ")", ";", "for", "(", "com", ".", "sun", ".", "jdi", ".", "ReferenceType", "rt", ":", "vm", ".", "allClasses", "(", ")", ")", "{", "if", "(", "rt", ".", "name", "(", ")", ".", "toLowerCase", "(", ")", ".", "contains", "(", "\"wuntee\"", ")", ")", "{", "System", ".", "out", ".", "println", "(", "rt", ".", "name", "(", ")", ")", ";", "for", "(", "Method", "m", ":", "rt", ".", "allMethods", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"", "-\"", "+", "m", ".", "name", "(", ")", ")", ";", "if", "(", "m", ".", "name", "(", ")", ".", "contains", "(", "\"cache\"", ")", ")", "{", "addBreakpointToMethod", "(", "m", ",", "mgr", ")", ";", "}", "}", "}", "}", "com", ".", "sun", ".", "jdi", ".", "event", ".", "EventQueue", "q", "=", "vm", ".", "eventQueue", "(", ")", ";", "while", "(", "true", ")", "{", "EventSet", "es", "=", "q", ".", "remove", "(", ")", ";", "Iterator", "<", "com", ".", "sun", ".", "jdi", ".", "event", ".", "Event", ">", "it", "=", "es", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "com", ".", "sun", ".", "jdi", ".", "event", ".", "Event", "e", "=", "it", ".", "next", "(", ")", ";", "BreakpointEvent", "bpe", "=", "(", "BreakpointEvent", ")", "e", ";", "try", "{", "System", ".", "out", ".", "println", "(", "\"Method:", "\"", "+", "bpe", ".", "location", "(", ")", ".", "method", "(", ")", ".", "toString", "(", ")", ")", ";", "for", "(", "StackFrame", "sf", ":", "bpe", ".", "thread", "(", ")", ".", "frames", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "sf", ".", "location", "(", ")", ".", "method", "(", ")", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Arguments:", "\"", ")", ";", "for", "(", "Value", "lv", ":", "sf", ".", "getArgumentValues", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"t--\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"t\"", "+", "lv", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "System", ".", "out", ".", "println", "(", "\"Error:", "\"", ")", ";", "ex", ".", "printStackTrace", "(", ")", ";", "}", "System", ".", "out", ".", "println", "(", ")", ";", "vm", ".", "resume", "(", ")", ";", "}", "}", "}", "public", "static", "void", "addBreakpointToMethod", "(", "Method", "m", ",", "EventRequestManager", "mgr", ")", "{", "System", ".", "out", ".", "println", "(", "\"Breakpoint:", "\"", "+", "m", ".", "toString", "(", ")", ")", ";", "try", "{", "Location", "location", "=", "m", ".", "location", "(", ")", ";", "BreakpointRequest", "bpr", "=", "mgr", ".", "createBreakpointRequest", "(", "location", ")", ";", "bpr", ".", "enable", "(", ")", ";", "}", "catch", "(", "com", ".", "sun", ".", "jdi", ".", "NativeMethodException", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "m", ".", "toString", "(", ")", "+", "\")\"", ")", ";", "}", "}", "public", "static", "void", "printBreakpointData", "(", "BreakpointEvent", "e", ")", "throws", "IncompatibleThreadStateException", ",", "AbsentInformationException", "{", "System", ".", "out", ".", "println", "(", "e", ".", "location", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ".", "location", "(", ")", ".", "lineNumber", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Code", "index:", "\"", "+", "e", ".", "location", "(", ")", ".", "codeIndex", "(", ")", ")", ";", "try", "{", "System", ".", "out", ".", "println", "(", "\"SourceName:", "\"", "+", "e", ".", "location", "(", ")", ".", "sourceName", "(", ")", ")", ";", "}", "catch", "(", "AbsentInformationException", "e1", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ".", "location", "(", ")", ".", "declaringType", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Method:", "\"", "+", "e", ".", "location", "(", ")", ".", "method", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "for", "(", "StackFrame", "sf", ":", "e", ".", "thread", "(", ")", ".", "frames", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"t\"", "+", "sf", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "for", "(", "LocalVariable", "lv", ":", "sf", ".", "visibleVariables", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"tt--\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"ttName:", "\"", "+", "lv", ".", "name", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"ttType:", "\"", "+", "lv", ".", "typeName", "(", ")", ")", ";", "Value", "lvValue", "=", "sf", ".", "getValue", "(", "lv", ")", ";", "if", "(", "lvValue", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"ttValue:", "\"", "+", "lvValue", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "lvValue", ".", "type", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"tttoString:", "\"", "+", "lv", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "for", "(", "Value", "lv", ":", "sf", ".", "getArgumentValues", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"tt--\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"tt\"", "+", "lv", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "@", "SuppressWarnings", "(", "\"restriction\"", ")", "public", "static", "void", "addIntentBreakpoints", "(", "VirtualMachine", "vm", ")", "{", "EventRequestManager", "mgr", "=", "vm", ".", "eventRequestManager", "(", ")", ";", "com", ".", "sun", ".", "jdi", ".", "ReferenceType", "intentClass", "=", "vm", ".", "classesByName", "(", "\"\"", ")", ".", "get", "(", "0", ")", ";", "for", "(", "Method", "m", ":", "intentClass", ".", "methodsByName", "(", "\"<init>\"", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Breakpoint:", "\"", "+", "m", ".", "toString", "(", ")", ")", ";", "Location", "location", "=", "m", ".", "location", "(", ")", ";", "BreakpointRequest", "bpr", "=", "mgr", ".", "createBreakpointRequest", "(", "location", ")", ";", "bpr", ".", "enable", "(", ")", ";", "}", "for", "(", "Method", "m", ":", "intentClass", ".", "methodsByName", "(", "\"putExtra\"", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Breakpoint:", "\"", "+", "m", ".", "toString", "(", ")", ")", ";", "Location", "location", "=", "m", ".", "location", "(", ")", ";", "BreakpointRequest", "bpr", "=", "mgr", ".", "createBreakpointRequest", "(", "location", ")", ";", "bpr", ".", "enable", "(", ")", ";", "}", "}", "public", "static", "Connector", "getConnector", "(", ")", "{", "List", "<", "Connector", ">", "connectors", "=", "Bootstrap", ".", "virtualMachineManager", "(", ")", ".", "allConnectors", "(", ")", ";", "for", "(", "Connector", "c", ":", "connectors", ")", "{", "if", "(", "c", ".", "name", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "return", "(", "c", ")", ";", "}", "}", "return", "(", "null", ")", ";", "}", "}", "</s>" ]
1,999
[ "<s>", "package", "com", ".", "wuntee", ".", "oter", ".", "logcat", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "org", ".", "apache", ".", "log4j", ".", "Logger", ";", "import", "com", ".", "wuntee", ".", "oter", ".", "exception", ".", "ParseException", ";", "public", "class", "LogCatBean", "{", "private", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "LogCatBean", ".", "class", ")", ";", "private", "Date", "date", ";", "private", "String", "raw", ";", "private", "LogCatLevelEnum", "level", ";", "private", "String", "clazz", ";", "private", "int", "pid", ";", "private", "String", "message", ";", "public", "LogCatBean", "(", ")", "{", "}", "public", "LogCatBean", "(", "String", "raw", ")", "{", "this", ".", "raw", "=", "raw", ";", "}", "public", "static", "LogCatBean", "parse", "(", "String", "raw", ")", "throws", "ParseException", "{", "LogCatBean", "l", "=", "new", "LogCatBean", "(", "raw", ")", ";", "l", ".", "parseLine", "(", ")", ";", "return", "(", "l", ")", ";", "}", "public", "void", "parseLine", "(", ")", "throws", "ParseException", "{", "logger", ".", "debug", "(", "\"Parsing:", "\"", "+", "raw", ")", ";", "this", ".", "date", "=", "new", "Date", "(", ")", ";", "switch", "(", "raw", ".", "charAt", "(", "0", ")", ")", "{", "case", "'V'", ":", "level", "=", "LogCatLevelEnum", ".", "VERBOSE", ";", "break", ";", "case", "'D'", ":", "level", "=", "LogCatLevelEnum", ".", "DEBUG", ";", "break", ";", "case", "'I'", ":", "level", "=", "LogCatLevelEnum", ".", "INFO", ";", "break", ";", "case", "'W'", ":", "level", "=", "LogCatLevelEnum", ".", "WARN", ";", "break", ";", "case", "'E'", ":", "level", "=", "LogCatLevelEnum", ".", "ERROR", ";", "break", ";", "}", "try", "{", "this", ".", "clazz", "=", "raw", ".", "substring", "(", "2", ",", "raw", ".", "length", "(", ")", ")", ".", "split", "(", "\"\\\\(\"", ")", "[", "0", "]", ";", "this", ".", "pid", "=", "Integer", ".", "valueOf", "(", "raw", ".", "substring", "(", "(", "raw", ".", "indexOf", "(", "\"(\"", ")", "+", "1", ")", ",", "(", "raw", ".", "indexOf", "(", "\")\"", ")", ")", ")", ".", "trim", "(", ")", ")", ";", "this", ".", "message", "=", "raw", ".", "substring", "(", "raw", ".", "indexOf", "(", "\":\"", ")", "+", "2", ",", "raw", ".", "length", "(", ")", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "throw", "new", "ParseException", "(", "raw", ")", ";", "}", "}", "public", "String", "toString", "(", ")", "{", "return", "(", "String", ".", "format", "(", "\"\"", ",", "level", ",", "clazz", ",", "pid", ",", "message", ")", ")", ";", "}", "public", "String", "getRaw", "(", ")", "{", "return", "raw", ";", "}", "public", "void", "setRaw", "(", "String", "raw", ")", "{", "this", ".", "raw", "=", "raw", ";", "}", "public", "LogCatLevelEnum", "getLevel", "(", ")", "{", "return", "level", ";", "}", "public", "void", "setLevel", "(", "LogCatLevelEnum", "level", ")", "{", "this", ".", "level", "=", "level", ";", "}", "public", "String", "getClazz", "(", ")", "{", "return", "clazz", ";", "}", "public", "void", "setClazz", "(", "String", "clazz", ")", "{", "this", ".", "clazz", "=", "clazz", ";", "}", "public", "int", "getPid", "(", ")", "{", "return", "pid", ";", "}", "public", "void", "setPid", "(", "int", "pid", ")", "{", "this", ".", "pid", "=", "pid", ";", "}", "public", "String", "getMessage", "(", ")", "{", "return", "message", ";", "}", "public", "void", "setMessage", "(", "String", "message", ")", "{", "this", ".", "message", "=", "message", ";", "}", "public", "Date", "getDate", "(", ")", "{", "return", "date", ";", "}", "public", "void", "setDate", "(", "Date", "date", ")", "{", "this", ".", "date", "=", "date", ";", "}", "}", "</s>" ]