use of au.gov.asd.tac.constellation.views.namedselection.state.NamedSelectionStatePlugin in project constellation by constellation-app.
the class NamedSelectionManager method saveStateToGraph.
/**
* Helper method that saves the current Named Selection state to the graph.
*
* @return The state that was saved to the graph.
*/
@SuppressWarnings("unchecked")
private NamedSelectionState saveStateToGraph() {
final Graph graph = graphNode.getGraph();
final NamedSelectionState newState;
if (state != null) {
newState = new NamedSelectionState(state);
} else {
newState = new NamedSelectionState();
}
// Only write graph if it exists.
if (graph != null) {
// Write what we have to the graph:
final NamedSelectionStatePlugin nssp = new NamedSelectionStatePlugin(newState);
final Future<?> f = PluginExecution.withPlugin(nssp).interactively(true).executeLater(graph);
try {
f.get();
} catch (final InterruptedException ex) {
LOGGER.log(Level.SEVERE, "Saving Named Selection state was interrupted", ex);
Thread.currentThread().interrupt();
} catch (final ExecutionException ex) {
LOGGER.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
}
}
// Update the old state now:
state = newState;
return newState;
}
Aggregations