<commit_before>package org.csstudio.channel.widgets;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import gov.bnl.channelfinder.api.ChannelQuery;

import org.csstudio.ui.util.helpers.ComboHistoryHelper;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;

public class ChannelQueryInputBar extends AbstractChannelQueryWidget {

	private Combo combo;
	
	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public ChannelQueryInputBar(Composite parent, int style,
			IDialogSettings dialogSettings, String settingsKey) {
		super(parent, style);
		setLayout(new FillLayout(SWT.HORIZONTAL));

		ComboViewer comboViewer = new ComboViewer(this, SWT.NONE);
		combo = comboViewer.getCombo();
		combo.setToolTipText(
				"space seperated search criterias, patterns may include * and ? wildcards\r\nchannelNamePatter\r\npropertyName=propertyValuePattern1,propertyValuePattern2\r\nTags=tagNamePattern\r\nEach criteria is logically ANDed and , or || seperated values are logically ORed\r\n");

		ComboHistoryHelper name_helper = new ComboHistoryHelper(dialogSettings,
				settingsKey, combo, 20, true) {
			@Override
			public void newSelection(final String queryText) {
				setChannelQuery(ChannelQuery.Builder.query(queryText).create());
			}
		};
		
		addPropertyChangeListener(new PropertyChangeListener() {
			
			@Override
			public void propertyChange(PropertyChangeEvent event) {
				if ("channelQuery".equals(event.getPropertyName())) {
					String newValue = "";
					if (event.getNewValue() != null)
						newValue = ((ChannelQuery) event.getNewValue()).getQuery();
					if (newValue.equals(combo.getText())) {
						combo.setText(newValue);
					}
				}
			}
		});
		
		
		name_helper.loadSettings();
	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}
}<commit_msg>..channel.widget: input bar did not show query set programmatically.<commit_after>package org.csstudio.channel.widgets;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import gov.bnl.channelfinder.api.ChannelQuery;

import org.csstudio.ui.util.helpers.ComboHistoryHelper;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;

public class ChannelQueryInputBar extends AbstractChannelQueryWidget {

	private Combo combo;
	
	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public ChannelQueryInputBar(Composite parent, int style,
			IDialogSettings dialogSettings, String settingsKey) {
		super(parent, style);
		setLayout(new FillLayout(SWT.HORIZONTAL));

		ComboViewer comboViewer = new ComboViewer(this, SWT.NONE);
		combo = comboViewer.getCombo();
		combo.setToolTipText(
				"space seperated search criterias, patterns may include * and ? wildcards\r\nchannelNamePatter\r\npropertyName=propertyValuePattern1,propertyValuePattern2\r\nTags=tagNamePattern\r\nEach criteria is logically ANDed and , or || seperated values are logically ORed\r\n");

		ComboHistoryHelper name_helper = new ComboHistoryHelper(dialogSettings,
				settingsKey, combo, 20, true) {
			@Override
			public void newSelection(final String queryText) {
				setChannelQuery(ChannelQuery.Builder.query(queryText).create());
			}
		};
		
		addPropertyChangeListener(new PropertyChangeListener() {
			
			@Override
			public void propertyChange(PropertyChangeEvent event) {
				if ("channelQuery".equals(event.getPropertyName())) {
					String newValue = "";
					if (event.getNewValue() != null)
						newValue = ((ChannelQuery) event.getNewValue()).getQuery();
					if (!newValue.equals(combo.getText())) {
						combo.setText(newValue);
					}
				}
			}
		});
		
		
		name_helper.loadSettings();
	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}
}
{'fraction_non_alphanumeric': 0.10444234404536862, 'fraction_numerical': 0.001890359168241966, 'mean_word_length': 4.651535380507343, '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': '1225673', 'n_tokens_mistral': 1463, 'n_tokens_neox': 1272, 'n_words': 262}