# HG changeset patch # User jrice@netbeans.org # Date 1202485716 0 # Node ID 66ae4a8aa636a2ba77c6c70cce509086e39d6356 # Parent 64509e0ef84ec9252fc08816299d8220d5715e94 #126869: prevent Ignore Menu enabling blocking on AWT thread diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/FileStatusCache.java --- a/mercurial/src/org/netbeans/modules/mercurial/FileStatusCache.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/FileStatusCache.java Fri Feb 08 15:48:36 2008 +0000 @@ -54,6 +54,7 @@ import java.util.logging.Level; import java.util.logging.Level; import java.beans.PropertyChangeSupport; import java.beans.PropertyChangeListener; +import java.io.File; import org.netbeans.modules.mercurial.util.HgCommand; import java.util.logging.Level; import org.netbeans.api.queries.SharabilityQuery; @@ -132,7 +133,7 @@ public class FileStatusCache { Set files = getScannedFiles(dir, null).keySet(); return files.toArray(new File[files.size()]); } - + /** * Check if this context has at least one file with the passed in status * @@ -305,19 +306,23 @@ public class FileStatusCache { * @return give file's status or null if the file's status is not in cache */ @SuppressWarnings("unchecked") // Need to change turbo module to remove warning at source - FileInformation getCachedStatus(File file) { + FileInformation getCachedStatus(File file, boolean bCheckSharability) { File parent = file.getParentFile(); if (parent == null) return FileStatusCache.FILE_INFORMATION_NOTMANAGED_DIRECTORY; + + Map files = (Map) turbo.readEntry(parent, FILE_STATUS_MAP); + FileInformation fi = files != null ? files.get(file) : null; + if( fi != null) return fi; + if (file.isDirectory()) { - if (hg.isAdministrative(file) || HgUtils.isIgnored(file)) { + if (hg.isAdministrative(file) || HgUtils.isIgnored(file, bCheckSharability)) { return FileStatusCache.FILE_INFORMATION_EXCLUDED_DIRECTORY; } else { return FileStatusCache.FILE_INFORMATION_UPTODATE_DIRECTORY; } } - Map files = (Map) turbo.readEntry(parent, FILE_STATUS_MAP); - return files != null ? files.get(file) : null; + return fi; } private FileInformation refresh(File file, FileStatus repositoryStatus, @@ -327,7 +332,7 @@ public class FileStatusCache { if (dir == null) { return FileStatusCache.FILE_INFORMATION_NOTMANAGED; //default for filesystem roots } - Map files = getScannedFiles(dir, null); + Map files = getScannedFiles(dir, null); // Has side effect of updating the cache if (files == FileStatusCache.NOT_MANAGED_MAP && repositoryStatus == FileStatusCache.REPOSITORY_STATUS_UNKNOWN) return FileStatusCache.FILE_INFORMATION_NOTMANAGED; FileInformation current = files.get(file); @@ -359,7 +364,7 @@ public class FileStatusCache { turbo.writeEntry(dir, FILE_STATUS_MAP, newFiles.size() == 0 ? null : newFiles); if (file.isDirectory() && needRecursiveRefresh(fi, current)) { - File [] content = listFiles(file); + File [] content = listFiles(file); // Has side effect of updating the cache for (int i = 0; i < content.length; i++) { refresh(content[i], FileStatusCache.REPOSITORY_STATUS_UNKNOWN); } @@ -699,10 +704,15 @@ public class FileStatusCache { // Only interested in looking for Hg managed dirs for (File file : files) { if (file.isDirectory() && hg.getTopmostManagedParent(file) != null){ - if (hg.isAdministrative(file) || HgUtils.isIgnored(file)) + if (hg.isAdministrative(file) || HgUtils.isIgnored(file)){ + Mercurial.LOG.log(Level.FINE, "scanFolder NotMng Ignored Dir {0}: exclude SubDir: {1}", // NOI18N + new Object[]{dir.getAbsolutePath(), file.getName()}); folderFiles.put(file, FILE_INFORMATION_EXCLUDED_DIRECTORY); // Excluded dir - else + }else{ + Mercurial.LOG.log(Level.FINE, "scanFolder NotMng Dir {0}: up to date Dir: {1}", // NOI18N + new Object[]{dir.getAbsolutePath(), file.getName()}); folderFiles.put(file, FILE_INFORMATION_UPTODATE_DIRECTORY); + } } // Do NOT put any unmanaged dir's (FILE_INFORMATION_NOTMANAGED_DIRECTORY) or // files (FILE_INFORMATION_NOTMANAGED) into the folderFiles @@ -717,8 +727,11 @@ public class FileStatusCache { if (file.isDirectory()) { folderFiles.put(file, FILE_INFORMATION_EXCLUDED_DIRECTORY); // Excluded dir + Mercurial.LOG.log(Level.FINE, "scanFolder Mng Ignored Dir {0}: exclude SubDir: {1}", // NOI18N + new Object[]{dir.getAbsolutePath(), file.getName()}); } else { - Mercurial.LOG.log(Level.FINE, "scanFolder exclude: {0}", file); // NOI18N + Mercurial.LOG.log(Level.FINE, "scanFolder Mng Ignored Dir {0}: exclude File: {1}", // NOI18N + new Object[]{dir.getAbsolutePath(), file.getName()}); folderFiles.put(file, FILE_INFORMATION_EXCLUDED); } } @@ -732,26 +745,11 @@ public class FileStatusCache { try { interestingFiles = HgCommand.getInterestingStatus(rootManagedFolder, dir); } catch (HgException ex) { - Mercurial.LOG.log(Level.FINE, "scanFolder() dir: {0} {1}", new Object[]{dir.getAbsolutePath(), ex.toString()}); // NOI18N + Mercurial.LOG.log(Level.FINE, "scanFolder() getInterestingStatus Exception: dir: {0} {1}", new Object[]{dir.getAbsolutePath(), ex.toString()}); // NOI18N return folderFiles; } } - // TODO: Deal with removed and deleted files the repository is tracking but are not on the filesystem - // Code below does work, but seem to blow up further down the line with deserilaisation problems - // presuambly the cache is trying to deserialise the files I've just added - need to figure out how - // stop it doing so. - /* - if (!removedOrDeletedFiles.isEmpty()){ - for (Iterator i = removedOrDeletedFiles.keySet().iterator(); i.hasNext();) { - File file = (File) i.next(); - FileInformation fi = removedOrDeletedFiles.get(file); - if (fi != null && fi.getStatus() != FileInformation.STATUS_VERSIONED_UPTODATE) - folderFiles.put(file, fi); - } - } - */ - if (interestingFiles == null) return folderFiles; for (File file : files) { @@ -759,8 +757,12 @@ public class FileStatusCache { if (file.isDirectory()) { if (hg.isAdministrative(file) || HgUtils.isIgnored(file)) { + Mercurial.LOG.log(Level.FINE, "scanFolder Mng Dir {0}: exclude Dir: {1}", // NOI18N + new Object[]{dir.getAbsolutePath(), file.getName()}); folderFiles.put(file, FILE_INFORMATION_EXCLUDED_DIRECTORY); // Excluded dir } else { + Mercurial.LOG.log(Level.FINE, "scanFolder Mng Dir {0}: up to date Dir: {1}", // NOI18N + new Object[]{dir.getAbsolutePath(), file.getName()}); folderFiles.put(file, FILE_INFORMATION_UPTODATE_DIRECTORY); } } else { diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java --- a/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java Fri Feb 08 15:48:36 2008 +0000 @@ -217,7 +217,7 @@ public class MercurialAnnotator extends boolean folderAnnotation = false; for (final File file : context.getRootFiles()) { - FileInformation info = cache.getCachedStatus(file); + FileInformation info = cache.getCachedStatus(file, true); if (info == null) { File parentFile = file.getParentFile(); Mercurial.LOG.log(Level.FINE, "null cached status for: {0} {1} {2}", new Object[] {file, folderToScan, parentFile}); @@ -268,7 +268,7 @@ public class MercurialAnnotator extends // There is an assumption here that annotateName was already // called and FileStatusCache.getStatus was scheduled if // FileStatusCache.getCachedStatus returned null. - FileInformation info = cache.getCachedStatus(file); + FileInformation info = cache.getCachedStatus(file, true); if ((info != null && (info.getStatus() & STATUS_BADGEABLE) != 0)) { isVersioned = true; break; @@ -382,8 +382,10 @@ public class MercurialAnnotator extends actions.add(new RollbackAction(NbBundle.getMessage(MercurialAnnotator.class, "CTL_PopupMenuItem_Rollback"), ctx)); // NOI18N actions.add(new RevertModificationsAction(NbBundle.getMessage(MercurialAnnotator.class, "CTL_PopupMenuItem_Revert"), ctx)); // NOI18N actions.add(new ResolveConflictsAction(NbBundle.getMessage(MercurialAnnotator.class, "CTL_PopupMenuItem_Resolve"), ctx)); // NOI18N - IgnoreAction tempIA = new IgnoreAction(loc.getString("CTL_PopupMenuItem_Ignore"), ctx); // NOI18N - actions.add(tempIA); + if (!onlyProjects && !onlyFolders) { + IgnoreAction tempIA = new IgnoreAction(loc.getString("CTL_PopupMenuItem_Ignore"), ctx); // NOI18N + actions.add(tempIA); + } actions.add(null); actions.add(new PropertiesAction(loc.getString("CTL_PopupMenuItem_Properties"), ctx)); // NOI18N } else { @@ -430,7 +432,7 @@ public class MercurialAnnotator extends "CTL_PopupMenuItem_Revert"), ctx)); // NOI18N actions.add(new ResolveConflictsAction(NbBundle.getMessage(MercurialAnnotator.class, "CTL_PopupMenuItem_Resolve"), ctx)); // NOI18N - if (!onlyProjects) { + if (!onlyProjects && !onlyFolders) { actions.add(new ConflictResolvedAction(NbBundle.getMessage(MercurialAnnotator.class, "CTL_PopupMenuItem_MarkResolved"), ctx)); // NOI18N diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/ignore/Bundle.properties --- a/mercurial/src/org/netbeans/modules/mercurial/ui/ignore/Bundle.properties Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/ignore/Bundle.properties Fri Feb 08 15:48:36 2008 +0000 @@ -41,11 +41,11 @@ LBL_Ignore_Progress=Ignoring... MSG_IGNORE_TITLE = Mercurial Ignore MSG_IGNORE_TITLE_SEP = ---------------- -MSG_IGNORE_INIT_SEP_ONE = Ignoring {0} file in repository for {1}: -MSG_IGNORE_INIT_SEP = Ignoring {0} files in repository for {1}: +MSG_IGNORE_INIT_SEP = Ignoring the following in repository {0}: MSG_IGNORE_DONE = INFO: End of Ignore MSG_UNIGNORE_TITLE = Mercurial Unignore MSG_UNIGNORE_TITLE_SEP = ------------------ -MSG_UNIGNORE_INIT_SEP_ONE = Unignoring {0} file in repository for {1}: -MSG_UNIGNORE_INIT_SEP = Unignoring {0} files in repository for {1}: +MSG_UNIGNORE_INIT_SEP = Unignoring the following in repository {0}: MSG_UNIGNORE_DONE = INFO: End of Unignore + +MSG_IGNORE_ONLY_LOCALLY_NEW = Ignore is only supported for Locally New files. diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/ignore/IgnoreAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/ignore/IgnoreAction.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/ignore/IgnoreAction.java Fri Feb 08 15:48:36 2008 +0000 @@ -45,17 +45,17 @@ import java.util.logging.Level; import java.util.logging.Level; import org.netbeans.modules.mercurial.*; import org.netbeans.modules.mercurial.util.HgUtils; -import org.netbeans.modules.mercurial.util.HgProjectUtils; import org.netbeans.modules.versioning.spi.VCSContext; import org.openide.*; import org.openide.util.RequestProcessor; import org.openide.util.NbBundle; -import org.openide.nodes.Node; import java.io.File; import java.io.IOException; -import java.lang.String; import java.awt.event.ActionEvent; import javax.swing.*; +import org.netbeans.api.project.ProjectManager; +import org.netbeans.api.queries.SharabilityQuery; +import org.openide.filesystems.FileUtil; /** * Adds/removes files to repository .hgignore. @@ -65,7 +65,7 @@ public class IgnoreAction extends Abstra public class IgnoreAction extends AbstractAction { private final VCSContext context; - + private int mActionStatus; public static final int UNDEFINED = 0; public static final int IGNORING = 1; public static final int UNIGNORING = 2; @@ -82,13 +82,15 @@ public class IgnoreAction extends Abstra protected int getDirectoryEnabledStatus() { return FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY | FileInformation.STATUS_NOTVERSIONED_EXCLUDED; } - + public int getActionStatus(File [] files) { int actionStatus = -1; if (files.length == 0) return UNDEFINED; FileStatusCache cache = Mercurial.getInstance().getFileStatusCache(); for (int i = 0; i < files.length; i++) { - if (files[i].getName().equals(".hg")) { // NOI18N + if (files[i].getName().equals(".hg") || // NOI18N + files[i].isDirectory() || + SharabilityQuery.getSharability(files[i])== SharabilityQuery.NOT_SHARABLE) { actionStatus = UNDEFINED; break; } @@ -113,33 +115,42 @@ public class IgnoreAction extends Abstra return actionStatus == -1 ? UNDEFINED : actionStatus; } + @Override public boolean isEnabled() { - File[] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]); - return getActionStatus(files) != UNDEFINED; + Set ctxFiles = context != null? context.getRootFiles(): null; + final File repository = HgUtils.getRootFile(context); + if(repository == null || ctxFiles == null || ctxFiles.size() == 0) + return false; + return true; } public void actionPerformed(ActionEvent e) { if(!Mercurial.getInstance().isGoodVersionAndNotify()) return; - final File[] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]); - final int actionStatus = getActionStatus(files); - - if (actionStatus != IGNORING && actionStatus != UNIGNORING) { - throw new RuntimeException("Invalid action status: " + actionStatus); // NOI18N - } + final File repository = HgUtils.getRootFile(context); + if(repository == null) return; + Set ctxFiles = context != null? context.getRootFiles(): null; + if(ctxFiles == null || ctxFiles.size() == 0) return; + final File[] files = ctxFiles.toArray(new File[context.getRootFiles().size()]); - final File repository = HgUtils.getRootFile(context); - if (repository == null) return; - String projName = HgProjectUtils.getProjectName(repository); - if (projName == null) { - File projFile = HgUtils.getProjectFile(context); - projName = HgProjectUtils.getProjectName(projFile); - } - final String prjName = projName; RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository.getAbsolutePath()); HgProgressSupport support = new HgProgressSupport() { public void perform() { try { - if (actionStatus == IGNORING) { + mActionStatus = getActionStatus(files); + if (mActionStatus == UNDEFINED) { + HgUtils.outputMercurialTabInRed( + NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_TITLE")); // NOI18N + HgUtils.outputMercurialTabInRed( + NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_TITLE_SEP")); // NOI18N + HgUtils.outputMercurialTab( + NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_ONLY_LOCALLY_NEW")); // NOI18N + HgUtils.outputMercurialTabInRed( + NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_DONE")); // NOI18N + HgUtils.outputMercurialTab(""); // NOI18N + return; + } + + if (mActionStatus == IGNORING) { HgUtils.addIgnored(repository, files); HgUtils.outputMercurialTabInRed( NbBundle.getMessage(IgnoreAction.class, @@ -147,15 +158,9 @@ public class IgnoreAction extends Abstra HgUtils.outputMercurialTabInRed( NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_TITLE_SEP")); // NOI18N - if (files.length == 1) { - HgUtils.outputMercurialTab( - NbBundle.getMessage(IgnoreAction.class, - "MSG_IGNORE_INIT_SEP_ONE", files.length, prjName)); // NOI18N - } else { - HgUtils.outputMercurialTab( - NbBundle.getMessage(IgnoreAction.class, - "MSG_IGNORE_INIT_SEP", files.length, prjName)); // NOI18N - } + HgUtils.outputMercurialTab( + NbBundle.getMessage(IgnoreAction.class, + "MSG_IGNORE_INIT_SEP", repository.getName())); // NOI18N } else { HgUtils.removeIgnored(repository, files); HgUtils.outputMercurialTabInRed( @@ -164,15 +169,9 @@ public class IgnoreAction extends Abstra HgUtils.outputMercurialTabInRed( NbBundle.getMessage(IgnoreAction.class, "MSG_UNIGNORE_TITLE_SEP")); // NOI18N - if (files.length == 1) { - HgUtils.outputMercurialTab( - NbBundle.getMessage(IgnoreAction.class, - "MSG_UNIGNORE_INIT_SEP_ONE", files.length, prjName)); // NOI18N - } else { - HgUtils.outputMercurialTab( - NbBundle.getMessage(IgnoreAction.class, - "MSG_UNIGNORE_INIT_SEP", files.length, prjName)); // NOI18N - } + HgUtils.outputMercurialTab( + NbBundle.getMessage(IgnoreAction.class, + "MSG_UNIGNORE_INIT_SEP", repository.getName())); // NOI18N } } catch (IOException ex) { Mercurial.LOG.log(Level.FINE, "IgnoreAction(): File {0} - {1}", // NOI18N @@ -183,7 +182,7 @@ public class IgnoreAction extends Abstra Mercurial.getInstance().getFileStatusCache().refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN); HgUtils.outputMercurialTab("\t" + file.getAbsolutePath()); // NOI18N } - if (actionStatus == IGNORING) { + if (mActionStatus == IGNORING) { HgUtils.outputMercurialTabInRed( NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_DONE")); // NOI18N @@ -192,7 +191,7 @@ public class IgnoreAction extends Abstra NbBundle.getMessage(IgnoreAction.class, "MSG_UNIGNORE_DONE")); // NOI18N } - // HgUtils.outputMercurialTab(""); // NOI18N + HgUtils.outputMercurialTab(""); // NOI18N } }; support.start(rp, repository.getAbsolutePath(), org.openide.util.NbBundle.getMessage(IgnoreAction.class, "LBL_Ignore_Progress")); // NOI18N diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/log/DiffTreeTable.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/log/DiffTreeTable.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/log/DiffTreeTable.java Fri Feb 08 15:48:36 2008 +0000 @@ -83,6 +83,7 @@ class DiffTreeTable extends TreeTableVie tree.setCellRenderer(renderer); } + @SuppressWarnings("unchecked") private void setupColumns() { Node.Property [] columns = new Node.Property[4]; ResourceBundle loc = NbBundle.getBundle(DiffTreeTable.class); @@ -208,11 +209,13 @@ class DiffTreeTable extends TreeTableVie protected void addNotify() { refreshKeys(); } - + + @SuppressWarnings("unchecked") protected void removeNotify() { setKeys(Collections.EMPTY_SET); } + @SuppressWarnings("unchecked") private void refreshKeys() { setKeys(results); } diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/log/HgLogMessage.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/log/HgLogMessage.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/log/HgLogMessage.java Fri Feb 08 15:48:36 2008 +0000 @@ -80,10 +80,10 @@ public class HgLogMessage { splits = date.split(" "); this.date = new Date(Long.parseLong(splits[0]) * 1000); // UTC in miliseconds this.id = id; - this.mpaths = new ArrayList(); - this.apaths = new ArrayList(); - this.dpaths = new ArrayList(); - this.cpaths = new ArrayList(); + this.mpaths = new ArrayList(); + this.apaths = new ArrayList(); + this.dpaths = new ArrayList(); + this.cpaths = new ArrayList(); if( fm != null && !fm.equals("")){ splits = fm.split(" "); @@ -126,7 +126,7 @@ public class HgLogMessage { } public HgLogMessageChangedPath [] getChangedPaths(){ - List paths = new ArrayList(); + List paths = new ArrayList(); if(!mpaths.isEmpty()) paths.addAll(mpaths); if(!apaths.isEmpty()) paths.addAll(apaths); if(!dpaths.isEmpty()) paths.addAll(dpaths); diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/log/RevisionNode.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/log/RevisionNode.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/log/RevisionNode.java Fri Feb 08 15:48:36 2008 +0000 @@ -161,6 +161,7 @@ class RevisionNode extends AbstractNode private class UsernameProperty extends CommitNodeProperty { + @SuppressWarnings("unchecked") public UsernameProperty() { super(COLUMN_NAME_USERNAME, String.class, COLUMN_NAME_USERNAME, COLUMN_NAME_USERNAME); } @@ -176,6 +177,7 @@ class RevisionNode extends AbstractNode private class DateProperty extends CommitNodeProperty { + @SuppressWarnings("unchecked") public DateProperty() { super(COLUMN_NAME_DATE, String.class, COLUMN_NAME_DATE, COLUMN_NAME_DATE); } @@ -190,7 +192,8 @@ class RevisionNode extends AbstractNode } private class MessageProperty extends CommitNodeProperty { - + + @SuppressWarnings("unchecked") public MessageProperty() { super(COLUMN_NAME_MESSAGE, String.class, COLUMN_NAME_MESSAGE, COLUMN_NAME_MESSAGE); } diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java Fri Feb 08 15:48:36 2008 +0000 @@ -62,6 +62,7 @@ import java.text.DateFormat; import java.text.DateFormat; import java.util.List; import java.util.List; +import org.netbeans.api.editor.mimelookup.MimePath; import org.netbeans.modules.mercurial.ExceptionHandler; import org.netbeans.modules.mercurial.HgException; import org.netbeans.modules.mercurial.HgProgressSupport; @@ -97,7 +98,7 @@ class SummaryView implements MouseListen this.master = master; this.results = results; this.dispResults = expandResults(results); - FontColorSettings fcs = (FontColorSettings) MimeLookup.getMimeLookup("text/x-java").lookup(FontColorSettings.class); // NOI18N + FontColorSettings fcs = (FontColorSettings) MimeLookup.getLookup(MimePath.get("text/x-java")).lookup(FontColorSettings.class); // NOI18N searchHiliteAttrs = fcs.getFontColors("highlight-search"); // NOI18N message = master.getCriteria().getCommitMessage(); resultsList = new JList(new SummaryListModel()); @@ -136,6 +137,7 @@ class SummaryView implements MouseListen // not interested } + @SuppressWarnings("unchecked") private List expandResults(List results) { ArrayList newResults = new ArrayList(results.size()); for (RepositoryRevision repositoryRevision : results) { diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/pull/FetchAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/FetchAction.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/pull/FetchAction.java Fri Feb 08 15:48:36 2008 +0000 @@ -116,10 +116,6 @@ public class FetchAction extends Abstrac } public boolean isEnabled() { - File root = HgUtils.getRootFile(context); - if (root == null) - return false; - else - return true; + return HgUtils.getRootFile(context) != null; } } diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullAction.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullAction.java Fri Feb 08 15:48:36 2008 +0000 @@ -209,10 +209,7 @@ public class PullAction extends Abstract } public boolean isEnabled() { - Set ctxFiles = context != null? context.getRootFiles(): null; - if(HgUtils.getRootFile(context) == null || ctxFiles == null || ctxFiles.size() == 0) - return false; - return true; // #121293: Speed up menu display, warn user if not set when Pull selected + return HgUtils.getRootFile(context) != null; } static void performPull(PullType type, VCSContext ctx, File root, String pullPath, String fromPrjName, String toPrjName) { diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullOtherAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullOtherAction.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullOtherAction.java Fri Feb 08 15:48:36 2008 +0000 @@ -133,10 +133,6 @@ public class PullOtherAction extends Abs } public boolean isEnabled() { - File root = HgUtils.getRootFile(context); - if(root == null) - return false; - else - return true; + return HgUtils.getRootFile(context) != null; } } diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/push/PushOtherAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushOtherAction.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushOtherAction.java Fri Feb 08 15:48:36 2008 +0000 @@ -48,6 +48,7 @@ import java.util.List; import java.util.List; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; +import java.util.Set; import org.netbeans.modules.mercurial.HgException; import org.netbeans.modules.mercurial.HgProgressSupport; import org.netbeans.modules.mercurial.Mercurial; @@ -135,10 +136,9 @@ public class PushOtherAction extends Abs } public boolean isEnabled() { - File root = HgUtils.getRootFile(context); - if(root == null) + Set ctxFiles = context != null? context.getRootFiles(): null; + if(HgUtils.getRootFile(context) == null || ctxFiles == null || ctxFiles.size() == 0) return false; - else - return true; + return true; // #121293: Speed up menu display, warn user if not set when Push selected } } diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/status/StatusAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/status/StatusAction.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/status/StatusAction.java Fri Feb 08 15:48:36 2008 +0000 @@ -87,12 +87,7 @@ public class StatusAction extends Abstra } public boolean isEnabled() { - // If it's a mercurial managed repository enable action - File root = HgUtils.getRootFile(context); - if (root == null) - return false; - else - return true; + return HgUtils.getRootFile(context) != null; } /** diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/update/RevertModificationsAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/update/RevertModificationsAction.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/update/RevertModificationsAction.java Fri Feb 08 15:48:36 2008 +0000 @@ -173,6 +173,9 @@ public class RevertModificationsAction e } public boolean isEnabled() { - return HgUtils.getRootFile(context) != null; + Set ctxFiles = context != null? context.getRootFiles(): null; + if(HgUtils.getRootFile(context) == null || ctxFiles == null || ctxFiles.size() == 0) + return false; + return true; } } diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdateAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdateAction.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdateAction.java Fri Feb 08 15:48:36 2008 +0000 @@ -127,11 +127,6 @@ public class UpdateAction extends Abstra } public boolean isEnabled() { - // If it's a mercurial managed repository enable Update action - File root = HgUtils.getRootFile(context); - if (root == null) - return false; - else - return true; + return HgUtils.getRootFile(context) != null; } } diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/ui/view/ViewAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/view/ViewAction.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/view/ViewAction.java Fri Feb 08 15:48:36 2008 +0000 @@ -146,10 +146,6 @@ public class ViewAction extends Abstract } public boolean isEnabled() { - File root = HgUtils.getRootFile(context); - if (root == null) - return false; - else - return true; + return HgUtils.getRootFile(context) != null; } } diff -r 64509e0ef84e -r 66ae4a8aa636 mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java --- a/mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java Wed Feb 06 19:17:27 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java Fri Feb 08 15:48:36 2008 +0000 @@ -95,7 +95,9 @@ import org.netbeans.api.project.FileOwne import org.netbeans.api.project.FileOwnerQuery; import org.netbeans.api.project.ProjectManager; import org.netbeans.api.queries.SharabilityQuery; +import org.netbeans.modules.mercurial.HgProgressSupport; import org.openide.awt.HtmlBrowser; +import org.openide.util.RequestProcessor; import org.openide.util.Utilities; import org.openide.windows.OutputListener; @@ -148,7 +150,7 @@ public class HgUtils { public static List replaceHttpPassword(List list){ if(list == null) return null; - List out = new ArrayList(list.size()); + List out = new ArrayList(list.size()); for(String s: list){ out.add(replaceHttpPassword(s)); } @@ -304,7 +306,7 @@ public class HgUtils { if (checkSharability) { int sharability = SharabilityQuery.getSharability(file); if (sharability == SharabilityQuery.NOT_SHARABLE) return true; - } + } return false; }