Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
23,600 | Configuration (Project project) { return project.getService(Configuration.class); } | getProjectInstance |
23,601 | List<BaseInjection> () { return Collections.emptyList(); } | getDefaultInjections |
23,602 | Collection<BaseInjection> (String languageId) { return myInjectionsById.getValue().get(languageId); } | getInjectionsByLanguageId |
23,603 | void (final List<BaseInjection> injections) { final Map<String, Set<BaseInjection>> map = ContainerUtil.classify(injections.iterator(), o -> o.getSupportId()); List<BaseInjection> originalInjections = new ArrayList<>(); List<BaseInjection> newInjections = new ArrayList<>(); for (String supportId : InjectorUtils.getActiveInjectionSupportIds()) { final Set<BaseInjection> importingInjections = map.get(supportId); if (importingInjections == null) continue; importInjections(getInjections(supportId), importingInjections, originalInjections, newInjections); } if (!newInjections.isEmpty()) configurationModified(); replaceInjections(newInjections, originalInjections, true); } | importPlaces |
23,604 | void (final Collection<? extends BaseInjection> existingInjections, final Collection<? extends BaseInjection> importingInjections, final Collection<? super BaseInjection> originalInjections, final Collection<? super BaseInjection> newInjections) { final MultiValuesMap<InjectionPlace, BaseInjection> placeMap = new MultiValuesMap<>(); for (BaseInjection exising : existingInjections) { for (InjectionPlace place : exising.getInjectionPlaces()) { placeMap.put(place, exising); } } main: for (BaseInjection other : importingInjections) { InjectionPlace[] places = other.getInjectionPlaces(); if (places.length == 0) { if (!existingInjections.contains(other)) newInjections.add(other); continue; } final Set<BaseInjection> matchingInjections = JBIterable.of(places) .flatten(o -> JBIterable.from(placeMap.get(o))).toSet(); if (matchingInjections.isEmpty()) { newInjections.add(other); } else { BaseInjection existing = null; for (BaseInjection injection : matchingInjections) { if (injection.equals(other)) continue main; if (existing == null && injection.sameLanguageParameters(other)) { existing = injection; } } if (existing == null) continue main; // skip!! language changed final BaseInjection newInjection = existing.copy(); newInjection.mergeOriginalPlacesFrom(other, true); if (!newInjection.equals(existing)) { originalInjections.add(existing); newInjections.add(newInjection); } } } } | importInjections |
23,605 | void () { incModificationCount(); } | configurationModified |
23,606 | BaseInjection (@NotNull final BaseInjection injection) { final List<BaseInjection> list = getInjections(injection.getSupportId()); for (BaseInjection cur : list) { if (cur.intersectsWith(injection)) return cur; } return null; } | findExistingInjection |
23,607 | boolean (final PsiLanguageInjectionHost host, final Collection<String> languages, final boolean enabled) { List<BaseInjection> originalInjections = new ArrayList<>(); List<BaseInjection> newInjections = new ArrayList<>(); for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { for (BaseInjection injection : getInjections(support.getId())) { if (!languages.contains(injection.getInjectedLanguageId())) continue; boolean replace = false; final ArrayList<InjectionPlace> newPlaces = new ArrayList<>(); for (InjectionPlace place : injection.getInjectionPlaces()) { if (place.isEnabled() != enabled && place.getElementPattern() != null && (place.getElementPattern().accepts(host) || place.getElementPattern().accepts(host.getParent()))) { newPlaces.add(place.enabled(enabled)); replace = true; } else newPlaces.add(place); } if (replace) { originalInjections.add(injection); final BaseInjection newInjection = injection.copy(); newInjection.setInjectionPlaces(newPlaces.toArray(InjectionPlace.EMPTY_ARRAY)); newInjections.add(newInjection); } } } if (!originalInjections.isEmpty()) { replaceInjectionsWithUndo(host.getProject(), host.getContainingFile(), newInjections, originalInjections, Collections.emptyList()); return true; } return false; } | setHostInjectionEnabled |
23,608 | void (Collection<? extends BaseInjection> injections) { for (BaseInjection injection : injections) { myInjections.get(injection.getSupportId()).add(injection); } } | setInjections |
23,609 | List<BaseInjection> (final String injectorId) { return Collections.unmodifiableList(myInjections.get(injectorId)); } | getInjections |
23,610 | void (Project project, @Nullable PsiFile hostFile, List<? extends BaseInjection> newInjections, List<? extends BaseInjection> originalInjections, List<? extends PsiElement> psiElementsToRemove) { replaceInjectionsWithUndo(project, hostFile, newInjections, originalInjections, true, psiElementsToRemove, (add, remove) -> { replaceInjectionsWithUndoInner(add, remove); if (ContainerUtil.find(add, LANGUAGE_INJECTION_CONDITION) != null || ContainerUtil.find(remove, LANGUAGE_INJECTION_CONDITION) != null) { FileContentUtil.reparseOpenedFiles(); } return true; }); } | replaceInjectionsWithUndo |
23,611 | void (final List<? extends BaseInjection> add, final List<? extends BaseInjection> remove) { replaceInjections(add, remove, false); } | replaceInjectionsWithUndoInner |
23,612 | void () { actualProcessor.process(remove, add); } | undo |
23,613 | void () { actualProcessor.process(add, remove); } | redo |
23,614 | boolean () { return global; } | isGlobal |
23,615 | boolean (List<? extends BaseInjection> newInjections, List<? extends BaseInjection> originalInjections, boolean forceLevel) { boolean changed = false; for (BaseInjection injection : originalInjections) { changed |= myInjections.get(injection.getSupportId()).remove(injection); } for (BaseInjection injection : newInjections) { changed |= myInjections.get(injection.getSupportId()).add(injection); } if (changed) { configurationModified(); } return changed; } | replaceInjections |
23,616 | void (List<? extends BaseInjection> injections, Runnable runnable) { replaceInjections(injections, ContainerUtil.emptyList(), true); try { runnable.run(); } finally { replaceInjections(ContainerUtil.emptyList(), injections, true); } } | withInjections |
23,617 | String () { return myLanguageAnnotation; } | getLanguageAnnotationClass |
23,618 | String () { return myPatternAnnotation; } | getPatternAnnotationClass |
23,619 | String () { return mySubstAnnotation; } | getSubstAnnotationClass |
23,620 | void (@Nullable String type) { if (type != null) { setInstrumentationType(InstrumentationType.valueOf(type)); } } | setInstrumentationType |
23,621 | void (@NotNull InstrumentationType type) { myInstrumentationType = type; } | setInstrumentationType |
23,622 | void (@Nullable String languageAnnotation) { if (languageAnnotation == null) return; myLanguageAnnotation = languageAnnotation; myLanguageAnnotationPair = Pair.create(languageAnnotation, Collections.singleton(languageAnnotation)); } | setLanguageAnnotation |
23,623 | void (@Nullable String patternAnnotation) { if (patternAnnotation == null) return; myPatternAnnotation = patternAnnotation; myPatternAnnotationPair = Pair.create(patternAnnotation, Collections.singleton(patternAnnotation)); } | setPatternAnnotation |
23,624 | void (@Nullable String substAnnotation) { if (substAnnotation == null) return; mySubstAnnotation = substAnnotation; mySubstAnnotationPair = Pair.create(substAnnotation, Collections.singleton(substAnnotation)); } | setSubstAnnotation |
23,625 | boolean () { return myIncludeUncomputablesAsLiterals; } | isIncludeUncomputablesAsLiterals |
23,626 | void (boolean flag) { myIncludeUncomputablesAsLiterals = flag; } | setIncludeUncomputablesAsLiterals |
23,627 | DfaOption () { return myDfaOption; } | getDfaOption |
23,628 | void (@NotNull final DfaOption dfaOption) { myDfaOption = dfaOption; } | setDfaOption |
23,629 | boolean () { return mySourceModificationAllowed; } | isSourceModificationAllowed |
23,630 | void (boolean sourceModificationAllowed) { mySourceModificationAllowed = sourceModificationAllowed; } | setSourceModificationAllowed |
23,631 | InstrumentationType () { return myInstrumentationType; } | getInstrumentation |
23,632 | void (@NotNull Element element) { AdvancedConfiguration defaults = new AdvancedConfiguration(); if (myInstrumentationType != defaults.myInstrumentationType) { JDOMExternalizerUtil.writeField(element, INSTRUMENTATION_TYPE_NAME, myInstrumentationType.toString()); } JDOMExternalizerUtil.writeField(element, LANGUAGE_ANNOTATION_NAME, myLanguageAnnotation, defaults.myLanguageAnnotation); JDOMExternalizerUtil.writeField(element, PATTERN_ANNOTATION_NAME, myPatternAnnotation, defaults.myPatternAnnotation); JDOMExternalizerUtil.writeField(element, SUBST_ANNOTATION_NAME, mySubstAnnotation, defaults.mySubstAnnotation); if (myIncludeUncomputablesAsLiterals) { JDOMExternalizerUtil.writeField(element, INCLUDE_UNCOMPUTABLES_AS_LITERALS, "true"); } if (mySourceModificationAllowed) { JDOMExternalizerUtil.writeField(element, SOURCE_MODIFICATION_ALLOWED, "true"); } if (myDfaOption != DfaOption.RESOLVE) { switch (myDfaOption) { case OFF -> {} case ASSIGNMENTS -> JDOMExternalizerUtil.writeField(element, LOOK_FOR_VAR_ASSIGNMENTS, Boolean.TRUE.toString()); case DFA -> JDOMExternalizerUtil.writeField(element, USE_DFA_IF_AVAILABLE, Boolean.TRUE.toString()); } } } | writeState |
23,633 | void (final Element element) { setInstrumentationType(JDOMExternalizerUtil.readField(element, INSTRUMENTATION_TYPE_NAME)); setLanguageAnnotation(JDOMExternalizerUtil.readField(element, LANGUAGE_ANNOTATION_NAME)); setPatternAnnotation(JDOMExternalizerUtil.readField(element, PATTERN_ANNOTATION_NAME)); setSubstAnnotation(JDOMExternalizerUtil.readField(element, SUBST_ANNOTATION_NAME)); if (readBoolean(element, RESOLVE_REFERENCES, true)) { setDfaOption(DfaOption.RESOLVE); } if (readBoolean(element, LOOK_FOR_VAR_ASSIGNMENTS, false)) { setDfaOption(DfaOption.ASSIGNMENTS); } if (readBoolean(element, USE_DFA_IF_AVAILABLE, false)) { setDfaOption(DfaOption.DFA); } setIncludeUncomputablesAsLiterals(readBoolean(element, INCLUDE_UNCOMPUTABLES_AS_LITERALS, false)); setSourceModificationAllowed(readBoolean(element, SOURCE_MODIFICATION_ALLOWED, false)); } | loadState |
23,634 | void (ToolbarDecorator decorator) { final Consumer<BaseInjection> consumer = this::addInjection; final Factory<BaseInjection> producer = (NullableFactory<BaseInjection>)() -> { final InjInfo info = getSelectedInjection(); return info == null? null : info.injection; }; for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { ContainerUtil.addAll(myAddActions, support.createAddActions(myProject, consumer)); final AnAction action = support.createEditAction(myProject, producer); myEditActions .put(support.getId(), action == null ? AbstractLanguageInjectionSupport.createDefaultEditAction(myProject, producer) : action); mySupports.put(support.getId(), support); } myAddActions.sort((o1, o2) -> Comparing.compare(o1.getTemplatePresentation().getText(), o2.getTemplatePresentation().getText())); decorator.disableUpDownActions(); decorator.setAddActionUpdater(e -> !myAddActions.isEmpty()); decorator.setAddAction(this::performAdd); decorator.setAddIcon(LayeredIcon.ADD_WITH_DROPDOWN); decorator.setRemoveActionUpdater(e -> { boolean enabled = false; for (InjInfo info : getSelectedInjections()) { if (!info.bundled) { enabled = true; break; } } return enabled; }); decorator.setRemoveAction(button -> performRemove()); decorator.setEditActionUpdater(e -> { AnAction edit = getEditAction(); if (edit != null) edit.update(e); return edit != null && e.getPresentation().isEnabled(); }); decorator.setEditAction(button -> performEditAction()); decorator.addExtraAction(new DumbAwareEDTUActionButton(IntelliLangBundle.messagePointer("action.AnActionButton.text.duplicate"), IntelliLangBundle.messagePointer("action.AnActionButton.description.duplicate"), IconManager.getInstance().getPlatformIcon(PlatformIcons.Copy)) { @Override public boolean isEnabled() { return getEditAction() != null; } @Override public void actionPerformed(@NotNull AnActionEvent e) { final InjInfo injection = getSelectedInjection(); if (injection != null) { addInjection(injection.injection.copy()); //performEditAction(e); } } }); decorator.addExtraAction( new DumbAwareEDTUActionButton(IntelliLangBundle.messagePointer("action.AnActionButton.text.enable.selected.injections"), IntelliLangBundle.messagePointer("action.AnActionButton.description.enable.selected.injections"), com.intellij.util.PlatformIcons.SELECT_ALL_ICON) { @Override public void actionPerformed(@NotNull final AnActionEvent e) { performSelectedInjectionsEnabled(true); } }); decorator.addExtraAction( new DumbAwareEDTUActionButton(IntelliLangBundle.messagePointer("action.AnActionButton.text.disable.selected.injections"), IntelliLangBundle.messagePointer("action.AnActionButton.description.disable.selected.injections"), com.intellij.util.PlatformIcons.UNSELECT_ALL_ICON) { @Override public void actionPerformed(@NotNull final AnActionEvent e) { performSelectedInjectionsEnabled(false); } }); new DumbAwareAction(IdeBundle.messagePointer("action.Anonymous.text.toggle")) { @Override public void update(@NotNull AnActionEvent e) { SpeedSearchSupply supply = SpeedSearchSupply.getSupply(myInjectionsTable); e.getPresentation().setEnabled(supply == null || !supply.isPopupActive()); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } @Override public void actionPerformed(@NotNull final AnActionEvent e) { performToggleAction(); } }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0)), myInjectionsTable); if (myInfos.length > 1) { AnActionButton shareAction = new DumbAwareEDTUActionButton(IntelliLangBundle.messagePointer("action.AnActionButton.text.move.to.ide.scope"), com.intellij.util.PlatformIcons.IMPORT_ICON) { { addCustomUpdater(e -> { CfgInfo cfg = getTargetCfgInfo(getSelectedInjections()); e.getPresentation().setText(cfg == getDefaultCfgInfo() ? IntelliLangBundle.message("label.text.move.to.ide.scope") : IntelliLangBundle.message("label.text.move.to.project.scope")); return cfg != null; }); } @Override public void actionPerformed(@NotNull final AnActionEvent e) { final List<InjInfo> injections = getSelectedInjections(); final CfgInfo cfg = getTargetCfgInfo(injections); if (cfg == null) return; for (InjInfo info : injections) { if (info.cfgInfo == cfg) continue; if (info.bundled) continue; info.cfgInfo.injectionInfos.remove(info); cfg.addInjection(info.injection); } final int[] selectedRows = myInjectionsTable.getSelectedRows(); myInjectionsTable.getListTableModel().setItems(getInjInfoList(myInfos)); TableUtil.selectRows(myInjectionsTable, selectedRows); } @Nullable private CfgInfo getTargetCfgInfo(final List<InjInfo> injections) { CfgInfo cfg = null; for (InjInfo info : injections) { if (info.bundled) { continue; } if (cfg == null) cfg = info.cfgInfo; else if (cfg != info.cfgInfo) return info.cfgInfo; } if (cfg == null) return null; for (CfgInfo info : myInfos) { if (info != cfg) return info; } throw new AssertionError(); } }; shareAction.setShortcut(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.SHIFT_DOWN_MASK))); decorator.addExtraAction(shareAction); } decorator.addExtraAction(new DumbAwareEDTUActionButton(IntelliLangBundle.messagePointer("action.AnActionButton.text.import"), IntelliLangBundle.messagePointer("action.AnActionButton.description.import"), AllIcons.Actions.Install) { @Override public void actionPerformed(@NotNull final AnActionEvent e) { doImportAction(e.getDataContext()); updateCountLabel(); } }); decorator.addExtraAction(new DumbAwareEDTUActionButton(IntelliLangBundle.messagePointer("action.AnActionButton.text.export"), IntelliLangBundle.messagePointer("action.AnActionButton.description.export"), AllIcons.ToolbarDecorator.Export) { @Override public void actionPerformed(@NotNull final AnActionEvent e) { List<BaseInjection> injections = getInjectionList(getSelectedInjections()); VirtualFileWrapper wrapper = FileChooserFactory.getInstance() .createSaveFileDialog(new FileSaverDescriptor(IntelliLangBundle.message("dialog.title.export.selected.injections.to.file"), "", "xml"), myProject) .save((Path)null, null); if (wrapper == null) { return; } Configuration configuration = new Configuration(); configuration.setInjections(injections); try { JDOMUtil.write(configuration.getState(), wrapper.getFile().toPath()); } catch (IOException ex) { final String msg = ex.getLocalizedMessage(); Messages.showErrorDialog(myProject, msg != null && msg.length() > 0 ? msg : ex.toString(), IntelliLangBundle.message("dialog.title.export.failed")); } } @Override public boolean isEnabled() { return !getSelectedInjections().isEmpty(); } }); } | createActions |
23,635 | boolean () { return getEditAction() != null; } | isEnabled |
23,636 | void (@NotNull AnActionEvent e) { final InjInfo injection = getSelectedInjection(); if (injection != null) { addInjection(injection.injection.copy()); //performEditAction(e); } } | actionPerformed |
23,637 | void (@NotNull final AnActionEvent e) { performSelectedInjectionsEnabled(true); } | actionPerformed |
23,638 | void (@NotNull final AnActionEvent e) { performSelectedInjectionsEnabled(false); } | actionPerformed |
23,639 | void (@NotNull AnActionEvent e) { SpeedSearchSupply supply = SpeedSearchSupply.getSupply(myInjectionsTable); e.getPresentation().setEnabled(supply == null || !supply.isPopupActive()); } | update |
23,640 | ActionUpdateThread () { return ActionUpdateThread.EDT; } | getActionUpdateThread |
23,641 | void (@NotNull final AnActionEvent e) { performToggleAction(); } | actionPerformed |
23,642 | void (@NotNull final AnActionEvent e) { final List<InjInfo> injections = getSelectedInjections(); final CfgInfo cfg = getTargetCfgInfo(injections); if (cfg == null) return; for (InjInfo info : injections) { if (info.cfgInfo == cfg) continue; if (info.bundled) continue; info.cfgInfo.injectionInfos.remove(info); cfg.addInjection(info.injection); } final int[] selectedRows = myInjectionsTable.getSelectedRows(); myInjectionsTable.getListTableModel().setItems(getInjInfoList(myInfos)); TableUtil.selectRows(myInjectionsTable, selectedRows); } | actionPerformed |
23,643 | CfgInfo (final List<InjInfo> injections) { CfgInfo cfg = null; for (InjInfo info : injections) { if (info.bundled) { continue; } if (cfg == null) cfg = info.cfgInfo; else if (cfg != info.cfgInfo) return info.cfgInfo; } if (cfg == null) return null; for (CfgInfo info : myInfos) { if (info != cfg) return info; } throw new AssertionError(); } | getTargetCfgInfo |
23,644 | void (@NotNull final AnActionEvent e) { doImportAction(e.getDataContext()); updateCountLabel(); } | actionPerformed |
23,645 | void (@NotNull final AnActionEvent e) { List<BaseInjection> injections = getInjectionList(getSelectedInjections()); VirtualFileWrapper wrapper = FileChooserFactory.getInstance() .createSaveFileDialog(new FileSaverDescriptor(IntelliLangBundle.message("dialog.title.export.selected.injections.to.file"), "", "xml"), myProject) .save((Path)null, null); if (wrapper == null) { return; } Configuration configuration = new Configuration(); configuration.setInjections(injections); try { JDOMUtil.write(configuration.getState(), wrapper.getFile().toPath()); } catch (IOException ex) { final String msg = ex.getLocalizedMessage(); Messages.showErrorDialog(myProject, msg != null && msg.length() > 0 ? msg : ex.toString(), IntelliLangBundle.message("dialog.title.export.failed")); } } | actionPerformed |
23,646 | boolean () { return !getSelectedInjections().isEmpty(); } | isEnabled |
23,647 | void () { final AnAction action = getEditAction(); if (action != null) { final int row = myInjectionsTable.getSelectedRow(); action.actionPerformed(new AnActionEvent(null, DataManager.getInstance().getDataContext(myInjectionsTable), ActionPlaces.UNKNOWN, new Presentation(""), ActionManager.getInstance(), 0)); myInjectionsTable.getListTableModel().fireTableDataChanged(); myInjectionsTable.getSelectionModel().setSelectionInterval(row, row); updateCountLabel(); } } | performEditAction |
23,648 | void () { int placesCount = 0; int enablePlacesCount = 0; final List<InjInfo> items = myInjectionsTable.getListTableModel().getItems(); if (!items.isEmpty()) { for (InjInfo injection : items) { for (InjectionPlace place : injection.injection.getInjectionPlaces()) { placesCount++; if (place.isEnabled()) enablePlacesCount++; } } myCountLabel.setText( IntelliLangBundle.message("label.text.0.injection.1.2.of.3.place.4.enabled", items.size(), enablePlacesCount, placesCount)); } else { myCountLabel.setText(IntelliLangBundle.message("label.text.no.injections.configured")); } } | updateCountLabel |
23,649 | AnAction () { final InjInfo info = getSelectedInjection(); final String supportId = info == null? null : info.injection.getSupportId(); return supportId == null? null : myEditActions.get(supportId); } | getEditAction |
23,650 | void (final BaseInjection injection) { final InjInfo info = getDefaultCfgInfo().addInjection(injection); myInjectionsTable.getListTableModel().setItems(getInjInfoList(myInfos)); final int index = myInjectionsTable.convertRowIndexToView(myInjectionsTable.getListTableModel().getItems().indexOf(info)); myInjectionsTable.getSelectionModel().setSelectionInterval(index, index); TableUtil.scrollSelectionToVisible(myInjectionsTable); } | addInjection |
23,651 | CfgInfo () { return myInfos[0]; } | getDefaultCfgInfo |
23,652 | boolean () { return true; } | hasOwnContent |
23,653 | Configurable[] () { final ArrayList<Configurable> configurables = new ArrayList<>(); for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { ContainerUtil.addAll(configurables, support.createSettings(myProject, myConfiguration)); } configurables.sort((o1, o2) -> Comparing.compare(o1.getDisplayName(), o2.getDisplayName())); return configurables.toArray(new Configurable[0]); } | buildConfigurables |
23,654 | String () { return "IntelliLang.Configuration"; } | getId |
23,655 | void (final List<? extends BaseInjection> injections) { injections.sort((o1, o2) -> { final int support = Comparing.compare(o1.getSupportId(), o2.getSupportId()); if (support != 0) return support; final int lang = Comparing.compare(o1.getInjectedLanguageId(), o2.getInjectedLanguageId()); if (lang != 0) return lang; return Comparing.compare(o1.getDisplayName(), o2.getDisplayName()); }); } | sortInjections |
23,656 | JComponent () { return myRoot; } | createComponent |
23,657 | void () { for (CfgInfo info : myInfos) { info.reset(); } myInjectionsTable.getListTableModel().setItems(getInjInfoList(myInfos)); updateCountLabel(); } | reset |
23,658 | void () { for (CfgInfo info : myInfos) { info.apply(); } reset(); } | apply |
23,659 | boolean () { return ContainerUtil.exists(myInfos, CfgInfo::isModified); } | isModified |
23,660 | void (final boolean enabled) { for (InjInfo info : getSelectedInjections()) { info.injection.setPlaceEnabled(null, enabled); } myInjectionsTable.updateUI(); updateCountLabel(); } | performSelectedInjectionsEnabled |
23,661 | void () { final List<InjInfo> selectedInjections = getSelectedInjections(); boolean enabledExists = false; boolean disabledExists = false; for (InjInfo info : selectedInjections) { if (info.injection.isEnabled()) enabledExists = true; else disabledExists = true; if (enabledExists && disabledExists) break; } boolean allEnabled = !enabledExists && disabledExists; performSelectedInjectionsEnabled(allEnabled); } | performToggleAction |
23,662 | void () { final int selectedRow = myInjectionsTable.getSelectedRow(); if (selectedRow < 0) return; final List<InjInfo> selected = getSelectedInjections(); for (InjInfo info : selected) { if (info.bundled) continue; info.cfgInfo.injectionInfos.remove(info); } myInjectionsTable.getListTableModel().setItems(getInjInfoList(myInfos)); final int index = Math.min(myInjectionsTable.getListTableModel().getRowCount() - 1, selectedRow); myInjectionsTable.getSelectionModel().setSelectionInterval(index, index); TableUtil.scrollSelectionToVisible(myInjectionsTable); updateCountLabel(); } | performRemove |
23,663 | List<InjInfo> () { List<InjInfo> toRemove = new ArrayList<>(); for (int row : myInjectionsTable.getSelectedRows()) { toRemove.add(myInjectionsTable.getItems().get(myInjectionsTable.convertRowIndexToModel(row))); } return toRemove; } | getSelectedInjections |
23,664 | InjInfo () { final int row = myInjectionsTable.getSelectedRow(); return row < 0? null : myInjectionsTable.getItems().get(myInjectionsTable.convertRowIndexToModel(row)); } | getSelectedInjection |
23,665 | void (AnActionButton e) { DefaultActionGroup group = new DefaultActionGroup(myAddActions); JBPopupFactory.getInstance() .createActionGroupPopup(null, group, e.getDataContext(), JBPopupFactory.ActionSelectionAid.NUMBERING, true, this::updateCountLabel, -1) .show(e.getPreferredPopupPoint()); } | performAdd |
23,666 | String () { return IntelliLangBundle.message("configurable.InjectionsSettingsUI.display.name"); } | getDisplayName |
23,667 | String () { return "reference.settings.injection.language.injection.settings"; } | getHelpTopic |
23,668 | boolean (@NotNull MouseEvent e) { final int row = rowAtPoint(e.getPoint()); if (row < 0) return false; if (columnAtPoint(e.getPoint()) <= 0) return false; myInjectionsTable.getSelectionModel().setSelectionInterval(row, row); performEditAction(); return true; } | onDoubleClick |
23,669 | String (@NotNull InjInfo element) { final BaseInjection injection = element.injection; return injection.getSupportId() + " " + injection.getInjectedLanguageId() + " " + injection.getDisplayName(); } | getItemText |
23,670 | ColumnInfo[] () { final TableCellRenderer booleanCellRenderer = createBooleanCellRenderer(); final TableCellRenderer displayNameCellRenderer = createDisplayNameCellRenderer(); final TableCellRenderer languageCellRenderer = createLanguageCellRenderer(); final Comparator<InjInfo> languageComparator = (o1, o2) -> Comparing.compare(o1.injection.getInjectedLanguageId(), o2.injection.getInjectedLanguageId()); final Comparator<InjInfo> displayNameComparator = (o1, o2) -> { final int support = Comparing.compare(o1.injection.getSupportId(), o2.injection.getSupportId()); if (support != 0) return support; return Comparing.compare(o1.injection.getDisplayName(), o2.injection.getDisplayName()); }; final ColumnInfo[] columnInfos = {new ColumnInfo<InjInfo, Boolean>(" ") { @Override public Class getColumnClass() { return Boolean.class; } @Override public Boolean valueOf(final InjInfo o) { return o.injection.isEnabled(); } @Override public boolean isCellEditable(final InjInfo injection) { return true; } @Override public void setValue(final InjInfo injection, final Boolean value) { injection.injection.setPlaceEnabled(null, value.booleanValue()); } @Override public TableCellRenderer getRenderer(final InjInfo injection) { return booleanCellRenderer; } }, new ColumnInfo<InjInfo, InjInfo>(IntelliLangBundle.message("column.info.name")) { @Override public InjInfo valueOf(final InjInfo info) { return info; } @Override public Comparator<InjInfo> getComparator() { return displayNameComparator; } @Override public TableCellRenderer getRenderer(final InjInfo injection) { return displayNameCellRenderer; } }, new ColumnInfo<InjInfo, InjInfo>(IntelliLangBundle.message("column.info.language")) { @Override public InjInfo valueOf(final InjInfo info) { return info; } @Override public Comparator<InjInfo> getComparator() { return languageComparator; } @Override public TableCellRenderer getRenderer(final InjInfo info) { return languageCellRenderer; } }}; if (myInfos.length > 1) { final TableCellRenderer typeRenderer = createTypeRenderer(); return ArrayUtil.append(columnInfos, new ColumnInfo<InjInfo, String>(IntelliLangBundle.message("column.info.scope")) { @Override public String valueOf(final InjInfo info) { return info.bundled ? "Built-in" : info.cfgInfo.title; } @Override public TableCellRenderer getRenderer(final InjInfo injInfo) { return typeRenderer; } @Override public int getWidth(final JTable table) { return table.getFontMetrics(table.getFont()).stringWidth(StringUtil.repeatSymbol('m', 6)); } @Override public Comparator<InjInfo> getComparator() { return (o1, o2) -> Comparing.compare(valueOf(o1), valueOf(o2)); } }); } return columnInfos; } | createInjectionColumnInfos |
23,671 | Class () { return Boolean.class; } | getColumnClass |
23,672 | Boolean (final InjInfo o) { return o.injection.isEnabled(); } | valueOf |
23,673 | boolean (final InjInfo injection) { return true; } | isCellEditable |
23,674 | void (final InjInfo injection, final Boolean value) { injection.injection.setPlaceEnabled(null, value.booleanValue()); } | setValue |
23,675 | TableCellRenderer (final InjInfo injection) { return booleanCellRenderer; } | getRenderer |
23,676 | InjInfo (final InjInfo info) { return info; } | valueOf |
23,677 | Comparator<InjInfo> () { return displayNameComparator; } | getComparator |
23,678 | TableCellRenderer (final InjInfo injection) { return displayNameCellRenderer; } | getRenderer |
23,679 | InjInfo (final InjInfo info) { return info; } | valueOf |
23,680 | Comparator<InjInfo> () { return languageComparator; } | getComparator |
23,681 | TableCellRenderer (final InjInfo info) { return languageCellRenderer; } | getRenderer |
23,682 | String (final InjInfo info) { return info.bundled ? "Built-in" : info.cfgInfo.title; } | valueOf |
23,683 | TableCellRenderer (final InjInfo injInfo) { return typeRenderer; } | getRenderer |
23,684 | int (final JTable table) { return table.getFontMetrics(table.getFont()).stringWidth(StringUtil.repeatSymbol('m', 6)); } | getWidth |
23,685 | Comparator<InjInfo> () { return (o1, o2) -> Comparing.compare(valueOf(o1), valueOf(o2)); } | getComparator |
23,686 | BooleanTableCellRenderer () { return new BooleanTableCellRenderer() { @Override public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { return setLabelColors(super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column), table, isSelected, row); } }; } | createBooleanCellRenderer |
23,687 | Component (final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { return setLabelColors(super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column), table, isSelected, row); } | getTableCellRendererComponent |
23,688 | TableCellRenderer () { return new TableCellRenderer() { final JLabel myLabel = new JLabel(); @Override public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { final InjInfo injection = (InjInfo)value; // fix for a marvellous Swing peculiarity: AccessibleJTable likes to pass null here if (injection == null) return myLabel; final String languageId = injection.injection.getInjectedLanguageId(); final Language language = InjectedLanguage.findLanguageById(languageId); final FileType fileType = language == null ? null : language.getAssociatedFileType(); myLabel.setIcon(fileType == null ? null : fileType.getIcon()); myLabel.setText(language == null ? languageId : language.getDisplayName()); setLabelColors(myLabel, table, isSelected, row); return myLabel; } }; } | createLanguageCellRenderer |
23,689 | Component (final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { final InjInfo injection = (InjInfo)value; // fix for a marvellous Swing peculiarity: AccessibleJTable likes to pass null here if (injection == null) return myLabel; final String languageId = injection.injection.getInjectedLanguageId(); final Language language = InjectedLanguage.findLanguageById(languageId); final FileType fileType = language == null ? null : language.getAssociatedFileType(); myLabel.setIcon(fileType == null ? null : fileType.getIcon()); myLabel.setText(language == null ? languageId : language.getDisplayName()); setLabelColors(myLabel, table, isSelected, row); return myLabel; } | getTableCellRendererComponent |
23,690 | TableCellRenderer () { return new TableCellRenderer() { final SimpleColoredComponent myLabel = new SimpleColoredComponent(); final SimpleColoredText myText = new SimpleColoredText(); @Override public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { myLabel.clear(); final InjInfo info = (InjInfo)value; // fix for a marvellous Swing peculiarity: AccessibleJTable likes to pass null here if (info == null) return myLabel; final SimpleTextAttributes grayAttrs = isSelected ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES; final String supportId = info.injection.getSupportId(); myText.append(supportId + ": ", grayAttrs); mySupports.get(supportId).setupPresentation(info.injection, myText, isSelected); myText.appendToComponent(myLabel); myText.clear(); setLabelColors(myLabel, table, isSelected, row); return myLabel; } }; } | createDisplayNameCellRenderer |
23,691 | Component (final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { myLabel.clear(); final InjInfo info = (InjInfo)value; // fix for a marvellous Swing peculiarity: AccessibleJTable likes to pass null here if (info == null) return myLabel; final SimpleTextAttributes grayAttrs = isSelected ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES; final String supportId = info.injection.getSupportId(); myText.append(supportId + ": ", grayAttrs); mySupports.get(supportId).setupPresentation(info.injection, myText, isSelected); myText.appendToComponent(myLabel); myText.clear(); setLabelColors(myLabel, table, isSelected, row); return myLabel; } | getTableCellRendererComponent |
23,692 | TableCellRenderer () { return new TableCellRenderer() { final SimpleColoredComponent myLabel = new SimpleColoredComponent(); @Override public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { myLabel.clear(); final String info = (String)value; if (info == null) return myLabel; final SimpleTextAttributes grayAttrs = isSelected ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES; myLabel.append(info, grayAttrs); setLabelColors(myLabel, table, isSelected, row); return myLabel; } }; } | createTypeRenderer |
23,693 | Component (final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { myLabel.clear(); final String info = (String)value; if (info == null) return myLabel; final SimpleTextAttributes grayAttrs = isSelected ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES; myLabel.append(info, grayAttrs); setLabelColors(myLabel, table, isSelected, row); return myLabel; } | getTableCellRendererComponent |
23,694 | Component (final Component label, final JTable table, final boolean isSelected, final int row) { if (label instanceof JComponent) { ((JComponent)label).setOpaque(true); } label.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); label.setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); return label; } | setLabelColors |
23,695 | void (final DataContext dataContext) { final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, true, false) { @Override public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) { return super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || "xml".equals(file.getExtension()) || FileTypeRegistry.getInstance().isFileOfType(file, ArchiveFileType.INSTANCE)); } @Override public boolean isFileSelectable(@Nullable VirtualFile file) { return file != null && FileTypeRegistry.getInstance().isFileOfType(file, StdFileTypes.XML); } }; descriptor.setDescription(IntelliLangBundle.message("dialog.file.chooser.description.please.select.the.configuration.file")); descriptor.setTitle(IntelliLangBundle.message("dialog.file.chooser.title.import.configuration")); descriptor.putUserData(LangDataKeys.MODULE_CONTEXT, PlatformCoreDataKeys.MODULE.getData(dataContext)); final SplitterProportionsData splitterData = new SplitterProportionsDataImpl(); splitterData.externalizeFromDimensionService("IntelliLang.ImportSettingsKey.SplitterProportions"); final VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); if (file == null) return; try { final Configuration cfg = Configuration.load(file.getInputStream()); if (cfg == null) { Messages.showWarningDialog(myProject, IntelliLangBundle.message("dialog.message.the.selected.file"), IntelliLangBundle.message("dialog.title.nothing.to.import")); return; } final CfgInfo info = getDefaultCfgInfo(); final Map<String,Set<InjInfo>> currentMap = ContainerUtil.classify(info.injectionInfos.iterator(), o -> o.injection.getSupportId()); final List<BaseInjection> originalInjections = new ArrayList<>(); final List<BaseInjection> newInjections = new ArrayList<>(); //// remove duplicates //for (String supportId : InjectorUtils.getActiveInjectionSupportIds()) { // final Set<BaseInjection> currentInjections = currentMap.get(supportId); // if (currentInjections == null) continue; // for (BaseInjection injection : currentInjections) { // Configuration.importInjections(newInjections, Collections.singleton(injection), originalInjections, newInjections); // } //} //myInjections.clear(); //myInjections.addAll(newInjections); for (String supportId : InjectorUtils.getActiveInjectionSupportIds()) { ArrayList<InjInfo> list = new ArrayList<>(ObjectUtils.notNull(currentMap.get(supportId), Collections.emptyList())); final List<BaseInjection> currentInjections = getInjectionList(list); final List<BaseInjection> importingInjections = cfg.getInjections(supportId); Configuration.importInjections(currentInjections, importingInjections, originalInjections, newInjections); } info.replace(originalInjections, newInjections); myInjectionsTable.getListTableModel().setItems(getInjInfoList(myInfos)); final int n = newInjections.size(); if (n > 1) { Messages.showInfoMessage(myProject, IntelliLangBundle.message("dialog.message.0.entries.have.been.successfully.imported", n), IntelliLangBundle.message("dialog.title.import.successful")); } else if (n == 1) { Messages.showInfoMessage(myProject, IntelliLangBundle.message("dialog.message.one.entry.has.been.successfully.imported"), IntelliLangBundle.message("dialog.title.import.successful")); } else { Messages.showInfoMessage(myProject, IntelliLangBundle.message("dialog.message.no.new.entries.have.been.imported"), IntelliLangBundle.message("dialog.title.import")); } } catch (Exception ex) { Configuration.LOG.error(ex); final String msg = ex.getLocalizedMessage(); Messages.showErrorDialog(myProject, msg != null && msg.length() > 0 ? msg : ex.toString(), IntelliLangBundle.message("dialog.title.import.failed")); } } | doImportAction |
23,696 | boolean (VirtualFile file, boolean showHiddenFiles) { return super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || "xml".equals(file.getExtension()) || FileTypeRegistry.getInstance().isFileOfType(file, ArchiveFileType.INSTANCE)); } | isFileVisible |
23,697 | boolean (@Nullable VirtualFile file) { return file != null && FileTypeRegistry.getInstance().isFileOfType(file, StdFileTypes.XML); } | isFileSelectable |
23,698 | void () { final List<BaseInjection> injectionList = getInjectionList(injectionInfos); cfg.replaceInjections(injectionList, originalInjections, true); originalInjections.clear(); originalInjections.addAll(injectionList); sortInjections(originalInjections); FileContentUtil.reparseOpenedFiles(); } | apply |
23,699 | void () { injectionInfos.clear(); for (BaseInjection injection : originalInjections) { injectionInfos.add(new InjInfo(injection.copy(), this, bundledInjections.contains(injection))); } } | reset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.