Révision 2262

tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionLink.java (revision 2262)
6 6
import org.eclipse.swt.browser.BrowserFunction;
7 7
import org.txm.edition.rcp.handlers.BackToText;
8 8
import org.txm.edition.rcp.messages.EditionUIMessages;
9

  
9
/**
10
 * Browser Javascript method to open a TXM edition given 1 to 4 parameters : corpusid, editionid, textid, wordid
11
 * @author mdecorde
12
 *
13
 */
10 14
public class EditionLink extends BrowserFunction {
11 15

  
12 16
	String data = ""; //$NON-NLS-1$
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java (revision 2262)
359 359
//		annotationWidgetsArea = new GLComposite(getBetweenTopToolbarsAndResultComposite(), SWT.NONE, "Edition annotation area");
360 360
//		this.annotationWidgetsArea.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
361 361

  
362
	//	supplementaryButtonToolbar = new TXMEditorToolBar(this, getTopToolbarContainer(), annotationWidgetsArea, SWT.NONE, "annotation urs");
362
		//supplementaryButtonToolbar = new TXMEditorToolBar(this, getTopToolbarContainer(), annotationWidgetsArea, SWT.NONE, "annotation urs");
363 363
		
364 364
		// Edition names label
365 365
		editionsChooser = new Button(controlsArea, SWT.PUSH);
......
382 382
						if (d.open() == Window.OK) {
383 383
							Object[] rez = d.getResult();
384 384
							editionNames = new ArrayList<String>();
385
							for(int i = 0 ; i < rez.length ; i++) editionNames.add(rez[i].toString());
385
							for (int i = 0 ; i < rez.length ; i++) {
386
								editionNames.add(rez[i].toString());
387
							}
386 388
							
387 389
							editionsChooser.setText(StringUtils.join(editionNames, " | ")); //$NON-NLS-1$
388 390
							openEditions(text, editionNames);
......
469 471
//		previous.setLayoutData(buttonGridData);
470 472

  
471 473
		// set sizes
472

  
473 474
		GridData gdata = new GridData(GridData.END,GridData.CENTER, false, false);
474 475
		gdata.minimumWidth = 25;
475 476
		gdata.widthHint = 25;
......
526 527
			@Override
527 528
			public void keyReleased(KeyEvent e) {
528 529
				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
529
					if (identifiantComboAutoCompleteField.isOpen()) return; // ignore keys when content assist is opened
530
					if (identifiantComboAutoCompleteField.isOpen()) {
531
						return; // ignore keys when content assist is opened
532
					}
530 533
					
531 534
					goToText(text_text.getText());
532 535
				} else if (e.keyCode == SWT.ARROW_DOWN) {
......
542 545
		text_text.addMouseWheelListener(new MouseWheelListener() {
543 546
			@Override
544 547
			public void mouseScrolled(MouseEvent e) {
545
				if (identifiantComboAutoCompleteField.isOpen()) return;
548
				if (identifiantComboAutoCompleteField.isOpen()) {
549
					return;
550
				}
546 551

  
547 552
				if (e.count > 0) {
548 553
					previousText(false);
......
653 658
				firstPage();
654 659
			}
655 660
		} catch (Exception e1) {
656
			// TODO Auto-generated catch block
657 661
			e1.printStackTrace();
658 662
		}
659 663
	}
......
674 678
	private void updatePageLabel() {
675 679
		for (EditionPanel p : editionPanels.values()) {
676 680
			Page cpage = p.getCurrentPage();
677
			if (cpage == null) continue;
681
			if (cpage == null) {
682
				continue;
683
			}
678 684
			Edition e = cpage.getEdition();
679
			if (e == null) continue;
685
			if (e == null) {
686
				continue;
687
			}
680 688
			this.setPartName(e.getText().getName()+ " - "+cpage.getName()); //$NON-NLS-1$
681 689
			
682
			if (page_text.isDisposed()) continue;
690
			if (page_text.isDisposed()) {
691
				continue;
692
			}
683 693
			page_text.setText(cpage.getName());
684 694
			page_label.setText(" / "+e.getNumPages()); //$NON-NLS-1$
685 695
			
......
777 787
	}
778 788

  
779 789
	@Override
780
	public void init(IEditorSite site, IEditorInput input)
781
			throws PartInitException {
790
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
782 791
		
783 792
		corpus = ((SynopticEditorInput) input).getCorpus(); // corpus focused when opening the editions
784 793
		corpus.compute(false);
......
813 822
			updateWordStyles();
814 823
			notifyExtensions("onBackToText"); //$NON-NLS-1$
815 824
		} catch (Exception e) {
816
			// TODO Auto-generated catch block
817 825
			e.printStackTrace();
818 826
		}
819
		
820 827
	}
821 828

  
822 829
	public void reloadPage() {
......
830 837
		String sel = null;
831 838
		for (EditionPanel p : editionPanels.values()) {
832 839
			sel = p.getTextSelection();
833
			if (sel != null) return sel;
840
			if (sel != null) {
841
				return sel;
842
			}
834 843
		}
835 844
		return EditionUIMessages.CommandLink_empty;
836 845
	}
......
839 848
	public CQPCorpus getCorpus() {
840 849
		return corpus;
841 850
	}
842
	
843 851

  
844 852
	public CQPCorpus getMainCorpus() {
845 853
		return mainCorpus;
......
848 856
	public EditionPanel getEditionPanel(int i) {
849 857
		int n = 0;
850 858
		for (EditionPanel p : editionPanels.values()) {
851
			if (n == i) return p;
859
			if (n == i) {
860
				return p;
861
			}
852 862
		}
853 863
		return null;
854 864
	}
......
882 892
	}
883 893

  
884 894
	/**
885
	 *  NOT DONE
895
	 * TODO finish implementation in EditionPanel
886 896
	 *  
887
	 * @param pos
897
	 * @param posisions
888 898
	 */
889 899
	public void setHighlightedArea(HashSet<int[]> positions) {
890 900
		for (EditionPanel p : editionPanels.values()) {
......
933 943
		this.firstPage();
934 944
	}
935 945
	
936
	// Called by JavaScript
937
	
938

  
939 946
	/**
940 947
	 * Browser command that opens an edition
941 948
	 * @author mdecorde
942 949
	 *
943 950
	 */
944
	
945
	
946 951
	public static Object callTXMCommand(String id, HashMap<String, String> params) {
947 952
		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
948 953
		ICommandService cmdService = (ICommandService)window.getService(ICommandService.class);
......
984 989
	 */
985 990
	public static Object callTXMCommand(Object[] arguments) {
986 991
		HashMap<String, String> params = new HashMap<String, String>();
987
		for (int i = 0 ; i < arguments.length ; i += 2) {
992
		for (int i = 0 ; i+1 < arguments.length ; i += 2) {
988 993
			params.put(arguments[i].toString(), arguments[i+1].toString());
989 994
		}
990 995

  

Formats disponibles : Unified diff