Révision 564
tmp/org.txm.cah.core/src/org/txm/cah/core/functions/AHC.java (revision 564) | ||
---|---|---|
134 | 134 |
} |
135 | 135 |
|
136 | 136 |
|
137 |
@Override |
|
137 | 138 |
public boolean loadParameters() { |
138 | 139 |
this.setParameters( |
139 | 140 |
this.getBooleanParameterValue(AHCPreferences.COLUMNS_COMPUTING), |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/AdapterFactory.java (revision 564) | ||
---|---|---|
38 | 38 |
import org.eclipse.osgi.util.NLS; |
39 | 39 |
import org.eclipse.ui.model.IWorkbenchAdapter; |
40 | 40 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
41 |
import org.txm.core.preferences.TBXPreferences; |
|
41 | 42 |
import org.txm.core.results.TXMResult; |
42 | 43 |
import org.txm.objects.SavedQuery; |
43 | 44 |
import org.txm.objects.Text; |
... | ... | |
112 | 113 |
} |
113 | 114 |
}; |
114 | 115 |
|
115 |
/** The corpus adapter. */ |
|
116 |
private IWorkbenchAdapter corpusAdapter = new IWorkbenchAdapter() { |
|
116 |
// /** The corpus adapter. */ |
|
117 |
// private IWorkbenchAdapter corpusAdapter = new IWorkbenchAdapter() { |
|
118 |
// |
|
119 |
// @Override |
|
120 |
// public Object[] getChildren(Object corpus) { |
|
121 |
// ArrayList<TXMResult> results = ((Corpus) corpus).getChildren(true); |
|
122 |
// for (int i = 0; i < results.size(); i++) { |
|
123 |
// Object element = results.get(i); |
|
124 |
// |
|
125 |
// // remove Text and SavedQuery from the corpora view |
|
126 |
// if (!TBXPreferences.getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES, TBXPreferences.PREFERENCES_NODE) && (element instanceof Text || element instanceof SavedQuery)) { |
|
127 |
// results.remove(i); |
|
128 |
// i--; |
|
129 |
// } |
|
130 |
// } |
|
131 |
// List<Object> children = new ArrayList<Object>(); |
|
132 |
// children.addAll(results); |
|
133 |
// return children.toArray(); |
|
134 |
// } |
|
135 |
// |
|
136 |
// @Override |
|
137 |
// public ImageDescriptor getImageDescriptor(Object object) { |
|
138 |
// return AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID, IImageKeys.CORPUS); |
|
139 |
// } |
|
140 |
// |
|
141 |
// @Override |
|
142 |
// public String getLabel(Object corpus) { |
|
143 |
// if (corpus instanceof MainCorpus) { |
|
144 |
// return ((MainCorpus) corpus).getNameForCorporaView(); |
|
145 |
// } |
|
146 |
// else { |
|
147 |
// return ((Corpus) corpus).getName(); |
|
148 |
// } |
|
149 |
// } |
|
150 |
// |
|
151 |
// @Override |
|
152 |
// public Object getParent(Object corpus) { |
|
153 |
// if (corpus instanceof Subcorpus) { |
|
154 |
// return ((Subcorpus) corpus).getMotherSubcorpus(); |
|
155 |
// } |
|
156 |
// else { |
|
157 |
// return CorpusManager.getCorpusManager(); |
|
158 |
// } |
|
159 |
// } |
|
160 |
// }; |
|
117 | 161 |
|
118 |
@Override |
|
119 |
public Object[] getChildren(Object corpus) { |
|
120 |
ArrayList<TXMResult> results = ((Corpus) corpus).getChildren(true); |
|
121 |
for (int i = 0; i < results.size(); i++) { |
|
122 |
Object element = results.get(i); |
|
162 |
// /** The partition adapter. */ |
|
163 |
// private IWorkbenchAdapter partitionAdapter = new IWorkbenchAdapter() { |
|
164 |
// |
|
165 |
// @Override |
|
166 |
// public Object[] getChildren(Object partition) { |
|
167 |
// ArrayList<TXMResult> children = ((Partition) partition).getResults(); |
|
168 |
// // System.out.println("PARTITION RESULTS "+children); |
|
169 |
// return children.toArray(); |
|
170 |
// } |
|
171 |
// |
|
172 |
// @Override |
|
173 |
// public ImageDescriptor getImageDescriptor(Object object) { |
|
174 |
// return AbstractUIPlugin.imageDescriptorFromPlugin( |
|
175 |
// Application.PLUGIN_ID, IImageKeys.PARTITION); |
|
176 |
// } |
|
177 |
// |
|
178 |
// @Override |
|
179 |
// public String getLabel(Object partition) { |
|
180 |
// return ((Partition) partition).getSimpleName(); |
|
181 |
// } |
|
182 |
// |
|
183 |
// @Override |
|
184 |
// public Object getParent(Object partition) { |
|
185 |
// return ((Partition) partition).getCorpus(); |
|
186 |
// } |
|
187 |
// }; |
|
123 | 188 |
|
124 |
// remove Text and SavedQuery from the corpora view |
|
125 |
if (element instanceof Text || element instanceof SavedQuery) { |
|
126 |
results.remove(i); |
|
127 |
i--; |
|
128 |
} |
|
129 |
} |
|
130 |
List<Object> children = new ArrayList<Object>(); |
|
131 |
children.addAll(results); |
|
132 |
return children.toArray(); |
|
133 |
} |
|
134 | 189 |
|
135 |
@Override |
|
136 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
137 |
return AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID, IImageKeys.CORPUS); |
|
138 |
} |
|
139 |
|
|
140 |
@Override |
|
141 |
public String getLabel(Object corpus) { |
|
142 |
if (corpus instanceof MainCorpus) { |
|
143 |
return ((MainCorpus) corpus).getNameForCorporaView(); |
|
144 |
} |
|
145 |
else { |
|
146 |
return ((Corpus) corpus).getName(); |
|
147 |
} |
|
148 |
} |
|
149 |
|
|
150 |
@Override |
|
151 |
public Object getParent(Object corpus) { |
|
152 |
if (corpus instanceof Subcorpus) { |
|
153 |
return ((Subcorpus) corpus).getMotherSubcorpus(); |
|
154 |
} |
|
155 |
else { |
|
156 |
return CorpusManager.getCorpusManager(); |
|
157 |
} |
|
158 |
} |
|
159 |
}; |
|
160 |
|
|
161 |
/** The partition adapter. */ |
|
162 |
private IWorkbenchAdapter partitionAdapter = new IWorkbenchAdapter() { |
|
163 |
|
|
164 |
@Override |
|
165 |
public Object[] getChildren(Object partition) { |
|
166 |
ArrayList<TXMResult> children = ((Partition) partition).getResults(); |
|
167 |
// System.out.println("PARTITION RESULTS "+children); |
|
168 |
return children.toArray(); |
|
169 |
} |
|
170 |
|
|
171 |
@Override |
|
172 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
173 |
return AbstractUIPlugin.imageDescriptorFromPlugin( |
|
174 |
Application.PLUGIN_ID, IImageKeys.PARTITION); |
|
175 |
} |
|
176 |
|
|
177 |
@Override |
|
178 |
public String getLabel(Object partition) { |
|
179 |
return ((Partition) partition).getSimpleName(); |
|
180 |
} |
|
181 |
|
|
182 |
@Override |
|
183 |
public Object getParent(Object partition) { |
|
184 |
return ((Partition) partition).getCorpus(); |
|
185 |
} |
|
186 |
}; |
|
187 |
|
|
188 |
|
|
189 | 190 |
/** The Lexicon adapter. */ |
190 | 191 |
// FIXME: became useless? seems never used |
191 | 192 |
private IWorkbenchAdapter LexiconAdapter = new TXMResultAdapter() { |
... | ... | |
209 | 210 |
if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof CorpusManager) { |
210 | 211 |
return corpusManagerAdapter; |
211 | 212 |
} |
212 |
if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Corpus) { |
|
213 |
return corpusAdapter; |
|
214 |
} |
|
215 |
if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Partition) { |
|
216 |
return partitionAdapter; |
|
217 |
} |
|
213 |
// if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Corpus) {
|
|
214 |
// return corpusAdapter;
|
|
215 |
// }
|
|
216 |
// if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Partition) {
|
|
217 |
// return partitionAdapter;
|
|
218 |
// }
|
|
218 | 219 |
|
219 | 220 |
//check adapters from plugins |
220 | 221 |
if (externalAdapters.containsKey(adaptableObject.getClass())) { |
221 | 222 |
return externalAdapters.get(adaptableObject.getClass()); |
222 | 223 |
} |
224 |
|
|
225 |
if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof TXMResult) { |
|
226 |
return new TXMResultAdapter() { |
|
227 |
@Override |
|
228 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
229 |
return AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID, IImageKeys.ACTION_INFO); |
|
230 |
} |
|
231 |
}; |
|
232 |
} |
|
223 | 233 |
return null; |
224 | 234 |
} |
225 | 235 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 564) | ||
---|---|---|
237 | 237 |
// FIXME: Debug: |
238 | 238 |
// FIXME: à repasser dans TXMResult.toString(); |
239 | 239 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): ********************************************************************************"); |
240 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): selected object = " + selectedItem); |
|
240 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): selected object = " + selectedItem + ", visible = " + ((TXMResult)selectedItem).isVisible());
|
|
241 | 241 |
if (selectedItem instanceof ChartResult) { |
242 | 242 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): chart object = " + ((ChartResult)selectedItem).getChart()); |
243 | 243 |
} |
244 | 244 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): selection full path name = " + ((TXMResult)selectedItem).getFullPathSimpleName() + " - " + ((TXMResult)selectedItem).getName()); |
245 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): direct children count = " + ((TXMResult)selectedItem).getResults().size()); |
|
246 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): direct visible children count = " + ((TXMResult)selectedItem).getChildren(true).size()); |
|
247 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): children count = " + ((TXMResult)selectedItem).getDeepChildren().size()); |
|
248 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): root parent = " + ((TXMResult)selectedItem).getRootParent()); |
|
249 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): corpus parent = " + Corpus.getParentMainCorpus(((TXMResult)selectedItem))); |
|
245 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): direct children count = " + ((TXMResult)selectedItem).getResults().size() |
|
246 |
+ ", direct visible children count = " + ((TXMResult)selectedItem).getChildren(true).size() + ", children count = " + ((TXMResult)selectedItem).getDeepChildren().size()); |
|
247 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): root parent = " |
|
248 |
+ ((TXMResult)selectedItem).getRootParent() + ", main corpus parent = " + Corpus.getParentMainCorpus(((TXMResult)selectedItem))); |
|
250 | 249 |
} |
251 | 250 |
|
252 | 251 |
@Override |
... | ... | |
515 | 514 |
*/ |
516 | 515 |
public static void expand(Object obj) { |
517 | 516 |
final CorporaView corporaView = getInstance(); |
518 |
if (obj != null) |
|
517 |
if (obj != null) {
|
|
519 | 518 |
corporaView.treeViewer.expandToLevel(obj, 1); |
519 |
} |
|
520 | 520 |
} |
521 | 521 |
|
522 | 522 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/AdvancePreferencePage.java (revision 564) | ||
---|---|---|
37 | 37 |
import org.eclipse.ui.IWorkbench; |
38 | 38 |
import org.eclipse.ui.PlatformUI; |
39 | 39 |
import org.eclipse.ui.handlers.IHandlerService; |
40 |
import org.eclipse.ui.preferences.ScopedPreferenceStore; |
|
41 | 40 |
import org.txm.core.preferences.TBXPreferences; |
42 | 41 |
import org.txm.rcp.RCPMessages; |
42 |
import org.txm.rcp.views.corpora.CorporaView; |
|
43 | 43 |
import org.txm.rcp.views.fileexplorer.MacroExplorer; |
44 | 44 |
|
45 | 45 |
// TODO: Auto-generated Javadoc |
... | ... | |
48 | 48 |
*/ |
49 | 49 |
public class AdvancePreferencePage extends TXMPreferencePage { |
50 | 50 |
|
51 |
/** The install dir. */ |
|
52 |
private DirectoryFieldEditor installDirField; |
|
53 |
|
|
54 |
/** The txmhome dir. */ |
|
55 |
private DirectoryFieldEditor txmhomeDirField; |
|
56 |
|
|
57 |
/** The log level. */ |
|
58 |
private ComboFieldEditor logLevelField; |
|
59 |
|
|
60 |
/** The log console. */ |
|
61 |
private BooleanFieldEditor logTimingsField; |
|
62 |
|
|
63 |
/** The log console. */ |
|
64 |
private BooleanFieldEditor logConsoleField; |
|
65 |
|
|
66 |
/** The log file. */ |
|
67 |
private BooleanFieldEditor logFileField; |
|
68 |
|
|
69 |
/** The log console. */ |
|
70 |
private BooleanFieldEditor expertField; |
|
71 |
|
|
72 |
/** The log stacktrace. */ |
|
73 |
private BooleanFieldEditor logStackTraceField; |
|
74 |
|
|
75 |
/** The severeDialog Field. */ |
|
76 |
private BooleanFieldEditor severeDialogField; |
|
77 | 51 |
|
78 |
private ComboFieldEditor updateLevelField; |
|
79 |
|
|
80 |
/** |
|
81 |
* Instantiates a new advance preference page. |
|
82 |
*/ |
|
83 |
public AdvancePreferencePage() { |
|
84 |
super(); |
|
85 |
} |
|
86 |
|
|
87 | 52 |
/* (non-Javadoc) |
88 | 53 |
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() |
89 | 54 |
*/ |
90 | 55 |
@Override |
91 | 56 |
protected void createFieldEditors() { |
92 |
installDirField = new DirectoryFieldEditor(TBXPreferences.INSTALL_DIR, |
|
93 |
RCPMessages.AdvancePreferencePage_1, getFieldEditorParent());
|
|
94 |
addField(installDirField);
|
|
57 |
|
|
58 |
// install directory
|
|
59 |
addField(new DirectoryFieldEditor(TBXPreferences.INSTALL_DIR, RCPMessages.AdvancePreferencePage_1, getFieldEditorParent()));
|
|
95 | 60 |
|
96 |
txmhomeDirField = new DirectoryFieldEditor(TBXPreferences.USER_TXM_HOME, |
|
97 |
RCPMessages.AdvancePreferencePage_2, getFieldEditorParent()); |
|
98 |
addField(txmhomeDirField); |
|
61 |
// txmhome directory |
|
62 |
addField(new DirectoryFieldEditor(TBXPreferences.USER_TXM_HOME, RCPMessages.AdvancePreferencePage_2, getFieldEditorParent())); |
|
99 | 63 |
|
100 | 64 |
Group updateGroup = new Group(getFieldEditorParent(), SWT.NONE); |
101 | 65 |
updateGroup.setText(RCPMessages.AdvancePreferencePage_6); |
... | ... | |
107 | 71 |
rlayout.marginHeight = 5; |
108 | 72 |
updateGroup.setLayout(rlayout); |
109 | 73 |
|
74 |
// Log level |
|
110 | 75 |
String[][] choices = new String[9][2]; |
111 | 76 |
choices[0][0] = choices[0][1] = "OFF"; //$NON-NLS-1$ |
112 | 77 |
choices[1][0] = choices[1][1] = "SEVERE"; //$NON-NLS-1$ |
... | ... | |
117 | 82 |
choices[6][0] = choices[6][1] = "FINER"; //$NON-NLS-1$ |
118 | 83 |
choices[7][0] = choices[7][1] = "FINEST"; //$NON-NLS-1$ |
119 | 84 |
choices[8][0] = choices[8][1] = "ALL"; //$NON-NLS-1$ |
120 |
logLevelField = new ComboFieldEditor(TBXPreferences.LOG_LEVEL, |
|
121 |
RCPMessages.AdvancePreferencePage_12, choices, |
|
122 |
updateGroup); |
|
123 |
addField(logLevelField); |
|
85 |
addField(new ComboFieldEditor(TBXPreferences.LOG_LEVEL, RCPMessages.AdvancePreferencePage_12, choices, updateGroup)); |
|
124 | 86 |
|
125 |
logTimingsField = new BooleanFieldEditor(TBXPreferences.SHOW_TIMINGS, |
|
126 |
RCPMessages.AdvancePreferencePage_3, updateGroup); |
|
127 |
addField(logTimingsField); |
|
87 |
// Log timings |
|
88 |
addField(new BooleanFieldEditor(TBXPreferences.SHOW_TIMINGS, RCPMessages.AdvancePreferencePage_3, updateGroup)); |
|
128 | 89 |
|
129 |
logStackTraceField = new BooleanFieldEditor(TBXPreferences.LOG_STACKTRACE, |
|
130 |
RCPMessages.AdvancePreferencePage_0, updateGroup); |
|
131 |
addField(logStackTraceField); |
|
90 |
// Log stack trace |
|
91 |
addField(new BooleanFieldEditor(TBXPreferences.LOG_STACKTRACE, RCPMessages.AdvancePreferencePage_0, updateGroup)); |
|
132 | 92 |
|
133 |
logConsoleField = new BooleanFieldEditor(TBXPreferences.ADD_TECH_LOGS, |
|
134 |
RCPMessages.AdvancePreferencePage_13, updateGroup); |
|
135 |
addField(logConsoleField); |
|
93 |
// Log console |
|
94 |
addField(new BooleanFieldEditor(TBXPreferences.ADD_TECH_LOGS, RCPMessages.AdvancePreferencePage_13, updateGroup)); |
|
136 | 95 |
|
137 |
severeDialogField = new BooleanFieldEditor(RCPPreferences.SHOW_SEVERE_DIALOG, |
|
138 |
"Show a dialog when a severe error occurs", updateGroup); |
|
139 |
addField(severeDialogField); |
|
96 |
// Show dialog on severe error |
|
97 |
addField(new BooleanFieldEditor(RCPPreferences.SHOW_SEVERE_DIALOG, "Show a dialog when a severe error occurs", updateGroup)); |
|
140 | 98 |
|
141 |
logFileField = new BooleanFieldEditor(TBXPreferences.LOG_IN_FILE, |
|
142 |
RCPMessages.AdvancePreferencePage_14, updateGroup); |
|
143 |
addField(logFileField); |
|
99 |
// Log in file |
|
100 |
addField(new BooleanFieldEditor(TBXPreferences.LOG_IN_FILE, RCPMessages.AdvancePreferencePage_14, updateGroup)); |
|
144 | 101 |
|
102 |
// Update level |
|
145 | 103 |
String[][] choices2 = new String[4][2]; |
146 | 104 |
choices2[0][0] = choices2[0][1]= "STABLE"; //$NON-NLS-1$ |
147 | 105 |
choices2[1][0] = choices2[1][1] = "BETA"; //$NON-NLS-1$ |
148 | 106 |
choices2[2][0] = choices2[2][1] = "ALPHA"; //$NON-NLS-1$ |
149 | 107 |
choices2[3][0] = choices2[3][1] = "DEV"; //$NON-NLS-1$ |
150 |
updateLevelField = new ComboFieldEditor(RCPPreferences.UPDATE_LEVEL, |
|
151 |
RCPMessages.AdvancePreferencePage_7,choices2, getFieldEditorParent()); |
|
152 |
addField(updateLevelField); |
|
108 |
addField(new ComboFieldEditor(RCPPreferences.UPDATE_LEVEL, RCPMessages.AdvancePreferencePage_7,choices2, getFieldEditorParent())); |
|
153 | 109 |
|
154 |
expertField = new BooleanFieldEditor(TBXPreferences.EXPERT_USER, |
|
155 |
RCPMessages.AdvancePreferencePage_4, getFieldEditorParent()); |
|
156 |
addField(expertField); |
|
110 |
// Expert mode |
|
111 |
addField(new BooleanFieldEditor(TBXPreferences.EXPERT_USER, RCPMessages.AdvancePreferencePage_4, getFieldEditorParent())); |
|
112 |
|
|
113 |
// Show all result nodes in Corpora view |
|
114 |
|
|
115 |
// Expert mode |
|
116 |
addField(new BooleanFieldEditor(TBXPreferences.SHOW_ALL_RESULT_NODES, "Show all result nodes in Corpora view", getFieldEditorParent())); |
|
117 |
|
|
157 | 118 |
} |
158 | 119 |
|
159 | 120 |
/* (non-Javadoc) |
... | ... | |
164 | 125 |
super.performOk(); |
165 | 126 |
try { |
166 | 127 |
MacroExplorer.refresh(); |
128 |
CorporaView.refresh(); |
|
167 | 129 |
|
168 | 130 |
// update repositories |
169 | 131 |
IHandlerService service = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/adapters/CorpusAdapterFactory.java (revision 564) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
package org.txm.rcp.adapters; |
|
3 |
|
|
4 |
import java.util.ArrayList; |
|
5 |
|
|
6 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
7 |
import org.eclipse.ui.model.IWorkbenchAdapter; |
|
8 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
9 |
import org.txm.core.preferences.TBXPreferences; |
|
10 |
import org.txm.core.results.TXMResult; |
|
11 |
import org.txm.objects.SavedQuery; |
|
12 |
import org.txm.objects.Text; |
|
13 |
import org.txm.rcp.Application; |
|
14 |
import org.txm.rcp.IImageKeys; |
|
15 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
16 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
|
17 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
|
18 |
|
|
19 |
|
|
20 |
/** |
|
21 |
* A factory for creating Adapter objects. |
|
22 |
* |
|
23 |
* @author mdecorde |
|
24 |
* @author sjacquot |
|
25 |
*/ |
|
26 |
public class CorpusAdapterFactory extends TXMResultAdapterFactory { |
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
@Override |
|
31 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
|
32 |
if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Corpus) { |
|
33 |
return new TXMResultAdapter() { |
|
34 |
@Override |
|
35 |
public Object[] getChildren(Object corpus) { |
|
36 |
ArrayList<TXMResult> children = ((Corpus) corpus).getChildren(!TBXPreferences.getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES, TBXPreferences.PREFERENCES_NODE)); |
|
37 |
|
|
38 |
// FIXME: remove Text and SavedQuery from the corpora view |
|
39 |
for (int i = 0; i < children.size(); i++) { |
|
40 |
Object element = children.get(i); |
|
41 |
if ( |
|
42 |
//!TBXPreferences.getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES, TBXPreferences.PREFERENCES_NODE) && |
|
43 |
(element instanceof Text || element instanceof SavedQuery)) { |
|
44 |
children.remove(i); |
|
45 |
i--; |
|
46 |
} |
|
47 |
} |
|
48 |
|
|
49 |
return children.toArray(); |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
54 |
return AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID, IImageKeys.CORPUS); |
|
55 |
} |
|
56 |
|
|
57 |
|
|
58 |
@Override |
|
59 |
public Object getParent(Object corpus) { |
|
60 |
if (corpus instanceof Subcorpus) { |
|
61 |
return ((Subcorpus) corpus).getMotherSubcorpus(); |
|
62 |
} |
|
63 |
else { |
|
64 |
return CorpusManager.getCorpusManager(); |
|
65 |
} |
|
66 |
} |
|
67 |
}; |
|
68 |
} |
|
69 |
return null; |
|
70 |
} |
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
} |
|
0 | 76 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/adapters/TXMResultAdapter.java (revision 564) | ||
---|---|---|
4 | 4 |
package org.txm.rcp.adapters; |
5 | 5 |
|
6 | 6 |
import org.eclipse.ui.model.IWorkbenchAdapter; |
7 |
import org.txm.core.preferences.TBXPreferences; |
|
7 | 8 |
import org.txm.core.results.TXMResult; |
8 | 9 |
|
9 | 10 |
/** |
... | ... | |
24 | 25 |
|
25 | 26 |
@Override |
26 | 27 |
public Object[] getChildren(Object result) { |
27 |
return ((TXMResult) result).getChildren(true).toArray();
|
|
28 |
return ((TXMResult) result).getChildren(!TBXPreferences.getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES, TBXPreferences.PREFERENCES_NODE)).toArray();
|
|
28 | 29 |
} |
29 | 30 |
|
30 | 31 |
@Override |
tmp/org.txm.rcp/plugin.xml (revision 564) | ||
---|---|---|
198 | 198 |
|
199 | 199 |
<factory |
200 | 200 |
adaptableType="org.txm.searchengine.cqp.corpus.Corpus" |
201 |
class="org.txm.rcp.AdapterFactory"> |
|
201 |
class="org.txm.rcp.adapters.CorpusAdapterFactory">
|
|
202 | 202 |
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/> |
203 | 203 |
</factory> |
204 | 204 |
|
205 |
<factory |
|
206 |
adaptableType="org.txm.searchengine.cqp.corpus.Partition" |
|
207 |
class="org.txm.rcp.AdapterFactory"> |
|
208 |
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/> |
|
209 |
</factory> |
|
210 | 205 |
|
211 | 206 |
|
212 | 207 |
|
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/adapters/PartitionAdapterFactory.java (revision 564) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
package org.txm.partition.rcp.adapters; |
|
3 |
|
|
4 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
5 |
import org.eclipse.ui.model.IWorkbenchAdapter; |
|
6 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
7 |
import org.osgi.framework.FrameworkUtil; |
|
8 |
import org.txm.rcp.adapters.TXMResultAdapter; |
|
9 |
import org.txm.rcp.adapters.TXMResultAdapterFactory; |
|
10 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
11 |
|
|
12 |
|
|
13 |
/** |
|
14 |
* A factory for creating Adapter objects. |
|
15 |
* |
|
16 |
* @author mdecorde |
|
17 |
* @author sjacquot |
|
18 |
*/ |
|
19 |
public class PartitionAdapterFactory extends TXMResultAdapterFactory { |
|
20 |
|
|
21 |
|
|
22 |
public static final ImageDescriptor ICON = |
|
23 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(PartitionAdapterFactory.class).getSymbolicName(), |
|
24 |
"platform:/plugin/"+ FrameworkUtil.getBundle(PartitionAdapterFactory.class).getSymbolicName() + "/icons/partition.png"); //$NON-NLS-1$ |
|
25 |
|
|
26 |
|
|
27 |
@Override |
|
28 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
|
29 |
if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Partition) { |
|
30 |
return new TXMResultAdapter() { |
|
31 |
@Override |
|
32 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
33 |
return ICON; |
|
34 |
} |
|
35 |
}; |
|
36 |
} |
|
37 |
return null; |
|
38 |
} |
|
39 |
|
|
40 |
|
|
41 |
} |
|
0 | 42 |
tmp/org.txm.partition.rcp/plugin.xml (revision 564) | ||
---|---|---|
105 | 105 |
type="org.eclipse.ui.model.IWorkbenchAdapter"> |
106 | 106 |
</adapter> |
107 | 107 |
</factory> |
108 |
<factory |
|
109 |
adaptableType="org.txm.searchengine.cqp.corpus.Partition" |
|
110 |
class="org.txm.partition.rcp.adapters.PartitionAdapterFactory"> |
|
111 |
<adapter |
|
112 |
type="org.eclipse.ui.model.IWorkbenchAdapter"> |
|
113 |
</adapter> |
|
114 |
</factory> |
|
108 | 115 |
</extension> |
109 | 116 |
|
110 | 117 |
</plugin> |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java (revision 564) | ||
---|---|---|
67 | 67 |
this.partition = partition; |
68 | 68 |
|
69 | 69 |
this.partition.addChild(this); |
70 |
this.setVisible(false); |
|
70 | 71 |
} |
71 | 72 |
|
72 | 73 |
/** |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 564) | ||
---|---|---|
569 | 569 |
return 1; |
570 | 570 |
} |
571 | 571 |
|
572 |
|
|
573 |
@Override |
|
574 |
public String getSimpleName() { |
|
575 |
if (modified) { |
|
576 |
return getName() + "*"; //$NON-NLS-1$ |
|
577 |
} |
|
578 |
else { |
|
579 |
return getName(); |
|
580 |
} |
|
581 |
} |
|
572 | 582 |
|
573 | 583 |
protected boolean modified = false; |
574 | 584 |
public boolean isModified() { return modified; } |
575 | 585 |
public void setIsModified(boolean b) { modified = b; } |
576 |
public String getNameForCorporaView() { |
|
577 |
if (modified) |
|
578 |
return getName()+"*"; |
|
579 |
else |
|
580 |
return getName(); |
|
581 |
} |
|
586 |
|
|
587 |
|
|
582 | 588 |
|
583 | 589 |
@Override |
584 | 590 |
public String getDetails() { |
tmp/org.txm.core/src/java/org/txm/core/preferences/TBXPreferences.java (revision 564) | ||
---|---|---|
63 | 63 |
public static final String EXPORT_TXTSEPARATOR = "export_txtseparator"; //$NON-NLS-1$ |
64 | 64 |
|
65 | 65 |
|
66 |
/** |
|
67 |
* To show or not all nodes in some views, eg. in CorporaView tree. |
|
68 |
*/ |
|
69 |
public static final String SHOW_ALL_RESULT_NODES = "show_all_result_nodes"; //$NON-NLS-1$ |
|
70 |
|
|
71 |
|
|
66 | 72 |
public static String getID() { |
67 | 73 |
return "org.txm.core"; |
68 | 74 |
} |
... | ... | |
96 | 102 |
preferences.put(EXPORT_ENCODING, System.getProperty("file.encoding")); |
97 | 103 |
preferences.put(EXPORT_TXTSEPARATOR, ""); |
98 | 104 |
preferences.putBoolean(EXPORT_SHOW, false); |
105 |
|
|
106 |
preferences.putBoolean(SHOW_ALL_RESULT_NODES, false); |
|
99 | 107 |
} |
100 | 108 |
} |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 564) | ||
---|---|---|
676 | 676 |
|
677 | 677 |
/** |
678 | 678 |
* Sets the result visibility state. |
679 |
* Dedicated to UI purposes. |
|
679 | 680 |
* |
680 | 681 |
* @param visible |
681 | 682 |
* @return |
tmp/org.txm.core/src/java/org/txm/objects/Text.java (revision 564) | ||
---|---|---|
74 | 74 |
*/ |
75 | 75 |
public Text(Corpus corpus, Element text) { |
76 | 76 |
super(corpus); |
77 |
this.setVisible(false); |
|
77 | 78 |
this.setPath(corpus.getPath() + getName()); |
78 | 79 |
this.corpus = corpus; |
79 | 80 |
setSelfElement(text); |
tmp/org.txm.core/src/java/org/txm/objects/SavedQuery.java (revision 564) | ||
---|---|---|
78 | 78 |
super(c); |
79 | 79 |
this.corpus = c; |
80 | 80 |
this.value = query; |
81 |
if (examples == null) |
|
82 |
this.examples = new ArrayList<String>(); |
|
81 |
if (examples == null) { |
|
82 |
this.examples = new ArrayList<String>(); |
|
83 |
} |
|
83 | 84 |
this.examples = examples; |
84 |
this.name = query; |
|
85 |
this.name = query; |
|
86 |
this.setVisible(false); |
|
85 | 87 |
} |
86 | 88 |
|
87 | 89 |
/** |
... | ... | |
94 | 96 |
super(corpus); |
95 | 97 |
this.corpus = corpus; |
96 | 98 |
this.setSelfElement(e); |
97 |
this.load(); |
|
99 |
this.load(); |
|
100 |
this.setVisible(false); |
|
98 | 101 |
} |
99 | 102 |
|
100 | 103 |
/* (non-Javadoc) |
... | ... | |
146 | 149 |
*/ |
147 | 150 |
@Override |
148 | 151 |
public String toString() { |
149 |
return this.name+"="+this.value;//+ " >> " + this.examples;
|
|
152 |
return this.name + "=" + this.value; //+ " >> " + this.examples; //$NON-NLS-1$
|
|
150 | 153 |
} |
151 | 154 |
} |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartEditorToolBar.java (revision 564) | ||
---|---|---|
19 | 19 |
// FIXME: became useless, can directly use TXMEditorToolBar |
20 | 20 |
public class ChartEditorToolBar extends TXMEditorToolBar { |
21 | 21 |
|
22 |
|
|
23 |
public final static String ID = "ChartEditorToolBar" ; |
|
22 | 24 |
|
25 |
|
|
23 | 26 |
/** |
24 | 27 |
* |
25 | 28 |
* @param parent |
... | ... | |
39 | 42 |
* @param chartEditorPart |
40 | 43 |
*/ |
41 | 44 |
public ChartEditorToolBar(ChartEditorPart chartEditorPart, int style) { |
42 |
this(chartEditorPart, style, "ChartEditorToolBar"); //$NON-NLS-1$
|
|
45 |
this(chartEditorPart, style, ChartEditorToolBar.ID); //$NON-NLS-1$
|
|
43 | 46 |
|
44 | 47 |
|
45 | 48 |
//FIXME: tests |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java (revision 564) | ||
---|---|---|
713 | 713 |
// does nothing by default |
714 | 714 |
} |
715 | 715 |
|
716 |
@Override |
|
716 | 717 |
public Composite getToolBarContainer(String toolbarLocalId) { |
717 |
if ("ChartEditorToolBar".equals(toolbarLocalId)) {
|
|
718 |
if (ChartEditorToolBar.ID.equals(toolbarLocalId)) {
|
|
718 | 719 |
return this.getTopToolBarContainer(); |
719 | 720 |
} |
720 | 721 |
return super.getToolBarContainer(toolbarLocalId); |
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java (revision 564) | ||
---|---|---|
20 | 20 |
* @author sjacquot |
21 | 21 |
* |
22 | 22 |
*/ |
23 |
public class WordCloud extends ChartResult implements IChartResult {
|
|
23 |
public class WordCloud extends ChartResult { |
|
24 | 24 |
|
25 | 25 |
//TODO: test rw.setStringEncoding("UTF-8"); // or connection |
26 | 26 |
private int[] freqs; |
tmp/org.txm.searchengine.cqp.rcp/plugin.xml (revision 564) | ||
---|---|---|
328 | 328 |
adaptableType="org.txm.functions.diagnostic.Diagnostic" |
329 | 329 |
class="org.txm.searchengine.cqp.rcp.command.DiagnosticAdapterFactory"> |
330 | 330 |
<adapter |
331 |
type="org.txm.searchengine.cqp.rcp.Adapter1">
|
|
331 |
type="org.eclipse.ui.model.IWorkbenchAdapter">
|
|
332 | 332 |
</adapter> |
333 | 333 |
</factory> |
334 | 334 |
</extension> |
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/command/DiagnosticAdapterFactory.java (revision 564) | ||
---|---|---|
6 | 6 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
7 | 7 |
import org.osgi.framework.FrameworkUtil; |
8 | 8 |
import org.txm.functions.diagnostic.Diagnostic; |
9 |
import org.txm.index.core.functions.Index; |
|
10 | 9 |
import org.txm.rcp.adapters.TXMResultAdapter; |
11 | 10 |
import org.txm.rcp.adapters.TXMResultAdapterFactory; |
12 | 11 |
|
... | ... | |
25 | 24 |
|
26 | 25 |
@Override |
27 | 26 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
28 |
if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Index) {
|
|
27 |
if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Diagnostic) {
|
|
29 | 28 |
return new TXMResultAdapter() { |
30 | 29 |
@Override |
31 | 30 |
public ImageDescriptor getImageDescriptor(Object object) { |
Formats disponibles : Unified diff