Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
297,800
int () { int result = super.hashCode(); result = 31 * result + (myDomElement != null ? myDomElement.hashCode() : 0); result = 31 * result + (myRange != null ? myRange.hashCode() : 0); return result; }
hashCode
297,801
DomElement () { return myDomElement; }
getDomElement
297,802
DomManager (Project project) { return project.getService(DomManager.class); }
getDomManager
297,803
Module[] (@Nullable PsiFile context) { if (context == null) return Module.EMPTY_ARRAY; final Set<Module> modules = new HashSet<>(); for (ModuleContextProvider moduleContextProvider : EP_NAME.getExtensionList()) { ContainerUtil.addAllNotNull(modules, moduleContextProvider.getContextModules(context)); } Module module = ModuleUtilCore.findModuleForPsiElement(context); if (module != null) modules.add(module); return modules.toArray(Module.EMPTY_ARRAY); }
getModules
297,804
XmlName () { return myXmlName; }
getXmlName
297,805
EvaluatedXmlName (@NotNull final XmlName name) { String namespaceKey = name.getNamespaceKey(); if (namespaceKey == null) { return new DummyEvaluatedXmlName(name.getLocalName(), myNamespace); } return EvaluatedXmlNameImpl.createEvaluatedXmlName(name, namespaceKey, false); }
evaluateChildName
297,806
boolean (final String namespace, final XmlFile file, boolean qualified) { return namespace.equals(myNamespace); }
isNamespaceAllowed
297,807
String (@NotNull final XmlElement parentElement, final XmlFile file) { return myNamespace; }
getNamespace
297,808
boolean (final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final DummyEvaluatedXmlName that = (DummyEvaluatedXmlName)o; if (myNamespace != null ? !myNamespace.equals(that.myNamespace) : that.myNamespace != null) return false; if (myXmlName != null ? !myXmlName.equals(that.myXmlName) : that.myXmlName != null) return false; return true; }
equals
297,809
int () { int result; result = (myXmlName != null ? myXmlName.hashCode() : 0); result = 31 * result + (myNamespace != null ? myNamespace.hashCode() : 0); return result; }
hashCode
297,810
DomElementsNavigationManager (Project project) { return project.getService(DomElementsNavigationManager.class); }
getManager
297,811
T (final Project project, final Editor editor, final PsiFile file) { return generate(getParentDomElement(project, editor, file), editor); }
generate
297,812
T (@Nullable final DomElement parent, final Editor editor) { if (parent == null) { return null; } final List<? extends DomCollectionChildDescription> list = parent.getGenericInfo().getCollectionChildrenDescriptions(); for (DomCollectionChildDescription childDescription : list) { if (ClassUtil.getRawType(childDescription.getType()).isAssignableFrom(myChildElementClass)) { XmlTag parentTag = parent.getXmlTag(); if (editor != null && parentTag != null) { int offset = editor.getCaretModel().getOffset(); PsiFile file = parentTag.getContainingFile(); PsiElement psiElement = file.findElementAt(offset); if (psiElement instanceof PsiWhiteSpace && PsiTreeUtil.isAncestor(parentTag, psiElement, false)) { Document document = editor.getDocument(); XmlTag childTag = parentTag.createChildTag(childDescription.getXmlElementName(), null, null, true); String text = childTag.getText(); document.insertString(offset, text); Project project = editor.getProject(); assert project != null; PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); documentManager.commitDocument(document); PsiElement element = file.findElementAt(offset + 1); T domElement = DomUtil.findDomElement(element, myChildElementClass); if (domElement != null) return domElement; document.deleteString(offset, offset + text.length()); documentManager.commitDocument(document); } } int index = getCollectionIndex(parent, childDescription, editor); return index < 0 ? (T)childDescription.addValue(parent, myChildElementClass) : (T)childDescription.addValue(parent, myChildElementClass, index); } } return null; }
generate
297,813
int (final DomElement parent, final DomCollectionChildDescription childDescription, final Editor editor) { int offset = editor.getCaretModel().getOffset(); for (int i = 0; i < childDescription.getValues(parent).size(); i++) { DomElement element = childDescription.getValues(parent).get(i); XmlElement xmlElement = element.getXmlElement(); if (xmlElement != null && xmlElement.getTextRange().getStartOffset() >= offset) { return i; } } return -1; }
getCollectionIndex
297,814
T (final Project project, final Editor editor, final PsiFile file) { DomElement parentDomElement = getParentDomElement(project, editor, file); final T t = generate(parentDomElement, editor); runTemplate(editor, file, t, getPredefinedVars(parentDomElement, t, editor, file)); return t; }
generate
297,815
void (@Nullable DomElement domElement, @NotNull Map<String, String> vars) { if (domElement != null) { XmlTag tag = domElement.getXmlTag(); if (tag != null) { String namespacePrefix = tag.getNamespacePrefix(); if (!StringUtil.isEmptyOrSpaces(namespacePrefix)) { vars.put(NAMESPACE_PREFIX_VAR, namespacePrefix + ":"); } } } }
addNamespacePrefix
297,816
void (final Editor editor, final PsiFile file, final T t, Map<String, String> predefinedVars) { DomTemplateRunner.getInstance(file.getProject()).runTemplate(t, myMappingId, editor, predefinedVars); }
runTemplate
297,817
void (final DomElementNavigationProvider navigateProvider, final DomElement copy) { final DomElement element = getElementToNavigate((T)copy); if (element != null) { super.doNavigate(navigateProvider, element); } }
doNavigate
297,818
DomElement (final T t) { return t; }
getElementToNavigate
297,819
String (final Class<? extends DomElement> aClass) { return StringUtil.join(Arrays.asList(NameUtilCore.nameToWords(aClass.getSimpleName())), " "); }
getDescription
297,820
String () { return myMappingId; }
getMappingId
297,821
DomTemplateRunner (Project project) { return project.getService(DomTemplateRunner.class); }
getInstance
297,822
DomElement () { return myElement; }
getElement
297,823
boolean () { return myDefined; }
isDefined
297,824
String () { return (myDefined ? "Defined " : "Changed ") + myElement; }
toString
297,825
JCheckBox (JCheckBox boundComponent) { JCheckBox checkBox = boundComponent == null ? new JCheckBox() : boundComponent; checkBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myUndefined = false; setModified(); commit(); reset(); } }); return checkBox; }
createMainComponent
297,826
void (ActionEvent e) { myUndefined = false; setModified(); commit(); reset(); }
actionPerformed
297,827
String () { return myUndefined ? null : (getComponent().isSelected() ? mySelectedValue : myUnselectedValue); }
getValue
297,828
void (final String value) { myUndefined = value == null; getComponent().setSelected(mySelectedValue.equals(value)); }
setValue
297,829
boolean () { return getExistingDomElement().isValid(); }
isValid
297,830
Project () { return getExistingDomElement().getManager().getProject(); }
getProject
297,831
GlobalSearchScope () { return getExistingDomElement().getResolveScope(); }
getResolveScope
297,832
XmlFile () { return DomUtil.getFile(getExistingDomElement()); }
getFile
297,833
void (@NotNull FileEditorManagerEvent event) { if (!isValid()) return; ApplicationManager.getApplication().invokeLater(() -> { if (myUndoHelper.isShowing() && !getComponent().isShowing()) { deselectNotify(); } else if (!myUndoHelper.isShowing() && getComponent().isShowing()) { selectNotify(); } }); FileEditor oldEditor = event.getOldEditor(); FileEditor newEditor = event.getNewEditor(); if (oldEditor == null || newEditor == null) return; if (oldEditor.getComponent().isShowing() && newEditor.getComponent().isShowing()) return; if (PerspectiveFileEditor.this.equals(oldEditor)) { if (newEditor instanceof TextEditor) { ensureInitialized(); DomElement selectedDomElement = getSelectedDomElement(); if (selectedDomElement != null) { setSelectionInTextEditor((TextEditor)newEditor, selectedDomElement); } } } else if (PerspectiveFileEditor.this.equals(newEditor)) { if (oldEditor instanceof TextEditor) { DomElement element = getSelectedDomElementFromTextEditor((TextEditor)oldEditor); if (element != null) { ensureInitialized(); setSelectedDomElement(element); } } else if (oldEditor instanceof PerspectiveFileEditor) { ensureInitialized(); DomElement selectedDomElement = ((PerspectiveFileEditor)oldEditor).getSelectedDomElement(); if (selectedDomElement != null) { setSelectedDomElement(selectedDomElement); } } } }
selectionChanged
297,834
void (@NotNull DomElement domElement) { addWatchedDocument(getDocumentManager().getDocument(DomUtil.getFile(domElement))); }
addWatchedElement
297,835
void (@NotNull DomElement domElement) { removeWatchedDocument(getDocumentManager().getDocument(DomUtil.getFile(domElement))); }
removeWatchedElement
297,836
void (Document document) { myUndoHelper.addWatchedDocument(document); }
addWatchedDocument
297,837
void (Document document) { myUndoHelper.removeWatchedDocument(document); }
removeWatchedDocument
297,838
void (TextEditor textEditor, DomElement element) { if (element != null && element.isValid()) { XmlTag tag = element.getXmlTag(); if (tag == null) return; PsiFile file = tag.getContainingFile(); if (file == null) return; Document document = getDocumentManager().getDocument(file); if (document == null || !document.equals(textEditor.getEditor().getDocument())) return; textEditor.getEditor().getCaretModel().moveToOffset(tag.getTextOffset()); textEditor.getEditor().getScrollingModel().scrollToCaret(ScrollType.CENTER); } }
setSelectionInTextEditor
297,839
PsiDocumentManager () { return PsiDocumentManager.getInstance(myProject); }
getDocumentManager
297,840
Project () { return myProject; }
getProject
297,841
VirtualFile () { return myFile; }
getVirtualFile
297,842
void () { if (myInvalidated) return; myInvalidated = true; myUndoHelper.stopListeningDocuments(); }
dispose
297,843
boolean () { return FileDocumentManager.getInstance().isFileModified(getVirtualFile()); }
isModified
297,844
boolean () { return getVirtualFile().isValid(); }
isValid
297,845
void () { if (!checkIsValid() || myInvalidated) return; ensureInitialized(); setShowing(true); if (myInitialised) { reset(); } }
selectNotify
297,846
void (boolean b) { myUndoHelper.setShowing(b); }
setShowing
297,847
void () { if (!checkIsValid() || myInvalidated) return; setShowing(false); commit(); }
deselectNotify
297,848
FileEditorLocation () { return new FileEditorLocation() { @Override public @NotNull FileEditor getEditor() { return PerspectiveFileEditor.this; } @Override public int compareTo(@NotNull FileEditorLocation fileEditorLocation) { return 0; } }; }
getCurrentLocation
297,849
FileEditor () { return PerspectiveFileEditor.this; }
getEditor
297,850
int (@NotNull FileEditorLocation fileEditorLocation) { return 0; }
compareTo
297,851
VirtualFile () { return myFile; }
getFile
297,852
void (@NotNull FileEditorState state) { }
setState
297,853
void (@NotNull PropertyChangeListener listener) { myPropertyChangeSupport.addPropertyChangeListener(listener); }
addPropertyChangeListener
297,854
void (@NotNull PropertyChangeListener listener) { myPropertyChangeSupport.removePropertyChangeListener(listener); }
removePropertyChangeListener
297,855
boolean () { if (!myInvalidated && !isValid()) { myInvalidated = true; myPropertyChangeSupport.firePropertyChange(FileEditor.PROP_VALID, Boolean.TRUE, Boolean.FALSE); } return !myInvalidated; }
checkIsValid
297,856
JComponent () { return getWrapper(); }
getComponent
297,857
Wrapper () { return myWrapper; }
getWrapper
297,858
void (@NotNull DomFileElement element) { if (isInitialised() && getComponent().isShowing() && element.isValid()) { updateHighlighting(); } }
highlightingFinished
297,859
void () { if (checkIsValid()) { CommittableUtil.updateHighlighting(myComponent); } }
updateHighlighting
297,860
void () { if (checkIsValid() && isInitialised()) { setShowing(false); try { getProject().getService(CommittableUtil.class).commit(myComponent); } finally { setShowing(true); } } }
commit
297,861
JComponent () { ensureInitialized(); return myComponent.getComponent(); }
getPreferredFocusedComponent
297,862
T () { return myComponent; }
getDomComponent
297,863
JComponent () { MnemonicHelper.init(getComponent()); myComponent = myComponentFactory.create(); DomUIFactory.getDomUIFactory().setupErrorOutdatingUserActivityWatcher(this, getDomElement()); DomManager.getDomManager(getProject()).addDomEventListener(new DomEventListener() { @Override public void eventOccured(@NotNull DomEvent event) { checkIsValid(); } }, this); Disposer.register(this, myComponent); return myComponent.getComponent(); }
createCustomComponent
297,864
void (@NotNull DomEvent event) { checkIsValid(); }
eventOccured
297,865
String () { return myName; }
getName
297,866
DomElement () { if (myComponent == null) return null; return DomUINavigationProvider.findDomElement(myComponent); }
getSelectedDomElement
297,867
void (DomElement domElement) { final DomUIControl domControl = DomUINavigationProvider.findDomControl(myComponent, domElement); if (domControl != null) { domControl.navigate(domElement); } }
setSelectedDomElement
297,868
BackgroundEditorHighlighter () { ensureInitialized(); return DomUIFactory.getDomUIFactory().createDomHighlighter(getProject(), this, getDomElement()); }
getBackgroundHighlighter
297,869
DomElement () { return myComponent.getDomElement(); }
getDomElement
297,870
boolean () { return super.isValid() && (!isInitialised() || getDomElement().isValid()); }
isValid
297,871
void () { if (checkIsValid()) { myComponent.reset(); } }
reset
297,872
BasicDomElementComponent (final CommittablePanel committablePanel, final CaptionComponent captionComponent, final @Nullable DomElement element) { final JPanel panel = new JPanel(new BorderLayout()); panel.add(captionComponent, BorderLayout.NORTH); panel.add(element != null && element.isValid() ? committablePanel.getComponent() : new JPanel(), BorderLayout.CENTER); BasicDomElementComponent component = new BasicDomElementComponent(element) { @Override public JComponent getComponent() { return panel; } }; component.addComponent(committablePanel); component.addComponent(captionComponent); return component; }
createComponentWithCaption
297,873
JComponent () { return panel; }
getComponent
297,874
boolean () { return myEditable; }
isEditable
297,875
void (JComponent component) { assert component instanceof DomTableView; initialize((DomTableView)component); }
bind
297,876
void (CommitListener listener) { myDispatcher.addListener(listener); }
addCommitListener
297,877
void (CommitListener listener) { myDispatcher.removeListener(listener); }
removeCommitListener
297,878
boolean (DomElement element) { Class<DomElement> aClass = (Class<DomElement>)ClassUtil.getRawType(myChildDescription.getType()); final DomElement domElement = element.getParentOfType(aClass, false); return domElement != null && myCollectionElements.contains(domElement); }
canNavigate
297,879
void (DomElement element) { final Class<DomElement> aClass = (Class<DomElement>)ClassUtil.getRawType(myChildDescription.getType()); final DomElement domElement = element.getParentOfType(aClass, false); int index = myCollectionElements.indexOf(domElement); if (index < 0) index = 0; myCollectionPanel.getTable().setRowSelectionInterval(index, index); }
navigate
297,880
Object (@NotNull String dataId) { if (DOM_COLLECTION_CONTROL.is(dataId)) { return this; } return null; }
getData
297,881
String () { return null; }
getHelpId
297,882
String () { return null; }
getEmptyPaneText
297,883
void (final DomTableView boundComponent) { if (boundComponent == null) { myCollectionPanel = new DomTableView(getProject(), getEmptyPaneText(), getHelpId()); } else { myCollectionPanel = boundComponent; } myCollectionPanel.setToolbarActions(new AddAction(), new EditAction(), new RemoveAction()); myCollectionPanel.installPopup(ActionPlaces.J2EE_ATTRIBUTES_VIEW_POPUP, createPopupActionGroup()); myCollectionPanel.initializeTable(); myCollectionPanel.addCustomDataProvider(this); myCollectionPanel.addChangeListener(new AbstractTableView.ChangeListener() { @Override public void changed() { reset(); } }); reset(); }
initialize
297,884
void () { reset(); }
changed
297,885
DefaultActionGroup () { final DefaultActionGroup group = new DefaultActionGroup(); group.addAll((DefaultActionGroup)ActionManager.getInstance().getAction("DomCollectionControl")); return group; }
createPopupActionGroup
297,886
ColumnInfo[] (DomElement parent) { return myColumnInfos; }
createColumnInfos
297,887
int (final int index) { return myCollectionPanel.getTable().convertRowIndexToModel(index); }
sortAdjustedIndex
297,888
void () { doEdit(myCollectionElements.get(sortAdjustedIndex(myCollectionPanel.getTable().getSelectedRow()))); }
doEdit
297,889
void (final T t) { final DomEditorManager manager = getDomEditorManager(this); if (manager != null) { manager.openDomElementEditor(t); } }
doEdit
297,890
void (final List<? extends T> toDelete) { Set<PsiFile> files = new HashSet<>(); for (final T t : toDelete) { final XmlElement element = t.getXmlElement(); if (element != null) { ContainerUtil.addIfNotNull(files, element.getContainingFile()); } } WriteCommandAction.writeCommandAction(getProject(), PsiUtilCore.toPsiFileArray(files)).run(() -> { for (final T t : toDelete) { if (t.isValid()) { t.undefine(); } } }); }
doRemove
297,891
void () { ApplicationManager.getApplication().invokeLater(() -> { final int[] selected = myCollectionPanel.getTable().getSelectedRows(); if (selected == null || selected.length == 0) return; final List<T> selectedElements = new ArrayList<>(selected.length); for (final int i : selected) { selectedElements.add(myCollectionElements.get(sortAdjustedIndex(i))); } doRemove(selectedElements); reset(); int selection = selected[0]; if (selection >= myCollectionElements.size()) { selection = myCollectionElements.size() - 1; } if (selection >= 0) { myCollectionPanel.getTable().setRowSelectionInterval(selection, selection); } }); }
doRemove
297,892
void () { final CommitListener listener = myDispatcher.getMulticaster(); listener.beforeCommit(this); listener.afterCommit(this); validate(); }
commit
297,893
void () { DomElement domElement = getDomElement(); final List<DomElementProblemDescriptor> list = DomElementAnnotationsManager.getInstance(getProject()).getCachedProblemHolder(domElement).getProblems(domElement); final List<@InspectionMessage String> messages = new ArrayList<>(); for (final DomElementProblemDescriptor descriptor : list) { if (descriptor instanceof DomCollectionProblemDescriptor && myChildDescription.equals(((DomCollectionProblemDescriptor)descriptor).getChildDescription())) { messages.add(descriptor.getDescriptionTemplate()); } } myCollectionPanel.setErrorMessages(ArrayUtilRt.toStringArray(messages)); myCollectionPanel.repaint(); }
validate
297,894
void () { if (myCollectionPanel != null) { myCollectionPanel.dispose(); } }
dispose
297,895
Project () { return myParentDomElement.getManager().getProject(); }
getProject
297,896
DomTableView () { if (myCollectionPanel == null) initialize(null); return myCollectionPanel; }
getComponent
297,897
DomCollectionChildDescription () { return myChildDescription; }
getChildDescription
297,898
DomElement () { return myParentDomElement; }
getDomElement
297,899
void () { myCollectionElements = new ArrayList<>(getCollectionElements()); myCollectionPanel.reset(createColumnInfos(myParentDomElement), myCollectionElements); validate(); }
reset