@Override public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); String scriptUrl = element.getAttributeValue(SCRIPT_PATH_URL); String scriptParams = element.getAttributeValue(SCRIPT_PARAMETERS); String scriptOptions = element.getAttributeValue(SCRIPT_OPTIONS); String logEvents = element.getAttributeValue(SCRIPT_SHOW_EVENTS); if (!StringUtil.isEmpty(scriptUrl)) { scriptPath = scriptUrl; } if (!StringUtil.isEmpty(scriptParams)) { scriptParameters = scriptParams; } if (!StringUtil.isEmpty(scriptOptions)) { this.scriptOptions = scriptOptions; } if (!StringUtil.isEmpty(logEvents)) myShowAppleEvents = "true".equals(logEvents); }
@NotNull @Override public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException { Module baseModule = super.createModule(moduleModel); String languageName = myCourse.getLanguageID(); Language language = Language.findLanguageByID(languageName); if (language != null) { EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language); if (configurator != null) { Project project = baseModule.getProject(); myGenerator.setSelectedCourse(myCourse); myGenerator.generateProject(project, project.getBaseDir()); Course course = StudyTaskManager.getInstance(project).getCourse(); if (course == null) { LOG.info("failed to generate course"); return baseModule; } configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory()); } } return baseModule; }
@NotNull @Override public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException { Module module = super.createModule(moduleModel); Course course = myTask.getLesson().getCourse(); String directory = getModuleFileDirectory(); if (directory == null) { return module; } VirtualFile moduleDir = VfsUtil.findFileByIoFile(new File(directory), true); if (moduleDir == null) { return module; } VirtualFile src = moduleDir.findChild(EduNames.SRC); if (src == null) { return module; } createTask(module.getProject(), course, src); ModuleRootModificationUtil.addDependency(module, myUtilModule); EduIntellijUtils.addJUnit(module); return module; }
@NotNull @Override public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException { Module baseModule = super.createModule(moduleModel); if (mySelectedCourse != null) { String languageName = mySelectedCourse.getLanguageID(); Language language = Language.findLanguageByID(languageName); if (language != null) { EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language); if (configurator != null) { myGenerator.setSelectedCourse(mySelectedCourse); Project project = baseModule.getProject(); myGenerator.generateProject(project, project.getBaseDir()); Course course = StudyTaskManager.getInstance(project).getCourse(); if (course == null) { LOG.info("failed to generate course"); return baseModule; } configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory()); } } } return baseModule; }
@NotNull @Override public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException { Module baseModule = super.createModule(moduleModel); Project project = baseModule.getProject(); EduProjectGenerator generator = new EduProjectGenerator(); if (myCourse == null) { File courseRoot = StudyUtils.getBundledCourseRoot(DEFAULT_COURSE_NAME, EduKotlinKoansModuleBuilder.class); final Course course = generator.addLocalCourse(FileUtil.join(courseRoot.getPath(), DEFAULT_COURSE_NAME)); if (course == null) { LOG.info("Failed to find course " + DEFAULT_COURSE_NAME); return baseModule; } } myCourse.setLanguage("kotlin"); EduModuleBuilderUtils.createCourseFromCourseInfo(moduleModel, project, generator, myCourse, getModuleFileDirectory()); return baseModule; }
@Override public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); String name = ProcessingRunSettings.class.getSimpleName(); Element settingsElement = element.getChild(name); if (settingsElement == null) return; ProcessingRunSettings deserializedConfig = XmlSerializer.deserialize(settingsElement, ProcessingRunSettings.class); runSettings.setModule(deserializedConfig.getModule()); runSettings.setSketchClass(deserializedConfig.getSketchClass()); runSettings.setFullscreen(deserializedConfig.isFullscreen()); runSettings.setHideStopButton(deserializedConfig.isHideStopButton()); runSettings.setJvmArguments(deserializedConfig.getJvmArguments()); runSettings.setSketchArguments(deserializedConfig.getSketchArguments()); runSettings.setWindowBackgroundColor(deserializedConfig.getWindowBackgroundColor()); runSettings.setStopButtonColor(deserializedConfig.getStopButtonColor()); runSettings.setSketchOutputPath(deserializedConfig.getSketchOutputPath()); runSettings.setLocation(deserializedConfig.getLocation()); readModule(element); }
@Override public void readExternal(final Element element) throws InvalidDataException { super.readExternal(element); final Element fileElement = element.getChild("file"); if (fileElement != null) { this.runFilePath = fileElement.getText(); } }
@Override public void readExternal(Element element) throws InvalidDataException { blazeFlags.readExternal(element); exeFlags.readExternal(element); setNativeDebuggingEnabled(Boolean.parseBoolean(element.getAttributeValue(NATIVE_DEBUG_ATTR))); Element deployTargetStatesElement = element.getChild(DEPLOY_TARGET_STATES_TAG); if (deployTargetStatesElement != null) { deployTargetManager.readExternal(deployTargetStatesElement); } Element debuggerStatesElement = element.getChild(DEBUGGER_STATES_TAG); if (debuggerStatesElement != null) { debuggerManager.readExternal(debuggerStatesElement); } }
@Override public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); this.weaveHome = JDOMExternalizerUtil.readField(element, WEAVE_HOME_FIELD); this.weaveFile = JDOMExternalizerUtil.readField(element, WEAVE_FILE); this.weaveOutput = JDOMExternalizerUtil.readField(element, WEAVE_OUTPUT); final List<Element> children = element.getChildren(WEAVE_INPUT); this.weaveInputs = new ArrayList<>(); for (Element child : children) { final WeaveInput weaveInput = new WeaveInput(); weaveInput.readExternal(child); weaveInputs.add(weaveInput); } getConfigurationModule().readExternal(element); }
@Test public void readAndWriteShouldMatch() throws InvalidDataException, WriteExternalException { state.getBlazeFlagsState().setRawFlags(ImmutableList.of("--flag1", "--flag2")); state.getExeFlagsState().setRawFlags(ImmutableList.of("--exe1", "--exe2")); state.setNativeDebuggingEnabled(true); Element element = new Element("test"); state.writeExternal(element); BlazeAndroidRunConfigurationCommonState readState = new BlazeAndroidRunConfigurationCommonState(buildSystem().getName(), false); readState.readExternal(element); assertThat(readState.getBlazeFlagsState().getRawFlags()) .containsExactly("--flag1", "--flag2") .inOrder(); assertThat(readState.getExeFlagsState().getRawFlags()) .containsExactly("--exe1", "--exe2") .inOrder(); assertThat(readState.isNativeDebuggingEnabled()).isTrue(); }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); readModule(element); vmParams = JDOMExternalizer.readString(element, "vmparams"); cmdLine = JDOMExternalizer.readString(element, "cmdLine"); String sPassParentEnviroment = JDOMExternalizer.readString(element, "passParentEnv"); passParentEnv = StringUtil.isEmpty(sPassParentEnviroment) || Boolean.parseBoolean(sPassParentEnviroment); envs.clear(); JDOMExternalizer.readMap(element, envs, null, "env"); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); depsClasspath = !"false".equals(JDOMExternalizer.readString(element, "depsClasspath")); }
@Override public void readExternal(Element element) throws InvalidDataException { DefaultJDOMExternalizer.readExternal(this, element); PATH = FileUtil.toSystemIndependentName(PATH); 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 = element.getChildren(ELEMENT_BINARY); myBinaryFiles = new ArrayList<ShelvedBinaryFile>(children.size()); for (Element child : children) { ShelvedBinaryFile binaryFile = new ShelvedBinaryFile(); binaryFile.readExternal(child); myBinaryFiles.add(binaryFile); } }
private static Module doLoadModule(@NotNull String path, @NotNull Project project) throws IOException, JDOMException, InvalidDataException { Module module; AccessToken token = WriteAction.start(); try { module = ModuleManager.getInstance(project).newModule(path + '/' + EclipseProjectFinder.findProjectName(path) + IdeaXml.IML_EXT, StdModuleTypes.JAVA.getId()); } finally { token.finish(); } replaceRoot(path, EclipseXml.DOT_CLASSPATH_EXT, project); ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel(); new EclipseClasspathConverter(module).readClasspath(rootModel); token = WriteAction.start(); try { rootModel.commit(); } finally { token.finish(); } return module; }
public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); // filters final List children = element.getChildren(FILTER); List<String> filters = new ArrayList<String>(); //noinspection unchecked for (Element child : ((Iterable<Element>)children)) { filters.add(child.getValue()); } myFilters = filters.isEmpty() ? null : ArrayUtil.toStringArray(filters); // suite to merge mySuiteToMerge = element.getAttributeValue(MERGE_SUITE); if (getRunner() == null) { setRunner(CoverageRunner.getInstance(IDEACoverageRunner.class)); //default } }
@Override public void loadState(final Element object) { try { final List children = object.getChildren(FILTER); for (Object child : children) { Element filterElement = (Element)child; final LogFilter filter = new LogFilter(); filter.readExternal(filterElement); setFilterSelected(filter, Boolean.parseBoolean(filterElement.getAttributeValue(IS_ACTIVE))); } DefaultJDOMExternalizer.readExternal(this, object); } catch (InvalidDataException e) { LOG.error(e); } }
ModuleJdkOrderEntryImpl(@NotNull Element element, @NotNull RootModelImpl rootModel, @NotNull ProjectRootManagerImpl projectRootManager) throws InvalidDataException { super(rootModel, projectRootManager); if (!element.getName().equals(OrderEntryFactory.ORDER_ENTRY_ELEMENT_NAME)) { throw new InvalidDataException(); } final Attribute jdkNameAttribute = element.getAttribute(JDK_NAME_ATTR); if (jdkNameAttribute == null) { throw new InvalidDataException(); } final String jdkName = jdkNameAttribute.getValue(); final String jdkType = element.getAttributeValue(JDK_TYPE_ATTR); final Sdk jdkByName = findJdk(jdkName, jdkType); if (jdkByName == null) { init(null, jdkName, jdkType); } else { init(jdkByName, null, null); } }
public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); myInterpreterOptions = JDOMExternalizerUtil.readField(element, "INTERPRETER_OPTIONS"); readEnvs(element); mySdkHome = JDOMExternalizerUtil.readField(element, "SDK_HOME"); myWorkingDirectory = JDOMExternalizerUtil.readField(element, "WORKING_DIRECTORY"); myUseModuleSdk = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, "IS_MODULE_SDK")); final String addContentRoots = JDOMExternalizerUtil.readField(element, "ADD_CONTENT_ROOTS"); myAddContentRoots = addContentRoots == null || Boolean.parseBoolean(addContentRoots); final String addSourceRoots = JDOMExternalizerUtil.readField(element, "ADD_SOURCE_ROOTS"); myAddSourceRoots = addSourceRoots == null || Boolean.parseBoolean(addSourceRoots); getConfigurationModule().readExternal(element); setMappingSettings(PathMappingSettings.readExternal(element)); // extension settings: PythonRunConfigurationExtensionsManager.getInstance().readExternal(this, element); }
@Test public void testRunConfigurationUnalteredBySerializationRoundTrip() throws InvalidDataException { configuration.setTarget(Label.create("//package:rule")); configuration.setKeepInSync(true); final Element initialElement = runManager.getState(); Element element = RunConfigurationSerializer.writeToXml(configuration); assertThat(RunConfigurationSerializer.findExisting(getProject(), element)).isNotNull(); clearRunManager(); // remove configuration from project RunConfigurationSerializer.loadFromXmlElementIgnoreExisting(getProject(), element); final Element newElement = runManager.getState(); final XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat()); assertThat(xmlOutputter.outputString(newElement)) .isEqualTo(xmlOutputter.outputString(initialElement)); }
public HistoryEntry(@NotNull Project project, @NotNull Element e) throws InvalidDataException { myFile = getVirtualFile(e); myProvider2State = new HashMap<FileEditorProvider, FileEditorState>(); List providers = e.getChildren(PROVIDER_ELEMENT); for (final Object provider1 : providers) { Element _e = (Element)provider1; String typeId = _e.getAttributeValue(EDITOR_TYPE_ID_ATTR); FileEditorProvider provider = FileEditorProviderManager.getInstance().getProvider(typeId); if (provider == null) { continue; } if (Boolean.valueOf(_e.getAttributeValue(SELECTED_ATTR_VALUE))) { mySelectedProvider = provider; } Element stateElement = _e.getChild(STATE_ELEMENT); if (stateElement == null) { throw new InvalidDataException(); } FileEditorState state = provider.readState(stateElement, project, myFile); putState(provider, state); } }
@Override public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); Settings settings = XmlSerializer.deserialize(element, Settings.class); this.host = settings.host; this.port = settings.port; this.route = settings.route; this.browser = WebBrowserManager.getInstance().findBrowserById(settings.browser); this.interpreter = PhpInterpretersManagerImpl.getInstance(getProject()).findInterpreter(settings.interpreterName); }
@Override public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); this.tomcatInfo = TomcatInfoConfigs.getInstance(getProject()).getCurrent(); // this.tomcatInstallation = PropertiesComponent.getInstance().getValue("TOMCAT_INSTALLATION"); // this.tomcatInstallation = JDOMExternalizerUtil.readField(element, "TOMCAT_INSTALLATION"); this.docBase = JDOMExternalizerUtil.readField(element, "DOC_BASE"); this.contextPath = JDOMExternalizerUtil.readField(element, "CONTEXT_PATH"); this.port = JDOMExternalizerUtil.readField(element, "TOMCAT_PORT"); this.vmOptions = JDOMExternalizerUtil.readField(element, "VM_OPTIONS"); }
private static void createLessonModules(@NotNull ModifiableModuleModel moduleModel, Course course, String moduleDir, Module utilModule) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException { List<Lesson> lessons = course.getLessons(); for (int i = 0; i < lessons.size(); i++) { int lessonVisibleIndex = i + 1; Lesson lesson = lessons.get(i); lesson.setIndex(lessonVisibleIndex); EduLessonModuleBuilder eduLessonModuleBuilder = new EduLessonModuleBuilder(moduleDir, lesson, utilModule); eduLessonModuleBuilder.createModule(moduleModel); } }
@NotNull @Override public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException { Module baseModule = super.createModule(moduleModel); List<Task> taskList = myLesson.getTaskList(); for (int i = 0; i < taskList.size(); i++) { int visibleTaskIndex = i + 1; Task task = taskList.get(i); task.setIndex(visibleTaskIndex); createTaskModule(moduleModel, task); } return baseModule; }
@NotNull @Override public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException { Module baseModule = super.createModule(moduleModel); String directory = getModuleFileDirectory(); if (directory == null) { return baseModule; } VirtualFile moduleDir = VfsUtil.findFileByIoFile(new File(directory), true); if (moduleDir == null) { return baseModule; } VirtualFile src = moduleDir.findChild(EduNames.SRC); if (src == null) { return baseModule; } Project project = baseModule.getProject(); StartupManager.getInstance(project).registerPostStartupActivity(() -> DumbService.getInstance(project).runWhenSmart(() -> ApplicationManager.getApplication().runWriteAction(() -> { EduIntellijUtils.addTemplate(project, src, "EduTestRunner.java"); }))); EduIntellijUtils.addJUnit(baseModule); if (myAdditionalMaterials != null) { final List<Task> taskList = myAdditionalMaterials.getTaskList(); if (taskList.size() == 1) { final Task task = taskList.get(0); for (Map.Entry<String, String> entry : task.getTestsText().entrySet()) { StudyGenerator.createChildFile(project.getBaseDir(), entry.getKey(), entry.getValue()); } } } return baseModule; }
@NotNull @Override public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException { Module module = super.createModule(moduleModel); Project project = module.getProject(); final Course course = new Course(); course.setName(myPanel.getName()); course.setAuthorsAsString(myPanel.getAuthors()); course.setDescription(myPanel.getDescription()); LanguageWrapper wrapper = (LanguageWrapper)myLanguageComboBox.getSelectedItem(); Language language = wrapper.getLanguage(); course.setLanguage(language.getID()); course.setCourseMode(CCUtils.COURSE_MODE); StudyTaskManager.getInstance(project).setCourse(course); EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language); String languageName = language.getDisplayName(); if (configurator == null) { LOG.error("EduPluginConfigurator for language " + languageName + " not found"); return module; } configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory()); StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> new WriteCommandAction.Simple(project) { @Override protected void run() throws Throwable { PsiDirectory baseDir = PsiManager.getInstance(project).findDirectory(project.getBaseDir()); if (baseDir == null) { return; } PsiDirectory lessonDir = new CCCreateLesson().createItem(null, project, baseDir, course); if (lessonDir == null) { LOG.error("Failed to create lesson"); return; } new CCCreateTask().createItem(null, project, lessonDir, course); } }.execute()); return module; }
public void loadContext(Element fromElement) throws InvalidDataException { for (AbstractProjectViewPane pane : myPanes) { Element paneElement = fromElement.getChild(pane.getId()); if (paneElement != null) { pane.readExternal(paneElement); if (pane.getTree() != null) { pane.restoreExpandedPaths(); } } } }
public BlazeCommandRunConfiguration(Project project, ConfigurationFactory factory, String name) { super(project, factory, name); // start with whatever fallback is present handlerProvider = BlazeCommandRunConfigurationHandlerProvider.findHandlerProvider(null); handler = handlerProvider.createHandler(this); try { handler.getState().readExternal(elementState); } catch (InvalidDataException e) { logger.error(e); } }
@Override public void readSettings(@NotNull Element node) throws InvalidDataException { final String attributeValue = node.getAttributeValue("ignoreVisibleSpaces"); if (attributeValue != null) { myIgnoreVisibleSpaces = Boolean.valueOf(attributeValue); } }
@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); } }
@SuppressWarnings({"HardCodedStringLiteral"}) public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); final String value = JDOMExternalizerUtil.readField(element, "USE_CLASS_FILTERS"); USE_CLASS_FILTERS = "true".equalsIgnoreCase(value); myClassFilters = DebuggerUtilsEx.readFilters(element.getChildren("filter")); }
@Override public void loadState(Element state) { try { readExternal(state); myIsLoaded = true; } catch (InvalidDataException e) { LOG.error(e); } }
public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); DefaultJDOMExternalizer.readExternal(this, element); TextWithImports childrenExpression = DebuggerUtils.getInstance().readTextWithImports(element, "CHILDREN_EXPRESSION"); if(childrenExpression != null) { setChildrenExpression(childrenExpression); } TextWithImports childrenExpandable = DebuggerUtils.getInstance().readTextWithImports(element, "CHILDREN_EXPANDABLE"); if(childrenExpandable != null) { myChildrenExpandable.setReferenceExpression(childrenExpandable); } }
@Override public void readExternal(final Element element) throws InvalidDataException { final String value = element.getAttributeValue(VALUE_ATTRIBUTE); myUrl = value != null ? value : ""; final String protocol = VirtualFileManager.extractProtocol(myUrl); if (protocol == null) myUrl = urlValue(myUrl); }
@Override public void readSettings(@NotNull Element node) throws InvalidDataException { super.readSettings(node); for (Element option : node.getChildren("option")) { if ("onlyWarnOnProtectedClone".equals(option.getAttributeValue("name"))) { onlyWarnOnProtectedClone = Boolean.parseBoolean(option.getAttributeValue("value")); } } }
public static void loadFacetConfiguration(final @NotNull FacetConfiguration configuration, final @Nullable Element config) throws InvalidDataException { if (config != null) { if (configuration instanceof PersistentStateComponent) { ComponentSerializationUtil.loadComponentState((PersistentStateComponent)configuration, config); } else { configuration.readExternal(config); } } }
@Test public void readAndWriteShouldHandleNulls() throws InvalidDataException, WriteExternalException { Element element = new Element("test"); state.writeExternal(element); BlazeAndroidRunConfigurationCommonState readState = new BlazeAndroidRunConfigurationCommonState(buildSystem().getName(), false); readState.readExternal(element); assertThat(readState.getBlazeFlagsState().getRawFlags()) .isEqualTo(state.getBlazeFlagsState().getRawFlags()); assertThat(readState.getExeFlagsState().getRawFlags()) .isEqualTo(state.getExeFlagsState().getRawFlags()); assertThat(readState.isNativeDebuggingEnabled()).isEqualTo(state.isNativeDebuggingEnabled()); }
private String processFile(String fileText) throws IncorrectOperationException, InvalidDataException, IOException { String result = ""; int startOffset = fileText.indexOf(TestUtils.BEGIN_MARKER); if (startOffset < 0) { startOffset = fileText.indexOf(ALL_MARKER); replaceAllOccurences = true; fileText = IntroduceVariableTest.removeAllMarker(fileText); } else { replaceAllOccurences = false; fileText = TestUtils.removeBeginMarker(fileText); } int endOffset = fileText.indexOf(TestUtils.END_MARKER); fileText = TestUtils.removeEndMarker(fileText); myFixture.configureByText(GroovyFileType.GROOVY_FILE_TYPE, fileText); Editor myEditor = myFixture.getEditor(); myEditor.getSelectionModel().setSelection(startOffset, endOffset); GrExpression selectedExpr = PsiImplUtil.findElementInRange(myFixture.getFile(), startOffset, endOffset, GrExpression.class); Assert.assertNotNull("Selected expression reference points to null", selectedExpr); final PsiElement tempContainer = GrIntroduceHandlerBase.getEnclosingContainer(selectedExpr); Assert.assertTrue(tempContainer instanceof GroovyPsiElement); PsiElement[] occurences = GroovyRefactoringUtil.getExpressionOccurrences(PsiUtil.skipParentheses(selectedExpr, false), tempContainer); String varName = "preved"; GroovyVariableValidator validator = new GroovyVariableValidator(new GrIntroduceContextImpl(getProject(), myEditor, selectedExpr, null, null, occurences, tempContainer)); result = validator.isOKTest(varName, replaceAllOccurences); return result; }
/** * Deserializes the configuration represented by the given XML element, then searches for an * existing run configuration in the project with the same name and type. */ @Nullable @VisibleForTesting static RunnerAndConfigurationSettings findExisting(Project project, Element element) throws InvalidDataException { RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project); RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(manager); RunnerAndConfigurationSettingsCompatUtils.readConfiguration(settings, element); RunConfiguration config = settings.getConfiguration(); if (config == null) { return null; } return manager.findConfigurationByTypeAndName(config.getType().getId(), config.getName()); }
@Override public void readExternal(Element element) throws InvalidDataException { boolean dataFound = false; for (Element item : (List<Element>)element.getChildren(ITEM)) { if (!dataFound) { clear(); dataFound = true; } add(StringUtil.unescapeXml(item.getAttributeValue(VALUE))); } }