<commit_before>/*
 * Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.configure.ui;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.wso2.developerstudio.eclipse.gmf.esb.EsbFactory;
import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.wso2.developerstudio.eclipse.gmf.esb.Task;
import org.wso2.developerstudio.eclipse.gmf.esb.TaskProperty;
import org.wso2.developerstudio.eclipse.gmf.esb.TaskPropertyType;

public class TaskPropertyDialog extends Dialog{
	
	private TransactionalEditingDomain editingDomain;
	private Task task;
	private boolean defaultESBtask;
	
	/**
	 * Table for add/edit/remove parameters.
	 */
	private Table propertyTable;
	/**
	 * Table Editor for inline property edit
	 */
	private TableEditor propertyTypeEditor;
	/**
	 * Combo box for select parameter type.
	 */
	private Combo cmbPropertyType;
	/**
	 * Button for add new parameter.
	 */
	private Button newPropertyButton;
	/**
	 * Button for remove parameter.
	 */
	private Button removePropertyButton;	
	/**
	 * Command for recording user operations.
	 */
	private CompoundCommand resultCommand;
	

	public TaskPropertyDialog(Shell parentShell,
			Task task,
			TransactionalEditingDomain editingDomain) {
		super(parentShell);
		this.editingDomain = editingDomain;
		this.task = task;
		defaultESBtask = (task.getTaskImplementation().equals("org.apache.synapse.startup.tasks.MessageInjector"));
		initializeDefaultMessageInjectorTask();
	}

	protected void configureShell(Shell newShell) {
		super.configureShell(newShell);
		newShell.setText("Task Configuration");
	}
	
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		FormLayout mainLayout = new FormLayout();
		mainLayout.marginHeight = 5;
		mainLayout.marginWidth = 5;
		container.setLayout(mainLayout);

		// Button for add new parameter.
		newPropertyButton = new Button(container, SWT.NONE);
		newPropertyButton.setText("New...");
		FormData newTaskPropertyButtonLayoutData = new FormData(80, SWT.DEFAULT);
		newTaskPropertyButtonLayoutData.right = new FormAttachment(100);
		newPropertyButton.setLayoutData(newTaskPropertyButtonLayoutData);

		newPropertyButton.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				TableItem item = bindPram(EsbFactory.eINSTANCE
						.createTaskProperty());
				propertyTable.select(propertyTable.indexOf(item));
			}
		});<commit_msg>Latest Commit Fixing TOOLS 2479<commit_after>/*
 * Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.configure.ui;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.wso2.developerstudio.eclipse.gmf.esb.EsbFactory;
import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.wso2.developerstudio.eclipse.gmf.esb.Task;
import org.wso2.developerstudio.eclipse.gmf.esb.TaskProperty;
import org.wso2.developerstudio.eclipse.gmf.esb.TaskPropertyType;

public class TaskPropertyDialog extends Dialog{
	
	private TransactionalEditingDomain editingDomain;
	private Task task;
	private boolean defaultESBtask;
	
	/**
	 * Table for add/edit/remove parameters.
	 */
	private Table propertyTable;
	/**
	 * Table Editor for inline property edit
	 */
	private TableEditor propertyTypeEditor;
	/**
	 * Combo box for select parameter type.
	 */
	private Combo cmbPropertyType;
	/**
	 * Button for add new parameter.
	 */
	private Button newPropertyButton;
	/**
	 * Button for remove parameter.
	 */
	private Button removePropertyButton;	
	/**
	 * Command for recording user operations.
	 */
	private CompoundCommand resultCommand;
	

	public TaskPropertyDialog(Shell parentShell,
			Task task,
			TransactionalEditingDomain editingDomain) {
		super(parentShell);
		this.editingDomain = editingDomain;
		this.task = task;
		defaultESBtask = (task.getTaskImplementation().equals("org.apache.synapse.startup.tasks.MessageInjector"));
		initializeDefaultMessageInjectorTask();
	}

	protected void configureShell(Shell newShell) {
		super.configureShell(newShell);
		newShell.setText("Task Properties");
	}
	
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		FormLayout mainLayout = new FormLayout();
		mainLayout.marginHeight = 5;
		mainLayout.marginWidth = 5;
		container.setLayout(mainLayout);

		// Button for add new parameter.
		newPropertyButton = new Button(container, SWT.NONE);
		newPropertyButton.setText("New...");
		FormData newTaskPropertyButtonLayoutData = new FormData(80, SWT.DEFAULT);
		newTaskPropertyButtonLayoutData.right = new FormAttachment(100);
		newPropertyButton.setLayoutData(newTaskPropertyButtonLayoutData);

		newPropertyButton.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				TableItem item = bindPram(EsbFactory.eINSTANCE
						.createTaskProperty());
				propertyTable.select(propertyTable.indexOf(item));
			}
		});
{'fraction_non_alphanumeric': 0.10157618213660245, 'fraction_numerical': 0.004903677758318739, 'mean_word_length': 5.011228070175439, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '837323', 'n_tokens_mistral': 2693, 'n_tokens_neox': 2543, 'n_words': 586}