use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class MavenProjectsNavigator method scheduleStructureRequest.
private void scheduleStructureRequest(final Runnable r) {
if (isUnitTestMode()) {
if (myStructure != null) {
r.run();
}
return;
}
if (myToolWindow == null)
return;
MavenUtil.invokeLater(myProject, () -> {
if (!myToolWindow.isVisible())
return;
boolean shouldCreate = myStructure == null;
if (shouldCreate) {
initStructure();
}
r.run();
if (shouldCreate) {
if (myState.treeState != null) {
TreeState treeState = new TreeState();
try {
treeState.readExternal(myState.treeState);
treeState.applyTo(myTree);
} catch (InvalidDataException e) {
MavenLog.LOG.info(e);
}
}
}
});
}
use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class Breakpoint method readExternal.
public void readExternal(Element parentNode) throws InvalidDataException {
FilteredRequestorImpl requestor = new FilteredRequestorImpl(myProject);
requestor.readTo(parentNode, this);
try {
setEnabled(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "ENABLED")));
} catch (Exception ignored) {
}
try {
setLogEnabled(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_ENABLED")));
} catch (Exception ignored) {
}
try {
String logMessage = JDOMExternalizerUtil.readField(parentNode, LOG_MESSAGE_OPTION_NAME);
if (logMessage != null && !logMessage.isEmpty()) {
XExpressionImpl expression = XExpressionImpl.fromText(logMessage);
XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(XBreakpointActionsPanel.LOG_EXPRESSION_HISTORY_ID, expression);
myXBreakpoint.setLogExpressionObject(expression);
((XBreakpointBase) myXBreakpoint).setLogExpressionEnabled(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_EXPRESSION_ENABLED")));
}
} catch (Exception ignored) {
}
try {
setRemoveAfterHit(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "REMOVE_AFTER_HIT")));
} catch (Exception ignored) {
}
}
use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class BreakpointManager method createXLineBreakpoint.
private <B extends XBreakpoint<?>> XLineBreakpoint createXLineBreakpoint(Class<? extends XBreakpointType<B, ?>> typeCls, Element breakpointNode) throws InvalidDataException {
final String url = breakpointNode.getAttributeValue("url");
VirtualFile vFile = VirtualFileManager.getInstance().findFileByUrl(url);
if (vFile == null) {
throw new InvalidDataException(DebuggerBundle.message("error.breakpoint.file.not.found", url));
}
final Document doc = FileDocumentManager.getInstance().getDocument(vFile);
if (doc == null) {
throw new InvalidDataException(DebuggerBundle.message("error.cannot.load.breakpoint.file", url));
}
final int line;
try {
//noinspection HardCodedStringLiteral
line = Integer.parseInt(breakpointNode.getAttributeValue("line"));
} catch (Exception e) {
throw new InvalidDataException("Line number is invalid for breakpoint");
}
return addXLineBreakpoint(typeCls, doc, line);
}
use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class ExternalProjectsViewImpl method restoreTreeState.
private void restoreTreeState() {
if (myState.treeState != null) {
TreeState treeState = new TreeState();
try {
treeState.readExternal(myState.treeState);
treeState.applyTo(myTree);
} catch (InvalidDataException e) {
LOG.info(e);
}
}
}
use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class PackageEntryTable method readExternal.
@Override
public void readExternal(Element element) throws InvalidDataException {
myEntries.clear();
List children = element.getChildren();
for (final Object aChildren : children) {
@NonNls Element e = (Element) aChildren;
@NonNls String name = e.getName();
if ("package".equals(name)) {
String packageName = e.getAttributeValue("name");
boolean isStatic = Boolean.parseBoolean(e.getAttributeValue("static"));
boolean withSubpackages = Boolean.parseBoolean(e.getAttributeValue("withSubpackages"));
if (packageName == null) {
throw new InvalidDataException();
}
PackageEntry entry;
if (packageName.isEmpty()) {
entry = isStatic ? PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY : PackageEntry.ALL_OTHER_IMPORTS_ENTRY;
} else {
entry = new PackageEntry(isStatic, packageName, withSubpackages);
}
myEntries.add(entry);
} else {
if ("emptyLine".equals(name)) {
myEntries.add(PackageEntry.BLANK_LINE_ENTRY);
}
}
}
}
Aggregations