<commit_before>package org.csstudio.opibuilder.widgets.editparts;

import org.csstudio.opibuilder.widgets.model.TextIndicatorModel;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.DirectEditPolicy;
import org.eclipse.gef.requests.DirectEditRequest;

/**
 * The Editpolicy to handle direct text edit.
 * @author <NAME>
 *
 */
public class TextIndicatorDirectEditPolicy 
	extends DirectEditPolicy {

	/**
	 * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest)
	 */
	protected Command getDirectEditCommand(DirectEditRequest edit) {
		String labelText = (String)edit.getCellEditor().getValue();
		TextIndicatorEditPart label = (TextIndicatorEditPart)getHost();
		TextIndicatorEditCommand command = 
			new TextIndicatorEditCommand((TextIndicatorModel)label.getModel(),labelText);
		return command;
	}
	
	/**
	 * @see DirectEditPolicy#showCurrentEditValue(DirectEditRequest)
	 */
	protected void showCurrentEditValue(DirectEditRequest request) {
		//String value = (String)request.getCellEditor().getValue();
		//((LabelFigure)getHostFigure()).setText(value);
		//hack to prevent async layout from placing the cell editor twice.
		//getHostFigure().getUpdateManager().performUpdate();
		
	
	}


static class TextIndicatorEditCommand extends Command	{
	
	private String newText, oldText;
	private TextIndicatorModel label;
	
	public TextIndicatorEditCommand(TextIndicatorModel l, String s) {
	label = l;
	if (s != null)
		newText = s;
	else
		newText = "";  //$NON-NLS-1$
	}
	
	public void execute() {
		oldText = label.getText();
		label.setText(newText);
	}
	
	public void undo() {
		label.setText(oldText);
	}

}


}<commit_msg>BOY: TextInput widget should write text value to PV even if the input text doesn't change.<commit_after>package org.csstudio.opibuilder.widgets.editparts;

import org.csstudio.opibuilder.widgets.model.TextIndicatorModel;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.DirectEditPolicy;
import org.eclipse.gef.requests.DirectEditRequest;

/**
 * The Editpolicy to handle direct text edit.
 * @author <NAME>
 *
 */
public class TextIndicatorDirectEditPolicy 
	extends DirectEditPolicy {

	/**
	 * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest)
	 */
	protected Command getDirectEditCommand(DirectEditRequest edit) {
		String labelText = (String)edit.getCellEditor().getValue();
		TextIndicatorEditPart label = (TextIndicatorEditPart)getHost();
		TextIndicatorEditCommand command = 
			new TextIndicatorEditCommand((TextIndicatorModel)label.getModel(),labelText);
		return command;
	}
	
	/**
	 * @see DirectEditPolicy#showCurrentEditValue(DirectEditRequest)
	 */
	protected void showCurrentEditValue(DirectEditRequest request) {
		//String value = (String)request.getCellEditor().getValue();
		//((LabelFigure)getHostFigure()).setText(value);
		//hack to prevent async layout from placing the cell editor twice.
		//getHostFigure().getUpdateManager().performUpdate();
		
	
	}


static class TextIndicatorEditCommand extends Command	{
	
	private String newText, oldText;
	private TextIndicatorModel label;
	
	public TextIndicatorEditCommand(TextIndicatorModel l, String s) {
	label = l;
	if (s != null)
		newText = s;
	else
		newText = "";  //$NON-NLS-1$
	}
	
	public void execute() {
		oldText = label.getText();
		label.setPropertyValue(TextIndicatorModel.PROP_TEXT, newText, true);//setText(newText);
	}
	
	public void undo() {
		label.setText(oldText);
	}

}


}
{'fraction_non_alphanumeric': 0.1097666378565255, 'fraction_numerical': 0.0005762028233938346, 'mean_word_length': 5.134275618374558, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4676092', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1035, 'n_words': 219}