private static void initializeRuntimesFromDefinitionFile(IProgressMonitor monitor) {
    final Set<RuntimePath> runtimePaths = parseRuntimeLocationsFile();
    for (RuntimePath runtimePath : runtimePaths) {
      RuntimeInitializerUtil.createRuntimeDefinitions(runtimePath, monitor);
    }

    if (runtimePaths.size() > 0) {
      HashSet<RuntimePath> set =
          new HashSet<RuntimePath>(
              Arrays.asList(RuntimeUIActivator.getDefault().getModel().getRuntimePaths()));
      set.addAll(runtimePaths);
      RuntimeUIActivator.getDefault()
          .getModel()
          .setRuntimePaths(set.toArray(new RuntimePath[set.size()]));
    }
  }
 private static File getRelativeDirectory(String dir) {
   try {
     String configuration = getConfiguration();
     File directory = new File(configuration, dir);
     return directory;
   } catch (IOException ioe) {
     RuntimeUIActivator.pluginLog().logError(ioe);
   }
   return null;
 }
 private static void initializeUserHomeRuntimes(IProgressMonitor monitor) {
   String userHome = System.getProperty(USER_HOME);
   if (userHome != null) {
     File directory = new File(userHome, JBOSS_RUNTIMES);
     if (directory.isDirectory()) {
       RuntimeInitializerUtil.initializeRuntimesFromFolder(directory, monitor);
     }
     RuntimePath path = new RuntimePath(directory.getAbsolutePath());
     path.setScanOnEveryStartup(true);
     RuntimeUIActivator.getDefault().getModel().addRuntimePath(path);
   }
 }
  private static File findRuntimeFile() {
    try {
      String pluginLocation =
          FileLocator.resolve(RuntimeUIActivator.getDefault().getBundle().getEntry("/"))
              .getPath(); //$NON-NLS-1$
      File serversFile = new File(pluginLocation, LOCATIONS_FILE);

      if (!serversFile.isFile()) {
        String configuration = getConfiguration();
        serversFile = new File(configuration, LOCATIONS_FILE_CONFIGURATION).getCanonicalFile();
      } else {
        serversFile = serversFile.getCanonicalFile();
      }
      if (!serversFile.isFile()) {
        serversFile = new File(pluginLocation, LOCATIONS_FILE_NAME);
      }
      if (serversFile.isFile()) {
        return serversFile;
      }
    } catch (IOException ioe) {
      RuntimeUIActivator.pluginLog().logError(ioe);
    }
    return null;
  }