<commit_before>/**
 * Copyright (c) 2011 committers of YAKINDU and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 * 
 */
package org.yakindu.sct.simulation.ui.view.editing;

import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.widgets.Composite;
import org.yakindu.base.types.Type;
import org.yakindu.base.types.typesystem.ITypeSystem;

/**
 * {@link TextCellEditor} support for Integer values
 * 
 * @author <NAME> - Initial contribution and API
 * 
 */
public class IntegerEditingSupport extends ScopeSlotEditingSupport {

	public IntegerEditingSupport(ColumnViewer viewer, ITypeSystemProvider provider) {
		super(viewer, provider);
	}

	@Override
	public CellEditor getCellEditor(Object element) {
		TextCellEditor textCellEditor = new TextCellEditor((Composite) getViewer().getControl());
		textCellEditor.setValidator(new ICellEditorValidator() {
			public String isValid(Object value) {
				try {
					Integer.parseInt((String) value);
				} catch (NumberFormatException e) {
					return "No valid integer value!";
				}
				return null;
			}
		});

		return textCellEditor;
	}

	@Override
	public Type getSupportedType() {
		return provider.getTypeSystem().getType(ITypeSystem.INTEGER);
	}

	@Override
	protected Object convertValue(Object element, Object value) {
		if (value != null && value instanceof String && ((String) value).trim().length() > 0) {
			return Integer.parseInt((String) value);
		}
		return null;
	}
}<commit_msg>Changed java type for IntegerEditingSupport from Integer to Long<commit_after>/**
 * Copyright (c) 2011 committers of YAKINDU and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 * 
 */
package org.yakindu.sct.simulation.ui.view.editing;

import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.widgets.Composite;
import org.yakindu.base.types.Type;
import org.yakindu.base.types.typesystem.ITypeSystem;

/**
 * {@link TextCellEditor} support for Integer values
 * 
 * @author <NAME> - Initial contribution and API
 * 
 */
public class IntegerEditingSupport extends ScopeSlotEditingSupport {

	public IntegerEditingSupport(ColumnViewer viewer, ITypeSystemProvider provider) {
		super(viewer, provider);
	}

	@Override
	public CellEditor getCellEditor(Object element) {
		TextCellEditor textCellEditor = new TextCellEditor((Composite) getViewer().getControl());
		textCellEditor.setValidator(new ICellEditorValidator() {
			public String isValid(Object value) {
				try {
					Long.parseLong((String) value);
				} catch (NumberFormatException e) {
					return "No valid integer value!";
				}
				return null;
			}
		});

		return textCellEditor;
	}

	@Override
	public Type getSupportedType() {
		return provider.getTypeSystem().getType(ITypeSystem.INTEGER);
	}

	@Override
	protected Object convertValue(Object element, Object value) {
		if (value != null && value instanceof String && ((String) value).trim().length() > 0) {
			return Long.parseLong((String) value);
		}
		return null;
	}
}
{'fraction_non_alphanumeric': 0.10237659963436929, 'fraction_numerical': 0.004700966309741447, 'mean_word_length': 4.624082232011747, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3757122', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1124, 'n_words': 298}