@Override public void run() { for (HistoryChangeListener l : la) { l.fireHistoryChanged(new HistoryEvent(HgHistoryProvider.this, files)); } } });
@Override public void doCreate(File file, boolean isDirectory) throws IOException { Mercurial.LOG.log(Level.FINE, "doCreate {0} {1}", new Object[]{file, isDirectory}); super.doCreate(file, isDirectory); }
/** Tests whether it shows some content. */ public boolean hasContext() { return context != null && context.getRootFiles().size() > 0; } }
private JComponent[] createVersioningSystemItems(VersioningSystem owner, Node[] nodes) { if (owner==null) { return new JComponent[0]; } VCSAnnotator an = owner.getVCSAnnotator(); if (an == null) return new JComponent[0]; VCSContext ctx = VCSContext.forNodes(nodes); Action [] actions = an.getActions(ctx, VCSAnnotator.ActionDestination.PopupMenu); JComponent [] items = new JComponent[actions.length]; int i = 0; for (Action action : actions) { if (action != null) { JMenuItem item = createmenuItem(action); items[i++] = item; } else { items[i++] = createJSeparator(); } } return items; }
/** * Returns root files sorted per their repository roots * @param ctx * @param rootFiles * @return */ public static Map<File, Set<File>> sortUnderRepository (final VCSContext ctx, boolean rootFiles) { Set<File> files = null; if(ctx != null) { files = rootFiles ? ctx.getRootFiles() : ctx.getFiles(); } return sortUnderRepository(files); }
/** * Tests whether a file or directory should receive the STATUS_NOTVERSIONED_NOTMANAGED status. * All files and folders that have a parent with CVS/Repository file are considered versioned. * * @param file a file or directory * @return false if the file should receive the STATUS_NOTVERSIONED_NOTMANAGED status, true otherwise */ public boolean isManaged(File file) { return VersioningSupport.getOwner(file) instanceof MercurialVCS && !HgUtils.isPartOfMercurialMetadata(file); }
/** * Check if this context has at least one file with the passed in status * @param context context to examine * @param includeStatus file status to check for * @param checkCommitExclusions if set to true then files excluded from commit will not be tested * @param cached if set to <code>true</code>, only cached values will be checked otherwise it may call I/O operations * @return boolean true if this context contains at least one file with the includeStatus, false otherwise */ public boolean containsFileOfStatus(VCSContext context, int includeStatus, boolean checkCommitExclusions){ Set<File> roots = context.getRootFiles(); for (File root : roots) { if (hasStatus(root, includeStatus, checkCommitExclusions) || containsFileOfStatus(root, includeStatus, checkCommitExclusions, !VersioningSupport.isFlat(root))) { return true; } } return false; }
@Override public boolean isMutable(File file) { return HgUtils.isPartOfMercurialMetadata(file) || super.isMutable(file); }
private HgRevision getHgRevision(HistoryEntry entry) { String[] revs = entry.getRevision().split(":"); final HgRevision revision = new HgRevision(revs[1], revs[0]); return revision; }
@Override protected boolean enable(Node[] nodes) { VCSContext context = HgUtils.getCurrentContext(nodes); Set<File> roots = context.getFiles(); if(roots == null) return false; return HgUtils.isFromHgRepository(context); }
@Override public void run() { Mercurial hg = Mercurial.getInstance(); hg.clearAncestorCaches(); hg.versionedFilesChanged(); VersioningSupport.versionedRootsChanged(); } });
/** * Returns repository roots for all root files from context * * @param VCSContext * @return repository roots */ public static Set<File> getRepositoryRoots(VCSContext context) { Set<File> rootsSet = context.getRootFiles(); return getRepositoryRoots(rootsSet); }
private boolean containsFile (File file) { if (context != null) { return HgUtils.contains(context.getRootFiles(), file); } else { return false; } }
private boolean isActionEnabled() { for (File file : HgUtils.getCurrentContext(null).getRootFiles()) { if (file.canRead()) return true; } return false; }
@Override protected boolean enable(Node[] nodes) { VCSContext context = HgUtils.getCurrentContext(nodes); Set<File> ctxFiles = context != null? context.getRootFiles(): null; if(!HgUtils.isFromHgRepository(context) || ctxFiles == null || ctxFiles.isEmpty()) return false; return true; // #121293: Speed up menu display, warn user if not set when Push selected }
@Override protected boolean enable(Node[] nodes) { VCSContext context = HgUtils.getCurrentContext(nodes); Set<File> ctxFiles = context != null? context.getRootFiles(): null; if(!HgUtils.isFromHgRepository(context) || ctxFiles == null || ctxFiles.size() == 0) return false; return true; // #121293: Speed up menu display, warn user if not set when Push selected }
@Override protected boolean enable(Node[] nodes) { VCSContext context = HgUtils.getCurrentContext(nodes); Set<File> ctxFiles = context != null? context.getRootFiles(): null; if (!HgUtils.isFromHgRepository(context) || ctxFiles == null || ctxFiles.isEmpty()) { return false; } return true; }
@Override protected boolean enable(Node[] nodes) { VCSContext context = HgUtils.getCurrentContext(nodes); Set<File> ctxFiles = context != null? context.getRootFiles(): null; if(!HgUtils.isFromHgRepository(context) || ctxFiles == null || ctxFiles.isEmpty()) return false; return true; }
@Override protected boolean enable(Node[] nodes) { VCSContext context = HgUtils.getCurrentContext(nodes); Set<File> ctxFiles = context != null? context.getRootFiles(): null; if(!HgUtils.isFromHgRepository(context) || ctxFiles == null || ctxFiles.isEmpty()) { return false; } return !HgUtils.onlyProjects(nodes); }
@Override protected boolean enable(Node[] nodes) { VCSContext context = HgUtils.getCurrentContext(nodes); Set<File> ctxFiles = context != null? context.getRootFiles(): null; if (!HgUtils.isFromHgRepository(context) || ctxFiles == null || ctxFiles.size() == 0) { return false; } return !HgUtils.onlyProjects(nodes) && !HgUtils.onlyFolders(ctxFiles); }