use of com.intellij.openapi.util.WriteExternalException in project intellij-community by JetBrains.
the class ConfigureTasksActivationDialog method updateTree.
private void updateTree(@Nullable CachingSimpleNode nodeToUpdate) {
Set<CachingSimpleNode> toUpdate = ContainerUtil.newIdentityTroveSet();
if (nodeToUpdate == null) {
for (DefaultMutableTreeNode node : myTree.getSelectedNodes(DefaultMutableTreeNode.class, null)) {
final Object userObject = node.getUserObject();
if (userObject instanceof SimpleNode && ((SimpleNode) userObject).getParent() instanceof CachingSimpleNode) {
toUpdate.add((CachingSimpleNode) ((SimpleNode) userObject).getParent());
}
}
} else {
toUpdate.add(nodeToUpdate);
}
if (toUpdate.isEmpty()) {
toUpdate.add(myRootNode);
}
Element treeStateElement = new Element("root");
try {
TreeState.createOn(myTree).writeExternal(treeStateElement);
} catch (WriteExternalException ignore) {
}
for (CachingSimpleNode node : toUpdate) {
cleanUpEmptyNodes(node);
}
TreeState treeState = new TreeState();
try {
treeState.readExternal(treeStateElement);
treeState.applyTo(myTree);
} catch (InvalidDataException ignore) {
}
}
use of com.intellij.openapi.util.WriteExternalException in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfiguration method writeExternal.
@Override
public void writeExternal(Element element) throws WriteExternalException {
super.writeExternal(element);
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.getProject());
final Element appConfigElement = XmlSerializer.serialize(this.appConfig, (accessor, o) -> !"artifact".equalsIgnoreCase(accessor.getName()));
final IArtifact artifact = this.appConfig.getDeployment().getArtifact();
Optional.ofNullable(this.appConfig).map(config -> XmlSerializer.serialize(config, (accessor, o) -> !"artifact".equalsIgnoreCase(accessor.getName()))).ifPresent(element::addContent);
Optional.ofNullable(this.appConfig).map(config -> (WrappedAzureArtifact) config.getDeployment().getArtifact()).map((a) -> manager.getArtifactIdentifier(a.getArtifact())).map(id -> new Element("Artifact").setAttribute("identifier", id)).ifPresent(element::addContent);
}
Aggregations