Utility method to update state of section
437885
function (sectionId, state) {
        if (!module.exports.operations.validateState || module.exports.operations.validateState(state)) {
            appState.set('state[' + sectionId + ']', state);
        } else {
            log.error('Unable to update invalid state:', state, 'in section:', sectionId);
        }
    }
1129896
def merge_modified_section_data(self):
        """"""
        
        for section in self.sections:
            section_data_start = adjust_FileAlignment( section.PointerToRawData,
                self.OPTIONAL_HEADER.FileAlignment )
            section_data_end = section_data_start+section.SizeOfRawData
            if section_data_start < len(self.__data__) and section_data_end < len(self.__data__):
                self.__data__ = self.__data__[:section_data_start] + section.get_data() + self.__data__[section_data_end:]
161805
def set_section(self, section):
        
        if not isinstance(section, Section):
            raise Exception("You")

        try:
            self.remove_section(section.name)
        except:
            pass

        self._sections[section.name] = copy.deepcopy(section)
632375
def reload(self):
        
        for section in self.sections():
            self.remove_section(section)
        self.autoload()
159855
function(state, title, url) {
      var t = document.title;
      if (lastTitle != null) {
        document.title = lastTitle;
      }
      historyPushState && fastFixChrome(historyPushState, arguments);
      changeState(state, url);
      document.title = t;
      lastTitle = title;
    }
283432
function() {
			var context = this.loopContext;
			var choiceContext = this.choiceContext;
			var forkContext = this.forkContext;

			// Update state.
			if (context.updateSegments) {
				context.endOfUpdateSegments = forkContext.head;

				// `update` -> `test`
				if (context.testSegments) {
					makeLooped(
						this,
						context.endOfUpdateSegments,
						context.testSegments);
				}
			} else if (context.testSegments) {
				finalizeTestSegmentsOfFor(
					context,
					choiceContext,
					forkContext.head);
			} else {
				context.endOfInitSegments = forkContext.head;
			}

			var bodySegments = context.endOfTestSegments;

			if (!bodySegments) {

				/*
				 * If there is not the `test` part, the `body` path comes from the
				 * `init` part and the `update` part.
				 */
				var prevForkContext = ForkContext.newEmpty(forkContext);

				prevForkContext.add(context.endOfInitSegments);
				if (context.endOfUpdateSegments) {
					prevForkContext.add(context.endOfUpdateSegments);
				}

				bodySegments = prevForkContext.makeNext(0, -1);
			}
			context.continueDestSegments = context.continueDestSegments || bodySegments;
			forkContext.replaceHead(bodySegments);
		}
953072
protected void updateState() {
        final WidgetState.State state;
        if (useParentState() || getFollowParentState()) {
            state = mParent.getState();
        } else {
            state = getState();
        }

        Log.d(Log.SUBSYSTEM.WIDGET, TAG, "updateState(): %s for '%s'", state, getName());
        if (!mLevelInfo.isEmpty() && mLevel >= 0) {
            mLevelInfo.get(mLevel).setState(state);
        }

        boolean updateChildren = isInFollowStateGroup()
                || getChildrenFollowState();
        for (Widget child : getChildren()) {
            if (updateChildren || child.getFollowParentState()) {
                child.updateState();
            }
        }
    }
957145
def _update_release_content(self, release, content):
        """"""
        if release.body:
            new_body = []
            current_parser = None
            is_start_line = False
            for parser in self.parsers:
                parser.replaced = False

            # update existing sections
            for line in release.body.splitlines():

                if current_parser:
                    if current_parser._is_end_line(current_parser._process_line(line)):
                        parser_content = current_parser.render()
                        if parser_content:
                            # replace existing section with new content
                            new_body.append(parser_content + "\r\n")
                        current_parser = None

                for parser in self.parsers:
                    if (
                        parser._render_header().strip()
                        == parser._process_line(line).strip()
                    ):
                        parser.replaced = True
                        current_parser = parser
                        is_start_line = True
                        break
                    else:
                        is_start_line = False

                if is_start_line:
                    continue
                if current_parser:
                    continue
                else:
                    # preserve existing sections
                    new_body.append(line.strip())

            # catch section without end line
            if current_parser:
                new_body.append(current_parser.render())

            # add new sections at bottom
            for parser in self.parsers:
                parser_content = parser.render()
                if parser_content and not parser.replaced:
                    new_body.append(parser_content + "\r\n")

            content = u"\r\n".join(new_body)

        return content
1359536
function() {
			var context = this.loopContext;
			var forkContext = this.forkContext;
			var bodySegments = forkContext.makeNext(-1, -1);

			// Update state.
			context.entrySegments = bodySegments;
			forkContext.replaceHead(bodySegments);
		}
1186818
public void setSections(Section... SECTIONS_ARRAY) {
        sections.clear();
        for (Section section : SECTIONS_ARRAY) {
            sections.add(new Section(section.getStart(), section.getStop(), section.getColor()));
        }
        validate();
        fireStateChanged();
    }
71113
private function updateSectionNodes($sectionUid, $leftNode, $rightNode, $level)
    {
        $this->createQueryBuilder('s')
                ->update()
                ->set('s._leftnode', $leftNode)
                ->set('s._rightnode', $rightNode)
                ->set('s._level', $level)
                ->where('s._uid = :uid')
                ->setParameter('uid', $sectionUid)
                ->getQuery()
                ->execute();

        return $this;
    }
71826
public void setSection (Section section)
    {
        _sections.put(key(section.x, section.y), section);
    }
863710
def edit(self, state):
        
        if state and state.lower() == 'active':
            data = dumps({'state': state.lower()})
            json = self._json(self._patch(self._api, data=data))
            self._update_attributes(json)
        return self
845256
private function update()
    {
        $errors = array();
        switch( State::get('action') )
        {
            case 'save':
                $errors = $this->save();
                Notifier::success('Settings saved.');
                break;
            case 'reset-section':
                $section = $this->config->get_section_by_slug(State::get('active_section'));
                $this->reset( $section );
                Notifier::success('<strong>'.$section->title.'</strong> section was reset to its default settings.');
                break;
            case 'reset-all':
                $this->reset();
                Notifier::success('All sections were reset to their default settings.');
                break;
            // No submission (simple request)
            default:
                $this->load();
        }
        
        $this->set_errors($errors);
    }
1231141
private function updateSections()
    {
        $sections = $this->repo->findAll();
        foreach ($sections as $section) {
            PageListener::setSectionHasChildren($this->em, $section);
        }
        $this->em->flush();

        return $this;
    }
207513
public void updateState()
  {
/*
    if( _editor.getCaretPosition() == _iCaretPos )
    {
      if( isOtherPopupShowing() )
      {
        resetSmartHelpState();
      }      
      return;
    }

*/
    resetSmartHelpState();

    if( isOtherPopupShowing() )
    {
      return; //don't clobber existing popups
    }

    //Iterate through all the closest issues within one line of the current cursor and offer to fix the closest one
    final List<IParseIssue> parseIssues = findParseIssuesOrderedByDistanceFromCaret( 1 );
    setMode( SmartFixMode.NONE );
    for( Highlighter.Highlight highlight : _editor.getHighlighter().getHighlights() )
    {
      if( highlight.getPainter() instanceof SmartFixHighlightPainter )
      {
        _editor.getHighlighter().removeHighlight( highlight );
      }
    }
    final Set<String> processed = new HashSet<String>();
//    if (isModeAvailable(SmartFixMode.CONVERT_STRING_TO_DISPLAY_KEY)) {
//      int lineNum = _gosuEditor.getLineNumberAtCaret();
//      Element line = _gosuEditor.getEditor().getDocument().getDefaultRootElement().getElement(lineNum - 1);
//      try {
//        if (_gosuEditor.getEditor().getText(line.getStartOffset(), line.getEndOffset() - line.getStartOffset()).contains("\"")) {
//          IParseTree locationAtCaret = _gosuEditor.getDeepestLocationAtCaret();
//          if (offerToTurnStringLiteralToDisplayKey(locationAtCaret)) {
//            _stringLiteralLocationToReplace = locationAtCaret;
//            return;
//          }
//        }
//      } catch (BadLocationException e) {
//        // ignore
//      }
//    }

    final ITypeUsesMap[] uses = new ITypeUsesMap[]{_gosuEditor.getTypeUsesMapFromMostRecentParse()};

    Runnable runnable = new Runnable()
    {
      @Override
      public void run()
      {
        if( uses[0] == null )
        {
          _gosuEditor.waitForParser();
          uses[0] = _gosuEditor.getTypeUsesMapFromMostRecentParse();
        }
        for( IParseIssue parseIssue : parseIssues )
        {
          IParsedElement source = parseIssue.getSource();
          if( isModeAvailable( SmartFixMode.IMPORT ) && _gosuEditor.acceptsUses() && handlePossibleImportFix( source, uses[0], processed ) )
          {
            setMode( SmartFixMode.IMPORT );
            return;
          }
          else if( isModeAvailable( SmartFixMode.FIX_IMPLICIT_CAST ) && isImplictCoercion( parseIssue ) )
          {
            setMode( SmartFixMode.FIX_IMPLICIT_CAST );
            return;
          }
          else if( isModeAvailable( SmartFixMode.FIX_CTOR_SYNTAX ) && isObsoleteConstructor( parseIssue ) )
          {
            setMode( SmartFixMode.FIX_CTOR_SYNTAX );
            return;
          }
          else if( isModeAvailable( SmartFixMode.FIX_JAVA_STYLE_CAST ) && isJavaStyleCast( parseIssue ) )
          {
            setMode( SmartFixMode.FIX_JAVA_STYLE_CAST );
            return;
          }
//          else if( isModeAvailable(SmartFixMode.CREATE_DISPLAY_KEY) && isPossibleDisplayKey( parseIssue ) )
//          {
//            setMode( SmartFixMode.CREATE_DISPLAY_KEY );
//            return;
//          }
          if( isModeAvailable( SmartFixMode.ADD_MISSING_OVERRIDE ) && isMissingOverride( parseIssue ) )
          {
            setMode( SmartFixMode.ADD_MISSING_OVERRIDE );
            return;
          }
          else if( isModeAvailable( SmartFixMode.FIX_CASE ) && isCaseIssue( parseIssue ) )
          {
            setMode( SmartFixMode.FIX_CASE );
            return;
          }
          else if( isModeAvailable( SmartFixMode.FIX_RETURN_TYPE ) && isVoidReturnTypeIssue( parseIssue ) )
          {
            setMode( SmartFixMode.FIX_RETURN_TYPE );
            return;
//          else if( isModeAvailable( SmartFixMode.IMPL_FUNCTIONS ) && showImplementPopup(parseIssue))
//          {
//            setMode( SmartFixMode.IMPL_FUNCTIONS );
//            return;
          }
          else if( isModeAvailable( SmartFixMode.GENERATE_CONSTRUCTORS ) && isMissingConstructor( parseIssue ) )
          {
            setMode( SmartFixMode.GENERATE_CONSTRUCTORS );
            return;
          }
          else if( isModeAvailable( SmartFixMode.GENERATE_SUPER_CALL ) && isMissingSuperCall( parseIssue ) )
          {
            setMode( SmartFixMode.GENERATE_SUPER_CALL );
            return;
          }
        }
      }
    };

    editor.util.EditorUtilities.doBackgroundOp( runnable );
  }
672447
void perform(ContentHandler handler, SectionState state) {
    final ModeUsage modeUsage = getModeUsage();
    if (handler != null)
      state.addActiveHandler(handler, modeUsage);
    else
      state.addAttributeValidationModeUsage(modeUsage);
    state.addChildMode(modeUsage, handler);
  }