* @return true if item list is not empty, otherwise false.
*/
private List<GoToItem> createGoToTItems(PhpModule phpModule, TokenSequence<PHPTokenId> ts, int offset) {
List<GoToItem> items = new ArrayList<GoToItem>();
YiiModule yiiModule = YiiModuleFactory.create(phpModule);
FileObject application = yiiModule.getApplication();
if (application == null || paramCount > 2) {
return items;
}
// move to offset of message for second parameter
String message = ""; // NOI18N
if (paramCount == 2) {
String tFirstParam = getTFirstParam(ts, offset);
if (tFirstParam == null) {
return items;
}
message = target;
target = tFirstParam;
}
// get messages directory
FileObject messagesDirectory = null;
String messagesDirectoryName = DEFAULT_MESSAGES_DIR_NAME;
// check whether text contains class name
String className = ""; // NOI18N
if (target.contains(".")) { // NOI18N
int dotIndex = target.indexOf("."); // NOI18N
className = target.substring(0, dotIndex);
String categoryName = target.substring(dotIndex + 1);
target = categoryName;
FileObject classFile = getClassFileObject(phpModule, className);
if (classFile != null) {
FileObject parent = classFile.getParent();
if (parent != null && parent.isFolder()) {
messagesDirectory = parent.getFileObject(messagesDirectoryName);
}
}
}
if (className.isEmpty() && messagesDirectory == null) {
messagesDirectory = yiiModule.getMessages();
}
if (messagesDirectory == null) {
return items;
}