in app/src/main/java/com/oracle/javafx/scenebuilder/app/DocumentWindowController.java [556:647]
public boolean canPerformControlAction(DocumentControlAction controlAction) {
final boolean result;
switch(controlAction) {
case COPY:
result = canPerformCopy();
break;
case SELECT_ALL:
result = canPerformSelectAll();
break;
case SELECT_NONE:
result = canPerformSelectNone();
break;
case SHOW_SAMPLE_CONTROLLER:
result = editorController.getFxomDocument() != null;
break;
case TOGGLE_LIBRARY_PANEL:
case TOGGLE_DOCUMENT_PANEL:
case TOGGLE_CSS_PANEL:
case TOGGLE_LEFT_PANEL:
case TOGGLE_RIGHT_PANEL:
case TOGGLE_OUTLINES_VISIBILITY:
case TOGGLE_GUIDES_VISIBILITY:
case SHOW_PREVIEW_WINDOW:
result = true;
break;
case SHOW_PREVIEW_DIALOG:
final FXOMDocument fxomDocument = editorController.getFxomDocument();
if (fxomDocument != null) {
Object sceneGraphRoot = fxomDocument.getSceneGraphRoot();
return sceneGraphRoot instanceof DialogPane;
}
result = false;
break;
case SAVE_FILE:
result = isDocumentDirty()
|| editorController.getFxomDocument().getLocation() == null; // Save new empty document
break;
case SAVE_AS_FILE:
case CLOSE_FILE:
result = true;
break;
case REVERT_FILE:
result = isDocumentDirty()
&& editorController.getFxomDocument().getLocation() != null;
break;
case REVEAL_FILE:
result = (editorController.getFxomDocument() != null)
&& (editorController.getFxomDocument().getLocation() != null);
break;
case GOTO_CONTENT:
case GOTO_PROPERTIES:
case GOTO_LAYOUT:
case GOTO_CODE:
result = true;
break;
case ADD_SCENE_STYLE_SHEET:
result = true;
break;
case SET_RESOURCE:
result = true;
break;
case REMOVE_RESOURCE:
case REVEAL_RESOURCE:
result = resourceController.getResourceFile() != null;
break;
case HELP:
result = true;
break;
default:
result = false;
assert false;
break;
}
return result;
}