Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
27,100
void () { setOKActionEnabled(!StringUtil.isEmptyOrSpaces(getKey())); }
somethingChanged
27,101
void () { List<@NlsSafe String> paths = suggestPropertiesFiles(); final String lastUrl = suggestSelectedFileUrl(); final String lastPath = lastUrl == null ? null : FileUtil.toSystemDependentName(VfsUtilCore.urlToPath(lastUrl)); if (lastPath != null) { paths.remove(lastPath); paths.add(0, lastPath); } myPropertiesFile.s...
populatePropertiesFiles
27,102
String () { return LastSelectedPropertiesFileStore.getInstance().suggestLastSelectedPropertiesFileUrl(myContext); }
suggestSelectedFileUrl
27,103
void () { if (myCreateNewPropertyRb.isSelected()) { PropertiesFile propertiesFile = getPropertiesFile(); if (propertiesFile != null) { LastSelectedPropertiesFileStore.getInstance().saveLastSelectedPropertiesFile(myContext, propertiesFile); } } }
saveLastSelectedFile
27,104
List<String> () { if (myCustomization.propertiesFiles != null && !myCustomization.propertiesFiles.isEmpty()) { ArrayList<String> list = new ArrayList<>(); for (PropertiesFile propertiesFile : myCustomization.propertiesFiles) { final VirtualFile virtualFile = propertiesFile.getVirtualFile(); if (virtualFile != null) { l...
suggestPropertiesFiles
27,105
List<String> () { return I18nUtil.defaultSuggestPropertiesFiles(myProject, myContextModules); }
defaultSuggestPropertiesFiles
27,106
PropertiesFile () { String path = getPropertiesFilePath(); if (path == null) return null; return getPropertyFileByPath(FileUtil.toSystemIndependentName(path)); }
getPropertiesFile
27,107
String () { return (String)myPropertiesFile.getSelectedItem(); }
getPropertiesFilePath
27,108
PropertiesFile (String path) { VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path); return virtualFile != null ? PropertiesImplUtil.getPropertiesFile(PsiManager.getInstance(myProject).findFile(virtualFile)) : null; }
getPropertyFileByPath
27,109
boolean () { if (myExistingProperties.isEnabled()) { IProperty item = myExistingProperties.getItem(); if (item != null) return true; } return false; }
useExistingProperty
27,110
boolean () { if (getPropertiesFile() != null) return true; final String path = getPropertiesFilePath(); if (StringUtil.isEmptyOrSpaces(path)) { String message = PropertiesBundle.message("i18nize.empty.file.path", path); Messages.showErrorDialog(myProject, message, PropertiesBundle.message("i18nize.error.creating.proper...
createPropertiesFileIfNotExists
27,111
JComponent () { return myPanel; }
createCenterPanel
27,112
JComponent () { return myCustomization.focusValueComponent ? myValue:myKey; }
getPreferredFocusedComponent
27,113
void () { super.dispose(); }
dispose
27,114
void () { if (!createPropertiesFileIfNotExists()) return; saveLastSelectedFile(); Collection<PropertiesFile> propertiesFiles = getAllPropertiesFiles(); HashMap<PropertiesFile, IProperty> existingProperties; try { ThrowableComputable<HashMap<PropertiesFile, IProperty>, RuntimeException> existingPropertiesGenerator = () ...
doOKAction
27,115
String () { return "editing.propertyFile.i18nInspection"; }
getHelpId
27,116
String () { if (useExistingProperty()) { return myExistingProperties.getItem().getUnescapedValue(); } return unescapeLineBreaks(myValue.getText()); }
getValue
27,117
String () { if (useExistingProperty()) { return myExistingProperties.getItem().getUnescapedKey(); } return getKeyTextField().getText(); }
getKey
27,118
boolean () { assert !ApplicationManager.getApplication().isUnitTestMode(); show(); return getExitCode() == OK_EXIT_CODE; }
hasValidData
27,119
boolean () { return myUseResourceBundle.isEnabled() && myUseResourceBundle.isSelected(); }
isUseResourceBundle
27,120
String () { return "#com.intellij.codeInsight.i18n.I18nizeQuickFixDialog"; }
getDimensionServiceKey
27,121
Collection<PropertiesFile> () { if (useExistingProperty()) { return Collections.singleton(myExistingProperties.getItem().getPropertiesFile()); } PropertiesFile propertiesFile = getPropertiesFile(); if (propertiesFile == null) return Collections.emptySet(); Collection<PropertiesFile> propertiesFiles; if (isUseResourceBu...
getAllPropertiesFiles
27,122
String () { return getFixName(); }
getName
27,123
String () { return getText(); }
getFamilyName
27,124
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement psiElement = descriptor.getPsiElement(); if (isAvailable(project, null, null)) { invoke(project, null, psiElement.getContainingFile()); } }
applyFix
27,125
String () { return getFixName(); }
getText
27,126
boolean (@NotNull Project project, @Nullable Editor editor, @Nullable PsiFile file) { return myElement != null && myElement.retrieve() != null; }
isAvailable
27,127
void (@NotNull final Project project, @Nullable Editor editor, @NotNull PsiFile file) { invokeAction(project, file, myElement.retrieve(), myKey, myPropertiesFiles); }
invoke
27,128
IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { String fileName = myPropertiesFiles != null && !myPropertiesFiles.isEmpty() ? myPropertiesFiles.get(0).getName() : ""; return new IntentionPreviewInfo.CustomDiff(PropertiesFileType.INSTANCE, fileName, myKey + "=", myKey + "...
generatePreview
27,129
void (@NotNull final Project project, @NotNull PsiFile file, @NotNull PsiElement psiElement, @Nullable final String suggestedKey, @Nullable final List<PropertiesFile> propertiesFiles) { final I18nizeQuickFixModel model; final I18nizeQuickFixDialog.DialogCustomization dialogCustomization = createDefaultCustomization(sug...
invokeAction
27,130
String () { return ""; }
getValue
27,131
String () { return dialogCustomization.getSuggestedName(); }
getKey
27,132
boolean () { return true; }
hasValidData
27,133
Collection<PropertiesFile> () { return propertiesFiles; }
getAllPropertiesFiles
27,134
Couple<String> (Project project, PsiElement psiElement, I18nizeQuickFixModel model) { if (!model.hasValidData()) { return null; } final String key = model.getKey(); final String value = model.getValue(); final Collection<PropertiesFile> selectedPropertiesFiles = model.getAllPropertiesFiles(); createProperty(project, ps...
doAction
27,135
void (@NotNull final Project project, @NotNull final PsiElement psiElement, @NotNull final Collection<? extends PropertiesFile> selectedPropertiesFiles, @NotNull final String key, @NotNull final String value) { for (PropertiesFile selectedFile : selectedPropertiesFiles) { if (!FileModificationService.getInstance().prep...
createProperty
27,136
boolean () { return false; }
startInWriteAction
27,137
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { doAdd(parameters, result); }
addCompletions
27,138
void (CompletionParameters parameters, final CompletionResultSet result) { PsiElement position = parameters.getPosition(); PsiElement parent = position.getParent(); PsiElement gParent = parent != null ? parent.getParent() : null; PsiReference[] references = parent == null ? position.getReferences() : ArrayUtil.mergeArr...
doAdd
27,139
boolean (PsiReference @NotNull [] references, @NotNull PropertyReference propertyReference) { return propertyReference.isSoft() && ContainerUtil.or(references, reference -> !reference.isSoft()); }
hasMoreImportantReference
27,140
void (LookupElement element, LookupElementPresentation presentation) { IProperty property = (IProperty)element.getObject(); presentation.setIcon(PlatformIcons.PROPERTY_ICON); String key = StringUtil.notNullize(property.getUnescapedKey()); presentation.setItemText(key); PropertiesFile propertiesFile = property.getProper...
renderElement
27,141
LookupElement[] (Set<Object> variants) { return variants.stream().map(o -> o instanceof String ? LookupElementBuilder.create((String)o).withIcon(PlatformIcons.PROPERTY_ICON) : createVariant((IProperty)o)) .filter(Objects::nonNull).toArray(LookupElement[]::new); }
getVariants
27,142
LookupElement (IProperty property) { String key = property.getKey(); return key == null ? null : LookupElementBuilder.create(property, key).withRenderer(LOOKUP_ELEMENT_RENDERER); }
createVariant
27,143
void (@NotNull CompletionInitializationContext context) { if (context.getFile() instanceof PropertiesFile) { context.setDummyIdentifier(CompletionUtil.DUMMY_IDENTIFIER_TRIMMED); } }
beforeCompletion
27,144
boolean (DataContext dataContext) { return ResourceBundle.ARRAY_DATA_KEY.getData(dataContext) != null; }
canMove
27,145
boolean (PsiElement[] elements, @Nullable final PsiElement targetContainer, @Nullable PsiReference reference) { return false; }
canMove
27,146
boolean (PsiElement psiElement, PsiElement[] sources) { return MoveFilesOrDirectoriesHandler.isValidTarget(psiElement); }
isValidTarget
27,147
void (DataContext dataContext, Set<PsiElement> filesOrDirs) { final ResourceBundle[] bundles = ResourceBundle.ARRAY_DATA_KEY.getData(dataContext); LOG.assertTrue(bundles != null); for (ResourceBundle bundle : bundles) { List<PropertiesFile> propertiesFiles = bundle.getPropertiesFiles(); for (PropertiesFile propertiesFi...
collectFilesOrDirsFromContext
27,148
boolean (PsiElement source, PsiElement target) { if (source instanceof PropertiesFile && target instanceof PsiDirectory) { return source.getParent() == target; } return super.isMoveRedundant(source, target); }
isMoveRedundant
27,149
boolean (@NotNull Language language) { return false; // only available in project view }
supportsLanguage
27,150
void (@NotNull PresentationData data) { super.update(data); data.setLocationString(PropertiesBundle.message("project.view.resource.bundle.tree.node.text", getResourceBundle().getBaseName())); }
update
27,151
ResourceBundle () { return Objects.requireNonNull(PropertiesImplUtil.getPropertiesFile(getValue())).getResourceBundle(); }
getResourceBundle
27,152
String () { return super.getTestPresentation() + " (custom RB: " + getResourceBundle().getBaseName() + ")"; }
getTestPresentation
27,153
boolean (@NotNull VirtualFile file) { if (!file.isValid()) return false; assert myProject != null; PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file); PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(psiFile); return propertiesFile != null && getResourceBundle().getPropertiesFiles()....
contains
27,154
VirtualFile () { ResourceBundle rb = getResourceBundle(); if (!rb.isValid()) return null; final List<PropertiesFile> list = rb.getPropertiesFiles(); if (!list.isEmpty()) { return list.get(0).getVirtualFile(); } return null; }
getVirtualFile
27,155
void (@NotNull PresentationData presentation) { presentation.setIcon(AllIcons.Nodes.ResourceBundle); ResourceBundle rb = getResourceBundle(); if (rb.isValid()) { presentation.setPresentableText(PropertiesBundle.message("project.view.resource.bundle.tree.node.text", rb.getBaseName())); } }
update
27,156
boolean () { return true; }
canNavigateToSource
27,157
boolean () { return true; }
canNavigate
27,158
void (final boolean requestFocus) { assert myProject != null; OpenFileDescriptor descriptor = new OpenFileDescriptor(myProject, new ResourceBundleAsVirtualFile(getResourceBundle())); FileEditorManager.getInstance(myProject).openTextEditor(descriptor, requestFocus); }
navigate
27,159
boolean () { return true; }
isSortByFirstChild
27,160
Comparable () { return new PsiFileNode.ExtensionSortKey(PropertiesFileType.INSTANCE.getDefaultExtension()); }
getTypeSortKey
27,161
boolean () { if (!super.validate()) { return false; } final ResourceBundle newBundle = getResourceBundle().getDefaultPropertiesFile().getResourceBundle(); final ResourceBundle currentBundle = getResourceBundle(); if (!Comparing.equal(newBundle, currentBundle)) { return false; } return currentBundle.isValid(); }
validate
27,162
boolean () { return getResourceBundle().isValid(); }
isValid
27,163
boolean (TreeNode @NotNull [] sourceNodes) { for (TreeNode node : sourceNodes) { if (extractPropertiesFileFromNode(node) == null) return false; } return true; }
canDrop
27,164
void (TreeNode @NotNull [] sourceNodes, @NotNull DataContext dataContext) { MultiMap<ResourceBundle, PropertiesFile> bundleGrouping = new MultiMap<>(); for (TreeNode sourceNode : sourceNodes) { final PropertiesFile propertiesFile = extractPropertiesFileFromNode(sourceNode); if (propertiesFile == null) return; bundleGro...
drop
27,165
void (PsiFileSystemItem[] sourceFileArray, DataContext dataContext) { }
dropExternalFiles
27,166
Collection<VirtualFile> () { ResourceBundle rb = getResourceBundle(); return rb.isValid() ? ContainerUtil.map(rb.getPropertiesFiles(), PropertiesFile::getVirtualFile) : Collections.emptyList(); }
getRoots
27,167
ResourceBundle () { return Objects.requireNonNull(getValue()); }
getResourceBundle
27,168
PropertiesFile (TreeNode node) { if (!(node instanceof DefaultMutableTreeNode)) return null; final Object userObject = ((DefaultMutableTreeNode) node).getUserObject(); if (!(userObject instanceof PsiFileNode)) return null; final PsiFile file = ((PsiFileNode)userObject).getValue(); final PropertiesFile propertiesFile = ...
extractPropertiesFileFromNode
27,169
void (@NotNull List<? extends PropertiesFile> files, @NotNull Project project, @NotNull Consumer<? super AbstractTreeNode<?>> nodeConsumer, ViewSettings settings) { ResourceBundleManager manager = ResourceBundleManager.getInstance(project); MultiMap<Couple<String>, PropertiesFile> resourceBundles = new MultiMap<>(); Mu...
appendPropertiesFilesNodes
27,170
Object (@NotNull Collection<? extends AbstractTreeNode<?>> selected, @NotNull String dataId) { if (PlatformCoreDataKeys.BGT_DATA_PROVIDER.is(dataId)) { return (DataProvider)slowId -> getSlowData(selected, slowId); } return null; }
getData
27,171
Object (@NotNull Collection<? extends AbstractTreeNode<?>> selected, @NotNull String dataId) { if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) { for (AbstractTreeNode<?> selectedElement : selected) { Object element = selectedElement.getValue(); if (element instanceof ResourceBundle) { return new ResourceBundle...
getSlowData
27,172
void (ContainerEvent e) { PropertiesComponent.getInstance().setValue(checkBoxSelectedStateKey, myUseXMLBasedPropertiesCheckBox.isSelected()); }
componentRemoved
27,173
void () { final String errorString = myComponent.canCreateAllFilesForAllLocales(); if (errorString != null) { Messages.showErrorDialog(getContentPanel(), errorString); } else { final List<PsiFile> createFiles = myComponent.createPropertiesFiles(); myCreatedFiles = createFiles.toArray(PsiElement.EMPTY_ARRAY); super.doOK...
doOKAction
27,174
ValidationInfo () { for (String fileName : myComponent.getFileNamesToCreate()) { if (!PathUtil.isValidFileName(fileName)) { return new ValidationInfo( PropertiesBundle.message("create.resource.bundle.file.name.for.properties.file.0.is.invalid.error", fileName)); } else { if (myDirectory.findFile(fileName) != null) { re...
doValidate
27,175
JComponent () { return myComponent.getPanel(); }
createCenterPanel
27,176
JComponent () { return myComponent.myResourceBundleBaseNameTextField; }
getPreferredFocusedComponent
27,177
PsiElement[] () { return myCreatedFiles; }
getCreatedFiles
27,178
List<PsiFile> () { final Set<String> fileNames = getFileNamesToCreate(); final List<PsiFile> createdFiles = WriteCommandAction.runWriteCommandAction(myProject, (Computable<List<PsiFile>>)() -> ReadAction.compute(() -> ContainerUtil.map(fileNames, n -> { final boolean isXml = myResourceBundle == null ? myUseXMLBasedProp...
createPropertiesFiles
27,179
Set<String> () { final String name = getBaseName(); final String suffix = getPropertiesFileSuffix(); return ContainerUtil.map2Set(myLocalesModel.getItems(), locale -> name + (locale == PropertiesUtil.DEFAULT_LOCALE ? "" : ("_" + myLocaleSuffixes .getOrDefault(locale, locale.toString()))) + suffix); }
getFileNamesToCreate
27,180
void (Collection<? extends PsiFile> files) { Collection<PropertiesFile> createdFiles = ContainerUtil.map(files, dom -> { final PropertiesFile file = PropertiesImplUtil.getPropertiesFile(dom); LOG.assertTrue(file != null, dom.getName()); return file; }); ResourceBundle mainBundle = myResourceBundle; final Set<ResourceBu...
combineToResourceBundleIfNeeded
27,181
String () { return myResourceBundle == null ? myResourceBundleBaseNameTextField.getText() : myResourceBundle.getBaseName(); }
getBaseName
27,182
String () { if (myResourceBundle == null) { return myUseXMLBasedPropertiesCheckBox.isSelected() ? ".xml" : ".properties"; } return "." + myResourceBundle.getDefaultPropertiesFile().getContainingFile().getFileType().getDefaultExtension(); }
getPropertiesFileSuffix
27,183
JPanel () { return myPanel; }
getPanel
27,184
void () { final JBList<Locale> projectExistLocalesList = new JBList<>(); final MyExistLocalesListModel existLocalesListModel = new MyExistLocalesListModel(); projectExistLocalesList.setModel(existLocalesListModel); projectExistLocalesList.setCellRenderer(getLocaleRenderer()); myProjectExistLocalesPanel = ToolbarDecorat...
createUIComponents
27,185
void (@NotNull List<? extends Locale> elements) { final List<Locale> currentItems = getItems(); elements = ContainerUtil.filter(elements, locale -> !restrictedLocales.contains(locale) && !currentItems.contains(locale)); super.add(elements); }
add
27,186
void (FocusEvent e) { projectExistLocalesList.clearSelection(); }
focusGained
27,187
void (FocusEvent e) { localesToAddList.clearSelection(); }
focusGained
27,188
void (AnActionButton button) { final String rawAddedLocales = Messages.showInputDialog(myProject, PropertiesBundle.message("create.resource.bundle.dialog.add.locales.validator.message"), PropertiesBundle.message("create.resource.bundle.dialog.add.locales.validator.title"), null, null, new InputValidatorEx() { @Nullable...
run
27,189
String (String inputString) { return checkInput(inputString) ? null : PropertiesBundle.message("create.resource.bundle.invalid.locales.error.text"); }
getErrorText
27,190
boolean (String inputString) { return extractLocalesFromString(inputString) != null; }
checkInput
27,191
boolean (String inputString) { return checkInput(inputString); }
canClose
27,192
boolean (@NotNull MouseEvent event, int clickCount) { if (clickCount == 1) { myLocalesModel.add(projectExistLocalesList.getSelectedValuesList()); return true; } return false; }
onClick
27,193
void (ListSelectionEvent e) { final List<Locale> currentItems = myLocalesModel.getItems(); for (Locale l : projectExistLocalesList.getSelectedValuesList()) { if (!restrictedLocales.contains(l) && !currentItems.contains(l)) { myAddLocaleFromExistButton.setEnabled(true); return; } } myAddLocaleFromExistButton.setEnabled(...
valueChanged
27,194
boolean (@NotNull MouseEvent event, int clickCount) { if (clickCount == 1) { myLocalesModel.add(existLocalesListModel.getLocales()); } return false; }
onClick
27,195
ColoredListCellRenderer<Locale> () { return new ColoredListCellRenderer<>() { @Override protected void customizeCellRenderer(@NotNull JList list, Locale locale, int index, boolean selected, boolean hasFocus) { if (PropertiesUtil.DEFAULT_LOCALE == locale) { append(PropertiesBundle.message("create.resource.bundle.default...
getLocaleRenderer
27,196
void (@NotNull JList list, Locale locale, int index, boolean selected, boolean hasFocus) { if (PropertiesUtil.DEFAULT_LOCALE == locale) { append(PropertiesBundle.message("create.resource.bundle.default.locale.presentation")); } else { append(myLocaleSuffixes.getOrDefault(locale, locale.toString())); append(PropertiesUt...
customizeCellRenderer
27,197
int () { return myLocales.size(); }
getSize
27,198
Locale (int index) { return myLocales.get(index); }
getElementAt
27,199
List<Locale> () { return myLocales; }
getLocales