Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
26,100 | void () { boolean isEnabled = myImportCodeStyleRB.isSelected() && !myCodeStylesListModel.isEmpty(); myCodeStylesList.setEnabled(isEnabled); myOrganizeImportsCheckBox.setEnabled(isEnabled); if (isEnabled) { myCodeStylesList.getSelectionModel().setSelectionInterval(0, 0); } else { myCodeStylesList.getSelectionModel().clearSelection(); } } | updateProjectListEnabledStatus |
26,101 | List<EclipseProjectCodeStyleData> () { List<EclipseProjectCodeStyleData> codeStyleDataList = new ArrayList<>(); ProjectBuilder builder = getWizardContext().getProjectBuilder(); if (builder instanceof EclipseImportBuilder eclipseImportBuilder) { for (String projectPath : eclipseImportBuilder.getParameters().projectsToConvert) { String projectName = EclipseProjectFinder.findProjectName(projectPath); if (projectName != null) { EclipseProjectCodeStyleData codeStyleData = new EclipseProjectCodeStyleData(projectName, projectPath); if (codeStyleData.loadEclipsePreferences()) { codeStyleDataList.add(codeStyleData); } } } } return codeStyleDataList; } | getCodeStylesList |
26,102 | ProjectImportBuilder () { return ProjectImportBuilder.EXTENSIONS_POINT_NAME.findExtensionOrFail(EclipseImportBuilder.class); } | doGetBuilder |
26,103 | ModuleWizardStep[] (WizardContext context) { final ProjectWizardStepFactory stepFactory = ProjectWizardStepFactory.getInstance(); return new ModuleWizardStep[]{new EclipseWorkspaceRootStep(context), new SelectEclipseImportedProjectsStep(context), new EclipseCodeStyleImportStep(context), stepFactory.createProjectJdkStep(context)/*, stepFactory.createNameAndLocationStep(context)*/}; } | createSteps |
26,104 | boolean (VirtualFile file) { return myProcessor.canOpenProject(file); } | canImportFromFile |
26,105 | String () { return EclipseBundle.message("eclipse.file.to.import.description"); } | getFileSample |
26,106 | void (final ActionEvent e) { final boolean dedicated = rbModulesDedicated.isSelected(); myDirComponent.setEnabled(dedicated); if (dedicated && myDirComponent.getText().length() == 0) { final String remoteStorage = Options.getProjectStorageDir(context.getProject()); myDirComponent.setText(remoteStorage != null ? remoteStorage : FileUtil.toSystemDependentName(myWorkspaceRootComponent.getText())); } } | actionPerformed |
26,107 | JComponent () { return myPanel; } | getComponent |
26,108 | String () { return EclipseBundle.message("eclipse.import.step.name"); } | getName |
26,109 | void () { final String projectFilesDir; if (myDirComponent.isEnabled()) { projectFilesDir = myDirComponent.getText(); } else { projectFilesDir = null; } suggestProjectNameAndPath(projectFilesDir, myWorkspaceRootComponent.getText()); getParameters().converterOptions.commonModulesDirectory = projectFilesDir; getParameters().converterOptions.testPattern = wildcardToRegexp(myTestSourcesMask.getText()); getParameters().linkConverted = myLinkCheckBox.isSelected(); getParameters().projectsToConvert = null; if (getWizardContext().isCreatingNewProject()) { myProjectFormatPanel.updateData(getWizardContext()); } PropertiesComponent.getInstance().setValue(_ECLIPSE_PROJECT_DIR, myWorkspaceRootComponent.getText()); Options.saveProjectStorageDir(getParameters().converterOptions.commonModulesDirectory); } | updateDataModel |
26,110 | void () { String path = getBuilder().getFileToImport(); if (path == null) { if (getWizardContext().isProjectFileDirectorySet() || !PropertiesComponent.getInstance().isValueSet(_ECLIPSE_PROJECT_DIR)) { path = getWizardContext().getProjectFileDirectory(); } else { path = PropertiesComponent.getInstance().getValue(_ECLIPSE_PROJECT_DIR); } } myWorkspaceRootComponent.setText(path.replace('/', File.separatorChar)); myWorkspaceRootComponent.getTextField().selectAll(); final String storageDir = Options.getProjectStorageDir(getWizardContext().getProject()); final boolean colocated = StringUtil.isEmptyOrSpaces(getParameters().converterOptions.commonModulesDirectory) && StringUtil.isEmptyOrSpaces(storageDir); rbModulesColocated.setSelected(colocated); rbModulesDedicated.setSelected(!colocated); myDirComponent.setEnabled(!colocated); if (StringUtil.isEmptyOrSpaces(getParameters().converterOptions.commonModulesDirectory)) { myDirComponent.setText(storageDir); } else { myDirComponent.setText(getParameters().converterOptions.commonModulesDirectory); } myTestSourcesMask.setText(regexpToWildcard(getParameters().converterOptions.testPattern)); myLinkCheckBox.setSelected(getParameters().linkConverted); } | updateStep |
26,111 | String (String string) { return string == null ? null : string.replaceAll("\\.", "\\.") // "." -> "\." .replaceAll("\\*", ".*") // "*" -> ".*" .replaceAll("\\?", ".") // "?" -> "." .replaceAll(",\\s*", "|"); // "," possible followed by whitespace -> "|" } | wildcardToRegexp |
26,112 | String (String string) { return string == null ? null : string.replaceAll("\\.\\*", "*") // ".*" -> "*" .replaceAll("\\.", "?") // "." -> "?" .replaceAll("\\\\\\?", ".") // "\?" -> "." .replaceAll("\\|", ", "); // "|" -> ","; } | regexpToWildcard |
26,113 | JComponent () { return myWorkspaceRootComponent.getTextField(); } | getPreferredFocusedComponent |
26,114 | String () { return "reference.dialogs.new.project.import.eclipse.page1"; } | getHelpId |
26,115 | EclipseProjectWizardContext () { return (EclipseProjectWizardContext)getBuilder(); } | getContext |
26,116 | Set<String> () { final Set<String> allCons = new HashSet<>(); allCons.add(EclipseXml.GROOVY_SUPPORT); allCons.add(EclipseXml.GROOVY_DSL_CONTAINER); for (EclipseNatureImporter provider : EP_NAME.getExtensionList()) { allCons.addAll(provider.getProvidedCons()); } return allCons; } | getAllDefinedCons |
26,117 | List<String> () { return Arrays.asList(EclipseXml.JAVA_NATURE, EclipseXml.JREBEL_NATURE, EclipseXml.SONAR_NATURE); } | getDefaultNatures |
26,118 | void (final String element, final boolean isMarked) { duplicateNames = null; fileChooser.repaint(); } | elementMarkChanged |
26,119 | boolean (final String item) { calcDuplicates(); return fileChooser.getMarkedElements().contains(item) && duplicateNames.contains(EclipseProjectFinder.findProjectName(item)); } | isInConflict |
26,120 | void () { if (duplicateNames == null) { duplicateNames = new HashSet<>(); Set<String> usedNames = new HashSet<>(); for (String model : fileChooser.getMarkedElements()) { final String projectName = EclipseProjectFinder.findProjectName(model); if (!usedNames.add(projectName)) { duplicateNames.add(projectName); } } } } | calcDuplicates |
26,121 | String (final String item) { StringBuilder stringBuilder = new StringBuilder(); final String projectName = EclipseProjectFinder.findProjectName(item); stringBuilder.append(projectName); String relPath = PathUtil.getRelative(((EclipseImportBuilder)getBuilder()).getParameters().root, item); if (!relPath.equals(".") && !relPath.equals(projectName)) { stringBuilder.append(" (").append(relPath).append(")"); } return stringBuilder.toString(); } | getElementText |
26,122 | Icon (final String item) { return isInConflict(item) ? AllIcons.Actions.Cancel : null; } | getElementIcon |
26,123 | void () { super.updateStep(); duplicateNames = null; } | updateStep |
26,124 | String () { return EclipseBundle.message("eclipse.projects.to.import.selection.step.name"); } | getName |
26,125 | String () { return "reference.dialogs.new.project.import.eclipse.page2"; } | getHelpId |
26,126 | String () { return EclipseBundle.message("eclipse.name"); } | getName |
26,127 | Icon () { return AllIcons.Providers.Eclipse; } | getIcon |
26,128 | String () { return getParameters().root; } | getRootDirectory |
26,129 | boolean (@NotNull String path) { ProgressManager.getInstance().run(new Task.Modal(getCurrentProject(), EclipseBundle.message("eclipse.import.scanning"), true) { @Override public void run(@NotNull ProgressIndicator indicator) { List<String> roots = new ArrayList<>(); EclipseProjectFinder.findModuleRoots(roots, path, (@NlsSafe var path12) -> { final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (progressIndicator != null) { if (progressIndicator.isCanceled()) return false; progressIndicator.setText2(path12); } return true; }); roots.sort((path1, path2) -> { final String projectName1 = EclipseProjectFinder.findProjectName(path1); final String projectName2 = EclipseProjectFinder.findProjectName(path2); return projectName1 != null && projectName2 != null ? projectName1.compareToIgnoreCase(projectName2) : 0; }); getParameters().workspace = roots; getParameters().root = path; } @Override public void onCancel() { getParameters().workspace = null; getParameters().root = null; } }); setFileToImport(path); return getParameters().workspace != null; } | setRootDirectory |
26,130 | void (@NotNull ProgressIndicator indicator) { List<String> roots = new ArrayList<>(); EclipseProjectFinder.findModuleRoots(roots, path, (@NlsSafe var path12) -> { final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (progressIndicator != null) { if (progressIndicator.isCanceled()) return false; progressIndicator.setText2(path12); } return true; }); roots.sort((path1, path2) -> { final String projectName1 = EclipseProjectFinder.findProjectName(path1); final String projectName2 = EclipseProjectFinder.findProjectName(path2); return projectName1 != null && projectName2 != null ? projectName1.compareToIgnoreCase(projectName2) : 0; }); getParameters().workspace = roots; getParameters().root = path; } | run |
26,131 | void () { getParameters().workspace = null; getParameters().root = null; } | onCancel |
26,132 | List<String> () { return getParameters().workspace; } | getList |
26,133 | boolean (final String element) { if (getParameters().projectsToConvert != null) { return getParameters().projectsToConvert.contains(element); } return !getParameters().existingModuleNames.contains(EclipseProjectFinder.findProjectName(element)); } | isMarked |
26,134 | void (List<String> list) { getParameters().projectsToConvert = list; } | setList |
26,135 | boolean () { return getParameters().openModuleSettings; } | isOpenProjectSettingsAfter |
26,136 | void (boolean on) { getParameters().openModuleSettings = on; } | setOpenProjectSettingsAfter |
26,137 | void () { super.cleanup(); parameters = null; } | cleanup |
26,138 | boolean (@Nullable Project currentProject, @NotNull Project project) { final Ref<Exception> refEx = new Ref<>(); final Set<String> variables = new HashSet<>(); final Map<String, String> naturesNames = new HashMap<>(); final List<String> projectsToConvert = getParameters().projectsToConvert; final boolean oneProjectToConvert = projectsToConvert.size() == 1; final String separator = oneProjectToConvert ? "<br>" : ", "; ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { try { for (String path : projectsToConvert) { File classPathFile = new File(path, EclipseXml.DOT_CLASSPATH_EXT); if (classPathFile.exists()) { EclipseClasspathReader.collectVariables(variables, JDOMUtil.load(classPathFile), path); } collectUnknownNatures(path, naturesNames, separator); } } catch (IOException | JDOMException e) { refEx.set(e); } }, EclipseBundle.message("eclipse.import.converting"), false, null); if (!refEx.isNull()) { Messages.showErrorDialog(project, refEx.get().getMessage(), getTitle()); return false; } if (!ProjectMacrosUtil.checkNonIgnoredMacros(project, variables)) { return false; } if (!naturesNames.isEmpty()) { final String title = EclipseBundle.message("notification.title.unknown.natures.detected"); final String naturesByProject; if (oneProjectToConvert) { naturesByProject = naturesNames.values().iterator().next(); } else { naturesByProject = StringUtil.join(naturesNames.keySet(), projectPath -> projectPath + "(" + naturesNames.get(projectPath) + ")", "<br>"); } Notifications.Bus.notify(new Notification("Unknown Natures Detected", title, EclipseBundle .message("notification.content.imported.projects.contain.unknown.natures", naturesByProject), NotificationType.WARNING)); } return true; } | validate |
26,139 | List<Module> (final Project project, ModifiableModuleModel model, ModulesProvider modulesProvider, ModifiableArtifactModel artifactModel) { final Collection<@NlsSafe String> unknownLibraries = new TreeSet<>(); final Collection<String> unknownJdks = new TreeSet<>(); final Set<String> refsToModules = new HashSet<>(); final List<Module> result = new ArrayList<>(); final Map<Module, Set<String>> module2NatureNames = new HashMap<>(); try { final ModifiableModuleModel moduleModel = model != null ? model : ModuleManager.getInstance(project).getModifiableModel(); final ModifiableRootModel[] rootModels = new ModifiableRootModel[getParameters().projectsToConvert.size()]; final Set<File> files = new HashSet<>(); final Set<String> moduleNames = new HashSet<>(getParameters().projectsToConvert.size()); for (String path : getParameters().projectsToConvert) { String modulesDirectory = getParameters().converterOptions.commonModulesDirectory; if (modulesDirectory == null) { modulesDirectory = path; } final String moduleName = EclipseProjectFinder.findProjectName(path); moduleNames.add(moduleName); final File imlFile = new File(modulesDirectory + File.separator + moduleName + ModuleManagerEx.IML_EXTENSION); if (imlFile.isFile()) { files.add(imlFile); } final File emlFile = new File(modulesDirectory + File.separator + moduleName + EclipseXml.IDEA_SETTINGS_POSTFIX); if (emlFile.isFile()) { files.add(emlFile); } } if (!files.isEmpty()) { final int resultCode = Messages.showYesNoCancelDialog(EclipseBundle.message( "dialog.message.0.module.files.found.1.would.you.like.to.reuse.them", ApplicationNamesInfo.getInstance().getFullProductName(), StringUtil.join(files, file -> file.getPath(), "\n")), EclipseBundle.message("dialog.title.module.files.found"), Messages.getQuestionIcon()); if (resultCode != Messages.YES) { if (resultCode == Messages.NO) { final LocalFileSystem localFileSystem = LocalFileSystem.getInstance(); for (File file : files) { final VirtualFile virtualFile = localFileSystem.findFileByIoFile(file); if (virtualFile != null) { ApplicationManager.getApplication().runWriteAction(new ThrowableComputable<Void, IOException>() { @Override public Void compute() throws IOException { virtualFile.delete(this); return null; } }); } else { FileUtil.delete(file); } } } else { return result; } } } int idx = 0; for (String path : getParameters().projectsToConvert) { String modulesDirectory = getParameters().converterOptions.commonModulesDirectory; if (modulesDirectory == null) { modulesDirectory = path; } final Module module = moduleModel.newModule(modulesDirectory + "/" + EclipseProjectFinder.findProjectName(path) + ModuleManagerEx.IML_EXTENSION, StdModuleTypes.JAVA.getId()); result.add(module); final Set<String> natures = collectNatures(path); if (natures.size() > 0) { module2NatureNames.put(module, natures); } final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel(); rootModels[idx++] = rootModel; final File classpathFile = new File(path, EclipseXml.DOT_CLASSPATH_EXT); final EclipseClasspathReader classpathReader = new EclipseClasspathReader(path, project, getParameters().projectsToConvert, moduleNames); classpathReader.init(rootModel); if (classpathFile.exists()) { Element classpathElement = JDOMUtil.load(classpathFile); classpathReader.readClasspath(rootModel, unknownLibraries, unknownJdks, refsToModules, getParameters().converterOptions.testPattern, classpathElement); } else { EclipseClasspathReader.setOutputUrl(rootModel, path + "/bin"); } ClasspathStorage.setStorageType(rootModel, getParameters().linkConverted ? JpsEclipseClasspathSerializer.CLASSPATH_STORAGE_ID : ClassPathStorageUtil.DEFAULT_STORAGE); if (model != null) { ApplicationManager.getApplication().runWriteAction(() -> rootModel.commit()); } } if (model == null) { ApplicationManager.getApplication().runWriteAction(() -> ModifiableModelCommitter.multiCommit(rootModels, moduleModel)); } } catch (Exception e) { LOG.error(e); } scheduleNaturesImporting(project, module2NatureNames); createEclipseLibrary(project, unknownLibraries, IdeaXml.ECLIPSE_LIBRARY); refsToModules.removeAll(getParameters().existingModuleNames); for (String path : getParameters().projectsToConvert) { final String projectName = EclipseProjectFinder.findProjectName(path); if (projectName != null) { refsToModules.remove(projectName); getParameters().existingModuleNames.add(projectName); } } @Nls StringBuilder message = new StringBuilder(); if (!refsToModules.isEmpty()) { message.append(EclipseBundle.message("unknown.modules.detected.dialog.message", StringUtil.join(refsToModules, "\n"))); } if (!unknownJdks.isEmpty()) { message.append(EclipseBundle.message("unknown.jdks.detected.message", message.length() > 0 ? 0 : 1, StringUtil.join(unknownJdks, "\n"))); } if (!unknownLibraries.isEmpty()) { final HtmlBuilder buf = new HtmlBuilder(); buf.append(EclipseBundle.message("eclipse.import.warning.undefinded.libraries")); for (@NlsSafe String name : unknownLibraries) { buf.br().append(name); } if (model == null) { buf.br().append(HtmlChunk.text(EclipseBundle.message("unknown.libraries.dialog.description")).bold()); final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) { @Override public boolean isFileSelectable(@Nullable VirtualFile file) { return super.isFileSelectable(file) && Comparing.strEqual(file.getExtension(), "userlibraries"); } }; descriptor.setDescription(buf.wrapWithHtmlBody().toString()); descriptor.setTitle(getTitle()); final VirtualFile selectedFile = FileChooser.chooseFile(descriptor, project, project.getBaseDir()); if (selectedFile != null) { try { EclipseUserLibrariesHelper.readProjectLibrariesContent(selectedFile, project, unknownLibraries); } catch (Exception e) { LOG.error(e); } } } } setupProjectCodeStyle(project, message); if (message.length() > 0) { Messages.showErrorDialog(project, message.toString(), getTitle()); } return result; } | commit |
26,140 | boolean (@Nullable VirtualFile file) { return super.isFileSelectable(file) && Comparing.strEqual(file.getExtension(), "userlibraries"); } | isFileSelectable |
26,141 | void (@NotNull Project project, @NotNull StringBuilder messageBuilder) { try { EclipseProjectCodeStyleData codeStyleData = getParameters().codeStyleData; if (codeStyleData != null) { CodeStyleSettings projectSettings = codeStyleData.importCodeStyle(); if (projectSettings != null) { CodeStyle.setMainProjectSettings(project, projectSettings); } } } catch (Exception e) { if (messageBuilder.length() > 0) messageBuilder.append('\n'); messageBuilder.append(EclipseBundle.message("error.while.importing.project.code.style", e.getMessage())); } } | setupProjectCodeStyle |
26,142 | void (@NotNull final Project project, @NotNull final Map<Module, Set<String>> module2NatureNames) { if (module2NatureNames.size() == 0) { return; } StartupManager.getInstance(project).runAfterOpened(() -> { DumbService.getInstance(project).smartInvokeLater(() -> { for (EclipseNatureImporter importer : EclipseNatureImporter.EP_NAME.getExtensions()) { final String importerNatureName = importer.getNatureName(); final List<Module> modulesToImport = new ArrayList<>(); for (Map.Entry<Module, Set<String>> entry : module2NatureNames.entrySet()) { final Module module = entry.getKey(); final Set<String> natureNames = entry.getValue(); if (natureNames.contains(importerNatureName)) { modulesToImport.add(module); } } if (modulesToImport.size() > 0) { importer.doImport(project, modulesToImport); } } }); }); } | scheduleNaturesImporting |
26,143 | void (final Project project, final Collection<String> libraries, final String libraryName) { if (libraries.contains(libraryName)) { final FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false, false) { @Override public Icon getIcon(final VirtualFile file) { return looksLikeEclipse(file) ? dressIcon(file, AllIcons.Providers.Eclipse) : super.getIcon(file); } private static boolean looksLikeEclipse(final VirtualFile file) { return file.findChild(".eclipseproduct") != null; } }; fileChooserDescriptor.setTitle(EclipseBundle.message("eclipse.create.library.title")); fileChooserDescriptor.setDescription(EclipseBundle.message("eclipse.create.library.description", libraryName)); final VirtualFile file = FileChooser.chooseFile(fileChooserDescriptor, project, null); if (file != null) { final VirtualFile pluginsDir = file.findChild("plugins"); if (pluginsDir != null) { ApplicationManager.getApplication().runWriteAction(() -> { final LibraryTable table = LibraryTablesRegistrar.getInstance().getLibraryTableByLevel(LibraryTablesRegistrar.APPLICATION_LEVEL, project); assert table != null; final LibraryTable.ModifiableModel tableModel = table.getModifiableModel(); final Library library = tableModel.createLibrary(libraryName); final Library.ModifiableModel libraryModel = library.getModifiableModel(); libraryModel.addJarDirectory(pluginsDir, true); libraryModel.commit(); tableModel.commit(); }); libraries.remove(libraryName); } } } } | createEclipseLibrary |
26,144 | Icon (final VirtualFile file) { return looksLikeEclipse(file) ? dressIcon(file, AllIcons.Providers.Eclipse) : super.getIcon(file); } | getIcon |
26,145 | boolean (final VirtualFile file) { return file.findChild(".eclipseproduct") != null; } | looksLikeEclipse |
26,146 | Parameters () { if (parameters == null) { parameters = new Parameters(); parameters.existingModuleNames = new HashSet<>(); if (isUpdate()) { Project project = getCurrentProject(); if (project != null) { for (Module module : ModuleManager.getInstance(project).getModules()) { parameters.existingModuleNames.add(module.getName()); } } } } return parameters; } | getParameters |
26,147 | void (String path, Map<String, String> naturesNames, String separator) { Set<String> natures = collectNatures(path); natures.removeAll(EclipseNatureImporter.getDefaultNatures()); for (EclipseNatureImporter importer : EclipseNatureImporter.EP_NAME.getExtensions()) { natures.remove(importer.getNatureName()); } if (!natures.isEmpty()) { naturesNames.put(path, StringUtil.join(natures, separator)); } } | collectUnknownNatures |
26,148 | Set<String> (@NotNull String path) { Set<String> naturesNames = new HashSet<>(); try { Element natures = JDOMUtil.load(new File(path, EclipseXml.DOT_PROJECT_EXT)).getChild("natures"); if (natures != null) { for (Element nature : natures.getChildren("nature")) { String natureName = nature.getText(); if (!StringUtil.isEmptyOrSpaces(natureName)) { naturesNames.add(natureName); } } } } catch (Exception ignore) { } return naturesNames; } | collectNatures |
26,149 | String (Project project) { return PropertiesComponent.getInstance().getValue(ECLIPSE_REMOTE_PROJECT_STORAGE); } | getProjectStorageDir |
26,150 | void (String dir) { PropertiesComponent.getInstance().setValue(ECLIPSE_REMOTE_PROJECT_STORAGE, dir); } | saveProjectStorageDir |
26,151 | String (@NonNls @NotNull String postfix) { return String.format("%s.%s", FORMATTER_OPTIONS_PREFIX, postfix); } | completeId |
26,152 | boolean () { try { myCorePreferences = loadProperties(CORE_PREFS_FILE_NAME); myUiPreferences = loadProperties(UI_PREFS_FILE_NAME); myImportOrganizeImportsConfig = isEclipseImportsConfigAvailable(); return myCorePreferences != null && formatterOptionsExist(myCorePreferences) && myUiPreferences != null; } catch (IOException e) { LOG.warn(e); } return false; } | loadEclipsePreferences |
26,153 | boolean (@NotNull Properties eclipseProperties) { for (String propertyKey : eclipseProperties.stringPropertyNames()) { if (propertyKey.startsWith(FORMATTER_OPTIONS_PREFIX)) return true; } return false; } | formatterOptionsExist |
26,154 | File (@NotNull String fileName) { String filePath = myProjectPath + File.separator + ECLIPSE_SETTINGS_SUBDIR + File.separator + fileName; File prefsFile = new File(filePath); return prefsFile.exists() ? prefsFile : null; } | getPreferencesFile |
26,155 | String () { return myProjectName; } | getProjectName |
26,156 | String () { String profileName = getFormatterProfileName(); return myProjectName + (profileName != null ? ": " + profileName : ""); } | toString |
26,157 | String () { String rawName = myUiPreferences != null ? myUiPreferences.getProperty(OPTION_FORMATTER_PROFILE) : null; if (rawName != null) { if (PREDEFINED_ECLIPSE_PROFILES.containsKey(rawName)) { return PREDEFINED_ECLIPSE_PROFILES.get(rawName); } rawName = StringUtil.trimStart(rawName, "_"); } return rawName; } | getFormatterProfileName |
26,158 | boolean () { return myUiPreferences != null && myUiPreferences.getProperty(OPTION_IMPORT_ORDER) != null; } | isEclipseImportsConfigAvailable |
26,159 | boolean () { return isEclipseImportsConfigAvailable() && myImportOrganizeImportsConfig; } | isImportOrganizeImportsConfig |
26,160 | void (boolean importOrganizeImportsConfig) { myImportOrganizeImportsConfig = importOrganizeImportsConfig; } | setImportOrganizeImportsConfig |
26,161 | void (@NotNull Properties uiPreferences, @NotNull CodeStyleSettings settings) { JavaCodeStyleSettings javaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class); importOrderOfImports(uiPreferences, javaSettings); importStarImportThresholds(uiPreferences, javaSettings); javaSettings.LAYOUT_STATIC_IMPORTS_SEPARATELY = true; javaSettings.PACKAGES_TO_USE_IMPORT_ON_DEMAND.copyFrom(new PackageEntryTable()); } | importOptimizeImportsSettings |
26,162 | void (@NotNull Properties uiPreferences, @NotNull JavaCodeStyleSettings javaSettings) { String oderOfImportsValue = uiPreferences.getProperty(OPTION_IMPORT_ORDER); if (oderOfImportsValue != null) { PackageEntryTable importLayoutTable = new PackageEntryTable(); importLayoutTable.addEntry(PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY); String[] chunks = oderOfImportsValue.split(";"); for (String importString : chunks) { if (!importString.trim().isEmpty()) { boolean isStatic = importString.startsWith("#"); importString = StringUtil.trimStart(importString, "#"); importLayoutTable.addEntry(PackageEntry.BLANK_LINE_ENTRY); importLayoutTable.addEntry(new PackageEntry(isStatic, importString, true)); } } if (importLayoutTable.getEntryCount() > 0) { importLayoutTable.addEntry(PackageEntry.BLANK_LINE_ENTRY); importLayoutTable.addEntry(PackageEntry.ALL_OTHER_IMPORTS_ENTRY); javaSettings.getImportLayoutTable().copyFrom(importLayoutTable); } } } | importOrderOfImports |
26,163 | void (@NotNull Properties uiPreferences, @NotNull JavaCodeStyleSettings javaSettings) { javaSettings.CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND = parseThreshold(uiPreferences.getProperty(OPTION_ON_DEMAND_IMPORT_THRESHOLD)); javaSettings.NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND = parseThreshold(uiPreferences.getProperty(OPTION_ON_DEMAND_STATIC_IMPORT_THRESHOLD)); } | importStarImportThresholds |
26,164 | int (@Nullable String s) { if (s != null) { try { return Integer.parseInt(s); } catch (NumberFormatException nfe) { // ignore and return default } } return DEFAULT_IMPORTS_THRESHOLD; } | parseThreshold |
26,165 | boolean (@NotNull String tagName) { if (tagName.length() >= BACKGROUND_SUFFIX.length()) { tagName = tagName.substring(tagName.length() - BACKGROUND_SUFFIX.length()); return tagName.equalsIgnoreCase(BACKGROUND_SUFFIX); } return false; } | isBackground |
26,166 | String () { return myThemeName; } | getThemeName |
26,167 | int (@NotNull String tag, @NotNull Attributes attributes) { int fontStyle = getDefaultFontStyle(tag); String boldValue = attributes.getValue(BOLD_ATTR); if (boldValue != null) { if (Boolean.parseBoolean(boldValue)) fontStyle |= Font.BOLD; else fontStyle &= ~Font.BOLD; } String italicValue = attributes.getValue(ITALIC_ATTR); if (italicValue != null) { if (Boolean.parseBoolean(italicValue)) fontStyle |= Font.ITALIC; else fontStyle &= ~Font.ITALIC; } return fontStyle; } | getFontStyle |
26,168 | int (@NotNull String tag) { //noinspection MagicConstant return ECLIPSE_DEFAULT_FONT_STYLES.getOrDefault(tag, Font.PLAIN); } | getDefaultFontStyle |
26,169 | EffectType (@NotNull Attributes attributes) { String strikeThrough = attributes.getValue(STRIKETHROUGH_ATTR); if (Boolean.parseBoolean(strikeThrough)) { return EffectType.STRIKEOUT; } String underline = attributes.getValue(UNDERLINE_ATTR); if (Boolean.parseBoolean(underline)) { return EffectType.LINE_UNDERSCORE; } return null; } | getEffectType |
26,170 | void (@NotNull EditorColorsScheme scheme) { Color background = scheme.getDefaultBackground(); String defaultSchemeName = ColorUtil.isDark(background) ? "Darcula" : EditorColorsScheme.DEFAULT_SCHEME_NAME; EditorColorsScheme baseScheme = DefaultColorSchemesManager.getInstance().getScheme(defaultSchemeName); assert baseScheme != null : "Can not find default scheme '" + defaultSchemeName + "'!"; for (TextAttributesKey attributesKey : ATTRIBUTES_TO_COPY) { copyAttributes(baseScheme, scheme, attributesKey); } for (ColorKey colorKey : COLORS_TO_COPY) { copyColor(baseScheme, scheme, colorKey); } for (String keyName : EXTERNAL_ATTRIBUTES) { TextAttributesKey key = TextAttributesKey.createTextAttributesKey(keyName); copyAttributes(baseScheme, scheme, key); } for (String keyName : EXTERNAL_COLORS) { ColorKey key = ColorKey.createColorKey(keyName); copyColor(baseScheme, scheme, key); } Color lightForeground = ColorUtil.mix(background, scheme.getDefaultForeground(), 0.5); scheme.setColor(EditorColors.WHITESPACES_COLOR, lightForeground); scheme.setColor(EditorColors.INDENT_GUIDE_COLOR, lightForeground); scheme.setColor(EditorColors.SOFT_WRAP_SIGN_COLOR, lightForeground); TextAttributes matchedBrace = new TextAttributes(); matchedBrace.setEffectType(EffectType.BOXED); matchedBrace.setEffectColor(lightForeground); scheme.setAttributes(CodeInsightColors.MATCHED_BRACE_ATTRIBUTES, matchedBrace); TextAttributes unmatchedBrace = matchedBrace.clone(); Color errorColor = ColorUtil.mix(background, Color.RED, 0.5); unmatchedBrace.setEffectColor(errorColor); scheme.setAttributes(CodeInsightColors.UNMATCHED_BRACE_ATTRIBUTES, unmatchedBrace); TextAttributes markedForRemoval = scheme.getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES); if (markedForRemoval != null) { markedForRemoval = markedForRemoval.clone(); if (markedForRemoval.getEffectColor() == null) markedForRemoval.setEffectType(EffectType.STRIKEOUT); markedForRemoval.setEffectColor(errorColor); scheme.setAttributes(CodeInsightColors.MARKED_FOR_REMOVAL_ATTRIBUTES, markedForRemoval); } TextAttributes visibilityModifier = new TextAttributes(); scheme.setAttributes(JavaHighlightingColors.PUBLIC_REFERENCE_ATTRIBUTES, visibilityModifier); scheme.setAttributes(JavaHighlightingColors.PRIVATE_REFERENCE_ATTRIBUTES, visibilityModifier); scheme.setAttributes(JavaHighlightingColors.PACKAGE_PRIVATE_REFERENCE_ATTRIBUTES, visibilityModifier); scheme.setAttributes(JavaHighlightingColors.PROTECTED_REFERENCE_ATTRIBUTES, visibilityModifier); } | setupMissingColors |
26,171 | void (@NotNull EditorColorsScheme source, @NotNull EditorColorsScheme target, @NotNull TextAttributesKey key) { target.setAttributes(key, source.getAttributes(key)); } | copyAttributes |
26,172 | void (@NotNull EditorColorsScheme source, @NotNull EditorColorsScheme target, @NotNull ColorKey key) { target.setColor(key, source.getColor(key)); } | copyColor |
26,173 | void (@NotNull String name, @NotNull TextAttributes attributes) { switch (name) { case BACKGROUND_TAG -> { updateAttributes(HighlighterColors.TEXT, attributes); myColorsScheme.setColor(EditorColors.GUTTER_BACKGROUND, attributes.getBackgroundColor()); myColorsScheme.setColor(ConsoleViewContentType.CONSOLE_BACKGROUND_KEY, attributes.getBackgroundColor()); } case FOREGROUND_TAG -> { updateAttributes(HighlighterColors.TEXT, attributes); updateAttributes(DefaultLanguageHighlighterColors.IDENTIFIER, attributes); } case CURR_LINE_TAG -> myColorsScheme.setColor(EditorColors.CARET_ROW_COLOR, attributes.getForegroundColor()); case SELECTION_BACKGROUND_TAG -> myColorsScheme.setColor(EditorColors.SELECTION_BACKGROUND_COLOR, attributes.getBackgroundColor()); case SELECTION_FOREGROUND_TAG -> myColorsScheme.setColor(EditorColors.SELECTION_FOREGROUND_COLOR, attributes.getForegroundColor()); case BRACKET -> { myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.BRACES, attributes); myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.BRACKETS, attributes); myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.PARENTHESES, attributes); } case OPERATOR_TAG -> { myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.OPERATION_SIGN, attributes); myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.COMMA, attributes); myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.SEMICOLON, attributes); myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.DOT, attributes); } case LINE_NUMBER_TAG -> { Color lineNumberColor = attributes.getForegroundColor(); myColorsScheme.setColor(EditorColors.LINE_NUMBERS_COLOR, lineNumberColor); myColorsScheme.setColor(EditorColors.TEARLINE_COLOR, lineNumberColor); myColorsScheme.setColor(EditorColors.RIGHT_MARGIN_COLOR, lineNumberColor); myColorsScheme.setColor(EditorColors.CARET_COLOR, lineNumberColor); } case LOCAL_VARIABLE_TAG -> { myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.LOCAL_VARIABLE, attributes); myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.MARKUP_TAG, attributes); } case LOCAL_VARIABLE_DECL_TAG -> { myColorsScheme.setAttributes(XmlHighlighterColors.HTML_TAG_NAME, attributes); myColorsScheme.setAttributes(XmlHighlighterColors.XML_TAG_NAME, attributes); } case FIELD_TAG -> { myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.INSTANCE_FIELD, attributes); myColorsScheme.setAttributes(XmlHighlighterColors.XML_ATTRIBUTE_NAME, attributes); myColorsScheme.setAttributes(XmlHighlighterColors.HTML_ATTRIBUTE_NAME, attributes); } case OCCURENCE_TAG -> myColorsScheme.setAttributes(EditorColors.IDENTIFIER_UNDER_CARET_ATTRIBUTES, toBackgroundAttributes(attributes)); case WRITE_OCCURENCE_TAG -> myColorsScheme.setAttributes(EditorColors.WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES, toBackgroundAttributes(attributes)); case SEARCH_RESULT_TAG -> myColorsScheme.setAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES, toBackgroundAttributes(attributes)); case FILTER_SEARCH_RESULT_TAG -> myColorsScheme.setAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES, toBackgroundAttributes(attributes)); case STRING_TAG -> { myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.STRING, attributes); TextAttributes validEscapeAttrs = attributes.clone(); validEscapeAttrs.setFontType(Font.BOLD); myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE, validEscapeAttrs); } case KEYWORD_TAG -> { myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.KEYWORD, attributes); myColorsScheme.setAttributes(DefaultLanguageHighlighterColors.MARKUP_ENTITY, attributes); } default -> { if (ECLIPSE_TO_IDEA_ATTR_MAP.containsKey(name)) { myColorsScheme.setAttributes(ECLIPSE_TO_IDEA_ATTR_MAP.get(name), attributes); } } } } | handleColorOption |
26,174 | void (@NotNull TextAttributesKey key, @NotNull TextAttributes attributes) { if (myColorsScheme instanceof AbstractColorsScheme) { TextAttributes alreadyDefined = ((AbstractColorsScheme)myColorsScheme).getDirectlyDefinedAttributes(key); if (alreadyDefined != null) { alreadyDefined = alreadyDefined.clone(); if (attributes.getForegroundColor() != null) alreadyDefined.setForegroundColor(attributes.getForegroundColor()); if (attributes.getBackgroundColor() != null) alreadyDefined.setBackgroundColor(attributes.getBackgroundColor()); myColorsScheme.setAttributes(key, alreadyDefined); return; } } myColorsScheme.setAttributes(key, attributes); } | updateAttributes |
26,175 | TextAttributes (@NotNull TextAttributes attributes) { TextAttributes backgroundAttrs = attributes.clone(); backgroundAttrs.setBackgroundColor(attributes.getForegroundColor()); backgroundAttrs.setForegroundColor(null); return backgroundAttrs; } | toBackgroundAttributes |
26,176 | void () { myFixture.addFileToProject("p.properties", "key=value"); myFixture.addFileToProject("p_en.properties", "key=value eng"); final PsiFile file = myFixture.addFileToProject("p_ru.properties", ""); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file); assertNotNull(propertiesFile); final ResourceBundle resourceBundle = propertiesFile.getResourceBundle(); assertSize(3, resourceBundle.getPropertiesFiles()); final IncompletePropertyInspection incompletePropertyInspection = IncompletePropertyInspection.getInstance(propertiesFile.getContainingFile()); incompletePropertyInspection.addSuffixes(Collections.singleton("ru")); assertTrue(incompletePropertyInspection.isPropertyComplete("key", resourceBundle)); } | testPropertyIsComplete |
26,177 | void () { myFixture.addFileToProject("p.properties", "key=value"); myFixture.addFileToProject("p_en.properties", "key=value eng"); final PsiFile file = myFixture.addFileToProject("p_ru.properties", "key=value rus"); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file); assertNotNull(propertiesFile); final ResourceBundle resourceBundle = propertiesFile.getResourceBundle(); assertSize(3, resourceBundle.getPropertiesFiles()); final IncompletePropertyInspection incompletePropertyInspection = IncompletePropertyInspection.getInstance(propertiesFile.getContainingFile()); assertTrue(incompletePropertyInspection.isPropertyComplete("key", resourceBundle)); } | testPropertyIsComplete2 |
26,178 | void () { myFixture.addFileToProject("p.properties", "key=value"); myFixture.addFileToProject("p_en.properties", "key=value eng"); myFixture.addFileToProject("p_fr.properties", ""); final PsiFile file = myFixture.addFileToProject("p_ru.properties", ""); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file); assertNotNull(propertiesFile); final ResourceBundle resourceBundle = propertiesFile.getResourceBundle(); assertSize(4, resourceBundle.getPropertiesFiles()); final IncompletePropertyInspection incompletePropertyInspection = IncompletePropertyInspection.getInstance(propertiesFile.getContainingFile()); incompletePropertyInspection.addSuffixes(Collections.singleton("ru")); assertFalse(incompletePropertyInspection.isPropertyComplete("key", resourceBundle)); } | testPropertyIsIncomplete |
26,179 | void () { myFixture.addFileToProject("p.properties", "key=value"); myFixture.addFileToProject("p_en.properties", ""); myFixture.addFileToProject("p_en_EN.properties", ""); myFixture.addFileToProject("p_en_GB.properties", ""); final PsiFile file = myFixture.addFileToProject("p_en_US.properties", ""); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file); assertNotNull(propertiesFile); final ResourceBundle resourceBundle = propertiesFile.getResourceBundle(); assertSize(5, resourceBundle.getPropertiesFiles()); final IncompletePropertyInspection incompletePropertyInspection = IncompletePropertyInspection.getInstance(propertiesFile.getContainingFile()); incompletePropertyInspection.addSuffixes(Collections.singleton("en")); assertFalse(incompletePropertyInspection.isPropertyComplete("key", resourceBundle)); } | testPropertyIsIncomplete2 |
26,180 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData/insertManager/"; } | getTestDataPath |
26,181 | void () { myFixture.configureByFile(getTestName(true) + "/p.properties"); myFixture.configureByFile(getTestName(true) + "/p_en.properties"); myFixture.configureByFile(getTestName(true) + "/p_fr.properties"); final PsiFile file = myFixture.configureByFile(getTestName(true) + "/p_ru.properties"); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file); final ResourceBundlePropertiesUpdateManager manager = new ResourceBundlePropertiesUpdateManager(propertiesFile.getResourceBundle()); manager.reload(); assertTrue(manager.isAlphaSorted()); } | testIsAlphaSorted |
26,182 | void () { doTest(new TestAction() { @Override public void doTestAction(PropertiesFile baseFile, PropertiesFile translationFile, ResourceBundlePropertiesUpdateManager manager) { assertTrue(manager.isAlphaSorted()); manager.insertNewProperty("l", "v"); manager.insertOrUpdateTranslation("d", "v", baseFile); manager.insertOrUpdateTranslation("r", "v", translationFile); manager.insertNewProperty("a", "v"); manager.insertOrUpdateTranslation("a", "v", translationFile); manager.insertNewProperty("z", "v"); manager.insertOrUpdateTranslation("z", "v", translationFile); manager.insertOrUpdateTranslation("l", "v", translationFile); manager.insertOrUpdateTranslation("e", "v", translationFile); manager.insertOrUpdateTranslation("t", "v", baseFile); } }); } | testAddToAlphaOrdered |
26,183 | void (PropertiesFile baseFile, PropertiesFile translationFile, ResourceBundlePropertiesUpdateManager manager) { assertTrue(manager.isAlphaSorted()); manager.insertNewProperty("l", "v"); manager.insertOrUpdateTranslation("d", "v", baseFile); manager.insertOrUpdateTranslation("r", "v", translationFile); manager.insertNewProperty("a", "v"); manager.insertOrUpdateTranslation("a", "v", translationFile); manager.insertNewProperty("z", "v"); manager.insertOrUpdateTranslation("z", "v", translationFile); manager.insertOrUpdateTranslation("l", "v", translationFile); manager.insertOrUpdateTranslation("e", "v", translationFile); manager.insertOrUpdateTranslation("t", "v", baseFile); } | doTestAction |
26,184 | void () { doTest(new TestAction() { @Override public void doTestAction(PropertiesFile baseFile, PropertiesFile translationFile, ResourceBundlePropertiesUpdateManager manager) { assertFalse(manager.isAlphaSorted()); manager.insertNewProperty("bnm", "v"); manager.insertNewProperty("uio", "v"); manager.insertOrUpdateTranslation("uio", "v", translationFile); manager.insertOrUpdateTranslation("qwe", "v", translationFile); manager.insertOrUpdateTranslation("zxc", "v", baseFile); } }); } | testAddToOrdered |
26,185 | void (PropertiesFile baseFile, PropertiesFile translationFile, ResourceBundlePropertiesUpdateManager manager) { assertFalse(manager.isAlphaSorted()); manager.insertNewProperty("bnm", "v"); manager.insertNewProperty("uio", "v"); manager.insertOrUpdateTranslation("uio", "v", translationFile); manager.insertOrUpdateTranslation("qwe", "v", translationFile); manager.insertOrUpdateTranslation("zxc", "v", baseFile); } | doTestAction |
26,186 | void () { doTest(new TestAction() { @Override public void doTestAction(PropertiesFile baseFile, PropertiesFile translationFile, ResourceBundlePropertiesUpdateManager manager) { assertFalse(manager.isAlphaSorted()); manager.insertOrUpdateTranslation("bnm", "v", translationFile); manager.insertNewProperty("ghj", "v"); manager.insertOrUpdateTranslation("ghj", "v", translationFile); manager.insertNewProperty("uio", "v"); manager.insertOrUpdateTranslation("uio", "v", translationFile); } }); } | testAddToUnordered |
26,187 | void (PropertiesFile baseFile, PropertiesFile translationFile, ResourceBundlePropertiesUpdateManager manager) { assertFalse(manager.isAlphaSorted()); manager.insertOrUpdateTranslation("bnm", "v", translationFile); manager.insertNewProperty("ghj", "v"); manager.insertOrUpdateTranslation("ghj", "v", translationFile); manager.insertNewProperty("uio", "v"); manager.insertOrUpdateTranslation("uio", "v", translationFile); } | doTestAction |
26,188 | void (final TestAction testAction) { final PsiFile baseFile = myFixture.configureByFile(getTestName(true) + "/p.properties"); final PsiFile translationFile = myFixture.configureByFile(getTestName(true) + "/p_en.properties"); final PropertiesFile basePropertiesFile = PropertiesImplUtil.getPropertiesFile(baseFile); assertNotNull(basePropertiesFile); final ResourceBundle bundle = basePropertiesFile.getResourceBundle(); final ResourceBundlePropertiesUpdateManager manager = new ResourceBundlePropertiesUpdateManager(bundle); assertInstanceOf(manager, ResourceBundlePropertiesUpdateManager.class); WriteCommandAction.runWriteCommandAction(getProject(), () -> testAction.doTestAction(basePropertiesFile, PropertiesImplUtil.getPropertiesFile(translationFile), manager)); myFixture.checkResultByFile(getTestName(true) + "/p.properties", getTestName(true) + "/p-after.properties", true); myFixture.checkResultByFile(getTestName(true) + "/p_en.properties", getTestName(true) + "/p-after_en.properties",true); } | doTest |
26,189 | void () { final PsiFile file = myFixture.addFileToProject("empty.properties", ""); final ResourceBundleImpl bundle = new ResourceBundleImpl((PropertiesFile)file); bundle.invalidate(); ResourceBundleFileStructureViewElement myElement = new ResourceBundleFileStructureViewElement(bundle, () -> true); Assert.assertNull("Should return null on an invalidated resource bundle", myElement.getFiles()); } | testGetFilesNull |
26,190 | void () { final PsiFile rawDefault = myFixture.addFileToProject("p.properties", ""); myFixture.addFileToProject("p_en.properties", ""); final PropertiesFile defaultFile = PropertiesImplUtil.getPropertiesFile(rawDefault); assertNotNull(defaultFile); final PropertiesFile file = defaultFile.getResourceBundle().getDefaultPropertiesFile(); assertTrue(file.getContainingFile().isEquivalentTo(defaultFile.getContainingFile())); } | testDefaultPropertyFile |
26,191 | void () { doTestRenameResourceBundleEntryFile("old_p.properties", "old_p_en.properties", "new_p.properties", "new_p_en.properties"); } | testRenameResourceBundleEntryFile |
26,192 | void () { doTestRenameResourceBundleEntryFile("ppp.properties", "ppp_en.properties", "qqq.properties", "qqq_en.properties"); } | testRenameResourceBundleEntryFile2 |
26,193 | void () { doTestRenameResourceBundleEntryFile("p.properties.properties", "p.properties_en.properties", "p.properties", "p_en.properties"); } | testRenameResourceBundleEntryFile3 |
26,194 | void () { final PsiFile toCheckFile = myFixture.addFileToProject("p.properties", "key=value"); myFixture.configureByText("p_en.properties", "ke<caret>y=en_value"); myFixture.renameElementAtCaret("new_key"); assertEquals(toCheckFile.getText(), "new_key=value"); } | testRenamePropertyKey |
26,195 | void () { final PsiFile xmlFile = myFixture.addFileToProject("p.xml", """ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> </properties>"""); final PsiFile propFile = myFixture.addFileToProject("p.properties", ""); final PropertiesFile xmlPropFile = PropertiesImplUtil.getPropertiesFile(xmlFile); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(propFile); assertNotNull(xmlPropFile); assertNotNull(propertiesFile); assertEquals(xmlPropFile, assertOneElement(xmlPropFile.getResourceBundle().getPropertiesFiles())); assertEquals(propertiesFile, assertOneElement(propertiesFile.getResourceBundle().getPropertiesFiles())); } | testDifferentPropertiesDontCombinedToResourceBundle |
26,196 | void (String fileNameToRenameBefore, String fileNameToCheckBefore, String fileNameToRenameAfter, String fileNameToCheckAfter) { final PsiFile toRenameFile = myFixture.addFileToProject(fileNameToRenameBefore, ""); final PsiFile toCheck = myFixture.addFileToProject(fileNameToCheckBefore, ""); final RenameProcessor processor = new RenameProcessor(getProject(), toRenameFile, fileNameToRenameAfter, true, true); for (AutomaticRenamerFactory factory : AutomaticRenamerFactory.EP_NAME.getExtensionList()) { if (factory instanceof ResourceBundleRenamerFactory) { processor.addRenamerFactory(factory); } } processor.run(); assertEquals(fileNameToCheckAfter, toCheck.getName()); } | doTestRenameResourceBundleEntryFile |
26,197 | boolean (@NotNull DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return false; } final ResourceBundle bundle = ResourceBundleUtil.getResourceBundleFromDataContext(dataContext); if (bundle == null) { return false; } final FileEditor fileEditor = PlatformCoreDataKeys.FILE_EDITOR.getData(dataContext); if (!(fileEditor instanceof ResourceBundleEditor)) { return false; } final VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); return virtualFile instanceof ResourceBundleAsVirtualFile; } | isAvailableOnDataContext |
26,198 | void (final @NotNull Project project, Editor editor, final PsiFile file, DataContext dataContext) { final ResourceBundleEditor resourceBundleEditor = (ResourceBundleEditor)PlatformCoreDataKeys.FILE_EDITOR.getData(dataContext); assert resourceBundleEditor != null; final Object selectedElement = resourceBundleEditor.getSelectedElementIfOnlyOne(); if (selectedElement != null) { CommandProcessor.getInstance().runUndoTransparentAction(() -> { if (selectedElement instanceof PropertiesPrefixGroup group) { ResourceBundleRenameUtil.renameResourceBundleKeySection(getPsiElementsFromGroup(group), group.getPresentableName(), group.getPrefix().length() - group.getPresentableName().length()); } else if (selectedElement instanceof PropertyStructureViewElement) { final PsiElement psiElement = ((PropertyStructureViewElement)selectedElement).getPsiElement(); ResourceBundleRenameUtil.renameResourceBundleKey(psiElement, project); } else if (selectedElement instanceof ResourceBundleFileStructureViewElement) { ResourceBundleRenameUtil.renameResourceBundleBaseName(((ResourceBundleFileStructureViewElement)selectedElement).getValue(), project); } else { throw new IllegalStateException("unsupported type: " + selectedElement.getClass()); } }); } } | invoke |
26,199 | void (@NotNull Project project, PsiElement @NotNull [] elements, DataContext dataContext) { invoke(project, null, null, dataContext); } | invoke |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.