/**
   * Create the file system selection area.
   *
   * @param composite
   * @param enabled the initial enablement state.
   */
  private void createFileSystemSelection(Composite composite, boolean enabled) {

    // Always use the default if that is all there is.
    if (FileSystemSupportRegistry.getInstance().hasOneFileSystem()) {
      return;
    }

    fileSystemSelectionArea = new FileSystemSelectionArea();
    fileSystemSelectionArea.createContents(composite);
    fileSystemSelectionArea.setEnabled(enabled);
  }
 /**
  * Update the filesystem selector, if possible.
  *
  * @param newPath The new path to be set.
  */
 private void updateFilesystemSelector(String newPath) {
   try {
     URI selectedURI = new URI(newPath);
     String scheme = selectedURI.getScheme();
     try {
       if (scheme == null) {
         fileSystemSelectionArea.setSelectedFileSystem("local"); // $NON-NLS-1$
       } else {
         fileSystemSelectionArea.setSelectedFileSystem(scheme);
       }
     } catch (CoreException e) {
       // Probably an unrecognized scheme. Don't change the setting of
       // the filesystem selector.
     }
   } catch (URISyntaxException e) {
     // This error can be ignored because we just won't set the
     // filesystem selector
     // to a anything
   }
 }
  /** Open an appropriate directory browser */
  private void handleURIBrowseButtonPressed() {

    String selectedResource = null;
    String path = getURIText().getText();
    FileSystemElement fileSystem = fileSystemSelectionArea.getSelectedFileSystem();

    IRemoteResourceSelectorProxy resourceSelector = fileSystem.getSelectorProxy();
    if (resourceSelector != null) {
      switch (resourceType) {
        case FILE:
          {
            URI uri =
                resourceSelector.selectFile(
                    fileSystem.getScheme(),
                    path,
                    ResourceSelectorWidgetMessages.ResourceSelectorWidget_select + sectionLabelText,
                    browseButton.getShell());
            if (uri != null) {
              selectedResource = uri.toString();
            }
            break;
          }
        case DIRECTORY:
          {
            URI uri =
                resourceSelector.selectDirectory(
                    fileSystem.getScheme(),
                    path,
                    ResourceSelectorWidgetMessages.ResourceSelectorWidget_select + sectionLabelText,
                    browseButton.getShell());
            if (uri != null) {
              selectedResource = uri.toString();
            }
            break;
          }
        default:
          ProfileLaunchPlugin.log(
              IStatus.ERROR,
              ResourceSelectorWidgetMessages.ResourceSelectorWidget_unrecognized_resourceType);
          return;
      }
    } else {
      ProfileLaunchPlugin.log(
          IStatus.ERROR,
          ResourceSelectorWidgetMessages.ResourceSelectorWidget_getSelectorProxy_returned_null);
    }

    if (selectedResource != null) {
      updateURIField(selectedResource);
    }
  }
 public void setEnabled(boolean enabled) {
   if (mainComp != null) {
     mainComp.setEnabled(enabled);
   }
   if (uriLabel != null) {
     uriLabel.setEnabled(enabled);
   }
   if (browseButton != null) {
     browseButton.setEnabled(enabled);
   }
   if (uriField != null) {
     uriField.setEnabled(enabled);
   }
   if (fileSystemSelectionArea != null) {
     fileSystemSelectionArea.setEnabled(enabled);
   }
 }
 /**
  * Return the selected configuration or <code>null</code> if there is not one selected.
  *
  * @return FileSystemConfiguration or <code>null</code>
  */
 private FileSystemConfiguration getSelectedConfiguration() {
   if (fileSystemSelectionArea == null) {
     return null;
   }
   return fileSystemSelectionArea.getSelectedConfiguration();
 }
 /**
  * Create the file system selection area.
  *
  * @param composite Parent composite
  */
 private void createFileSystemSelection(Composite composite) {
   fileSystemSelectionArea = new FileSystemSelectionArea();
   fileSystemSelectionArea.createContents(composite);
 }