public String getFinishStatusText(boolean isAborted, long buildTimeInMilliseconds) { int errors = getErrorCount(); int warnings = getWarningCount(); final String theDateAsString = DateFormatUtil.formatDateTime(Clock.getTime()); String formattedBuildTime = formatBuildTime(buildTimeInMilliseconds / 1000); if (isAborted) { return AntBundle.message( "build.finished.status.ant.build.aborted", formattedBuildTime, theDateAsString); } else if (errors == 0 && warnings == 0) { return AntBundle.message( "build.finished.status.ant.build.completed.successfully", formattedBuildTime, theDateAsString); } else if (errors == 0) { return AntBundle.message( "build.finished.status.ant.build.completed.with.warnings", warnings, formattedBuildTime, theDateAsString); } else { return AntBundle.message( "build.finished.status.ant.build.completed.with.errors.warnings", errors, warnings, formattedBuildTime, theDateAsString); } }
private void setColumnPreferredSize() { for (int i = 0; i < getColumnCount(); i++) { TableColumn column = getColumnModel().getColumn(i); if (i == AbstractVcsLogTableModel.ROOT_COLUMN) { // thin stripe or nothing int rootWidth = myUI.getColorManager().isMultipleRoots() ? ROOT_INDICATOR_WIDTH : 0; // NB: all further instructions and their order are important, otherwise the minimum size // which is less than 15 won't be applied column.setMinWidth(rootWidth); column.setMaxWidth(rootWidth); column.setPreferredWidth(rootWidth); } else if (i == AbstractVcsLogTableModel .COMMIT_COLUMN) { // let commit message occupy as much as possible column.setPreferredWidth(Short.MAX_VALUE); } else if (i == AbstractVcsLogTableModel.AUTHOR_COLUMN) { // detect author with the longest name // to avoid querying the last row (it would lead to full graph loading) int maxRowsToCheck = Math.min(MAX_ROWS_TO_CALC_WIDTH, getRowCount() - MAX_ROWS_TO_CALC_OFFSET); if (maxRowsToCheck < 0) { // but if the log is small, check all of them maxRowsToCheck = getRowCount(); } int contentWidth = calcMaxContentColumnWidth(i, maxRowsToCheck); column.setMinWidth(Math.min(contentWidth, MAX_DEFAULT_AUTHOR_COLUMN_WIDTH)); column.setWidth(column.getMinWidth()); } else if (i == AbstractVcsLogTableModel.DATE_COLUMN) { // all dates have nearly equal sizes Font tableFont = UIManager.getFont("Table.font"); column.setMinWidth( getFontMetrics(tableFont) .stringWidth("mm" + DateFormatUtil.formatDateTime(new Date()))); column.setWidth(column.getMinWidth()); } } }
private boolean setColumnPreferredSize() { boolean sizeCalculated = false; Font tableFont = UIManager.getFont("Table.font"); for (int i = 0; i < getColumnCount(); i++) { TableColumn column = getColumnModel().getColumn(i); if (i == GraphTableModel.ROOT_COLUMN) { // thin stripe, or root name, or nothing setRootColumnSize(column); } else if (i == GraphTableModel.COMMIT_COLUMN) { // let commit message occupy as much as possible column.setPreferredWidth(Short.MAX_VALUE); } else if (i == GraphTableModel.AUTHOR_COLUMN) { // detect author with the longest name // to avoid querying the last row (it would lead to full graph loading) int maxRowsToCheck = Math.min(MAX_ROWS_TO_CALC_WIDTH, getRowCount() - MAX_ROWS_TO_CALC_OFFSET); if (maxRowsToCheck < 0) { // but if the log is small, check all of them maxRowsToCheck = getRowCount(); } int maxWidth = 0; for (int row = 0; row < maxRowsToCheck; row++) { String value = getModel().getValueAt(row, i).toString(); maxWidth = Math.max(getFontMetrics(tableFont).stringWidth(value), maxWidth); if (!value.isEmpty()) sizeCalculated = true; } column.setMinWidth( Math.min(maxWidth + UIUtil.DEFAULT_HGAP, MAX_DEFAULT_AUTHOR_COLUMN_WIDTH)); column.setWidth(column.getMinWidth()); } else if (i == GraphTableModel.DATE_COLUMN) { // all dates have nearly equal sizes column.setMinWidth( getFontMetrics(tableFont) .stringWidth("mm" + DateFormatUtil.formatDateTime(new Date()))); column.setWidth(column.getMinWidth()); } } return sizeCalculated; }
public static void generateStubs(Framework framework, File location) { final StringBuilder builder = new StringBuilder(); builder .append("# This is a machine generated stub for: ") .append(framework.getName()) .append("\n"); builder .append("# Created on: ") .append(DateFormatUtil.formatDateTime(new Date())) .append("\n\n"); for (Class aClass : framework.getClasses()) { generateClassStub(builder, framework, aClass); } for (Function function : framework.getFunctions()) { generateFunctionStub(builder, function, ""); } for (Constant constant : framework.getConstants()) { generateConstantStub(builder, constant); } for (Map.Entry<String, String> entry : framework.getFunctionAliases().entrySet()) { generateAlias(builder, entry); } try { FileUtil.writeToFile(location, builder.toString()); } catch (Throwable ignored) { } }
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); } }
@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" + revision.getMessage()); } return null; }
protected void showErrors(final CvsHandler handler, final CvsTabbedWindow tabbedWindow) { final List<VcsException> errors = handler.getErrorsExceptAborted(); if (!myShowErrors || myIsQuietOperation) return; if (tabbedWindow == null) { if (errors.isEmpty()) return; final List<String> messages = new ArrayList<String>(); for (VcsException error : errors) { if (!StringUtil.isEmptyOrSpaces(error.getMessage())) { messages.add(error.getMessage()); } } final String errorMessage = StringUtil.join(messages, "\n"); Messages.showErrorDialog(errorMessage, "CVS Error"); return; } if (errors.isEmpty()) { tabbedWindow.hideErrors(); } else { ErrorTreeView errorTreeView = tabbedWindow.getErrorsTreeView(); for (final VcsException exception : errors) { final String groupName = DateFormatUtil.formatDateTime(System.currentTimeMillis()) + ' ' + handler.getTitle(); if (exception.isWarning()) { errorTreeView.addMessage( MessageCategory.WARNING, exception.getMessages(), groupName, DummyNavigatable.INSTANCE, null, null, exception); } else { errorTreeView.addMessage( MessageCategory.ERROR, exception.getMessages(), groupName, DummyNavigatable.INSTANCE, null, null, exception); } } tabbedWindow.ensureVisible(myProject); } }
@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()), true, updateInfoTree); ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS).activate(null); updateInfoTree.expandRootChildren(); return updateInfoTree; }
private static String getLastModification(DiffElement file) { final long timeStamp = file.getTimeStamp(); return timeStamp < 0 ? "" : DateFormatUtil.formatDateTime(timeStamp); }
private boolean reorderCommitsIfNeeded(@NotNull final RebaseInfo rebaseInfo) { if (rebaseInfo.reorderedCommits.isEmpty()) { return true; } ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (progressIndicator == null) { progressIndicator = new EmptyProgressIndicator(); } String stashMessage = "Uncommitted changes before rebase operation at " + DateFormatUtil.formatDateTime(Clock.getTime()); final GitChangesSaver saver = rebaseInfo.policy == GitVcsSettings.UpdateChangesPolicy.SHELVE ? new GitShelveChangesSaver(myProject, progressIndicator, stashMessage) : new GitStashChangesSaver(myProject, progressIndicator, stashMessage); final Boolean[] result = new Boolean[1]; result[0] = false; final ProgressIndicator finalProgressIndicator = progressIndicator; GitComplexProcess.Operation reorderOperation = new GitComplexProcess.Operation() { @Override public void run(ContinuationContext context) { try { final Set<VirtualFile> rootsToReorder = rebaseInfo.reorderedCommits.keySet(); saver.saveLocalChanges(rootsToReorder); try { GitRebaser rebaser = new GitRebaser(myProject, finalProgressIndicator); for (Map.Entry<VirtualFile, List<String>> rootToCommits : rebaseInfo.reorderedCommits.entrySet()) { final VirtualFile root = rootToCommits.getKey(); GitBranch b = GitBranch.current(myProject, root); if (b == null) { LOG.info("executeRebase: current branch is null"); continue; } GitBranch t = b.tracked(myProject, root); if (t == null) { LOG.info("executeRebase: tracked branch is null"); continue; } final GitRevisionNumber mergeBase = b.getMergeBase(myProject, root, t); if (mergeBase == null) { LOG.info("executeRebase: merge base is null for " + b + " and " + t); continue; } String parentCommit = mergeBase.getRev(); result[0] = rebaser.reoderCommitsIfNeeded(root, parentCommit, rootToCommits.getValue()); } } catch (VcsException e) { notifyMessage( myProject, "Commits weren't pushed", "Failed to reorder commits", NotificationType.WARNING, true, Collections.singleton(e)); } finally { saver.restoreLocalChanges(context); } } catch (VcsException e) { LOG.info("Couldn't save local changes", e); notifyError( myProject, "Couldn't save local changes", "Tried to save uncommitted changes in " + saver.getSaverName() + " before update, but failed with an error.<br/>" + "Update was cancelled.", true, e); } } }; GitComplexProcess.execute(myProject, "reordering commits", reorderOperation); return result[0]; }