Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / foldersmanager / SetLastPathFunction.java @ 44389

History | View | Annotate | Download (1.35 KB)

1 44389 jjdelcerro
package org.gvsig.expressionevaluator.impl.function.foldersmanager;
2 43512 jjdelcerro
3 44389 jjdelcerro
import java.io.File;
4 43512 jjdelcerro
import org.apache.commons.lang3.Range;
5 43521 jjdelcerro
import org.gvsig.expressionevaluator.Interpreter;
6 43512 jjdelcerro
import org.gvsig.expressionevaluator.spi.AbstractFunction;
7 44389 jjdelcerro
import org.gvsig.tools.ToolsLocator;
8
import org.gvsig.tools.folders.FoldersManager;
9 43512 jjdelcerro
10 44389 jjdelcerro
public class SetLastPathFunction extends AbstractFunction {
11 43512 jjdelcerro
12 44389 jjdelcerro
13
    public static final String NAME = "SETLASTPATH";
14
15
    public SetLastPathFunction() {
16
        super(
17
            "Folders",
18
            NAME,
19
            Range.is(2),
20
            "Assigns the last value used to the indicated folder. Return the new value set to the folder.",
21
            NAME+"({{folderid}}, value)",
22
            new String[] {
23
                "folderid - Identifier of the folder to set",
24
                "value - Value to be assigned as the last used folder associated with the indicated identifier.."
25
            },
26
            "File",
27
            false
28
        );
29 43512 jjdelcerro
    }
30
31
    @Override
32 44009 jjdelcerro
    public boolean allowConstantFolding() {
33 44389 jjdelcerro
        return false;
34 44009 jjdelcerro
    }
35
36
    @Override
37 43521 jjdelcerro
    public Object call(Interpreter interpreter, Object[] args) {
38 44389 jjdelcerro
        FoldersManager folderManager = ToolsLocator.getFoldersManager();
39
        String id = getStr(args, 0);
40
        File value = getFile(args,1);
41
        folderManager.setLastPath(id, value);
42
        return value;
43 43512 jjdelcerro
    }
44
}