public void performClickAction()

in remoting/ide/browsing/src/org/netbeans/modules/jackpot30/ide/browsing/HyperlinkProviderImpl.java [92:127]


    public void performClickAction(Document doc, int offset, HyperlinkType type) {
        RemoteSourceDescription rsd = org.netbeans.modules.jackpot30.remoting.api.Utilities.remoteSource(doc);
        FileObject file = NbEditorUtilities.getFileObject(doc);

        if (rsd != null && file != null) {
            try {
                URI sourceURI = new URI(rsd.idx.remote.toExternalForm() + "/ui/target?path=" + WebUtilities.escapeForQuery(rsd.idx.remoteSegment) + "&relative=" + WebUtilities.escapeForQuery(rsd.relative) + "&position=" + offset);
                Map<Object, Object> targetData = Pojson.load(HashMap.class, sourceURI.toURL().openStream());

                if (targetData.containsKey("position")) {
                    open(file, Integer.parseInt(String.valueOf(targetData.get("position"))));
                } else if (targetData.containsKey("source")) {
                    RemoteIndex targetIDX = null;
                    for (RemoteIndex i : RemoteIndex.loadIndices()) {
                        if (i.remote.equals(rsd.idx.remote) && i.remoteSegment.equals(targetData.get("path"))) {
                            targetIDX = i;
                        }
                    }

                    if (targetIDX == null) {
                        //TODO
                    } else {
                        String relativePath = (String) targetData.get("source");
                        URI declarationSpanURI = new URI(targetIDX.remote.toExternalForm() + "/ui/declarationSpan?path=" + WebUtilities.escapeForQuery(targetIDX.remoteSegment) + "&relative=" + WebUtilities.escapeForQuery(relativePath) + "&signature=" + WebUtilities.escapeForQuery(String.valueOf(targetData.get("signature"))));
                        List<Long> span = Pojson.update(new ArrayList<Long>(), declarationSpanURI.toURL().openStream());
                        //TODO: if the target is on disk, should use standard way to open:
                        open(targetIDX.getFile(relativePath), (int) (long) span.get(2));
                    }
                }
            } catch (URISyntaxException ex) {
                Exceptions.printStackTrace(ex);
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
    }