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 / programming / DesktopBrowse.java @ 47376
History | View | Annotate | Download (1.18 KB)
1 | 45011 | jjdelcerro | package org.gvsig.expressionevaluator.impl.function.programming; |
---|---|---|---|
2 | |||
3 | import java.net.URL; |
||
4 | import org.apache.commons.lang3.Range; |
||
5 | 47376 | jjdelcerro | import org.gvsig.desktopopen.DesktopOpen; |
6 | import static org.gvsig.expressionevaluator.ExpressionBuilder.FUNCTION_DESKTOPBROWSE; |
||
7 | 45011 | jjdelcerro | import org.gvsig.expressionevaluator.Function; |
8 | import org.gvsig.expressionevaluator.Interpreter; |
||
9 | import org.gvsig.expressionevaluator.spi.AbstractFunction; |
||
10 | 47376 | jjdelcerro | import org.gvsig.tools.util.ToolsUtilLocator; |
11 | 45011 | jjdelcerro | |
12 | /**
|
||
13 | *
|
||
14 | * @author jjdelcerro
|
||
15 | */
|
||
16 | 47376 | jjdelcerro | public class DesktopBrowse extends AbstractFunction { |
17 | 45011 | jjdelcerro | |
18 | 47376 | jjdelcerro | public DesktopBrowse() {
|
19 | 45011 | jjdelcerro | super(Function.GROUP_PROGRAMMING,
|
20 | 47376 | jjdelcerro | FUNCTION_DESKTOPBROWSE, |
21 | 45011 | jjdelcerro | Range.is(1),
|
22 | null,
|
||
23 | 47376 | jjdelcerro | FUNCTION_DESKTOPBROWSE+"({{url}})",
|
24 | 45011 | jjdelcerro | null,
|
25 | 47376 | jjdelcerro | "NULL",
|
26 | 45011 | jjdelcerro | false
|
27 | ); |
||
28 | } |
||
29 | |||
30 | @Override
|
||
31 | public boolean allowConstantFolding() { |
||
32 | return false; |
||
33 | } |
||
34 | |||
35 | @Override
|
||
36 | public Object call(Interpreter interpreter, Object[] args) throws Exception { |
||
37 | URL url = getURL(args,0); |
||
38 | 47376 | jjdelcerro | DesktopOpen desktop = ToolsUtilLocator.getToolsUtilManager().createDesktopOpen(); |
39 | desktop.browse(url.toURI()); |
||
40 | return null; |
||
41 | 45011 | jjdelcerro | } |
42 | |||
43 | } |