Révision 2991
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/ColumnSelectionListener.java (revision 2991) | ||
---|---|---|
26 | 26 |
TableViewerColumn col; |
27 | 27 |
|
28 | 28 |
/** The index. */ |
29 |
int index;
|
|
29 |
int columnIndex;
|
|
30 | 30 |
|
31 | 31 |
/** |
32 | 32 |
* Instantiates a new column selection listener. |
... | ... | |
37 | 37 |
public ColumnSelectionListener(LexicalTableEditor editor, TableViewerColumn formColumn, int index) { |
38 | 38 |
this.editor = editor; |
39 | 39 |
this.col = formColumn; |
40 |
this.index = index;
|
|
40 |
this.columnIndex = index;
|
|
41 | 41 |
} |
42 | 42 |
|
43 | 43 |
/* |
... | ... | |
54 | 54 |
@Override |
55 | 55 |
public void widgetSelected(SelectionEvent e) { |
56 | 56 |
StatusLine.setMessage(TXMUIMessages.sortingColumn); |
57 |
this.editor.sort(this.col, this.index);
|
|
57 |
this.editor.sort(this.col, this.columnIndex);
|
|
58 | 58 |
StatusLine.setMessage(""); //$NON-NLS-1$ |
59 | 59 |
} |
60 | 60 |
} |
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 2991) | ||
---|---|---|
428 | 428 |
|
429 | 429 |
// property column |
430 | 430 |
unitColumn = new TableViewerColumn(viewer, SWT.LEFT); |
431 |
unitColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, unitColumn, -2));
|
|
431 |
unitColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, unitColumn, -3));
|
|
432 | 432 |
// FIXME: viewer comparator tests |
433 | 433 |
// viewerComparator.addSelectionAdapter(viewer, unitColumn.getColumn(), 1); |
434 | 434 |
|
435 | 435 |
// frequency column |
436 | 436 |
freqColumn = new TableViewerColumn(viewer, SWT.LEFT); |
437 | 437 |
freqColumn.getColumn().setText(TXMCoreMessages.common_frequency); |
438 |
freqColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, freqColumn, -1));
|
|
438 |
freqColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, freqColumn, -2));
|
|
439 | 439 |
// FIXME: viewer comparator tests |
440 | 440 |
// viewerComparator.addSelectionAdapter(viewer, freqColumn.getColumn(), 2); |
441 | 441 |
|
442 |
// add a separator empty column |
|
443 |
TableViewerColumn separatorColumn = new TableViewerColumn(viewer, SWT.NONE); |
|
444 |
separatorColumn.getColumn().setResizable(false); |
|
445 |
|
|
442 | 446 |
// Register the context menu |
443 | 447 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); // $NON-NLS-1$ |
444 | 448 |
|
... | ... | |
504 | 508 |
this.viewer.getControl().setRedraw(false); |
505 | 509 |
|
506 | 510 |
// removing old columns |
507 |
for (int i = viewer.getTable().getColumnCount() - 1; i >= 3; i--) {
|
|
511 |
for (int i = viewer.getTable().getColumnCount() - 2; i >= 3; i--) {
|
|
508 | 512 |
viewer.getTable().getColumns()[i].dispose(); |
509 | 513 |
} |
510 | 514 |
|
... | ... | |
547 | 551 |
column.getColumn().setText(colName); |
548 | 552 |
} |
549 | 553 |
|
554 |
// add a separator empty column |
|
555 |
TableViewerColumn separatorColumn = new TableViewerColumn(viewer, SWT.NONE); |
|
556 |
separatorColumn.getColumn().setResizable(false); |
|
557 |
|
|
550 | 558 |
} |
551 | 559 |
catch (StatException e) { |
552 | 560 |
// TODO Auto-generated catch block |
... | ... | |
666 | 674 |
// fix col names |
667 | 675 |
String[] colnames = lexicalTable.getColNames().asStringsArray(); |
668 | 676 |
TableColumn[] cols = viewer.getTable().getColumns(); |
669 |
int ncol = cols.length - 3;
|
|
677 |
int ncol = cols.length - 4;
|
|
670 | 678 |
if (colnames.length != ncol) { |
671 | 679 |
// Log.severe(LexicalTableUIMessages.bind(LexicalTableUIMessages.errorColonDifferentColumnsNumberColonBeforeP0AfterP1, ncol, colnames.length)); |
672 | 680 |
LexicalTable r = getResult(); |
... | ... | |
676 | 684 |
} |
677 | 685 |
for (int i = 0; i < colnames.length; i++) { |
678 | 686 |
// System.out.println("set col name "+colnames[i]); |
679 |
cols[3 + i].setText(colnames[i]);
|
|
687 |
cols[4 + i].setText(colnames[i]);
|
|
680 | 688 |
} |
681 | 689 |
viewer.refresh(); |
682 | 690 |
viewer.setInput(lexicalTable); |
... | ... | |
711 | 719 |
reverse = DEFAULTREVERSE; |
712 | 720 |
} |
713 | 721 |
|
714 |
if (index == -2) {// rownames
|
|
722 |
if (index == -3) {// rownames
|
|
715 | 723 |
lexicalTable.getData().sortRowNames(reverse); |
716 | 724 |
} |
717 |
else if (index == -1) { // freqs
|
|
725 |
else if (index == -2) { // freqs
|
|
718 | 726 |
try { |
719 | 727 |
lexicalTable.getData().sortByFreqs(reverse); |
720 | 728 |
StatusLine.setMessage(TXMUIMessages.sortDone); |
... | ... | |
732 | 740 |
refreshTable(true); |
733 | 741 |
|
734 | 742 |
// viewer.getTable().setSortColumn(col.getColumn()); |
735 |
viewer.getTable().setSortColumn(viewer.getTable().getColumn(index + 3));
|
|
743 |
viewer.getTable().setSortColumn(viewer.getTable().getColumn(index + 4));
|
|
736 | 744 |
|
737 | 745 |
if (reverse) { |
738 | 746 |
viewer.getTable().setSortDirection(SWT.DOWN); |
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LineLabelProvider.java (revision 2991) | ||
---|---|---|
51 | 51 |
String[] rownames; |
52 | 52 |
|
53 | 53 |
/** The cols. */ |
54 |
List<double[]> cols = new ArrayList<double[]>();
|
|
54 |
List<double[]> cols = new ArrayList<>(); |
|
55 | 55 |
|
56 | 56 |
/** The freqs. */ |
57 | 57 |
int[] freqs; |
... | ... | |
100 | 100 |
return null; |
101 | 101 |
} |
102 | 102 |
|
103 |
public static final String EMPTY = ""; |
|
104 |
|
|
103 | 105 |
/* |
104 | 106 |
* (non-Javadoc) |
105 | 107 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) |
... | ... | |
107 | 109 |
@Override |
108 | 110 |
public String getColumnText(Object element, int columnIndex) { |
109 | 111 |
|
110 |
switch (columnIndex) { |
|
111 |
case 0: |
|
112 |
return ""; //$NON-NLS-1$ |
|
113 |
case 1: |
|
114 |
return rownames[(Integer) element]; |
|
115 |
case 2: |
|
116 |
return "" + freqs[(Integer) element]; //$NON-NLS-1$ |
|
117 |
default: |
|
118 |
|
|
119 |
if (columnIndex == Ncols + 3) |
|
120 |
return ""; //$NON-NLS-1$ |
|
121 |
else |
|
122 |
return "" + (int) cols.get(columnIndex - 3)[(Integer) element]; //$NON-NLS-1$ |
|
112 |
if (columnIndex == 0 || columnIndex == 3 || columnIndex == cols.size() + 4) { |
|
113 |
return EMPTY; |
|
123 | 114 |
} |
115 |
else if (columnIndex == 1) { |
|
116 |
return rownames[(Integer) element]; |
|
117 |
} |
|
118 |
else if (columnIndex == 2) { |
|
119 |
return Integer.toString(freqs[(Integer) element]); |
|
120 |
} |
|
121 |
else { |
|
122 |
// if (columnIndex == Ncols + 3) { |
|
123 |
// return EMPTY; |
|
124 |
// } |
|
125 |
// else { |
|
126 |
try { |
|
127 |
return Integer.toString((int) cols.get(columnIndex - 4)[(Integer) element]); |
|
128 |
} |
|
129 |
catch (Exception ee) { |
|
130 |
System.out.println(ee); |
|
131 |
System.out.println(ee); |
|
132 |
; |
|
133 |
return "error"; |
|
134 |
} |
|
135 |
// } |
|
136 |
} |
|
124 | 137 |
} |
125 | 138 |
|
126 | 139 |
/** |
... | ... | |
169 | 182 |
return Arrays.asList(rownames); |
170 | 183 |
} |
171 | 184 |
catch (Exception e) { |
172 |
return new ArrayList<String>();
|
|
185 |
return new ArrayList<>(); |
|
173 | 186 |
} |
174 | 187 |
} |
175 | 188 |
} |
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/editors/DocumentationTab.java (revision 2991) | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import org.eclipse.swt.SWT; |
7 | 7 |
import org.eclipse.swt.browser.Browser; |
8 |
import org.eclipse.swt.events.SelectionListener; |
|
8 | 9 |
import org.eclipse.swt.layout.GridData; |
10 |
import org.eclipse.swt.widgets.Composite; |
|
9 | 11 |
import org.eclipse.swt.widgets.Label; |
10 | 12 |
import org.eclipse.swt.widgets.TabFolder; |
11 | 13 |
import org.eclipse.swt.widgets.TabItem; |
14 |
import org.eclipse.swt.widgets.ToolBar; |
|
15 |
import org.eclipse.swt.widgets.ToolItem; |
|
16 |
import org.eclipse.ui.internal.browser.ImageResource; |
|
12 | 17 |
import org.txm.core.results.TXMResult; |
13 | 18 |
import org.txm.objects.Project; |
14 | 19 |
import org.txm.properties.rcp.Messages; |
... | ... | |
37 | 42 |
} |
38 | 43 |
|
39 | 44 |
protected void buildContent(GLComposite parent) { |
45 |
|
|
46 |
|
|
47 |
createToolbar(parent); |
|
40 | 48 |
this.browser = new Browser(parent, SWT.NONE); |
41 | 49 |
this.browser.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
42 | 50 |
} |
43 | 51 |
|
52 |
|
|
53 |
private ToolBar createToolbar(Composite parent) { |
|
54 |
ToolBar toolbar = new ToolBar(parent, SWT.FLAT); |
|
55 |
|
|
56 |
// create back and forward actions |
|
57 |
ToolItem back = new ToolItem(toolbar, SWT.NONE); |
|
58 |
back.setImage(ImageResource |
|
59 |
.getImage(ImageResource.IMG_ELCL_NAV_BACKWARD)); |
|
60 |
back.setHotImage(ImageResource |
|
61 |
.getImage(ImageResource.IMG_CLCL_NAV_BACKWARD)); |
|
62 |
back.setDisabledImage(ImageResource |
|
63 |
.getImage(ImageResource.IMG_DLCL_NAV_BACKWARD)); |
|
64 |
// back.setToolTipText(Messages.actionWebBrowserBack); |
|
65 |
back.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> this.browser.back())); |
|
66 |
|
|
67 |
ToolItem forward = new ToolItem(toolbar, SWT.NONE); |
|
68 |
forward.setImage(ImageResource |
|
69 |
.getImage(ImageResource.IMG_ELCL_NAV_FORWARD)); |
|
70 |
forward.setHotImage(ImageResource |
|
71 |
.getImage(ImageResource.IMG_CLCL_NAV_FORWARD)); |
|
72 |
forward.setDisabledImage(ImageResource |
|
73 |
.getImage(ImageResource.IMG_DLCL_NAV_FORWARD)); |
|
74 |
// forward.setToolTipText(Messages.actionWebBrowserForward); |
|
75 |
forward.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> this.browser.forward())); |
|
76 |
|
|
77 |
// create refresh, stop, and print actions |
|
78 |
ToolItem stop = new ToolItem(toolbar, SWT.NONE); |
|
79 |
stop.setImage(ImageResource.getImage(ImageResource.IMG_ELCL_NAV_STOP)); |
|
80 |
stop.setHotImage(ImageResource |
|
81 |
.getImage(ImageResource.IMG_CLCL_NAV_STOP)); |
|
82 |
stop.setDisabledImage(ImageResource |
|
83 |
.getImage(ImageResource.IMG_DLCL_NAV_STOP)); |
|
84 |
// stop.setToolTipText(Messages.actionWebBrowserStop); |
|
85 |
stop.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> this.browser.stop())); |
|
86 |
|
|
87 |
ToolItem refresh = new ToolItem(toolbar, SWT.NONE); |
|
88 |
refresh.setImage(ImageResource |
|
89 |
.getImage(ImageResource.IMG_ELCL_NAV_REFRESH)); |
|
90 |
refresh.setHotImage(ImageResource |
|
91 |
.getImage(ImageResource.IMG_CLCL_NAV_REFRESH)); |
|
92 |
refresh.setDisabledImage(ImageResource |
|
93 |
.getImage(ImageResource.IMG_DLCL_NAV_REFRESH)); |
|
94 |
// refresh.setToolTipText(Messages.actionWebBrowserRefresh); |
|
95 |
refresh.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> this.browser.refresh())); |
|
96 |
|
|
97 |
ToolItem home = new ToolItem(toolbar, SWT.NONE); |
|
98 |
home.setImage(ImageResource |
|
99 |
.getImage(ImageResource.IMG_CLCL_NAV_HOME)); |
|
100 |
home.setHotImage(ImageResource |
|
101 |
.getImage(ImageResource.IMG_CLCL_NAV_HOME)); |
|
102 |
home.setDisabledImage(ImageResource |
|
103 |
.getImage(ImageResource.IMG_CLCL_NAV_HOME)); |
|
104 |
home.setToolTipText("Shows opening page."); |
|
105 |
|
|
106 |
TXMResult r = this.editor.getResult().getParent(); |
|
107 |
Project p = r.getFirstParent(Project.class); |
|
108 |
home.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> this.browser.setUrl(p.getDocumentationURL()))); |
|
109 |
|
|
110 |
return toolbar; |
|
111 |
} |
|
112 |
|
|
44 | 113 |
@Override |
45 | 114 |
public void updateResultFromEditor(boolean update) throws Exception { |
46 | 115 |
|
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/editors/PropertiesGeneralTab.java (revision 2991) | ||
---|---|---|
5 | 5 |
import org.eclipse.jface.viewers.DecoratingLabelProvider; |
6 | 6 |
import org.eclipse.jface.viewers.IBaseLabelProvider; |
7 | 7 |
import org.eclipse.swt.SWT; |
8 |
import org.eclipse.swt.browser.Browser; |
|
8 | 9 |
import org.eclipse.swt.events.KeyEvent; |
9 | 10 |
import org.eclipse.swt.events.KeyListener; |
10 | 11 |
import org.eclipse.swt.events.SelectionEvent; |
... | ... | |
21 | 22 |
import org.txm.rcp.views.corpora.CorporaView; |
22 | 23 |
|
23 | 24 |
public class PropertiesGeneralTab extends PropertiesTab { |
24 |
|
|
25 |
|
|
25 | 26 |
private Text nameField; |
26 |
|
|
27 |
|
|
27 | 28 |
public PropertiesGeneralTab(TabFolder folder, PropertiesPagedEditor editor2) { |
28 | 29 |
super(folder, editor2); |
29 | 30 |
tab.setText(Messages.PropertiesGeneralTab_0); |
30 | 31 |
|
31 | 32 |
parent.getLayout().numColumns = 3; |
33 |
parent.getLayout().makeColumnsEqualWidth = false; |
|
32 | 34 |
parent.getLayout().verticalSpacing = 10; |
33 | 35 |
parent.getLayout().horizontalSpacing = 10; |
34 | 36 |
parent.getLayout().marginTop = 10; |
35 | 37 |
parent.getLayout().marginLeft = 10; |
36 | 38 |
|
37 | 39 |
Label image = new Label(parent, SWT.NONE); |
38 |
//image.setImage(IImageKeys.getImage("")); |
|
40 |
// image.setImage(IImageKeys.getImage(""));
|
|
39 | 41 |
IBaseLabelProvider lp = CorporaView.getInstance().getTreeViewer().getLabelProvider(); |
40 | 42 |
if (lp instanceof DecoratingLabelProvider) { |
41 |
Image img = ((DecoratingLabelProvider)lp).getImage(editor.getResult().getParent()); |
|
43 |
Image img = ((DecoratingLabelProvider) lp).getImage(editor.getResult().getParent());
|
|
42 | 44 |
if (img != null) { |
43 | 45 |
image.setImage(img); |
44 |
} else { |
|
46 |
} |
|
47 |
else { |
|
45 | 48 |
image.setImage(IImageKeys.getImage(IImageKeys.FILE)); |
46 | 49 |
} |
47 | 50 |
} |
48 |
image.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, true, 1, 7));
|
|
51 |
image.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, true, 1, 8));
|
|
49 | 52 |
|
50 | 53 |
new Label(parent, SWT.NONE); |
51 | 54 |
Button clipButton = new Button(parent, SWT.PUSH); |
... | ... | |
59 | 62 |
} |
60 | 63 |
|
61 | 64 |
@Override |
62 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
65 |
public void widgetDefaultSelected(SelectionEvent e) {} |
|
63 | 66 |
}); |
64 | 67 |
|
65 | 68 |
Label l = new Label(parent, SWT.NONE); |
... | ... | |
74 | 77 |
public void keyReleased(KeyEvent e) { |
75 | 78 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR && nameField.getText().length() > 0 && !nameField.getText().equals(editor.getResult().getParent().getUserName())) { |
76 | 79 |
editor.getResult().getParent().setUserName(nameField.getText()); |
77 |
System.out.println(Messages.PropertiesGeneralTab_2+nameField.getText());
|
|
80 |
System.out.println(Messages.PropertiesGeneralTab_2 + nameField.getText());
|
|
78 | 81 |
CorporaView.refreshObject(editor.getResult().getParent()); |
79 | 82 |
} |
80 | 83 |
} |
81 | 84 |
|
82 | 85 |
@Override |
83 |
public void keyPressed(KeyEvent e) { }
|
|
86 |
public void keyPressed(KeyEvent e) {} |
|
84 | 87 |
}); |
85 | 88 |
new Label(parent, SWT.NONE).setText(Messages.PropertiesGeneralTab_3); |
86 | 89 |
l = new Label(parent, SWT.NONE); |
87 | 90 |
l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false)); |
88 | 91 |
l.setText(editor.getResult().getParent().getResultType()); |
89 | 92 |
|
90 |
// new Label(parent, SWT.NONE).setText("Size");
|
|
91 |
// l = new Label(parent, SWT.NONE);
|
|
92 |
// l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false));
|
|
93 |
// l.setText(""+editor.getResult().getParent().getChildren().size());
|
|
93 |
// new Label(parent, SWT.NONE).setText("Size");
|
|
94 |
// l = new Label(parent, SWT.NONE);
|
|
95 |
// l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false));
|
|
96 |
// l.setText(""+editor.getResult().getParent().getChildren().size());
|
|
94 | 97 |
|
95 | 98 |
new Label(parent, SWT.NONE).setText(Messages.PropertiesGeneralTab_4); |
96 | 99 |
l = new Label(parent, SWT.NONE); |
97 | 100 |
l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false)); |
98 |
l.setText(""+editor.getResult().getParent().getFullPathSimpleName(false));//.getParent().getParent().getUserName()); //$NON-NLS-1$
|
|
101 |
l.setText("" + editor.getResult().getParent().getFullPathSimpleName(false));// .getParent().getParent().getUserName()); //$NON-NLS-1$
|
|
99 | 102 |
|
100 | 103 |
new Label(parent, SWT.NONE).setText(Messages.PropertiesGeneralTab_6); |
101 | 104 |
l = new Label(parent, SWT.NONE); |
102 | 105 |
l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false)); |
103 | 106 |
Date d = editor.getResult().getParent().getCreationDate(); |
104 | 107 |
if (d != null) { |
105 |
l.setText(""+TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(d)); //$NON-NLS-1$
|
|
108 |
l.setText("" + TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(d)); //$NON-NLS-1$
|
|
106 | 109 |
} |
107 | 110 |
|
108 | 111 |
new Label(parent, SWT.NONE).setText(Messages.PropertiesGeneralTab_8); |
... | ... | |
110 | 113 |
l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false)); |
111 | 114 |
d = editor.getResult().getParent().getLastComputingDate(); |
112 | 115 |
if (d != null) { |
113 |
l.setText(""+TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(d)); //$NON-NLS-1$ |
|
114 |
} else { |
|
116 |
l.setText("" + TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(d)); //$NON-NLS-1$ |
|
117 |
} |
|
118 |
else { |
|
115 | 119 |
l.setText(Messages.PropertiesGeneralTab_10); |
116 | 120 |
} |
117 | 121 |
|
122 |
// l = new Label(parent, SWT.SEPARATOR_FILL); |
|
123 |
// l.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); |
|
124 |
// |
|
125 |
// // l = new Label(parent, SWT.NONE); |
|
126 |
// // l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false)); |
|
127 |
// // l.setText("Description"); |
|
128 |
// |
|
129 |
// Text name2Field = new Text(parent, SWT.BORDER | SWT.MULTI); |
|
130 |
// name2Field.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
131 |
// name2Field.setText(editor.getResult().getProject().getDescription()); |
|
132 |
// name2Field.addKeyListener(new KeyListener() { |
|
133 |
// |
|
134 |
// @Override |
|
135 |
// public void keyReleased(KeyEvent e) { |
|
136 |
// if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR && name2Field.getText().length() > 0 && !name2Field.getText().equals(editor.getResult().getParent().getUserName())) { |
|
137 |
// editor.getResult().getProject().setDescription(name2Field.getText()); |
|
138 |
// } |
|
139 |
// } |
|
140 |
// |
|
141 |
// @Override |
|
142 |
// public void keyPressed(KeyEvent e) {} |
|
143 |
// }); |
|
144 |
|
|
145 |
l = new Label(parent, SWT.NONE); |
|
146 |
l.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); |
|
147 |
l.setText("Description"); |
|
148 |
|
|
149 |
Browser b = new Browser(parent, SWT.H_SCROLL | SWT.V_SCROLL); |
|
150 |
b.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1)); |
|
151 |
b.setText(editor.getResult().getProject().getDescription()); |
|
118 | 152 |
} |
119 | 153 |
|
120 | 154 |
public void toClipboard() { |
121 | 155 |
StringBuffer buffer = new StringBuffer(); |
122 |
buffer.append(Messages.PropertiesGeneralTab_12+ editor.getResult().getParent().getUserName()); |
|
156 |
buffer.append(Messages.PropertiesGeneralTab_12 + editor.getResult().getParent().getUserName());
|
|
123 | 157 |
buffer.append("\n"); //$NON-NLS-1$ |
124 |
buffer.append(Messages.PropertiesGeneralTab_14+editor.getResult().getParent().getResultType());
|
|
158 |
buffer.append(Messages.PropertiesGeneralTab_14 + editor.getResult().getParent().getResultType());
|
|
125 | 159 |
buffer.append("\n"); //$NON-NLS-1$ |
126 |
// buffer.append("Size: "+editor.getResult().getParent().getChildren().size());
|
|
127 |
// buffer.append("\n");
|
|
128 |
buffer.append(Messages.PropertiesGeneralTab_16+editor.getResult().getParent().getParent().getUserName());
|
|
160 |
// buffer.append("Size: "+editor.getResult().getParent().getChildren().size());
|
|
161 |
// buffer.append("\n");
|
|
162 |
buffer.append(Messages.PropertiesGeneralTab_16 + editor.getResult().getParent().getParent().getUserName());
|
|
129 | 163 |
buffer.append("\n"); //$NON-NLS-1$ |
130 | 164 |
Date d = editor.getResult().getParent().getCreationDate(); |
131 | 165 |
if (d != null) { |
132 |
buffer.append(Messages.PropertiesGeneralTab_18+TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(d));
|
|
166 |
buffer.append(Messages.PropertiesGeneralTab_18 + TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(d));
|
|
133 | 167 |
} |
134 | 168 |
|
135 | 169 |
buffer.append("\n"); //$NON-NLS-1$ |
136 | 170 |
d = editor.getResult().getParent().getCreationDate(); |
137 | 171 |
if (d != null) { |
138 |
buffer.append(Messages.PropertiesGeneralTab_20+TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(d)); |
|
139 |
} else { |
|
172 |
buffer.append(Messages.PropertiesGeneralTab_20 + TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(d)); |
|
173 |
} |
|
174 |
else { |
|
140 | 175 |
buffer.append(Messages.PropertiesGeneralTab_21); |
141 | 176 |
} |
142 | 177 |
|
... | ... | |
147 | 182 |
public void updateResultFromEditor(boolean update) { |
148 | 183 |
// TODO Auto-generated method stub |
149 | 184 |
} |
150 |
|
|
185 |
|
|
151 | 186 |
@Override |
152 | 187 |
public void updateEditorFromResult() { |
153 | 188 |
// TODO Auto-generated method stub |
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/editors/PropertiesPagedEditor.java (revision 2991) | ||
---|---|---|
47 | 47 |
tabFolder = new TabFolder(parent, SWT.BORDER); |
48 | 48 |
tabFolder.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
49 | 49 |
|
50 |
tabs.add(new PropertiesGeneralTab(tabFolder, this)); |
|
51 | 50 |
PropertiesTXMResultTab resultTab = new PropertiesTXMResultTab(tabFolder, this); |
52 | 51 |
tabs.add(resultTab); |
53 | 52 |
|
53 |
tabs.add(new PropertiesGeneralTab(tabFolder, this)); |
|
54 |
|
|
55 |
tabs.add(new PropertiesParametersTab(tabFolder, this)); |
|
56 |
|
|
54 | 57 |
Project p = this.getResult().getFirstParent(Project.class); |
55 | 58 |
if (!p.getDocumentationURL().isEmpty()) { |
56 | 59 |
DocumentationTab docTab = new DocumentationTab(tabFolder, this); |
57 | 60 |
tabs.add(docTab); |
58 | 61 |
} |
59 |
tabs.add(new PropertiesParametersTab(tabFolder, this)); |
|
60 | 62 |
|
61 | 63 |
tabFolder.setSelection(resultTab.getTab()); |
62 | 64 |
} |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy (revision 2991) | ||
---|---|---|
164 | 164 |
for (File infile : txmDir.listFiles()) { |
165 | 165 |
if (infile.isHidden() || infile.isDirectory() || infile.getName().startsWith(".")) continue; |
166 | 166 |
print "." |
167 |
if (!SetNewXmlDocumentRoot.process(infile, "//tei:text")) {
|
|
168 |
println "Failed to reset XML root $infile" |
|
169 |
return |
|
170 |
} |
|
167 |
// if (!SetNewXmlDocumentRoot.process(infile, "//text")) {
|
|
168 |
// println "Failed to reset XML root $infile"
|
|
169 |
// return
|
|
170 |
// }
|
|
171 | 171 |
} |
172 | 172 |
println "" |
173 | 173 |
|
174 | 174 |
// filtering |
175 |
println "Filtering XML files with xpaths: [//tei:term]"
|
|
176 |
def xpaths = ["//tei:term"]
|
|
175 |
println "Filtering XML files with xpaths: [//term]" |
|
176 |
def xpaths = ["//term"] |
|
177 | 177 |
|
178 | 178 |
if (xpaths != null) { |
179 | 179 |
println "Filtering XML files with xpaths: $xpaths" |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/debug/LibrariesVersionsMacro.groovy (revision 2991) | ||
---|---|---|
12 | 12 |
println " WEBKITGTK version: "+ System.properties.'org.eclipse.swt.internal.webkitgtk.version' |
13 | 13 |
|
14 | 14 |
def loader = ClassLoader.getSystemClassLoader() |
15 |
LIBRARIES = ClassLoader.class.getDeclaredField("loadedLibraryNames");
|
|
16 |
LIBRARIES.setAccessible(true);
|
|
15 |
LIBRARIES = ClassLoader.class.getDeclaredField("loadedLibraryNames") |
|
16 |
LIBRARIES.setAccessible(true) |
|
17 | 17 |
println "Loaded libraries: " |
18 |
println "\t"+LIBRARIES.get(loader).join("\n\t"); |
|
18 |
println "\t"+LIBRARIES.get(loader).join("\n\t") |
tmp/org.txm.properties.core/src/org/txm/properties/core/functions/CorpusPropertiesComputer.java (revision 2991) | ||
---|---|---|
29 | 29 |
import org.txm.utils.logger.Log; |
30 | 30 |
|
31 | 31 |
public class CorpusPropertiesComputer extends PropertiesComputer<CQPCorpus> { |
32 |
|
|
32 |
|
|
33 | 33 |
public CorpusPropertiesComputer(Properties props, CQPCorpus result) { |
34 | 34 |
super(props, result); |
35 | 35 |
} |
36 |
|
|
36 |
|
|
37 | 37 |
@Override |
38 | 38 |
public List<String> getComputableInformations() { |
39 | 39 |
return Arrays.asList("all"); |
40 | 40 |
} |
41 |
|
|
41 |
|
|
42 | 42 |
@Override |
43 | 43 |
public LinkedHashMap<String, String> getInformation(String name) { |
44 | 44 |
LinkedHashMap<String, String> data = new LinkedHashMap<>(); |
45 | 45 |
data.put("all", dump(props.pMaxPropertiesToDisplay)); |
46 | 46 |
return data; |
47 | 47 |
} |
48 |
|
|
48 |
|
|
49 | 49 |
@Override |
50 | 50 |
public String getInformationHTML(String info) { |
51 | 51 |
return htmlDump(); |
52 | 52 |
} |
53 |
|
|
53 |
|
|
54 | 54 |
// Numbers |
55 | 55 |
/** The T. */ |
56 | 56 |
int numberOfWords = 0; // number of word |
57 |
|
|
57 |
|
|
58 | 58 |
/** The N properties. */ |
59 | 59 |
int NProperties = 0; // number of word properties |
60 | 60 |
// HashMap<String, Integer> propertiesCounts = new HashMap<String, Integer>(); |
61 | 61 |
// // properties counts |
62 |
|
|
62 |
|
|
63 | 63 |
/** The properties values. */ |
64 | 64 |
HashMap<String, List<String>> propertiesValues = new HashMap<>(); // properties values |
65 |
|
|
65 |
|
|
66 | 66 |
/** The N structures. */ |
67 | 67 |
int NStructures = 0; // number of structures |
68 |
|
|
68 |
|
|
69 | 69 |
/** The structures counts. */ |
70 | 70 |
HashMap<String, Integer> structuresCounts = new HashMap<>(); // structures counts |
71 |
|
|
71 |
|
|
72 | 72 |
/** The internal architecture. */ |
73 | 73 |
List<String> internalArchitecture = new ArrayList<>(); // cqp structures = propertiesCounts keys but ordered |
74 |
|
|
74 |
|
|
75 | 75 |
/** The hierarchie counts. */ |
76 | 76 |
HashMap<String, Integer> hierarchieCounts = new HashMap<>(); // hierarchic structures counts |
77 |
|
|
77 |
|
|
78 | 78 |
/** The internal architecture properties. */ |
79 | 79 |
HashMap<String, HashMap<String, List<String>>> internalArchitectureProperties = new HashMap<>(); // hierarchic structures counts |
80 |
|
|
80 |
|
|
81 | 81 |
/** The internal architecture properties counts. */ |
82 | 82 |
HashMap<String, HashMap<String, Integer>> internalArchitecturePropertiesCounts = new HashMap<>(); // hierarchic structures counts |
83 |
|
|
83 |
|
|
84 | 84 |
// Annotations description |
85 | 85 |
/** The annotations types. */ |
86 | 86 |
HashMap<String, Integer> annotationsTypes = new HashMap<>(); // for each annotation its description |
87 |
|
|
87 |
|
|
88 | 88 |
/** The annotations origins. */ |
89 | 89 |
HashMap<String, Integer> annotationsOrigins = new HashMap<>(); // for each annoation its origin description |
90 |
|
|
90 |
|
|
91 | 91 |
/** The properties. */ |
92 | 92 |
List<WordProperty> properties; |
93 |
|
|
93 |
|
|
94 | 94 |
/** The structures. */ |
95 | 95 |
List<StructuralUnit> structures; |
96 |
|
|
96 |
|
|
97 | 97 |
@Override |
98 | 98 |
public String getName() { |
99 | 99 |
String filename = result.getMainCorpus() + "-" + result.getName(); //$NON-NLS-1$ |
... | ... | |
102 | 102 |
} |
103 | 103 |
return filename; |
104 | 104 |
} |
105 |
|
|
105 |
|
|
106 | 106 |
/** |
107 | 107 |
* Step general infos. |
108 | 108 |
*/ |
... | ... | |
123 | 123 |
Log.printStackTrace(e); |
124 | 124 |
return; |
125 | 125 |
} |
126 |
|
|
126 |
|
|
127 | 127 |
try { |
128 | 128 |
numberOfWords = result.getSize();// corpus.getLexicon(corpus.getProperty("id")).nbrOfToken(); |
129 | 129 |
} |
... | ... | |
133 | 133 |
return; |
134 | 134 |
} |
135 | 135 |
} |
136 |
|
|
136 |
|
|
137 | 137 |
/** |
138 | 138 |
* step2. randomly position are choose |
139 | 139 |
*/ |
140 | 140 |
public void stepLexicalProperties() { |
141 | 141 |
propertiesValues.clear(); |
142 |
|
|
142 |
|
|
143 | 143 |
AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient(); |
144 |
|
|
144 |
|
|
145 | 145 |
int s = Math.min(props.pMaxPropertiesToDisplay, numberOfWords); |
146 | 146 |
int[] positions = new int[s]; |
147 | 147 |
int n = 0; |
... | ... | |
153 | 153 |
positions[n++] = i; |
154 | 154 |
} |
155 | 155 |
} |
156 |
|
|
156 |
|
|
157 | 157 |
for (Property p : properties) { |
158 | 158 |
// int size; |
159 | 159 |
try { |
... | ... | |
165 | 165 |
} |
166 | 166 |
} |
167 | 167 |
} |
168 |
|
|
168 |
|
|
169 | 169 |
/** |
170 | 170 |
* Step structural units. |
171 | 171 |
*/ |
172 | 172 |
public void stepStructuralUnits() { |
173 | 173 |
try { |
174 | 174 |
structures = result.getOrderedStructuralUnits(); |
175 |
|
|
175 |
|
|
176 | 176 |
List<StructuralUnit> sstructures = new ArrayList<>(structures); |
177 | 177 |
for (StructuralUnit su : structures) { |
178 | 178 |
if (su.getName().equals("txmcorpus")) { |
... | ... | |
193 | 193 |
hierarchieCounts.put(su.getName(), -1); |
194 | 194 |
internalArchitectureProperties.put(su.getName(), new HashMap<String, List<String>>()); |
195 | 195 |
internalArchitecturePropertiesCounts.put(su.getName(), new HashMap<String, Integer>()); |
196 |
|
|
196 |
|
|
197 | 197 |
for (StructuralUnitProperty sup : su.getOrderedProperties()) {// for each of its property |
198 | 198 |
try { |
199 | 199 |
List<String> allvalues = sup.getValues(result); |
... | ... | |
209 | 209 |
} |
210 | 210 |
} |
211 | 211 |
} |
212 |
|
|
212 |
|
|
213 | 213 |
/** |
214 | 214 |
* dump the results of the diagnostic in a String containing HTML code. |
215 | 215 |
* |
... | ... | |
217 | 217 |
*/ |
218 | 218 |
public String htmlDump() { |
219 | 219 |
StringBuffer buff = new StringBuffer(); |
220 |
|
|
220 |
|
|
221 | 221 |
buff.append("<? version=\"1.0\" encoding=\"UTF-8\"?>\n" + //$NON-NLS-1$ |
222 | 222 |
"<html>" + //$NON-NLS-1$ |
223 | 223 |
"<head>" + //$NON-NLS-1$ |
... | ... | |
225 | 225 |
"</head>" + //$NON-NLS-1$ |
226 | 226 |
"<body>\n"); //$NON-NLS-1$ |
227 | 227 |
buff.append("<h2 style'font-family:\"Arial\";'>" + PropertiesCoreMessages.descriptionOf + this.result.getName() + " (CQP ID=" + this.result.getID() + ")</h2>\n"); //$NON-NLS-2$ //$NON-NLS-1$ |
228 |
|
|
228 |
|
|
229 | 229 |
Project projet = this.result.getProject(); |
230 | 230 |
// if (projet.getCreationDate() != null) { |
231 | 231 |
// buff.append(NLS.bind(PropertiesCoreMessages.createdTheP0, TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(projet.getCreationDate()))); |
... | ... | |
234 | 234 |
// buff.append(NLS.bind(PropertiesCoreMessages.updatedTheP0, TXMResult.PRETTY_LOCALIZED_TIME_FORMAT.format(projet.getLastComputingDate()))); |
235 | 235 |
// } |
236 | 236 |
// |
237 |
if (projet.getDescription() != null && projet.getDescription().length() > 0) { |
|
238 |
buff.append("<p><h3>Description</h3>" + projet.getDescription() + "</p>"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
239 |
} |
|
240 |
|
|
237 |
// if (projet.getDescription() != null && projet.getDescription().length() > 0) {
|
|
238 |
// buff.append("<p><h3>Description</h3>" + projet.getDescription() + "</p>"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
239 |
// }
|
|
240 |
|
|
241 | 241 |
buff.append("<h3 style'font-family:\"Arial\";'>" + PropertiesCoreMessages.generalStatistics_2 + "</h3>\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
242 |
|
|
242 |
|
|
243 | 243 |
// counts |
244 | 244 |
buff.append("<ul>\n"); //$NON-NLS-1$ |
245 | 245 |
buff.append("<li>" + NLS.bind(PropertiesCoreMessages.numberOfWordsP0, NumberFormat.getInstance().format(numberOfWords)) + "</li>\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
246 |
|
|
246 |
|
|
247 | 247 |
buff.append("<li>" + PropertiesCoreMessages.numberOfWordProperties + (properties.size()) + " (" + StringUtils.join(properties, ", ") + ")</li>\n"); //$NON-NLS-2$ //$NON-NLS-1$ |
248 | 248 |
buff.append("<li>" + PropertiesCoreMessages.numberOfStructuralUnits + (structures.size()) + " (" + StringUtils.join(structures, ", ") + ")</li>\n"); //$NON-NLS-2$ //$NON-NLS-1$ |
249 | 249 |
buff.append("</ul>\n"); //$NON-NLS-1$ |
250 |
|
|
250 |
|
|
251 | 251 |
// Propriétés d'occurrences |
252 | 252 |
buff.append("<h3 style'font-family:\"Arial\";'>" + NLS.bind(PropertiesCoreMessages.lexicalUnitsPropertiesMaxP0Values, props.pMaxPropertiesToDisplay) + "</h3>\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
253 | 253 |
ArrayList<String> properties = new ArrayList<>(propertiesValues.keySet()); |
... | ... | |
267 | 267 |
} |
268 | 268 |
} |
269 | 269 |
buff.append("</ul>\n"); //$NON-NLS-1$ |
270 |
|
|
270 |
|
|
271 | 271 |
// Propriété de structures |
272 | 272 |
buff.append("<h3 style'font-family:\"Arial\";'>" + NLS.bind(PropertiesCoreMessages.structuralUnitsPropertiesMaxP0Values, props.pMaxPropertiesToDisplay) + "</h3>\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
273 | 273 |
buff.append("<ul>\n"); //$NON-NLS-1$ |
... | ... | |
275 | 275 |
StringBuffer subbuffer = new StringBuffer(); |
276 | 276 |
if (s.equals("txmcorpus")) //$NON-NLS-1$ |
277 | 277 |
continue;// ignore the txmcorpus structure |
278 |
|
|
278 |
|
|
279 | 279 |
properties = new ArrayList<>(internalArchitectureProperties.get(s).keySet()); |
280 |
|
|
280 |
|
|
281 | 281 |
subbuffer.append("<li> " + s + "\n<ul>\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
282 | 282 |
if (internalArchitectureProperties.get(s).keySet().size() == 0) |
283 | 283 |
subbuffer.append("<li>" + PropertiesCoreMessages.noProperty + "</li>\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
284 |
|
|
284 |
|
|
285 | 285 |
// System.out.println("struct: "+s+" >> "+properties); |
286 | 286 |
Collections.sort(properties); |
287 | 287 |
// System.out.println("struct: "+s+" >sort> "+properties); |
... | ... | |
302 | 302 |
subbuffer.append(psv.replace("<", "<")); //$NON-NLS-1$ //$NON-NLS-2$ |
303 | 303 |
else |
304 | 304 |
subbuffer.append("\"\""); //$NON-NLS-1$ |
305 |
|
|
305 |
|
|
306 | 306 |
if (i == values.size() - 1) |
307 | 307 |
subbuffer.append("."); //$NON-NLS-1$ |
308 | 308 |
else |
309 | 309 |
subbuffer.append(", "); //$NON-NLS-1$ |
310 |
|
|
310 |
|
|
311 | 311 |
if (i >= props.pMaxPropertiesToDisplay) { |
312 | 312 |
subbuffer.append("..."); //$NON-NLS-1$ |
313 | 313 |
break; |
... | ... | |
316 | 316 |
subbuffer.append("</li>\n"); //$NON-NLS-1$ |
317 | 317 |
} |
318 | 318 |
} |
319 |
|
|
319 |
|
|
320 | 320 |
if (properties.size() == 0) { |
321 | 321 |
subbuffer.append("<p>--</p>\n"); //$NON-NLS-1$ |
322 | 322 |
} |
323 |
|
|
323 |
|
|
324 | 324 |
subbuffer.append("</ul>\n</li>\n"); //$NON-NLS-1$ |
325 | 325 |
if (nbOfValues > 0) { |
326 | 326 |
buff.append(subbuffer); |
... | ... | |
329 | 329 |
buff.append("</ul>\n"); //$NON-NLS-1$ |
330 | 330 |
buff.append("</body>\n"); //$NON-NLS-1$ |
331 | 331 |
buff.append("</html>\n"); //$NON-NLS-1$ |
332 |
|
|
332 |
|
|
333 | 333 |
return buff.toString(); |
334 | 334 |
} |
335 |
|
|
335 |
|
|
336 | 336 |
/** |
337 | 337 |
* dump the result in the console. |
338 | 338 |
* |
... | ... | |
342 | 342 |
*/ |
343 | 343 |
public String dump(int maxvalue) { |
344 | 344 |
StringBuffer buff = new StringBuffer(); |
345 |
|
|
345 |
|
|
346 | 346 |
buff.append(PropertiesCoreMessages.generalStatistics); |
347 | 347 |
buff.append(PropertiesCoreMessages.t + String.format(Locale.FRANCE, "%,d", numberOfWords) + "\n"); //$NON-NLS-1$ |
348 | 348 |
buff.append(PropertiesCoreMessages.wordProperties + String.format("%,d", NProperties) + "\n"); //$NON-NLS-1$ |
... | ... | |
354 | 354 |
buff.append(PropertiesCoreMessages.s + String.format("%,d", NStructures) + "\n"); //$NON-NLS-1$ |
355 | 355 |
for (String s : structuresCounts.keySet()) |
356 | 356 |
buff.append(" - " + s + "\n");// +structuresCounts.get(s)+"\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
357 |
|
|
357 |
|
|
358 | 358 |
/* |
359 | 359 |
* buff.append("* Structural Units counts\n"); for(String s : |
360 | 360 |
* internalArchitecture) buff.append(" - "+s+" "+hierarchieCounts.get(s)+"\n"); |
... | ... | |
366 | 366 |
if (!(s.equals("text") && (ps.equals("project") || ps.equals("base") || ps.equals("id")))) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
367 | 367 |
{ |
368 | 368 |
buff.append(" - " + ps + "(" + internalArchitectureProperties.get(s).get(ps).size() + ") = "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
369 |
|
|
369 |
|
|
370 | 370 |
int valuecount = 0; |
371 | 371 |
for (String psv : internalArchitectureProperties.get(s).get(ps)) { |
372 | 372 |
buff.append(psv); |
... | ... | |
377 | 377 |
if (valuecount < internalArchitectureProperties.get(s).get(ps).size()) |
378 | 378 |
buff.append(", "); //$NON-NLS-1$ |
379 | 379 |
} |
380 |
|
|
380 |
|
|
381 | 381 |
buff.append("\n"); //$NON-NLS-1$ |
382 | 382 |
} |
383 | 383 |
} |
384 | 384 |
} |
385 |
|
|
385 |
|
|
386 | 386 |
return buff.toString(); |
387 | 387 |
} |
388 |
|
|
389 |
|
|
388 |
|
|
389 |
|
|
390 | 390 |
/** |
391 | 391 |
* Gets the t. |
392 | 392 |
* |
... | ... | |
395 | 395 |
public int getT() { |
396 | 396 |
return numberOfWords; |
397 | 397 |
} |
398 |
|
|
398 |
|
|
399 | 399 |
/** |
400 | 400 |
* Gets the n properties. |
401 | 401 |
* |
... | ... | |
404 | 404 |
public int getNProperties() { |
405 | 405 |
return NProperties; |
406 | 406 |
} |
407 |
|
|
407 |
|
|
408 | 408 |
/** |
409 | 409 |
* Gets the internal architecture. |
410 | 410 |
* |
... | ... | |
413 | 413 |
public List<String> getInternalArchitecture() { |
414 | 414 |
return internalArchitecture; |
415 | 415 |
} |
416 |
|
|
416 |
|
|
417 | 417 |
/** |
418 | 418 |
* Gets the n structures. |
419 | 419 |
* |
... | ... | |
422 | 422 |
public int getNStructures() { |
423 | 423 |
return NStructures; |
424 | 424 |
} |
425 |
|
|
425 |
|
|
426 | 426 |
/** |
427 | 427 |
* Gets the structures counts. |
428 | 428 |
* |
... | ... | |
431 | 431 |
public HashMap<String, Integer> getStructuresCounts() { |
432 | 432 |
return structuresCounts; |
433 | 433 |
} |
434 |
|
|
434 |
|
|
435 | 435 |
/** |
436 | 436 |
* Gets the annotations types. |
437 | 437 |
* |
... | ... | |
440 | 440 |
public HashMap<String, Integer> getAnnotationsTypes() { |
441 | 441 |
return annotationsTypes; |
442 | 442 |
} |
443 |
|
|
443 |
|
|
444 | 444 |
/** |
445 | 445 |
* Gets the annotations origins. |
446 | 446 |
* |
... | ... | |
449 | 449 |
public HashMap<String, Integer> getAnnotationsOrigins() { |
450 | 450 |
return annotationsOrigins; |
451 | 451 |
} |
452 |
|
|
452 |
|
|
453 | 453 |
@Override |
454 | 454 |
public boolean _compute(TXMProgressMonitor monitor) throws Exception { |
455 |
|
|
455 |
|
|
456 | 456 |
monitor.setTask(props.getComputingStartMessage()); |
457 |
|
|
457 |
|
|
458 | 458 |
this.stepGeneralInfos(); |
459 | 459 |
monitor.worked(34); |
460 |
|
|
460 |
|
|
461 | 461 |
this.stepLexicalProperties(); |
462 | 462 |
monitor.worked(33); |
463 |
|
|
463 |
|
|
464 | 464 |
this.stepStructuralUnits(); |
465 | 465 |
monitor.worked(33); |
466 |
|
|
466 |
|
|
467 | 467 |
return true; |
468 | 468 |
} |
469 |
|
|
469 |
|
|
470 | 470 |
public String getDetails() { |
471 | 471 |
if (numberOfWords >= 0) { |
472 | 472 |
return NLS.bind(PropertiesCoreMessages.numberOfWordsP0, numberOfWords); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMWebBrowserEditor.java (revision 2991) | ||
---|---|---|
8 | 8 |
import org.eclipse.core.commands.Parameterization; |
9 | 9 |
import org.eclipse.core.commands.ParameterizedCommand; |
10 | 10 |
import org.eclipse.core.commands.common.NotDefinedException; |
11 |
import org.eclipse.swt.SWT; |
|
11 | 12 |
import org.eclipse.swt.browser.Browser; |
12 | 13 |
import org.eclipse.swt.browser.BrowserFunction; |
14 |
import org.eclipse.swt.events.SelectionListener; |
|
13 | 15 |
import org.eclipse.swt.graphics.Image; |
14 | 16 |
import org.eclipse.swt.widgets.Composite; |
17 |
import org.eclipse.swt.widgets.ToolBar; |
|
18 |
import org.eclipse.swt.widgets.ToolItem; |
|
15 | 19 |
import org.eclipse.ui.IWorkbenchWindow; |
16 | 20 |
import org.eclipse.ui.PlatformUI; |
17 | 21 |
import org.eclipse.ui.commands.ICommandService; |
18 | 22 |
import org.eclipse.ui.handlers.IHandlerService; |
19 | 23 |
import org.eclipse.ui.internal.browser.BrowserViewer; |
24 |
import org.eclipse.ui.internal.browser.ImageResource; |
|
25 |
import org.eclipse.ui.internal.browser.Messages; |
|
20 | 26 |
import org.eclipse.ui.internal.browser.WebBrowserEditor; |
27 |
import org.eclipse.ui.internal.browser.WebBrowserEditorInput; |
|
21 | 28 |
|
22 | 29 |
@SuppressWarnings("restriction") |
23 | 30 |
public class TXMWebBrowserEditor extends WebBrowserEditor { |
... | ... | |
48 | 55 |
|
49 | 56 |
@Override |
50 | 57 |
public void createPartControl(Composite parent) { |
58 |
|
|
51 | 59 |
super.createPartControl(parent); |
52 | 60 |
|
61 |
// createToolbar(parent); |
|
62 |
|
|
53 | 63 |
new CommandLink(this.webBrowser.getBrowser()); |
54 | 64 |
} |
55 | 65 |
|
66 |
ToolItem back; |
|
67 |
|
|
68 |
ToolItem forward; |
|
69 |
|
|
70 |
|
|
56 | 71 |
// Called by JavaScript |
57 | 72 |
public class CommandLink extends BrowserFunction { |
58 | 73 |
|
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesTableLabelProvider.java (revision 2991) | ||
---|---|---|
38 | 38 |
* create the specificites table (as many columns as parts) |
39 | 39 |
*/ |
40 | 40 |
class SpecificitiesTableLabelProvider extends LabelProvider implements ITableLabelProvider { |
41 |
|
|
41 |
|
|
42 | 42 |
/** The partindexes. */ |
43 |
//int[] partindexes; |
|
44 |
|
|
43 |
// int[] partindexes;
|
|
44 |
|
|
45 | 45 |
private boolean showPValues; |
46 |
|
|
46 | 47 |
private String format; |
47 |
|
|
48 |
|
|
48 | 49 |
/** |
49 | 50 |
* Instantiates a new specificites table label provider. |
50 | 51 |
* |
51 | 52 |
* @param partindexes the partindexes |
52 | 53 |
*/ |
53 | 54 |
public SpecificitiesTableLabelProvider() { |
54 |
//this.partindexes = partindexes; |
|
55 |
//showPValues = "true".equals(Toolbox.getParam(SpecificitiesPreferencePage.SPECIF_PVALUES)); //$NON-NLS-1$ |
|
55 |
// this.partindexes = partindexes;
|
|
56 |
// showPValues = "true".equals(Toolbox.getParam(SpecificitiesPreferencePage.SPECIF_PVALUES)); //$NON-NLS-1$
|
|
56 | 57 |
this.format = SpecificitiesPreferences.getInstance().getString(SpecificitiesPreferences.FORMAT); |
57 | 58 |
if (format == null || format.trim().length() == 0) { |
58 | 59 |
format = "%,.1f"; //$NON-NLS-1$ |
59 | 60 |
} |
60 | 61 |
} |
61 |
|
|
62 |
/* (non-Javadoc) |
|
62 |
|
|
63 |
/* |
|
64 |
* (non-Javadoc) |
|
63 | 65 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) |
64 | 66 |
*/ |
65 | 67 |
@Override |
66 | 68 |
public Image getColumnImage(Object element, int columnIndex) { |
67 | 69 |
return null; |
68 | 70 |
} |
69 |
|
|
70 |
/* (non-Javadoc) |
|
71 |
|
|
72 |
public static final String EMPTY = ""; |
|
73 |
|
|
74 |
/* |
|
75 |
* (non-Javadoc) |
|
71 | 76 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) |
72 | 77 |
*/ |
73 | 78 |
@Override |
74 | 79 |
public String getColumnText(Object element, int columnIndex) { |
75 |
|
|
80 |
|
|
76 | 81 |
Object[] line = (Object[]) element; |
77 |
//line content : {unit, freq, freqs[], scores[]} |
|
78 |
|
|
82 |
int[] freqs = (int[]) line[2];// get the freqs |
|
83 |
// line content : {unit, freq, freqs[], scores[]} |
|
84 |
|
|
79 | 85 |
if (columnIndex < 2) { |
80 | 86 |
Object cell = line[columnIndex]; |
81 | 87 |
return cell.toString(); |
82 |
} else if (columnIndex == 2) { // separator column |
|
83 |
return ""; //$NON-NLS-1$ |
|
84 |
} else { |
|
85 |
columnIndex = columnIndex - 3 ;//this.partindexes[columnIndex - 3]; |
|
86 |
if (columnIndex%2 == 0) { // FREQ COLUMN |
|
87 |
columnIndex = columnIndex/2; // because there is 2 col per part |
|
88 |
int[] freqs = (int[])line[2];// get the freqs |
|
88 |
} |
|
89 |
else if (columnIndex == 2) { // separator column |
|
90 |
return EMPTY; |
|
91 |
} |
|
92 |
else if (columnIndex == (freqs.length * 2) + 3) { // separator column |
|
93 |
return EMPTY; |
|
94 |
} |
|
95 |
else { |
|
96 |
columnIndex = columnIndex - 3;// this.partindexes[columnIndex - 3]; |
|
97 |
if (columnIndex % 2 == 0) { // FREQ COLUMN |
|
98 |
columnIndex = columnIndex / 2; // because there is 2 col per part |
|
89 | 99 |
return String.valueOf(freqs[columnIndex]); |
90 |
} else { // SCORE COLUMN |
|
91 |
columnIndex = columnIndex/2; // because there is 2 cols per part |
|
100 |
} |
|
101 |
else { // SCORE COLUMN |
|
102 |
columnIndex = columnIndex / 2; // because there is 2 cols per part |
|
92 | 103 |
Object specif = line[3]; // get the scores |
93 |
double[] specifs = (double[]) specif ;
|
|
94 |
|
|
104 |
double[] specifs = (double[]) specif; |
|
105 |
|
|
95 | 106 |
double s = specifs[columnIndex]; |
96 |
//if (-2 < s && s < 2) return ""; |
|
107 |
// if (-2 < s && s < 2) return "";
|
|
97 | 108 |
return String.format(format, s); |
98 |
// if (showPValues) {
|
|
99 |
// return String.valueOf();
|
|
100 |
// } else {
|
|
101 |
// return String.valueOf((int) specifs[columnIndex]);
|
|
102 |
// }
|
|
109 |
// if (showPValues) {
|
|
110 |
// return String.valueOf();
|
|
111 |
// } else {
|
|
112 |
// return String.valueOf((int) specifs[columnIndex]);
|
|
113 |
// }
|
|
103 | 114 |
} |
104 | 115 |
} |
105 | 116 |
} |
106 |
|
|
107 |
/* (non-Javadoc) |
|
117 |
|
|
118 |
/* |
|
119 |
* (non-Javadoc) |
|
108 | 120 |
* @see org.eclipse.jface.viewers.BaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) |
109 | 121 |
*/ |
110 | 122 |
@Override |
111 | 123 |
public boolean isLabelProperty(Object element, String property) { |
112 | 124 |
return false; |
113 | 125 |
} |
114 |
|
|
115 |
|
|
126 |
|
|
127 |
|
|
116 | 128 |
} |
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 2991) | ||
---|---|---|
187 | 187 |
|
188 | 188 |
viewerComparator.addSelectionAdapter(viewer, typeFrequencyColumn, 1); |
189 | 189 |
|
190 |
|
|
191 | 190 |
// add a separator empty column |
192 | 191 |
TableColumn separatorColumn = new TableColumn(specificitesTable, SWT.NONE); |
193 | 192 |
separatorColumn.setResizable(false); |
... | ... | |
298 | 297 |
|
299 | 298 |
viewerComparator.addSelectionAdapter(viewer, lexicalTableColumn, (firstLexicalTableColumnIndex + 1)); |
300 | 299 |
} |
300 |
|
|
301 |
// add a separator empty column |
|
302 |
TableColumn separatorColumn = new TableColumn(specificitesTable, SWT.NONE); |
|
303 |
separatorColumn.setResizable(false); |
|
301 | 304 |
} |
302 | 305 |
|
303 | 306 |
if (!this.getResult().isDirty()) { |
Formats disponibles : Unified diff