<commit_before>
package org.nakedobjects.viewer.skylark.value;


import org.nakedobjects.object.InvalidEntryException;
import org.nakedobjects.object.TextEntryParseException;
import org.nakedobjects.object.control.Allow;
import org.nakedobjects.object.control.Consent;
import org.nakedobjects.object.control.Veto;
import org.nakedobjects.viewer.skylark.Location;
import org.nakedobjects.viewer.skylark.ValueField;
import org.nakedobjects.viewer.skylark.View;
import org.nakedobjects.viewer.skylark.Workspace;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;

import org.apache.log4j.Logger;


public class PasteValueOption extends AbstractValueOption {
	private static final Logger LOG = Logger.getLogger(PasteValueOption.class);
	
    public PasteValueOption() {
        super("Replace with clipboard value");
    }

    public Consent disabled(View view) {

		if (!view.canChangeValue()) {
			return new Veto("Field cannot be edited");
		} else {
			return new Allow("Replace field content with '" + getClipboard() + "' from clipboard");
		}
    }

    public void execute(Workspace frame, View view, Location at) {
        String pasteValue = getClipboard();
        ValueField objectContent = ((ValueField) view.getContent());<commit_msg>Fixed bug in Paste option where it failed on fields in dialogs<commit_after>
package org.nakedobjects.viewer.skylark.value;


import org.nakedobjects.object.InvalidEntryException;
import org.nakedobjects.object.TextEntryParseException;
import org.nakedobjects.object.control.Allow;
import org.nakedobjects.object.control.Consent;
import org.nakedobjects.object.control.Veto;
import org.nakedobjects.viewer.skylark.Location;
import org.nakedobjects.viewer.skylark.ValueContent;
import org.nakedobjects.viewer.skylark.View;
import org.nakedobjects.viewer.skylark.Workspace;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;

import org.apache.log4j.Logger;


public class PasteValueOption extends AbstractValueOption {
	private static final Logger LOG = Logger.getLogger(PasteValueOption.class);
	
    public PasteValueOption() {
        super("Replace with clipboard value");
    }

    public Consent disabled(View view) {
		if (!view.canChangeValue()) {
			return new Veto("Field cannot be edited");
		} else {
			return new Allow("Replace field content with '" + getClipboard() + "' from clipboard");
		}
    }

    public void execute(Workspace workspace, View view, Location at) {
        String pasteValue = getClipboard();
        ValueContent objectContent = ((ValueContent) view.getContent());
{'fraction_non_alphanumeric': 0.09912536443148688, 'fraction_numerical': 0.0007288629737609329, 'mean_word_length': 4.954446854663774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3526170', 'n_tokens_mistral': 837, 'n_tokens_neox': 813, 'n_words': 182}