Implements the "Evaluating selection sets" section of the spec for "write" mode.
177834
protected static function executeFieldsSerially(ExecutionContext $context, ObjectType $parent, $source, $fields)
    {
        $results = [];
        foreach ($fields as $response => $asts) {
            $result = self::resolveField($context, $parent, $source, $asts);

            if ($result !== self::$UNDEFINED) {
                // Undefined means that field is not defined in schema.
                $results[$response] = $result;
            }
        }

        return $results;
    }
227288
public void generate(Output out) throws IOException {
        out.output(getSelectorString());
        out.output(" {");
        out.incIndent();
        for (Attribute attr : attributes) {
            out.optionalLineBreak();
            out.output(attr);
        }
        for (Section child : subSections) {
            out.lineBreak();
            child.generate(out);
        }
        out.decIndent();
        out.optionalLineBreak();
        out.output("}");
    }
471588
function (suggestion, selectionOptions) {
        var that = this,
            formatSelected = that.options.formatSelected || that.type.formatSelected,
            hasSameValues = selectionOptions && selectionOptions.hasSameValues,
            hasBeenEnriched = selectionOptions && selectionOptions.hasBeenEnriched,
            formattedValue,
            typeFormattedValue = null;


        if ($.isFunction(formatSelected)) {
            formattedValue = formatSelected.call(that, suggestion);
        }

        if (typeof formattedValue !== 'string') {
            formattedValue = suggestion.value;

            if (that.type.getSuggestionValue) {
                typeFormattedValue = that.type.getSuggestionValue(that, {
                    suggestion: suggestion,
                    hasSameValues: hasSameValues,
                    hasBeenEnriched: hasBeenEnriched,
                });

                if (typeFormattedValue !== null) {
                    formattedValue = typeFormattedValue;
                }
            }
        }

        return formattedValue;
    }
1191779
public void select(ArrayList selection) {
		list.clearSelection();
		int[] selected = new int[selection.size()];
		for (int i=0;i<selection.size();i++) {
			selected[i] = sprites.indexOf(selection.get(i));
		}
		list.setSelectedIndices(selected);
		
		sheetPanel.setSelection(selection);
	}
382137
private void writePreferences() {
    boolean runOnStartup = getRunOnStartupCheckBox().isSelected();
    pref.putBoolean("runOnStartup", runOnStartup);

    if (getLimitCpusCheckBox().isSelected()) {
      int maxCpus = ((Number) getMaxCpusTextField().getValue()).intValue();
      pref.putInt("maxCpus", maxCpus);
    } else {
      pref.putInt("maxCpus", 0);
    }

    boolean requireAC = getRequireACCheckBox().isSelected();
    int minBattLife = getMinBatteryLifeSlider().getValue();
    int minBattLifeWhileChg = getMinBatteryLifeWhileChargingSlider().getValue();
    pref.putBoolean("requireAC", requireAC);
    pref.putInt("minBattLife", minBattLife);
    pref.putInt("minBattLifeWhileChg", minBattLifeWhileChg);

    boolean cacheClassDefinitions = getCacheClassDefinitionsCheckBox().isSelected();
    pref.putBoolean("cacheClassDefinitions", cacheClassDefinitions);
  }
481493
private void writeGetAs(Definition def, Writer out, int indent) throws IOException
   {
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Get activation spec class\n");
      writeWithIndent(out, indent, " * @return Activation spec\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent, "public " + def.getAsClass() + " getActivationSpec()");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "return spec;");

      writeRightCurlyBracket(out, indent);
      writeEol(out);
   }
393551
@Override
    public void checkWriteAccess() throws RejectedException {
        logger.debug("checkWriteAccess of " + this);

        if (!isDependingOnConsistentRegistries()) {
            throw new RejectedException("At least one depending registry is inconsistent!");
        }

        pluginPool.checkAccess();

        if (!consistent) {
            log(getName() + " is inconsistent! To fix registry manually start the registry in force mode.", LogLevel.WARN);
            throw new RejectedException("Registry is inconsistent!");
        }
    }
212649
protected void storeValidation(Validation v, XMLStreamWriter writer) throws Exception
   {
      writer.writeStartElement(CommonXML.ELEMENT_VALIDATION);

      if (v.isValidateOnMatch() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_VALIDATE_ON_MATCH);
         writer.writeCharacters(v.getValue(CommonXML.ELEMENT_VALIDATE_ON_MATCH, v.isValidateOnMatch().toString()));
         writer.writeEndElement();
      }

      if (v.isBackgroundValidation() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_BACKGROUND_VALIDATION);
         writer.writeCharacters(v.getValue(CommonXML.ELEMENT_BACKGROUND_VALIDATION,
                                           v.isBackgroundValidation().toString()));
         writer.writeEndElement();
      }

      if (v.getBackgroundValidationMillis() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_BACKGROUND_VALIDATION_MILLIS);
         writer.writeCharacters(v.getValue(CommonXML.ELEMENT_BACKGROUND_VALIDATION_MILLIS,
                                           v.getBackgroundValidationMillis().toString()));
         writer.writeEndElement();
      }

      if (v.isUseFastFail() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_USE_FAST_FAIL);
         writer.writeCharacters(v.getValue(CommonXML.ELEMENT_USE_FAST_FAIL, v.isUseFastFail().toString()));
         writer.writeEndElement();
      }

      writer.writeEndElement();
   }
458899
public void onWrite(final SelectionKey key) {
    if (this.writeEventDispatcher == null) {
      dispatchWriteEvent(key);
    } else {
      this.writeEventDispatcher.dispatch(new WriteTask(key));
    }
  }
33158
public void highlight(HIGHLIGHT_MODES mode) throws WidgetException {
		if (mode.equals(HIGHLIGHT_MODES.NONE))
			return;
		else
			highlight(mode.toString());

	}
725072
private void ensureValueMode() throws IOException {
    switch (this.mode) {
      case MODE_START_LINE: {
        changeMode(MODE_VALUES);
        for (final Extra e : extras) {
          e.onBeforeFirstValue(this);
        }
        writeIndent();
        this.write(this.prefixFirtValueAtLine);
      }
      break;
      case MODE_COMMENTS: {
        this.BR();
        writeIndent();
        changeMode(MODE_VALUES);
        for (final Extra e : extras) {
          e.onBeforeFirstValue(this);
        }
        this.write(this.prefixFirtValueAtLine);
      }
      break;
      case MODE_VALUES:
        break;
      default:
        throw new Error("Unexpected state");
    }
  }
1085358
private boolean isSelectionCommented(ISelection selection) {
		if (!(selection instanceof ITextSelection))
			return false;

		ITextSelection textSelection= (ITextSelection) selection;
		if (textSelection.getStartLine() < 0 || textSelection.getEndLine() < 0)
			return false;

		IDocument document= getTextEditor().getDocumentProvider().getDocument(getTextEditor().getEditorInput());

		try {

			IRegion block= getTextBlockFromSelection(textSelection, document);
			ITypedRegion[] regions= TextUtilities.computePartitioning(document, fDocumentPartitioning, block.getOffset(), block.getLength(), false);

			int[] lines= new int[regions.length * 2]; // [startline, endline, startline, endline, ...]
			for (int i= 0, j= 0; i < regions.length; i++, j+= 2) {
				// start line of region
				lines[j]= getFirstCompleteLineOfRegion(regions[i], document);
				// end line of region
				int length= regions[i].getLength();
				int offset= regions[i].getOffset() + length;
				if (length > 0)
					offset--;
				lines[j + 1]= (lines[j] == -1 ? -1 : document.getLineOfOffset(offset));
			}

			// Perform the check
			for (int i= 0, j= 0; i < regions.length; i++, j += 2) {
				String[] prefixes= (String[]) fPrefixesMap.get(regions[i].getType());
				if (prefixes != null && prefixes.length > 0 && lines[j] >= 0 && lines[j + 1] >= 0)
					if (!isBlockCommented(lines[j], lines[j + 1], prefixes, document))
						return false;
			}

			return true;

		} catch (BadLocationException x) {
			// should not happen
			VdmUIPlugin.log(x);
		}

		return false;
	}
26354
def preserve_selection():
    
    sl = cmds.ls(sl=True)
    try:
        yield
    finally:
        cmds.select(sl, replace=True)
1143064
private void writeBeanDefinitionsToMetaInf() {
        try {
            classWriterOutputVisitor.finish();
        } catch (Exception e) {
            String message = e.getMessage();
            error("Error occurred writing META-INF files: %s", message != null ? message : e);
        }
    }
1256635
public void setSelected(String s)
    {
        for (int i = 0; i < listBox.getItemCount(); i++)
        {
            if (listBox.getItemText(i).equals(s))
                listBox.setSelectedIndex(i);
        }
    }
1073780
void browseAndWriteMethods(List<ExecutableElement> methodElements, String classname, Writer writer) throws IOException {
		Collection<String> methodProceeds = new ArrayList<>();
		boolean first = true;
		for (ExecutableElement methodElement : methodElements) {
			if (isConsiderateMethod(methodProceeds, methodElement)) {
				if(!first) {
					writer.append(COMMA).append(CR);
				}
				visitMethodElement(classname, methodElement, writer);
				first = false;
			}
		}
	}
152962
private void evalAccess()
        throws EFapsException
    {
        final List<Instance> instances = new ArrayList<>();
        while (step(this.selection.getInstSelects().values())) {
            for (final Entry<String, Select> entry : this.selection.getInstSelects().entrySet()) {
                final Object object = entry.getValue().getCurrent();
                if (object != null) {
                    if (object instanceof List) {
                        ((List<?>) object).stream()
                            .filter(Objects::nonNull)
                            .forEach(e -> instances.add((Instance) e));
                    } else {
                        instances.add((Instance) object);
                    }
                }
            }
        }
        for (final Entry<String, Select> entry : this.selection.getInstSelects().entrySet()) {
            entry.getValue().reset();
        }
        this.access = Access.get(AccessTypeEnums.READ.getAccessType(), instances);
    }