class ExporterPajek implements GraphExporter, CharacterExporter, LongTask {

    // Options
    private boolean exportPosition = true;
    private boolean exportEdgeWeight = true;
    // Architecture
    private Workspace workspace;
    private Writer writer;
    private boolean exportVisible;
    private boolean cancel = false;
    private ProgressTicket progressTicket;

    public boolean isExportEdgeWeight() {
        return exportEdgeWeight;
    }

    public void setExportEdgeWeight(boolean exportEdgeWeight) {
        this.exportEdgeWeight = exportEdgeWeight;
    }

    public boolean isExportPosition() {
        return exportPosition;
    }

    public void setExportPosition(boolean exportPosition) {
        this.exportPosition = exportPosition;
    }

    @Override
    public boolean cancel() {
        cancel = true;
        return true;
    }

    @Override
    public void setProgressTicket(ProgressTicket progressTicket) {
        this.progressTicket = progressTicket;
    }

    @Override
    public boolean isExportVisible() {
        return exportVisible;
    }

    @Override
    public void setExportVisible(boolean exportVisible) {
        this.exportVisible = exportVisible;
    }

    @Override
    public void setWriter(Writer writer) {
        this.writer = writer;
    }

    @Override
    public Workspace getWorkspace() {
        return workspace;
    }

    @Override
    public void setWorkspace(Workspace workspace) {
        this.workspace = workspace;
    }

    public String getName() {
        return NbBundle.getMessage(getClass(), "ExporterPajek_name");
    }

    public FileType[] getFileTypes() {
        FileType ft = new FileType(".net", NbBundle.getMessage(getClass(), "fileType_Pajek_Name"));
        return new FileType[] {ft};
    }

    @Override
    public boolean execute() {<FILL_FUNCTION_BODY>}

    private void exportData(Graph graph) throws Exception {
        int max = graph.getNodeCount(), i = 1;
        HashMap<String, Integer> idx = new HashMap<>(3 * max / 2 + 1);

        Progress.start(progressTicket, max);

        writer.append("*Vertices " + max + "\n");

        NodeIterable nodeIterable = graph.getNodes();
        for (Node node : nodeIterable) {
            writer.append(Integer.toString(i));
            writer.append(" \"" + node.getLabel() + "\"");
            if (exportPosition) {
                writer.append(" " + node.x() + " " + node.y() + " " + node.z());
            }
            writer.append("\n");
            idx.put(node.getId().toString(), i++); // assigns Ids from the interval [1..max]

            if (cancel) {
                nodeIterable.doBreak();
                return;
            }
        }

        if (graph.isUndirected()) {
            writer.append("*Edges\n");
        } else {
            writer.append("*Arcs\n");
        }

        EdgeIterable edgeIterable = graph.getEdges();
        for (Edge edge : edgeIterable) {
            if (cancel) {
                edgeIterable.doBreak();
                return;
            }
            writer.append(idx.get(edge.getSource().getId().toString()) + " ");
            writer.append(Integer.toString(idx.get(edge.getTarget().getId().toString())));
            if (exportEdgeWeight) {
                writer.append(" " + edge.getWeight());
            }
            writer.append("\n");

            Progress.progress(progressTicket);
        }

        Progress.finish(progressTicket);
    }
}

        GraphModel graphModel = workspace.getLookup().lookup(GraphModel.class);
        Graph graph = exportVisible ? graphModel.getGraphVisible() : graphModel.getGraph();

        graph.readLock();

        try {
            exportData(graph);
        } catch (Exception e) {
            Logger.getLogger(ExporterPajek.class.getName()).log(Level.SEVERE, null, e);
        } finally {
            graph.readUnlock();
            Progress.finish(progressTicket);
        }

        return !cancel;
    
<no_super_class>