Révision 1086
tmp/org.txm.index.core/src/org/txm/index/core/functions/Lexicon.java (revision 1086) | ||
---|---|---|
627 | 627 |
return true; |
628 | 628 |
} |
629 | 629 |
|
630 |
/** |
|
631 |
* Sets the unit property. |
|
632 |
* @param property the unit property |
|
633 |
*/ |
|
630 | 634 |
public void setProperty(Property property) { |
631 | 635 |
this.pProperty = property; |
632 | 636 |
} |
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 1086) | ||
---|---|---|
122 | 122 |
protected Integer pNLinesPerPage; |
123 | 123 |
|
124 | 124 |
/** |
125 |
* The word properties shown.
|
|
125 |
* The word properties to display.
|
|
126 | 126 |
*/ |
127 | 127 |
@Parameter(key=TXMPreferences.UNIT_PROPERTIES) |
128 | 128 |
protected List<WordProperty> pProperties; |
... | ... | |
647 | 647 |
selectedLines = lines.subList(start, end); |
648 | 648 |
|
649 | 649 |
int p = 0; |
650 |
for (Property property : pProperties) {// for each property get the string values
|
|
651 |
// values of the tokens
|
|
650 |
// for each property get the string values of the tokens
|
|
651 |
for (Property property : pProperties) {
|
|
652 | 652 |
|
653 | 653 |
int len = 0; |
654 | 654 |
for (Line l : selectedLines) { |
... | ... | |
665 | 665 |
String[] strs = null; |
666 | 666 |
try { |
667 | 667 |
if (property instanceof StructuralUnitProperty) { |
668 |
strs = CorpusManager.getCorpusManager().getCqiClient() |
|
669 |
.struc2Str(property.getQualifiedName(), indices); |
|
670 |
} else { |
|
671 |
strs = CorpusManager.getCorpusManager().getCqiClient() |
|
672 |
.id2Str(property.getQualifiedName(), indices); |
|
668 |
strs = CorpusManager.getCorpusManager().getCqiClient().struc2Str(property.getQualifiedName(), indices); |
|
673 | 669 |
} |
670 |
else { |
|
671 |
strs = CorpusManager.getCorpusManager().getCqiClient().id2Str(property.getQualifiedName(), indices); |
|
672 |
} |
|
674 | 673 |
} catch (Exception e) { |
675 | 674 |
org.txm.utils.logger.Log.printStackTrace(e); |
676 | 675 |
return null; |
... | ... | |
947 | 946 |
Line line = new Line(); |
948 | 947 |
Match match = matches.get(i); |
949 | 948 |
int size = match.size(); |
950 |
if (isTargetUsed) size = 1; |
|
949 |
if (isTargetUsed) { |
|
950 |
size = 1; |
|
951 |
} |
|
951 | 952 |
for (int p = 0; p < pProperties.size(); p++) { |
952 | 953 |
Property property = pProperties.get(p); |
953 | 954 |
int[] allprosids = propsId.get(property); |
... | ... | |
987 | 988 |
|
988 | 989 |
} |
989 | 990 |
|
991 |
/** |
|
992 |
* |
|
993 |
* @param mode |
|
994 |
*/ |
|
990 | 995 |
public void setLexiconMode(boolean mode) { |
991 | 996 |
this.lexiconMode = mode; |
992 | 997 |
} |
993 | 998 |
|
994 |
|
|
995 |
|
|
999 |
/** |
|
1000 |
* |
|
1001 |
* @param nLinesPerPage |
|
1002 |
*/ |
|
996 | 1003 |
public void setNLinesPerPage(int nLinesPerPage) { |
997 | 1004 |
this.pNLinesPerPage = Math.max(nLinesPerPage, 1); |
998 | 1005 |
} |
999 | 1006 |
|
1007 |
/** |
|
1008 |
* |
|
1009 |
* @param props |
|
1010 |
*/ |
|
1000 | 1011 |
public void setParameters(List<WordProperty> props) { |
1001 | 1012 |
this.pQuery = new CQLQuery("[]"); //$NON-NLS-1$ |
1002 | 1013 |
this.pProperties = props; |
... | ... | |
1101 | 1112 |
* @throws CqiClientException the cqi client exception |
1102 | 1113 |
* @throws IOException Signals that an I/O exception has occurred. |
1103 | 1114 |
*/ |
1104 |
public void toConsole(int from, int to) throws CqiClientException, |
|
1105 |
IOException { |
|
1115 |
public void toConsole(int from, int to) throws CqiClientException, IOException { |
|
1106 | 1116 |
|
1107 | 1117 |
String header = ""; //$NON-NLS-1$ |
1108 |
for (Property p : pProperties) |
|
1118 |
for (Property p : pProperties) {
|
|
1109 | 1119 |
header += (p + pPropertiesSeparator); |
1120 |
} |
|
1110 | 1121 |
header = header.substring(0, header.length() - 1); |
1111 | 1122 |
header += "\tF"; //$NON-NLS-1$ |
1112 |
if (partnames.size() > 1) |
|
1113 |
for (int j = 0; j < partnames.size(); j++) |
|
1123 |
if (partnames.size() > 1) {
|
|
1124 |
for (int j = 0; j < partnames.size(); j++) {
|
|
1114 | 1125 |
header += "\t" + partnames.get(j); //$NON-NLS-1$ |
1126 |
} |
|
1127 |
} |
|
1115 | 1128 |
|
1116 | 1129 |
System.out.println(header); |
1117 | 1130 |
for (int i = from; i < to; i++) { |
1118 | 1131 |
Line ligne = lines.get(i); |
1119 | 1132 |
System.out.print(ligne + "\t" + ligne.getFrequency()); //$NON-NLS-1$ |
1120 |
if (partnames.size() > 1) |
|
1121 |
for (int j = 0; j < partnames.size(); j++) |
|
1133 |
if (partnames.size() > 1) {
|
|
1134 |
for (int j = 0; j < partnames.size(); j++) {
|
|
1122 | 1135 |
System.out.print("\t" + ligne.getFrequency(j)); //$NON-NLS-1$ |
1136 |
} |
|
1137 |
} |
|
1123 | 1138 |
System.out.print("\n"); //$NON-NLS-1$ |
1124 | 1139 |
} |
1125 | 1140 |
System.out.flush(); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/DeleteObject.java (revision 1086) | ||
---|---|---|
51 | 51 |
import org.eclipse.ui.internal.Workbench; |
52 | 52 |
import org.txm.Toolbox; |
53 | 53 |
import org.txm.core.engines.EngineType; |
54 |
import org.txm.core.preferences.TXMPreferences; |
|
55 | 54 |
import org.txm.core.results.TXMResult; |
56 | 55 |
import org.txm.objects.TxmObject; |
57 | 56 |
import org.txm.rcp.StatusLine; |
... | ... | |
63 | 62 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
64 | 63 |
import org.txm.searchengine.cqp.corpus.Partition; |
65 | 64 |
import org.txm.utils.logger.Log; |
66 |
//import org.txm.functions.queryindex.QueryIndex; |
|
67 |
// TODO: Auto-generated Javadoc |
|
65 |
|
|
68 | 66 |
/** |
69 |
* Delete the selection: TXMObjects and results code for the results must be |
|
70 |
* added manually here @ author mdecorde. |
|
67 |
* Deletes the selected results. |
|
68 |
* |
|
69 |
* @author mdecorde |
|
70 |
* |
|
71 | 71 |
*/ |
72 | 72 |
public class DeleteObject extends AbstractHandler { |
73 | 73 |
|
... | ... | |
84 | 84 |
|
85 | 85 |
final IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
86 | 86 |
|
87 |
if (!askContinueToDelete(selection)) return null; |
|
87 |
if (!askContinueToDelete(selection)) { |
|
88 |
return null; |
|
89 |
} |
|
88 | 90 |
|
89 | 91 |
JobHandler job = new JobHandler("Deleting", true) { |
90 | 92 |
@Override |
... | ... | |
131 | 133 |
} |
132 | 134 |
|
133 | 135 |
/** |
134 |
* Delete. |
|
136 |
* Deletes.
|
|
135 | 137 |
* |
136 |
* @param sel the selection of object to delete |
|
138 |
* @param sel the selection of objects to delete
|
|
137 | 139 |
*/ |
138 | 140 |
public static HashSet<Object> delete(ISelection sel) { |
139 | 141 |
IStructuredSelection selection = (IStructuredSelection) sel; |
140 |
if (selection.size() == 0) return new HashSet<Object>(); |
|
141 | 142 |
|
143 |
if (selection.size() == 0) { |
|
144 |
return new HashSet<Object>(); |
|
145 |
} |
|
146 |
|
|
142 | 147 |
List<Object> objects = new ArrayList<Object>(selection.toList()); |
143 | 148 |
return delete(objects); |
144 | 149 |
} |
145 | 150 |
|
146 | 151 |
|
147 | 152 |
/** |
148 |
* Delete. |
|
153 |
* Deletes.
|
|
149 | 154 |
* |
150 | 155 |
* TODO: select the parent object of the deleted object |
151 | 156 |
* |
... | ... | |
182 | 187 |
org.txm.Toolbox.restartWorkspace(null); |
183 | 188 |
Toolbox.getEngineManager(EngineType.SEARCH).restartEngines(); |
184 | 189 |
|
185 |
System.err.println(TXMUIMessages.AddBase_10);
|
|
190 |
Log.info(TXMUIMessages.AddBase_10);
|
|
186 | 191 |
StatusLine.setMessage(TXMUIMessages.AddBase_10); |
187 | 192 |
} |
188 | 193 |
|
... | ... | |
196 | 201 |
for(Object obj : allObjectDeleted) { |
197 | 202 |
closeEditorOfSelection(obj); |
198 | 203 |
} |
199 |
} catch(Exception e) { } |
|
204 |
} catch(Exception e) { |
|
205 |
} |
|
200 | 206 |
} |
201 | 207 |
}); |
202 | 208 |
} |
... | ... | |
206 | 212 |
} |
207 | 213 |
|
208 | 214 |
/** |
209 |
* Delete. |
|
215 |
* Deletes the specified object.
|
|
210 | 216 |
* |
211 | 217 |
* @param o the o |
212 | 218 |
* @return the list |
... | ... | |
231 | 237 |
Log.info(TXMUIMessages.DeleteObject_3); |
232 | 238 |
return new ArrayList<Object>(0); |
233 | 239 |
} |
234 |
} else if (o instanceof Partition) { |
|
240 |
} |
|
241 |
else if (o instanceof Partition) { |
|
235 | 242 |
Partition p = (Partition)o; |
236 | 243 |
for (int i = 0 ; i < p.getChildren().size() ; i++) { |
237 | 244 |
deleted.addAll(delete(p.getChildren().get(i))); |
... | ... | |
249 | 256 |
// FIXME: when TXMResult will be implemented, only this code must be left |
250 | 257 |
else if (o instanceof TXMResult) { |
251 | 258 |
((TXMResult) o).delete(); |
252 |
System.out.println(NLS.bind(TXMUIMessages.DeleteObject_10, ((TXMResult) o).getName()));
|
|
259 |
Log.info(NLS.bind(TXMUIMessages.DeleteObject_10, ((TXMResult) o).getName()));
|
|
253 | 260 |
} |
254 | 261 |
|
255 |
|
|
256 | 262 |
deleted.add(o); |
257 | 263 |
|
258 | 264 |
return deleted; |
... | ... | |
263 | 269 |
* |
264 | 270 |
* @param o the object used by an editor |
265 | 271 |
*/ |
266 |
public static void closeEditorOfSelection(Object o) |
|
267 |
{ |
|
272 |
public static void closeEditorOfSelection(Object o) { |
|
268 | 273 |
for (IWorkbenchPage page : getPages()) { |
269 | 274 |
for (IEditorReference editorref : page.getEditorReferences()) { |
270 | 275 |
IEditorPart editor = editorref.getEditor(false); |
... | ... | |
284 | 289 |
* |
285 | 290 |
* @return the pages |
286 | 291 |
*/ |
287 |
public static IWorkbenchPage[] getPages() |
|
288 |
{ |
|
292 |
public static IWorkbenchPage[] getPages() { |
|
289 | 293 |
for (IWorkbenchWindow win : Workbench.getInstance().getWorkbenchWindows()) { |
290 | 294 |
return win.getPages(); |
291 | 295 |
} |
Formats disponibles : Unified diff