--- Original/theme_editor/theme_editor.inc	2009-05-07 16:12:04.000000000 -0400
+++ Modified/theme_editor.inc	2010-09-06 22:05:20.000000000 -0400
@@ -214,6 +214,11 @@ function theme_editor_new_file_form($for
  	'#value' => 'Save File',
  	'#attributes'=>array('class'=>'theme_editor_save_button theme_editor_button'),
  	);
+ 	$form['file_editor_save_apply']= array(
+ 	'#type' =>'submit',
+ 	'#value' => 'Save & Apply',
+ 	'#attributes'=>array('class'=>'theme_editor_save_button theme_editor_button'),
+ 	);
  	return $form;
 }
 
@@ -412,6 +417,10 @@ if (!_file_write_theme_file($filedata,$f
 	drupal_set_message('File was not saved', 'error');
 }
 else {
+	if($form_state['values']['op'] == 'Save & Apply'){
+		$theme_to_change = end(explode("/", $form_state['values']['file_dir']));
+		save_and_apply($theme_to_change);
+	}	
 	drupal_set_message('File was saved successfully');
 	return 'test test';
 }
@@ -712,3 +721,23 @@ function theme_editor_build_file_tree($d
 		return array($out,$file);
 }
 
+function save_and_apply($theme_to_apply){
+	// Store list of previously enabled themes and disable all themes
+	$old_theme_list = $new_theme_list = array();
+	foreach (list_themes() as $theme) 
+	{
+		if ($theme->status) 
+		{
+			$old_theme_list[] = $theme->name;
+		}
+	}
+	variable_del('theme_default');
+	db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' AND name = '".$theme_to_apply."'");
+	$new_theme_list = array($theme_to_apply);
+	variable_set('theme_default', $theme_to_apply);
+	list_themes(TRUE);
+	menu_rebuild();
+	drupal_rebuild_theme_registry();
+	drupal_set_message(t('Theme successfully changed to '.$theme_to_apply.'.'));
+	module_invoke('locale', 'system_update', array_diff($new_theme_list, $old_theme_list));
+}
\ No newline at end of file
