Revision 2133

tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 2133)
868 868
	private void composeControlArea(final Composite controlArea) {
869 869

  
870 870

  
871
		// Computing listeners
872
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
871
		// Modified computing listeners to manage multi lines query widgets
872
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this) {
873
			@Override
874
			public void keyPressed(KeyEvent e) {
875
				if (queryWidget.getQuery() == null) return;
876
				if (!queryWidget.getQuery().getSearchEngine().hasMultiLineQueries()) super.keyPressed(e);
877
			}
878
		};
873 879

  
874

  
875 880
		GridLayout controlLayout = new GridLayout(1, false);
876 881
		controlLayout.verticalSpacing = 0;
877 882
		controlLayout.marginWidth = 0;
......
907 912
		queryLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
908 913

  
909 914
		// [ (v)]
910
		queryWidget = new AssistedChoiceQueryWidget(this.getMainParametersComposite(), SWT.DROP_DOWN, concordance.getCorpus());
915
		queryWidget = new AssistedChoiceQueryWidget(this.getMainParametersComposite(), SWT.DROP_DOWN|SWT.MULTI| SWT.WRAP | SWT.V_SCROLL, concordance.getCorpus());
911 916
		queryWidget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
912 917
		queryWidget.addKeyListener(computeKeyListener);
913 918
		queryWidget.getQueryWidget().addModifyListener(computeKeyListener);
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/BasesView.java (revision 2133)
209 209
		 * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
210 210
		 */
211 211
		@Override
212
		public String getText(Object Element) {
213
			return ((TXMResult) Element).getName();
212
		public String getText(Object element) {
213
			String title = ((TXMResult) element).getName();
214
			if (title.length() > 41) { // limit text length
215
				title = title.substring(0, 40)+"..."; 
216
			}
217
			return title;
214 218
		}
215 219

  
216 220
		/* (non-Javadoc)
......
219 223
		@Override
220 224
		public final Image getImage(Object element) {
221 225
			ImageDescriptor imageDescriptor = AbstractUIPlugin
222
					.imageDescriptorFromPlugin(Application.PLUGIN_ID,
226
					.imageDescriptorFromPlugin(Application.PLUGIN_ID, 
223 227
							IImageKeys.FILE);
224 228
			if (element instanceof Project)
225 229
				imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2133)
1052 1052
		// disable the component rendering to avoid strange behaviors when modifying the result area widget
1053 1053
		//this.getContainer().setRedraw(false);
1054 1054

  
1055
		this.setPartName(result.getName());
1055
		String title = result.getName();
1056
		if (title.length() > 41) { // limit title length
1057
			title = title.substring(0, 40)+"..."; 
1058
		}
1059
		this.setPartName(title);
1056 1060
		//this.firePropertyChange(TXMEditor.PROP_DIRTY);
1057 1061

  
1058 1062
		//MD commented 'if (!update) {...}'
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedChoiceQueryWidget.java (revision 2133)
30 30
import java.util.List;
31 31

  
32 32
import org.eclipse.jface.viewers.ComboViewer;
33
import org.eclipse.jface.viewers.IBaseLabelProvider;
34
import org.eclipse.jface.viewers.ILabelProviderListener;
35 33
import org.eclipse.jface.viewers.ISelection;
36 34
import org.eclipse.jface.viewers.ISelectionChangedListener;
37 35
import org.eclipse.jface.viewers.LabelProvider;
......
51 49
import org.txm.rcp.swt.GLComposite;
52 50
import org.txm.rcp.swt.dialog.QueryAssistDialog;
53 51
import org.txm.rcp.swt.provider.ListContentProvider;
54
import org.txm.rcp.swt.provider.SimpleLabelProvider;
55 52
import org.txm.searchengine.core.IQuery;
56 53
import org.txm.searchengine.core.SearchEngine;
57 54
import org.txm.searchengine.core.SearchEnginesManager;
58 55
import org.txm.searchengine.cqp.corpus.CQPCorpus;
59
import org.txm.searchengine.cqp.corpus.query.CQLQuery;
60 56

  
61 57
/**
62
 * the QueryWidget 
58
 * The QueryWidget 
63 59
 * 	+ the button to open the QueryAssisDialog
64 60
 *  + Engine selector 
65 61
 * 
......
113 109
					Object o = sel.getFirstElement();
114 110
					SearchEngine se = (SearchEngine)o;
115 111
					querywidget.setSearchEngine(se);
112
					GridData gdata = (GridData) querywidget.getLayoutData();
113
					if (se.hasMultiLineQueries()) gdata.heightHint = 100;
114
					else gdata.heightHint = -1;
115
					querywidget.layout();
116
					relayout();
117
					
116 118
				}
117 119
			});
118 120
		}
......
142 144
		}
143 145
	}
144 146
	
147
	protected void relayout() {
148
		Composite parent = AssistedChoiceQueryWidget.this.getParent();
149
//		parent.layout(true);
150
//		parent.getParent().layout(true);
151
		try {
152
			parent.getParent().getParent().layout(true);
153
		} catch(Exception e) {
154
			parent.layout(true);
155
		}
156
//		while (parent instanceof Composite) {
157
//			
158
//			if (!(parent.getParent() instanceof Composite)) {
159
//				parent.layout();
160
//				return;
161
//			}
162
//			parent = parent.getParent();
163
//		}
164
	}
165

  
145 166
	public void setEnabled(boolean b) {
146 167
		super.setEnabled(b);
147 168
		querywidget.setEnabled(b);
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/QueryWidget.java (revision 2133)
82 82
		String rawQuery;
83 83
		if (getSelectionIndex() < 0) {
84 84
			rawQuery = getText();
85
		}
86
		else {
85
		} else {
87 86
			rawQuery = this.getItem(this.getSelectionIndex());
88 87
		}
89 88
		return se.newQuery().setQuery(rawQuery).getQueryString();
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 2133)
40 40
		return true;
41 41
	}
42 42

  
43
	/**
44
	 * 
45
	 * @return true because TIGER queries are frequently multi lines
46
	 */
47
	public boolean hasMultiLineQueries() {
48
		return true;
49
	}
50
	
43 51
	@Override
44 52
	public boolean start(IProgressMonitor monitor) throws Exception {
45 53
		return true;
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 2133)
910 910
	@Override
911 911
	public String getSimpleName() {
912 912
		if (this.pQuery != null && !this.pQuery.isEmpty()) {
913
			return this.pQuery.toString();
913
			return this.pQuery.toString().replace("\n", " ");
914 914
		}
915 915
		else	{
916 916
			return this.getEmptyName();
......
924 924
			String name = this.getCorpus().getName();
925 925
			
926 926
			if (this.pQuery != null && !this.pQuery.isEmpty()) {
927
				name += " " + this.pQuery.toString(); //$NON-NLS-1$
927
				name += " " + this.pQuery.toString().replace("\n", " "); //$NON-NLS-1$
928 928
			}
929 929
//			
930 930
//			if (this.queryResult != null) {
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java (revision 2133)
29 29
	 * @return
30 30
	 */
31 31
	public static SearchEngine getTIGERSearchEngine() {
32
		return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("TIGER");
32
		return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("TIGER"); //$NON-NLS-1$
33 33
	}
34 34
	
35 35
	/**
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java (revision 2133)
57 57
	 * @return the positions property value
58 58
	 */
59 59
	public abstract List<String> getValuesForProperty(Match match, SearchEngineProperty property);
60

  
61
	/**
62
	 * 
63
	 * @return indicates if the SearchEngine queries need mumltiple lines to be written
64
	 */
65
	public boolean hasMultiLineQueries() {
66
		return false;
67
	}
60 68
}

Also available in: Unified diff