@Override
    public void actionPerformed(ActionContext context) {
        int userChoice = OptionDialog.showOptionDialog( panel, "Remove All Fields?", 
            "There is no undo for this action.\n" +
            "Are you sure you want to remove all fields?", "Continue", 
            OptionDialog.WARNING_MESSAGE );
        if ( userChoice == OptionDialog.CANCEL_OPTION ) {
            return;
        }
        
    	panel.setTabLock( true );
    	
        FieldHeaderLocation loc = (FieldHeaderLocation) context.getContextObject();
        FieldFormatModel modelAtLocation = loc.getModel();
		modelAtLocation.removeAllFactories();
	}
Method called when the action is invoked.
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/format/actions/RemoveAllFieldsAction.java