public void readExternal(final Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); readModule(element); DefaultJDOMExternalizer.readExternal(this, element); DefaultJDOMExternalizer.readExternal(getPersistentData(), element); EnvironmentVariablesComponent.readExternal(element, getPersistentData().getEnvs()); final Element patternsElement = element.getChild(PATTERNS_EL_NAME); if (patternsElement != null) { final Set<String> tests = new LinkedHashSet<String>(); for (Object o : patternsElement.getChildren(PATTERN_EL_NAME)) { Element patternElement = (Element) o; tests.add(patternElement.getAttributeValue(TEST_CLASS_ATT_NAME)); } myData.setPatterns(tests); } final Element forkModeElement = element.getChild("fork_mode"); if (forkModeElement != null) { final String mode = forkModeElement.getAttributeValue("value"); if (mode != null) { setForkMode(mode); } } final Element dirNameElement = element.getChild("dir"); if (dirNameElement != null) { final String dirName = dirNameElement.getAttributeValue("value"); getPersistentData().setDirName(FileUtil.toSystemDependentName(dirName)); } }
public void writeExternal(final Element element) throws WriteExternalException { super.writeExternal(element); JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element); writeModule(element); DefaultJDOMExternalizer.writeExternal(this, element); final Data persistentData = getPersistentData(); DefaultJDOMExternalizer.writeExternal(persistentData, element); EnvironmentVariablesComponent.writeExternal(element, persistentData.getEnvs()); final String dirName = persistentData.getDirName(); if (!dirName.isEmpty()) { final Element dirNameElement = new Element("dir"); dirNameElement.setAttribute("value", FileUtil.toSystemIndependentName(dirName)); element.addContent(dirNameElement); } final Element patternsElement = new Element(PATTERNS_EL_NAME); for (String o : persistentData.getPatterns()) { final Element patternElement = new Element(PATTERN_EL_NAME); patternElement.setAttribute(TEST_CLASS_ATT_NAME, o); patternsElement.addContent(patternElement); } final String forkMode = getForkMode(); if (!forkMode.equals("none")) { final Element forkModeElement = new Element("fork_mode"); forkModeElement.setAttribute("value", forkMode); element.addContent(forkModeElement); } element.addContent(patternsElement); PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element); }
@Override @SuppressWarnings({"unchecked"}) public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); DefaultJDOMExternalizer.readExternal(this, element); Element e = element.getChild("XsltFile"); if (e != null) { final String url = e.getAttributeValue("url"); if (url != null) { myXsltFile = VirtualFilePointerManager.getInstance().create(url, getProject(), null); } } e = element.getChild("XmlFile"); if (e != null) { final String url = e.getAttributeValue("url"); if (url != null) { myXmlInputFile = VirtualFilePointerManager.getInstance().create(url, getProject(), null); } } e = element.getChild("OutputFile"); if (e != null) { myOutputFile = e.getAttributeValue("path"); myOpenOutputFile = Boolean.valueOf(e.getAttributeValue("openOutputFile")); myOpenInBrowser = Boolean.valueOf(e.getAttributeValue("openInBrowser")); } }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element); writeModule(element); DefaultJDOMExternalizer.writeExternal(this, element); DefaultJDOMExternalizer.writeExternal(getPersistantData(), element); EnvironmentVariablesComponent.writeExternal(element, getPersistantData().getEnvs()); Element propertiesElement = element.getChild("properties"); if (propertiesElement == null) { propertiesElement = new Element("properties"); element.addContent(propertiesElement); } Map<String, String> properties = getPersistantData().TEST_PROPERTIES; for (Map.Entry<String, String> entry : properties.entrySet()) { Element property = new Element("property"); property.setAttribute("name", entry.getKey()); property.setAttribute("value", entry.getValue()); propertiesElement.addContent(property); } Element listenersElement = element.getChild("listeners"); if (listenersElement == null) { listenersElement = new Element("listeners"); element.addContent(listenersElement); } List<String> listeners = getPersistantData().TEST_LISTENERS; for (String listener : listeners) { Element listenerElement = new Element("listener"); listenerElement.setAttribute("class", listener); listenersElement.addContent(listenerElement); } final Set<String> patterns = getPersistantData().getPatterns(); if (!patterns.isEmpty()) { final Element patternsElement = new Element(PATTERNS_EL_NAME); for (String o : patterns) { final Element patternElement = new Element(PATTERN_EL_NAME); patternElement.setAttribute(TEST_CLASS_ATT_NAME, o); patternsElement.addContent(patternElement); } element.addContent(patternsElement); } }
public static void writeFilters(Element parentNode, @NonNls String tagName, ClassFilter[] filters) throws WriteExternalException { for (ClassFilter filter : filters) { Element element = new Element(tagName); parentNode.addContent(element); DefaultJDOMExternalizer.writeExternal(filter, element); } }
@Override public void loadState(final Element state) { try { DefaultJDOMExternalizer.readExternal(this, state); } catch (InvalidDataException e) { LOG.info(e); } }
public void writeExternal(Element element) throws WriteExternalException { for (final String name : myName2FavoritesRoots.keySet()) { Element list = new Element(ELEMENT_FAVORITES_LIST); list.setAttribute(ATTRIBUTE_NAME, name); writeRoots(list, myName2FavoritesRoots.get(name)); element.addContent(list); } DefaultJDOMExternalizer.writeExternal(this, element); }
public void readExternal(Element element) throws InvalidDataException { myName2FavoritesRoots.clear(); for (Object list : element.getChildren(ELEMENT_FAVORITES_LIST)) { final String name = ((Element) list).getAttributeValue(ATTRIBUTE_NAME); List<TreeItem<Pair<AbstractUrl, String>>> roots = readRoots((Element) list, myProject); myName2FavoritesRoots.put(name, roots); } DefaultJDOMExternalizer.readExternal(this, element); }
@Override public Element getState() { Element element = new Element("state"); try { DefaultJDOMExternalizer.writeExternal(this, element); } catch (WriteExternalException e) { LOG.info(e); } return element; }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); readModule(element); DefaultJDOMExternalizer.readExternal(this, element); DefaultJDOMExternalizer.readExternal(getPersistantData(), element); EnvironmentVariablesComponent.readExternal(element, getPersistantData().getEnvs()); Map<String, String> properties = getPersistantData().TEST_PROPERTIES; properties.clear(); Element propertiesElement = element.getChild("properties"); if (propertiesElement != null) { List<Element> children = propertiesElement.getChildren("property"); for (Element property : children) { properties.put(property.getAttributeValue("name"), property.getAttributeValue("value")); } } List<String> listeners = getPersistantData().TEST_LISTENERS; listeners.clear(); Element listenersElement = element.getChild("listeners"); if (listenersElement != null) { List<Element> children = listenersElement.getChildren("listener"); for (Element listenerClassName : children) { listeners.add(listenerClassName.getAttributeValue("class")); } } final Element patternsElement = element.getChild(PATTERNS_EL_NAME); if (patternsElement != null) { final LinkedHashSet<String> tests = new LinkedHashSet<String>(); for (Object o : patternsElement.getChildren(PATTERN_EL_NAME)) { Element patternElement = (Element) o; tests.add(patternElement.getAttributeValue(TEST_CLASS_ATT_NAME)); } getPersistantData().setPatterns(tests); } }
@Override public void writeExternal(Element element) throws WriteExternalException { final CodeStyleSettings parentSettings = new CodeStyleSettings(); DefaultJDOMExternalizer.writeExternal( this, element, new DifferenceFilter<CodeStyleSettings>(this, parentSettings)); List<CustomCodeStyleSettings> customSettings = new ArrayList<CustomCodeStyleSettings>(getCustomSettingsValues()); Collections.sort( customSettings, new Comparator<CustomCodeStyleSettings>() { @Override public int compare(final CustomCodeStyleSettings o1, final CustomCodeStyleSettings o2) { return o1.getTagName().compareTo(o2.getTagName()); } }); for (final CustomCodeStyleSettings settings : customSettings) { final CustomCodeStyleSettings parentCustomSettings = parentSettings.getCustomSettings(settings.getClass()); if (parentCustomSettings == null) { throw new WriteExternalException("Custom settings are null for " + settings.getClass()); } settings.writeExternal(element, parentCustomSettings); } final FileType[] fileTypes = myAdditionalIndentOptions .keySet() .toArray(new FileType[myAdditionalIndentOptions.keySet().size()]); Arrays.sort( fileTypes, new Comparator<FileType>() { @Override public int compare(final FileType o1, final FileType o2) { return o1.getDefaultExtension().compareTo(o2.getDefaultExtension()); } }); for (FileType fileType : fileTypes) { final IndentOptions indentOptions = myAdditionalIndentOptions.get(fileType); Element additionalIndentOptions = new Element(ADDITIONAL_INDENT_OPTIONS); indentOptions.serialize(additionalIndentOptions, getDefaultIndentOptions(fileType)); additionalIndentOptions.setAttribute(FILETYPE, fileType.getDefaultExtension()); if (!additionalIndentOptions.getChildren().isEmpty()) { element.addContent(additionalIndentOptions); } } myCommonSettingsManager.writeExternal(element); }
private static void writeExternal( @NotNull Element element, @NotNull ShelvedChangeList shelvedChangeList) throws WriteExternalException { DefaultJDOMExternalizer.writeExternal(shelvedChangeList, element); element.setAttribute(NAME_ATTRIBUTE, shelvedChangeList.getName()); element.setAttribute(ATTRIBUTE_DATE, Long.toString(shelvedChangeList.DATE.getTime())); element.setAttribute( ATTRIBUTE_RECYCLED_CHANGELIST, Boolean.toString(shelvedChangeList.isRecycled())); for (ShelvedBinaryFile file : shelvedChangeList.getBinaryFiles()) { Element child = new Element(ELEMENT_BINARY); file.writeExternal(child); element.addContent(child); } }
@Override public void loadState(Element state) { try { DefaultJDOMExternalizer.readExternal(this, state); if (myNullables.isEmpty()) { Collections.addAll(myNullables, DEFAULT_NULLABLES); } if (myNotNulls.isEmpty()) { Collections.addAll(myNotNulls, DEFAULT_NOT_NULLS); } } catch (InvalidDataException e) { LOG.error(e); } }
@Override public void readExternal(Element element) throws InvalidDataException { DefaultJDOMExternalizer.readExternal(this, element); mySchemeName = element.getAttributeValue(NAME_ATTRIBUTE); DATE = new Date(Long.parseLong(element.getAttributeValue(ATTRIBUTE_DATE))); myRecycled = Boolean.parseBoolean(element.getAttributeValue(ATTRIBUTE_RECYCLED_CHANGELIST)); //noinspection unchecked final List<Element> children = (List<Element>) element.getChildren(ELEMENT_BINARY); myBinaryFiles = new ArrayList<ShelvedBinaryFile>(children.size()); for (Element child : children) { ShelvedBinaryFile binaryFile = new ShelvedBinaryFile(); binaryFile.readExternal(child); myBinaryFiles.add(binaryFile); } }
@Override public Element getState() { final Element component = new Element("component"); if (hasDefaultValues()) { return component; } try { DefaultJDOMExternalizer.writeExternal(this, component); } catch (WriteExternalException e) { LOG.error(e); } return component; }
@SuppressWarnings({"HardCodedStringLiteral"}) public void writeExternal(Element element) throws WriteExternalException { DefaultJDOMExternalizer.writeExternal(this, element); if (ADD_PATHS != null) { for (String aADD_PATHS : ADD_PATHS) { Element elem = new Element("addpath"); elem.setAttribute("path", aADD_PATHS); element.addContent(elem); } } if (myConfigurationDirectory != null) { Element configurationDirectory = new Element("configuration"); configurationDirectory.setText(myConfigurationDirectory); configurationDirectory.setAttribute( "useDefault", myIsUseDefaultConfiguration ? "true" : "false"); element.addContent(configurationDirectory); } if (myIsKeepLocks) { element.addContent(new Element("keepLocks")); } if (myRemoteStatus) { element.addContent(new Element("remoteStatus")); } if (myUpgradeMode != null) { element.addContent(new Element("upgradeMode").setText(myUpgradeMode)); } element.addContent( new Element("myIsUseDefaultProxy").setText(myIsUseDefaultProxy ? "true" : "false")); if (mySupportOptions != null) { element.addContent(new Element("supportedVersion").setText("" + mySupportOptions.myVersion)); } element.setAttribute("maxAnnotateRevisions", "" + myMaxAnnotateRevisions); element.setAttribute("myUseAcceleration", "" + myUseAcceleration); element.setAttribute("myAutoUpdateAfterCommit", "" + myAutoUpdateAfterCommit); element.setAttribute(CLEANUP_ON_START_RUN, "" + myCleanupRun); element.setAttribute("SSL_PROTOCOLS", SSL_PROTOCOLS.name()); if (TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE != null) { element.setAttribute( "TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE", "" + TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE); } }
@Override public void readExternal(Element element) throws InvalidDataException { myGroupPath = new ArrayList<String>(); for (Object o : element.getChildren(PATH)) { myGroupPath.add(((Element) o).getAttributeValue(VALUE)); } final String attributeValue = element.getAttributeValue(VALUE); if (element.getAttributeValue(IS_ACTION) != null) { myComponent = attributeValue; } else if (element.getAttributeValue(SEPARATOR) != null) { myComponent = Separator.getInstance(); } else if (element.getAttributeValue(IS_GROUP) != null) { final AnAction action = ActionManager.getInstance().getAction(attributeValue); myComponent = action instanceof ActionGroup ? ActionsTreeUtil.createGroup((ActionGroup) action, true, null) : new Group(attributeValue, attributeValue, null); } myActionType = Integer.parseInt(element.getAttributeValue(ACTION_TYPE)); myAbsolutePosition = Integer.parseInt(element.getAttributeValue(POSITION)); DefaultJDOMExternalizer.readExternal(this, element); }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); DefaultJDOMExternalizer.writeExternal(this, element); Element e = new Element("XsltFile"); if (myXsltFile != null) { e.setAttribute("url", myXsltFile.getUrl()); element.addContent(e); } e = new Element("XmlFile"); if (myXmlInputFile != null) { e.setAttribute("url", myXmlInputFile.getUrl()); element.addContent(e); } e = new Element("OutputFile"); if (myOutputFile != null) { e.setAttribute("path", myOutputFile); e.setAttribute("openOutputFile", Boolean.toString(myOpenOutputFile)); e.setAttribute("openInBrowser", Boolean.toString(myOpenInBrowser)); element.addContent(e); } }
@Override public void writeExternal(Element element) throws WriteExternalException { for (String s : myGroupPath) { Element path = new Element(PATH); path.setAttribute(VALUE, s); element.addContent(path); } if (myComponent instanceof String) { element.setAttribute(VALUE, (String) myComponent); element.setAttribute(IS_ACTION, Boolean.TRUE.toString()); } else if (myComponent instanceof Separator) { element.setAttribute(SEPARATOR, Boolean.TRUE.toString()); } else if (myComponent instanceof Group) { final String groupId = ((Group) myComponent).getId() != null && ((Group) myComponent).getId().length() != 0 ? ((Group) myComponent).getId() : ((Group) myComponent).getName(); element.setAttribute(VALUE, groupId != null ? groupId : ""); element.setAttribute(IS_GROUP, Boolean.TRUE.toString()); } element.setAttribute(ACTION_TYPE, Integer.toString(myActionType)); element.setAttribute(POSITION, Integer.toString(myAbsolutePosition)); DefaultJDOMExternalizer.writeExternal(this, element); }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); DefaultJDOMExternalizer.writeExternal(this, element); }
@Override public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); DefaultJDOMExternalizer.readExternal(this, element); }
@Override public void readExternal(Element element) throws InvalidDataException { DefaultJDOMExternalizer.readExternal(this, element); if (LAYOUT_STATIC_IMPORTS_SEPARATELY) { // add <all other static imports> entry if there is none boolean found = false; for (PackageEntry entry : IMPORT_LAYOUT_TABLE.getEntries()) { if (entry == PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY) { found = true; break; } } if (!found) { PackageEntry last = IMPORT_LAYOUT_TABLE.getEntryCount() == 0 ? null : IMPORT_LAYOUT_TABLE.getEntryAt(IMPORT_LAYOUT_TABLE.getEntryCount() - 1); if (last != PackageEntry.BLANK_LINE_ENTRY) { IMPORT_LAYOUT_TABLE.addEntry(PackageEntry.BLANK_LINE_ENTRY); } IMPORT_LAYOUT_TABLE.addEntry(PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY); } } boolean oldOptionsImported = importOldIndentOptions(element); for (final CustomCodeStyleSettings settings : getCustomSettingsValues()) { settings.readExternal(element); settings.importLegacySettings(); } final List list = element.getChildren(ADDITIONAL_INDENT_OPTIONS); if (list != null) { for (Object o : list) { if (o instanceof Element) { final Element additionalIndentElement = (Element) o; final String fileTypeId = additionalIndentElement.getAttributeValue(FILETYPE); if (fileTypeId != null && !fileTypeId.isEmpty()) { FileType target = FileTypeManager.getInstance().getFileTypeByExtension(fileTypeId); if (FileTypes.UNKNOWN == target || FileTypes.PLAIN_TEXT == target || target.getDefaultExtension().isEmpty()) { target = new TempFileType(fileTypeId); } final IndentOptions options = getDefaultIndentOptions(target); options.readExternal(additionalIndentElement); registerAdditionalIndentOptions(target, options); } } } } myCommonSettingsManager.readExternal(element); if (oldOptionsImported) { copyOldIndentOptions("java", JAVA_INDENT_OPTIONS); copyOldIndentOptions("jsp", JSP_INDENT_OPTIONS); copyOldIndentOptions("xml", XML_INDENT_OPTIONS); } if (USE_SAME_INDENTS) IGNORE_SAME_INDENTS_FOR_LANGUAGES = true; }
public void writeExternal(Element element) throws WriteExternalException { DefaultJDOMExternalizer.writeExternal(this, element); if (myUserObject instanceof String) { element.setAttribute(USER_OBJECT, (String) myUserObject); } }
public void readExternal(Element element) throws InvalidDataException { DefaultJDOMExternalizer.readExternal(this, element); myUserObject = element.getAttributeValue(USER_OBJECT); }
private void readExternal(Element element) throws InvalidDataException { DefaultJDOMExternalizer.readExternal(this, element); }
private void writeExternal(Element element) throws WriteExternalException { DefaultJDOMExternalizer.writeExternal( this, element, new DifferenceFilter<CodeStyleSettingsManager>(this, new CodeStyleSettingsManager())); }
public void writeExternal(Element element) throws WriteExternalException { DefaultJDOMExternalizer.writeExternal(this, element); }
public static ClassFilter create(Element element) throws InvalidDataException { ClassFilter filter = new ClassFilter(); DefaultJDOMExternalizer.readExternal(filter, element); return filter; }
@SuppressWarnings({"HardCodedStringLiteral"}) public void readExternal(Element element) throws InvalidDataException { DefaultJDOMExternalizer.readExternal(this, element); List elems = element.getChildren("addpath"); LOG.debug(elems.toString()); ADD_PATHS = new String[elems.size()]; for (int i = 0; i < elems.size(); i++) { Element elem = (Element) elems.get(i); ADD_PATHS[i] = elem.getAttributeValue("path"); } Element configurationDirectory = element.getChild("configuration"); if (configurationDirectory != null) { myConfigurationDirectory = configurationDirectory.getText(); Attribute defaultAttr = configurationDirectory.getAttribute("useDefault"); try { myIsUseDefaultConfiguration = defaultAttr != null && defaultAttr.getBooleanValue(); } catch (DataConversionException e) { myIsUseDefaultConfiguration = false; } } else { myIsUseDefaultConfiguration = true; } // compatibility: this setting was moved from .iws to global settings List urls = element.getChildren("checkoutURL"); for (Object url1 : urls) { Element child = (Element) url1; String url = child.getText(); if (url != null) { SvnApplicationSettings.getInstance().addCheckoutURL(url); } } myIsKeepLocks = element.getChild("keepLocks") != null; myRemoteStatus = element.getChild("remoteStatus") != null; myUpgradeMode = element.getChild("upgradeMode") != null ? element.getChild("upgradeMode").getText() : null; final Element useProxy = element.getChild("myIsUseDefaultProxy"); if (useProxy == null) { myIsUseDefaultProxy = false; } else { myIsUseDefaultProxy = Boolean.parseBoolean(useProxy.getText()); } final Element supportedVersion = element.getChild("supportedVersion"); if (supportedVersion != null) { try { mySupportOptions = new SvnSupportOptions(Long.parseLong(supportedVersion.getText().trim())); } catch (NumberFormatException e) { mySupportOptions = new SvnSupportOptions(null); } } final Attribute maxAnnotateRevisions = element.getAttribute("maxAnnotateRevisions"); if (maxAnnotateRevisions != null) { try { myMaxAnnotateRevisions = maxAnnotateRevisions.getIntValue(); } catch (DataConversionException e) { // } final Attribute acceleration = element.getAttribute("myUseAcceleration"); if (acceleration != null) { try { myUseAcceleration = UseAcceleration.valueOf(acceleration.getValue()); } catch (IllegalArgumentException e) { // } } } final Attribute autoUpdateAfterCommit = element.getAttribute("myAutoUpdateAfterCommit"); if (autoUpdateAfterCommit != null) { myAutoUpdateAfterCommit = Boolean.parseBoolean(autoUpdateAfterCommit.getValue()); } final Attribute cleanupRun = element.getAttribute(CLEANUP_ON_START_RUN); if (cleanupRun != null) { myCleanupRun = Boolean.parseBoolean(cleanupRun.getValue()); } final Attribute treeConflictMergeNewFilesPlace = element.getAttribute("TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE"); final Attribute protocols = element.getAttribute("SSL_PROTOCOLS"); if (protocols != null) { try { SSL_PROTOCOLS = SSLProtocols.valueOf(protocols.getValue()); } catch (IllegalArgumentException e) { // } } if (treeConflictMergeNewFilesPlace != null) { TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE = Boolean.parseBoolean(treeConflictMergeNewFilesPlace.getValue()); } }