Révision 2993
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/commands/ExportCorpusAsCONNLU.java (revision 2993) | ||
---|---|---|
313 | 313 |
if (insertParagraphs) { |
314 | 314 |
StructuralUnit p_struct = mainCorpus.getStructuralUnit("p"); |
315 | 315 |
if (p_struct == null) { |
316 |
Log.warning(NLS.bind("No 'p' structure found in the {0} CQP corpus. Paragraphs can't be inserted.", mainCorpus)); |
|
316 |
Log.warning(NLS.bind("** insertParagraph parameter is set, but there are no *p* structure (no paragraph) in the {0} CQP corpus. The insertParagraph parameter will be ignored.", |
|
317 |
mainCorpus)); |
|
317 | 318 |
} |
318 | 319 |
else { |
319 | 320 |
for (int position : mainCorpus.query(new CQLQuery("<p> [_.text_id=\"" + textIds[iText] + "\"]"), "textParagraphPositions", false).getStarts()) { |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java (revision 2993) | ||
---|---|---|
14 | 14 |
* |
15 | 15 |
*/ |
16 | 16 |
public class ChartsEnginePreferences extends TXMPreferences { |
17 |
|
|
18 |
|
|
17 |
|
|
18 |
|
|
19 | 19 |
/** |
20 | 20 |
* The name of the current charts engine. |
21 | 21 |
*/ |
... | ... | |
27 | 27 |
*/ |
28 | 28 |
public final static String CHARTS_ENGINES_ORDER = "charts_engines_order"; //$NON-NLS-1$ |
29 | 29 |
|
30 |
|
|
30 |
|
|
31 | 31 |
/** |
32 | 32 |
* Constant for the default export format. |
33 | 33 |
*/ |
34 | 34 |
public static final String DEFAULT_EXPORT_FORMAT = "default_export_format"; //$NON-NLS-1$ |
35 | 35 |
|
36 |
|
|
37 | 36 |
|
37 |
|
|
38 | 38 |
/** |
39 | 39 |
* Constant for showing title or not in the charts. |
40 | 40 |
*/ |
41 | 41 |
public final static String SHOW_TITLE = "show_title"; //$NON-NLS-1$ |
42 |
|
|
43 |
|
|
42 |
|
|
43 |
|
|
44 | 44 |
/** |
45 | 45 |
* Constant for showing legend or not in the charts. |
46 | 46 |
*/ |
47 | 47 |
public final static String SHOW_LEGEND = "show_legend"; //$NON-NLS-1$ |
48 |
|
|
49 |
|
|
48 |
|
|
49 |
|
|
50 | 50 |
/** |
51 | 51 |
* Constant for showing grid/lines or not in the charts. |
52 | 52 |
*/ |
53 | 53 |
public final static String SHOW_GRID = "show_grid"; //$NON-NLS-1$ |
54 |
|
|
55 | 54 |
|
55 |
|
|
56 | 56 |
/** |
57 | 57 |
* Constant for the color mode (colors, grayscale, monochrome, B&W). |
58 | 58 |
*/ |
... | ... | |
74 | 74 |
*/ |
75 | 75 |
public static final String MULTIPLE_LINE_STROKES = "multiple_line_strokes"; //$NON-NLS-1$ |
76 | 76 |
|
77 |
|
|
77 |
|
|
78 | 78 |
// local result preferences |
79 | 79 |
/** |
80 | 80 |
* Chart type. |
... | ... | |
86 | 86 |
*/ |
87 | 87 |
public final static String DEFAULT_CHART_TYPE = "[Default]"; //$NON-NLS-1$ |
88 | 88 |
|
89 |
|
|
89 |
|
|
90 | 90 |
/** |
91 | 91 |
* Gets the instance. |
92 |
* |
|
92 | 93 |
* @return the instance |
93 | 94 |
*/ |
94 |
public static TXMPreferences getInstance() {
|
|
95 |
public static TXMPreferences getInstance() {
|
|
95 | 96 |
if (!TXMPreferences.instances.containsKey(ChartsEnginePreferences.class)) { |
96 | 97 |
new ChartsEnginePreferences(); |
97 | 98 |
} |
... | ... | |
112 | 113 |
/** |
113 | 114 |
* Initializes the charts engine default preferences. |
114 | 115 |
* This method is also used to define the charts preference for each command using charts. |
116 |
* |
|
115 | 117 |
* @param preferences |
116 | 118 |
*/ |
117 |
public static void initializeChartsEngineSharedPreferences(Preferences preferences) {
|
|
119 |
public static void initializeChartsEngineSharedPreferences(Preferences preferences) {
|
|
118 | 120 |
preferences.put(CHART_TYPE, DEFAULT_CHART_TYPE); |
119 | 121 |
preferences.putBoolean(SHOW_TITLE, true); |
120 | 122 |
preferences.putBoolean(SHOW_LEGEND, true); |
... | ... | |
124 | 126 |
preferences.putBoolean(MULTIPLE_LINE_STROKES, false); |
125 | 127 |
|
126 | 128 |
// Check the target OS and set the default font from the JVM embedded font |
127 |
String defaultFont;
|
|
128 |
if(OSDetector.isFamilyUnix()) {
|
|
129 |
String defaultFont; |
|
130 |
if (OSDetector.isFamilyUnix()) {
|
|
129 | 131 |
defaultFont = "1|Lucida Sans|11.0|0|GTK|1|"; //$NON-NLS-1$ // other version if needed later: "1|Lucida Sans|11|0" |
130 | 132 |
} |
131 |
else {
|
|
133 |
else {
|
|
132 | 134 |
defaultFont = "1|Lucida Sans Unicode|11.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"; //$NON-NLS-1$ |
133 | 135 |
} |
134 | 136 |
|
... | ... | |
138 | 140 |
|
139 | 141 |
/** |
140 | 142 |
* Gets the engines order from the specified string with | separator. |
143 |
* |
|
141 | 144 |
* @param enginesOrder |
142 | 145 |
* @return |
143 | 146 |
*/ |
... | ... | |
145 | 148 |
|
146 | 149 |
String[] orderedEnginesNames = enginesOrder.split("\\|"); |
147 | 150 |
|
148 |
if(orderedEnginesNames.length == 1 && orderedEnginesNames[0].isEmpty()) {
|
|
151 |
if (orderedEnginesNames.length == 1 && orderedEnginesNames[0].isEmpty()) {
|
|
149 | 152 |
return null; |
150 | 153 |
} |
151 | 154 |
else { |
152 | 155 |
return orderedEnginesNames; |
153 | 156 |
} |
154 | 157 |
} |
155 |
|
|
156 | 158 |
|
159 |
|
|
157 | 160 |
/** |
158 | 161 |
* Creates the engines order string with | separator from the specified engines list. |
162 |
* |
|
159 | 163 |
* @param enginesNames |
160 | 164 |
* @return |
161 | 165 |
*/ |
162 | 166 |
public static String createEnginesOrder(String[] enginesNames) { |
163 | 167 |
StringBuilder sb = new StringBuilder(); |
164 | 168 |
for (int i = 0; i < enginesNames.length; i++) { |
165 |
if(i > 0) {
|
|
169 |
if (i > 0) {
|
|
166 | 170 |
sb.append("|"); |
167 | 171 |
} |
168 |
sb.append(enginesNames[i]);
|
|
172 |
sb.append(enginesNames[i]); |
|
169 | 173 |
} |
170 | 174 |
|
171 | 175 |
Log.finest("ChartsEnginePreferences.createChartsEnginesOrder():" + sb); |
... | ... | |
175 | 179 |
|
176 | 180 |
/** |
177 | 181 |
* Gets the name of the first engine stored in the engines order preference. |
182 |
* |
|
178 | 183 |
* @param enginesOrder |
179 | 184 |
* @return |
180 | 185 |
*/ |
181 | 186 |
public static String getFirstEngineName() { |
182 | 187 |
return getEnginesOrder(getInstance().getString(CHARTS_ENGINES_ORDER))[0]; |
183 | 188 |
} |
184 |
|
|
185 |
|
|
189 |
|
|
190 |
|
|
186 | 191 |
/** |
187 | 192 |
* Gets the engines order from stored in the preferences. |
193 |
* |
|
188 | 194 |
* @return |
189 | 195 |
*/ |
190 | 196 |
public String[] getEnginesOrder() { |
191 | 197 |
return getEnginesOrder(this.getString(ChartsEnginePreferences.CHARTS_ENGINES_ORDER)); |
192 | 198 |
} |
193 |
|
|
194 | 199 |
|
200 |
|
|
195 | 201 |
} |
196 | 202 |
|
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 2993) | ||
---|---|---|
7 | 7 |
import java.io.IOException; |
8 | 8 |
import java.io.ObjectInputStream; |
9 | 9 |
import java.io.ObjectOutputStream; |
10 |
import java.io.PrintStream; |
|
10 | 11 |
import java.io.Serializable; |
11 | 12 |
import java.text.ParseException; |
12 | 13 |
import java.util.ArrayList; |
... | ... | |
1231 | 1232 |
* print TxmPreferences in the console. |
1232 | 1233 |
*/ |
1233 | 1234 |
public static void dump() { |
1235 |
dump(System.out); |
|
1236 |
} |
|
1237 |
|
|
1238 |
/** |
|
1239 |
* print TxmPreferences in the output printstream parameter. |
|
1240 |
* |
|
1241 |
* @param out output printstream !! must be closed after used |
|
1242 |
*/ |
|
1243 |
public static void dump(PrintStream out) { |
|
1234 | 1244 |
try { |
1235 |
System.out.println("root:"); //$NON-NLS-1$
|
|
1245 |
out.println("root:"); //$NON-NLS-1$ |
|
1236 | 1246 |
for (String children : preferencesRootNode.childrenNames()) { |
1237 |
System.out.println("********************************************************************************************************"); //$NON-NLS-1$
|
|
1238 |
System.out.println(" scope: " + children); //$NON-NLS-1$
|
|
1247 |
out.println("********************************************************************************************************"); //$NON-NLS-1$ |
|
1248 |
out.println(" scope: " + children); //$NON-NLS-1$ |
|
1239 | 1249 |
String[] subchildren = preferencesRootNode.node(children).childrenNames(); |
1240 | 1250 |
Arrays.sort(subchildren); |
1241 | 1251 |
for (String children2 : subchildren) { |
1242 |
System.out.println(" scope: " + children + " node: " + children2); //$NON-NLS-1$
|
|
1252 |
out.println(" scope: " + children + " node: " + children2); //$NON-NLS-1$ |
|
1243 | 1253 |
String[] keys = preferencesRootNode.node(children).node(children2).keys(); |
1244 | 1254 |
Arrays.sort(keys); |
1245 | 1255 |
for (String key2 : keys) { |
1246 |
System.out.println(" " + key2 + " = " + preferencesRootNode.node(children).node(children2).get(key2, null)); //$NON-NLS-1$ //$NON-NLS-2$
|
|
1256 |
out.println(" " + key2 + " = " + preferencesRootNode.node(children).node(children2).get(key2, null)); //$NON-NLS-1$ //$NON-NLS-2$ |
|
1247 | 1257 |
} |
1248 | 1258 |
} |
1249 | 1259 |
} |
1250 | 1260 |
} |
1251 | 1261 |
catch (Exception e) { |
1252 | 1262 |
e.printStackTrace(); |
1253 |
; |
|
1254 | 1263 |
} |
1255 | 1264 |
} |
1256 | 1265 |
|
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 2993) | ||
---|---|---|
153 | 153 |
* Font. |
154 | 154 |
*/ |
155 | 155 |
@Parameter(key = TBXPreferences.FONT) |
156 |
private String pFont = "Arial";
|
|
156 |
private String pFont; |
|
157 | 157 |
|
158 | 158 |
/** |
159 | 159 |
* Description. |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/debug/PreferencesMacro.groovy (revision 2993) | ||
---|---|---|
6 | 6 |
import org.txm.rcp.swt.widget.parameters.* |
7 | 7 |
import org.txm.core.preferences.TXMPreferences |
8 | 8 |
import org.txm.searchengine.cqp.CQPPreferences |
9 |
import org.txm.utils.io.* |
|
9 | 10 |
|
10 |
org.txm.core.preferences.TXMPreferences.dump(); |
|
11 |
@Field @Option(name="outputFile", usage="set outputFile to '' to write in console", widget="CreateFile", required=false, def="") |
|
12 |
File outputFile; |
|
13 |
if (!ParametersDialog.open(this)) { |
|
14 |
return |
|
15 |
} |
|
11 | 16 |
|
17 |
if (outputFile == null) { |
|
18 |
org.txm.core.preferences.TXMPreferences.dump(); |
|
19 |
} else { |
|
20 |
def out = new PrintStream(outputFile); |
|
21 |
org.txm.core.preferences.TXMPreferences.dump(out); |
|
22 |
out.close() |
|
23 |
println "Result in: $outputFile" |
|
24 |
} |
|
25 |
|
|
12 | 26 |
//println CQPPreferences.getInstance().getProperties() |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/FontSection.java (revision 2993) | ||
---|---|---|
18 | 18 |
public class FontSection extends ImportEditorSection { |
19 | 19 |
|
20 | 20 |
private static final int SECTION_SIZE = 1; |
21 |
public static final String DEFAULTFONT = "<default>"; |
|
22 | 21 |
|
22 |
public static final String DEFAULTFONT = ""; |
|
23 |
|
|
23 | 24 |
Combo fontCombo; |
24 | 25 |
|
25 | 26 |
public FontSection(FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style) { |
26 | 27 |
super(toolkit2, form2, parent, style); |
27 |
|
|
28 |
|
|
28 | 29 |
this.section.setText(TXMUIMessages.displayFont); |
29 | 30 |
TableWrapLayout layout = new TableWrapLayout(); |
30 | 31 |
layout.makeColumnsEqualWidth = true; |
31 | 32 |
this.section.setLayout(layout); |
32 | 33 |
this.section.setLayoutData(getSectionGridData(SECTION_SIZE)); |
33 | 34 |
this.section.setEnabled(false); |
34 |
|
|
35 |
|
|
35 | 36 |
this.section.addExpansionListener(new ExpansionAdapter() { |
37 |
|
|
36 | 38 |
@Override |
37 |
public void expansionStateChanged(ExpansionEvent e) {form.layout(true);} |
|
39 |
public void expansionStateChanged(ExpansionEvent e) { |
|
40 |
form.layout(true); |
|
41 |
} |
|
38 | 42 |
}); |
39 |
|
|
40 |
//filesection.setDescription("Select how to find source files"); |
|
43 |
|
|
44 |
// filesection.setDescription("Select how to find source files");
|
|
41 | 45 |
Composite sectionClient = toolkit.createComposite(this.section); |
42 | 46 |
TableWrapLayout slayout = new TableWrapLayout(); |
43 | 47 |
slayout.makeColumnsEqualWidth = false; |
44 | 48 |
slayout.numColumns = 2; |
45 | 49 |
sectionClient.setLayout(slayout); |
46 | 50 |
this.section.setClient(sectionClient); |
47 |
|
|
51 |
|
|
48 | 52 |
Label l = toolkit.createLabel(sectionClient, TXMUIMessages.fontName, SWT.WRAP); |
49 | 53 |
l.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE)); |
50 |
|
|
54 |
|
|
51 | 55 |
fontCombo = new Combo(sectionClient, SWT.BORDER); |
52 | 56 |
TableWrapData gdata = getTextGridData(); |
53 | 57 |
fontCombo.setLayoutData(gdata); |
54 |
|
|
58 |
|
|
55 | 59 |
fontCombo.removeAll(); |
56 | 60 |
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
57 | 61 |
java.awt.Font[] fonts = e.getAllFonts(); // Get the fonts |
58 |
|
|
62 |
|
|
59 | 63 |
fontCombo.add(DEFAULTFONT); |
60 | 64 |
for (java.awt.Font font : fonts) { |
61 | 65 |
fontCombo.add(font.getFontName()); |
62 | 66 |
} |
63 |
|
|
64 |
//updateFontSection(); |
|
65 | 67 |
|
68 |
// updateFontSection(); |
|
66 | 69 |
|
70 |
|
|
67 | 71 |
} |
68 |
|
|
72 |
|
|
69 | 73 |
@Override |
70 | 74 |
public void update(Project project) { |
71 | 75 |
if (this.section.isDisposed()) return; |
72 | 76 |
if (project == null) return; |
73 | 77 |
|
74 |
String value = project.getFont(); //$NON-NLS-1$ |
|
78 |
String value = project.getFont(); // $NON-NLS-1$
|
|
75 | 79 |
|
76 | 80 |
if (value == null || value.length() == 0) value = DEFAULTFONT; |
77 | 81 |
|
78 |
if (value != null && value.length() > 0) |
|
82 |
if (value != null && value.length() > 0) {
|
|
79 | 83 |
fontCombo.setText(value); |
80 |
|
|
84 |
} |
|
85 |
else { |
|
86 |
fontCombo.setText(""); |
|
87 |
} |
|
81 | 88 |
} |
82 |
|
|
89 |
|
|
83 | 90 |
@Override |
84 | 91 |
public boolean save(Project project) { |
85 | 92 |
if (!this.section.isDisposed()) { |
86 | 93 |
String value = fontCombo.getText(); |
87 | 94 |
if (DEFAULTFONT.equals(value)) value = ""; |
88 | 95 |
|
89 |
project.setFont(value); //$NON-NLS-1$ |
|
96 |
project.setFont(value); // $NON-NLS-1$
|
|
90 | 97 |
return true; |
91 | 98 |
} |
92 | 99 |
return true; |
93 | 100 |
} |
94 |
|
|
101 |
|
|
95 | 102 |
@Override |
96 | 103 |
public boolean checkFields() { |
97 | 104 |
return true; |
98 | 105 |
} |
99 |
|
|
106 |
|
|
100 | 107 |
@Override |
101 | 108 |
public int getSectionSize() { |
102 | 109 |
return SECTION_SIZE; |
103 | 110 |
} |
104 |
} |
|
111 |
} |
Formats disponibles : Unified diff