Rename a specified tab.

@param request
@throws IOException
183061
@RequestMapping(method = RequestMethod.POST, params = "action=renameTab")
    public ModelAndView renameTab(HttpServletRequest request, HttpServletResponse response)
            throws IOException {

        IUserInstance ui = userInstanceManager.getUserInstance(request);
        UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
        IUserLayoutManager ulm = upm.getUserLayoutManager();

        // element ID of the tab to be renamed
        String tabId = request.getParameter("tabId");
        IUserLayoutFolderDescription tab = (IUserLayoutFolderDescription) ulm.getNode(tabId);

        // desired new name
        String tabName = request.getParameter("tabName");

        if (!ulm.canUpdateNode(tab)) {
            logger.warn("Attempting to rename an immutable tab");
            response.sendError(HttpServletResponse.SC_FORBIDDEN);
            return new ModelAndView(
                    "jsonView",
                    Collections.singletonMap(
                            "error",
                            getMessage(
                                    "error.element.update",
                                    "Unable to update element",
                                    RequestContextUtils.getLocale(request))));
        }

        /*
         * Update the tab and save the layout
         */
        tab.setName(StringUtils.isBlank(tabName) ? DEFAULT_TAB_NAME : tabName);
        final boolean updated = ulm.updateNode(tab);

        if (updated) {
            try {
                // save the user's layout
                ulm.saveUserLayout();
            } catch (PortalException e) {
                return handlePersistError(request, response, e);
            }

            // TODO why do we have to do this, shouldn't modifying the layout be enough to trigger a
            // full re-render (layout's cache key changes)
            this.stylesheetUserPreferencesService.setLayoutAttribute(
                    request, PreferencesScope.STRUCTURE, tabId, "name", tabName);
        }

        Map<String, String> model = Collections.singletonMap("message", "saved new tab name");
        return new ModelAndView("jsonView", model);
    }
1102974
public function renameFormTab($tabName, $newTabName, $keepOrder = true)
    {
        $tabs = $this->getFormTabs();

        if (!$tabs) {
            return;
        }

        if (!isset($tabs[$tabName])) {
            throw new \Exception(sprintf('Tab %s does not exist.', $tabName));
        }
        if (isset($tabs[$newTabName])) {
            return;
        }

        if ($keepOrder) {
            $keys = array_keys($tabs);
            $keys[array_search($tabName, $keys)] = $newTabName;
            $tabs = array_combine($keys, $tabs);
        } else {
            $tabs[$newTabName] = $tabs[$tabName];
            unset($tabs[$tabName]);
        }

        $this->setFormTabs($tabs);
    }
417368
private void handleSortRequest(final Request request) {
		String sortColStr = request.getParameter(getId() + ".sort");
		String sortDescStr = request.getParameter(getId() + ".sortDesc");

		if (sortColStr != null) {
			if ("".equals(sortColStr)) {
				// Reset sort
				setSort(-1, false);
				getOrCreateComponentModel().rowIndexMapping = null;
			} else {
				try {
					int sortCol = Integer.parseInt(sortColStr);
					// Allow for column order
					int[] cols = getColumnOrder();
					if (cols != null) {
						sortCol = cols[sortCol];
					}
					boolean sortAsc = !"true".equalsIgnoreCase(sortDescStr);

					// Only process the sort request if it differs from the current sort order
					if (sortCol != getSortColumnIndex() || sortAsc != isSortAscending()) {
						sort(sortCol, sortAsc);
						setFocussed();
					}
				} catch (NumberFormatException e) {
					LOG.warn("Invalid sort column: " + sortColStr);
				}
			}
		}
	}
1079094
def tabFileNameChanged(self, tab):
		'''
		
		'''
		if tab == self.currentTab:
			if tab.fileName:
				self.setWindowTitle("")
				if globalSettings.windowTitleFullPath:
					self.setWindowTitle(tab.fileName + '[*]')
				self.setWindowFilePath(tab.fileName)
				self.tabWidget.setTabText(self.ind, tab.getBaseName())
				self.tabWidget.setTabToolTip(self.ind, tab.fileName)
				QDir.setCurrent(QFileInfo(tab.fileName).dir().path())
			else:
				self.setWindowFilePath('')
				self.setWindowTitle(self.tr('New document') + '[*]')

			canReload = bool(tab.fileName) and not self.autoSaveActive(tab)
			self.actionSetEncoding.setEnabled(canReload)
			self.actionReload.setEnabled(canReload)
384088
private void addQueryParams(final Request request) {
        if (deviceSid != null) {
            request.addQueryParam("DeviceSid", deviceSid);
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
400506
@Override
	protected void preparePaintComponent(final Request request) {
		if (getAttribute(ERROR_KEY) == null) {
			try {
				for (int i = 0; i < shim.getChildCount(); i++) {
					shim.getChildAt(i).preparePaint(request);
				}
			} catch (final Exception e) {
				if (isAjaxOrTargetedRequest(request)) {
					throw new SystemException(e.getMessage(), e);
				} else {
					setAttribute(ERROR_KEY, e);
				}
			}
		}
	}
601489
public void replace(T item) throws IOException {
        removeAll((Class)item.getClass());
        data.add(item);
        onModified();
    }
1038500
public DeleteResponse delete(DeleteRequest request) throws IOException {
        return new DeleteResponse(client.doDelete(request.toUrl()));
    }
892
public static void renamePath(FileSystem fs, Path oldName, Path newName, boolean overwrite) throws IOException {
    if (!fs.exists(oldName)) {
      throw new FileNotFoundException(String.format("Failed to rename %s to %s: src not found", oldName, newName));
    }
    if (fs.exists(newName)) {
      if (overwrite) {
        HadoopUtils.moveToTrash(fs, newName);
      } else {
        throw new FileAlreadyExistsException(
            String.format("Failed to rename %s to %s: dst already exists", oldName, newName));
      }
    }
    if (!fs.rename(oldName, newName)) {
      throw new IOException(String.format("Failed to rename %s to %s", oldName, newName));
    }
  }
6762
def applet_rename(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs)
1027978
public static void renamePath(FileSystem fs, Path oldName, Path newName) throws IOException {
    renamePath(fs, oldName, newName, false);
  }
1087207
@SuppressWarnings("ResultOfMethodCallIgnored") private void updateSuccess(
      DownloadRequest request) {
    updateState(request, DownloadState.SUCCESSFUL);

    /* notify the request download finish */
    request.finish();

    File file = new File(request.tempFilePath());
    if (file.exists()) {
      file.renameTo(new File(request.destinationFilePath()));
    }

    /* deliver success message */
    delivery.postSuccess(request);
  }
389456
public void destroy( HttpServletRequest request )
    {
        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
        
        sh.removeAttribute( rc, attrName );
    }
35149
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (!this.isInitialised()) {
			List recent = loadRecentList();

			if (recent != null && !recent.isEmpty()) {
				String selection = (String) recent.get(0);
				displaySelection(selection);
			}

			this.setInitialised(true);
		}

		updateTitle();
	}
1148784
private boolean rename(String src, String dst) throws IOException {
    src = stripPath(src);
    dst = stripPath(dst);
    File file = new File(src);
    return file.renameTo(new File(dst));
  }
343012
protected void createTable(TableName tableName, CreateTableRequest request)
          throws IOException {
    try {
      tableAdminClientWrapper.createTable(request);
    } catch (Throwable throwable) {
      throw convertToTableExistsException(tableName, throwable);
    }
  }
428872
function rename(ts, cm) {
    var token = cm.getTokenAt(cm.getCursor());
    if (!/\w/.test(token.string)) showError(ts, cm, "Not at a variable");
    dialog(cm, "New name for " + token.string, function(newName) {
      ts.request(cm, {type: "rename", newName: newName, fullDocs: true}, function(error, data) {
        if (error) return showError(ts, cm, error);
        applyChanges(ts, data.changes);
      });
    });
  }