Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
19,900
void (@NlsSafe String initialText) { myResultList = new Tree(); myResultList.setExpandableItemsEnabled(false); myResultList.getEmptyText().setText(CommonBundle.getLoadingTreeNodeText()); myResultList.setRootVisible(false); myResultList.setShowsRootHandles(true); myResultList.setModel(null); MyArtifactCellRenderer renderer = myClassMode ? new MyClassCellRenderer(myResultList) : new MyArtifactCellRenderer(myResultList); myResultList.setCellRenderer(renderer); myResultList.setRowHeight(renderer.getPreferredSize().height); mySearchField = new JTextField(initialText); mySearchField.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { int d; if (e.getKeyCode() == KeyEvent.VK_DOWN) { d = 1; } else if (e.getKeyCode() == KeyEvent.VK_UP) { d = -1; } else { return; } int row = myResultList.getSelectionModel().getLeadSelectionRow(); row += d; if (row >=0 && row < myResultList.getRowCount()) { myResultList.setSelectionRow(row); } } }); setLayout(new BorderLayout()); add(mySearchField, BorderLayout.NORTH); JScrollPane pane = ScrollPaneFactory.createScrollPane(myResultList); pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); // Don't remove this line. // Without VERTICAL_SCROLLBAR_ALWAYS policy our custom layout // works incorrectly, see https://youtrack.jetbrains.com/issue/IDEA-72986 add(pane, BorderLayout.CENTER); mySearchField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { scheduleSearch(); } }); myResultList.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { if (!myAlarm.isEmpty()) return; boolean hasSelection = !myResultList.isSelectionEmpty(); myListener.canSelectStateChanged(MavenArtifactSearchPanel.this, hasSelection); } }); myResultList.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER && myResultList.getLastSelectedPathComponent() != null) { myListener.itemSelected(); e.consume(); } } }); new DoubleClickListener() { @Override protected boolean onDoubleClick(@NotNull MouseEvent e) { final TreePath path = myResultList.getPathForLocation(e.getX(), e.getY()); if (path != null && myResultList.isPathSelected(path)) { Object sel = path.getLastPathComponent(); if (sel != null && myResultList.getModel().isLeaf(sel)) { myListener.itemSelected(); return true; } } return false; } }.installOn(myResultList); }
initComponents
19,901
void (KeyEvent e) { int d; if (e.getKeyCode() == KeyEvent.VK_DOWN) { d = 1; } else if (e.getKeyCode() == KeyEvent.VK_UP) { d = -1; } else { return; } int row = myResultList.getSelectionModel().getLeadSelectionRow(); row += d; if (row >=0 && row < myResultList.getRowCount()) { myResultList.setSelectionRow(row); } }
keyPressed
19,902
void (@NotNull DocumentEvent e) { scheduleSearch(); }
textChanged
19,903
void (TreeSelectionEvent e) { if (!myAlarm.isEmpty()) return; boolean hasSelection = !myResultList.isSelectionEmpty(); myListener.canSelectStateChanged(MavenArtifactSearchPanel.this, hasSelection); }
valueChanged
19,904
void (KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER && myResultList.getLastSelectedPathComponent() != null) { myListener.itemSelected(); e.consume(); } }
keyPressed
19,905
boolean (@NotNull MouseEvent e) { final TreePath path = myResultList.getPathForLocation(e.getX(), e.getY()); if (path != null && myResultList.isPathSelected(path)) { Object sel = path.getLastPathComponent(); if (sel != null && myResultList.getModel().isLeaf(sel)) { myListener.itemSelected(); return true; } } return false; }
onDoubleClick
19,906
void () { myListener.canSelectStateChanged(this, false); myResultList.setPaintBusy(true); // evaluate text value in the swing thread final String text = mySearchField.getText(); myAlarm.cancelAllRequests(); myAlarm.addRequest(() -> { try { doSearch(text); } catch (Throwable e) { MavenLog.LOG.warn(e); } }, 500); }
scheduleSearch
19,907
void (String searchText) { MavenSearcher searcher = myClassMode ? new MavenClassSearcher() : new MavenArtifactSearcher(); List<MavenArtifactSearchResult> result = searcher.search(myProject, searchText, MAX_RESULT); final TreeModel model = new MyTreeModel(result); SwingUtilities.invokeLater(() -> { if (!myDialog.isVisible()) return; myResultList.getEmptyText().setText(MavenDomBundle.message("maven.search.no.results")); if (myClassMode) { myResultList.getEmptyText().appendLine(MavenDomBundle.message("maven.search.no.results.indices.try.update"), LINK_BOLD_ATTRIBUTES, e -> { ShowSettingsUtil.getInstance() .showSettingsDialog(myProject, MavenRepositoriesConfigurable.class); }); } myResultList.setModel(model); myResultList.setSelectionRow(0); myResultList.setPaintBusy(false); }); }
doSearch
19,908
List<MavenId> () { TreePath[] selectionPaths = myResultList.getSelectionPaths(); if (selectionPaths == null) { return Collections.emptyList(); } List<MavenId> result = new ArrayList<>(); for (TreePath each : selectionPaths) { Object sel = each.getLastPathComponent(); MavenDependencyCompletionItem info; if (sel instanceof MavenDependencyCompletionItem) { info = (MavenDependencyCompletionItem)sel; } else { info = ((MavenArtifactSearchResult)sel).getSearchResults().getItems()[0]; } result.add(new MavenId(info.getGroupId(), info.getArtifactId(), info.getVersion())); } return result; }
getResult
19,909
Object () { return myItems; }
getRoot
19,910
Object (Object parent, int index) { return getList(parent).get(index); }
getChild
19,911
int (Object parent) { List list = getList(parent); assert list != null : parent; return list.size(); }
getChildCount
19,912
List (Object parent) { if (parent == myItems) return myItems; if (parent instanceof MavenArtifactSearchResult) { return Arrays.asList(((MavenArtifactSearchResult)parent).getSearchResults().getItems()); } return null; }
getList
19,913
boolean (Object node) { return node != myItems && (getList(node) == null || getChildCount(node) < 2); }
isLeaf
19,914
int (Object parent, Object child) { return getList(parent).indexOf(child); }
getIndexOfChild
19,915
void (TreePath path, Object newValue) { }
valueForPathChanged
19,916
void (TreeModelListener l) { }
addTreeModelListener
19,917
void (TreeModelListener l) { }
removeTreeModelListener
19,918
Dimension (Container parent) { return new Dimension(getVisibleWidth(), myLeftComponent.getPreferredSize().height); }
preferredLayoutSize
19,919
void (Container parent) { int w = getVisibleWidth(); Dimension ls = myLeftComponent.getPreferredSize(); Dimension rs = myRightComponent.getPreferredSize(); int lw = w - rs.width - 10; int rw = rs.width; myLeftComponent.setBounds(0, 0, lw, ls.height); myRightComponent.setBounds(w - rw, 0, rw, rs.height); }
layoutContainer
19,920
int () { int w = tree.getVisibleRect().width - 10; Insets insets = tree.getInsets(); w -= insets.left + insets.right; JScrollPane scrollPane = ComponentUtil.getScrollPane(tree); if (scrollPane != null) { JScrollBar sb = scrollPane.getVerticalScrollBar(); if (sb != null) { w -= sb.getWidth(); } } return w; }
getVisibleWidth
19,921
Component (JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { myLeftComponent.clear(); myRightComponent.clear(); setBackground(RenderingUtil.getBackground(tree, selected)); myLeftComponent.setForeground(selected ? UIUtil.getTreeSelectionForeground(hasFocus) : null); myRightComponent.setForeground(selected ? UIUtil.getTreeSelectionForeground(hasFocus) : null); if (value == tree.getModel().getRoot()) { myLeftComponent.append(MavenProjectBundle.message("maven.search.artifract.results"), SimpleTextAttributes.REGULAR_ATTRIBUTES); } else if (value instanceof MavenArtifactSearchResult) { formatSearchResult(tree, (MavenArtifactSearchResult)value, selected); } else if (value instanceof MavenDependencyCompletionItem info) { String version = info.getVersion(); Icon icon = MavenDependencyCompletionUtil.getIcon(info.getType()); String managedVersion = myManagedDependenciesMap.get(Pair.create(info.getGroupId(), info.getArtifactId())); if (managedVersion != null && managedVersion.equals(version)) { myLeftComponent.setIcon(icon); myLeftComponent.append(version, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); myLeftComponent.append(MavenProjectBundle.message("from.dependency.management"), SimpleTextAttributes.GRAYED_ATTRIBUTES); } else { myLeftComponent.setIcon(icon); myLeftComponent.append(version, SimpleTextAttributes.REGULAR_ATTRIBUTES); } } return this; }
getTreeCellRendererComponent
19,922
void (JTree tree, MavenArtifactSearchResult searchResult, boolean selected) { MavenDependencyCompletionItem info = searchResult.getSearchResults().getItems()[0]; MavenDependencyCompletionItem iconInfo = MavenDependencyCompletionUtil.getMaxIcon(searchResult); myLeftComponent.setIcon(MavenDependencyCompletionUtil.getIcon(iconInfo.getType())); appendArtifactInfo(myLeftComponent, info, selected); }
formatSearchResult
19,923
void (SimpleColoredComponent component, MavenDependencyCompletionItem info, boolean selected) { component.append(info.getGroupId() + ":", getGrayAttributes(selected)); component.append(info.getArtifactId(), SimpleTextAttributes.REGULAR_ATTRIBUTES); component.append(":" + info.getVersion(), getGrayAttributes(selected)); }
appendArtifactInfo
19,924
SimpleTextAttributes (boolean selected) { return !selected ? SimpleTextAttributes.GRAY_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES; }
getGrayAttributes
19,925
void (JTree tree, MavenArtifactSearchResult searchResult, boolean selected) { MavenClassSearchResult classResult = (MavenClassSearchResult)searchResult; MavenDependencyCompletionItem info = searchResult.getSearchResults().getItems()[0]; myLeftComponent.setIcon(AllIcons.Nodes.Class); myLeftComponent.append(classResult.getClassName(), SimpleTextAttributes.REGULAR_ATTRIBUTES); myLeftComponent.append(" (" + classResult.getPackageName() + ")", getGrayAttributes(selected)); appendArtifactInfo(myRightComponent, info, selected); }
formatSearchResult
19,926
String () { return myDataDirName; }
getDataDirName
19,927
void () { close(true); //noinspection TestOnlyProblems final File currentDataDir = getCurrentDataDir(); final File currentDataContextDir = getCurrentDataContextDir(); final File[] files = currentDataDir.listFiles(); if (files != null) { for (File file : files) { if (!FileUtil.filesEqual(file, currentDataContextDir)) { FileUtil.delete(file); } } } else { FileUtil.delete(currentDataDir); } }
cleanupBrokenData
19,928
void (boolean releaseIndexContext) { IndexData data = myData; try { if (data != null) data.close(releaseIndexContext); } catch (MavenIndexException e) { MavenLog.LOG.warn(e); } myData = null; }
close
19,929
String () { return join(myRegisteredRepositoryIds, ","); }
getRepositoryId
19,930
File () { return myKind == IndexKind.LOCAL ? new File(myRepositoryPathOrUrl) : null; }
getRepositoryFile
19,931
String () { return myKind == IndexKind.REMOTE ? myRepositoryPathOrUrl : null; }
getRepositoryUrl
19,932
String () { return myRepositoryPathOrUrl; }
getRepositoryPathOrUrl
19,933
IndexKind () { return myKind; }
getKind
19,934
MavenRepositoryInfo () { if (myKind == IndexKind.ONLINE) return null; return new MavenRepositoryInfo(getRepositoryId(), getRepositoryId(), myRepositoryPathOrUrl, myKind); }
getRepository
19,935
long () { return myUpdateTimestamp == null ? -1 : myUpdateTimestamp; }
getUpdateTimestamp
19,936
String () { return myFailureMessage; }
getFailureMessage
19,937
boolean (@NotNull File contextDir) { return contextDir.isDirectory() && myNexusIndexer.indexExists(contextDir); }
hasValidContext
19,938
void (Exception e) { String failureMessage = e.getMessage(); if (failureMessage != null && failureMessage.contains("nexus-maven-repository-index.properties") && failureMessage.contains("FileNotFoundException")) { failureMessage = "Repository is non-nexus repo, or is not indexed"; MavenLog.LOG.debug("Failed to update Maven indices for: " + myRegisteredRepositoryIds + " " + myRepositoryPathOrUrl, e); } else { MavenLog.LOG.warn("Failed to update Maven indices for: " + myRegisteredRepositoryIds + " " + myRepositoryPathOrUrl, e); } myFailureMessage = failureMessage; }
handleUpdateException
19,939
void (PersistentHashMap<String, Set<String>> map) { try { map.closeAndClean(); } catch (IOException e) { MavenLog.LOG.error(e); } }
closeAndClean
19,940
void () { if (myDataClosed.compareAndSet(false, true)) { closeAndClean(myData.groupToArtifactMap); closeAndClean(myData.groupWithArtifactToVersionMap); closeAndClean(myData.archetypeIdToDescriptionMap); close(false); } }
closeAndClean
19,941
File () { return myDir; }
getDir
19,942
File () { //noinspection TestOnlyProblems return new File(getCurrentDataDir(), "context"); }
getCurrentDataContextDir
19,943
File () { return MavenIndices.createNewDir(myDir, DATA_DIR_PREFIX, 100); }
createNewDataDir
19,944
List<AddArtifactResponse> (@NotNull Collection<File> artifactFiles) { var failedResponses = ContainerUtil.map(artifactFiles, file -> new AddArtifactResponse(file, null)); return doIndexAndRecoveryTask(() -> { boolean locked = indexUpdateLock.tryLock(); if (!locked) return failedResponses; try { IndexData indexData = myData; if (indexData != null) { var addArtifactResponses = indexData.addArtifacts(artifactFiles); for (var addArtifactResponse : addArtifactResponses) { var id = addArtifactResponse.indexedMavenId(); if (id != null) { String groupWithArtifact = id.groupId + ":" + id.artifactId; addToCache(indexData.groupToArtifactMap, id.groupId, id.artifactId); addToCache(indexData.groupWithArtifactToVersionMap, groupWithArtifact, id.version); if ("maven-archetype".equals(id.packaging)) { addToCache(indexData.archetypeIdToDescriptionMap, groupWithArtifact, id.version + ":" + StringUtil.notNullize(id.description)); } } } indexData.flush(); return addArtifactResponses; } return failedResponses; } finally { indexUpdateLock.unlock(); } }, failedResponses); }
tryAddArtifacts
19,945
Collection<String> () { return doIndexTask(() -> getGroupIdsRaw(), Collections.emptySet()); }
getGroupIds
19,946
Set<String> (final String groupId) { return doIndexTask(() -> notNullize(myData.groupToArtifactMap.get(groupId)), Collections.emptySet()); }
getArtifactIds
19,947
Set<String> (final String groupId, final String artifactId) { String ga = groupId + ":" + artifactId; return doIndexTask(() -> notNullize(myData.groupWithArtifactToVersionMap.get(ga)), Collections.emptySet()); }
getVersions
19,948
boolean (String groupId) { if (isBroken) return false; IndexData indexData = myData; return doIndexTask(() -> indexData.groupToArtifactMap.containsMapping(groupId), false); }
hasGroupId
19,949
boolean (String groupId, String artifactId) { if (isBroken) return false; IndexData indexData = myData; String key = groupId + ":" + artifactId; return doIndexTask(() -> indexData.groupWithArtifactToVersionMap.containsMapping(key), false); }
hasArtifactId
19,950
boolean (String groupId, String artifactId, final String version) { if (isBroken) return false; final String groupWithArtifactWithVersion = groupId + ":" + artifactId + ':' + version; String groupWithArtifact = groupWithArtifactWithVersion.substring(0, groupWithArtifactWithVersion.length() - version.length() - 1); IndexData indexData = myData; return doIndexTask(() -> notNullize(indexData.groupWithArtifactToVersionMap.get(groupWithArtifact)).contains(version), false); }
hasVersion
19,951
Set<MavenArtifactInfo> (final String pattern, final int maxResult) { return doIndexAndRecoveryTask(() -> myData.search(pattern, maxResult), Collections.emptySet()); }
search
19,952
Set<MavenArchetype> () { return doIndexAndRecoveryTask(() -> { Set<MavenArchetype> archetypes = new HashSet<>(); IndexData indexData = myData; indexData.archetypeIdToDescriptionMap.consumeKeysWithExistingMapping(ga -> { List<String> gaParts = split(ga, ":"); String groupId = gaParts.get(0); String artifactId = gaParts.get(1); try { for (String vd : indexData.archetypeIdToDescriptionMap.get(ga)) { int index = vd.indexOf(':'); if (index == -1) continue; String version = vd.substring(0, index); String description = vd.substring(index + 1); archetypes.add(new MavenArchetype(groupId, artifactId, version, myRepositoryPathOrUrl, description)); } } catch (IOException e) { throw new UncheckedIOException(e); } }); return archetypes; }, Collections.emptySet()); }
getArchetypes
19,953
void () { if (isClose) return; if (!isBroken) { MavenLog.LOG.info("index is broken " + this); ApplicationManager.getApplication().getMessageBus().syncPublisher(INDEX_IS_BROKEN).indexIsBroken(this); } isBroken = true; }
markAsBroken
19,954
String () { return "MavenIndex{" + "myKind=" + myKind + '\'' + ", myRepositoryPathOrUrl='" + myRepositoryPathOrUrl + ", ids=" + myRegisteredRepositoryIds + '}'; }
toString
19,955
File (File dataDir) { return new File(dataDir, "context"); }
getDataContextDir
19,956
void (@Nullable Closeable enumerator, MavenIndexException[] exceptions) { try { if (enumerator != null) enumerator.close(); } catch (IOException e) { MavenLog.LOG.warn(e); if (exceptions[0] == null) exceptions[0] = new MavenIndexException(e); } }
safeClose
19,957
boolean () { return false; }
isModified
19,958
void () { myUpdateButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doUpdateIndex(); } }); myIndicesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { updateButtonsState(); } }); myIndicesTable.addMouseMotionListener(new MouseMotionListener() { @Override public void mouseDragged(MouseEvent e) { } @Override public void mouseMoved(MouseEvent e) { int row = myIndicesTable.rowAtPoint(e.getPoint()); if (row == -1) return; updateIndexHint(row); } }); myIndicesTable.setDefaultRenderer(Object.class, new MyCellRenderer()); myIndicesTable.setDefaultRenderer(MavenIndexUpdateManager.IndexUpdatingState.class, new MyIconCellRenderer()); myIndicesTable.getEmptyText().setText(MavenConfigurableBundle.message("maven.settings.repositories.no")); updateButtonsState(); }
configControls
19,959
void (ActionEvent e) { doUpdateIndex(); }
actionPerformed
19,960
void (ListSelectionEvent e) { updateButtonsState(); }
valueChanged
19,961
void (MouseEvent e) { }
mouseDragged
19,962
void (MouseEvent e) { int row = myIndicesTable.rowAtPoint(e.getPoint()); if (row == -1) return; updateIndexHint(row); }
mouseMoved
19,963
void () { boolean hasSelection = !myIndicesTable.getSelectionModel().isSelectionEmpty(); myUpdateButton.setEnabled(hasSelection); }
updateButtonsState
19,964
void (int row) { MavenSearchIndex index = getIndexAt(row); String message = index.getFailureMessage(); if (message == null) { myIndicesTable.setToolTipText(null); } else { myIndicesTable.setToolTipText(message); } }
updateIndexHint
19,965
void () { MavenIndicesManager.getInstance(myProject).scheduleUpdateContent(getSelectedIndices(), true); }
doUpdateIndex
19,966
List<MavenIndex> () { List<MavenIndex> result = new ArrayList<>(); for (int i : myIndicesTable.getSelectedRows()) { result.add(getIndexAt(i)); } return result; }
getSelectedIndices
19,967
MavenIndex (int i) { MyTableModel model = (MyTableModel)myIndicesTable.getModel(); return model.getIndex(i); }
getIndexAt
19,968
String () { return IndicesBundle.message("maven.repositories.title"); }
getDisplayName
19,969
String () { return "reference.settings.project.maven.repository.indices"; }
getHelpTopic
19,970
String () { return getHelpTopic(); }
getId
19,971
JComponent () { return myMainPanel; }
createComponent
19,972
void () { myIndicesTable.setModel(new MyTableModel(MavenIndicesManager.getInstance(myProject).getIndex().getIndices())); myIndicesTable.getColumnModel().getColumn(0).setPreferredWidth(400); myIndicesTable.getColumnModel().getColumn(1).setPreferredWidth(50); myIndicesTable.getColumnModel().getColumn(2).setPreferredWidth(50); myIndicesTable.getColumnModel().getColumn(3).setPreferredWidth(20); myUpdatingIcon = new AsyncProcessIcon(IndicesBundle.message("maven.indices.updating")); myUpdatingIcon.resume(); myTimerListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myIndicesTable.repaint(); } }; myRepaintTimer = TimerUtil.createNamedTimer("Maven repaint", AsyncProcessIcon.CYCLE_LENGTH / AsyncProcessIcon.COUNT, myTimerListener); myRepaintTimer.start(); }
reset
19,973
void (ActionEvent e) { myIndicesTable.repaint(); }
actionPerformed
19,974
void () { if (myRepaintTimer == null) return; // has not yet been initialized and reset myRepaintTimer.removeActionListener(myTimerListener); myRepaintTimer.stop(); myUpdatingIcon.dispose(); }
disposeUIResources
19,975
int () { return COLUMNS.length; }
getColumnCount
19,976
String (int index) { return COLUMNS[index]; }
getColumnName
19,977
int () { return myIndices.size(); }
getRowCount
19,978
Object (int rowIndex, int columnIndex) { MavenSearchIndex i = getIndex(rowIndex); return switch (columnIndex) { case 0 -> i.getRepositoryPathOrUrl(); case 1 -> switch (i.getKind()) { case LOCAL -> "Local"; case REMOTE -> "Remote"; case ONLINE -> "Online"; }; case 2 -> { if (i.getFailureMessage() != null) { yield IndicesBundle.message("maven.index.updated.error"); } long timestamp = i.getUpdateTimestamp(); if (timestamp == -1) yield IndicesBundle.message("maven.index.updated.never"); yield DateFormatUtil.formatDate(timestamp); } case 3 -> { MavenRepositoryInfo repository = i.getRepository(); if (repository == null) yield MavenIndexUpdateManager.IndexUpdatingState.IDLE; yield MavenSystemIndicesManager.getInstance().getUpdatingStateSync(myProject, repository); } default -> throw new RuntimeException(); }; }
getValueAt
19,979
MavenIndex (int rowIndex) { return myIndices.get(rowIndex); }
getIndex
19,980
Component (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { // reset custom colors and let DefaultTableCellRenderer to set ones setForeground(null); setBackground(null); Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); MavenSearchIndex index = getIndexAt(row); if (index.getFailureMessage() != null) { if (isSelected) { setForeground(JBColor.PINK); } else { setBackground(JBColor.PINK); } } return c; }
getTableCellRendererComponent
19,981
Component (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { myState = (MavenIndexUpdateManager.IndexUpdatingState)value; return super.getTableCellRendererComponent(table, "", isSelected, hasFocus, row, column); }
getTableCellRendererComponent
19,982
void (Graphics g) { super.paintComponent(g); Dimension size = getSize(); switch (myState) { case UPDATING -> { myUpdatingIcon.setBackground(getBackground()); myUpdatingIcon.setSize(size.width, size.height); myUpdatingIcon.paint(g); } case WAITING -> { int x = (size.width - AllIcons.Process.Step_passive.getIconWidth()) / 2; int y = (size.height - AllIcons.Process.Step_passive.getIconHeight()) / 2; AllIcons.Process.Step_passive.paintIcon(this, g, x, y); } } }
paintComponent
19,983
MavenArchetypeManager (@NotNull Project project) { return project.getService(MavenArchetypeManager.class); }
getInstance
19,984
Collection<MavenArchetype> (@NotNull MavenCatalog catalog) { if (catalog instanceof MavenCatalog.System.Internal) { return getInnerArchetypes(); } if (catalog instanceof MavenCatalog.System.DefaultLocal) { return getLocalArchetypes(); } if (catalog instanceof MavenCatalog.System.MavenCentral) { return getRemoteArchetypes(((MavenCatalog.System.MavenCentral)catalog).getUrl()); } if (catalog instanceof MavenCatalog.Local) { return getInnerArchetypes(((MavenCatalog.Local)catalog).getPath()); } if (catalog instanceof MavenCatalog.Remote) { return getRemoteArchetypes(((MavenCatalog.Remote)catalog).getUrl()); } return Collections.emptyList(); }
getArchetypes
19,985
Set<MavenArchetype> () { MavenIndicesManager indicesManager = MavenIndicesManager.getInstance(myProject); Set<MavenArchetype> result = new HashSet<>(getInnerArchetypes()); result.addAll(loadUserArchetypes(getUserArchetypesFile())); if (!indicesManager.isInit()) { indicesManager.updateIndicesListSync(); } MavenIndexHolder indexHolder = indicesManager.getIndex(); for (MavenIndex index : indexHolder.getIndices()) { result.addAll(index.getArchetypes()); } for (MavenArchetypesProvider each : MavenArchetypesProvider.EP_NAME.getExtensionList()) { result.addAll(each.getArchetypes()); } return result; }
getArchetypes
19,986
Collection<MavenArchetype> () { MavenIndicesManager indicesManager = MavenIndicesManager.getInstance(myProject); if (!indicesManager.isInit()) indicesManager.updateIndicesListSync(); MavenIndex localIndex = indicesManager.getIndex().getLocalIndex(); if (localIndex == null) return Collections.emptySet(); return localIndex.getArchetypes(); }
getLocalArchetypes
19,987
Collection<MavenArchetype> () { return List.of( new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-archetype", "1.0", null, "An archetype which contains a sample archetype."), new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-j2ee-simple", "1.0", null, "An archetype which contains a simplifed sample J2EE application."), new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-plugin", "1.2", null, "An archetype which contains a sample Maven plugin."), new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-plugin-site", "1.1", null, "An archetype which contains a sample Maven plugin site. " + "This archetype can be layered upon an existing Maven plugin project."), new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-portlet", "1.0.1", null, "An archetype which contains a sample JSR-268 Portlet."), new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-profiles", "1.0-alpha-4", null, ""), new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-quickstart", "1.1", null, "An archetype which contains a sample Maven project."), new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-site", "1.1", null, "An archetype which contains a sample Maven site which demonstrates some of the supported document types" + " like APT, XDoc, and FML and demonstrates how to i18n your site. " + "This archetype can be layered upon an existing Maven project."), new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-site-simple", "1.1", null, "An archetype which contains a sample Maven site."), new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-webapp", "1.0", null, "An archetype which contains a sample Maven Webapp project.") ); }
getInnerArchetypes
19,988
Collection<MavenArchetype> (Path path) { return executeWithMavenEmbedderWrapper(wrapper -> wrapper.getInnerArchetypes(path)); }
getInnerArchetypes
19,989
Collection<MavenArchetype> (URL url) { return getRemoteArchetypes(url.toExternalForm()); }
getRemoteArchetypes
19,990
Collection<MavenArchetype> (String url) { return executeWithMavenEmbedderWrapper(wrapper -> wrapper.getRemoteArchetypes(url)); }
getRemoteArchetypes
19,991
void (@NotNull String groupId, @NotNull String artifactId, @NotNull String version) { MavenId mavenId = new MavenId(groupId, artifactId, version); MavenIndex localIndex = MavenIndicesManager.getInstance(myProject).getIndex().getLocalIndex(); if (localIndex == null) return; Path artifactPath = MavenUtil.getArtifactPath(Path.of(localIndex.getRepositoryPathOrUrl()), mavenId, "jar", null); if (artifactPath != null && artifactPath.toFile().exists()) { MavenIndicesManager.getInstance(myProject).scheduleArtifactIndexing(mavenId, artifactPath.toFile()); } }
addToLocalIndex
19,992
List<MavenArchetype> (@NotNull Path userArchetypesPath) { try { if (!Files.exists(userArchetypesPath)) { return Collections.emptyList(); } // Store artifact to set to remove duplicate created by old IDEA (https://youtrack.jetbrains.com/issue/IDEA-72105) Collection<MavenArchetype> result = new LinkedHashSet<>(); List<Element> children = JDOMUtil.load(userArchetypesPath).getChildren(ELEMENT_ARCHETYPE); for (int i = children.size() - 1; i >= 0; i--) { Element each = children.get(i); String groupId = each.getAttributeValue(ELEMENT_GROUP_ID); String artifactId = each.getAttributeValue(ELEMENT_ARTIFACT_ID); String version = each.getAttributeValue(ELEMENT_VERSION); String repository = each.getAttributeValue(ELEMENT_REPOSITORY); String description = each.getAttributeValue(ELEMENT_DESCRIPTION); if (StringUtil.isEmptyOrSpaces(groupId) || StringUtil.isEmptyOrSpaces(artifactId) || StringUtil.isEmptyOrSpaces(version)) { continue; } result.add(new MavenArchetype(groupId, artifactId, version, repository, description)); } ArrayList<MavenArchetype> listResult = new ArrayList<>(result); Collections.reverse(listResult); return listResult; } catch (IOException | JDOMException e) { MavenLog.LOG.warn(e); return Collections.emptyList(); } }
loadUserArchetypes
19,993
void (@NotNull MavenArchetype archetype, @NotNull Path userArchetypesPath) { List<MavenArchetype> archetypes = new ArrayList<>(loadUserArchetypes(userArchetypesPath)); int idx = archetypes.indexOf(archetype); if (idx >= 0) { archetypes.set(idx, archetype); } else { archetypes.add(archetype); } saveUserArchetypes(archetypes, userArchetypesPath); }
addArchetype
19,994
Path () { return MavenSystemIndicesManager.getInstance().getIndicesDir().resolve("UserArchetypes.xml"); }
getUserArchetypesFile
19,995
void (List<MavenArchetype> userArchetypes, @NotNull Path userArchetypesPath) { Element root = new Element(ELEMENT_ARCHETYPES); for (MavenArchetype each : userArchetypes) { Element childElement = new Element(ELEMENT_ARCHETYPE); childElement.setAttribute(ELEMENT_GROUP_ID, each.groupId); childElement.setAttribute(ELEMENT_ARTIFACT_ID, each.artifactId); childElement.setAttribute(ELEMENT_VERSION, each.version); if (each.repository != null) { childElement.setAttribute(ELEMENT_REPOSITORY, each.repository); } if (each.description != null) { childElement.setAttribute(ELEMENT_DESCRIPTION, each.description); } root.addContent(childElement); } try { JDOMUtil.write(root, userArchetypesPath); } catch (IOException e) { MavenLog.LOG.warn(e); } }
saveUserArchetypes
19,996
boolean () { return indicesInit; }
isIndicesInit
19,997
boolean () { return !indicesInit; }
isNotInit
19,998
List<MavenIndex> (@NotNull RepositoryDiff<MavenIndex> localDiff, @NotNull RepositoryDiff<List<MavenIndex>> remoteDiff) { List<MavenIndex> oldIndices = new ArrayList<>(remoteDiff.oldIndices); if (localDiff.oldIndices != null) oldIndices.add(localDiff.oldIndices); return oldIndices; }
getOldIndices
19,999
List<MavenIndex> () { return myIndexHolder.getIndices(); }
getIndices