use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class ToolsProcessor method readScheme.
@NotNull
@Override
public ToolsGroup<T> readScheme(@NotNull Element root, boolean duringLoad) throws InvalidDataException, IOException, JDOMException {
if (!TOOL_SET.equals(root.getName())) {
throw new InvalidDataException();
}
String attrName = root.getAttributeValue(ATTRIBUTE_NAME);
String groupName = StringUtil.isEmpty(attrName) ? Tool.DEFAULT_GROUP_NAME : attrName;
ToolsGroup<T> result = createToolsGroup(groupName);
final PathMacroManager macroManager = PathMacroManager.getInstance(ApplicationManager.getApplication());
for (Element element : root.getChildren(TOOL)) {
T tool = createTool();
readToolAttributes(element, tool);
Element exec = element.getChild(EXEC);
if (exec != null) {
for (final Object o1 : exec.getChildren(ELEMENT_OPTION)) {
Element optionElement = (Element) o1;
String name = optionElement.getAttributeValue(ATTRIBUTE_NAME);
String value = optionElement.getAttributeValue(ATTRIBUTE_VALUE);
if (WORKING_DIRECTORY.equals(name)) {
if (value != null) {
final String replace = macroManager.expandPath(value).replace('/', File.separatorChar);
tool.setWorkingDirectory(replace);
}
}
if (COMMAND.equals(name)) {
tool.setProgram(macroManager.expandPath(BaseToolManager.convertString(value)));
}
if (PARAMETERS.equals(name)) {
tool.setParameters(macroManager.expandPath(BaseToolManager.convertString(value)));
}
}
}
for (final Object o2 : element.getChildren(FILTER)) {
Element childNode = (Element) o2;
FilterInfo filterInfo = new FilterInfo();
filterInfo.readExternal(childNode);
tool.addOutputFilter(filterInfo);
}
tool.setGroup(groupName);
result.addElement(tool);
}
return result;
}
use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class ConfigFileInfoSetImpl method readExternal.
public void readExternal(final Element element) throws InvalidDataException {
myConfigFiles.clear();
List<Element> children = element.getChildren(ELEMENT_NAME);
for (Element child : children) {
final String id = child.getAttributeValue(ID_ATTRIBUTE);
if (id != null) {
final ConfigFileMetaData metaData = myMetaDataProvider.findMetaData(id);
if (metaData != null) {
final String url = child.getAttributeValue(URL_ATTRIBUTE);
if (url == null)
throw new InvalidDataException(URL_ATTRIBUTE + " attribute not specified for " + id + " descriptor");
myConfigFiles.put(metaData, new ConfigFileInfo(metaData, url));
}
}
}
onChange();
}
use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class MigrationMapSet method loadMaps.
private void loadMaps() {
myMaps = new ArrayList<>();
File dir = getMapDirectory();
copyPredefinedMaps(dir);
File[] files = getMapFiles(dir);
for (int i = 0; i < files.length; i++) {
try {
MigrationMap map = readMap(files[i]);
if (map != null) {
map.setFileName(FileUtil.getNameWithoutExtension(files[i]));
myMaps.add(map);
}
} catch (InvalidDataException | JDOMException e) {
LOG.error("Invalid data in file: " + files[i].getAbsolutePath());
} catch (IOException e) {
LOG.error(e);
}
}
}
use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class ContentEntryImpl method getUrlFrom.
private static String getUrlFrom(@NotNull Element e) throws InvalidDataException {
LOG.assertTrue(ELEMENT_NAME.equals(e.getName()));
String url = e.getAttributeValue(URL_ATTRIBUTE);
if (url == null)
throw new InvalidDataException();
return url;
}
use of com.intellij.openapi.util.InvalidDataException in project intellij-community by JetBrains.
the class ProjectLevelVcsManagerSerialization method readExternalUtil.
public void readExternalUtil(final Element element, final OptionsAndConfirmations optionsAndConfirmations) throws InvalidDataException {
final Map<String, VcsShowOptionsSettingImpl> options = optionsAndConfirmations.getOptions();
for (Element subElement : element.getChildren(OPTIONS_SETTING)) {
final String id = subElement.getAttributeValue(ID_ATTRIBUTE);
final String value = subElement.getAttributeValue(VALUE_ATTTIBUTE);
if (id != null && value != null) {
try {
getOrCreateOption(options, id).setValue(Boolean.parseBoolean(value));
} catch (Exception ignored) {
}
}
}
myReadValue.clear();
for (Element subElement : element.getChildren(CONFIRMATIONS_SETTING)) {
final String id = subElement.getAttributeValue(ID_ATTRIBUTE);
final String value = subElement.getAttributeValue(VALUE_ATTTIBUTE);
if (id != null && value != null) {
try {
myReadValue.put(id, VcsShowConfirmationOption.Value.fromString(value));
} catch (Exception ignored) {
}
}
}
}
Aggregations