Removes old menu items and saves new menu items
488308
public function actionDelete ()
		{
			if (Yii::$app->request->isAjax)
			{
				$id = Yii::$app->request->post('id');
				$menu = Menu::findOne($id);
				if ($menu !== null)
				{
					if (!$menu->deleteWithChildren())
						echo Json::encode(current($menu->firstErrors));
					else
						echo 0;
				}
			}
			Yii::$app->end();
		}
29935
def _insert_options(self, menu):
        """"""
        menu.append(Gtk.SeparatorMenuItem())
        menu.append(self._menuitem(
            _('Mount disc image'),
            self._icons.get_icon('losetup', Gtk.IconSize.MENU),
            run_bg(lambda _: self._losetup())
        ))
        menu.append(Gtk.SeparatorMenuItem())
        menu.append(self._menuitem(
            _("Enable automounting"),
            icon=None,
            onclick=lambda _: self._daemon.automounter.toggle_on(),
            checked=self._daemon.automounter.is_on(),
        ))
        menu.append(self._menuitem(
            _("Enable notifications"),
            icon=None,
            onclick=lambda _: self._daemon.notify.toggle(),
            checked=self._daemon.notify.active,
        ))
        # append menu item for closing the application
        if self._quit_action:
            menu.append(Gtk.SeparatorMenuItem())
            menu.append(self._menuitem(
                _('Quit'),
                self._icons.get_icon('quit', Gtk.IconSize.MENU),
                lambda _: self._quit_action()
            ))
1229976
private void updateRecentMenu() {
		menu.removeAllMenuItems();

		int index = 1;
		boolean first = true;

		for (Iterator<ExampleData> i = recent.iterator(); i.hasNext();) {
			ExampleData data = i.next();

			try {
				StringBuilder builder = new StringBuilder(Integer.toString(index++)).append(". ");

				if (data.getExampleGroupName() != null) {
					builder.append(data.getExampleGroupName()).append(" - ");
				}

				builder.append(data.getExampleName());
				addRecentExample(builder.toString(), data, first);
				first = false;
			} catch (Exception e) {
				i.remove();
				LogFactory.getLog(getClass()).error("Unable to read recent class: " + data.getExampleName());
			}
		}
	}
828564
def clear(self):
        """"""
        with self.lock:
            self.data.clear()
            self.items.clear()
1227668
def buffer_menu
      menu = PromptMenu.new self do
        item :n, :buffer_next
        item :p, :buffer_prev
        item :b, :scroll_backward
        item :f, :scroll_forward
        item :l, :list_buffers
        item :q, :close
        submenu :m, "submenu..." do
          item :p, :goto_last_position
          item :r, :scroll_right
          item :l, :scroll_left
        end
      end
      menu.display_new :title => "Buffer Menu"
    end
557457
def _bin_update_items(self, items, replace_at_most_one,
                          replacements, leftovers):
        
        for key, values in items:
            # <values> is not a list or an empty list.
            like_list_not_str = self._quacks_like_a_list_but_not_str(values)
            if not like_list_not_str or (like_list_not_str and not values):
                values = [values]

            for value in values:
                # If the value is [], remove any existing leftovers with
                # key <key> and set the list of values itself to [],
                # which in turn will later delete <key> when [] is
                # passed to omdict.setlist() in
                # omdict._update_updateall().
                if value == []:
                    replacements[key] = []
                    leftovers[:] = [l for l in leftovers if key != l[0]]
                    continue

                # If there are existing items with key <key> that have
                # yet to be marked for replacement, mark that item's
                # value to be replaced by <value> by appending it to
                # <replacements>.  TODO: Refactor for clarity
                if (key in self and
                    (key not in replacements or
                     (key in replacements and
                      replacements[key] == []))):
                    replacements[key] = [value]
                elif (key in self and not replace_at_most_one and
                      len(replacements[key]) < len(self.values(key))):
                    replacements[key].append(value)
                else:
                    if replace_at_most_one:
                        replacements[key] = [value]
                    else:
                        leftovers.append((key, value))
659387
def __setup_menu(self):
        """"""
        self.menu.clear()
        if self.data:
            actions = self.menu_actions
        else:
            actions = (self.new_action, self.open_action)
            self.setFocus() # --> Editor.__get_focus_editortabwidget
        add_actions(self.menu, list(actions) + self.__get_split_actions())
        self.close_action.setEnabled(self.is_closable)
1110932
def _cleanup(self):
        """"""
        current_time = time.time()
        timeout = self._config.timeout
        if current_time - self._last_cleanup_time > timeout:
            self.store.cleanup(timeout)
            self._last_cleanup_time = current_time
581296
public function removeCachedMenu()
    {
        $menuTypeIds = $this->menu_items()->pluck('menu_type_id')->unique()->all();

        foreach ( $menuTypeIds as $menuTypeId ) {
            MenuHelper::clearCache($menuTypeId, app()->getLocale());
        }
    }
931190
def setup_menu_actions(self):
        """"""
        self.recent_project_menu.clear()
        self.recent_projects_actions = []
        if self.recent_projects:
            for project in self.recent_projects:
                if self.is_valid_project(project):
                    name = project.replace(get_home_dir(), '~')
                    action = create_action(
                        self,
                        name,
                        icon=ima.icon('project'),
                        triggered=(
                            lambda _, p=project: self.open_project(path=p))
                        )
                    self.recent_projects_actions.append(action)
                else:
                    self.recent_projects.remove(project)
            self.recent_projects_actions += [None,
                                             self.clear_recent_projects_action]
        else:
            self.recent_projects_actions = [self.clear_recent_projects_action]
        add_actions(self.recent_project_menu, self.recent_projects_actions)
        self.update_project_actions()
89763
def delete_menu(self, menu):
        
        if menu.parent is None:
            del self.menus[menu.name()]
        menu._delete()
1210071
function() {
        var items = _utils.getArgArray(arguments);
        if (items.length === 0) {
            throw new Error('no files specified to clean up');
        }
        items.forEach(function(item) {
            try {
                var path = (typeof item === 'string') ? item : item.path;
                _fs.unlinkSync(path);
            } catch (e) {
                // Eat the exception.
            }
        });
    }
821324
def append_item(self, item):
        
        did_remove = self.remove_exit()
        item.menu = self
        self.items.append(item)
        if did_remove:
            self.add_exit()
665718
def remove_menu(self, menu):
        
        self._menus.remove(menu)
        for action in menu.actions():
            self.removeAction(action)
577256
def menu_item_remove_libraries_or_root_clicked(self, menu_item):
        """"""

        menu_item_text = self.get_menu_item_text(menu_item)

        logger.info("Delete item '{0}' pressed.".format(menu_item_text))
        model, path = self.view.get_selection().get_selected()
        if path:
            # Second confirmation to delete library
            tree_m_row = self.tree_store[path]
            library_os_path, library_path, library_name, item_key = self.extract_library_properties_from_selected_row()
            # assert isinstance(tree_m_row[self.ITEM_STORAGE_ID], str)
            library_file_system_path = library_os_path

            if "root" in menu_item_text:
                button_texts = [menu_item_text + "from tree and config", "Cancel"]
                partial_message = "This will remove the library root from your configuration (config.yaml)."
            else:
                button_texts = [menu_item_text, "Cancel"]
                partial_message = "This folder will be removed from hard drive! You really wanna do that?"

            message_string = "You choose to {2} with " \
                             "\n\nlibrary tree path:   {0}" \
                             "\n\nphysical path:        {1}.\n\n\n"\
                             "{3}" \
                             "".format(os.path.join(self.convert_if_human_readable(tree_m_row[self.LIB_PATH_STORAGE_ID]),
                                                    item_key),
                                       library_file_system_path,
                                       menu_item_text.lower(),
                                       partial_message)

            width = 8*len("physical path:        " + library_file_system_path)
            dialog = RAFCONButtonDialog(message_string, button_texts, message_type=Gtk.MessageType.QUESTION,
                                        parent=self.get_root_window(), width=min(width, 1400))
            response_id = dialog.run()
            dialog.destroy()
            if response_id == 1:
                if "root" in menu_item_text:
                    logger.info("Remove library root key '{0}' from config.".format(item_key))
                    from rafcon.gui.singleton import global_config
                    library_paths = global_config.get_config_value('LIBRARY_PATHS')
                    del library_paths[tree_m_row[self.LIB_KEY_STORAGE_ID]]
                    global_config.save_configuration()
                    self.model.library_manager.refresh_libraries()
                elif "libraries" in menu_item_text:
                    logger.debug("Remove of all libraries in {} is triggered.".format(library_os_path))
                    import shutil
                    shutil.rmtree(library_os_path)
                    self.model.library_manager.refresh_libraries()
                else:

                    logger.debug("Remove of Library {} is triggered.".format(library_os_path))
                    self.model.library_manager.remove_library_from_file_system(library_path,
                                                                               library_name)
            elif response_id in [2, -4]:
                pass
            else:
                logger.warning("Response id: {} is not considered".format(response_id))

            return True
        return False
999970
def obsolete_and_new(changes = { })
      return if changes.empty?
      if changes['new'].present?
        changes['new'].each { |name, _| ForemanChef::Environment.create(:name => name, :chef_proxy_id => @chef_proxy.id) }
      end
      if changes['obsolete'].present?
        changes['obsolete'].each { |name, _| ForemanChef::Environment.where(:chef_proxy_id => @chef_proxy.id).find_by_name(name).destroy }
      end
      []
    end
606619
function removeThis()
    {
        $itemOptionList = eZProductCollectionItemOption::fetchList( $this->attribute( 'id' ) );

        $db = eZDB::instance();
        $db->begin();
        foreach( $itemOptionList as $itemOption )
        {
            $itemOption->remove();
        }
        $this->remove();
        $db->commit();
    }