47 |
47 |
import org.eclipse.swt.events.KeyEvent;
|
48 |
48 |
import org.eclipse.swt.events.MouseAdapter;
|
49 |
49 |
import org.eclipse.swt.events.MouseEvent;
|
|
50 |
import org.eclipse.swt.events.SelectionEvent;
|
|
51 |
import org.eclipse.swt.events.SelectionListener;
|
50 |
52 |
import org.eclipse.swt.widgets.Composite;
|
51 |
53 |
import org.eclipse.swt.widgets.Display;
|
52 |
54 |
import org.eclipse.swt.widgets.Menu;
|
... | ... | |
240 |
242 |
}
|
241 |
243 |
//PlatformUI.getWorkbench().getHelpSystem().setHelp(treeViewer.getTree(), "org.txm.rcpapplication.corporaView" //$NON-NLS-1$);
|
242 |
244 |
|
243 |
|
treeViewer.getTree().addMouseListener(new MouseAdapter() {
|
|
245 |
treeViewer.getTree().addSelectionListener(new SelectionListener() {
|
|
246 |
|
244 |
247 |
@Override
|
245 |
|
public void mouseDown(MouseEvent e) {
|
246 |
|
IViewSite site = getViewSite();
|
247 |
|
if (site != null) {
|
248 |
|
IWorkbenchPage page = site.getPage();
|
249 |
|
if (page != null)
|
250 |
|
page.activate(CorporaView.this);
|
251 |
|
}
|
252 |
|
|
|
248 |
public void widgetSelected(SelectionEvent e) {
|
253 |
249 |
TreeItem[] sel = treeViewer.getTree().getSelection();
|
254 |
250 |
if (sel.length == 0)
|
255 |
251 |
return;
|
... | ... | |
288 |
284 |
} else {
|
289 |
285 |
StatusLine.setMessage(selectedItem.toString());
|
290 |
286 |
}
|
|
287 |
|
291 |
288 |
}
|
|
289 |
|
|
290 |
@Override
|
|
291 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
292 |
// TODO Auto-generated method stub
|
|
293 |
|
|
294 |
}
|
292 |
295 |
});
|
|
296 |
|
|
297 |
|
|
298 |
// FIXME: old code that does not manage keyboard selection
|
|
299 |
// treeViewer.getTree().addMouseListener(new MouseAdapter() {
|
|
300 |
// @Override
|
|
301 |
// public void mouseDown(MouseEvent e) {
|
|
302 |
// IViewSite site = getViewSite();
|
|
303 |
// if (site != null) {
|
|
304 |
// IWorkbenchPage page = site.getPage();
|
|
305 |
// if (page != null)
|
|
306 |
// page.activate(CorporaView.this);
|
|
307 |
// }
|
|
308 |
//
|
|
309 |
// TreeItem[] sel = treeViewer.getTree().getSelection();
|
|
310 |
// if (sel.length == 0)
|
|
311 |
// return;
|
|
312 |
//
|
|
313 |
// ISelection tsel = treeViewer.getSelection();
|
|
314 |
// if (!(tsel instanceof TreeSelection)) return;
|
|
315 |
//
|
|
316 |
// TreeSelection selection = (TreeSelection) treeViewer.getSelection();
|
|
317 |
// Object selectedItem = selection.getFirstElement();
|
|
318 |
// //TODO : add more status message on clicked objects of corpora view
|
|
319 |
// if (selectedItem instanceof Corpus) {
|
|
320 |
// try {
|
|
321 |
// StatusLine.setMessage(((Corpus)selectedItem).getName()+ ", T = "+((Corpus)selectedItem).getSize()); //$NON-NLS-1$
|
|
322 |
// } catch (CqiClientException e1) {
|
|
323 |
// Log.severe(NLS.bind(Messages.CorporaView_2, ((Corpus)selectedItem).getName()));
|
|
324 |
// StatusLine.setMessage(((Corpus)selectedItem).getName()+ " is not ready"); //$NON-NLS-1$
|
|
325 |
// }
|
|
326 |
// } else if (selectedItem instanceof Partition) {
|
|
327 |
// StatusLine.setMessage(((Partition)selectedItem).getName() + ": "+((Partition)selectedItem).getNPart()); //$NON-NLS-1$
|
|
328 |
// } else if (selectedItem instanceof Concordance) {
|
|
329 |
// StatusLine.setMessage(((Concordance)selectedItem).getName());
|
|
330 |
// } else if (selectedItem instanceof Cooccurrence) {
|
|
331 |
// StatusLine.setMessage(((Cooccurrence)selectedItem).getName());
|
|
332 |
// } else if (selectedItem instanceof Index) {
|
|
333 |
// StatusLine.setMessage(((Index)selectedItem).getName());
|
|
334 |
// } else if (selectedItem instanceof CA) {
|
|
335 |
// StatusLine.setMessage(((CA)selectedItem).getName());
|
|
336 |
// } else if (selectedItem instanceof CAH) {
|
|
337 |
// StatusLine.setMessage(((CAH)selectedItem).getName());
|
|
338 |
// } else if (selectedItem instanceof SpecificitesResult) {
|
|
339 |
// StatusLine.setMessage(((SpecificitesResult)selectedItem).getName());
|
|
340 |
// } else if (selectedItem instanceof InternalView) {
|
|
341 |
// StatusLine.setMessage(((InternalView)selectedItem).getDetails());
|
|
342 |
// // } else if (selectedItem instanceof QueryIndex) {
|
|
343 |
// // StatusLine.setMessage(((QueryIndex)selectedItem).getName());
|
|
344 |
// } else {
|
|
345 |
// StatusLine.setMessage(selectedItem.toString());
|
|
346 |
// }
|
|
347 |
// }
|
|
348 |
// });
|
293 |
349 |
|
294 |
350 |
treeViewer.addDoubleClickListener(new IDoubleClickListener() {
|
295 |
351 |
@Override
|
... | ... | |
311 |
367 |
} catch (PartInitException e) {
|
312 |
368 |
System.err.println(Messages.CorporaView_3+ e);
|
313 |
369 |
}
|
314 |
|
// } else if (selectedItem instanceof SpecificitesResult) {
|
315 |
|
// SpecificitesResult specifRes = (SpecificitesResult) selectedItem;
|
316 |
|
// Partition partition = null;
|
317 |
|
// IEditorInput editorInput = null;
|
318 |
|
//
|
319 |
|
// if (specifRes.getLexicalTable() != null) {
|
320 |
|
// if (specifRes.getLexicalTable().getPartition() != null) {
|
321 |
|
// partition = specifRes.getLexicalTable().getPartition();
|
322 |
|
// editorInput = new SpecificitiesResultEditorInput(specifRes, partition);
|
323 |
|
// } else {
|
324 |
|
// editorInput = new SpecificitiesResultEditorInput(
|
325 |
|
// specifRes, specifRes.getLexicalTable().getCorpus());
|
326 |
|
// }
|
327 |
|
// } else {
|
328 |
|
// editorInput = new SpecificitiesResultEditorInput(
|
329 |
|
// specifRes, specifRes.getCorpus());
|
330 |
|
// }
|
331 |
|
//
|
332 |
|
// IWorkbenchPage page = getSite().getWorkbenchWindow().getActivePage();
|
333 |
|
// try {
|
334 |
|
// page.openEditor(editorInput, SpecificitiesTableEditor.ID); //$NON-NLS-1$
|
335 |
|
// } catch (PartInitException e) {
|
336 |
|
// System.err.println(Messages.CorporaView_5+e);
|
337 |
|
// }
|
338 |
370 |
} else if (selectedItem instanceof LexicalTable) {
|
339 |
371 |
LexicalTable lt = (LexicalTable) selectedItem;
|
340 |
372 |
IEditorInput editorInput = new LexicalTableEditorInput(lt);
|
... | ... | |
382 |
414 |
// System.err.println(Messages.CorporaView_7+ e);
|
383 |
415 |
// }
|
384 |
416 |
|
385 |
|
// } else if (selectedItem instanceof Progression) {
|
386 |
|
//
|
387 |
|
// // FIXME : use charts engine instead of code below
|
388 |
|
// Progression progression = (Progression) selectedItem;
|
389 |
|
//
|
390 |
|
// // FIXME: temporary force R/SVG version because the Progression density chart is not yet implemented in JFC mode
|
391 |
|
// if(!progression.isDoCumulative()) {
|
392 |
|
// ___RChartsEngine tmpChartsEngine = new ___RChartsEngine(___ChartsEngine.OUTPUT_FORMAT_SVG);
|
393 |
|
// ___SVGChartsSWTComponentProvider tmpSWTComponentsProvider = new ___SVGChartsSWTComponentProvider(tmpChartsEngine);
|
394 |
|
// ___ChartEditorPart chartEditor = tmpSWTComponentsProvider.createProgressionChartEditorPart(IImageKeys.getImage(IImageKeys.ACTION_PROGRESSION), progression, progression.isMonochrome(), progression.isMonostyle(), progression.isDoCumulative());
|
395 |
|
// // Create and open the chart editor
|
396 |
|
// ___SWTChartsComponentProvider.openEditor(chartEditor);
|
397 |
|
// }
|
398 |
|
// else {
|
399 |
|
// // Create and open the chart editor
|
400 |
|
// ___SWTChartsComponentProvider.openEditor(Application.swtComponentProvider.createProgressionChartEditorPart(IImageKeys.getImage(IImageKeys.ACTION_PROGRESSION), progression, progression.isMonochrome(), progression.isMonostyle(), progression.isDoCumulative()));
|
401 |
|
// }
|
402 |
|
//
|
403 |
|
// // FIXME : to remove when charts engine will be valdiated
|
404 |
|
//// try {
|
405 |
|
//// // System.out.println("run syncexec");
|
406 |
|
//// String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
|
407 |
|
//// RDevice device = RDevice.valueOf(TxmPreferences.getString(ExportPreferencePage.RDEVICE, RDevice.SVG.toString()).toUpperCase());
|
408 |
|
////
|
409 |
|
//// File resultDir = new File(txmhome, "results"); //$NON-NLS-1$
|
410 |
|
//// resultDir.mkdirs();
|
411 |
|
//// File svgfile = File.createTempFile("progression", device.getExt(), resultDir); //$NON-NLS-1$
|
412 |
|
//// if (!svgfile.canWrite()) {
|
413 |
|
//// System.out.println(NLS.bind(Messages.CorporaView_9, svgfile));
|
414 |
|
//// return;
|
415 |
|
//// }
|
416 |
|
//// progression.toSvg(svgfile, device);
|
417 |
|
//// StatusLine.setMessage(""); //$NON-NLS-1$
|
418 |
|
//// IEditorPart editor = OpenGraph.OpenFile(svgfile, device, progression.getCorpus()+": "+progression.getName(), IImageKeys.ACTION_PROGRESSION); //$NON-NLS-1$
|
419 |
|
//// if (editor != null && editor instanceof CustomizableEditor) {
|
420 |
|
//// CustomizableEditor ceditor = (CustomizableEditor) editor;
|
421 |
|
//// ceditor.setSource(progression);
|
422 |
|
//// }
|
423 |
|
//// } catch (Exception e) {
|
424 |
|
//// org.txm.rcpapplication.utils.Logger.printStackTrace(e);
|
425 |
|
//// }
|
426 |
|
////
|
427 |
|
//
|
428 |
417 |
} else if (selectedItem instanceof Cooccurrence) {
|
429 |
418 |
Cooccurrence cooc = (Cooccurrence) selectedItem;
|
430 |
419 |
|
... | ... | |
461 |
450 |
} catch (PartInitException e) {
|
462 |
451 |
System.err.println(Messages.CorporaView_6+ e);
|
463 |
452 |
}
|
464 |
|
// } else if (selectedItem instanceof CA) {
|
465 |
|
// CA ca = (CA) selectedItem;
|
466 |
|
// CorrespondanceAnalysisEditorInput editorInput = new CorrespondanceAnalysisEditorInput(ca, ca.getPartition(), ca.getAnalysisProperty());
|
467 |
|
// IWorkbenchPage page = getSite().getWorkbenchWindow().getActivePage();
|
468 |
|
// try {
|
469 |
|
// CaEditor editor = (CaEditor) page.openEditor(editorInput,"org.txm.rcpapplication.editors.ca.CaEditor"); //$NON-NLS-1$
|
470 |
|
// editor.refreshGraphEditor();
|
471 |
|
// // FIXME: to remove when charts engine will be validated
|
472 |
|
// //IEditorPart editor2 = page.openEditor(editorInput, "org.txm.rcpapplication.editors.ca.FactorialMapEditor"); //$NON-NLS-1$
|
473 |
|
// } catch (PartInitException e) {
|
474 |
|
// org.txm.rcpapplication.utils.Logger.printStackTrace(e);
|
475 |
|
// }
|
476 |
|
// }
|
477 |
453 |
// else if (selectedItem instanceof CAH) {
|
478 |
454 |
//
|
479 |
455 |
// IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
|