this.actionName = actionName;
}
public FuelPhpControllerVisitor(FileObject targetFile, int currentCaretPosition) {
// get PhpBaseElement(Method) for current positon
EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
// XXX
int startClassOffset = 0;
Collection<PhpClass> classes = editorSupport.getClasses(targetFile);
for (PhpClass phpClass : classes) {
startClassOffset = phpClass.getOffset();
break;
}
// FIXME exception might be occurred
// if user run action at outside php class.
// e.g. document area.
//
if (currentCaretPosition > startClassOffset) {
PhpBaseElement phpElement = editorSupport.getElement(targetFile, currentCaretPosition);
if (phpElement != null && phpElement instanceof PhpClass.Method) {
PhpClass.Method method = (PhpClass.Method) phpElement;
actionName = method.getName();
}
}