public AntHectorConfigurable(XmlFile file) {
   myFile = file;
   myProject = file.getProject();
   final VirtualFile selfVFile = myFile.getVirtualFile();
   myLocalPath = PathUtil.getLocalPath(selfVFile);
   myFileFilter = GlobalSearchScope.projectScope(myProject);
 }
 /**
  * @param xmlFile
  * @return True if the file is contained within 'OSGI-INF/blueprint'
  */
 private boolean isInsideOsgiInfBlueprint(XmlFile xmlFile) {
   String localPath = PathUtil.getLocalPath(xmlFile.getVirtualFile());
   if (localPath == null) return false;
   String parentPath = PathUtil.getParentPath(localPath);
   return parentPath.endsWith("OSGI-INF\\blueprint") || parentPath.endsWith("OSGI-INF/blueprint");
 }
 private static String getFSPath(VirtualFile output) {
   return PathUtil.getLocalPath(output);
 }
 @Nullable
 protected String getDefaultWorkingDir(@NotNull Project project) {
   return PathUtil.getLocalPath(project.getBaseDir());
 }
 public GroovyScriptRunConfiguration(
     final String name, final Project project, final ConfigurationFactory factory) {
   super(name, new RunConfigurationModule(project), factory);
   workDir = PathUtil.getLocalPath(project.getBaseDir());
 }
  public JComponent createComponent() {
    final JPanel panel = new JPanel(new GridBagLayout());
    panel.setBorder(IdeBorderFactory.createTitledBorder("File Context", false));
    myCombo = new ComboBox();
    myCombo.putClientProperty(CONTEXTS_COMBO_KEY, Boolean.TRUE);
    panel.add(
        new JLabel("Included into:"),
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 0, 5, 0),
            0,
            0));
    panel.add(
        myCombo,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 0),
            0,
            0));

    final PsiManager psiManager = PsiManager.getInstance(myProject);
    final FileBasedIndex fbi = FileBasedIndex.getInstance();
    final Collection<VirtualFile> antFiles =
        fbi.getContainingFiles(
            AntImportsIndex.INDEX_NAME, AntImportsIndex.ANT_FILES_WITH_IMPORTS_KEY, myFileFilter);

    for (VirtualFile file : antFiles) {
      final PsiFile psiFile = psiManager.findFile(file);
      if (!(psiFile instanceof XmlFile)) {
        continue;
      }
      final XmlFile xmlFile = (XmlFile) psiFile;
      if (!xmlFile.equals(myFile) && AntDomFileDescription.isAntFile(xmlFile)) {
        final String path = PathUtil.getLocalPath(file);
        final XmlFile previous = myPathToFileMap.put(path, xmlFile);
        assert previous == null;
      }
    }

    final List<String> paths = new ArrayList<String>(myPathToFileMap.keySet());
    Collections.sort(
        paths,
        new Comparator<String>() {
          public int compare(final String o1, final String o2) {
            return o1.compareTo(o2);
          }
        });

    myCombo.addItem(NONE);
    for (String path : paths) {
      myCombo.addItem(path);
    }

    final AntConfigurationBase antConfig = AntConfigurationBase.getInstance(myProject);
    final XmlFile currentContext = antConfig.getContextFile(myFile);
    if (currentContext != null) {
      final VirtualFile vFile = currentContext.getVirtualFile();

      assert vFile != null;

      final String path = PathUtil.getLocalPath(vFile);
      if (!FileUtil.pathsEqual(path, myLocalPath)) {
        myOriginalContext = path;
      }
    }
    myCombo.setSelectedItem(myOriginalContext);

    return panel;
  }