com.intellij.openapi.vfs.VirtualFilejava.util.List



Project JetBrains/intellij-community in file ....idea.svn.history.SvnCommittedChangesProvider.java (2007-07-16)
@@ -23,11 +23,10 @@ import com.intellij.openapi.vcs.*;
 import com.intellij.openapi.vcs.history.VcsRevisionNumber;
 import com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings;
 import com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor;
-import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.Nullable;
 import org.jetbrains.idea.svn.SvnBundle;
-import org.jetbrains.idea.svn.SvnVcs;
 import org.jetbrains.idea.svn.SvnUtil;
-import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.SvnVcs;
 import org.tmatesoft.svn.core.ISVNLogEntryHandler;
 import org.tmatesoft.svn.core.SVNException;
 import org.tmatesoft.svn.core.SVNLogEntry;
@@ -36,11 +35,13 @@ import org.tmatesoft.svn.core.io.SVNRepository;
 import org.tmatesoft.svn.core.wc.SVNLogClient;
 import org.tmatesoft.svn.core.wc.SVNRevision;
 
-import java.util.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.DataOutput;
 import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
 
 /**
  * @author yole
@@ -61,9 +62,9 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
   }
 
   @Nullable
-  public RepositoryLocation getLocationFor(final VirtualFile root) {
+  public RepositoryLocation getLocationFor(final FilePath root) {
     final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
-    String[] urls = SvnUtil.getLocationsForModule(SvnVcs.getInstance(myProject), new File(root.getPath()), progress);
+    String[] urls = SvnUtil.getLocationsForModule(SvnVcs.getInstance(myProject), root.getIOFile(), progress);
     if (urls.length == 1) {
       return new SvnRepositoryLocation(root, urls [0]);
     }
Project JetBrains/intellij-community in file ...etbrains.idea.maven.dom.MavenPropertyResolver.java (2009-07-09)
@@ -2,16 +2,15 @@ package org.jetbrains.idea.maven.dom;
 
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.xml.XmlTag;
 import com.intellij.util.xml.DomFileElement;
-import com.intellij.util.xml.GenericDomValue;
 import com.intellij.util.xml.DomUtil;
+import com.intellij.util.xml.GenericDomValue;
 import org.apache.commons.beanutils.BeanAccessLanguageException;
 import org.apache.commons.beanutils.BeanUtils;
+import org.jetbrains.idea.maven.dom.model.MavenDomProfile;
 import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
 import org.jetbrains.idea.maven.dom.model.MavenDomProperties;
-import org.jetbrains.idea.maven.dom.model.MavenDomProfile;
 import org.jetbrains.idea.maven.embedder.MavenEmbedderFactory;
 import org.jetbrains.idea.maven.project.MavenProject;
 import org.jetbrains.idea.maven.project.MavenProjectsManager;
@@ -19,6 +18,7 @@ import org.jetbrains.idea.maven.project.MavenProjectsManager;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Properties;
 import java.util.Stack;
+import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -41,34 +41,31 @@ public class MavenPropertyResolver {
     if (text == null) return null;
 
     DomFileElement<MavenDomProjectModel> dom = DomUtil.getFileElement(value);
-    return resolve(text, dom);
+    return resolve(text, dom.getRootElement());
   }
 
-  public static String resolve(String text, DomFileElement<MavenDomProjectModel> dom) {
-    VirtualFile file = dom.getOriginalFile().getVirtualFile();
-    MavenProjectsManager manager = MavenProjectsManager.getInstance(dom.getFile().getProject());
-    MavenProject mavenProject = manager.findProject(file);
+  public static String resolve(String text, MavenDomProjectModel projectDom) {
+    MavenProject mavenProject = MavenDomUtil.findProject(projectDom);
     if (mavenProject == null) return text;
-
-    return doResolve(text, mavenProject, collectPropertiesFromDOM(mavenProject, dom), null, null, new Stack<String>());
+    return doResolve(text, mavenProject, collectPropertiesFromDOM(mavenProject, projectDom), null, null, new Stack<String>());
   }
 
-  private static Properties collectPropertiesFromDOM(MavenProject project, DomFileElement<MavenDomProjectModel> dom) {
+  private static Properties collectPropertiesFromDOM(MavenProject project, MavenDomProjectModel projectDom) {
     Properties result = new Properties();
 
-    MavenDomProjectModel mavenModel = dom.getRootElement();
-    collectPropertiesFromDOM(result, mavenModel.getProperties());
+    collectPropertiesFromDOM(projectDom.getProperties(), result);
 
-    for (MavenDomProfile each : mavenModel.getProfiles().getProfiles()) {
-      String id = each.getId().getStringValue();
-      if (id == null || !project.getActiveProfilesIds().contains(id)) continue;
-      collectPropertiesFromDOM(result, each.getProperties());
+    List<String> activePropfiles = project.getActiveProfilesIds();
+    for (MavenDomProfile each : projectDom.getProfiles().getProfiles()) {
+      XmlTag idTag = each.getId().getXmlTag();
+      if (idTag == null || !activePropfiles.contains(idTag.getValue().getText())) continue;
+      collectPropertiesFromDOM(each.getProperties(), result);
     }
 
     return result;
   }
 
-  private static void collectPropertiesFromDOM(Properties result, MavenDomProperties props) {
+  private static void collectPropertiesFromDOM(MavenDomProperties props, Properties result) {
     XmlTag propsTag = props.getXmlTag();
     if (propsTag != null) {
       for (XmlTag each : propsTag.getSubTags()) {
Project JetBrains/intellij-community in file ...nfiguration.actions.ToggleExcludedStateAction.java (2012-03-01)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2012 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,18 +18,18 @@ package com.intellij.openapi.roots.ui.configuration.actions;
 
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.project.ProjectBundle;
 import com.intellij.openapi.roots.ExcludeFolder;
 import com.intellij.openapi.roots.ui.configuration.ContentEntryEditor;
 import com.intellij.openapi.roots.ui.configuration.ContentEntryTreeEditor;
 import com.intellij.openapi.roots.ui.configuration.IconSet;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.project.ProjectBundle;
 
 import javax.swing.*;
+import java.util.List;
 
 /**
  * @author Eugene Zhuravlev
- * Date: Oct 14 2003
+ * @since Oct 14, 2003
  */
 public class ToggleExcludedStateAction extends ContentEntryEditingAction {
   private final ContentEntryTreeEditor myEntryTreeEditor;
@@ -43,23 +43,25 @@ public class ToggleExcludedStateAction extends ContentEntryEditingAction {
     templatePresentation.setIcon(IconSet.EXCLUDE_FOLDER);
   }
 
-  public boolean isSelected(AnActionEvent e) {
-    final VirtualFile[] selectedFiles = getSelectedFiles();
-    if (selectedFiles == null || selectedFiles.length == 0) {
-      return false;
-    }
-    final ContentEntryEditor contentEntryEditor = myEntryTreeEditor.getContentEntryEditor();
-    return contentEntryEditor.isExcluded(selectedFiles[0]) || contentEntryEditor.isUnderExcludedDirectory(selectedFiles[0]);
+  @Override
+  public boolean isSelected(final AnActionEvent e) {
+    final List<String> selectedPaths = getSelectedPaths();
+    if (selectedPaths.size() == 0) return false;
+
+    final ContentEntryEditor editor = myEntryTreeEditor.getContentEntryEditor();
+    return editor.isExcluded(selectedPaths.get(0)) || editor.isUnderExcludedDirectory(selectedPaths.get(0));
   }
 
-  public void setSelected(AnActionEvent e, boolean isSelected) {
-    final VirtualFile[] selectedFiles = getSelectedFiles();
-    assert selectedFiles != null && selectedFiles.length > 0;
-    for (VirtualFile selectedFile : selectedFiles) {
-      final ExcludeFolder excludeFolder = myEntryTreeEditor.getContentEntryEditor().getExcludeFolder(selectedFile);
+  @Override
+  public void setSelected(final AnActionEvent e, final boolean isSelected) {
+    final List<String> selectedPaths = getSelectedPaths();
+    assert selectedPaths.size() != 0;
+
+    for (String selectedPath : selectedPaths) {
+      final ExcludeFolder excludeFolder = myEntryTreeEditor.getContentEntryEditor().getExcludeFolder(selectedPath);
       if (isSelected) {
         if (excludeFolder == null) { // not excluded yet
-          myEntryTreeEditor.getContentEntryEditor().addExcludeFolder(selectedFile);
+          myEntryTreeEditor.getContentEntryEditor().addExcludeFolder(selectedPath);
         }
       }
       else {
@@ -70,10 +72,10 @@ public class ToggleExcludedStateAction extends ContentEntryEditingAction {
     }
   }
 
-  public void update(AnActionEvent e) {
+  @Override
+  public void update(final AnActionEvent e) {
     super.update(e);
     final Presentation presentation = e.getPresentation();
     presentation.setText(ProjectBundle.message("module.toggle.excluded.action"));
   }
-
 }
Project JetBrains/intellij-community in file ...onfiguration.actions.ToggleSourcesStateAction.java (2012-03-01)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2012 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,18 +18,18 @@ package com.intellij.openapi.roots.ui.configuration.actions;
 
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.project.ProjectBundle;
 import com.intellij.openapi.roots.SourceFolder;
 import com.intellij.openapi.roots.ui.configuration.ContentEntryEditor;
 import com.intellij.openapi.roots.ui.configuration.ContentEntryTreeEditor;
 import com.intellij.openapi.roots.ui.configuration.IconSet;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.project.ProjectBundle;
 
 import javax.swing.*;
+import java.util.List;
 
 /**
  * @author Eugene Zhuravlev
- * Date: Oct 14 2003
+ * @since Oct 14, 2003
  */
 public class ToggleSourcesStateAction extends ContentEntryEditingAction {
   private final ContentEntryTreeEditor myEntryTreeEditor;
@@ -52,29 +52,31 @@ public class ToggleSourcesStateAction extends ContentEntryEditingAction {
     }
   }
 
-  public boolean isSelected(AnActionEvent e) {
-    final VirtualFile[] selectedFiles = getSelectedFiles();
-    if (selectedFiles == null || selectedFiles.length == 0) {
-      return false;
-    }
-    final ContentEntryEditor contentEntryEditor = myEntryTreeEditor.getContentEntryEditor();
-    return myEditTestSources? contentEntryEditor.isTestSource(selectedFiles[0]) : contentEntryEditor.isSource(selectedFiles[0]);
+  @Override
+  public boolean isSelected(final AnActionEvent e) {
+    final List<String> selectedPaths = getSelectedPaths();
+    if (selectedPaths.size() == 0) return false;
+
+    final ContentEntryEditor editor = myEntryTreeEditor.getContentEntryEditor();
+    return myEditTestSources ? editor.isTestSource(selectedPaths.get(0)) : editor.isSource(selectedPaths.get(0));
   }
 
-  public void setSelected(AnActionEvent e, boolean isSelected) {
-    final VirtualFile[] selectedFiles = getSelectedFiles();
-    assert selectedFiles != null && selectedFiles.length != 0;
+  @Override
+  public void setSelected(final AnActionEvent e, final boolean isSelected) {
+    final List<String> selectedPaths = getSelectedPaths();
+    assert selectedPaths.size() != 0;
+
     final ContentEntryEditor contentEntryEditor = myEntryTreeEditor.getContentEntryEditor();
-    for (VirtualFile selectedFile : selectedFiles) {
-      final SourceFolder sourceFolder = contentEntryEditor.getSourceFolder(selectedFile);
+    for (String selectedPath : selectedPaths) {
+      final SourceFolder sourceFolder = contentEntryEditor.getSourceFolder(selectedPath);
       if (isSelected) {
         if (sourceFolder == null) { // not marked yet
-          contentEntryEditor.addSourceFolder(selectedFile, myEditTestSources);
+          contentEntryEditor.addSourceFolder(selectedPath, myEditTestSources);
         }
         else {
-          if (myEditTestSources? !sourceFolder.isTestSource() : sourceFolder.isTestSource()) {
+          if (myEditTestSources != sourceFolder.isTestSource()) {
             contentEntryEditor.removeSourceFolder(sourceFolder);
-            contentEntryEditor.addSourceFolder(selectedFile, myEditTestSources);
+            contentEntryEditor.addSourceFolder(selectedPath, myEditTestSources);
           }
         }
       }
@@ -86,11 +88,10 @@ public class ToggleSourcesStateAction extends ContentEntryEditingAction {
     }
   }
 
-  public void update(AnActionEvent e) {
+  @Override
+  public void update(final AnActionEvent e) {
     super.update(e);
     final Presentation presentation = e.getPresentation();
-    presentation.setText(myEditTestSources
-                         ? ProjectBundle.message("module.toggle.test.sources.action")
-                         : ProjectBundle.message("module.toggle.sources.action"));
+    presentation.setText(ProjectBundle.message(myEditTestSources ? "module.toggle.test.sources.action" : "module.toggle.sources.action"));
   }
 }
Project JetBrains/intellij-community in file ...t4idea.src.git4idea.repo.GitRepositoryManager.java (2015-01-16)
@@ -17,34 +17,36 @@ package git4idea.repo;
 
 import com.intellij.dvcs.branch.DvcsSyncSettings;
 import com.intellij.dvcs.repo.AbstractRepositoryManager;
+import com.intellij.dvcs.repo.VcsRepositoryManager;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vcs.ProjectLevelVcsManager;
-import com.intellij.openapi.vfs.VirtualFile;
 import git4idea.GitPlatformFacade;
 import git4idea.GitUtil;
 import git4idea.ui.branch.GitMultiRootBranchConfig;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.List;
+
 public class GitRepositoryManager extends AbstractRepositoryManager<GitRepository> {
 
   @NotNull private final GitPlatformFacade myPlatformFacade;
+  @NotNull private final Project myProject;
 
   public GitRepositoryManager(@NotNull Project project, @NotNull GitPlatformFacade platformFacade,
-                              @NotNull ProjectLevelVcsManager vcsManager) {
-    super(project, vcsManager, platformFacade.getVcs(project), GitUtil.DOT_GIT);
+                              @NotNull VcsRepositoryManager vcsRepositoryManager) {
+    super(vcsRepositoryManager, platformFacade.getVcs(project), GitUtil.DOT_GIT);
+    myProject = project;
     myPlatformFacade = platformFacade;
   }
 
-  @NotNull
-  @Override
-  protected GitRepository createRepository(@NotNull VirtualFile root) {
-    return GitRepositoryImpl.getFullInstance(root, myProject, myPlatformFacade, this);
-  }
-
   @Override
   public boolean isSyncEnabled() {
     return myPlatformFacade.getSettings(myProject).getSyncSetting() == DvcsSyncSettings.Value.SYNC &&
            !new GitMultiRootBranchConfig(getRepositories()).diverged();
   }
 
+  @NotNull
+  @Override
+  public List<GitRepository> getRepositories() {
+    return getRepositories(GitRepository.class);
+  }
 }