Marc Portier wrote:
>
> Adding myself some of the answers after a hard days work...
>
> (I assume this mail list is moderated? which I would understand
> BTW, just a bit of an adaption, didn't read any message about this)
>
> Marc Portier wrote:
> > Hi there,
> >
>
> <snip content="context" />
>
> >
> > These are the 3 small commands that should tackle my problem:
> > 1. tox.readAttribute att_name
> >
> > returns the value of the @att_name on the selected node
> > (strange that this is not available already?)
> >
>
> finished, really simple code too:
>
> public boolean prepareCommand(
> Gadget gadget,
> String parameter,
> int x,
> int y) {
> Element selElm = getSelectedElement(gadget);
> return ((selElm !=
> null)&&(selElm.getAttribute(Name.get("src"))!=null)) ;
> }
>
> protected Element getSelectedElement(Gadget gadget) {
> DocumentView docView = (DocumentView) gadget;
> MarkManager marks = docView.getMarkManager();
> NodeMark sel = marks.getSelected();
> Node selNode = sel.getNode();
> Element selElm = null;
> if(selNode.getNodeType() == Node.ELEMENT) {
> selElm = (Element) selNode;
> }
> return selElm;
> }
>
> public Object executeCommand(
> Gadget gadget,
> String parameter,
> int x,
> int y) {
> return
> getSelectedElement(gadget).getAttribute(Name.get("src"));
> }
> >
> > 2. tox.resolveSrc fileRelative path
> > tox.resolveSrc sysPropRelative path sysPropName
> >
> > returns the resolved version of the path variable into an
> > absoluteFileName by either using the current file location (1st version)
> > or using a base-path found in a Java system property (2nd version of the
> > command)
> >
> > Question: for the first version: is there a way to grab the current file
> > location? Which method/object I should ask?
> >
>
> found this one after some search:
> Document has getEntityURL();
>
> public boolean prepareCommand(
> Gadget gadget,
> String parameter,
> int x,
> int y) {
> return (parameter != null && !"".equals(parameter)) ;
> }
>
> public Object executeCommand(
> Gadget gadget,
> String parameter,
> int x,
> int y) {
> DocumentView docView = (DocumentView) gadget;
> Document doc = docView.getDocument();
> URL u = doc.getEntityURL();
> String url = u.toString();
> url = url.substring(0, url.lastIndexOf("/") + 1);
> return url + parameter;
> }
>
> > 3. tox.openFile path
> >
> > instructs xxe to open the file in a new document window.
> >
>
> Which is leading me nowhere yet...
> I did find something like
> - new OpenedDocument(App)
> - openedDoc.open(java.net.URL)
>
> and maybe I will also need to create my own
> - new Editor(App, OpenedDocument, StylesheetInfo)
>
> I guess the StyleSheetInfo could be obtained from the
> App.getActiveEditor().getStyleSheetInfo();
>
> assuming my reasoning is correct the issue remains to get a hold
> of the App instance, which I fail to find.
>
> help is welcomed.
See answer to your previous email: for now, you simply cannot do it.
Note that answering questions related to programming XXE in Java or in a
scripting language will not be answered in this mailing list because
this is a service reserved to our customers.
End user and power user support (i.e. using XXE, configuring XXE, even
writing macro-commands, etc) is free and we are committed to answer
*all* questions but you have already noticed that we are far from
supporting our users in real-time (at best: once a day, worst case: once
a week).
All this does not mean that we do not care about Standard Edition users.
On the contrary, we care very much but we really need to give
Professional Edition customers advantages over Standard Edition users.