Search in sources :

Example 1 with QueryNode

use of org.gephi.desktop.filters.query.QueryNode in project gephi by gephi.

the class CategoryNode method getDropType.

@Override
public PasteType getDropType(final Transferable t, int action, int index) {
    if (category == null || !category.equals(FiltersExplorer.QUERIES)) {
        return null;
    }
    final Node dropNode = NodeTransfer.node(t, DnDConstants.ACTION_COPY_OR_MOVE);
    if (dropNode != null && dropNode instanceof QueryNode) {
        return new PasteType() {

            @Override
            public Transferable paste() throws IOException {
                QueryNode queryNode = (QueryNode) dropNode;
                FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
                FilterLibrary library = filterController.getModel().getLibrary();
                library.saveQuery(queryNode.getQuery());
                return null;
            }
        };
    }
    return null;
}
Also used : QueryNode(org.gephi.desktop.filters.query.QueryNode) Node(org.openide.nodes.Node) QueryNode(org.gephi.desktop.filters.query.QueryNode) AbstractNode(org.openide.nodes.AbstractNode) PasteType(org.openide.util.datatransfer.PasteType) FilterLibrary(org.gephi.filters.api.FilterLibrary) FilterController(org.gephi.filters.api.FilterController)

Aggregations

QueryNode (org.gephi.desktop.filters.query.QueryNode)1 FilterController (org.gephi.filters.api.FilterController)1 FilterLibrary (org.gephi.filters.api.FilterLibrary)1 AbstractNode (org.openide.nodes.AbstractNode)1 Node (org.openide.nodes.Node)1 PasteType (org.openide.util.datatransfer.PasteType)1