Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
8,400
|
int (@NotNull final Task task1, @NotNull final Task task2) { // N/A here throw new UnsupportedOperationException(); }
|
compare
|
8,401
|
Component (JList list, Object value, int index, boolean sel, boolean focus) { final JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(UIUtil.getListBackground(sel)); panel.setForeground(UIUtil.getListForeground(sel)); if (value instanceof TaskPsiElement) { final Task task = ((TaskPsiElement)value).getTask(); final SimpleColoredComponent c = new SimpleColoredComponent(); final TaskManager taskManager = TaskManager.getManager(myProject); final boolean isLocalTask = taskManager.findTask(task.getId()) != null; final boolean isClosed = task.isClosed() || (task instanceof LocalTask && taskManager.isLocallyClosed((LocalTask)task)); final Color bg = sel ? UIUtil.getListSelectionBackground(true) : isLocalTask ? UIUtil.getListBackground() : UIUtil.getDecoratedRowColor(); panel.setBackground(bg); SimpleTextAttributes attr = getAttributes(sel, isClosed); c.setIcon(isClosed ? IconLoader.getTransparentIcon(task.getIcon()) : task.getIcon()); SpeedSearchUtil.appendColoredFragmentForMatcher(task.getPresentableName(), c, attr, MatcherHolder.getAssociatedMatcher(list), bg, sel); panel.add(c, BorderLayout.CENTER); } else if ("...".equals(value)) { final SimpleColoredComponent c = new SimpleColoredComponent(); c.setIcon(EmptyIcon.ICON_16); c.append((String)value); panel.add(c, BorderLayout.CENTER); } else if (GotoTaskAction.CREATE_NEW_TASK_ACTION == value) { final SimpleColoredComponent c = new SimpleColoredComponent(); c.setIcon(LayeredIcon.create(AllIcons.FileTypes.Unknown, AllIcons.Actions.New)); c.append(GotoTaskAction.CREATE_NEW_TASK_ACTION.getActionText()); panel.add(c, BorderLayout.CENTER); } return panel; }
|
getListCellRendererComponent
|
8,402
|
SimpleTextAttributes (final boolean selected, final boolean taskClosed) { return new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, taskClosed ? UIUtil.getLabelDisabledForeground() : UIUtil.getListForeground(selected)); }
|
getAttributes
|
8,403
|
List<String> (@NotNull ChooseByNameViewModel base, String @NotNull [] names, @NotNull String pattern) { return ContainerUtil.emptyList(); }
|
filterNames
|
8,404
|
boolean (@NotNull ChooseByNameViewModel base, @NotNull final String pattern, final boolean everywhere, @NotNull final ProgressIndicator cancelled, @NotNull Processor<Object> consumer) { GotoTaskAction.CREATE_NEW_TASK_ACTION.setTaskName(pattern); if (!consumer.process(GotoTaskAction.CREATE_NEW_TASK_ACTION)) return false; TaskManager taskManager = TaskManager.getManager(myProject); List<Task> allCachedAndLocalTasks = ContainerUtil.concat(taskManager.getCachedIssues(), taskManager.getLocalTasks()); List<Task> filteredCachedAndLocalTasks = TaskSearchSupport.getLocalAndCachedTasks(taskManager, pattern, everywhere); if (!processTasks(filteredCachedAndLocalTasks, consumer, cancelled)) return false; if (filteredCachedAndLocalTasks.size() >= base.getMaximumListSizeLimit()) { return true; } if (myDisposed) { return false; } int delay = myFutureReference.get() == null && pattern.length() > 5 ? 0 : DELAY_PERIOD; Future<List<Task>> future = JobScheduler.getScheduler().schedule(() -> fetchFromServer(pattern, everywhere, cancelled), delay, TimeUnit.MILLISECONDS); // Newer request always wins Future<List<Task>> oldFuture = myFutureReference.getAndSet(future); if (oldFuture != null) { LOG.debug("Cancelling existing task"); oldFuture.cancel(true); } try { List<Task> tasks; while (true) { try { tasks = future.get(10, TimeUnit.MILLISECONDS); break; } catch (TimeoutException ignore) { } } myFutureReference.compareAndSet(future, null); // Exclude *all* cached and local issues, not only those returned by TaskSearchSupport.getLocalAndCachedTasks(). // Previously used approach might lead to the following strange behavior. Local task excluded by getLocalAndCachedTasks() // as "locally closed" (i.e. having no associated change list) was indeed *included* in popup because it // was contained in server response (as not remotely closed). Moreover on next request with pagination when the // same issues was not returned again by server it was *excluded* from popup (thus subsequent update reduced total // number of items shown). tasks.removeAll(allCachedAndLocalTasks); return processTasks(tasks, consumer, cancelled); } catch (InterruptedException interrupted) { Thread.interrupted(); } catch (CancellationException e) { LOG.debug("Task cancelled"); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof ProcessCanceledException) { LOG.debug("Task cancelled via progress indicator"); } ExceptionUtil.rethrow(cause); } return false; }
|
filterElements
|
8,405
|
List<Task> (String pattern, boolean everywhere, ProgressIndicator cancelled) { int offset, limit; // pattern changed -> reset pagination if (!myOldPattern.equals(pattern)) { myCurrentOffset = offset = 0; limit = GotoTaskAction.PAGE_SIZE; } // include closed tasks -> download all previous + closed, so no one is missing else if (myOldEverywhere != everywhere) { offset = 0; myCurrentOffset = limit = myCurrentOffset + GotoTaskAction.PAGE_SIZE; } // normal pagination step else { offset = myCurrentOffset; limit = GotoTaskAction.PAGE_SIZE; myCurrentOffset += GotoTaskAction.PAGE_SIZE; } List<Task> tasks = TaskSearchSupport.getRepositoriesTasks(myProject, pattern, offset, limit, true, everywhere, cancelled); myOldEverywhere = everywhere; myOldPattern = pattern; return tasks; }
|
fetchFromServer
|
8,406
|
boolean (List<Task> tasks, Processor<Object> consumer, ProgressIndicator cancelled) { PsiManager psiManager = PsiManager.getInstance(myProject); for (Task task : tasks) { cancelled.checkCanceled(); if (!consumer.process(new TaskPsiElement(psiManager, task))) return false; } return true; }
|
processTasks
|
8,407
|
void () { Future<List<Task>> future = myFutureReference.get(); if (future != null) { future.cancel(true); } myDisposed = true; }
|
dispose
|
8,408
|
void (@NotNull AnActionEvent event) { super.update(event); if (event.getPresentation().isEnabled()) { Project project = getProject(event); TaskManager manager = getTaskManager(event); Presentation presentation = event.getPresentation(); if (project == null || manager == null || !manager.isVcsEnabled() || !ChangeListManager.getInstance(project).areChangeListsEnabled()) { presentation.setTextWithMnemonic(getTemplatePresentation().getTextWithPossibleMnemonic()); presentation.setEnabled(false); } else { presentation.setEnabled(true); if (manager.getActiveTask().getChangeLists().size() == 0) { presentation.setText(TaskBundle.message("action.create.changelist.for.text", TaskUtil.getTrimmedSummary(manager.getActiveTask()))); } else { presentation.setText(TaskBundle.message("action.add.changelist.for.text", TaskUtil.getTrimmedSummary(manager.getActiveTask()))); } } } }
|
update
|
8,409
|
void (@NotNull AnActionEvent e) { TaskManagerImpl manager = (TaskManagerImpl)getTaskManager(e); assert manager != null; LocalTask activeTask = manager.getActiveTask(); String name = Messages.showInputDialog(getProject(e), TaskBundle.message("dialog.message.changelist.name"), TaskBundle.message("dialog.title.create.changelist"), null, manager.getChangelistName(activeTask), null); if (name != null) { manager.createChangeList(activeTask, name); } }
|
actionPerformed
|
8,410
|
List<Task> (final TaskManager myManager, String pattern, final boolean withClosed) { List<Task> tasks = new ArrayList<>(); tasks.addAll(myManager.getLocalTasks(withClosed)); tasks.addAll(ContainerUtil.filter(myManager.getCachedIssues(withClosed), task -> myManager.findTask(task.getId()) == null)); List<Task> filteredTasks = ContainerUtil.sorted(filterTasks(pattern, tasks), TaskManagerImpl.TASK_UPDATE_COMPARATOR); return filteredTasks; }
|
getLocalAndCachedTasks
|
8,411
|
List<Task> (Project project, String pattern, int offset, int limit, boolean forceRequest, final boolean withClosed, @NotNull final ProgressIndicator cancelled) { try { TaskManager manager = TaskManager.getManager(project); List<Task> tasks = manager.getIssues(pattern, offset, limit, withClosed, cancelled, forceRequest); ContainerUtil.sort(tasks, TaskManagerImpl.TASK_UPDATE_COMPARATOR); return tasks; } catch (RequestFailedException e) { notifyAboutConnectionFailure(e, project); return Collections.emptyList(); } }
|
getRepositoriesTasks
|
8,412
|
List<Task> (final TaskManager myManager, String pattern, boolean cached, boolean autopopup) { return filterTasks(pattern, getTasks(pattern, cached, autopopup, myManager)); }
|
getItems
|
8,413
|
List<Task> (String pattern, boolean cached, boolean autopopup, final TaskManager myManager) { return cached ? myManager.getCachedIssues() : myManager.getIssues(pattern, !autopopup); }
|
getTasks
|
8,414
|
void (RequestFailedException e, Project project) { String details = e.getMessage(); TaskRepository repository = e.getRepository(); String content = TaskBundle.message("notification.content.p.href.configure.server.p"); if (!StringUtil.isEmpty(details)) { content = "<p>" + details + "</p>" + content; //NON-NLS } new Notification(TASKS_NOTIFICATION_GROUP, TaskBundle.message("notification.title.cannot.connect.to", repository.getUrl()), content, NotificationType.WARNING) .setListener((notification, event) -> { TaskRepositoriesConfigurable configurable = new TaskRepositoriesConfigurable(project); ShowSettingsUtil.getInstance().editConfigurable(project, configurable); if (!ArrayUtil.contains(repository, TaskManager.getManager(project).getAllRepositories())) { notification.expire(); } }) .notify(project); }
|
notifyAboutConnectionFailure
|
8,415
|
void (ActionEvent e) { final boolean selected = myUpdateState.isSelected(); PropertiesComponent.getInstance(project).setValue(UPDATE_STATE_ENABLED, String.valueOf(selected)); updateFields(); if (selected) { myTaskStateCombo.scheduleUpdateOnce(); } }
|
actionPerformed
|
8,416
|
void (@NotNull DocumentEvent e) { LocalTaskImpl oldTask = new LocalTaskImpl(myTask); myTask.setSummary(myNameField.getText()); for (TaskDialogPanel panel : myPanels) { panel.taskNameChanged(oldTask, myTask); } }
|
textChanged
|
8,417
|
void () { myTaskStateCombo.setEnabled(myUpdateState.isSelected()); }
|
updateFields
|
8,418
|
void () { createTask(); super.doOKAction(); }
|
doOKAction
|
8,419
|
void () { final TaskManagerImpl taskManager = (TaskManagerImpl)TaskManager.getManager(myProject); if (myUpdateState.isSelected()) { final CustomTaskState taskState = myTaskStateCombo.getSelectedState(); final TaskRepository repository = myTask.getRepository(); if (repository != null && taskState != null) { try { repository.setTaskState(myTask, taskState); repository.setPreferredOpenTaskState(taskState); } catch (Exception ex) { Messages.showErrorDialog(myProject, ex.getMessage(), TaskBundle.message("dialog.title.cannot.set.state.for.issue")); LOG.warn(ex); } } } for (TaskDialogPanel panel : myPanels) { panel.commit(); } if (myTask.getRepository() != null) { TaskManagementUsageCollector.logOpenRemoteTask(myProject, myTask); } else { TaskManagementUsageCollector.logCreateLocalTaskManually(myProject); } taskManager.activateTask(myTask, isClearContext(), true); if (myTask.getType() == TaskType.EXCEPTION && AnalyzeTaskStacktraceAction.hasTexts(myTask)) { AnalyzeTaskStacktraceAction.analyzeStacktrace(myTask, myProject); } }
|
createTask
|
8,420
|
boolean () { return myClearContext.isSelected(); }
|
isClearContext
|
8,421
|
String () { return "SimpleOpenTaskDialog"; }
|
getDimensionServiceKey
|
8,422
|
JComponent () { if (myNameField.getText().trim().isEmpty()) { return myNameField; } for (TaskDialogPanel panel : myPanels) { final JComponent component = panel.getPreferredFocusedComponent(); if (component != null) { return component; } } if (myTaskStateCombo.isVisible() && myTaskStateCombo.isEnabled()){ return myTaskStateCombo.getComboBox(); } return null; }
|
getPreferredFocusedComponent
|
8,423
|
ValidationInfo () { String taskName = myNameField.getText().trim(); if (taskName.isEmpty()) { return new ValidationInfo(TaskBundle.message("dialog.message.task.name.should.not.be.empty"), myNameField); } for (TaskDialogPanel panel : myPanels) { ValidationInfo validate = panel.validate(); if (validate != null) return validate; } return null; }
|
doValidate
|
8,424
|
JComponent () { return myPanel; }
|
createCenterPanel
|
8,425
|
void () { myTaskStateCombo = new TaskStateCombo() { @Nullable @Override protected CustomTaskState getPreferredState(@NotNull TaskRepository repository, @NotNull Collection<CustomTaskState> available) { return repository.getPreferredOpenTaskState(); } }; }
|
createUIComponents
|
8,426
|
CustomTaskState (@NotNull TaskRepository repository, @NotNull Collection<CustomTaskState> available) { return repository.getPreferredOpenTaskState(); }
|
getPreferredState
|
8,427
|
void (@NotNull AnActionEvent event) { super.update(event); if (event.getPresentation().isEnabled()) { final Presentation presentation = event.getPresentation(); final LocalTask activeTask = getActiveTask(event); presentation.setEnabled(activeTask != null && activeTask.isIssue() && activeTask.getDescription() != null); if (activeTask == null || !activeTask.isIssue()) { presentation.setTextWithMnemonic(getTemplatePresentation().getTextWithPossibleMnemonic()); } else { presentation.setText(TaskBundle.message("action.show.description.text", StringUtil.escapeMnemonics(activeTask.getPresentableName()))); } } }
|
update
|
8,428
|
void (@NotNull AnActionEvent e) { final Project project = getProject(e); assert project != null; final LocalTask task = getActiveTask(e); FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.quickjavadoc.ctrln"); CommandProcessor.getInstance().executeCommand(project, () -> DocumentationManager.getInstance(project).showJavaDocInfo(new TaskPsiElement(PsiManager.getInstance(project), task), null), getCommandName(), null); }
|
actionPerformed
|
8,429
|
void (@NotNull final AnActionEvent e) { try { CertificateManager manager = CertificateManager.getInstance(); List<X509Certificate> certificates = manager.getCustomTrustManager().getCertificates(); if (certificates.isEmpty()) { Messages.showInfoMessage(String.format("Key store '%s' is empty", manager.getCacertsPath()), "No Certificates Available"); } else { CertificateWarningDialog dialog = CertificateWarningDialog.createUntrustedCertificateWarning(certificates.get(0)); LOG.debug("Accepted: " + dialog.showAndGet()); } } catch (Exception logged) { LOG.error(logged); } }
|
actionPerformed
|
8,430
|
ActionUpdateThread () { return ActionUpdateThread.BGT; }
|
getActionUpdateThread
|
8,431
|
void (@NotNull AnActionEvent e) { Project project = e.getProject(); assert project != null; TaskManagerImpl taskManager = (TaskManagerImpl)TaskManager.getManager(project); LocalTask task = taskManager.getActiveTask(); CloseTaskDialog dialog = new CloseTaskDialog(project, task); if (dialog.showAndGet()) { ((LocalTaskImpl)task).setClosed(true); final CustomTaskState taskState = dialog.getCloseIssueState(); if (taskState != null) { try { TaskRepository repository = task.getRepository(); assert repository != null; repository.setTaskState(task, taskState); repository.setPreferredCloseTaskState(taskState); } catch (Exception e1) { Messages.showErrorDialog(project, e1.getMessage(), TaskBundle.message("dialog.title.cannot.set.state.for.issue")); } } } }
|
actionPerformed
|
8,432
|
void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); Project project = getProject(event); boolean enabled = project != null && !TaskManager.getManager(project).getActiveTask().isDefault(); presentation.setEnabled(enabled); }
|
update
|
8,433
|
void (@NotNull AnActionEvent e) { Project project = getEventProject(e); if (project != null) { LocalTaskImpl task = (LocalTaskImpl)TaskManager.getManager(project).getActiveTask(); new EditTaskDialog(project, task).show(); } }
|
actionPerformed
|
8,434
|
void (@NotNull AnActionEvent event) { super.update(event); Presentation presentation = event.getPresentation(); Project project = getEventProject(event); if (project != null && presentation.isEnabled()) { presentation.setText(TaskBundle.message("action.edit.text", TaskManager.getManager(project).getActiveTask().getPresentableName()), false); } }
|
update
|
8,435
|
void (@NotNull AnActionEvent e) { String url = getIssueUrl(e); if (url != null) { BrowserUtil.browse(url); } }
|
actionPerformed
|
8,436
|
void (@NotNull AnActionEvent event) { super.update(event); if (event.getPresentation().isEnabled()) { Presentation presentation = event.getPresentation(); String url = getIssueUrl(event); presentation.setEnabled(url != null); Project project = getProject(event); if (project == null || !TaskManager.getManager(project).getActiveTask().isIssue()) { presentation.setTextWithMnemonic(getTemplatePresentation().getTextWithPossibleMnemonic()); } else { presentation.setText(TaskBundle.message("action.open.in.browser.text", StringUtil.escapeMnemonics(TaskManager.getManager(project).getActiveTask().getPresentableName()))); } } }
|
update
|
8,437
|
String (AnActionEvent event) { Project project = event.getProject(); return project == null ? null : TaskManager.getManager(project).getActiveTask().getIssueUrl(); }
|
getIssueUrl
|
8,438
|
Icon () { return myIcon; }
|
getIcon
|
8,439
|
LocalTask () { return myTask; }
|
getTask
|
8,440
|
boolean () { return myTemp; }
|
isTemp
|
8,441
|
JComponent () { return myPanel; }
|
getPanel
|
8,442
|
void () { if (myCommitChanges.isEnabled()) { myTaskManager.getState().commitChanges = isCommitChanges(); } if (myMergeBranches.isEnabled()) { myTaskManager.getState().mergeBranch = isMergeBranch(); } if (isCommitChanges()) { ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); for (ChangeListInfo info : myTask.getChangeLists()) { LocalChangeList list = changeListManager.getChangeList(info.id); if (list != null) { changeListManager.commitChanges(list, new ArrayList<>(list.getChanges())); } } } if (isMergeBranch()) { myTaskManager.mergeBranch(myTask); } }
|
commit
|
8,443
|
TaskDialogPanel (@NotNull Project project, @NotNull LocalTask task) { return TaskManager.getManager(project).isVcsEnabled() ? new VcsOpenTaskPanel(project, task) : null; }
|
getOpenTaskPanel
|
8,444
|
TaskDialogPanel (@NotNull Project project, @NotNull LocalTask task) { return TaskManager.getManager(project).isVcsEnabled() ? new VcsCloseTaskPanel(project, task) : null; }
|
getCloseTaskPanel
|
8,445
|
void (ActionEvent e) { updateFields(false); }
|
actionPerformed
|
8,446
|
void (ActionEvent e) { if (myCreateBranch.isSelected()) myUseBranch.setSelected(false); updateFields(false); }
|
actionPerformed
|
8,447
|
void (ActionEvent e) { if (myUseBranch.isSelected()) myCreateBranch.setSelected(false); updateFields(false); }
|
actionPerformed
|
8,448
|
void (ActionEvent e) { VcsTaskHandler.TaskInfo item = (VcsTaskHandler.TaskInfo)myBranchFrom.getSelectedItem(); if (item != null) { PropertiesComponent.getInstance(project).setValue(START_FROM_BRANCH, item.getName()); } }
|
actionPerformed
|
8,449
|
String (Task task) { return myTaskManager.getChangelistName(task); }
|
getChangelistName
|
8,450
|
String (Task task) { String branchName = myTaskManager.suggestBranchName(task, StringUtil.notNullize(TaskSettings.getInstance().REPLACE_SPACES)); if (myVcsTaskHandler != null) myVcsTaskHandler.cleanUpBranchName(branchName); return TaskSettings.getInstance().LOWER_CASE_BRANCH ? StringUtil.toLowerCase(branchName) : branchName; }
|
getBranchName
|
8,451
|
void (boolean initial) { if (!initial && myBranchFrom.getItemCount() == 0 && myCreateBranch.isSelected()) { Messages.showWarningDialog(myPanel, TaskBundle.message("dialog.message.can.t.create.branch.if.no.commit.exists.create.commit.first"), TaskBundle.message("dialog.title.cannot.create.branch")); myCreateBranch.setSelected(false); } myBranchName.setEnabled(myCreateBranch.isSelected()); myFromLabel.setEnabled(myCreateBranch.isSelected()); myBranchFrom.setEnabled(myCreateBranch.isSelected()); myUseBranchCombo.setEnabled(myUseBranch.isSelected()); myChangelistName.setEnabled(myCreateChangelist.isSelected()); }
|
updateFields
|
8,452
|
JComponent () { return myPanel; }
|
getPanel
|
8,453
|
void () { myTaskManager.getState().createChangelist = myCreateChangelist.isSelected(); myTaskManager.getState().shelveChanges = myShelveChanges.isSelected(); myTaskManager.getState().createBranch = myCreateBranch.isSelected(); myTaskManager.getState().useBranch = myUseBranch.isSelected(); if (myShelveChanges.isSelected()) { myTaskManager.shelveChanges(myPreviousTask, myPreviousTask.getSummary()); } if (myCreateChangelist.isSelected()) { myTaskManager.createChangeList(myTask, myChangelistName.getText()); } else { ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); String comment = TaskUtil.getChangeListComment(myTask); changeListManager.editComment(changeListManager.getDefaultListName(), comment); } if (myCreateBranch.isSelected()) { VcsTaskHandler.TaskInfo branchFrom = (VcsTaskHandler.TaskInfo)myBranchFrom.getSelectedItem(); Runnable createBranch = () -> myTaskManager.createBranch(myTask, myPreviousTask, myBranchName.getText(), branchFrom); VcsTaskHandler.TaskInfo[] current = myVcsTaskHandler.getCurrentTasks(); if (branchFrom != null && (current.length == 0 || !current[0].equals(branchFrom))) { myVcsTaskHandler.switchToTask(branchFrom, createBranch); } else { createBranch.run(); } } if (myUseBranch.isSelected()) { VcsTaskHandler.TaskInfo branch = (VcsTaskHandler.TaskInfo)myUseBranchCombo.getSelectedItem(); if (branch != null) { VcsTaskHandler.TaskInfo[] tasks = myVcsTaskHandler.getCurrentTasks(); TaskManagerImpl.addBranches(myPreviousTask, tasks, true); myVcsTaskHandler.switchToTask(branch, () -> TaskManagerImpl.addBranches(myTask, new VcsTaskHandler.TaskInfo[]{branch}, false)); } } }
|
commit
|
8,454
|
ValidationInfo () { if (myCreateBranch.isSelected()) { String branchName = myBranchName.getText().trim(); if (branchName.isEmpty()) { return new ValidationInfo(TaskBundle.message("dialog.message.branch.name.should.not.be.empty"), myBranchName); } else if (myVcsTaskHandler != null) { return myVcsTaskHandler.isBranchNameValid(branchName) ? null : new ValidationInfo(TaskBundle.message("dialog.message.branch.name.not.valid.check.your.vcs.branch.name.restrictions"), myBranchName); } else if (branchName.contains(" ")) { return new ValidationInfo(TaskBundle.message("dialog.message.branch.name.should.not.contain.spaces"), myBranchName); } else { return null; } } if (myCreateChangelist.isSelected()) { if (myChangelistName.getText().trim().isEmpty()) { return new ValidationInfo(TaskBundle.message("dialog.message.changelist.name.should.not.be.empty"), myChangelistName); } } return null; }
|
validate
|
8,455
|
JComponent () { if (myCreateBranch.isSelected()) { return myBranchName; } else if (myUseBranch.isSelected()) { return myUseBranchCombo; } else if (myCreateChangelist.isSelected()) { return myChangelistName; } return null; }
|
getPreferredFocusedComponent
|
8,456
|
void (Task oldTask, Task newTask) { if (getBranchName(oldTask).equals(myBranchName.getText())) { myBranchName.setText(getBranchName(newTask)); } if (getChangelistName(oldTask).equals(myChangelistName.getText())) { myChangelistName.setText(getChangelistName(newTask)); } }
|
taskNameChanged
|
8,457
|
void (@NotNull AnActionEvent e) { final Project project = getProject(e); assert project != null; DefaultActionGroup group = new DefaultActionGroup(); final WorkingContextManager manager = WorkingContextManager.getInstance(project); List<ContextInfo> history = manager.getContextHistory(); List<ContextHolder> infos = new ArrayList<>(ContainerUtil.map(history, info -> new ContextHolder() { @Override void load(final boolean clear) { LoadContextUndoableAction undoableAction = LoadContextUndoableAction.createAction(manager, clear, info.name); UndoableCommand.execute(project, undoableAction, TaskBundle.message("command.name.load.context", info.comment), "Context"); } @Override void remove() { manager.removeContext(info.name); } @Override Date getDate() { return new Date(info.date); } @Override String getComment() { return info.comment; } @Override Icon getIcon() { return TasksCoreIcons.SavedContext; } })); final TaskManager taskManager = TaskManager.getManager(project); List<LocalTask> tasks = taskManager.getLocalTasks(); infos.addAll(ContainerUtil.mapNotNull(tasks, (NullableFunction<LocalTask, ContextHolder>)task -> { if (task.isActive()) { return null; } return new ContextHolder() { @Override void load(boolean clear) { LoadContextUndoableAction undoableAction = LoadContextUndoableAction.createAction(manager, clear, task); UndoableCommand.execute(project, undoableAction, TaskBundle.message("command.name.load.context", TaskUtil.getTrimmedSummary(task)), "Context"); } @Override void remove() { SwitchTaskAction.removeTask(project, task, taskManager); } @Override Date getDate() { return task.getUpdated(); } @Override String getComment() { return TaskUtil.getTrimmedSummary(task); } @Override Icon getIcon() { return task.getIcon(); } }; })); infos.sort((o1, o2) -> o2.getDate().compareTo(o1.getDate())); final Ref<Boolean> shiftPressed = Ref.create(false); boolean today = true; Calendar now = Calendar.getInstance(); for (final ContextHolder info : infos) { Calendar calendar = Calendar.getInstance(); calendar.setTime(info.getDate()); if (today && (calendar.get(Calendar.YEAR) != now.get(Calendar.YEAR) || calendar.get(Calendar.DAY_OF_YEAR) != now.get(Calendar.DAY_OF_YEAR))) { group.addSeparator(); today = false; } group.add(createItem(info, shiftPressed)); } ListPopup popup = JBPopupFactory.getInstance() .createActionGroupPopup(TaskBundle.message("popup.title.load.context"), group, e.getDataContext(), false, null, MAX_ROW_COUNT); var popupImpl = (popup instanceof ListPopupImpl) ? (ListPopupImpl)popup : null; if (popupImpl != null) { //todo: RDCT-627 popupImpl.setAdText(TaskBundle.message("popup.advertisement.press.shift.to.merge.with.current.context")); popupImpl.registerAction("shiftPressed", KeyStroke.getKeyStroke("shift pressed SHIFT"), new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { shiftPressed.set(true); popup.setCaption(TaskBundle.message("popup.title.merge.with.current.context")); } }); popupImpl.registerAction("shiftReleased", KeyStroke.getKeyStroke("released SHIFT"), new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { shiftPressed.set(false); popup.setCaption(TaskBundle.message("popup.title.load.context")); } }); popupImpl.registerAction("invoke", KeyStroke.getKeyStroke("shift ENTER"), new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { popup.handleSelect(true); } }); } popup.showCenteredInCurrentWindow(project); }
|
actionPerformed
|
8,458
|
void (ActionEvent e) { shiftPressed.set(true); popup.setCaption(TaskBundle.message("popup.title.merge.with.current.context")); }
|
actionPerformed
|
8,459
|
void (ActionEvent e) { shiftPressed.set(false); popup.setCaption(TaskBundle.message("popup.title.load.context")); }
|
actionPerformed
|
8,460
|
void (ActionEvent e) { popup.handleSelect(true); }
|
actionPerformed
|
8,461
|
ActionGroup (final ContextHolder holder, final Ref<Boolean> shiftPressed) { String text = DateFormatUtil.formatPrettyDateTime(holder.getDate()); String comment = holder.getComment(); if (!StringUtil.isEmpty(comment)) { text = comment + " (" + text + ")"; } final AnAction loadAction = new AnAction(TaskBundle.messagePointer("action.LoadContextAction.Anonymous.text.load")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { holder.load(!shiftPressed.get()); } }; ActionGroup contextGroup = new ActionGroup(text, text, holder.getIcon()) { @Override public void actionPerformed(@NotNull AnActionEvent e) { loadAction.actionPerformed(e); } @Override public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) { return new AnAction[]{loadAction, new AnAction(TaskBundle.messagePointer("action.LoadContextAction.Anonymous.text.remove")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { holder.remove(); } }}; } }; contextGroup.setPopup(true); contextGroup.getTemplatePresentation().setPerformGroup(true); return contextGroup; }
|
createItem
|
8,462
|
void (@NotNull AnActionEvent e) { holder.load(!shiftPressed.get()); }
|
actionPerformed
|
8,463
|
void (@NotNull AnActionEvent e) { loadAction.actionPerformed(e); }
|
actionPerformed
|
8,464
|
void (@NotNull AnActionEvent e) { holder.remove(); }
|
actionPerformed
|
8,465
|
void (final Project project, final UndoableAction action, @NlsContexts.Command String name, String groupId) { CommandProcessor.getInstance().executeCommand(project, () -> { try { action.redo(); } catch (UnexpectedUndoException e) { throw new RuntimeException(e); } UndoManager.getInstance(project).undoableActionPerformed(action); }, name, groupId); }
|
execute
|
8,466
|
void (@NotNull AnActionEvent e) { Project project = getProject(e); saveContext(project); }
|
actionPerformed
|
8,467
|
void (Project project) { String initial = null; Editor textEditor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (textEditor != null) { PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(textEditor.getDocument()); if (file != null) { initial = file.getName(); } } String comment = Messages.showInputDialog(project, TaskBundle.message("task.save.context.action.message"), TaskBundle.message("task.save.context.action.name"), null, initial, null); if (comment != null) { WorkingContextManager.getInstance(project).saveContext(null, StringUtil.isEmpty(comment) ? null : comment); } }
|
saveContext
|
8,468
|
void (@NotNull final AnActionEvent e) { final Project project = getProject(e); GlobalUndoableAction action = new GlobalUndoableAction() { @Override public void undo() throws UnexpectedUndoException { } @Override public void redo() throws UnexpectedUndoException { WorkingContextManager.getInstance(project).clearContext(); } }; UndoableCommand.execute(project, action, TaskBundle.message("task.clear.context.action.name"), "Context"); }
|
actionPerformed
|
8,469
|
String () { return "Trello"; }
|
getName
|
8,470
|
Icon () { return TasksCoreIcons.Trello; }
|
getIcon
|
8,471
|
String () { return TaskBundle.message("html.a.href.0.where.can.i.get.authorization.token.a.html", CLIENT_AUTHORIZATION_URL); }
|
getAdvertiser
|
8,472
|
TaskRepositoryEditor (TrelloRepository repository, Project project, Consumer<? super TrelloRepository> changeListener) { return new TrelloRepositoryEditor(project, repository, changeListener); }
|
createEditor
|
8,473
|
TaskRepository () { return new TrelloRepository(this); }
|
createRepository
|
8,474
|
Class<TrelloRepository> () { return TrelloRepository.class; }
|
getRepositoryClass
|
8,475
|
String () { return "-- from all boards --"; }
|
getName
|
8,476
|
String () { return "-- from all lists --"; }
|
getName
|
8,477
|
boolean (Object o) { if (!super.equals(o)) return false; if (o.getClass() != getClass()) return false; final TrelloRepository repository = (TrelloRepository)o; if (!Comparing.equal(myCurrentUser, repository.myCurrentUser)) return false; if (!Comparing.equal(myCurrentBoard, repository.myCurrentBoard)) return false; if (!Comparing.equal(myCurrentList, repository.myCurrentList)) return false; return myIncludeAllCards == repository.myIncludeAllCards; }
|
equals
|
8,478
|
BaseRepository () { return new TrelloRepository(this); }
|
clone
|
8,479
|
TrelloUser () { return myCurrentUser; }
|
getCurrentUser
|
8,480
|
void (TrelloUser currentUser) { myCurrentUser = currentUser; }
|
setCurrentUser
|
8,481
|
TrelloBoard () { return myCurrentBoard; }
|
getCurrentBoard
|
8,482
|
void (@Nullable TrelloBoard board) { myCurrentBoard = board != null && board.getId().equals(UNSPECIFIED_BOARD.getId()) ? UNSPECIFIED_BOARD : board; }
|
setCurrentBoard
|
8,483
|
TrelloList () { return myCurrentList; }
|
getCurrentList
|
8,484
|
void (@Nullable TrelloList list) { myCurrentList = list != null && list.getId().equals(UNSPECIFIED_LIST.getId()) ? UNSPECIFIED_LIST : list; }
|
setCurrentList
|
8,485
|
String (@NotNull String taskName) { return TrelloUtil.TRELLO_ID_PATTERN.matcher(taskName).matches() ? taskName : null; }
|
extractId
|
8,486
|
String () { String pseudoUrl = "trello.com"; if (myCurrentBoard != null && myCurrentBoard != UNSPECIFIED_BOARD) { pseudoUrl += "/" + myCurrentBoard.getName(); } if (myCurrentList != null && myCurrentList != UNSPECIFIED_LIST) { pseudoUrl += "/" + myCurrentList.getName(); } return pseudoUrl; }
|
getPresentableName
|
8,487
|
boolean () { return myIncludeAllCards; }
|
isIncludeAllCards
|
8,488
|
void (boolean includeAllCards) { myIncludeAllCards = includeAllCards; }
|
setIncludeAllCards
|
8,489
|
CancellableConnection () { return new HttpTestConnection(new HttpGet(getRestApiUrl("members", "me", "cards") + "?limit=1")); }
|
createCancellableConnection
|
8,490
|
HttpRequestInterceptor () { return new HttpRequestInterceptor() { @Override public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { // pass if (request instanceof HttpRequestWrapper wrapper) { try { wrapper.setURI(new URIBuilder(wrapper.getURI()) .addParameter("token", myPassword) .addParameter("key", TrelloRepositoryType.DEVELOPER_KEY) .build()); } catch (URISyntaxException e) { LOG.error("Illegal URL: " + wrapper.getURI(), e); } } else { LOG.error("Cannot add required authentication query parameters to request: " + request); } } }; }
|
createRequestInterceptor
|
8,491
|
boolean () { return super.isConfigured() && StringUtil.isNotEmpty(myPassword); }
|
isConfigured
|
8,492
|
String () { return "/1"; }
|
getRestApiPathPrefix
|
8,493
|
String () { return "https://api.trello.com"; }
|
getUrl
|
8,494
|
int () { return super.getFeatures() & ~NATIVE_SEARCH | STATE_UPDATING; }
|
getFeatures
|
8,495
|
void (@NotNull DocumentEvent e) { final String password = String.valueOf(myPasswordText.getPassword()); if (password.isEmpty() || password.equals(myRepository.getPassword())) { return; } myRepository.setPassword(password); new BoardsComboBoxUpdater() { @Override @NotNull protected List<TrelloBoard> fetch(@NotNull ProgressIndicator indicator) throws Exception { myRepository.setCurrentUser(myRepository.fetchUserByToken()); return super.fetch(indicator); } }.queue(); doApply(); }
|
textChanged
|
8,496
|
void (ItemEvent e) { final TrelloBoard board = (TrelloBoard)e.getItem(); if (e.getStateChange() == ItemEvent.DESELECTED || board.equals(myRepository.getCurrentBoard())) { return; } if (board != TrelloRepository.UNSPECIFIED_BOARD) { myRepository.setCurrentBoard(board); new ListsComboBoxUpdater() { @Nullable @Override public TrelloList getSelectedItem() { return TrelloRepository.UNSPECIFIED_LIST; } }.queue(); } else { myRepository.setCurrentBoard(null); // will not fire selection event myListComboBox.removeAllItems(); myRepository.setCurrentList(null); } doApply(); }
|
itemStateChanged
|
8,497
|
TrelloList () { return TrelloRepository.UNSPECIFIED_LIST; }
|
getSelectedItem
|
8,498
|
void (ItemEvent e) { // only selection event is considered if (e.getStateChange() == ItemEvent.SELECTED) { final TrelloList list = (TrelloList)e.getItem(); myRepository.setCurrentList(list); doApply(); } }
|
itemStateChanged
|
8,499
|
void () { if (myRepository.getCurrentUser() != null) { new BoardsComboBoxUpdater() { @Override @NotNull protected List<TrelloBoard> fetch(@NotNull ProgressIndicator indicator) throws Exception { final List<TrelloBoard> boards = super.fetch(indicator); TrelloBoard currentBoard = getSelectedItem(); if (currentBoard != null && currentBoard != TrelloRepository.UNSPECIFIED_BOARD) { final int i = boards.indexOf(currentBoard); // update information about selected board // if it's open and thus downloaded with other boards of user, take info from there, // otherwise issue a separate request currentBoard = i >= 0 ? boards.get(i) : myRepository.fetchBoardById(currentBoard.getId()); myRepository.setCurrentBoard(currentBoard); } return boards; } }.queue(); } if (myRepository.getCurrentBoard() != null && myRepository.getCurrentBoard() != TrelloRepository.UNSPECIFIED_BOARD) { new ListsComboBoxUpdater() { @Override @NotNull protected List<TrelloList> fetch(@NotNull ProgressIndicator indicator) throws Exception { final List<TrelloList> lists = super.fetch(indicator); TrelloList currentList = myRepository.getCurrentList(); if (currentList != null && currentList != TrelloRepository.UNSPECIFIED_LIST) { final int i = lists.indexOf(currentList); currentList = i >= 0 ? lists.get(i) : myRepository.fetchListById(currentList.getId()); final TrelloBoard currentBoard = myRepository.getCurrentBoard(); if (currentBoard != null && !currentList.getIdBoard().equals(currentBoard.getId())) { currentList.setMoved(true); } myRepository.setCurrentList(currentList); } return lists; } }.queue(); } }
|
initialize
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.