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); } }
@Override public void requestFocus() { EditorItem firstItem = getEditorItems().get(0); assert firstItem instanceof StylesheetItem; ((StylesheetItem) firstItem).requestFocus(); }