Révision 490
| tmp/org.txm.lexicaltable.core/src/org/txm/functions/intertextualdistance/InterTextDistance.java (revision 490) | ||
|---|---|---|
| 7 | 7 |
|
| 8 | 8 |
import org.rosuda.REngine.REXP; |
| 9 | 9 |
import org.rosuda.REngine.REXPMismatchException; |
| 10 |
import org.txm.functions.ProgressWatcher;
|
|
| 10 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 11 | 11 |
import org.txm.functions.TXMCommand; |
| 12 | 12 |
import org.txm.lexicaltable.core.statsengine.data.ILexicalTable; |
| 13 | 13 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
| ... | ... | |
| 27 | 27 |
|
| 28 | 28 |
|
| 29 | 29 |
@Override |
| 30 |
public boolean compute(ProgressWatcher watcher) {
|
|
| 30 |
public boolean compute(IProgressMonitor watcher) {
|
|
| 31 | 31 |
try {
|
| 32 | 32 |
// Corpus corpus = CorpusManager.getCorpusManager().getCorpus("VOEUX");
|
| 33 | 33 |
// String method = "euclidean"; // "euclidean"’, ‘"maximum"’, ‘"manhattan"’, ‘"canberra"’, ‘"binary"’ or ‘"minkowski"’ |
| tmp/org.txm.cah.core/src/org/txm/cah/core/functions/CAH.java (revision 490) | ||
|---|---|---|
| 35 | 35 |
import org.txm.cah.core.messages.CAHCoreMessages; |
| 36 | 36 |
import org.txm.cah.core.preferences.CAHPreferences; |
| 37 | 37 |
import org.txm.core.preferences.TXMPreferences; |
| 38 |
import org.txm.functions.ProgressWatcher;
|
|
| 38 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 39 | 39 |
import org.txm.functions.TXMCommand; |
| 40 | 40 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
| 41 | 41 |
import org.txm.searchengine.cqp.corpus.Corpus; |
| ... | ... | |
| 217 | 217 |
protected static int nocah = 1; |
| 218 | 218 |
|
| 219 | 219 |
@Override |
| 220 |
public boolean compute(ProgressWatcher watcher) {
|
|
| 220 |
public boolean compute(IProgressMonitor watcher) {
|
|
| 221 | 221 |
|
| 222 | 222 |
Log.info("Computing CAH...");
|
| 223 | 223 |
try {
|
| tmp/org.txm.dictionary.rcp/src/org/txm/dictionary/functions/jpa/Dictionary.java (revision 490) | ||
|---|---|---|
| 31 | 31 |
import org.eclipse.persistence.queries.Cursor; |
| 32 | 32 |
import org.txm.Toolbox; |
| 33 | 33 |
import org.txm.annotation.DatabasePersistenceManager; |
| 34 |
import org.txm.functions.ProgressWatcher;
|
|
| 34 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 35 | 35 |
import org.txm.stat.utils.ConsoleProgressBar; |
| 36 | 36 |
import org.txm.utils.logger.Log; |
| 37 | 37 |
|
| ... | ... | |
| 62 | 62 |
addEntries(ids, null); |
| 63 | 63 |
} |
| 64 | 64 |
|
| 65 |
private void addEntries(ArrayList<EntryId> ids, ProgressWatcher monitor) {
|
|
| 65 |
private void addEntries(ArrayList<EntryId> ids, IProgressMonitor monitor) {
|
|
| 66 | 66 |
jpaem.getTransaction().begin(); |
| 67 | 67 |
|
| 68 | 68 |
for (EntryId t : ids) {
|
| ... | ... | |
| 135 | 135 |
addTypes(types, null); |
| 136 | 136 |
} |
| 137 | 137 |
|
| 138 |
public void addTypes(ArrayList<EntryPropertyType> types, ProgressWatcher monitor) {
|
|
| 138 |
public void addTypes(ArrayList<EntryPropertyType> types, IProgressMonitor monitor) {
|
|
| 139 | 139 |
jpaem.getTransaction().begin(); |
| 140 | 140 |
for (EntryPropertyType t : types) {
|
| 141 | 141 |
jpaem.persist(t); |
| 142 |
if (monitor != null) monitor.worked(); |
|
| 142 |
if (monitor != null) monitor.worked(1);
|
|
| 143 | 143 |
autoFlush(); |
| 144 | 144 |
} |
| 145 | 145 |
jpaem.getTransaction().commit(); |
| tmp/org.txm.querycooccurrences.rcp/src/org/txm/functions/coocmatrix/QueryAutoCooccurrence.java (revision 490) | ||
|---|---|---|
| 9 | 9 |
import org.txm.ca.core.functions.CA; |
| 10 | 10 |
import org.txm.ca.core.functions.ICAComputable; |
| 11 | 11 |
import org.txm.core.results.TXMResult; |
| 12 |
import org.txm.functions.ProgressWatcher;
|
|
| 12 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 13 | 13 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
| 14 | 14 |
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl; |
| 15 | 15 |
import org.txm.rcp.IImageKeys; |
| ... | ... | |
| 44 | 44 |
protected boolean oriented = false; |
| 45 | 45 |
|
| 46 | 46 |
public QueryAutoCooccurrence(Corpus corpus, ArrayList<Query> queries, |
| 47 |
ArrayList<String> names, int dist, int minCooc, String struct, boolean oriented, ProgressWatcher monitor) throws CqiClientException, RWorkspaceException {
|
|
| 47 |
ArrayList<String> names, int dist, int minCooc, String struct, boolean oriented, IProgressMonitor monitor) throws CqiClientException, RWorkspaceException {
|
|
| 48 | 48 |
this.queries = queries; |
| 49 | 49 |
this.names = names; |
| 50 | 50 |
this.corpus = corpus; |
| tmp/org.txm.searchengine.core/META-INF/MANIFEST.MF (revision 490) | ||
|---|---|---|
| 4 | 4 |
Bundle-SymbolicName: org.txm.searchengine.core;singleton:=true |
| 5 | 5 |
Bundle-Version: 1.0.0.qualifier |
| 6 | 6 |
Bundle-Activator: org.txm.searchengine.core.Activator |
| 7 |
Require-Bundle: org.txm.annotation.core;bundle-version="1.0.0", |
|
| 8 |
org.eclipse.core.runtime, |
|
| 7 |
Require-Bundle: org.eclipse.core.runtime, |
|
| 9 | 8 |
org.txm.core;bundle-version="0.7.0", |
| 10 | 9 |
org.txm.utils |
| 11 | 10 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
| tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/ComputeCooccurrences.java (revision 490) | ||
|---|---|---|
| 175 | 175 |
|
| 176 | 176 |
return selection; |
| 177 | 177 |
} |
| 178 |
|
|
| 179 |
|
|
| 180 |
|
|
| 181 | 178 |
} |
| tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 490) | ||
|---|---|---|
| 42 | 42 |
|
| 43 | 43 |
import org.apache.commons.lang.StringUtils; |
| 44 | 44 |
import org.eclipse.osgi.util.NLS; |
| 45 |
import org.txm.functions.ProgressWatcher;
|
|
| 45 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 46 | 46 |
import org.txm.functions.TXMCommand; |
| 47 | 47 |
import org.txm.index.core.messages.IndexCoreMessages; |
| 48 | 48 |
import org.txm.lexicon.core.corpusengine.cqp.Lexicon; |
| ... | ... | |
| 1017 | 1017 |
|
| 1018 | 1018 |
|
| 1019 | 1019 |
@Override |
| 1020 |
public boolean compute(ProgressWatcher watcher) throws Exception {
|
|
| 1020 |
public boolean compute(IProgressMonitor watcher) throws Exception {
|
|
| 1021 | 1021 |
if (query != null) {
|
| 1022 | 1022 |
if (parent instanceof Corpus) {
|
| 1023 | 1023 |
Corpus corpus = (Corpus)parent; |
| tmp/org.txm.concordance.rcp/META-INF/MANIFEST.MF (revision 490) | ||
|---|---|---|
| 5 | 5 |
Bundle-Version: 1.0.0.qualifier |
| 6 | 6 |
Bundle-Vendor: Textometrie.org |
| 7 | 7 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
| 8 |
Require-Bundle: org.txm.annotation.core;bundle-version="1.0.0", |
|
| 9 |
org.eclipse.core.runtime;bundle-version="3.10.0", |
|
| 8 |
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.10.0", |
|
| 10 | 9 |
org.eclipse.ui;bundle-version="3.106.1", |
| 11 | 10 |
org.txm.cooccurrence.core;bundle-version="1.0.0", |
| 12 | 11 |
org.txm.cooccurrence.rcp;bundle-version="1.0.0", |
| ... | ... | |
| 17 | 16 |
org.txm.core, |
| 18 | 17 |
org.txm.rcp, |
| 19 | 18 |
org.eclipse.core.expressions;bundle-version="3.4.600", |
| 20 |
org.txm.para.rcp,
|
|
| 21 |
org.txm.searchengine.core;bundle-version="1.0.0"
|
|
| 19 |
org.txm.searchengine.core;bundle-version="1.0.0",
|
|
| 20 |
org.txm.annotation.core;bundle-version="1.0.0"
|
|
| 22 | 21 |
Export-Package: org.txm.concordance.rcp.adapters, |
| 23 | 22 |
org.txm.concordance.rcp.editors, |
| 24 | 23 |
org.txm.concordance.rcp.handlers, |
| tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 490) | ||
|---|---|---|
| 100 | 100 |
import org.txm.Toolbox; |
| 101 | 101 |
import org.txm.annotation.Annotation; |
| 102 | 102 |
import org.txm.annotation.AnnotationManager; |
| 103 |
import org.txm.annotation.KRAnnotationEngine; |
|
| 103 | 104 |
import org.txm.annotation.repository.AnnotationType; |
| 104 | 105 |
import org.txm.annotation.repository.KnowledgeRepository; |
| 105 | 106 |
import org.txm.annotation.repository.KnowledgeRepositoryManager; |
| ... | ... | |
| 427 | 428 |
|
| 428 | 429 |
private void initializeEditor() {
|
| 429 | 430 |
this.corpus = ((ConcordanceEditorInput) getEditorInput()).getCorpus(); |
| 430 |
this.annotManager = corpus.getAnnotationManager();
|
|
| 431 |
this.annotManager = KRAnnotationEngine.getAnnotationManager(corpus);
|
|
| 431 | 432 |
|
| 432 | 433 |
this.standardComparators = new ArrayList<LineComparator>(); |
| 433 | 434 |
this.userDefinedComparators = new ArrayList<LineComparator>(); |
| ... | ... | |
| 1022 | 1023 |
Log.warning("Corpus KRs: "+krs); //$NON-NLS-1$
|
| 1023 | 1024 |
|
| 1024 | 1025 |
for (KnowledgeRepository kr : krs) {
|
| 1026 |
if (kr == null) continue; |
|
| 1027 |
|
|
| 1025 | 1028 |
currentKnowledgeRepository = kr; |
| 1026 | 1029 |
Log.warning(" KR: "+kr); //$NON-NLS-1$
|
| 1027 | 1030 |
List<AnnotationType> krtypes = kr.getAllAnnotationTypes(); |
| ... | ... | |
| 1045 | 1048 |
Log.warning("Available annotation types: "+typesList);
|
| 1046 | 1049 |
break; |
| 1047 | 1050 |
} |
| 1051 |
|
|
| 1052 |
if (currentKnowledgeRepository == null) {
|
|
| 1053 |
System.out.println("Error: no suitable KnowledgeRepository found");
|
|
| 1054 |
return; |
|
| 1055 |
} |
|
| 1048 | 1056 |
|
| 1049 | 1057 |
annotationArea = new Composite(parent, SWT.NONE); |
| 1050 | 1058 |
annotationArea.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, false, false)); |
| ... | ... | |
| 1790 | 1798 |
}); |
| 1791 | 1799 |
|
| 1792 | 1800 |
|
| 1793 |
if (corpus.getKnowledgeRepositoryNames().size() > 0) { // shown only if corpus has a registered KR
|
|
| 1801 |
if (KRAnnotationEngine.getKnowledgeRepositoryNames(corpus).size() > 0) { // shown only if corpus has a registered KR
|
|
| 1794 | 1802 |
|
| 1795 | 1803 |
annotationButton = new Button(navigationPanel, SWT.PUSH); |
| 1796 | 1804 |
annotationButton.setToolTipText(Messages.ConcordancesEditor_75); |
| ... | ... | |
| 1799 | 1807 |
@Override |
| 1800 | 1808 |
public void widgetSelected(SelectionEvent e) {
|
| 1801 | 1809 |
if (annotationArea != null) {
|
| 1802 |
AnnotationManager am = corpus.getMainCorpus().getAnnotationManager();
|
|
| 1810 |
AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
|
|
| 1803 | 1811 |
if (am != null && am.hasChanges()) {
|
| 1804 | 1812 |
// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?") |
| 1805 | 1813 |
JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus()); |
| tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineSortReferencePattern.java (revision 490) | ||
|---|---|---|
| 47 | 47 |
import org.eclipse.ui.IWorkbenchWindow; |
| 48 | 48 |
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; |
| 49 | 49 |
import org.txm.concordance.rcp.editors.ConcordanceEditor; |
| 50 |
import org.txm.para.rcp.editors.ParaBrowserEditor; |
|
| 51 | 50 |
import org.txm.rcp.Messages; |
| 52 | 51 |
import org.txm.searchengine.cqp.ReferencePattern; |
| 53 | 52 |
import org.txm.searchengine.cqp.corpus.Property; |
| ... | ... | |
| 70 | 69 |
/** The concordance editor. */ |
| 71 | 70 |
private ConcordanceEditor concordanceEditor; |
| 72 | 71 |
|
| 73 |
/** The para browser editor. */ |
|
| 74 |
private ParaBrowserEditor paraBrowserEditor; |
|
| 75 |
|
|
| 76 | 72 |
/** |
| 77 | 73 |
* Instantiates a new define reference pattern. |
| 78 | 74 |
* |
| ... | ... | |
| 88 | 84 |
setToolTipText(Messages.DefineReferencePattern_4); |
| 89 | 85 |
} |
| 90 | 86 |
|
| 91 |
/** |
|
| 92 |
* Instantiates a new define reference pattern. |
|
| 93 |
* |
|
| 94 |
* @param window the window |
|
| 95 |
* @param paraBrowserEditor the para browser editor |
|
| 96 |
*/ |
|
| 97 |
public DefineSortReferencePattern(IWorkbenchWindow window, |
|
| 98 |
ParaBrowserEditor paraBrowserEditor) {
|
|
| 99 |
this.window = window; |
|
| 100 |
this.paraBrowserEditor = paraBrowserEditor; |
|
| 101 |
setId(ID); |
|
| 102 |
setText(Messages.DefineReferencePattern_3); |
|
| 103 |
setToolTipText(Messages.DefineReferencePattern_4); |
|
| 104 |
} |
|
| 105 |
|
|
| 106 |
|
|
| 107 | 87 |
/* (non-Javadoc) |
| 108 | 88 |
* @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose() |
| 109 | 89 |
*/ |
| ... | ... | |
| 119 | 99 |
List<StructuralUnit> structuralUnits = null; |
| 120 | 100 |
List<Property> availableReferenceItems = new ArrayList<Property>(); |
| 121 | 101 |
try {
|
| 122 |
if (paraBrowserEditor != null) {
|
|
| 123 |
structuralUnits = paraBrowserEditor.getCorpus() |
|
| 124 |
.getOrderedStructuralUnits(); |
|
| 125 |
availableReferenceItems.addAll(paraBrowserEditor.getCorpus() |
|
| 126 |
.getOrderedProperties()); |
|
| 127 |
|
|
| 128 |
} else if (concordanceEditor != null) {
|
|
| 129 | 102 |
structuralUnits = concordanceEditor.getCorpus() |
| 130 | 103 |
.getOrderedStructuralUnits(); |
| 131 | 104 |
availableReferenceItems.addAll(concordanceEditor.getCorpus() |
| 132 | 105 |
.getOrderedProperties()); |
| 133 | 106 |
|
| 134 |
} |
|
| 135 | 107 |
|
| 136 | 108 |
} catch (Exception e) {
|
| 137 | 109 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
| ... | ... | |
| 143 | 115 |
|
| 144 | 116 |
// System.out.println("selected "+concordanceEditor.getSelectedReferences());
|
| 145 | 117 |
// System.out.println("before avail"+availableReferenceItems);
|
| 146 |
if (paraBrowserEditor != null) {
|
|
| 147 |
availableReferenceItems.remove(paraBrowserEditor |
|
| 148 |
.getSelectedReferences()); |
|
| 149 |
} else {
|
|
| 150 | 118 |
availableReferenceItems.remove(concordanceEditor |
| 151 | 119 |
.getSelectedSortReferences()); |
| 152 |
} |
|
| 153 | 120 |
|
| 154 |
// System.out.println("after avail"+availableReferenceItems);
|
|
| 121 |
// System.out.println("after avail"+availableReferenceItems);
|
|
| 155 | 122 |
DefineReferencePatternDialog d = null; |
| 156 |
if (paraBrowserEditor != null) {
|
|
| 157 | 123 |
d = new DefineReferencePatternDialog(window.getShell(), |
| 158 |
availableReferenceItems, paraBrowserEditor |
|
| 159 |
.getSelectedReferences()); |
|
| 160 |
} else if (concordanceEditor != null) {
|
|
| 161 |
d = new DefineReferencePatternDialog(window.getShell(), |
|
| 162 | 124 |
availableReferenceItems, concordanceEditor |
| 163 | 125 |
.getSelectedSortReferences()); |
| 164 |
} |
|
| 165 | 126 |
|
| 166 | 127 |
if (d.open() == Window.OK) {
|
| 167 |
if (paraBrowserEditor != null) {
|
|
| 168 |
paraBrowserEditor.setReferencePattern(new ReferencePattern(d |
|
| 169 |
.getSelectesdReferenceItems())); |
|
| 170 |
} else if (concordanceEditor != null) {
|
|
| 171 | 128 |
concordanceEditor.setRefSortPattern(new ReferencePattern(d |
| 172 | 129 |
.getSelectesdReferenceItems())); |
| 173 |
} |
|
| 174 | 130 |
//System.out.println(concordanceEditor.getSortReferencePattern()); |
| 175 | 131 |
} |
| 176 | 132 |
} |
| tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineViewReferencePattern.java (revision 490) | ||
|---|---|---|
| 47 | 47 |
import org.eclipse.ui.IWorkbenchWindow; |
| 48 | 48 |
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; |
| 49 | 49 |
import org.txm.concordance.rcp.editors.ConcordanceEditor; |
| 50 |
import org.txm.para.rcp.editors.ParaBrowserEditor; |
|
| 51 | 50 |
import org.txm.rcp.Messages; |
| 52 | 51 |
import org.txm.searchengine.cqp.ReferencePattern; |
| 53 | 52 |
import org.txm.searchengine.cqp.corpus.Property; |
| ... | ... | |
| 70 | 69 |
/** The concordance editor. */ |
| 71 | 70 |
private ConcordanceEditor concordanceEditor; |
| 72 | 71 |
|
| 73 |
/** The para browser editor. */ |
|
| 74 |
private ParaBrowserEditor paraBrowserEditor; |
|
| 75 |
|
|
| 76 | 72 |
/** |
| 77 | 73 |
* Instantiates a new define reference pattern. |
| 78 | 74 |
* |
| ... | ... | |
| 88 | 84 |
setToolTipText(Messages.DefineReferencePattern_2); |
| 89 | 85 |
} |
| 90 | 86 |
|
| 91 |
/** |
|
| 92 |
* Instantiates a new define reference pattern. |
|
| 93 |
* |
|
| 94 |
* @param window the window |
|
| 95 |
* @param paraBrowserEditor the para browser editor |
|
| 96 |
*/ |
|
| 97 |
public DefineViewReferencePattern(IWorkbenchWindow window, |
|
| 98 |
ParaBrowserEditor paraBrowserEditor) {
|
|
| 99 |
this.window = window; |
|
| 100 |
this.paraBrowserEditor = paraBrowserEditor; |
|
| 101 |
setId(ID); |
|
| 102 |
setText(Messages.DefineReferencePattern_1); |
|
| 103 |
setToolTipText(Messages.DefineReferencePattern_2); |
|
| 104 |
} |
|
| 105 |
|
|
| 106 |
|
|
| 107 | 87 |
/* (non-Javadoc) |
| 108 | 88 |
* @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose() |
| 109 | 89 |
*/ |
| ... | ... | |
| 119 | 99 |
List<StructuralUnit> structuralUnits = null; |
| 120 | 100 |
List<Property> availableReferenceItems = new ArrayList<Property>(); |
| 121 | 101 |
try {
|
| 122 |
if (paraBrowserEditor != null) {
|
|
| 123 |
structuralUnits = paraBrowserEditor.getCorpus() |
|
| 124 |
.getOrderedStructuralUnits(); |
|
| 125 |
availableReferenceItems.addAll(paraBrowserEditor.getCorpus() |
|
| 126 |
.getOrderedProperties()); |
|
| 127 |
|
|
| 128 |
} else if (concordanceEditor != null) {
|
|
| 129 | 102 |
structuralUnits = concordanceEditor.getCorpus() |
| 130 | 103 |
.getOrderedStructuralUnits(); |
| 131 | 104 |
availableReferenceItems.addAll(concordanceEditor.getCorpus() |
| 132 | 105 |
.getOrderedProperties()); |
| 133 | 106 |
|
| 134 |
} |
|
| 135 |
|
|
| 136 | 107 |
} catch (Exception e) {
|
| 137 | 108 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
| 138 | 109 |
} |
| ... | ... | |
| 143 | 114 |
|
| 144 | 115 |
// System.out.println("selected "+concordanceEditor.getSelectedReferences());
|
| 145 | 116 |
// System.out.println("before avail"+availableReferenceItems);
|
| 146 |
if (paraBrowserEditor != null) {
|
|
| 147 |
availableReferenceItems.remove(paraBrowserEditor |
|
| 148 |
.getSelectedReferences()); |
|
| 149 |
} else {
|
|
| 150 | 117 |
availableReferenceItems.remove(concordanceEditor |
| 151 | 118 |
.getSelectedViewReferences()); |
| 152 |
} |
|
| 153 | 119 |
|
| 154 | 120 |
// System.out.println("after avail"+availableReferenceItems);
|
| 155 | 121 |
DefineReferencePatternDialog d = null; |
| 156 |
if (paraBrowserEditor != null) {
|
|
| 157 | 122 |
d = new DefineReferencePatternDialog(window.getShell(), |
| 158 |
availableReferenceItems, paraBrowserEditor |
|
| 159 |
.getSelectedReferences()); |
|
| 160 |
} else if (concordanceEditor != null) {
|
|
| 161 |
d = new DefineReferencePatternDialog(window.getShell(), |
|
| 162 | 123 |
availableReferenceItems, concordanceEditor |
| 163 | 124 |
.getSelectedViewReferences()); |
| 164 |
} |
|
| 165 | 125 |
|
| 166 | 126 |
if (d.open() == Window.OK) {
|
| 167 |
if (paraBrowserEditor != null) {
|
|
| 168 |
paraBrowserEditor.setReferencePattern(new ReferencePattern(d |
|
| 169 |
.getSelectesdReferenceItems())); |
|
| 170 |
} else if (concordanceEditor != null) {
|
|
| 171 | 127 |
concordanceEditor.setRefViewPattern(new ReferencePattern(d |
| 172 | 128 |
.getSelectesdReferenceItems())); |
| 173 |
} |
|
| 174 | 129 |
//System.out.println(concordanceEditor.getViewReferencePattern()); |
| 175 | 130 |
} |
| 176 | 131 |
} |
| tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 490) | ||
|---|---|---|
| 43 | 43 |
import org.txm.ca.core.statsengine.r.functions.ICA; |
| 44 | 44 |
import org.txm.chartsengine.core.results.IChartResult; |
| 45 | 45 |
import org.txm.core.preferences.TXMPreferences; |
| 46 |
import org.txm.functions.ProgressWatcher;
|
|
| 46 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 47 | 47 |
import org.txm.functions.TXMCommand; |
| 48 | 48 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
| 49 | 49 |
import org.txm.lexicaltable.core.functions.LexicalTableFactory; |
| ... | ... | |
| 989 | 989 |
|
| 990 | 990 |
|
| 991 | 991 |
@Override |
| 992 |
public boolean compute(ProgressWatcher watcher) throws Exception {
|
|
| 992 |
public boolean compute(IProgressMonitor watcher) throws Exception {
|
|
| 993 | 993 |
return stepLexicalTable() && stepSortTableLexical() && stepCompute(); |
| 994 | 994 |
} |
| 995 | 995 |
|
| tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/TEI2Project.java (revision 490) | ||
|---|---|---|
| 12 | 12 |
import org.eclipse.core.runtime.Platform; |
| 13 | 13 |
import org.osgi.framework.Bundle; |
| 14 | 14 |
import org.txm.Toolbox; |
| 15 |
import org.txm.functions.ProgressWatcher;
|
|
| 15 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 16 | 16 |
import org.txm.importer.ApplyXsl2; |
| 17 | 17 |
import org.txm.importer.WriteIdAndNAttributes; |
| 18 | 18 |
import org.txm.utils.BundleUtils; |
| ... | ... | |
| 36 | 36 |
this.createArchive = createArchive; |
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 |
public boolean process(ProgressWatcher monitor) throws IOException, XMLStreamException, TransformerException {
|
|
| 39 |
public boolean process(IProgressMonitor monitor) throws IOException, XMLStreamException, TransformerException {
|
|
| 40 | 40 |
if (!xmlFile.exists()) {
|
| 41 | 41 |
System.out.println("Could not read input XML input file: "+xmlFile);
|
| 42 | 42 |
return false; |
| ... | ... | |
| 125 | 125 |
try {
|
| 126 | 126 |
|
| 127 | 127 |
System.out.println("Applying "+xslMissingMilestones+" to "+xmlWFile+"...");
|
| 128 |
if (monitor != null) monitor.worked(1, "Applying "+xslMissingMilestones+" to "+xmlWFile+"...");
|
|
| 128 |
if (monitor != null) { monitor.worked(1); monitor.subTask("Applying "+xslMissingMilestones+" to "+xmlWFile+"...");}
|
|
| 129 | 129 |
ApplyXsl2 builder = new ApplyXsl2(xslMissingMilestones); |
| 130 | 130 |
if (!builder.process(xmlFileCopy, xmlWFile)) {
|
| 131 | 131 |
System.out.println("Failed to process "+xmlWFile+" with "+xslMissingMilestones);
|
| ... | ... | |
| 133 | 133 |
} |
| 134 | 134 |
|
| 135 | 135 |
System.out.println("Applying "+xslTokenizer+" to "+xmlWFile+"...");
|
| 136 |
if (monitor != null) monitor.worked(15, "Applying "+xslTokenizer+" to "+xmlWFile+"...");
|
|
| 136 |
if (monitor != null) {monitor.worked(15); monitor.subTask( "Applying "+xslTokenizer+" to "+xmlWFile+"...");};
|
|
| 137 | 137 |
builder = new ApplyXsl2(xslTokenizer); |
| 138 | 138 |
if (!builder.process(xmlWFile, xmlWFile)) {
|
| 139 | 139 |
System.out.println("Failed to process "+xmlFileCopy+" with "+xslTokenizer);
|
| ... | ... | |
| 141 | 141 |
} |
| 142 | 142 |
|
| 143 | 143 |
System.out.println("Merging words </w><w>");
|
| 144 |
if (monitor != null) monitor.worked(15, "Merging words </w><w>");
|
|
| 144 |
if (monitor != null) {monitor.worked(15); monitor.subTask("Merging words </w><w>");}
|
|
| 145 | 145 |
String content = IOUtils.getText(xmlWFile, "UTF-8"); |
| 146 | 146 |
content = content.replaceAll("</w><w[^>]*>", "");
|
| 147 | 147 |
content = content.replaceAll("</w>\\s*(<milestone[^>]*>)?\\s*(<pb[^>]*>)?\\s*(<cb[^>]*>)?\\s*(<lb[^>]*break=\"no\"[^>]*>)\\s*<w[^>]*>", "$1$2$3$4");
|
| ... | ... | |
| 155 | 155 |
} |
| 156 | 156 |
|
| 157 | 157 |
System.out.println("Applying "+xslPatchLbInWords+" to "+xmlWFile+"...");
|
| 158 |
if (monitor != null) monitor.worked(15, "Applying "+xslPatchLbInWords+" to "+xmlWFile+"...");
|
|
| 158 |
if (monitor != null) {monitor.worked(15); monitor.subTask("Applying "+xslPatchLbInWords+" to "+xmlWFile+"...");}
|
|
| 159 | 159 |
builder = new ApplyXsl2(xslPatchLbInWords); |
| 160 | 160 |
if (!builder.process(xmlWFile, xmlWFile)) {
|
| 161 | 161 |
System.out.println("Failed to process "+xmlFileCopy+" with "+xslPatchLbInWords);
|
| ... | ... | |
| 163 | 163 |
} |
| 164 | 164 |
|
| 165 | 165 |
System.out.println("Fixing 'id' and 'n' attributes in "+xmlWFile+"...");
|
| 166 |
if (monitor != null) monitor.worked(15, "Fixing 'id' and 'n' attributes in "+xmlWFile+"...");
|
|
| 166 |
if (monitor != null) {monitor.worked(15); monitor.subTask("Fixing 'id' and 'n' attributes in "+xmlWFile+"...");}
|
|
| 167 | 167 |
WriteIdAndNAttributes wiana = new WriteIdAndNAttributes(xmlWFile, projectName); |
| 168 | 168 |
File tmp = new File(xmlWFile.getParentFile(), "tmp_"+xmlWFile.getName()); |
| 169 | 169 |
if (!wiana.process(tmp)) {
|
| ... | ... | |
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 | 182 |
System.out.println("Applying "+xslCharactersTokenizer+" to "+xmlWFile+"...");
|
| 183 |
if (monitor != null) monitor.worked(15, "Applying "+xslCharactersTokenizer+" to "+xmlWFile+"...");
|
|
| 183 |
if (monitor != null) {monitor.worked(15); monitor.subTask("Applying "+xslCharactersTokenizer+" to "+xmlWFile+"...");}
|
|
| 184 | 184 |
builder = new ApplyXsl2(xslCharactersTokenizer); |
| 185 | 185 |
if (!builder.process(xmlWFile, xmlWCFile)) {
|
| 186 | 186 |
System.out.println("Failed to process "+xmlWFile+" with "+xslCharactersTokenizer);
|
| ... | ... | |
| 188 | 188 |
} |
| 189 | 189 |
|
| 190 | 190 |
System.out.println("Applying "+xslCharactersIdentifier+" to "+xmlWCFile+"...");
|
| 191 |
if (monitor != null) monitor.worked(1, "Applying "+xslCharactersIdentifier+" to "+xmlWCFile+"...");
|
|
| 191 |
if (monitor != null) {monitor.worked(1); monitor.subTask("Applying "+xslCharactersIdentifier+" to "+xmlWCFile+"...");}
|
|
| 192 | 192 |
builder = new ApplyXsl2(xslCharactersIdentifier); |
| 193 | 193 |
if (!builder.process(xmlWCFile, xmlWCFile)) {
|
| 194 | 194 |
System.out.println("Failed to process "+xmlWCFile+" with "+xslCharactersIdentifier);
|
| ... | ... | |
| 196 | 196 |
} |
| 197 | 197 |
|
| 198 | 198 |
System.out.println("Applying "+xslZones+" to "+xmlWFile+"...");
|
| 199 |
if (monitor != null) monitor.worked(15, "Applying "+xslZones+" to "+xmlWFile+"...");
|
|
| 199 |
if (monitor != null) {monitor.worked(15); monitor.subTask("Applying "+xslZones+" to "+xmlWFile+"...");}
|
|
| 200 | 200 |
builder = new ApplyXsl2(xslZones); |
| 201 | 201 |
if (!builder.process(xmlWFile, null)) {
|
| 202 | 202 |
System.out.println("Failed to process "+xmlFileCopy+" with "+xslZones);
|
| ... | ... | |
| 211 | 211 |
} |
| 212 | 212 |
|
| 213 | 213 |
if (createArchive) {
|
| 214 |
if (monitor != null) monitor.worked(15, "Building Oriflamms binary project... ");
|
|
| 214 |
if (monitor != null) {monitor.worked(15); monitor.subTask("Building Oriflamms binary project... ");}
|
|
| 215 | 215 |
File zipFile = new File(xmlFileParentDirectory, projectName+".oriflamms"); |
| 216 | 216 |
zipFile.delete(); |
| 217 | 217 |
Zip.compress(projectDirectory, zipFile); |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/JobHandler.java (revision 490) | ||
|---|---|---|
| 34 | 34 |
import org.eclipse.core.runtime.jobs.Job; |
| 35 | 35 |
import org.eclipse.swt.widgets.Composite; |
| 36 | 36 |
import org.eclipse.swt.widgets.Display; |
| 37 |
import org.txm.functions.ProgressWatcher;
|
|
| 37 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 38 | 38 |
import org.txm.rcp.Messages; |
| 39 | 39 |
import org.txm.rcp.StatusLine; |
| 40 | 40 |
import org.txm.utils.logger.Log; |
| 41 | 41 |
|
| 42 | 42 |
// TODO: Auto-generated Javadoc |
| 43 | 43 |
/** |
| 44 |
* Simplified RCP Job that implements the Toolbox ProgressWatcher class to allow TBX functions to manager the Job monitor.
|
|
| 44 |
* Simplified RCP Job that implements the Toolbox IProgressMonitor class to allow TBX functions to manager the Job monitor.
|
|
| 45 | 45 |
* |
| 46 | 46 |
* the implemented run methods returns a Status.OK_STATUS or Status.CANCEL_STATUS that can be tested with the getResult() after the join method is called. |
| 47 | 47 |
* |
| ... | ... | |
| 49 | 49 |
* |
| 50 | 50 |
* @author mdecorde, nkredens |
| 51 | 51 |
*/ |
| 52 |
public abstract class JobHandler extends Job implements ProgressWatcher, IProgressMonitor {
|
|
| 52 |
public abstract class JobHandler extends Job implements IProgressMonitor {
|
|
| 53 | 53 |
|
| 54 | 54 |
/** The parent. */ |
| 55 | 55 |
IProgressMonitor currentMonitor; |
| ... | ... | |
| 83 | 83 |
currentMonitor = monitor; |
| 84 | 84 |
} |
| 85 | 85 |
|
| 86 |
@Override |
|
| 87 | 86 |
public void beginTask(String name, long totalWork) {
|
| 88 | 87 |
if (currentMonitor != null) {
|
| 89 | 88 |
currentMonitor.beginTask(name, (int) totalWork); |
| ... | ... | |
| 104 | 103 |
currentMonitor.worked(amount); |
| 105 | 104 |
} |
| 106 | 105 |
} |
| 107 |
|
|
| 108 | 106 |
|
| 109 | 107 |
@Override |
| 110 |
public void worked() {
|
|
| 111 |
if (currentMonitor != null) {
|
|
| 112 |
currentMonitor.worked(1); |
|
| 113 |
} |
|
| 114 |
} |
|
| 115 |
|
|
| 116 |
@Override |
|
| 117 |
public void worked(int amount, String message) {
|
|
| 118 |
if (currentMonitor != null) {
|
|
| 119 |
currentMonitor.worked(amount); |
|
| 120 |
currentMonitor.subTask(message); |
|
| 121 |
} |
|
| 122 |
} |
|
| 123 |
|
|
| 124 |
@Override |
|
| 125 |
public void setMessage(String message) {
|
|
| 126 |
if (currentMonitor != null) |
|
| 127 |
currentMonitor.subTask(message); |
|
| 128 |
} |
|
| 129 |
|
|
| 130 |
@Override |
|
| 131 | 108 |
public boolean isCanceled() {
|
| 132 | 109 |
if (currentMonitor != null) {
|
| 133 | 110 |
return currentMonitor.isCanceled(); |
| ... | ... | |
| 142 | 119 |
} |
| 143 | 120 |
} |
| 144 | 121 |
|
| 145 |
@Override |
|
| 146 | 122 |
public void acquireSemaphore() {
|
| 147 | 123 |
try {
|
| 148 | 124 |
this.mySemaphore.acquire(); |
| ... | ... | |
| 151 | 127 |
} |
| 152 | 128 |
} |
| 153 | 129 |
|
| 154 |
@Override |
|
| 155 | 130 |
public boolean tryAcquireSemaphore() {
|
| 156 | 131 |
return this.mySemaphore.tryAcquire(); |
| 157 | 132 |
} |
| 158 | 133 |
|
| 159 |
@Override |
|
| 160 | 134 |
public void releaseSemaphore() {
|
| 161 | 135 |
this.mySemaphore.release(); |
| 162 | 136 |
if (isCanceled()) {
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/annotation/SaveAnnotations.java (revision 490) | ||
|---|---|---|
| 13 | 13 |
import org.eclipse.swt.widgets.MessageBox; |
| 14 | 14 |
import org.eclipse.ui.handlers.HandlerUtil; |
| 15 | 15 |
import org.txm.annotation.AnnotationManager; |
| 16 |
import org.txm.annotation.KRAnnotationEngine; |
|
| 16 | 17 |
import org.txm.rcp.Messages; |
| 17 | 18 |
import org.txm.rcp.commands.CloseEditorsUsing; |
| 18 | 19 |
import org.txm.rcp.commands.workspace.UpdateCorpus; |
| ... | ... | |
| 42 | 43 |
} |
| 43 | 44 |
|
| 44 | 45 |
public static JobHandler save(final MainCorpus corpus) {
|
| 45 |
final AnnotationManager am = corpus.getAnnotationManager();
|
|
| 46 |
final AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
|
|
| 46 | 47 |
if (am == null) return null; // nothing to do |
| 47 | 48 |
|
| 48 |
if (!corpus.needToSaveAnnotations()) {
|
|
| 49 |
if (!KRAnnotationEngine.needToSaveAnnotations(corpus)) {
|
|
| 49 | 50 |
return null; |
| 50 | 51 |
} |
| 51 | 52 |
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/annotation/InitializeKnowledgeRepository.java (revision 490) | ||
|---|---|---|
| 10 | 10 |
import org.eclipse.jface.viewers.IStructuredSelection; |
| 11 | 11 |
import org.eclipse.swt.widgets.Display; |
| 12 | 12 |
import org.eclipse.ui.handlers.HandlerUtil; |
| 13 |
import org.txm.annotation.KRAnnotationEngine; |
|
| 13 | 14 |
import org.txm.annotation.repository.KnowledgeRepository; |
| 14 | 15 |
import org.txm.annotation.repository.KnowledgeRepositoryManager; |
| 15 | 16 |
import org.txm.rcp.swt.dialog.UsernamePasswordDialog; |
| ... | ... | |
| 43 | 44 |
public static List<KnowledgeRepository> get(MainCorpus corpus) {
|
| 44 | 45 |
List<KnowledgeRepository> ret = new ArrayList<KnowledgeRepository>(); |
| 45 | 46 |
|
| 46 |
for (String kr_name : corpus.getKnowledgeRepositoryNames()) {
|
|
| 47 |
KnowledgeRepository kr = corpus.getKnowledgeRepository(kr_name);
|
|
| 47 |
for (String kr_name : KRAnnotationEngine.getKnowledgeRepositoryNames(corpus)) {
|
|
| 48 |
KnowledgeRepository kr = KRAnnotationEngine.getKnowledgeRepository(corpus, kr_name);
|
|
| 48 | 49 |
if (kr == null) {
|
| 49 | 50 |
System.out.println("Warning '"+kr_name+"' KR is null. Please check KR configuration.");
|
| 50 | 51 |
continue; |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/annotation/ExportStandoff.java (revision 490) | ||
|---|---|---|
| 43 | 43 |
import org.eclipse.ui.handlers.HandlerUtil; |
| 44 | 44 |
import org.txm.Toolbox; |
| 45 | 45 |
import org.txm.annotation.AnnotationManager; |
| 46 |
import org.txm.annotation.KRAnnotationEngine; |
|
| 46 | 47 |
import org.txm.core.preferences.TBXPreferences; |
| 47 | 48 |
import org.txm.rcp.Messages; |
| 48 | 49 |
import org.txm.rcp.StatusLine; |
| ... | ... | |
| 98 | 99 |
} |
| 99 | 100 |
|
| 100 | 101 |
public static boolean exportAnnotations(final MainCorpus corpus, final File resultZipFile) {
|
| 101 |
final AnnotationManager am = corpus.getAnnotationManager();
|
|
| 102 |
final AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
|
|
| 102 | 103 |
if (am == null) return true; // nothing to do |
| 103 | 104 |
|
| 104 | 105 |
JobHandler saveJob = SaveAnnotations.save(corpus); |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/AnnotationSection.java (revision 490) | ||
|---|---|---|
| 12 | 12 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
| 13 | 13 |
import org.eclipse.ui.forms.widgets.TableWrapData; |
| 14 | 14 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
| 15 |
import org.txm.annotation.KRAnnotationEngine; |
|
| 15 | 16 |
import org.txm.objects.BaseParameters; |
| 16 | 17 |
|
| 17 | 18 |
public class AnnotationSection extends ImportEditorSection {
|
| ... | ... | |
| 54 | 55 |
public void update(BaseParameters params) {
|
| 55 | 56 |
if (this.section.isDisposed()) return; |
| 56 | 57 |
if (params == null) return; |
| 57 |
List<String> values = params.getKnowledgeRepositoryNames();
|
|
| 58 |
List<String> values = KRAnnotationEngine.getKnowledgeRepositoryNames(params);
|
|
| 58 | 59 |
|
| 59 | 60 |
String value = params.getCorpusName()+DEFAULTNAMESUFFIX; |
| 60 | 61 |
if (values.size() > 0) {
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/tests/AnnotationLookUp.java (revision 490) | ||
|---|---|---|
| 9 | 9 |
import org.txm.annotation.Annotation; |
| 10 | 10 |
import org.txm.annotation.AnnotationManager; |
| 11 | 11 |
import org.txm.annotation.CQPAnnotationManager; |
| 12 |
import org.txm.annotation.KRAnnotationEngine; |
|
| 12 | 13 |
import org.txm.annotation.repository.AnnotationType; |
| 13 | 14 |
import org.txm.annotation.repository.KnowledgeRepository; |
| 14 | 15 |
import org.txm.annotation.repository.KnowledgeRepositoryManager; |
| ... | ... | |
| 392 | 393 |
if (c == null) return; |
| 393 | 394 |
InitializeKnowledgeRepository.get(c); |
| 394 | 395 |
KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository("localkrfortesting", c);
|
| 395 |
AnnotationManager am = c.getAnnotationManager();
|
|
| 396 |
AnnotationManager am = KRAnnotationEngine.getAnnotationManager(c);
|
|
| 396 | 397 |
|
| 397 | 398 |
for (String test : args) {
|
| 398 | 399 |
System.out.println("******************** *** ********************");
|
| tmp/org.txm.core/src/java/org/txm/functions/TXMCommand.java (revision 490) | ||
|---|---|---|
| 29 | 29 |
|
| 30 | 30 |
import java.io.File; |
| 31 | 31 |
import java.io.IOException; |
| 32 |
import java.util.concurrent.Semaphore; |
|
| 32 | 33 |
|
| 34 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
| 33 | 35 |
import org.txm.core.results.TXMParameters; |
| 34 | 36 |
import org.txm.core.results.TXMResult; |
| 37 |
import org.txm.utils.logger.Log; |
|
| 35 | 38 |
|
| 36 | 39 |
/** |
| 37 | 40 |
* |
| ... | ... | |
| 50 | 53 |
/** |
| 51 | 54 |
* |
| 52 | 55 |
*/ |
| 53 |
protected ProgressWatcher monitor; |
|
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 56 |
protected IProgressMonitor monitor; |
|
| 57 |
|
|
| 57 | 58 |
public TXMCommand() {
|
| 58 | 59 |
super(); |
| 59 | 60 |
// TODO Auto-generated constructor stub |
| 60 | 61 |
} |
| 61 | 62 |
|
| 62 |
public TXMCommand(TXMResult parent, TXMParameters parameters) {
|
|
| 63 |
super(parent, parameters);
|
|
| 63 |
public TXMCommand(TXMResult parent) {
|
|
| 64 |
super(parent); |
|
| 64 | 65 |
// TODO Auto-generated constructor stub |
| 65 | 66 |
} |
| 66 | 67 |
|
| 67 |
public TXMCommand(TXMResult parent) {
|
|
| 68 |
super(parent); |
|
| 68 |
public TXMCommand(TXMResult parent, TXMParameters parameters) {
|
|
| 69 |
super(parent, parameters);
|
|
| 69 | 70 |
// TODO Auto-generated constructor stub |
| 70 | 71 |
} |
| 71 | 72 |
|
| 72 |
|
|
| 73 |
/** |
|
| 74 |
* You must set the current monitor to be available to manage the process progress |
|
| 75 |
* @param monitor |
|
| 76 |
*/ |
|
| 77 |
public void setCurrentMonitor(ProgressWatcher monitor) {
|
|
| 78 |
this.monitor = monitor; |
|
| 79 |
} |
|
| 80 |
|
|
| 81 |
/** |
|
| 82 |
* increment the process |
|
| 83 |
* @param amount of work |
|
| 84 |
*/ |
|
| 85 |
public void worked(int amount) {
|
|
| 86 |
if (monitor != null) {
|
|
| 87 |
//System.out.println("worked "+amount);
|
|
| 88 |
monitor.worked(amount); |
|
| 73 |
Semaphore progressSemaphore = new Semaphore(1); |
|
| 74 |
public void acquireSemaphore() {
|
|
| 75 |
try {
|
|
| 76 |
this.progressSemaphore.acquire(); |
|
| 77 |
} catch (InterruptedException e) {
|
|
| 78 |
Log.printStackTrace(e); |
|
| 89 | 79 |
} |
| 90 | 80 |
} |
| 91 | 81 |
|
| 92 | 82 |
/** |
| 93 |
* increment the progress and show a message |
|
| 94 |
* @param amount |
|
| 95 |
* @param message |
|
| 83 |
* Computes the result according to specified command parameters. |
|
| 84 |
* |
|
| 85 |
* @param parameters |
|
| 86 |
* @return |
|
| 96 | 87 |
*/ |
| 97 |
public void worked(int amount, String message) {
|
|
| 98 |
if (monitor != null) {
|
|
| 99 |
monitor.worked(amount, message); |
|
| 100 |
} |
|
| 88 |
public boolean compute() throws Exception {
|
|
| 89 |
return this.compute(null); |
|
| 101 | 90 |
} |
| 102 | 91 |
|
| 103 | 92 |
/** |
| 104 |
* show a message in progress |
|
| 105 |
* @param message |
|
| 93 |
* Computes the result according to stored command parameters. |
|
| 94 |
* |
|
| 95 |
* @param watcher |
|
| 96 |
* @return |
|
| 97 |
* @throws InvalidCqpIdException |
|
| 98 |
* @throws CqiServerError |
|
| 99 |
* @throws CqiClientException |
|
| 100 |
* @throws IOException |
|
| 106 | 101 |
*/ |
| 107 |
public void setMessage(String message) {
|
|
| 108 |
if (monitor != null) |
|
| 109 |
monitor.setMessage(message); |
|
| 110 |
} |
|
| 102 |
public abstract boolean compute(IProgressMonitor watcher) throws Exception; |
|
| 111 | 103 |
|
| 112 | 104 |
/** |
| 113 |
* |
|
| 114 |
* @return true if the monitor has been canceled by the user |
|
| 105 |
* Computes the result according to specified command parameters. |
|
| 106 |
* @param watcher |
|
| 107 |
* @param parameters |
|
| 108 |
* @return |
|
| 115 | 109 |
*/ |
| 116 |
public boolean isCanceled() {
|
|
| 117 |
if (monitor != null) {
|
|
| 118 |
return monitor.isCanceled(); |
|
| 119 |
} |
|
| 120 |
return false; |
|
| 110 |
public boolean compute(IProgressMonitor watcher, TXMParameters parameters) throws Exception {
|
|
| 111 |
this.parameters = parameters; |
|
| 112 |
return this.compute(watcher); |
|
| 121 | 113 |
} |
| 122 | 114 |
|
| 123 | 115 |
public void done() {
|
| ... | ... | |
| 126 | 118 |
} |
| 127 | 119 |
} |
| 128 | 120 |
|
| 129 |
public void acquireSemaphore() {
|
|
| 130 |
if (monitor != null) |
|
| 131 |
monitor.acquireSemaphore(); |
|
| 132 |
} |
|
| 133 |
|
|
| 134 |
public boolean tryAcquireSemaphore() {
|
|
| 135 |
if (monitor != null) |
|
| 136 |
return monitor.tryAcquireSemaphore(); |
|
| 137 |
else |
|
| 138 |
return false; |
|
| 139 |
} |
|
| 140 |
|
|
| 141 |
public void releaseSemaphore() {
|
|
| 142 |
if (monitor != null) |
|
| 143 |
monitor.releaseSemaphore(); |
|
| 144 |
} |
|
| 145 |
|
|
| 146 |
//public abstract boolean toTxt(File file, String encoding) throws Exception; |
|
| 147 |
@Deprecated |
|
| 148 |
//FIXME: should be moved in an exporter extension |
|
| 149 |
public abstract boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception; |
|
| 150 |
|
|
| 151 |
|
|
| 152 |
|
|
| 153 |
|
|
| 154 |
|
|
| 155 | 121 |
/** |
| 156 | 122 |
* |
| 157 | 123 |
* @return the array of extensions to show in the FileDialog SWT widget |
| ... | ... | |
| 164 | 130 |
|
| 165 | 131 |
/** |
| 166 | 132 |
* |
| 133 |
* @return true if the monitor has been canceled by the user |
|
| 134 |
*/ |
|
| 135 |
public boolean isCanceled() {
|
|
| 136 |
if (monitor != null) {
|
|
| 137 |
return monitor.isCanceled(); |
|
| 138 |
} |
|
| 139 |
return false; |
|
| 140 |
} |
|
| 141 |
|
|
| 142 |
/** |
|
| 143 |
* |
|
| 167 | 144 |
* @return the parent Object that contains this result |
| 168 | 145 |
*/ |
| 169 | 146 |
@Deprecated |
| ... | ... | |
| 179 | 156 |
return false; |
| 180 | 157 |
} |
| 181 | 158 |
|
| 159 |
public boolean tryAcquireSemaphore() {
|
|
| 160 |
return this.progressSemaphore.tryAcquire(); |
|
| 161 |
} |
|
| 162 |
|
|
| 163 |
public void releaseSemaphore() {
|
|
| 164 |
this.progressSemaphore.release(); |
|
| 165 |
} |
|
| 166 |
|
|
| 182 | 167 |
|
| 183 | 168 |
/** |
| 184 |
* Computes the result according to specified command parameters. |
|
| 185 |
* @param parameters |
|
| 186 |
* @return |
|
| 169 |
* You must set the current monitor to be available to manage the process progress |
|
| 170 |
* @param monitor |
|
| 187 | 171 |
*/ |
| 188 |
public boolean compute() throws Exception {
|
|
| 189 |
return this.compute(null);
|
|
| 172 |
public void setCurrentMonitor(IProgressMonitor monitor) {
|
|
| 173 |
this.monitor = monitor;
|
|
| 190 | 174 |
} |
| 191 | 175 |
|
| 176 |
|
|
| 177 |
|
|
| 192 | 178 |
|
| 179 |
|
|
| 193 | 180 |
/** |
| 194 |
* Computes the result according to stored command parameters. |
|
| 195 |
* @param watcher |
|
| 196 |
* @return |
|
| 197 |
* @throws InvalidCqpIdException |
|
| 198 |
* @throws CqiServerError |
|
| 199 |
* @throws CqiClientException |
|
| 200 |
* @throws IOException |
|
| 181 |
* show a message in progress |
|
| 182 |
* @param message |
|
| 201 | 183 |
*/ |
| 202 |
public abstract boolean compute(ProgressWatcher watcher) throws Exception; |
|
| 184 |
public void setMessage(String message) {
|
|
| 185 |
if (monitor != null) |
|
| 186 |
monitor.subTask(message); |
|
| 187 |
} |
|
| 203 | 188 |
|
| 189 |
//public abstract boolean toTxt(File file, String encoding) throws Exception; |
|
| 190 |
@Deprecated |
|
| 191 |
//FIXME: should be moved in an exporter extension |
|
| 192 |
public abstract boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception; |
|
| 193 |
|
|
| 194 |
/** |
|
| 195 |
* increment the process |
|
| 196 |
* @param amount of work |
|
| 197 |
*/ |
|
| 198 |
public void worked(int amount) {
|
|
| 199 |
if (monitor != null) {
|
|
| 200 |
//System.out.println("worked "+amount);
|
|
| 201 |
monitor.worked(amount); |
|
| 202 |
} |
|
| 203 |
} |
|
| 204 |
|
|
| 204 | 205 |
|
| 205 | 206 |
/** |
| 206 |
* Computes the result according to specified command parameters.
|
|
| 207 |
* @param watcher
|
|
| 208 |
* @param parameters
|
|
| 209 |
* @return
|
|
| 207 |
* increment the progress and show a message
|
|
| 208 |
* |
|
| 209 |
* @param amount
|
|
| 210 |
* @param message
|
|
| 210 | 211 |
*/ |
| 211 |
public boolean compute(ProgressWatcher watcher, TXMParameters parameters) throws Exception {
|
|
| 212 |
this.parameters = parameters; |
|
| 213 |
return this.compute(watcher); |
|
| 212 |
public void worked(int amount, String message) {
|
|
| 213 |
if (monitor != null) {
|
|
| 214 |
monitor.worked(amount); |
|
| 215 |
monitor.subTask(message); |
|
| 216 |
} |
|
| 214 | 217 |
} |
| 215 | 218 |
|
| 216 | 219 |
|
| tmp/org.txm.core/src/java/org/txm/stat/utils/ConsoleProgressBar.java (revision 490) | ||
|---|---|---|
| 1 | 1 |
package org.txm.stat.utils; |
| 2 |
import org.txm.functions.ProgressWatcher;
|
|
| 2 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 3 | 3 |
|
| 4 |
public class ConsoleProgressBar implements ProgressWatcher {
|
|
| 4 |
public class ConsoleProgressBar implements IProgressMonitor {
|
|
| 5 | 5 |
static int LINE_PROGRESS = 10; // number of tick to draw a line |
| 6 | 6 |
static int TOTAL_PROGRESS = 100; |
| 7 | 7 |
|
| ... | ... | |
| 53 | 53 |
} |
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 |
@Override |
|
| 57 | 56 |
public void worked(int amount, String message) {
|
| 58 | 57 |
this.tick(); |
| 59 | 58 |
System.out.println(message); |
| 60 | 59 |
|
| 61 | 60 |
} |
| 62 | 61 |
|
| 63 |
@Override |
|
| 64 | 62 |
public void setMessage(String message) {
|
| 65 | 63 |
System.out.println(message); |
| 66 | 64 |
} |
| ... | ... | |
| 81 | 79 |
for (int i = 0 ; i < step ; i++) tick(); |
| 82 | 80 |
} |
| 83 | 81 |
|
| 84 |
@Override |
|
| 85 | 82 |
public void worked() {
|
| 86 | 83 |
tick(); |
| 87 | 84 |
} |
| 88 | 85 |
|
| 89 |
@Override |
|
| 90 | 86 |
public void acquireSemaphore() {
|
| 91 | 87 |
|
| 92 | 88 |
} |
| 93 | 89 |
|
| 94 |
@Override |
|
| 95 | 90 |
public boolean tryAcquireSemaphore() {
|
| 96 | 91 |
return false; |
| 97 | 92 |
} |
| 98 | 93 |
|
| 99 |
@Override |
|
| 100 | 94 |
public void releaseSemaphore() { }
|
| 101 | 95 |
|
| 102 | 96 |
@Override |
| 103 |
public void beginTask(String name, long l) {
|
|
| 97 |
public void beginTask(String name, int l) {
|
|
| 104 | 98 |
System.out.println("Begining "+name);
|
| 105 | 99 |
this.start(l); |
| 106 | 100 |
} |
| ... | ... | |
| 110 | 104 |
// FIXME: not yet implemented |
| 111 | 105 |
System.err.println("ConsoleProgressBar.subTask(): not yet implemented.");
|
| 112 | 106 |
} |
| 107 |
|
|
| 108 |
@Override |
|
| 109 |
public void internalWorked(double work) {
|
|
| 110 |
// TODO Auto-generated method stub |
|
| 111 |
|
|
| 112 |
} |
|
| 113 |
|
|
| 114 |
@Override |
|
| 115 |
public void setCanceled(boolean value) {
|
|
| 116 |
if (value) done(); |
|
| 117 |
} |
|
| 118 |
|
|
| 119 |
@Override |
|
| 120 |
public void setTaskName(String name) {
|
|
| 121 |
// nothing to show |
|
| 122 |
} |
|
| 113 | 123 |
} |
| tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 490) | ||
|---|---|---|
| 3 | 3 |
*/ |
| 4 | 4 |
package org.txm.core.results; |
| 5 | 5 |
|
| 6 |
import java.text.DateFormat; |
|
| 7 |
import java.text.SimpleDateFormat; |
|
| 6 | 8 |
import java.util.ArrayList; |
| 9 |
import java.util.Date; |
|
| 7 | 10 |
import java.util.UUID; |
| 8 | 11 |
|
| 9 | 12 |
import org.osgi.framework.FrameworkUtil; |
| ... | ... | |
| 22 | 25 |
public abstract class TXMResult implements Cloneable {
|
| 23 | 26 |
|
| 24 | 27 |
/** |
| 25 |
* Unique ID of the object.
|
|
| 28 |
* Unique ID of the object built with : class + date + number
|
|
| 26 | 29 |
*/ |
| 27 | 30 |
protected String uniqueID; |
| 28 |
|
|
| 31 |
public static final DateFormat ID_TIME_FORMAT = new SimpleDateFormat("YYYYMMDD");
|
|
| 29 | 32 |
/** |
| 30 | 33 |
* The weight, essentially used for sorting purpose. |
| 31 | 34 |
*/ |
| ... | ... | |
| 80 | 83 |
public TXMResult(TXMResult parent, TXMParameters parameters) {
|
| 81 | 84 |
|
| 82 | 85 |
// FIXME: discuss about this method and validate it. Also discuss about a getInternalName() method that should also return an unique ID. |
| 83 |
this.uniqueID = this.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(this)) + "_" + UUID.randomUUID(); |
|
| 84 | 86 |
|
| 87 |
this.uniqueID = this.getClass().getName() + '@' + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID(); |
|
| 88 |
|
|
| 85 | 89 |
this.weight = 0; |
| 86 | 90 |
this.visible = true; |
| 87 | 91 |
if(parent != null) {
|
| ... | ... | |
| 161 | 165 |
return TXMPreferences.getString(key, this.parameters, this, this.preferencesNodeQualifier); |
| 162 | 166 |
} |
| 163 | 167 |
|
| 168 |
public void saveParameters() {
|
|
| 169 |
TXMPreferences.putLocalParameters(this, this.parameters); |
|
| 170 |
} |
|
| 171 |
|
|
| 164 | 172 |
/** |
| 165 | 173 |
* Deletes the object from its parent, also deletes the children. |
| 166 | 174 |
* The <code>TXMResult.clean()</code> methods of this result and children results are applied before the deletion. |
| ... | ... | |
| 319 | 327 |
synchronized public ArrayList<TXMResult> getResults(Class type, boolean onlyVisible) {
|
| 320 | 328 |
return TXMResult.getNodes(this.children, type, onlyVisible); |
| 321 | 329 |
} |
| 322 |
|
|
| 323 | 330 |
|
| 324 | 331 |
/** |
| 325 | 332 |
* Gets the children of all the branch in a flat list. |
| 333 |
* |
|
| 326 | 334 |
* @return |
| 327 | 335 |
*/ |
| 328 | 336 |
synchronized protected ArrayList<TXMResult> getDeepResults(TXMResult parent, ArrayList<TXMResult> results) {
|
| tmp/org.txm.core/src/java/org/txm/objects/BaseParameters.java (revision 490) | ||
|---|---|---|
| 17 | 17 |
|
| 18 | 18 |
import javax.xml.parsers.ParserConfigurationException; |
| 19 | 19 |
|
| 20 |
import org.txm.annotation.repository.SQLKnowledgeRepository; |
|
| 21 |
import org.txm.sql.SQLConnection; |
|
| 22 | 20 |
import org.txm.utils.xml.DomUtils; |
| 23 | 21 |
import org.txm.utils.logger.Log; |
| 24 | 22 |
import org.w3c.dom.Document; |
| ... | ... | |
| 374 | 372 |
return text; |
| 375 | 373 |
} |
| 376 | 374 |
|
| 377 |
public Element getKnowledgeRepositoriesElement(Element corpusElement) {
|
|
| 378 |
NodeList textsList = corpusElement.getElementsByTagName("knowledgeRepositories");
|
|
| 379 |
if (textsList.getLength() == 0) {
|
|
| 380 |
Element knowledgeRepositories = corpusElement.getOwnerDocument().createElement("knowledgeRepositories");
|
|
| 381 |
corpusElement.appendChild(knowledgeRepositories); |
|
| 382 |
return knowledgeRepositories; |
|
| 383 |
} else {
|
|
| 384 |
return (Element) textsList.item(0); |
|
| 385 |
} |
|
| 386 |
} |
|
| 387 | 375 |
|
| 388 |
public Element getKnowledgeRepositoryElement(String name) {
|
|
| 389 |
Element rElement = getKnowledgeRepositoriesElement(this.getCorpusElement()); |
|
| 390 |
NodeList repositoriesList = rElement.getElementsByTagName("repository");
|
|
| 391 |
for (int i = 0 ; i < repositoriesList.getLength() ; i++) {
|
|
| 392 |
Element e = ((Element)repositoriesList.item(i)); |
|
| 393 |
if (name.equals(e.getAttribute("name"))) {
|
|
| 394 |
return e; |
|
| 395 |
} |
|
| 396 |
} |
|
| 397 |
|
|
| 398 |
return null; |
|
| 399 |
} |
|
| 400 |
|
|
| 401 |
public Element createKnowledgeRepositoryElement(String name) {
|
|
| 402 |
Element rElement = getKnowledgeRepositoriesElement(this.getCorpusElement()); |
|
| 403 |
Element e = rElement.getOwnerDocument().createElement("repository");
|
|
| 404 |
e.setAttribute("name", name);
|
|
| 405 |
e.setAttribute("mode", "file");
|
|
| 406 |
e.setAttribute("user", "false");
|
|
| 407 |
e.setAttribute("password", "false");
|
|
| 408 |
e.setAttribute("version", "0");
|
|
| 409 |
|
|
| 410 |
rElement.appendChild(e); |
|
| 411 |
return e; |
|
| 412 |
} |
|
| 413 |
|
|
| 414 |
/** |
|
| 415 |
* Utility method to get a knowledge repository configuration |
|
| 416 |
* |
|
| 417 |
* @param name the repository name |
|
| 418 |
* @return |
|
| 419 |
*/ |
|
| 420 |
public List<String> getKnowledgeRepositoryNames() {
|
|
| 421 |
ArrayList<String> names = new ArrayList<String>(); |
|
| 422 |
Element corpusElement = getCorpusElement(); |
|
| 423 |
if (corpusElement == null) return names; |
|
| 424 |
|
|
| 425 |
Element rElement = getKnowledgeRepositoriesElement(corpusElement); |
|
| 426 |
if (rElement == null) return names; |
|
| 427 |
|
|
| 428 |
NodeList repositoriesList = rElement.getElementsByTagName("repository");
|
|
| 429 |
for (int i = 0 ; i < repositoriesList.getLength() ; i++) {
|
|
| 430 |
names.add(((Element)repositoriesList.item(i)).getAttribute("name"));
|
|
| 431 |
} |
|
| 432 |
return names; |
|
| 433 |
} |
|
| 434 |
|
|
| 435 |
public static String KNOWLEDGE_ACCESS = "access"; |
|
| 436 |
public static String KNOWLEDGE_TYPEQUERIES = "queries"; |
|
| 437 |
public static String KNOWLEDGE_TYPES = "fields"; |
|
| 438 |
public static String KNOWLEDGE_STRINGS = "strings"; |
|
| 439 |
public static String KNOWLEDGE_TYPEWEBACCESS = "typeaccess"; |
|
| 440 |
|
|
| 441 |
/** |
|
| 442 |
* Utility method to get a knowledge repository configuration |
|
| 443 |
* |
|
| 444 |
* @param name the repository name |
|
| 445 |
* @return |
|
| 446 |
*/ |
|
| 447 |
public static HashMap<String, HashMap<String, ?>> getKnowledgeRepositoryConfiguration(String name, Element e) {
|
|
| 448 |
HashMap<String, HashMap<String, ?>> repConfiguration = new HashMap<String, HashMap<String, ?>>(); |
|
| 449 |
|
|
| 450 |
HashMap<String, String> access = new HashMap<String, String>(); |
|
| 451 |
HashMap<String, HashMap<String, String>> strings = new HashMap<String, HashMap<String, String>>(); |
|
| 452 |
HashMap<String, HashMap<String, String>> fields = new HashMap<String, HashMap<String, String>>(); |
|
| 453 |
|
|
| 454 |
if (e == null) return null; |
|
| 455 |
|
|
| 456 |
access.put(SQLKnowledgeRepository.NAME, e.getAttribute(SQLKnowledgeRepository.NAME)); |
|
| 457 |
access.put("version", e.getAttribute("version"));
|
|
| 458 |
access.put("mode", e.getAttribute("mode"));
|
|
| 459 |
access.put(SQLKnowledgeRepository.TYPE_URL, e.getAttribute(SQLKnowledgeRepository.TYPE_URL)); |
|
| 460 |
access.put(SQLKnowledgeRepository.TYPE_RESURL, e.getAttribute(SQLKnowledgeRepository.TYPE_RESURL)); |
|
| 461 |
access.put(SQLKnowledgeRepository.TYPE_TYPEURL, e.getAttribute(SQLKnowledgeRepository.TYPE_TYPEURL)); |
|
| 462 |
access.put(SQLConnection.SQL_ADDRESS, e.getAttribute(SQLConnection.SQL_ADDRESS)); |
|
| 463 |
access.put(SQLConnection.SQL_DRIVER, e.getAttribute(SQLConnection.SQL_DRIVER)); |
|
| 464 |
access.put(SQLConnection.SQL_PORT, e.getAttribute(SQLConnection.SQL_PORT)); |
|
| 465 |
access.put(SQLConnection.SQL_USER, e.getAttribute(SQLConnection.SQL_USER)); |
|
| 466 |
access.put(SQLConnection.SQL_PASSWORD, e.getAttribute(SQLConnection.SQL_PASSWORD)); |
|
| 467 |
|
|
| 468 |
//<type id="" name> ... </type> |
|
| 469 |
NodeList typesList = e.getElementsByTagName("type");
|
|
| 470 |
for (int i = 0 ; i < typesList.getLength() ; i++) {
|
|
| 471 |
//<field type="xxx">yyy</field> |
|
| 472 |
Element typeElement = (Element)typesList.item(i); |
|
| 473 |
String type_id = ""+typeElement.getAttribute(SQLKnowledgeRepository.TYPE_ID); |
|
| 474 |
|
|
| 475 |
String type_name = typeElement.getAttribute(SQLKnowledgeRepository.NAME); |
|
| 476 |
if (type_name == null || type_name.length() == 0) type_name = type_id; |
|
| 477 |
|
|
| 478 |
String type_url = ""+typeElement.getAttribute(SQLKnowledgeRepository.TYPE_URL); |
|
| 479 |
|
|
| 480 |
String type_size = typeElement.getAttribute(SQLKnowledgeRepository.TYPE_SIZE); |
|
| 481 |
if (type_size == null || type_size.length() == 0) type_size = "SMALL"; // show all by default |
|
| 482 |
type_size = type_size.toUpperCase(); |
|
| 483 |
|
|
| 484 |
String type_effect = typeElement.getAttribute(SQLKnowledgeRepository.TYPE_EFFECT); |
|
| 485 |
if (type_effect == null || type_effect.length() == 0) type_effect = "SEGMENT"; // segment annotation by default |
|
| 486 |
type_effect = type_effect.toUpperCase(); |
|
| 487 |
|
|
| 488 |
HashMap<String, String> hashFields = new HashMap<String, String>(); |
|
| 489 |
NodeList fieldsList = typeElement.getElementsByTagName("field"); // contains KR type specific properties
|
|
| 490 |
for (int j = 0 ; j < fieldsList.getLength() ; j++) {
|
|
| 491 |
Element fieldElement = (Element)fieldsList.item(j); |
|
| 492 |
hashFields.put(fieldElement.getAttribute("type"), fieldElement.getTextContent());
|
|
| 493 |
} |
|
| 494 |
|
|
| 495 |
hashFields.put(SQLKnowledgeRepository.TYPE_URL, type_url); |
|
| 496 |
hashFields.put(SQLKnowledgeRepository.NAME, type_name); |
|
| 497 |
hashFields.put(SQLKnowledgeRepository.TYPE_SIZE, type_size); |
|
| 498 |
hashFields.put(SQLKnowledgeRepository.TYPE_EFFECT, type_effect); |
|
| 499 |
fields.put(type_id, hashFields); |
|
| 500 |
} |
|
| 501 |
|
|
| 502 |
NodeList stringsList = e.getElementsByTagName("strings");
|
|
| 503 |
for (int i = 0 ; i < stringsList.getLength() ; i++) {
|
|
| 504 |
Element stringsElement = (Element)stringsList.item(i); |
|
| 505 |
String lang = stringsElement.getAttribute("lang");
|
|
| 506 |
if (lang == null) lang = "en"; // default lang is "en" |
|
| 507 |
|
|
| 508 |
HashMap<String, String> values = new HashMap<String, String>(); |
|
| 509 |
strings.put(lang, values); |
|
| 510 |
|
|
| 511 |
NodeList stringList = stringsElement.getElementsByTagName("string");
|
|
| 512 |
for (int j = 0 ; j < stringList.getLength() ; j++) {
|
|
| 513 |
Element stringElement = (Element)stringList.item(j); |
|
| 514 |
String key = stringElement.getAttribute("key");
|
|
| 515 |
if (key != null) {
|
|
| 516 |
values.put(key, stringElement.getTextContent()); |
|
| 517 |
} |
|
| 518 |
} |
|
| 519 |
} |
|
| 520 |
|
|
| 521 |
repConfiguration.put(KNOWLEDGE_ACCESS, access); |
|
| 522 |
repConfiguration.put(KNOWLEDGE_TYPES, fields); |
|
| 523 |
repConfiguration.put(KNOWLEDGE_STRINGS, strings); |
|
| 524 |
|
|
| 525 |
return repConfiguration; |
|
| 526 |
} |
|
| 527 |
|
|
| 528 | 376 |
public Element getTextsElement(Element corpusElement) {
|
| 529 | 377 |
NodeList textsList = corpusElement.getElementsByTagName("texts");
|
| 530 | 378 |
if(textsList.getLength() == 0) {
|
| tmp/org.txm.core/src/java/org/txm/objects/Base.java (revision 490) | ||
|---|---|---|
| 48 | 48 |
|
| 49 | 49 |
import org.txm.Toolbox; |
| 50 | 50 |
import org.txm.core.messages.TXMCoreMessages; |
| 51 |
import org.txm.functions.ProgressWatcher;
|
|
| 51 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 52 | 52 |
import org.txm.utils.logger.Log; |
| 53 | 53 |
import org.txm.utils.zip.Zip; |
| 54 | 54 |
import org.w3c.dom.Document; |
| ... | ... | |
| 272 | 272 |
* @param exportzip the exportzip |
| 273 | 273 |
* @return true, if successful |
| 274 | 274 |
*/ |
| 275 |
public boolean export(File exportzip, ProgressWatcher monitor) {
|
|
| 275 |
public boolean export(File exportzip, IProgressMonitor monitor) {
|
|
| 276 | 276 |
File binarydir = this.params.paramFile.getParentFile(); |
| 277 | 277 |
|
| 278 | 278 |
if (binarydir.exists() && exportzip.getParentFile().exists()) {
|
| tmp/org.txm.core/src/java/org/txm/objects/Corpus.java (revision 490) | ||
|---|---|---|
| 36 | 36 |
import java.util.HashMap; |
| 37 | 37 |
import java.util.List; |
| 38 | 38 |
|
| 39 |
import javax.persistence.EntityManager; |
|
| 40 |
|
|
| 39 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
| 41 | 40 |
import org.txm.Toolbox; |
| 42 |
import org.txm.annotation.AnnotationManager; |
|
| 43 |
import org.txm.annotation.repository.KnowledgeRepository; |
|
| 44 |
import org.txm.annotation.repository.KnowledgeRepositoryManager; |
|
| 45 | 41 |
import org.txm.core.messages.TXMCoreMessages; |
| 46 | 42 |
import org.txm.core.preferences.TBXPreferences; |
| 47 |
import org.txm.functions.ProgressWatcher; |
|
| 48 | 43 |
import org.txm.metadatas.DateMetadata; |
| 49 | 44 |
import org.txm.metadatas.Metadata; |
| 50 | 45 |
import org.txm.metadatas.MetadataGroup; |
| ... | ... | |
| 162 | 157 |
protected int conc_left_context = 8; // read only |
| 163 | 158 |
protected int conc_right_context = 12; // read only |
| 164 | 159 |
|
| 165 |
/** The persistence manager for annotations **/ |
|
| 166 |
private EntityManager jpaem; |
|
| 167 | 160 |
|
| 168 | 161 |
/** |
| 169 | 162 |
* Gets the text. |
| ... | ... | |
| 533 | 526 |
* @param exportzip the exportzip |
| 534 | 527 |
* @return true, if successful |
| 535 | 528 |
*/ |
| 536 |
public boolean export(File exportzip, ProgressWatcher monitor) {
|
|
| 529 |
public boolean export(File exportzip, IProgressMonitor monitor) {
|
|
| 537 | 530 |
File binarydir = this.getBaseDirectory(); |
| 538 | 531 |
if (binarydir.exists() && exportzip.getParentFile().exists()) {
|
| 539 | 532 |
try {
|
| ... | ... | |
| 1094 | 1087 |
public void setDefaultViewProperty(String defaultViewProperty) {
|
| 1095 | 1088 |
this.defaultViewProperty = defaultViewProperty; |
| 1096 | 1089 |
} |
| 1097 |
|
|
| 1098 |
public abstract boolean canBeAnnotated(); |
|
| 1099 |
public abstract KnowledgeRepository getKnowledgeRepository(String name); |
|
| 1100 |
public abstract List<String> getKnowledgeRepositoryNames(); |
|
| 1101 |
public abstract AnnotationManager getAnnotationManager(); |
|
| 1102 |
|
|
| 1103 |
@SuppressWarnings("unchecked")
|
|
| 1104 |
public boolean[] mustLoginToKnowledgeRepository(String kr_name) {
|
|
| 1105 |
return KnowledgeRepositoryManager.mustLoginToKnowledgeRepository(kr_name, this); |
|
| 1106 |
} |
|
| 1107 |
|
|
| 1108 | 1090 |
} |
| tmp/org.txm.core/META-INF/persistence.xml (revision 490) | ||
|---|---|---|
| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
| 2 |
<persistence version="2.0" |
|
| 3 |
xmlns="http://java.sun.com/xml/ns/persistence" |
|
| 4 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> |
|
| 5 |
<persistence-unit name="MyPUWithHSQL" transaction-type="RESOURCE_LOCAL"> |
|
| 6 |
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> |
|
| 7 |
|
|
| 8 |
<class>org.txm.annotation.Annotation</class> |
|
| 9 |
<class>org.txm.annotation.repository.AnnotationType</class> |
|
| 10 |
<class>org.txm.annotation.repository.TypedValue</class> |
|
| 11 |
<!-- <class>org.txm.functions.dictionary_jpa.EntryId</class> |
|
| 12 |
<class>org.txm.functions.dictionary_jpa.EntryProperty</class> |
|
| 13 |
<class>org.txm.functions.dictionary_jpa.EntryPropertyType</class>--> |
|
| 14 |
<properties> |
|
| 15 |
<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/> |
|
| 16 |
<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:file:txmdb/db;shutdown=true;hsqldb.write_delay=false;hsqldb.lock_file=false;hsqldb.applog=0;hsqldb.sqllog=0"/> |
|
| 17 |
<property name="javax.persistence.jdbc.user" value="SA"/> |
|
| 18 |
|
|
| 19 |
<property name="eclipselink.logging.parameters" value="false"/> |
|
| 20 |
<property name="eclipselink.logging.level" value="OFF" /> |
|
| 21 |
|
|
| 22 |
<!-- <property name="eclipselink.jdbc.read-connections.min" value="1" /> |
|
| 23 |
<property name="eclipselink.jdbc.write-connections.min" value="1" /> |
|
| 24 |
<property name="eclipselink.jdbc.batch-writing" value="JDBC" /> |
|
| 25 |
--> |
|
| 26 |
<!-- Logging |
|
| 27 |
<property name="eclipselink.logging.file" value="output.log"/> |
|
| 28 |
<property name="eclipselink.logging.logger" value="JavaLogger"/> |
|
| 29 |
--> |
|
| 30 |
|
|
| 31 |
<!-- <property name="eclipselink.logging.level" value="FINE" /> |
|
| 32 |
<property name="eclipselink.logging.timestamp" value="false" /> |
|
| 33 |
<property name="eclipselink.logging.session" value="false" /> |
|
| 34 |
<property name="eclipselink.logging.thread" value="false" /> --> |
|
| 35 |
|
|
| 36 |
<!-- <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> --> |
|
| 37 |
<!-- <property name="eclipselink.ddl-generation.output-mode" value="database"/> --> |
|
| 38 |
</properties> |
|
| 39 |
|
|
| 40 |
</persistence-unit> |
|
| 41 |
</persistence> |
|
| tmp/org.txm.core/META-INF/MANIFEST.MF (revision 490) | ||
|---|---|---|
| 4 | 4 |
Bundle-SymbolicName: org.txm.core;singleton:=true |
| 5 | 5 |
Bundle-Version: 0.7.9.qualifier |
| 6 | 6 |
Bundle-Activator: org.txm.toolbox.Activator |
| 7 |
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.10.0",
|
|
| 8 |
javax.persistence;bundle-version="2.1.0",
|
|
| 7 |
Require-Bundle: org.txm.libs.groovy-all;bundle-version="1.0.0";visibility:=reexport,
|
|
| 8 |
org.eclipse.core.runtime;bundle-version="3.10.0";visibility:=reexport,
|
|
| 9 | 9 |
org.txm.utils;bundle-version="1.0.0";visibility:=reexport, |
| 10 |
org.eclipse.osgi.util;bundle-version="3.2.0", |
|
| 11 |
org.eclipse.core.net, |
|
| 12 |
org.eclipse.osgi, |
|
| 13 |
org.txm.libs.groovy-all;bundle-version="1.0.0";visibility:=reexport, |
|
| 14 |
org.txm.statsengine.r.core;bundle-version="1.0.0", |
|
| 15 |
org.txm.annotation.core;bundle-version="1.0.0" |
|
| 10 |
org.eclipse.osgi.util;bundle-version="3.2.0";visibility:=reexport, |
|
| 11 |
org.eclipse.core.net;visibility:=reexport, |
|
| 12 |
org.eclipse.osgi;visibility:=reexport |
|
| 16 | 13 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
| 17 | 14 |
Export-Package: EDU.oswego.cs.dl.util.concurrent, |
| 18 | 15 |
EDU.oswego.cs.dl.util.concurrent.misc, |
| tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/corpusengine/cqp/Lexicon.java (revision 490) | ||
|---|---|---|
| 39 | 39 |
|
| 40 | 40 |
import org.txm.core.messages.TXMCoreMessages; |
| 41 | 41 |
import org.txm.core.results.TXMResult; |
| 42 |
import org.txm.functions.ProgressWatcher;
|
|
| 42 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
| 43 | 43 |
import org.txm.functions.TXMCommand; |
| 44 | 44 |
import org.txm.lexicon.core.messages.LexiconCoreMessages; |
| 45 | 45 |
import org.txm.searchengine.cqp.ICqiClient; |
| ... | ... | |
| 574 | 574 |
} |
Formats disponibles : Unified diff