Révision 2234
| tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/BackToText.java (revision 2234) | ||
|---|---|---|
| 50 | 50 |
import org.txm.edition.rcp.editors.RGBA; |
| 51 | 51 |
import org.txm.edition.rcp.editors.SynopticEditionEditor; |
| 52 | 52 |
import org.txm.edition.rcp.messages.EditionUIMessages; |
| 53 |
import org.txm.edition.rcp.preferences.SynopticEditionPreferences; |
|
| 53 | 54 |
import org.txm.objects.Match; |
| 54 | 55 |
import org.txm.objects.Text; |
| 55 | 56 |
import org.txm.rcp.StatusLine; |
| ... | ... | |
| 277 | 278 |
|
| 278 | 279 |
attachedBrowserEditor = OpenEdition.openEdition(corpus, editionsToOpen); |
| 279 | 280 |
editor.addLinkedEditor(attachedBrowserEditor); |
| 280 |
SWTEditorsUtils.addEditor(editor, attachedBrowserEditor, EModelService.ABOVE); |
|
| 281 |
|
|
| 282 |
int position = SynopticEditionPreferences.getInstance().getInt(SynopticEditionPreferences.BACKTOTEXT_POSITION); |
|
| 283 |
SWTEditorsUtils.addEditor(editor, attachedBrowserEditor, position); |
|
| 281 | 284 |
} |
| 282 | 285 |
|
| 283 | 286 |
// remove previous highlighted words |
| tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/preferences/SynopticEditionPreferences.java (revision 2234) | ||
|---|---|---|
| 1 | 1 |
package org.txm.edition.rcp.preferences; |
| 2 | 2 |
|
| 3 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
| 3 | 4 |
import org.osgi.service.prefs.Preferences; |
| 4 | 5 |
import org.txm.core.preferences.TXMPreferences; |
| 5 | 6 |
|
| ... | ... | |
| 17 | 18 |
* |
| 18 | 19 |
*/ |
| 19 | 20 |
public static final String FAST_HIGHLIGHT = "fast_highlight"; //$NON-NLS-1$ |
| 21 |
|
|
| 22 |
/** |
|
| 23 |
* one of the EModelService position constant: ABOVE = 0 BELOW = 1 LEFT_OF = 2 RIGHT_OF = 3 |
|
| 24 |
*/ |
|
| 25 |
public static final String BACKTOTEXT_POSITION = "backtotext_position"; //$NON-NLS-1$ |
|
| 20 | 26 |
|
| 21 | 27 |
|
| 22 | 28 |
/** |
| ... | ... | |
| 35 | 41 |
super.initializeDefaultPreferences(); |
| 36 | 42 |
Preferences preferences = this.getDefaultPreferencesNode(); |
| 37 | 43 |
preferences.putBoolean(FAST_HIGHLIGHT, false); |
| 44 |
preferences.putInt(BACKTOTEXT_POSITION, EModelService.RIGHT_OF); |
|
| 38 | 45 |
} |
| 39 | 46 |
} |
| tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/preferences/SynopticEditionPreferencePage.java (revision 2234) | ||
|---|---|---|
| 1 | 1 |
package org.txm.edition.rcp.preferences; |
| 2 | 2 |
|
| 3 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
| 3 | 4 |
import org.eclipse.jface.preference.BooleanFieldEditor; |
| 5 |
import org.eclipse.jface.preference.ComboFieldEditor; |
|
| 6 |
import org.eclipse.jface.preference.IntegerFieldEditor; |
|
| 4 | 7 |
import org.eclipse.ui.IWorkbench; |
| 5 | 8 |
import org.txm.edition.rcp.messages.EditionUIMessages; |
| 6 | 9 |
import org.txm.rcp.IImageKeys; |
| ... | ... | |
| 17 | 20 |
public class SynopticEditionPreferencePage extends TXMPreferencePage {
|
| 18 | 21 |
|
| 19 | 22 |
private BooleanFieldEditor fast_highlight; |
| 23 |
private ComboFieldEditor backtotext_position; |
|
| 20 | 24 |
|
| 21 | 25 |
@Override |
| 22 | 26 |
public void init(IWorkbench workbench) {
|
| ... | ... | |
| 29 | 33 |
protected void createFieldEditors() {
|
| 30 | 34 |
fast_highlight = new BooleanFieldEditor(SynopticEditionPreferences.FAST_HIGHLIGHT, EditionUIMessages.enableFastWordHighlight, getFieldEditorParent()); |
| 31 | 35 |
addField(fast_highlight); |
| 36 |
|
|
| 37 |
String[][] values = {{"ABOVE", ""+EModelService.ABOVE}, {"BELOW", ""+EModelService.BELOW}, {"LEFT_OF", ""+EModelService.LEFT_OF}, {"RIGHT_OF", ""+EModelService.RIGHT_OF}};
|
|
| 38 |
|
|
| 39 |
backtotext_position = new ComboFieldEditor(SynopticEditionPreferences.BACKTOTEXT_POSITION, "new editor position", values, getFieldEditorParent()); |
|
| 40 |
addField(backtotext_position); |
|
| 32 | 41 |
} |
| 33 | 42 |
} |
| tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java (revision 2234) | ||
|---|---|---|
| 54 | 54 |
import org.eclipse.swt.SWT; |
| 55 | 55 |
import org.eclipse.swt.events.KeyEvent; |
| 56 | 56 |
import org.eclipse.swt.events.KeyListener; |
| 57 |
import org.eclipse.swt.events.MouseEvent; |
|
| 58 |
import org.eclipse.swt.events.MouseWheelListener; |
|
| 57 | 59 |
import org.eclipse.swt.events.SelectionEvent; |
| 58 | 60 |
import org.eclipse.swt.events.SelectionListener; |
| 59 | 61 |
import org.eclipse.swt.graphics.Cursor; |
| ... | ... | |
| 112 | 114 |
private ISelectionProvider selProvider; |
| 113 | 115 |
private org.eclipse.swt.widgets.Text text_text; |
| 114 | 116 |
private Label text_label; |
| 117 |
private TXMAutoCompleteField identifiantComboAutoCompleteField; |
|
| 115 | 118 |
|
| 116 | 119 |
//TODO finish editor conversion |
| 117 | 120 |
public Text getResult() {
|
| ... | ... | |
| 401 | 404 |
// Navigation buttons |
| 402 | 405 |
GLComposite pageNavigationComposite = new GLComposite(controlsArea, SWT.NONE, EditionUIMessages.pageButtons); |
| 403 | 406 |
pageNavigationComposite.getLayout().numColumns = 6; |
| 407 |
pageNavigationComposite.getLayout().horizontalSpacing = 1; |
|
| 404 | 408 |
Button first = new Button(pageNavigationComposite, SWT.FLAT|SWT.PUSH); |
| 405 | 409 |
Button previous = new Button(pageNavigationComposite, SWT.FLAT|SWT.PUSH); |
| 406 | 410 |
page_text = new org.eclipse.swt.widgets.Text(pageNavigationComposite, SWT.BORDER); |
| ... | ... | |
| 411 | 415 |
|
| 412 | 416 |
GLComposite textNavigationComposite = new GLComposite(controlsArea, SWT.NONE, EditionUIMessages.textButtons); |
| 413 | 417 |
textNavigationComposite.getLayout().numColumns = 7; |
| 418 |
textNavigationComposite.getLayout().horizontalSpacing = 1; |
|
| 414 | 419 |
Button firstText = new Button(textNavigationComposite, SWT.FLAT); |
| 415 | 420 |
Button previousText = new Button(textNavigationComposite, SWT.FLAT); |
| 416 | 421 |
text_text = new org.eclipse.swt.widgets.Text(textNavigationComposite, SWT.BORDER); |
| ... | ... | |
| 426 | 431 |
} |
| 427 | 432 |
} |
| 428 | 433 |
text_text.setLayoutData(gdata); |
| 429 |
TXMAutoCompleteField identifiantComboAutoCompleteField = new TXMAutoCompleteField(text_text, new TextContentAdapter(), text_ids, keys); |
|
| 434 |
identifiantComboAutoCompleteField = new TXMAutoCompleteField(text_text, new TextContentAdapter(), text_ids, keys); |
|
| 435 |
// identifiantComboAutoCompleteField.setSelectionListener(new SelectionListener() {
|
|
| 436 |
// @Override |
|
| 437 |
// public void widgetSelected(SelectionEvent e) {
|
|
| 438 |
// goToText(text_text.getText()); |
|
| 439 |
// } |
|
| 440 |
// |
|
| 441 |
// @Override |
|
| 442 |
// public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 443 |
// }); |
|
| 430 | 444 |
} catch (Exception e2) {
|
| 431 | 445 |
e2.printStackTrace(); |
| 432 | 446 |
} |
| ... | ... | |
| 456 | 470 |
|
| 457 | 471 |
// set sizes |
| 458 | 472 |
|
| 459 |
// GridData gdata = new GridData(GridData.END,GridData.CENTER, false, false); |
|
| 460 |
// gdata.minimumWidth = 40; |
|
| 461 |
// gdata.widthHint = 40; |
|
| 462 |
// page_text.setLayoutData(gdata); |
|
| 473 |
GridData gdata = new GridData(GridData.END,GridData.CENTER, false, false); |
|
| 474 |
gdata.minimumWidth = 25; |
|
| 475 |
gdata.widthHint = 25; |
|
| 476 |
|
|
| 477 |
page_text.setLayoutData(gdata); |
|
| 463 | 478 |
// page_label.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false)); |
| 464 | 479 |
// |
| 465 | 480 |
// next.setLayoutData(buttonGridData); |
| ... | ... | |
| 470 | 485 |
// nextText.setLayoutData(buttonGridData); |
| 471 | 486 |
// lastText.setLayoutData(buttonGridData); |
| 472 | 487 |
|
| 473 |
|
|
| 474 | 488 |
// if (editionsChooser != null) |
| 475 | 489 |
// editionsChooser.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, true)); |
| 476 | 490 |
//else spacer.setLayoutData(new GridData(GridData.END,GridData.CENTER, true, true)); |
| ... | ... | |
| 512 | 526 |
@Override |
| 513 | 527 |
public void keyReleased(KeyEvent e) {
|
| 514 | 528 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
|
| 529 |
if (identifiantComboAutoCompleteField.isOpen()) return; // ignore keys when content assist is opened |
|
| 530 |
|
|
| 515 | 531 |
goToText(text_text.getText()); |
| 532 |
} else if (e.keyCode == SWT.ARROW_DOWN) {
|
|
| 533 |
nextText(); |
|
| 534 |
} else if (e.keyCode == SWT.ARROW_UP) {
|
|
| 535 |
previousText(false); |
|
| 516 | 536 |
} |
| 517 | 537 |
} |
| 518 | 538 |
|
| 519 | 539 |
@Override |
| 520 | 540 |
public void keyPressed(KeyEvent e) {}
|
| 521 | 541 |
}); |
| 542 |
text_text.addMouseWheelListener(new MouseWheelListener() {
|
|
| 543 |
@Override |
|
| 544 |
public void mouseScrolled(MouseEvent e) {
|
|
| 545 |
if (identifiantComboAutoCompleteField.isOpen()) return; |
|
| 546 |
|
|
| 547 |
if (e.count > 0) {
|
|
| 548 |
previousText(false); |
|
| 549 |
} else {
|
|
| 550 |
nextText(); |
|
| 551 |
} |
|
| 552 |
//toolbar.getEditor().updateWordStyles(); |
|
| 553 |
} |
|
| 554 |
}); |
|
| 522 | 555 |
// set listeners |
| 523 | 556 |
first.addSelectionListener(new SelectionListener() {
|
| 524 | 557 |
@Override |
Formats disponibles : Unified diff