@FXML
  void chooseStylesheet(ActionEvent event) {

    String[] extensions = {"*.css"}; // NOI18N
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle(I18N.getString("inspector.select.css.title"));
    fileChooser
        .getExtensionFilters()
        .add(
            new FileChooser.ExtensionFilter(
                I18N.getString("inspector.select.css.filter"), Arrays.asList(extensions)));
    File file = fileChooser.showOpenDialog(root.getScene().getWindow());
    if ((file == null)) {
      return;
    }
    URL url;
    try {
      url = file.toURI().toURL();
    } catch (MalformedURLException ex) {
      throw new RuntimeException("Invalid URL", ex); // NOI18N
    }
    if (alreadyUsed(url.toExternalForm())) {
      System.err.println(
          I18N.getString("inspector.stylesheet.alreadyexist", url)); // should go to message panel
      return;
    }

    switchToItemList();
    // Add editor item
    String urlStr;
    if (fxmlFileLocation != null) {
      // If the document exists, make the type as document relative by default.
      urlStr = PrefixedValue.makePrefixedValue(url, fxmlFileLocation).toString();
      switchType(Type.DOCUMENT_RELATIVE_PATH);
    } else {
      urlStr = url.toExternalForm();
      switchType(Type.PLAIN_STRING);
    }
    addItem(new StylesheetItem(this, urlStr));

    // Workaround for RT-34863: Reload of an updated css file has no effect.
    // This reset the whole CSS from top. Would need to be moved on the FXOM side.
    Deprecation.reapplyCSS(root.getScene());

    userUpdateValueProperty(getValue());
  }
 private void switchType(Type type) {
   this.type = type;
   updateMenuItems();
   for (EditorItem editorItem : getEditorItems()) {
     assert editorItem instanceof StylesheetItem;
     StylesheetItem stylesheetItem = (StylesheetItem) editorItem;
     URL url = EditorUtils.getUrl(stylesheetItem.getValue(), fxmlFileLocation);
     String value = null;
     if ((url == null) || (type == Type.CLASSLOADER_RELATIVE_PATH)) {
       // In this case we empty the text field (i.e. suffix) content
       value = new PrefixedValue(type, "").toString(); // NOI18N
     } else if (type == Type.PLAIN_STRING) {
       value = url.toExternalForm();
     } else if (type == Type.DOCUMENT_RELATIVE_PATH) {
       value = PrefixedValue.makePrefixedValue(url, fxmlFileLocation).toString();
     }
     stylesheetItem.setValue(value);
     commit(stylesheetItem);
   }
 }