Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
6,000
void (@NlsContexts.ProgressText String s) { final ProgressIndicator progress = myProgress.get(); if (progress != null) { progress.setText2(s); } }
setProgressStatistics
6,001
void (@NlsContexts.ProgressText String s) { final ProgressIndicator progress = myProgress.get(); if (progress != null) { progress.setText(s); } }
setProgressText
6,002
void (@Nls String text) { myMessageView.outputError(text, AntBuildMessageView.PRIORITY_ERR); }
printRawError
6,003
void (@NlsSafe String text) { if (!myFirstLineProcessed) { myFirstLineProcessed = true; myStartedSuccessfully = false; myMessageView.buildFailed(myBuildName); } if (!myStartedSuccessfully) { printRawError(text); } }
readErrorOutput
6,004
void (char tagName, @NlsSafe final String tagValue, @AntMessage.Priority int priority) { if (LOG.isDebugEnabled()) { LOG.debug(String.valueOf(tagName) + priority + "=" + tagValue); } if (IdeaAntLogger2.TARGET == tagName) { setProgressStatistics(AntBundle.message("target.tag.name.status.text", tagValue)); } else if (IdeaAntLogger2.TASK == tagName) { setProgressText(AntBundle.message("executing.task.tag.value.status.text", tagValue)); if (JAVAC.equals(tagValue)) { myJavacMessages = new ArrayList<>(); } } if (myJavacMessages != null && (IdeaAntLogger2.MESSAGE == tagName || IdeaAntLogger2.ERROR == tagName)) { myJavacMessages.add(tagValue); return; } if (IdeaAntLogger2.MESSAGE == tagName) { myMessageView.outputMessage(tagValue, priority); } else if (IdeaAntLogger2.TARGET == tagName) { myMessageView.startTarget(tagValue); } else if (IdeaAntLogger2.TASK == tagName) { myMessageView.startTask(tagValue); } else if (IdeaAntLogger2.ERROR == tagName) { myMessageView.outputError(tagValue, priority); } else if (IdeaAntLogger2.EXCEPTION == tagName) { String exceptionText = tagValue.replace(IdeaAntLogger2.EXCEPTION_LINE_SEPARATOR, '\n'); myMessageView.outputException(exceptionText); } else if (IdeaAntLogger2.BUILD == tagName) { myMessageView.startBuild(myBuildName); } else if (IdeaAntLogger2.TARGET_END == tagName || IdeaAntLogger2.TASK_END == tagName) { final List<String> javacMessages = myJavacMessages; myJavacMessages = null; processJavacMessages(javacMessages, myMessageView, myProject); if (IdeaAntLogger2.TARGET_END == tagName) { myMessageView.finishTarget(); } else { myMessageView.finishTask(); } } }
processTag
6,005
int (int priority) { if (priority == AntBuildMessageView.PRIORITY_ERR || priority == AntBuildMessageView.PRIORITY_WARN || priority == AntBuildMessageView.PRIORITY_INFO || priority == AntBuildMessageView.PRIORITY_VERBOSE || priority == AntBuildMessageView.PRIORITY_DEBUG) { return priority; } return AntBuildMessageView.PRIORITY_VERBOSE; // fallback value for unknown priority value }
fixPriority
6,006
void (final List<String> javacMessages, final AntBuildMessageView messageView, final Project project) { if (javacMessages == null) { return; } final com.intellij.compiler.OutputParser outputParser = new JavacOutputParser(project); com.intellij.compiler.OutputParser.Callback callback = new com.intellij.compiler.OutputParser.Callback() { private int myIndex = -1; @Override @Nullable public String getCurrentLine() { if (myIndex >= javacMessages.size()) { return null; } return javacMessages.get(myIndex); } @Override public String getNextLine() { final int size = javacMessages.size(); final int next = Math.min(myIndex + 1, javacMessages.size()); myIndex = next; if (next >= size) { return null; } return javacMessages.get(next); } @Override public void pushBack(String line) { myIndex--; } @Override public void message(final CompilerMessageCategory category, final String message, final String url, final int lineNum, final int columnNum) { StringTokenizer tokenizer = new StringTokenizer(message, "\n", false); final String[] strings = new String[tokenizer.countTokens()]; for (int idx = 0; tokenizer.hasMoreTokens(); idx++) { strings[idx] = tokenizer.nextToken(); } ApplicationManager.getApplication().runReadAction(() -> { VirtualFile file = url == null ? null : VirtualFileManager.getInstance().findFileByUrl(url); messageView.outputJavacMessage(convertCategory(category), strings, file, url, lineNum, columnNum); if (file != null && category == CompilerMessageCategory.ERROR) { final WolfTheProblemSolver wolf = WolfTheProblemSolver.getInstance(project); final Problem problem = wolf.convertToProblem(file, lineNum, columnNum, strings); wolf.weHaveGotNonIgnorableProblems(file, Collections.singletonList(problem)); } }); } @Override public void setProgressText(String text) { } @Override public void fileProcessed(String path) { } @Override public void fileGenerated(String path) { } }; try { while (true) { if (!outputParser.processMessageLine(callback)) { break; } } } catch (Exception e) { //ignore } }
processJavacMessages
6,007
String () { if (myIndex >= javacMessages.size()) { return null; } return javacMessages.get(myIndex); }
getCurrentLine
6,008
String () { final int size = javacMessages.size(); final int next = Math.min(myIndex + 1, javacMessages.size()); myIndex = next; if (next >= size) { return null; } return javacMessages.get(next); }
getNextLine
6,009
void (String line) { myIndex--; }
pushBack
6,010
void (final CompilerMessageCategory category, final String message, final String url, final int lineNum, final int columnNum) { StringTokenizer tokenizer = new StringTokenizer(message, "\n", false); final String[] strings = new String[tokenizer.countTokens()]; for (int idx = 0; tokenizer.hasMoreTokens(); idx++) { strings[idx] = tokenizer.nextToken(); } ApplicationManager.getApplication().runReadAction(() -> { VirtualFile file = url == null ? null : VirtualFileManager.getInstance().findFileByUrl(url); messageView.outputJavacMessage(convertCategory(category), strings, file, url, lineNum, columnNum); if (file != null && category == CompilerMessageCategory.ERROR) { final WolfTheProblemSolver wolf = WolfTheProblemSolver.getInstance(project); final Problem problem = wolf.convertToProblem(file, lineNum, columnNum, strings); wolf.weHaveGotNonIgnorableProblems(file, Collections.singletonList(problem)); } }); }
message
6,011
void (String text) { }
setProgressText
6,012
void (String path) { }
fileProcessed
6,013
void (String path) { }
fileGenerated
6,014
String (SegmentReader reader, Project project) { String prompt = reader.readLimitedString(); String defaultValue = reader.readLimitedString(); String[] choices = reader.readStringArray(); MessagesEx.BaseInputInfo question; if (choices.length == 0) { MessagesEx.InputInfo inputInfo = new MessagesEx.InputInfo(project); inputInfo.setDefaultValue(defaultValue); question = inputInfo; } else { MessagesEx.ChoiceInfo choiceInfo = new MessagesEx.ChoiceInfo(project); choiceInfo.setChoices(choices, defaultValue); question = choiceInfo; } question.setIcon(Messages.getQuestionIcon()); question.setTitle(AntBundle.message("user.inout.request.ant.build.input.dialog.title")); question.setMessage(prompt); question.setIcon(Messages.getQuestionIcon()); return question.forceUserInput(); }
askUser
6,015
String () { return "#com.intellij.ant.explorer.SaveMetaTargetDialog"; }
getDimensionServiceKey
6,016
void () { final ExecuteCompositeTargetEvent eventObject = createEventObject(); if (myAntConfiguration.getTargetForEvent(eventObject) == null) { myAntConfiguration.setTargetForEvent(myBuildFile, eventObject.getMetaTargetName(), eventObject); super.doOKAction(); } else { Messages.showInfoMessage(getContentPane(), AntBundle.message("save.meta.data.such.sequence.of.targets.already.exists.error.message"), getTitle()); } }
doOKAction
6,017
JComponent () { return myTfName; }
getPreferredFocusedComponent
6,018
JComponent () { final JPanel panel = new JPanel(new GridBagLayout()); final JLabel nameLabel = new JLabel(AntBundle.message("save.meta.data.name.label")); panel.add(nameLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBInsets.emptyInsets(), 0, 0)); myTfName = new JTextField(myInitialEvent.getPresentableName()); nameLabel.setLabelFor(myTfName); myTfName.selectAll(); panel.add(myTfName, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insetsTop(4), 0, 0)); final DefaultListModel dataModel = new DefaultListModel(); myTargetList = new JBList(dataModel); final List<String> targetNames = myInitialEvent.getTargetNames(); for (@NlsSafe String name : targetNames) { dataModel.addElement(name); } panel.add(new JLabel(AntBundle.message("save.meta.data.targets.label")), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insetsTop(6), 0, 0)); panel.add(ScrollPaneFactory.createScrollPane(myTargetList), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 2, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, JBUI.insetsTop(4), 0, 0)); final JButton upButton = new JButton(AntBundle.message("button.move.up")); panel.add(upButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(6, 6, 0, 0), 0, 0)); final JButton downButton = new JButton(AntBundle.message("button.move.down")); panel.add(downButton, new GridBagConstraints(1, 4, 1, GridBagConstraints.REMAINDER, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insetsLeft(6), 0, 0)); class UpdateAction implements ActionListener { @Override public void actionPerformed(ActionEvent e) { upButton.setEnabled(ListUtil.canMoveSelectedItemsUp(myTargetList)); downButton.setEnabled(ListUtil.canMoveSelectedItemsDown(myTargetList)); } } upButton.addActionListener(new UpdateAction() { @Override public void actionPerformed(ActionEvent e) { ListUtil.moveSelectedItemsUp(myTargetList); super.actionPerformed(e); } }); downButton.addActionListener(new UpdateAction() { @Override public void actionPerformed(ActionEvent e) { ListUtil.moveSelectedItemsDown(myTargetList); super.actionPerformed(e); } }); myTargetList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { upButton.setEnabled(ListUtil.canMoveSelectedItemsUp(myTargetList)); downButton.setEnabled(ListUtil.canMoveSelectedItemsDown(myTargetList)); } }); myTargetList.setSelectedIndex(0); return panel; }
createCenterPanel
6,019
void (ActionEvent e) { upButton.setEnabled(ListUtil.canMoveSelectedItemsUp(myTargetList)); downButton.setEnabled(ListUtil.canMoveSelectedItemsDown(myTargetList)); }
actionPerformed
6,020
void (ActionEvent e) { ListUtil.moveSelectedItemsUp(myTargetList); super.actionPerformed(e); }
actionPerformed
6,021
void (ActionEvent e) { ListUtil.moveSelectedItemsDown(myTargetList); super.actionPerformed(e); }
actionPerformed
6,022
void (ListSelectionEvent e) { upButton.setEnabled(ListUtil.canMoveSelectedItemsUp(myTargetList)); downButton.setEnabled(ListUtil.canMoveSelectedItemsDown(myTargetList)); }
valueChanged
6,023
ExecuteCompositeTargetEvent () { final ListModel model = myTargetList.getModel(); final int size = model.getSize(); final List<@NlsSafe String> names = new ArrayList<>(); for (int idx = 0; idx < size; idx++) { names.add((String)model.getElementAt(idx)); } final ExecuteCompositeTargetEvent event = new ExecuteCompositeTargetEvent(names); event.setPresentableName(myTfName.getText().trim()); return event; }
createEventObject
6,024
boolean (@NotNull JTree tree) { final AntConfiguration config = myConfig; return config != null && !config.getBuildFileList().isEmpty() && super.isEnabled(tree); }
isEnabled
6,025
void () { treeModel.invalidateAsync(); }
configurationLoaded
6,026
void (AntBuildFile buildFile) { treeModel.invalidateAsync(); }
buildFileAdded
6,027
void (AntBuildFile buildFile) { treeModel.invalidate(buildFile, true); }
buildFileChanged
6,028
void (AntBuildFile buildFile) { treeModel.invalidateAsync(); }
buildFileRemoved
6,029
void () { config.removeAntConfigurationListener(listener); }
dispose
6,030
void (final Component comp, final int x, final int y) { popupInvoked(comp, x, y); }
invokePopup
6,031
void (@NotNull MouseEvent e, @NotNull DataContext dataContext, @NotNull TreePath treePath) { runSelection(DataManager.getInstance().getDataContext(myTree), true); }
processDoubleClick
6,032
void (ActionEvent e) { runSelection(DataManager.getInstance().getDataContext(myTree), false); }
actionPerformed
6,033
void (@NotNull Keymap keymap) { treeModel.invalidateAsync(); }
keymapAdded
6,034
void (@NotNull Keymap keymap) { treeModel.invalidateAsync(); }
keymapRemoved
6,035
void (@Nullable Keymap keymap) { treeModel.invalidateAsync(); }
activeKeymapChanged
6,036
void (@NotNull Keymap keymap, @NotNull String actionId) { treeModel.invalidateAsync(); }
shortcutChanged
6,037
void () { treeModel.invalidateAsync(); }
beforeRunTasksChanged
6,038
void () { StatusText emptyText = myTree.getEmptyText(); emptyText.appendLine(AntBundle.message("ant.empty.text.1")); emptyText.appendLine(AntBundle.message("ant.empty.text.2"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES, e -> addBuildFile()); emptyText.appendLine(""); emptyText.appendLine( AllIcons.General.ContextHelp, AntBundle.message("ant.empty.text.help"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES, e -> HelpManager.getInstance().invokeHelp("procedures.building.ant.add")); }
setupEmptyText
6,039
void () { final Tree tree = myTree; if (tree != null) { ToolTipManager.sharedInstance().unregisterComponent(tree); for (KeyStroke keyStroke : tree.getRegisteredKeyStrokes()) { tree.unregisterKeyboardAction(keyStroke); } myTree = null; } myTreeModel = null; myProject = null; myConfig = null; }
dispose
6,040
JPanel () { final DefaultActionGroup group = new DefaultActionGroup(); group.add(new AddAction()); group.add(new RemoveAction()); group.add(new RunAction()); group.add(new ShowAllTargetsAction()); AnAction action = CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, this); action.getTemplatePresentation().setDescription(AntBundle.messagePointer("ant.explorer.expand.all.nodes.action.description")); group.add(action); action = CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, this); action.getTemplatePresentation().setDescription(AntBundle.messagePointer("ant.explorer.collapse.all.nodes.action.description")); group.add(action); group.add(myAntBuildFilePropertiesAction); final ActionToolbar actionToolBar = ActionManager.getInstance().createActionToolbar(ActionPlaces.ANT_EXPLORER_TOOLBAR, group, true); actionToolBar.setTargetComponent(this); return JBUI.Panels.simplePanel(actionToolBar.getComponent()); }
createToolbarPanel
6,041
void () { final FileChooserDescriptor descriptor = createXmlDescriptor(); descriptor.setTitle(AntBundle.message("select.ant.build.file.dialog.title")); descriptor.setDescription(AntBundle.message("select.ant.build.file.dialog.description")); final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myProject, null); addBuildFile(files); }
addBuildFile
6,042
void (final VirtualFile[] files) { if (files.length == 0) { return; } ApplicationManager.getApplication().invokeLater(() -> { final AntConfiguration antConfiguration = myConfig; if (antConfiguration == null) { return; } final List<VirtualFile> ignoredFiles = new ArrayList<>(); for (VirtualFile file : files) { try { antConfiguration.addBuildFile(file); } catch (AntNoFileException e) { ignoredFiles.add(e.getFile()); } } if (ignoredFiles.size() != 0) { String messageText; @NlsSafe final StringBuilder message = new StringBuilder(); String separator = ""; for (final VirtualFile virtualFile : ignoredFiles) { message.append(separator); message.append(virtualFile.getPresentableUrl()); separator = "\n"; } messageText = message.toString(); Messages.showWarningDialog(myProject, messageText, AntBundle.message("cannot.add.ant.files.dialog.title")); } }); }
addBuildFile
6,043
void () { final Collection<AntBuildFileBase> files = getSelectedBuildFiles(); if (!files.isEmpty()) { if (files.size() == 1) { removeBuildFile(files.iterator().next()); } else { String dialogTitle = AntBundle.message("dialog.title.confirm.remove"); String message = AntBundle.message("dialog.message.remove.build.files.references", files.size()); final int result = Messages.showYesNoDialog(myProject, message, dialogTitle, Messages.getQuestionIcon() ); if (result == Messages.YES) { for (AntBuildFileBase file : files) { myConfig.removeBuildFile(file); } } } } }
removeSelectedBuildFiles
6,044
void () { final AntBuildFile buildFile = getCurrentBuildFile(); if (buildFile == null) { return; } removeBuildFile(buildFile); }
removeBuildFile
6,045
void (AntBuildFile buildFile) { final String fileName = buildFile.getPresentableUrl(); final int result = Messages.showYesNoDialog(myProject, AntBundle.message("remove.the.reference.to.file.confirmation.text", fileName), AntBundle.message("dialog.title.confirm.remove"), Messages.getQuestionIcon()); if (result != Messages.YES) { return; } myConfig.removeBuildFile(buildFile); }
removeBuildFile
6,046
void () { final AntBuildFileBase buildFile = getCurrentBuildFile(); if (buildFile != null && BuildFilePropertiesPanel.editBuildFile(buildFile)) { myConfig.updateBuildFile(buildFile); } }
setBuildFileProperties
6,047
void (final DataContext dataContext, final boolean moveFocusToEditor) { if (!canRunSelection()) { return; } final AntBuildFileBase buildFile = getCurrentBuildFile(); if (buildFile != null) { final List<String> targets = getTargetNamesFromPaths(myTree.getSelectionPaths()); AntActionsUsagesCollector.runSelectedBuildAction.log(myProject); ExecutionHandler.runBuild(buildFile, targets, null, dataContext, Collections.emptyList(), AntBuildListener.NULL); if (moveFocusToEditor) { ToolWindowManager.getInstance(myProject).activateEditorComponent(); } } }
runSelection
6,048
boolean () { if (myTree == null) { return false; } final TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) { return false; } final AntBuildFile buildFile = getCurrentBuildFile(); if (buildFile == null || !buildFile.exists()) { return false; } for (final TreePath path : paths) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); final Object userObject = node.getUserObject(); final AntBuildFileNodeDescriptor buildFileNodeDescriptor; if (userObject instanceof AntTargetNodeDescriptor) { buildFileNodeDescriptor = (AntBuildFileNodeDescriptor)((DefaultMutableTreeNode)node.getParent()).getUserObject(); } else if (userObject instanceof AntBuildFileNodeDescriptor){ buildFileNodeDescriptor = (AntBuildFileNodeDescriptor)userObject; } else { buildFileNodeDescriptor = null; } if (buildFileNodeDescriptor == null || buildFileNodeDescriptor.getBuildFile() != buildFile) { return false; } } return true; }
canRunSelection
6,049
AntBuildTarget[] (TreePath[] paths) { return Arrays.stream(paths) .map(path -> ((DefaultMutableTreeNode)path.getLastPathComponent()).getUserObject()) .filter(userObject -> userObject instanceof AntTargetNodeDescriptor) .map(userObject -> ((AntTargetNodeDescriptor)userObject).getTarget()) .toArray(AntBuildTarget[]::new); }
getTargetObjectsFromPaths
6,050
AntBuildFileBase () { if( myProject == null) return null; return getCurrentBuildFile(); }
getSelectedFile
6,051
AntBuildFileBase () { final AntBuildFileNodeDescriptor descriptor = getCurrentBuildFileNodeDescriptor(); return (AntBuildFileBase)((descriptor == null) ? null : descriptor.getBuildFile()); }
getCurrentBuildFile
6,052
Collection<AntBuildFileBase> () { if (myTree == null) { return Collections.emptyList(); } final TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) { return Collections.emptyList(); } final Set<AntBuildFileBase> result = new HashSet<>(); for (TreePath path : paths) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); while (node != null) { final Object userObject = node.getUserObject(); if (userObject instanceof AntBuildFileNodeDescriptor) { final AntBuildFileBase file = (AntBuildFileBase)((AntBuildFileNodeDescriptor)userObject).getBuildFile(); if (file != null) { result.add(file); } break; } node = (DefaultMutableTreeNode)node.getParent(); } } return result; }
getSelectedBuildFiles
6,053
AntBuildFileNodeDescriptor () { final Tree tree = myTree; if (tree == null) { return null; } final TreePath path = tree.getSelectionPath(); if (path == null) { return null; } DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); while (node != null) { final Object userObject = node.getUserObject(); if (userObject instanceof AntBuildFileNodeDescriptor) { return (AntBuildFileNodeDescriptor)userObject; } node = (DefaultMutableTreeNode)node.getParent(); } return null; }
getCurrentBuildFileNodeDescriptor
6,054
void (final Component comp, final int x, final int y) { Object userObject = null; final TreePath path = myTree.getSelectionPath(); if (path != null) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); if (node != null) { userObject = node.getUserObject(); } } final DefaultActionGroup group = new DefaultActionGroup(); group.add(new RunAction()); group.add(new CreateMetaTargetAction()); group.add(new MakeAntRunConfigurationAction()); group.add(new RemoveMetaTargetsOrBuildFileAction()); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE)); if (userObject instanceof AntBuildFileNodeDescriptor) { group.add(new RemoveBuildFileAction(this)); } if (userObject instanceof AntTargetNodeDescriptor) { final AntBuildTargetBase target = ((AntTargetNodeDescriptor)userObject).getTarget(); final DefaultActionGroup executeOnGroup = DefaultActionGroup.createPopupGroup(AntBundle.messagePointer("ant.explorer.execute.on.action.group.name")); executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteBeforeCompilationEvent.getInstance())); executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteAfterCompilationEvent.getInstance())); executeOnGroup.addSeparator(); executeOnGroup.add(new ExecuteBeforeRunAction(target)); group.add(executeOnGroup); group.add(new AssignShortcutAction(target.getActionId())); } group.add(myAntBuildFilePropertiesAction); final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.ANT_EXPLORER_POPUP, group); popupMenu.getComponent().show(comp, x, y); }
popupInvoked
6,055
Object (@NotNull @NonNls String dataId) { if (PlatformCoreDataKeys.BGT_DATA_PROVIDER.is(dataId)) { Tree tree = myTree; if (tree == null) { return null; } final TreePath[] paths = tree.getSelectionPaths(); final TreePath leadPath = tree.getLeadSelectionPath(); final AntBuildFile currentBuildFile = getCurrentBuildFile(); return (DataProvider)id -> getSlowData(id, paths, leadPath, currentBuildFile); } else if (PlatformCoreDataKeys.HELP_ID.is(dataId)) { return HelpID.ANT; } else if (PlatformDataKeys.TREE_EXPANDER.is(dataId)) { return myProject != null? myTreeExpander : null; } return super.getData(dataId); }
getData
6,056
Object (@NotNull @NonNls String dataId, final TreePath @Nullable [] paths, @Nullable TreePath leadPath, @Nullable AntBuildFile currentBuildFile) { if (CommonDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) { final List<VirtualFile> virtualFiles = collectAntFiles(buildFile -> { final VirtualFile virtualFile = buildFile.getVirtualFile(); if (virtualFile != null && virtualFile.isValid()) { return virtualFile; } return null; }, paths); return virtualFiles == null? null : virtualFiles.toArray(VirtualFile.EMPTY_ARRAY); } else if (PlatformCoreDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) { final List<PsiElement> elements = collectAntFiles(AntBuildFile::getAntFile, paths); return elements == null? null : elements.toArray(PsiElement.EMPTY_ARRAY); } else if (CommonDataKeys.NAVIGATABLE.is(dataId)) { if (leadPath != null) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)leadPath.getLastPathComponent(); if (node != null) { if (node.getUserObject() instanceof AntTargetNodeDescriptor targetNodeDescriptor) { final Navigatable navigatable = targetNodeDescriptor.getTarget().getOpenFileDescriptor(); if (navigatable != null && navigatable.canNavigate()) { return navigatable; } } } } if (currentBuildFile != null && !myProject.isDisposed()) { final VirtualFile file = currentBuildFile.getVirtualFile(); if (file != null && file.isValid()) { return new OpenFileDescriptor(myProject, file); } } } return null; }
getSlowData
6,057
FileChooserDescriptor () { return new FileChooserDescriptor(true, false, false, false, false, true){ @Override public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) { boolean b = super.isFileVisible(file, showHiddenFiles); if (!file.isDirectory()) { b &= FileTypeRegistry.getInstance().isFileOfType(file, XmlFileType.INSTANCE); } return b; } }; }
createXmlDescriptor
6,058
boolean (VirtualFile file, boolean showHiddenFiles) { boolean b = super.isFileVisible(file, showHiddenFiles); if (!file.isDirectory()) { b &= FileTypeRegistry.getInstance().isFileOfType(file, XmlFileType.INSTANCE); } return b; }
isFileVisible
6,059
void (@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { final Object userObject = ((DefaultMutableTreeNode)value).getUserObject(); if (userObject instanceof AntNodeDescriptor descriptor) { descriptor.customize(this); } else { append(tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus), SimpleTextAttributes.REGULAR_ATTRIBUTES); } }
customizeCellRenderer
6,060
void (@NotNull AnActionEvent e) { addBuildFile(); }
actionPerformed
6,061
void (@NotNull AnActionEvent e) { removeSelectedBuildFiles(); }
actionPerformed
6,062
void (@NotNull AnActionEvent event) { event.getPresentation().setEnabled(getCurrentBuildFile() != null); }
update
6,063
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
6,064
void (@NotNull AnActionEvent e) { runSelection(e.getDataContext(), true); }
actionPerformed
6,065
void (@NotNull AnActionEvent event) { final Presentation presentation = event.getPresentation(); final String place = event.getPlace(); if (ActionPlaces.ANT_EXPLORER_TOOLBAR.equals(place)) { presentation.setText(AntBundle.messagePointer("run.ant.file.or.target.action.name")); } else { final TreePath[] paths = myTree.getSelectionPaths(); if (paths != null && paths.length == 1 && ((DefaultMutableTreeNode)paths[0].getLastPathComponent()).getUserObject() instanceof AntBuildFileNodeDescriptor) { presentation.setText(AntBundle.messagePointer("run.ant.build.action.name")); } else { if (paths == null || paths.length == 1) { presentation.setText(AntBundle.messagePointer("run.ant.target.action.name")); } else { presentation.setText(AntBundle.messagePointer("run.ant.targets.action.name")); } } } presentation.setEnabled(canRunSelection()); }
update
6,066
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
6,067
void (@NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setEnabled(myTree.getSelectionCount() == 1 && canRunSelection()); }
update
6,068
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
6,069
void (@NotNull AnActionEvent e) { final AntBuildFile buildFile = getCurrentBuildFile(); if (buildFile == null || !buildFile.exists()) { return; } TreePath selectionPath = myTree.getSelectionPath(); if (selectionPath == null) return; final DefaultMutableTreeNode node = (DefaultMutableTreeNode) selectionPath.getLastPathComponent(); final Object userObject = node.getUserObject(); AntBuildTarget target = null; if (userObject instanceof AntTargetNodeDescriptor targetNodeDescriptor) { target = targetNodeDescriptor.getTarget(); } else if (userObject instanceof AntBuildFileNodeDescriptor){ AntBuildModel model = ((AntBuildFileNodeDescriptor)userObject).getBuildFile().getModel(); target = model.findTarget(model.getDefaultTargetName()); } String name = target != null ? target.getDisplayName() : null; if (target == null || name == null) { return; } RunManager runManager = RunManager.getInstance(myProject); RunnerAndConfigurationSettings settings = runManager.createConfiguration(name, AntRunConfigurationType.class); AntRunConfiguration configuration = (AntRunConfiguration)settings.getConfiguration(); configuration.acceptSettings(target); if (RunDialog.editConfiguration(e.getProject(), settings, ExecutionBundle .message("create.run.configuration.for.item.dialog.title", configuration.getName()))) { runManager.addConfiguration(settings); runManager.setSelectedConfiguration(settings); } }
actionPerformed
6,070
boolean (@NotNull AnActionEvent event) { final Project project = myProject; return project != null && AntConfigurationBase.getInstance(project).isFilterTargets(); }
isSelected
6,071
void (@NotNull AnActionEvent event, boolean flag) { setTargetsFiltered(flag); }
setSelected
6,072
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
6,073
void (boolean value) { try { myTreeStructure.setFilteredTargets(value); AntConfigurationBase.getInstance(myProject).setFilterTargets(value); } finally { myTreeModel.invalidateAsync(); } }
setTargetsFiltered
6,074
boolean (@NotNull AnActionEvent e) { return myTarget.equals(AntConfigurationBase.getInstance(myProject).getTargetForEvent(myExecutionEvent)); }
isSelected
6,075
void (@NotNull AnActionEvent event, boolean state) { final AntConfigurationBase antConfiguration = AntConfigurationBase.getInstance(myProject); if (state) { final AntBuildFileBase buildFile = (AntBuildFileBase)((myTarget instanceof MetaTarget) ? ((MetaTarget)myTarget).getBuildFile() : myTarget.getModel().getBuildFile()); antConfiguration.setTargetForEvent(buildFile, myTarget.getName(), myExecutionEvent); } else { antConfiguration.clearTargetForEvent(myExecutionEvent); } myTreeModel.invalidateAsync(); }
setSelected
6,076
void (@NotNull AnActionEvent e) { super.update(e); final AntBuildFile buildFile = myTarget.getModel().getBuildFile(); e.getPresentation().setEnabled(buildFile != null && buildFile.exists()); }
update
6,077
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
6,078
void (@NotNull AnActionEvent e) { final AntExecuteBeforeRunDialog dialog = new AntExecuteBeforeRunDialog(myProject, myTarget); dialog.show(); }
actionPerformed
6,079
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled(myTarget.getModel().getBuildFile().exists()); }
update
6,080
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
6,081
void (@NotNull AnActionEvent e) { final AntBuildFile buildFile = getCurrentBuildFile(); if (buildFile != null) { final List<String> targets = getTargetNamesFromPaths(myTree.getSelectionPaths()); final ExecuteCompositeTargetEvent event = new ExecuteCompositeTargetEvent(targets); final SaveMetaTargetDialog dialog = new SaveMetaTargetDialog(myTree, event, AntConfigurationBase.getInstance(myProject), buildFile); dialog.setTitle(e.getPresentation().getText()); if (dialog.showAndGet()) { myTreeModel.invalidate(buildFile, true); } } }
actionPerformed
6,082
void (@NotNull AnActionEvent e) { final TreePath[] paths = myTree.getSelectionPaths(); e.getPresentation().setEnabled(paths != null && paths.length > 1 && canRunSelection()); }
update
6,083
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
6,084
void () { RemoveMetaTargetsOrBuildFileAction.this.unregisterCustomShortcutSet(myTree); }
dispose
6,085
void (ActionEvent e) { doAction(); }
actionPerformed
6,086
void (@NotNull AnActionEvent e) { doAction(); }
actionPerformed
6,087
void () { final TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) { return; } try { // try to remove build file if (paths.length == 1) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)paths[0].getLastPathComponent(); if (node.getUserObject() instanceof AntBuildFileNodeDescriptor descriptor) { if (descriptor.getBuildFile().equals(getCurrentBuildFile())) { removeBuildFile(); return; } } } // try to remove meta targets final AntBuildTarget[] targets = getTargetObjectsFromPaths(paths); final AntConfigurationBase antConfiguration = AntConfigurationBase.getInstance(myProject); for (final AntBuildTarget buildTarget : targets) { if (buildTarget instanceof MetaTarget) { for (final ExecutionEvent event : antConfiguration.getEventsForTarget(buildTarget)) { if (event instanceof ExecuteCompositeTargetEvent) { antConfiguration.clearTargetForEvent(event); } } } } } finally { myTreeModel.invalidateAsync(); } }
doAction
6,088
void (@NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); final TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) { presentation.setEnabled(false); return; } if (paths.length == 1) { String text = AntBundle.message("remove.meta.target.action.name"); boolean enabled = false; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)paths[0].getLastPathComponent(); if (node.getUserObject() instanceof AntBuildFileNodeDescriptor descriptor) { if (descriptor.getBuildFile().equals(getCurrentBuildFile())) { text = AntBundle.message("remove.selected.build.file.action.name"); enabled = true; } } else { if (node.getUserObject() instanceof AntTargetNodeDescriptor descr) { final AntBuildTargetBase target = descr.getTarget(); if (target instanceof MetaTarget) { enabled = true; } } } presentation.setText(text); presentation.setEnabled(enabled); } else { presentation.setText(AntBundle.messagePointer("remove.selected.meta.targets.action.name")); final AntBuildTarget[] targets = getTargetObjectsFromPaths(paths); boolean enabled = targets.length > 0; for (final AntBuildTarget buildTarget : targets) { if (!(buildTarget instanceof MetaTarget)) { enabled = false; break; } } presentation.setEnabled(enabled); } }
update
6,089
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
6,090
void (@NotNull AnActionEvent e) { new EditKeymapsDialog(myProject, myActionId).show(); }
actionPerformed
6,091
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled(myActionId != null && ActionManager.getInstance().getAction(myActionId) != null); }
update
6,092
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
6,093
boolean (final TransferSupport support) { if (canImport(support)) { addBuildFile(getAntFiles(support)); return true; } return false; }
importData
6,094
boolean (final TransferSupport support) { return FileCopyPasteUtil.isFileListFlavorAvailable(support.getDataFlavors()); }
canImport
6,095
VirtualFile[] (final TransferSupport support) { List<VirtualFile> virtualFileList = new ArrayList<>(); final List<File> fileList = FileCopyPasteUtil.getFileList(support.getTransferable()); if (fileList != null) { for (File file : fileList ) { ContainerUtil.addIfNotNull(virtualFileList, VfsUtil.findFileByIoFile(file, true)); } } return VfsUtilCore.toVirtualFileArray(virtualFileList); }
getAntFiles
6,096
void (@NotNull SimpleColoredComponent component) { component.append(toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES); }
customize
6,097
Key<AntBeforeRunTask> () { return AntBeforeRunTaskProvider.ID; }
getTaskId
6,098
boolean (AntBeforeRunTask task) { return task.isRunningTarget(myTarget); }
isRunning
6,099
void (@NotNull AntBeforeRunTask task) { VirtualFile f = myTarget.getModel().getBuildFile().getVirtualFile(); task.setAntFileUrl(f != null ? f.getUrl() : null); task.setTargetName(f != null ? myTarget.getName() : null); }
update