Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
23,800
boolean (PsiLanguageInjectionHost host, String id) { return Configuration.getProjectInstance(host.getProject()).setHostInjectionEnabled(host, Collections.singleton(id), true); }
defaultFunctionalityWorked
23,801
boolean (Editor editor, final Processor<? super Injectable> onChosen) { ColoredListCellRenderer<Injectable> renderer = new ColoredListCellRenderer<>() { @Override protected void customizeCellRenderer(@NotNull JList<? extends Injectable> list, Injectable language, int index, boolean selected, boolean hasFocus) { setIcon(language.getIcon()); append(language.getDisplayName()); String description = language.getAdditionalDescription(); if (description != null) { append(description, SimpleTextAttributes.GRAYED_ATTRIBUTES); } } }; final List<Injectable> injectables = getAllInjectables(); final String lastInjectedId = PropertiesComponent.getInstance().getValue(LAST_INJECTED_LANGUAGE); Injectable lastInjected = lastInjectedId != null ? ContainerUtil.find(injectables, injectable -> lastInjectedId.equals(injectable.getId())) : null; Dimension minSize = new JLabel(PlainTextLanguage.INSTANCE.getDisplayName(), EmptyIcon.ICON_16, SwingConstants.LEFT).getMinimumSize(); minSize.height *= 4; IPopupChooserBuilder<Injectable> builder = JBPopupFactory.getInstance() .createPopupChooserBuilder(injectables) .setRenderer(renderer) .setItemChosenCallback(injectable -> { onChosen.process(injectable); PropertiesComponent.getInstance().setValue(LAST_INJECTED_LANGUAGE, injectable.getId()); }) .setMinSize(minSize) .setNamerForFiltering(language -> language.getDisplayName()); if (lastInjected != null) { builder = builder.setSelectedValue(lastInjected, true); } builder.createPopup().showInBestPositionFor(editor); return true; }
doChooseLanguageToInject
23,802
void (@NotNull JList<? extends Injectable> list, Injectable language, int index, boolean selected, boolean hasFocus) { setIcon(language.getIcon()); append(language.getDisplayName()); String description = language.getAdditionalDescription(); if (description != null) { append(description, SimpleTextAttributes.GRAYED_ATTRIBUTES); } }
customizeCellRenderer
23,803
boolean () { return false; }
startInWriteAction
23,804
void (@NotNull PsiLanguageInjectionHost host, Processor<? super PsiLanguageInjectionHost> annotationFixer, @NlsContexts.PopupContent String text) { host.putUserData(FIX_KEY, withFixName(annotationFixer, text)); }
addFixer
23,805
String () { return myText; }
getText
23,806
boolean (PsiLanguageInjectionHost host) { return myFix.process(host); }
process
23,807
Injection (@NotNull PsiElement context) { if (!(context instanceof PsiLanguageInjectionHost host) || context instanceof PsiComment) return null; if (!((PsiLanguageInjectionHost)context).isValidHost()) return null; boolean applicableFound = false; for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { if (!support.isApplicableTo(host)) continue; applicableFound = true; //noinspection deprecation if (!support.useDefaultCommentInjector()) continue; BaseInjection injection = support.findCommentInjection(host, null); if (isCompatible(injection, context)) { return injection; } } if (applicableFound) return null; BaseInjection commentInjection = InjectorUtils.findCommentInjection(host, "comment", null); if (!isCompatible(commentInjection, context)) return null; return commentInjection; }
getInjection
23,808
boolean (@Nullable BaseInjection injection, @NotNull PsiElement context) { if (injection == null) return false; if (injection.getInjectionPlaces().length == 0) return true; // it seems that "placeless" injections shouldn't be checked return injection.acceptsPsiElement(context); }
isCompatible
23,809
boolean (PsiLanguageInjectionHost host) { return false; }
isApplicableTo
23,810
boolean (final PsiLanguageInjectionHost host) { return false; }
useDefaultInjector
23,811
boolean () { return true; }
useDefaultCommentInjector
23,812
BaseInjection (@NotNull PsiElement host, @Nullable Ref<? super PsiElement> commentRef) { return InjectorUtils.findCommentInjection(host, "comment", commentRef); }
findCommentInjection
23,813
boolean (final Language language, final PsiLanguageInjectionHost psiElement) { return false; }
addInjectionInPlace
23,814
boolean (final PsiLanguageInjectionHost psiElement) { return false; }
removeInjectionInPlace
23,815
boolean (final PsiLanguageInjectionHost psiElement) { return false; }
editInjectionInPlace
23,816
BaseInjection (final Element element) { return new BaseInjection(getId()); }
createInjection
23,817
void (final BaseInjection injection, final SimpleColoredText presentation, final boolean isSelected) { presentation.append(injection.getDisplayName(), SimpleTextAttributes.REGULAR_ATTRIBUTES); }
setupPresentation
23,818
Configurable[] (final Project project, final Configuration configuration) { return new Configurable[0]; }
createSettings
23,819
AnAction[] (final Project project, final Consumer<? super BaseInjection> consumer) { return new AnAction[] { createDefaultAddAction(project, consumer, this) }; }
createAddActions
23,820
AnAction (final Project project, final Factory<? extends BaseInjection> producer) { return createDefaultEditAction(project, producer); }
createEditAction
23,821
AnAction (Project project, Factory<? extends BaseInjection> producer) { return DumbAwareAction.create(e -> perform(project, producer)); }
createDefaultEditAction
23,822
void (Project project, Factory<? extends BaseInjection> producer) { BaseInjection originalInjection = producer.create(); BaseInjection newInjection = showDefaultInjectionUI(project, originalInjection.copy()); if (newInjection != null) { originalInjection.copyFrom(newInjection); } }
perform
23,823
AnAction (final Project project, final Consumer<? super BaseInjection> consumer, final AbstractLanguageInjectionSupport support) { final String supportTitle = StringUtil.capitalize(support.getId()); Icon icon = FileTypeManager.getInstance().getFileTypeByExtension(support.getId()).getIcon(); AnAction action = DumbAwareAction.create(e -> { BaseInjection injection = new BaseInjection(support.getId()); injection.setDisplayName(IntelliLangBundle.message("new.language.name.injection", supportTitle)); final BaseInjection newInjection = showDefaultInjectionUI(project, injection); if (newInjection != null) { consumer.consume(injection); } }); action.getTemplatePresentation().setText(IntelliLangBundle.message("action.text.generic.0", supportTitle)); action.getTemplatePresentation().setIcon(icon); return action; }
createDefaultAddAction
23,824
BaseInjection (final Project project, BaseInjection injection) { final BaseInjectionPanel panel = new BaseInjectionPanel(injection, project); panel.reset(); String dimensionServiceKey = "#org.intellij.plugins.intelliLang.inject.config.ui.BaseInjectionDialog"; LanguageInjectionSupport support = InjectorUtils.findInjectionSupport(injection.getSupportId()); String helpId = support instanceof AbstractLanguageInjectionSupport ? ((AbstractLanguageInjectionSupport)support).getHelpId() : null; return showEditInjectionDialog(project, panel, dimensionServiceKey, helpId) ? injection : null; }
showDefaultInjectionUI
23,825
boolean (@NotNull Project project, @NotNull AbstractInjectionPanel panel, @Nullable String dimensionServiceKey, @Nullable String helpId) { final DialogBuilder builder = new DialogBuilder(project); builder.setHelpId(helpId); builder.addOkAction(); builder.addCancelAction(); builder.setDimensionServiceKey(dimensionServiceKey); builder.setCenterPanel(panel.getComponent()); builder.setTitle(IntelliLangBundle.message("language.injection.settings.title")); builder.setOkOperation(() -> { try { panel.apply(); builder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE); } catch (Exception e) { final Throwable cause = e.getCause(); final String message = e.getMessage() + (cause != null? "\n "+cause.getMessage():""); Messages.showErrorDialog(project, message, IntelliLangBundle.message("dialog.title.unable.to.save")); } }); return builder.show() == DialogWrapper.OK_EXIT_CODE; }
showEditInjectionDialog
23,826
int () { return getId().hashCode(); }
hashCode
23,827
boolean (Object obj) { return obj instanceof LanguageInjectionSupport && getId().equals(((LanguageInjectionSupport)obj).getId()); }
equals
23,828
String () { return null; }
getHelpId
23,829
String () { return TemporaryPlacesRegistry.SUPPORT_ID; }
getId
23,830
boolean (PsiLanguageInjectionHost host) { return true; }
isApplicableTo
23,831
boolean (Language language, PsiLanguageInjectionHost host) { TemporaryPlacesRegistry.getInstance(host.getProject()).addHostWithUndo(host, InjectedLanguage.create(language.getID())); return true; }
addInjectionInPlace
23,832
boolean (PsiLanguageInjectionHost psiElement) { return TemporaryPlacesRegistry.getInstance(psiElement.getProject()).removeHostWithUndo(psiElement.getProject(), psiElement); }
removeInjectionInPlace
23,833
String () { return myConfigUrl; }
getConfigUrl
23,834
boolean (final PsiElement psiElement) { return psiElement instanceof PsiLanguageInjectionHost && removeInjectionInPlace((PsiLanguageInjectionHost)psiElement); }
removeInjection
23,835
boolean () { return false; }
isPrimary
23,836
boolean (@NotNull MultiHostRegistrar registrar, @NotNull Injection injection, @NotNull PsiElement context) { if (!(context instanceof PsiLanguageInjectionHost host) || !((PsiLanguageInjectionHost)context).isValidHost()) { return false; } PsiFile containingFile = context.getContainingFile(); InjectedLanguage injectedLanguage = InjectedLanguage.create(injection.getInjectedLanguageId(), injection.getPrefix(), injection.getSuffix(), false); String injectionSupportId = injection.getSupportId(); LanguageInjectionSupport support = injectionSupportId != null ? InjectorUtils.findInjectionSupport(injectionSupportId) : null; Language language = injectedLanguage.getLanguage(); final ElementManipulator<PsiLanguageInjectionHost> manipulator = ElementManipulators.getManipulator(host); if (language == null || manipulator == null) { if (injection instanceof BaseInjection) { return InjectorUtils.registerInjectionSimple(host, (BaseInjection)injection, support, registrar); } return false; } List<InjectorUtils.InjectionInfo> infos = List.of(new InjectorUtils.InjectionInfo(host, injectedLanguage, manipulator.getRangeInElement(host))); InjectorUtils.registerInjection(language, containingFile, infos, registrar); if (support != null) { InjectorUtils.registerSupport(support, false, context, language); } return true; }
performInjection
23,837
void (PsiElement context, Injection injection) { if (LanguageInjectionSupport.INJECTOR_SUPPORT.get(context) != null) return; String injectionSupportId = injection.getSupportId(); LanguageInjectionSupport support = injectionSupportId != null ? InjectorUtils.findInjectionSupport(injectionSupportId) : null; if (support == null) return; Language language = InjectorUtils.getLanguageByString(injection.getInjectedLanguageId()); if (language == null) return; InjectorUtils.registerSupport(support, false, context, language); }
registerSupportIfNone
23,838
TemporaryPlacesRegistry (@NotNull Project project) { return project.getService(TemporaryPlacesRegistry.class); }
getInstance
23,839
List<TempPlace> () { long modificationCount = PsiModificationTracker.getInstance(myProject).getModificationCount(); if (myPsiModificationCounter == modificationCount) { return myTempPlaces; } myPsiModificationCounter = modificationCount; final List<TempPlace> placesToRemove = ContainerUtil.findAll(myTempPlaces, place -> { PsiLanguageInjectionHost element = place.elementPointer.getElement(); if (element == null) { Segment range = place.elementPointer.getRange(); if (range == null) return true; PsiFile file = place.elementPointer.getContainingFile(); if (file == null) return true; PsiLanguageInjectionHost newHost = CommonInjectedFileChangesHandlerKt.getInjectionHostAtRange(file, range); if (newHost == null) return true; newHost.putUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE, place.language); place.elementPointer = SmartPointerManager.createPointer(newHost); } else if (!element.isValidHost()) { element.putUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE, null); return true; } else { element.putUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE, place.language); } return false; }); if (!placesToRemove.isEmpty()) { myTempPlaces.removeAll(placesToRemove); } return myTempPlaces; }
getInjectionPlacesSafe
23,840
void (TempPlace place) { PsiLanguageInjectionHost host = place.elementPointer.getElement(); if (host == null) return; Set<PsiLanguageInjectionHost> hosts = new HashSet<>(); hosts.add(host); // because `enumerate` doesn't handle reference injections InjectedLanguageManager.getInstance(myProject).enumerate(host, (injectedPsi, places) -> { injectedPsi.putUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE, place.language); for (PsiLanguageInjectionHost.Shred shred: places) { hosts.add(shred.getHost()); } }); List<TempPlace> injectionPoints = getInjectionPlacesSafe(); for (TempPlace tempPlace : injectionPoints) { if (hosts.contains(tempPlace.elementPointer.getElement())) { injectionPoints.remove(tempPlace); break; } } if (place.language != null) { injectionPoints.add(place); } host.putUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE, place.language); host.getManager().dropPsiCaches(); }
addInjectionPlace
23,841
boolean (final Project project, final PsiLanguageInjectionHost host) { InjectedLanguage prevLanguage = host.getUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE); if (prevLanguage == null) return false; SmartPointerManager manager = SmartPointerManager.getInstance(myProject); SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = manager.createSmartPsiElementPointer(host); TempPlace place = new TempPlace(prevLanguage, pointer); TempPlace nextPlace = new TempPlace(null, pointer); Configuration.replaceInjectionsWithUndo( project, host.getContainingFile(), nextPlace, place, false, Collections.emptyList(), (add, remove) -> { addInjectionPlace(add); return true; }); return true; }
removeHostWithUndo
23,842
boolean (final PsiLanguageInjectionHost host) { InjectedLanguage prevLanguage = host.getUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE); if (prevLanguage == null) return false; SmartPointerManager manager = SmartPointerManager.getInstance(myProject); SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = manager.createSmartPsiElementPointer(host); TempPlace nextPlace = new TempPlace(null, pointer); addInjectionPlace(nextPlace); return true; }
removeHost
23,843
void (final PsiLanguageInjectionHost host, final InjectedLanguage language) { InjectedLanguage prevLanguage = host.getUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE); SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(host); TempPlace prevPlace = new TempPlace(prevLanguage, pointer); TempPlace place = new TempPlace(language, pointer); Configuration.replaceInjectionsWithUndo( myProject, host.getContainingFile(), place, prevPlace, false, Collections.emptyList(), (add, remove) -> { addInjectionPlace(add); return true; }); }
addHostWithUndo
23,844
void (final PsiLanguageInjectionHost host, final InjectedLanguage language) { SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(host); TempPlace place = new TempPlace(language, pointer); addInjectionPlace(place); }
addHost
23,845
LanguageInjectionSupport () { return InjectorUtils.findInjectionSupport(SUPPORT_ID); }
getLanguageInjectionSupport
23,846
InjectedLanguage (@NotNull PsiLanguageInjectionHost host, PsiFile containingFile) { PsiLanguageInjectionHost originalHost = CompletionUtilCoreImpl.getOriginalElement(host, containingFile); PsiLanguageInjectionHost injectionHost = originalHost == null ? host : originalHost; getInjectionPlacesSafe(); return injectionHost.getUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE); }
getLanguageFor
23,847
boolean (@NotNull PsiErrorElement element) { return !isFrankenstein(element.getContainingFile()); }
shouldHighlightErrorElement
23,848
boolean (@NotNull HighlightInfo highlightInfo, @Nullable PsiFile file) { if (highlightInfo.getSeverity() != HighlightSeverity.WARNING && highlightInfo.getSeverity() != HighlightSeverity.WEAK_WARNING) return true; if (!isFrankenstein(file)) return true; int start = highlightInfo.getStartOffset(); int end = highlightInfo.getEndOffset(); String text = file.getText().substring(start, end); return !"missingValue".equals(text); }
accept
23,849
boolean (@Nullable PsiFile file) { return file != null && Boolean.TRUE.equals(file.getUserData(InjectedLanguageUtil.FRANKENSTEIN_INJECTION)); }
isFrankenstein
23,850
void (InjectionPlace @NotNull ... places) { myPlaces = places; }
setInjectionPlaces
23,851
String () { return myDisplayName; }
getDisplayName
23,852
void (@Nls @NotNull String displayName) { myDisplayName = displayName; }
setDisplayName
23,853
void (@NotNull String injectedLanguageId) { myInjectedLanguageId = injectedLanguageId; }
setInjectedLanguageId
23,854
String () { return myPrefix; }
getPrefix
23,855
void (@NotNull String prefix) { myPrefix = prefix; }
setPrefix
23,856
String () { return mySuffix; }
getSuffix
23,857
void (@NotNull String suffix) { mySuffix = suffix; }
setSuffix
23,858
boolean (@NotNull Iterator<PsiLanguageInjectionHost> elements, @Nullable String delimiter) { if (myCompiledIgnorePattern == null) { return false; } StringBuilder buffer = new StringBuilder(); while (elements.hasNext()) { PsiLanguageInjectionHost element = elements.next(); LiteralTextEscaper<? extends PsiLanguageInjectionHost> textEscaper = element.createLiteralTextEscaper(); textEscaper.decode(ElementManipulators.getValueTextRange(element), buffer); if (delimiter != null && elements.hasNext()) { buffer.append(delimiter); } } return myCompiledIgnorePattern.matcher(StringPattern.newBombedCharSequence(buffer)).find(); }
shouldBeIgnored
23,859
boolean (@NotNull PsiElement element) { if (!(element instanceof PsiLanguageInjectionHost host)) { return false; } return shouldBeIgnored(Collections.singleton(host).iterator(), null); }
shouldBeIgnored
23,860
List<TextRange> (final PsiElement element) { final TextRange textRange = ElementManipulators.getValueTextRange(element); if (myCompiledValuePattern == null) { return Collections.singletonList(textRange); } else { final LiteralTextEscaper<? extends PsiLanguageInjectionHost> textEscaper = ((PsiLanguageInjectionHost)element).createLiteralTextEscaper(); final StringBuilder sb = new StringBuilder(); textEscaper.decode(textRange, sb); final List<TextRange> ranges = getMatchingRanges(myCompiledValuePattern.matcher(StringPattern.newBombedCharSequence(sb)), sb.length()); return !ranges.isEmpty() ? ContainerUtil.map(ranges, s -> new TextRange(textEscaper.getOffsetInHost(s.getStartOffset(), textRange), textEscaper.getOffsetInHost(s.getEndOffset(), textRange))) : Collections.emptyList(); } }
getInjectedArea
23,861
boolean () { for (InjectionPlace place : myPlaces) { if (place.getElementPattern() != null && place.isEnabled()) return true; } return false; }
isEnabled
23,862
boolean (final PsiElement element) { ProgressManager.checkCanceled(); for (InjectionPlace place : myPlaces) { if (place.isEnabled() && place.getElementPattern() != null && place.getElementPattern().accepts(element)) { return true; } } return false; }
acceptsPsiElement
23,863
boolean (final BaseInjection template) { if (!Objects.equals(getInjectedLanguageId(), template.getInjectedLanguageId())) return false; for (InjectionPlace other : template.getInjectionPlaces()) { if (ArrayUtil.contains(other, myPlaces)) return true; } return false; }
intersectsWith
23,864
boolean (final BaseInjection that) { if (!myInjectedLanguageId.equals(that.myInjectedLanguageId)) return false; if (!myPrefix.equals(that.myPrefix)) return false; if (!mySuffix.equals(that.mySuffix)) return false; if (!myValuePattern.equals(that.myValuePattern)) return false; if (mySingleFile != that.mySingleFile) return false; return true; }
sameLanguageParameters
23,865
BaseInjection () { return new BaseInjection(mySupportId).copyFrom(this); }
copy
23,866
boolean (Object o) { if (this == o) return true; if (!(o instanceof BaseInjection that)) return false; if (!Objects.equals(getDisplayName(), that.getDisplayName())) return false; if (!sameLanguageParameters(that)) return false; if (myPlaces.length != that.myPlaces.length) return false; for (int i = 0, len = myPlaces.length; i < len; i++) { if (myPlaces[i].isEnabled() != that.myPlaces[i].isEnabled()) { return false; } } // enabled flag is not counted this way: if (!Arrays.equals(myPlaces, that.myPlaces)) return false; return true; }
equals
23,867
int () { int result; result = myInjectedLanguageId.hashCode(); result = 31 * result + myPrefix.hashCode(); result = 31 * result + mySuffix.hashCode(); result = 31 * result + myValuePattern.hashCode(); result = 31 * result + myIgnorePattern.hashCode(); return result; }
hashCode
23,868
BaseInjection (@NotNull BaseInjection other) { assert this != other; myInjectedLanguageId = other.getInjectedLanguageId(); myPrefix = other.getPrefix(); mySuffix = other.getSuffix(); myDisplayName = other.getDisplayName(); setValuePattern(other.getValuePattern()); setIgnorePattern(other.getIgnorePattern()); mySingleFile = other.mySingleFile; myPlaces = other.getInjectionPlaces().clone(); return this; }
copyFrom
23,869
void (@NotNull Element element) { final PatternCompiler<PsiElement> helper = getCompiler(); @NlsSafe String displayName = element.getChildTextTrim("display-name"); myDisplayName = StringUtil.notNullize(displayName); myInjectedLanguageId = StringUtil.notNullize(element.getAttributeValue("language")); myPrefix = StringUtil.notNullize(getValueOrContent(element, "prefix")); mySuffix = StringUtil.notNullize(getValueOrContent(element, "suffix")); setValuePattern(getValueOrContent(element, "value-pattern")); setIgnorePattern(getValueOrContent(element, "ignore-pattern")); Element singleFileElement = element.getChild("single-file"); mySingleFile = singleFileElement == null || Boolean.parseBoolean(singleFileElement.getAttributeValue("value", "true")); readExternalImpl(element); final List<Element> placeElements = element.getChildren("place"); myPlaces = InjectionPlace.ARRAY_FACTORY.create(placeElements.size()); for (int i = 0, placeElementsSize = placeElements.size(); i < placeElementsSize; i++) { Element placeElement = placeElements.get(i); final boolean enabled = !Boolean.parseBoolean(placeElement.getAttributeValue("disabled")); final String text = placeElement.getText(); myPlaces[i] = new InjectionPlace(helper.createElementPattern(text, getDisplayName()), enabled); } if (myPlaces.length == 0) { generatePlaces(); } }
loadState
23,870
String (@NotNull Element element, String cname) { Element child = element.getChild(cname); if (child == null) return null; String attributeValue = child.getAttributeValue("value"); if (attributeValue != null) return attributeValue; return child.getText(); }
getValueOrContent
23,871
PatternCompiler<PsiElement> () { return PatternCompilerFactory.getFactory().getPatternCompiler(InjectorUtils.getPatternClasses(getSupportId())); }
getCompiler
23,872
void () { }
generatePlaces
23,873
void (Element e) { }
readExternalImpl
23,874
Element () { final Element e = new Element("injection"); e.setAttribute("language", myInjectedLanguageId); e.setAttribute("injector-id", mySupportId); e.addContent(withValueOrContent("display-name", getDisplayName())); if (StringUtil.isNotEmpty(myPrefix)) { e.addContent(withValueOrContent("prefix", myPrefix)); } if (StringUtil.isNotEmpty(mySuffix)) { e.addContent(withValueOrContent("suffix", mySuffix)); } if (StringUtil.isNotEmpty(myValuePattern)) { e.addContent(withValueOrContent("value-pattern", myValuePattern)); } if (StringUtil.isNotEmpty(myIgnorePattern)) { e.addContent(withValueOrContent("ignore-pattern", myIgnorePattern)); } e.addContent(new Element("single-file").setAttribute("value", mySingleFile ? "true" : "false")); Arrays.sort(myPlaces, (o1, o2) -> Comparing.compare(o1.getText(), o2.getText())); for (InjectionPlace place : myPlaces) { final Element child = new Element("place").setContent(new CDATA(place.getText())); if (!place.isEnabled()) child.setAttribute("disabled", "true"); e.addContent(child); } writeExternalImpl(e); return e; }
getState
23,875
Element (String name, String value) { Element element = new Element(name); if (!value.isEmpty() && (Character.isWhitespace(value.charAt(0)) || Character.isWhitespace(value.charAt(value.length() - 1)))) { return element.setAttribute("value", value); } return element.setText(value); }
withValueOrContent
23,876
void (Element e) { }
writeExternalImpl
23,877
String () { return myValuePattern; }
getValuePattern
23,878
void (@RegExp @Nullable String pattern) { try { if (pattern != null && pattern.length() > 0) { myValuePattern = pattern; myCompiledValuePattern = Pattern.compile(pattern, Pattern.DOTALL); } else { myValuePattern = ""; myCompiledValuePattern = null; } } catch (Exception ex) { myCompiledValuePattern = null; Logger.getInstance(getClass().getName()).info("Invalid value-pattern", ex); } }
setValuePattern
23,879
String () { return myIgnorePattern; }
getIgnorePattern
23,880
void (@RegExp @Nullable String pattern) { try { if (pattern != null && pattern.length() > 0) { myIgnorePattern = pattern; myCompiledIgnorePattern = Pattern.compile(pattern, Pattern.DOTALL); } else { myIgnorePattern = ""; myCompiledIgnorePattern = null; } } catch (Exception ex) { myCompiledIgnorePattern = null; Logger.getInstance(getClass().getName()).info("Invalid ignore-pattern", ex); } }
setIgnorePattern
23,881
boolean () { return mySingleFile; }
isSingleFile
23,882
void (final boolean singleFile) { mySingleFile = singleFile; }
setSingleFile
23,883
boolean () { return myCompiledValuePattern == null; }
isTerminal
23,884
List<TextRange> (Matcher matcher, final int length) { final List<TextRange> list = new SmartList<>(); int start = 0; while (start < length && matcher.find(start)) { final int groupCount = matcher.groupCount(); if (groupCount != 0) { for (int i = 1; i <= groupCount; i++) { start = matcher.start(i); if (start == -1) continue; list.add(new TextRange(start, matcher.end(i))); } if (start >= matcher.end()) break; } start = matcher.end(); } return list; }
getMatchingRanges
23,885
void (final BaseInjection injection, final boolean enabled) { for (InjectionPlace place : injection.getInjectionPlaces()) { if (!ArrayUtil.contains(place, myPlaces)) { myPlaces = ArrayUtil.append(myPlaces, enabled || !place.isEnabled() ? place : place.enabled(false), InjectionPlace.ARRAY_FACTORY); } } }
mergeOriginalPlacesFrom
23,886
void (@Nullable final String text, final boolean enabled) { for (int i = 0; i < myPlaces.length; i++) { final InjectionPlace cur = myPlaces[i]; if (text == null || Objects.equals(text, cur.getText())) { if (cur.isEnabled() != enabled) { myPlaces[i] = cur.enabled(enabled); } } } }
setPlaceEnabled
23,887
boolean (PsiElement element) { return acceptsPsiElement(element); }
acceptForReference
23,888
String () { return getInjectedLanguageId() + "->" + getDisplayName(); }
toString
23,889
InjectionPlace (final boolean enabled) { return new InjectionPlace(myElementPattern, enabled); }
enabled
23,890
String () { return myElementPattern.toString(); }
getText
23,891
boolean () { return myEnabled; }
isEnabled
23,892
boolean (final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final InjectionPlace place = (InjectionPlace)o; if (!myElementPattern.equals(place.myElementPattern)) return false; return true; }
equals
23,893
int () { return myElementPattern.hashCode(); }
hashCode
23,894
String () { return "InjectionPlace{" + (myEnabled ? "+ " : "- ") + myElementPattern + '}'; }
toString
23,895
void (@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) { if (psiElement instanceof RegExpFile && psiElement.getCopyableUserData(KEY) == Boolean.TRUE) { final PsiElement pattern = psiElement.getFirstChild(); if (!(pattern instanceof RegExpPattern)) { return; } final RegExpBranch[] branches = ((RegExpPattern)pattern).getBranches(); if (branches.length == 1 && branches[0].getAtoms().length == 0) { return; } for (RegExpBranch branch : branches) { final int[] count = new int[1]; branch.accept(new RegExpRecursiveElementVisitor() { @Override public void visitRegExpGroup(RegExpGroup group) { if (group.isCapturing()) { count[0]++; } super.visitRegExpGroup(group); } }); if (count[0] != 1) { holder.newAnnotation(HighlightSeverity.WARNING, IntelliLangBundle.message("annotation.message.the.pattern")).range(branch) .create(); } } } }
annotate
23,896
void (RegExpGroup group) { if (group.isCapturing()) { count[0]++; } super.visitRegExpGroup(group); }
visitRegExpGroup
23,897
void (BaseInjection other) { other.setValuePattern(myValuePattern.getText()); other.setSingleFile(mySingleFileCheckBox.isSelected()); }
apply
23,898
void () { myValuePattern.setText(myOrigInjection.getValuePattern()); mySingleFileCheckBox.setSelected(myOrigInjection.isSingleFile()); }
resetImpl
23,899
JPanel () { return myRoot; }
getComponent