com.intellij.util.text.DateFormatUtil Java Examples

The following examples show how to use com.intellij.util.text.DateFormatUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DateFilterPopupComponent.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
protected String getText(@Nonnull VcsLogDateFilter filter) {
  Date after = filter.getAfter();
  Date before = filter.getBefore();
  if (after != null && before != null) {
    return DateFormatUtil.formatDate(after) + "-" + DateFormatUtil.formatDate(before);
  }
  else if (after != null) {
    return "Since " + DateFormatUtil.formatDate(after);
  }
  else if (before != null) {
    return "Until " + DateFormatUtil.formatDate(before);
  }
  else {
    return ALL;
  }
}
 
Example #2
Source File: CurrentDateMacro.java    From consulo with Apache License 2.0 6 votes vote down vote up
static String formatUserDefined(Expression[] params, ExpressionContext context, boolean date) {
  long time = Clock.getTime();
  if (params.length == 1) {
    Result format = params[0].calculateResult(context);
    if (format != null) {
      String pattern = format.toString();
      try {
        return new SimpleDateFormat(pattern).format(new Date(time));
      }
      catch (Exception e) {
        return "Problem when formatting date/time for pattern \"" + pattern + "\": " + e.getMessage();
      }
    }
  }
  return date ? DateFormatUtil.formatDate(time) : DateFormatUtil.formatTime(time);
}
 
Example #3
Source File: DateFilterPopupComponent.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  final DateFilterComponent dateComponent = new DateFilterComponent(false, DateFormatUtil.getDateFormat().getDelegate());
  VcsLogDateFilter currentFilter = myFilterModel.getFilter();
  if (currentFilter != null) {
    if (currentFilter.getBefore() != null) {
      dateComponent.setBefore(currentFilter.getBefore().getTime());
    }
    if (currentFilter.getAfter() != null) {
      dateComponent.setAfter(currentFilter.getAfter().getTime());
    }
  }

  DialogBuilder db = new DialogBuilder(DateFilterPopupComponent.this);
  db.addOkAction();
  db.setCenterPanel(dateComponent.getPanel());
  db.setPreferredFocusComponent(dateComponent.getPanel());
  db.setTitle("Select Period");
  if (DialogWrapper.OK_EXIT_CODE == db.show()) {
    long after = dateComponent.getAfter();
    long before = dateComponent.getBefore();
    VcsLogDateFilter filter = new VcsLogDateFilterImpl(after > 0 ? new Date(after) : null, before > 0 ? new Date(before) : null);
    myFilterModel.setFilter(filter);
  }
}
 
Example #4
Source File: AnnotateStackTraceAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@CalledInAwt
public void updateData(@Nonnull Map<Integer, LastRevision> revisions) {
  myRevisions = revisions;

  Date newestDate = null;
  int maxDateLength = 0;

  for (LastRevision revision : myRevisions.values()) {
    Date date = revision.getDate();
    if (newestDate == null || date.after(newestDate)) {
      newestDate = date;
    }
    int length = DateFormatUtil.formatPrettyDate(date).length();
    if (length > maxDateLength) {
      maxDateLength = length;
    }
  }

  myNewestDate = newestDate;
  myMaxDateLength = maxDateLength;
}
 
Example #5
Source File: FileHistoryPanelImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static String getPresentableText(@Nonnull VcsFileRevision revision, boolean withMessage) {
  // implementation reflected by com.intellij.vcs.log.ui.frame.VcsLogGraphTable.getPresentableText()
  StringBuilder sb = new StringBuilder();
  sb.append(FileHistoryPanelImpl.RevisionColumnInfo.toString(revision, true)).append(" ");
  sb.append(revision.getAuthor());
  long time = revision.getRevisionDate().getTime();
  sb.append(" on ").append(DateFormatUtil.formatDate(time)).append(" at ").append(DateFormatUtil.formatTime(time));
  if (revision instanceof VcsFileRevisionEx) {
    if (!Comparing.equal(revision.getAuthor(), ((VcsFileRevisionEx)revision).getCommitterName())) {
      sb.append(" (committed by ").append(((VcsFileRevisionEx)revision).getCommitterName()).append(")");
    }
  }
  if (withMessage) {
    sb.append(" ").append(MessageColumnInfo.getSubject(revision));
  }
  return sb.toString();
}
 
Example #6
Source File: TodoCheckinHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void showTodo(TodoCheckinHandlerWorker worker) {
  String title = "For commit (" + DateFormatUtil.formatDateTime(System.currentTimeMillis()) + ")";
  ServiceManager.getService(myProject, TodoView.class).addCustomTodoView(new TodoTreeBuilderFactory() {
    @Override
    public TodoTreeBuilder createTreeBuilder(JTree tree, Project project) {
      return new CustomChangelistTodosTreeBuilder(tree, myProject, title, worker.inOneList());
    }
  }, title, new TodoPanelSettings(myConfiguration.myTodoPanelSettings));

  ApplicationManager.getApplication().invokeLater(() -> {
    ToolWindowManager manager = ToolWindowManager.getInstance(myProject);
    if (manager != null) {
      ToolWindow window = manager.getToolWindow("TODO");
      if (window != null) {
        window.show(() -> {
          ContentManager cm = window.getContentManager();
          Content[] contents = cm.getContents();
          if (contents.length > 0) {
            cm.setSelectedContent(contents[contents.length - 1], true);
          }
        });
      }
    }
  }, ModalityState.NON_MODAL, myProject.getDisposed());
}
 
Example #7
Source File: FileHistoryDialogTest.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void testTitles() throws IOException {
  long leftTime = new Date(2001 - 1900, 1, 3, 12, 0).getTime();
  long rightTime = new Date(2002 - 1900, 2, 4, 14, 0).getTime();

  VirtualFile f = myRoot.createChildData(null, "old.txt");
  f.setBinaryContent("old".getBytes(), -1, leftTime);

  f.rename(null, "new.txt");
  f.setBinaryContent("new".getBytes(), -1, rightTime);

  f.setBinaryContent(new byte[0]); // to create current content to skip.

  FileHistoryDialogModel m = createFileModelAndSelectRevisions(f, 0, 2);
  assertEquals(FileUtil.toSystemDependentName(f.getPath()), m.getDifferenceModel().getTitle());

  assertEquals(DateFormatUtil.formatPrettyDateTime(leftTime) + " - old.txt",
               m.getDifferenceModel().getLeftTitle(new NullRevisionsProgress()));
  assertEquals(DateFormatUtil.formatPrettyDateTime(rightTime) + " - new.txt",
               m.getDifferenceModel().getRightTitle(new NullRevisionsProgress()));
}
 
Example #8
Source File: IdeDocumentHistoryImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void appendTimestamp(@Nonnull Project project, @Nonnull SimpleColoredComponent component, @Nonnull VirtualFile file) {
  if (!UISettings.getInstance().getShowInplaceComments()) {
    return;
  }

  try {
    Long timestamp = getInstance(project).getRecentFilesTimestamps().get(file.getPath());
    if (timestamp != null) {
      component.append(" ").append(DateFormatUtil.formatPrettyDateTime(timestamp), SimpleTextAttributes.GRAYED_SMALL_ATTRIBUTES);
    }
  }
  catch (IOException e) {
    LOG.info("Cannot get a timestamp from a persistent hash map", e);
  }
}
 
Example #9
Source File: GraphTableModel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public final Object getValueAt(int rowIndex, int columnIndex) {
  if (rowIndex >= getRowCount() - 1 && canRequestMore()) {
    requestToLoadMore(EmptyRunnable.INSTANCE);
  }

  VcsShortCommitDetails data = getShortDetails(rowIndex);
  switch (columnIndex) {
    case ROOT_COLUMN:
      return getRoot(rowIndex);
    case COMMIT_COLUMN:
      return new GraphCommitCell(data.getSubject(), getRefsAtRow(rowIndex),
                                 myDataPack.getVisibleGraph().getRowInfo(rowIndex).getPrintElements());
    case AUTHOR_COLUMN:
      String authorString = VcsUserUtil.getShortPresentation(data.getAuthor());
      return authorString + (VcsUserUtil.isSamePerson(data.getAuthor(), data.getCommitter()) ? "" : "*");
    case DATE_COLUMN:
      if (data.getAuthorTime() < 0) {
        return "";
      }
      else {
        return DateFormatUtil.formatDateTime(data.getAuthorTime());
      }
    default:
      throw new IllegalArgumentException("columnIndex is " + columnIndex + " > " + (COLUMN_COUNT - 1));
  }
}
 
Example #10
Source File: SelectionReverterTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void testChangeSetName() throws IOException {
  long time = new Date(2001, 1, 11, 12, 30).getTime();
  Clock.setTime(time);

  f.setBinaryContent("one".getBytes());
  f.setBinaryContent("two".getBytes());

  revertToPreviousRevision(0, 0);

  List<Revision> rr = getRevisionsFor(f);
  assertEquals(5, rr.size());
  assertEquals("Reverted to " + DateFormatUtil.formatDateTime(time), rr.get(1).getChangeSetName());
}
 
Example #11
Source File: PlatformOrPluginUpdateChecker.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static boolean checkNeeded() {
  UpdateSettings updateSettings = UpdateSettings.getInstance();
  if (!updateSettings.isEnable()) {
    return false;
  }

  final long timeDelta = System.currentTimeMillis() - updateSettings.getLastTimeCheck();
  return Math.abs(timeDelta) >= DateFormatUtil.DAY;
}
 
Example #12
Source File: FileTemplateManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void fillDefaultVariables(@Nonnull Map<String, Object> map) {
  Calendar calendar = Calendar.getInstance();
  Date date = myTestDate == null ? calendar.getTime() : myTestDate;
  SimpleDateFormat sdfMonthNameShort = new SimpleDateFormat("MMM");
  SimpleDateFormat sdfMonthNameFull = new SimpleDateFormat("MMMM");
  SimpleDateFormat sdfDayNameShort = new SimpleDateFormat("EEE");
  SimpleDateFormat sdfDayNameFull = new SimpleDateFormat("EEEE");
  SimpleDateFormat sdfYearFull = new SimpleDateFormat("yyyy");

  map.put("DATE", DateFormatUtil.formatDate(date));
  map.put("TIME", DateFormatUtil.formatTime(date));
  map.put("YEAR", sdfYearFull.format(date));
  map.put("MONTH", getCalendarValue(calendar, Calendar.MONTH));
  map.put("MONTH_NAME_SHORT", sdfMonthNameShort.format(date));
  map.put("MONTH_NAME_FULL", sdfMonthNameFull.format(date));
  map.put("DAY", getCalendarValue(calendar, Calendar.DAY_OF_MONTH));
  map.put("DAY_NAME_SHORT", sdfDayNameShort.format(date));
  map.put("DAY_NAME_FULL", sdfDayNameFull.format(date));
  map.put("HOUR", getCalendarValue(calendar, Calendar.HOUR_OF_DAY));
  map.put("MINUTE", getCalendarValue(calendar, Calendar.MINUTE));
  map.put("SECOND", getCalendarValue(calendar, Calendar.SECOND));

  map.put("USER", SystemProperties.getUserName());
  map.put("PRODUCT_NAME", ApplicationNamesInfo.getInstance().getFullProductName());

  map.put("DS", "$"); // Dollar sign, strongly needed for PHP, JS, etc. See WI-8979

  map.put(PROJECT_NAME_VARIABLE, myProject.getName());
}
 
Example #13
Source File: UpdateCheckerComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
public UpdateCheckerComponent(@Nonnull UpdateSettings updateSettings) {
  myUpdateSettings = updateSettings;

  myCheckRunnable = () -> PlatformOrPluginUpdateChecker.updateAndShowResult().doWhenDone(() -> {
    myUpdateSettings.setLastTimeCheck(System.currentTimeMillis());
    queueNextUpdateCheck(ourCheckInterval);
  });

  final long interval = myUpdateSettings.getLastTimeCheck() + ourCheckInterval - System.currentTimeMillis();
  queueNextUpdateCheck(PlatformOrPluginUpdateChecker.checkNeeded() ? ourCheckInterval : Math.max(interval, DateFormatUtil.MINUTE));
}
 
Example #14
Source File: DocumentationManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private static String generateFileDoc(@Nonnull PsiFile psiFile, boolean withUrl) {
  VirtualFile file = PsiUtilCore.getVirtualFile(psiFile);
  File ioFile = file == null || !file.isInLocalFileSystem() ? null : VfsUtilCore.virtualToIoFile(file);
  BasicFileAttributes attr = null;
  try {
    attr = ioFile == null ? null : Files.readAttributes(Paths.get(ioFile.toURI()), BasicFileAttributes.class);
  }
  catch (Exception ignored) {
  }
  if (attr == null) return null;
  FileType type = file.getFileType();
  String typeName = type == UnknownFileType.INSTANCE ? "Unknown" : type == PlainTextFileType.INSTANCE ? "Text" : type instanceof ArchiveFileType ? "Archive" : type.getId();
  String languageName = type.isBinary() ? "" : psiFile.getLanguage().getDisplayName();
  return (withUrl ? DocumentationMarkup.DEFINITION_START + file.getPresentableUrl() + DocumentationMarkup.DEFINITION_END + DocumentationMarkup.CONTENT_START : "") +
         getVcsStatus(psiFile.getProject(), file) +
         getScope(psiFile.getProject(), file) +
         "<p><span class='grayed'>Size:</span> " +
         StringUtil.formatFileSize(attr.size()) +
         "<p><span class='grayed'>Type:</span> " +
         typeName +
         (type.isBinary() || typeName.equals(languageName) ? "" : " (" + languageName + ")") +
         "<p><span class='grayed'>Modified:</span> " +
         DateFormatUtil.formatDateTime(attr.lastModifiedTime().toMillis()) +
         "<p><span class='grayed'>Created:</span> " +
         DateFormatUtil.formatDateTime(attr.creationTime().toMillis()) +
         (withUrl ? DocumentationMarkup.CONTENT_END : "");
}
 
Example #15
Source File: OutdatedVersionNotifier.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void updateLabelText(final Change c) {
  String comment = myChangeList.getComment();
  int pos = comment.indexOf("\n");
  if (pos >= 0) {
    comment = comment.substring(0, pos).trim() + "...";
  }
  final String formattedDate = DateFormatUtil.formatPrettyDateTime(myChangeList.getCommitDate());
  final boolean dateIsPretty = ! formattedDate.contains("/");
  final String key = c.getType() == Change.Type.DELETED ? "outdated.version.text.deleted" :
                     (dateIsPretty ? "outdated.version.pretty.date.text" : "outdated.version.text");
  myLabel.setText(VcsBundle.message(key, myChangeList.getCommitterName(), formattedDate, comment));
}
 
Example #16
Source File: PluginManagerColumnInfo.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public String valueOf(PluginDescriptor base) {
  if (columnIdx == COLUMN_NAME) {
    return base.getName();
  }
  else if (columnIdx == COLUMN_DOWNLOADS) {
    //  Base class IdeaPluginDescriptor does not declare this field.
    return base.getDownloads();
  }
  if (columnIdx == COLUMN_DATE) {
    //  Base class IdeaPluginDescriptor does not declare this field.
    long date = (base instanceof PluginNode) ? ((PluginNode)base).getDate() : 0;
    if (date != 0) {
      return DateFormatUtil.formatDate(date);
    }
    else {
      return IdeBundle.message("plugin.info.not.available");
    }
  }
  else if (columnIdx == COLUMN_CATEGORY) {
    return base.getCategory();
  }
  else if (columnIdx == COLUMN_RATE) {
    return ((PluginNode)base).getRating();
  }
  else
  // For COLUMN_STATUS - set of icons show the actual state of installed plugins.
  {
    return "";
  }
}
 
Example #17
Source File: PluginManagerColumnInfo.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  Component orig = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  final Color bg = orig.getBackground();
  final Color grayedFg = isSelected ? orig.getForeground() : Color.GRAY;
  myLabel.setForeground(grayedFg);
  myLabel.setBackground(bg);
  myLabel.setOpaque(true);

  if (column == COLUMN_DATE) {
    long date = myPluginDescriptor.getDate();
    myLabel.setText(date != 0 && date != Long.MAX_VALUE ? DateFormatUtil.formatDate(date) : "n/a");
    myLabel.setHorizontalAlignment(SwingConstants.RIGHT);
  } else if (column == COLUMN_DOWNLOADS) {
    String downloads = myPluginDescriptor.getDownloads();
    myLabel.setText(!StringUtil.isEmpty(downloads) ? downloads : "n/a");
    myLabel.setHorizontalAlignment(SwingConstants.RIGHT);
  } else if (column == COLUMN_CATEGORY) {
    String category = myPluginDescriptor.getCategory();

    myLabel.setText(!StringUtil.isEmpty(category) ? category : "n/a");
  }
  if (myPluginDescriptor.getStatus() == PluginNode.STATUS_INSTALLED) {
    PluginId pluginId = myPluginDescriptor.getPluginId();
    final boolean hasNewerVersion = InstalledPluginsTableModel.hasNewerVersion(pluginId);
    if (hasNewerVersion) {
      if (!isSelected) myLabel.setBackground(LightColors.BLUE);
    }
  }
  return myLabel;
}
 
Example #18
Source File: ProjectLevelVcsManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@CalledInAwt
@Nullable
@Override
public UpdateInfoTree showUpdateProjectInfo(UpdatedFiles updatedFiles, String displayActionName, ActionInfo actionInfo, boolean canceled) {
  if (!myProject.isOpen() || myProject.isDisposed()) return null;
  ContentManager contentManager = getContentManager();
  if (contentManager == null) {
    return null;  // content manager is made null during dispose; flag is set later
  }
  final UpdateInfoTree updateInfoTree = new UpdateInfoTree(contentManager, myProject, updatedFiles, displayActionName, actionInfo);
  ContentUtilEx.addTabbedContent(contentManager, updateInfoTree, "Update Info", DateFormatUtil.formatDateTime(System.currentTimeMillis()), false, updateInfoTree);
  updateInfoTree.expandRootChildren();
  return updateInfoTree;
}
 
Example #19
Source File: RecentChangesPopup.java    From consulo with Apache License 2.0 5 votes vote down vote up
public Component getListCellRendererComponent(JList l, Object val, int i, boolean isSelected, boolean cellHasFocus) {
  RecentChange c = (RecentChange)val;
  myActionLabel.setText(c.getChangeName());
  myDateLabel.setText(DateFormatUtil.formatPrettyDateTime(c.getTimestamp()));

  updateColors(isSelected);
  return myPanel;
}
 
Example #20
Source File: ChangelistDetails.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
public ChangelistDetails(@NotNull P4RemoteChangelist changelist) {
    $$$setupUI$$$();
    this.myDescription.setText(changelist.getSummary().getComment());
    Date date = changelist.getSubmittedDate();
    this.myDate.setText(date == null ? null : DateFormatUtil.formatDateTime(date));
    this.myChangelistId.setText(Integer.toString(changelist.getChangelistId().getChangelistId()));
    this.myAuthor.setText(changelist.getUsername());
    this.myClientname.setText(changelist.getClientname());
    if (changelist.getAttachedJobs().isEmpty()) {
        myNoJobsPanel.setVisible(true);
        myJobsPanel.setVisible(false);
    } else {
        myJobsPanel.setVisible(true);
        myNoJobsPanel.setVisible(false);
        myJobsPanel.add(myJobs.getTableHeader(), BorderLayout.NORTH);
        jobsModel.addRows(changelist.getAttachedJobs());

        // TODO add context menu or toolbar action to view the job details.
    }
    if (changelist.getFiles().isEmpty()) {
        myNoFilesPanel.setVisible(true);
        myFilesPanel.setVisible(false);
    } else {
        myFilesPanel.setVisible(true);
        myNoFilesPanel.setVisible(false);
        myFilesPanel.add(myFiles.getTableHeader(), BorderLayout.NORTH);
        filesModel.addRows(changelist.getFiles());

        // TODO add context menu or toolbar action to view the file revision details.
    }


    root.validate();
    root.doLayout();
}
 
Example #21
Source File: StatusToolTip.java    From GitToolBox with Apache License 2.0 5 votes vote down vote up
private StringBand prepareInfoToolTipPart() {
  GitToolBoxConfigPrj config = ProjectConfig.get(project);
  StringBand result = new StringBand();
  if (config.getAutoFetch()) {
    result.append(GitUIUtil.bold(ResBundle.message("message.autoFetch"))).append(": ");
    long lastAutoFetch = AutoFetchComponent.getInstance(project).lastAutoFetch();
    if (lastAutoFetch != 0) {
      result.append(DateFormatUtil.formatBetweenDates(lastAutoFetch, System.currentTimeMillis()));
    } else {
      result.append(ResBundle.on());
    }
  }

  return result;
}
 
Example #22
Source File: BuckToGeneralTestEventsConverter.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public void consumeTestRunStarted(long timestamp) {
  final GeneralTestEventsProcessor processor = getProcessor();
  if (processor == null) {
    return;
  }
  processor.onUncapturedOutput(
      "Test run started at " + DateFormatUtil.formatTimeWithSeconds(new Date(timestamp)) + "\n",
      ProcessOutputTypes.STDOUT);
}
 
Example #23
Source File: BuckToGeneralTestEventsConverter.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public void consumeBuildEnd(long timestamp) {
  final GeneralTestEventsProcessor processor = getProcessor();
  if (processor == null) {
    return;
  }
  processor.onUncapturedOutput(
      "Build finished at " + DateFormatUtil.formatTimeWithSeconds(new Date(timestamp)) + "\n",
      ProcessOutputTypes.STDOUT);
}
 
Example #24
Source File: BuckToGeneralTestEventsConverter.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public void consumeBuildStart(long timestamp) {
  final GeneralTestEventsProcessor processor = getProcessor();
  if (processor == null) {
    return;
  }
  processor.onUncapturedOutput(
      "Build started at " + DateFormatUtil.formatTimeWithSeconds(new Date(timestamp)) + "\n",
      ProcessOutputTypes.STDOUT);
}
 
Example #25
Source File: BuckToGeneralTestEventsConverter.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public void consumeCompilerError(
    String target, long timestamp, String error, ImmutableSet<String> suggestions) {
  final GeneralTestEventsProcessor processor = getProcessor();
  if (processor != null) {
    processor.onUncapturedOutput(
        "Build failed at " + DateFormatUtil.formatTimeWithSeconds(new Date(timestamp)) + "\n",
        ProcessOutputTypes.STDOUT);
  }
  mConnection.disconnect();
  myHandler.detachProcess();
}
 
Example #26
Source File: SMTestRunnerResultsForm.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Returns root node, fake parent suite for all tests and suites
 *
 * @param testsRoot
 * @return
 */
@Override
public void onTestingStarted(@Nonnull SMTestProxy.SMRootTestProxy testsRoot) {
  myAnimator.setCurrentTestCase(myTestsRootNode);
  myTreeBuilder.updateFromRoot();

  // Status line
  myStatusLine.setStatusColor(ColorProgressBar.GREEN);

  // Tests tree
  selectAndNotify(myTestsRootNode);

  myStartTime = System.currentTimeMillis();
  boolean printTestingStartedTime = true;
  if (myProperties instanceof SMTRunnerConsoleProperties) {
    printTestingStartedTime = ((SMTRunnerConsoleProperties)myProperties).isPrintTestingStartedTime();
  }
  if (printTestingStartedTime) {
    myTestsRootNode.addSystemOutput("Testing started at " + DateFormatUtil.formatTime(myStartTime) + " ...\n");
  }

  updateStatusLabel(false);

  // TODO : show info - "Loading..." msg

  fireOnTestingStarted();
}
 
Example #27
Source File: ImportTestsFromHistoryAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static String getPresentableText(Project project, String name) {
  String nameWithoutExtension = FileUtil.getNameWithoutExtension(name);
  final int lastIndexOf = nameWithoutExtension.lastIndexOf(" - ");
  if (lastIndexOf > 0) {
    final String date = nameWithoutExtension.substring(lastIndexOf + 3);
    try {
      final Date creationDate = new SimpleDateFormat(SMTestRunnerResultsForm.HISTORY_DATE_FORMAT).parse(date);
      final String configurationName = TestHistoryConfiguration.getInstance(project).getConfigurationName(name);
      return (configurationName != null ? configurationName : nameWithoutExtension.substring(0, lastIndexOf)) +
             " (" + DateFormatUtil.formatDateTime(creationDate) + ")";
    }
    catch (ParseException ignore) {}
  }
  return nameWithoutExtension;
}
 
Example #28
Source File: AnnotateStackTraceAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public String getToolTip(int line, Editor editor) {
  LastRevision revision = myRevisions.get(line);
  if (revision != null) {
    return XmlStringUtil.escapeString(revision.getAuthor() + " " + DateFormatUtil.formatDateTime(revision.getDate()) + "\n" + VcsUtil.trimCommitMessageToSaneSize(revision.getMessage()));
  }
  return null;
}
 
Example #29
Source File: Reverter.java    From consulo with Apache License 2.0 5 votes vote down vote up
public String getCommandName() {
  Revision to = getTargetRevision();
  String name = to.getChangeSetName();
  String date = DateFormatUtil.formatDateTime(to.getTimestamp());
  if (name != null) {
    return LocalHistoryBundle.message("system.label.revert.to.change.date", name, date);
  }
  else {
    return LocalHistoryBundle.message("system.label.revert.to.date", date);
  }
}
 
Example #30
Source File: FileDifferenceModel.java    From consulo with Apache License 2.0 5 votes vote down vote up
private String formatTitle(Entry e, boolean isAvailable) {
  String result = DateFormatUtil.formatPrettyDateTime(e.getTimestamp()) + " - " + e.getName();
  if (!isAvailable) {
    result += " - " + LocalHistoryBundle.message("content.not.available");
  }
  return result;
}