Révision 100
tmp/org.txm.rcp/.settings/org.eclipse.jdt.core.prefs (revision 100) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
|
3 |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 |
|
4 |
org.eclipse.jdt.core.compiler.compliance=1.6 |
|
5 |
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
|
6 |
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
|
7 |
org.eclipse.jdt.core.compiler.source=1.6 |
|
0 | 8 |
tmp/org.txm.rcp/.settings/org.eclipse.core.runtime.prefs (revision 100) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
line.separator=\n |
|
0 | 3 |
tmp/org.txm.rcp/.settings/org.eclipse.pde.core.prefs (revision 100) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
resolve.requirebundle=false |
|
0 | 3 |
tmp/org.txm.rcp/.settings/org.eclipse.core.resources.prefs (revision 100) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
encoding//OSGI-INF/l10n/bundle_ru_utf-8.properties=UTF-8 |
|
3 |
encoding/<project>=UTF-8 |
|
0 | 4 |
tmp/org.txm.rcp/.project (revision 100) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.txm.rcp</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
<project>org.txm.tbx</project> |
|
7 |
</projects> |
|
8 |
<buildSpec> |
|
9 |
<buildCommand> |
|
10 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
11 |
<arguments> |
|
12 |
</arguments> |
|
13 |
</buildCommand> |
|
14 |
<buildCommand> |
|
15 |
<name>org.eclipse.pde.ManifestBuilder</name> |
|
16 |
<arguments> |
|
17 |
</arguments> |
|
18 |
</buildCommand> |
|
19 |
<buildCommand> |
|
20 |
<name>org.eclipse.pde.SchemaBuilder</name> |
|
21 |
<arguments> |
|
22 |
</arguments> |
|
23 |
</buildCommand> |
|
24 |
<buildCommand> |
|
25 |
<name>net.sourceforge.metrics.builder</name> |
|
26 |
<arguments> |
|
27 |
</arguments> |
|
28 |
</buildCommand> |
|
29 |
</buildSpec> |
|
30 |
<natures> |
|
31 |
<nature>org.eclipse.pde.PluginNature</nature> |
|
32 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
33 |
<nature>net.sourceforge.metrics.nature</nature> |
|
34 |
</natures> |
|
35 |
</projectDescription> |
|
0 | 36 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/wizard/ImportCorpusWizard.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.wizard; |
|
2 |
|
|
3 |
import org.eclipse.jface.dialogs.IDialogSettings; |
|
4 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
5 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
|
6 |
import org.eclipse.jface.wizard.IWizardContainer; |
|
7 |
import org.eclipse.jface.wizard.IWizardPage; |
|
8 |
import org.eclipse.jface.wizard.Wizard; |
|
9 |
import org.eclipse.swt.graphics.Image; |
|
10 |
import org.eclipse.swt.graphics.RGB; |
|
11 |
import org.eclipse.swt.widgets.Composite; |
|
12 |
import org.eclipse.swt.widgets.Event; |
|
13 |
import org.eclipse.ui.IImportWizard; |
|
14 |
import org.eclipse.ui.INewWizard; |
|
15 |
import org.eclipse.ui.IWorkbench; |
|
16 |
import org.eclipse.ui.dialogs.WizardExportPage; |
|
17 |
import org.eclipse.ui.dialogs.WizardExportResourcesPage; |
|
18 |
import org.eclipse.ui.dialogs.WizardImportPage; |
|
19 |
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; |
|
20 |
import org.eclipse.ui.dialogs.WizardResourceImportPage; |
|
21 |
import org.txm.rcpapplication.IImageKeys; |
|
22 |
|
|
23 |
public class ImportCorpusWizard extends WizardResourceImportPage implements IImportWizard { |
|
24 |
|
|
25 |
protected ImportCorpusWizard(String name, IStructuredSelection selection) { |
|
26 |
super(name, selection); |
|
27 |
// TODO Auto-generated constructor stub |
|
28 |
} |
|
29 |
|
|
30 |
public IWizardContainer getContainer() { |
|
31 |
return super.getContainer(); |
|
32 |
} |
|
33 |
|
|
34 |
public IDialogSettings getDialogSettings() { |
|
35 |
return super.getDialogSettings(); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public void init(IWorkbench workbench, IStructuredSelection selection) { |
|
40 |
// TODO Auto-generated method stub |
|
41 |
|
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public void addPages() { |
|
46 |
// TODO Auto-generated method stub |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public boolean canFinish() { |
|
52 |
// TODO Auto-generated method stub |
|
53 |
return false; |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public void createPageControls(Composite pageContainer) { |
|
58 |
// TODO Auto-generated method stub |
|
59 |
|
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public Image getDefaultPageImage() { |
|
64 |
// TODO Auto-generated method stub |
|
65 |
return null; |
|
66 |
} |
|
67 |
|
|
68 |
@Override |
|
69 |
public IWizardPage getNextPage(IWizardPage page) { |
|
70 |
// TODO Auto-generated method stub |
|
71 |
return null; |
|
72 |
} |
|
73 |
|
|
74 |
@Override |
|
75 |
public IWizardPage getPage(String pageName) { |
|
76 |
// TODO Auto-generated method stub |
|
77 |
return null; |
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public int getPageCount() { |
|
82 |
// TODO Auto-generated method stub |
|
83 |
return 0; |
|
84 |
} |
|
85 |
|
|
86 |
@Override |
|
87 |
public IWizardPage[] getPages() { |
|
88 |
// TODO Auto-generated method stub |
|
89 |
return null; |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public IWizardPage getPreviousPage(IWizardPage page) { |
|
94 |
// TODO Auto-generated method stub |
|
95 |
return null; |
|
96 |
} |
|
97 |
|
|
98 |
@Override |
|
99 |
public IWizardPage getStartingPage() { |
|
100 |
// TODO Auto-generated method stub |
|
101 |
return null; |
|
102 |
} |
|
103 |
|
|
104 |
@Override |
|
105 |
public RGB getTitleBarColor() { |
|
106 |
// TODO Auto-generated method stub |
|
107 |
return null; |
|
108 |
} |
|
109 |
|
|
110 |
@Override |
|
111 |
public String getWindowTitle() { |
|
112 |
// TODO Auto-generated method stub |
|
113 |
return null; |
|
114 |
} |
|
115 |
|
|
116 |
@Override |
|
117 |
public boolean isHelpAvailable() { |
|
118 |
// TODO Auto-generated method stub |
|
119 |
return false; |
|
120 |
} |
|
121 |
|
|
122 |
@Override |
|
123 |
public boolean needsPreviousAndNextButtons() { |
|
124 |
// TODO Auto-generated method stub |
|
125 |
return false; |
|
126 |
} |
|
127 |
|
|
128 |
@Override |
|
129 |
public boolean needsProgressMonitor() { |
|
130 |
// TODO Auto-generated method stub |
|
131 |
return false; |
|
132 |
} |
|
133 |
|
|
134 |
@Override |
|
135 |
public boolean performCancel() { |
|
136 |
// TODO Auto-generated method stub |
|
137 |
return false; |
|
138 |
} |
|
139 |
|
|
140 |
@Override |
|
141 |
public boolean performFinish() { |
|
142 |
// TODO Auto-generated method stub |
|
143 |
return false; |
|
144 |
} |
|
145 |
|
|
146 |
@Override |
|
147 |
public void setContainer(IWizardContainer wizardContainer) { |
|
148 |
// TODO Auto-generated method stub |
|
149 |
|
|
150 |
} |
|
151 |
|
|
152 |
@Override |
|
153 |
protected void createSourceGroup(Composite parent) { |
|
154 |
// TODO Auto-generated method stub |
|
155 |
|
|
156 |
} |
|
157 |
|
|
158 |
@Override |
|
159 |
protected ITreeContentProvider getFileProvider() { |
|
160 |
// TODO Auto-generated method stub |
|
161 |
return null; |
|
162 |
} |
|
163 |
|
|
164 |
@Override |
|
165 |
protected ITreeContentProvider getFolderProvider() { |
|
166 |
// TODO Auto-generated method stub |
|
167 |
return null; |
|
168 |
} |
|
169 |
|
|
170 |
} |
|
0 | 171 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/wizard/MyPageTwo.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.wizard; |
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
import org.eclipse.jface.wizard.WizardPage; |
|
6 |
|
|
7 |
import org.eclipse.swt.SWT; |
|
8 |
|
|
9 |
import org.eclipse.swt.events.KeyEvent; |
|
10 |
|
|
11 |
import org.eclipse.swt.events.KeyListener; |
|
12 |
|
|
13 |
import org.eclipse.swt.layout.GridData; |
|
14 |
|
|
15 |
import org.eclipse.swt.layout.GridLayout; |
|
16 |
|
|
17 |
import org.eclipse.swt.widgets.Button; |
|
18 |
|
|
19 |
import org.eclipse.swt.widgets.Composite; |
|
20 |
|
|
21 |
import org.eclipse.swt.widgets.Label; |
|
22 |
|
|
23 |
import org.eclipse.swt.widgets.Text; |
|
24 |
|
|
25 |
|
|
26 |
public class MyPageTwo extends WizardPage { |
|
27 |
|
|
28 |
private Text text1; |
|
29 |
|
|
30 |
private Composite container; |
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
public MyPageTwo() { |
|
35 |
|
|
36 |
super("Second Page"); |
|
37 |
|
|
38 |
setTitle("Second Page"); |
|
39 |
|
|
40 |
setDescription("Now this is the second page"); |
|
41 |
|
|
42 |
setControl(text1); |
|
43 |
|
|
44 |
} |
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
@Override |
|
49 |
|
|
50 |
public void createControl(Composite parent) { |
|
51 |
|
|
52 |
container = new Composite(parent, SWT.NONE); |
|
53 |
|
|
54 |
GridLayout layout = new GridLayout(); |
|
55 |
|
|
56 |
container.setLayout(layout); |
|
57 |
|
|
58 |
layout.numColumns = 2; |
|
59 |
|
|
60 |
Label label1 = new Label(container, SWT.NONE); |
|
61 |
|
|
62 |
label1.setText("Say hello to Fred"); |
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
text1 = new Text(container, SWT.BORDER | SWT.SINGLE); |
|
67 |
|
|
68 |
text1.setText(""); |
|
69 |
|
|
70 |
text1.addKeyListener(new KeyListener() { |
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
@Override |
|
75 |
|
|
76 |
public void keyPressed(KeyEvent e) { |
|
77 |
|
|
78 |
// TODO Auto-generated method stub |
|
79 |
|
|
80 |
} |
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
@Override |
|
85 |
|
|
86 |
public void keyReleased(KeyEvent e) { |
|
87 |
|
|
88 |
if (!text1.getText().isEmpty()) { |
|
89 |
|
|
90 |
setPageComplete(true); |
|
91 |
|
|
92 |
} |
|
93 |
|
|
94 |
} |
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
}); |
|
99 |
|
|
100 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL); |
|
101 |
|
|
102 |
text1.setLayoutData(gd); |
|
103 |
|
|
104 |
Label labelCheck = new Label(container, SWT.NONE); |
|
105 |
|
|
106 |
labelCheck.setText("This is a check"); |
|
107 |
|
|
108 |
Button check = new Button(container, SWT.CHECK); |
|
109 |
|
|
110 |
check.setSelection(true); |
|
111 |
|
|
112 |
// required to avoid an error in the system |
|
113 |
|
|
114 |
setControl(container); |
|
115 |
|
|
116 |
setPageComplete(false); |
|
117 |
|
|
118 |
} |
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
public String getText1() { |
|
123 |
|
|
124 |
return text1.getText(); |
|
125 |
|
|
126 |
} |
|
127 |
|
|
128 |
} |
|
129 |
|
|
0 | 130 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/wizard/ExportCorpusWizard.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.wizard; |
|
2 |
|
|
3 |
import org.eclipse.jface.dialogs.IDialogSettings; |
|
4 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
5 |
import org.eclipse.jface.wizard.IWizardContainer; |
|
6 |
import org.eclipse.jface.wizard.IWizardPage; |
|
7 |
import org.eclipse.swt.graphics.Image; |
|
8 |
import org.eclipse.swt.graphics.RGB; |
|
9 |
import org.eclipse.swt.widgets.Composite; |
|
10 |
import org.eclipse.swt.widgets.Event; |
|
11 |
import org.eclipse.ui.IExportWizard; |
|
12 |
import org.eclipse.ui.IWorkbench; |
|
13 |
import org.eclipse.ui.dialogs.WizardExportResourcesPage; |
|
14 |
|
|
15 |
public class ExportCorpusWizard extends WizardExportResourcesPage implements IExportWizard { |
|
16 |
|
|
17 |
protected ExportCorpusWizard(String pageName, IStructuredSelection selection) { |
|
18 |
super(pageName, selection); |
|
19 |
// TODO Auto-generated constructor stub |
|
20 |
} |
|
21 |
|
|
22 |
public IWizardContainer getContainer() { |
|
23 |
return super.getContainer(); |
|
24 |
} |
|
25 |
|
|
26 |
public IDialogSettings getDialogSettings() { |
|
27 |
return super.getDialogSettings(); |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public void init(IWorkbench workbench, IStructuredSelection selection) { |
|
32 |
// TODO Auto-generated method stub |
|
33 |
|
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public void addPages() { |
|
38 |
// TODO Auto-generated method stub |
|
39 |
|
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public boolean canFinish() { |
|
44 |
// TODO Auto-generated method stub |
|
45 |
return false; |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void createPageControls(Composite pageContainer) { |
|
50 |
// TODO Auto-generated method stub |
|
51 |
|
|
52 |
} |
|
53 |
|
|
54 |
@Override |
|
55 |
public Image getDefaultPageImage() { |
|
56 |
// TODO Auto-generated method stub |
|
57 |
return null; |
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
public IWizardPage getNextPage(IWizardPage page) { |
|
62 |
// TODO Auto-generated method stub |
|
63 |
return null; |
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
public IWizardPage getPage(String pageName) { |
|
68 |
// TODO Auto-generated method stub |
|
69 |
return null; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public int getPageCount() { |
|
74 |
// TODO Auto-generated method stub |
|
75 |
return 0; |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public IWizardPage[] getPages() { |
|
80 |
// TODO Auto-generated method stub |
|
81 |
return null; |
|
82 |
} |
|
83 |
|
|
84 |
@Override |
|
85 |
public IWizardPage getPreviousPage(IWizardPage page) { |
|
86 |
// TODO Auto-generated method stub |
|
87 |
return null; |
|
88 |
} |
|
89 |
|
|
90 |
@Override |
|
91 |
public IWizardPage getStartingPage() { |
|
92 |
// TODO Auto-generated method stub |
|
93 |
return null; |
|
94 |
} |
|
95 |
|
|
96 |
@Override |
|
97 |
public RGB getTitleBarColor() { |
|
98 |
// TODO Auto-generated method stub |
|
99 |
return null; |
|
100 |
} |
|
101 |
|
|
102 |
@Override |
|
103 |
public String getWindowTitle() { |
|
104 |
// TODO Auto-generated method stub |
|
105 |
return null; |
|
106 |
} |
|
107 |
|
|
108 |
@Override |
|
109 |
public boolean isHelpAvailable() { |
|
110 |
// TODO Auto-generated method stub |
|
111 |
return false; |
|
112 |
} |
|
113 |
|
|
114 |
@Override |
|
115 |
public boolean needsPreviousAndNextButtons() { |
|
116 |
// TODO Auto-generated method stub |
|
117 |
return false; |
|
118 |
} |
|
119 |
|
|
120 |
@Override |
|
121 |
public boolean needsProgressMonitor() { |
|
122 |
// TODO Auto-generated method stub |
|
123 |
return false; |
|
124 |
} |
|
125 |
|
|
126 |
@Override |
|
127 |
public boolean performCancel() { |
|
128 |
// TODO Auto-generated method stub |
|
129 |
return false; |
|
130 |
} |
|
131 |
|
|
132 |
@Override |
|
133 |
public boolean performFinish() { |
|
134 |
// TODO Auto-generated method stub |
|
135 |
return false; |
|
136 |
} |
|
137 |
|
|
138 |
@Override |
|
139 |
public void setContainer(IWizardContainer wizardContainer) { |
|
140 |
// TODO Auto-generated method stub |
|
141 |
|
|
142 |
} |
|
143 |
|
|
144 |
@Override |
|
145 |
public void handleEvent(Event event) { |
|
146 |
// TODO Auto-generated method stub |
|
147 |
|
|
148 |
} |
|
149 |
|
|
150 |
@Override |
|
151 |
protected void createDestinationGroup(Composite parent) { |
|
152 |
// TODO Auto-generated method stub |
|
153 |
|
|
154 |
} |
|
155 |
|
|
156 |
|
|
157 |
} |
|
0 | 158 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/wizard/MyPageOne.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.wizard; |
|
2 |
|
|
3 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
4 |
import org.eclipse.jface.wizard.WizardPage; |
|
5 |
import org.eclipse.swt.SWT; |
|
6 |
import org.eclipse.swt.events.KeyEvent; |
|
7 |
import org.eclipse.swt.events.KeyListener; |
|
8 |
import org.eclipse.swt.layout.GridData; |
|
9 |
import org.eclipse.swt.layout.GridLayout; |
|
10 |
import org.eclipse.swt.widgets.Composite; |
|
11 |
import org.eclipse.swt.widgets.Label; |
|
12 |
import org.eclipse.swt.widgets.Text; |
|
13 |
import org.eclipse.ui.dialogs.WizardNewFileCreationPage; |
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
public class MyPageOne extends WizardNewFileCreationPage { |
|
18 |
|
|
19 |
public MyPageOne(String pageName, IStructuredSelection selection) { |
|
20 |
super(pageName, selection); |
|
21 |
// TODO Auto-generated constructor stub |
|
22 |
} |
|
23 |
|
|
24 |
} |
|
25 |
|
|
0 | 26 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/wizard/NewCorpusWizard.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.wizard; |
|
2 |
|
|
3 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
4 |
import org.eclipse.jface.wizard.Wizard; |
|
5 |
import org.eclipse.ui.INewWizard; |
|
6 |
import org.eclipse.ui.IWorkbench; |
|
7 |
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; |
|
8 |
|
|
9 |
public class NewCorpusWizard extends Wizard implements INewWizard { |
|
10 |
|
|
11 |
WizardNewProjectCreationPage page; |
|
12 |
|
|
13 |
@Override |
|
14 |
public void init(IWorkbench workbench, IStructuredSelection selection) { |
|
15 |
page = new WizardNewProjectCreationPage("Corpus TXM"); |
|
16 |
page.setTitle("Corpus TXM"); |
|
17 |
page.setDescription("select the directory containing the source files"); |
|
18 |
addPage(page); |
|
19 |
} |
|
20 |
|
|
21 |
@Override |
|
22 |
public boolean performFinish() { |
|
23 |
return page.isPageComplete(); |
|
24 |
} |
|
25 |
} |
|
0 | 26 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/TXMPreferencePage.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.preferences; |
|
2 |
|
|
3 |
// Copyright © 2010-2013 ENS de Lyon. |
|
4 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
5 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
6 |
// Sophia Antipolis, University of Paris 3. |
|
7 |
// |
|
8 |
// The TXM platform is free software: you can redistribute it |
|
9 |
// and/or modify it under the terms of the GNU General Public |
|
10 |
// License as published by the Free Software Foundation, |
|
11 |
// either version 2 of the License, or (at your option) any |
|
12 |
// later version. |
|
13 |
// |
|
14 |
// The TXM platform is distributed in the hope that it will be |
|
15 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
16 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
17 |
// PURPOSE. See the GNU General Public License for more |
|
18 |
// details. |
|
19 |
// |
|
20 |
// You should have received a copy of the GNU General |
|
21 |
// Public License along with the TXM platform. If not, see |
|
22 |
// http://www.gnu.org/licenses. |
|
23 |
// |
|
24 |
// |
|
25 |
// |
|
26 |
// $LastChangedDate:$ |
|
27 |
// $LastChangedRevision:$ |
|
28 |
// $LastChangedBy:$ |
|
29 |
// |
|
30 |
|
|
31 |
|
|
32 |
import org.eclipse.jface.preference.FieldEditor; |
|
33 |
import org.eclipse.jface.preference.FieldEditorPreferencePage; |
|
34 |
import org.eclipse.swt.widgets.Composite; |
|
35 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
|
36 |
import org.eclipse.ui.preferences.ScopedPreferenceStore; |
|
37 |
|
|
38 |
/** |
|
39 |
* TXM base preference page. |
|
40 |
* @author mdecorde |
|
41 |
* @author sjacquot |
|
42 |
* |
|
43 |
*/ |
|
44 |
public abstract class TXMPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { |
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
/** |
|
49 |
* |
|
50 |
*/ |
|
51 |
public TXMPreferencePage() { |
|
52 |
super(GRID); |
|
53 |
} |
|
54 |
|
|
55 |
|
|
56 |
@Override |
|
57 |
public Composite getFieldEditorParent() { |
|
58 |
return super.getFieldEditorParent(); |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public void addField(FieldEditor editor) { |
|
63 |
super.addField(editor); |
|
64 |
} |
|
65 |
|
|
66 |
/* (non-Javadoc) |
|
67 |
* @see org.eclipse.jface.preference.PreferencePage#isValid() |
|
68 |
*/ |
|
69 |
@Override |
|
70 |
public boolean isValid() { |
|
71 |
return true; // Otherwise the bahaviour is so strange .... |
|
72 |
} |
|
73 |
|
|
74 |
/* (non-Javadoc) |
|
75 |
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk() |
|
76 |
*/ |
|
77 |
@Override |
|
78 |
public boolean performOk() { |
|
79 |
try { |
|
80 |
super.performOk(); |
|
81 |
((ScopedPreferenceStore) this.getPreferenceStore()).save(); |
|
82 |
// FIXME: to remove after the plug-ins split |
|
83 |
org.txm.Toolbox.updateProperties(org.txm.rcpapplication.ApplicationWorkbenchAdvisor.getProperties()); |
|
84 |
} catch (Exception e) { |
|
85 |
System.err.println(org.txm.rcpapplication.Messages.FAILED_TO_SAVE_PREFERENCES + e); |
|
86 |
} |
|
87 |
return true; |
|
88 |
} |
|
89 |
} |
|
0 | 90 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/TXMPreferenceStore.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.preferences; |
|
2 |
|
|
3 |
import org.eclipse.core.runtime.preferences.InstanceScope; |
|
4 |
import org.eclipse.ui.preferences.ScopedPreferenceStore; |
|
5 |
|
|
6 |
/** |
|
7 |
* Convenience to get scoped preference instance store. |
|
8 |
* |
|
9 |
* @author sjacquot |
|
10 |
* |
|
11 |
*/ |
|
12 |
// FIXME: add methods from the old TXMPreferences class? (getBoolean, getInt, set, etc.) |
|
13 |
public class TXMPreferenceStore extends ScopedPreferenceStore { |
|
14 |
|
|
15 |
/** |
|
16 |
* |
|
17 |
* @param qualifier |
|
18 |
*/ |
|
19 |
public TXMPreferenceStore(String qualifier) { |
|
20 |
super(InstanceScope.INSTANCE, qualifier); |
|
21 |
} |
|
22 |
|
|
23 |
} |
|
0 | 24 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/tests/AnnotationLookUp.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.tests; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.Arrays; |
|
5 |
import java.util.HashMap; |
|
6 |
import java.util.LinkedHashMap; |
|
7 |
import java.util.List; |
|
8 |
|
|
9 |
import org.txm.annotation.Annotation; |
|
10 |
import org.txm.annotation.AnnotationManager; |
|
11 |
import org.txm.annotation.CQPAnnotationManager; |
|
12 |
import org.txm.annotation.repository.AnnotationType; |
|
13 |
import org.txm.annotation.repository.KnowledgeRepository; |
|
14 |
import org.txm.annotation.repository.KnowledgeRepositoryManager; |
|
15 |
import org.txm.annotation.repository.TypedValue; |
|
16 |
import org.txm.annotation.storage.temporary.TemporaryAnnotationManager; |
|
17 |
import org.txm.rcpapplication.commands.annotation.InitializeKnowledgeRepository; |
|
18 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
|
19 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
|
20 |
import org.txm.searchengine.cqp.corpus.query.Match; |
|
21 |
|
|
22 |
public class AnnotationLookUp { |
|
23 |
|
|
24 |
////JPA Annotation Manager (only among temporary annotations) |
|
25 |
|
|
26 |
public static void writingAnnotations(KnowledgeRepository kr, MainCorpus c, AnnotationManager am){ |
|
27 |
TemporaryAnnotationManager jpamanager = am.getTemporaryManager(); |
|
28 |
try { |
|
29 |
|
|
30 |
List<Annotation> annotsOverlapped; |
|
31 |
AnnotationType T1 = kr.getType("T1"); |
|
32 |
AnnotationType T2 = kr.getType("T2"); |
|
33 |
|
|
34 |
if (T1 == null || T2 == null) { |
|
35 |
System.out.println("Annotation types are NULL !!!"); |
|
36 |
return; |
|
37 |
} |
|
38 |
|
|
39 |
TypedValue val1 = kr.getValue(T1, "V1"); |
|
40 |
TypedValue val2 = kr.getValue(T1, "V2"); |
|
41 |
TypedValue val3 = kr.getValue(T1, "V3"); |
|
42 |
TypedValue val4 = kr.getValue(T1, "V4"); |
|
43 |
TypedValue val5 = kr.getValue(T2, "V5"); |
|
44 |
|
|
45 |
TypedValue val6 = kr.getValue(T2, "V6"); |
|
46 |
TypedValue val7 = kr.getValue(T2, "V7"); |
|
47 |
TypedValue val8 = kr.getValue(T2, "V8"); |
|
48 |
|
|
49 |
if(val1!= null && val2!=null && val3!=null && val4!= null && |
|
50 |
val5!=null && val6!=null && val7!= null && val8!=null) { |
|
51 |
//OK |
|
52 |
System.out.println("============== Creation with no overlap =============="); |
|
53 |
annotsOverlapped = jpamanager.createAnnotation(T1, val1, 3, 3); |
|
54 |
System.out.println("No overlap for [val1] ? colision = "+annotsOverlapped); |
|
55 |
annotsOverlapped = jpamanager.createAnnotation(T1, val2, 10, 12); |
|
56 |
System.out.println("No overlap for [val2] ? colision = "+annotsOverlapped); |
|
57 |
annotsOverlapped = jpamanager.createAnnotation(T2, val3, 24, 29); |
|
58 |
System.out.println("No overlap for [val2] ? colision = "+annotsOverlapped); |
|
59 |
annotsOverlapped = jpamanager.createAnnotation(T2, val4, 11, 11); |
|
60 |
System.out.println("One overlap for [val4] ? colision = "+annotsOverlapped); |
|
61 |
annotsOverlapped = jpamanager.createAnnotation(T2, val5, 2, 5); |
|
62 |
System.out.println("One overlap for [val5] ? colision = "+annotsOverlapped); |
|
63 |
jpamanager.checkData(); |
|
64 |
am.saveAnnotations(); |
|
65 |
} |
|
66 |
|
|
67 |
} catch (Exception e) { |
|
68 |
// TODO Bloc catch généré automatiquement |
|
69 |
e.printStackTrace(); |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
public static class Test { |
|
74 |
public AnnotationType type; |
|
75 |
public TypedValue value; |
|
76 |
public List<Match> matches; |
|
77 |
public String comment; |
|
78 |
public Test(AnnotationType type, TypedValue value, List<Match> matches, String comment) { |
|
79 |
this.type = type; |
|
80 |
this.value = value; |
|
81 |
this.matches = matches; |
|
82 |
this.comment = comment; |
|
83 |
} |
|
84 |
|
|
85 |
public String toString() { return value.toString()+" at "+matches; } |
|
86 |
} |
|
87 |
|
|
88 |
public static void checkingAnnotationManager(KnowledgeRepository kr, MainCorpus c, AnnotationManager am){ |
|
89 |
|
|
90 |
try { |
|
91 |
HashMap<Match, List<Annotation>> annotsOverlapped; |
|
92 |
AnnotationType T1 = kr.getType("T1"); |
|
93 |
AnnotationType T2 = kr.getType("T2"); |
|
94 |
|
|
95 |
if (T1 == null || T2 == null) { |
|
96 |
System.out.println("Annotation types are NULL !!!"); |
|
97 |
return; |
|
98 |
} |
|
99 |
|
|
100 |
TypedValue V1 = kr.getValue(T1, "V1"); |
|
101 |
TypedValue V2 = kr.getValue(T1, "V2"); |
|
102 |
TypedValue V5 = kr.getValue(T2, "V5"); |
|
103 |
|
|
104 |
LinkedHashMap<String, ArrayList<Test>> testSuits = new LinkedHashMap<String, ArrayList<Test>>(); |
|
105 |
ArrayList<Test> tests = null; |
|
106 |
|
|
107 |
tests = new ArrayList<Test>(); |
|
108 |
tests.add(new Test(T1, V1, Arrays.asList(new Match(3, 3)), "no overlap")); |
|
109 |
tests.add(new Test(T1, V1, Arrays.asList(new Match(10, 12)), "no overlap")); |
|
110 |
testSuits.put("No overlap, diff types", tests); |
|
111 |
|
|
112 |
tests = new ArrayList<Test>(); |
|
113 |
tests.add(new Test(T1, V1, Arrays.asList(new Match(9, 10)), "ON START impossible")); |
|
114 |
tests.add(new Test(T1, V1, Arrays.asList(new Match(12, 13)), "ON END impossible")); |
|
115 |
tests.add(new Test(T1, V1, Arrays.asList(new Match(9, 13)), "OUTTER impossible")); |
|
116 |
tests.add(new Test(T1, V1, Arrays.asList(new Match(11, 11)), "INNER impossible")); |
|
117 |
testSuits.put("Creation overlap with same type", tests); |
|
118 |
|
|
119 |
tests = new ArrayList<Test>(); |
|
120 |
tests.add(new Test(T1, V1, Arrays.asList(new Match(23, 24)), "overlap")); |
|
121 |
tests.add(new Test(T1, V1, Arrays.asList(new Match(45, 50)), "no overlap")); |
|
122 |
testSuits.put("No overlap, diff types, pls words", tests); |
|
123 |
|
|
124 |
tests = new ArrayList<Test>(); |
|
125 |
tests.add(new Test(T2, V5, Arrays.asList(new Match(9, 11)), "ON START impossible")); |
|
126 |
tests.add(new Test(T2, V5, Arrays.asList(new Match(11, 14)), "ON END impossible")); |
|
127 |
tests.add(new Test(T2, V5, Arrays.asList(new Match(22, 26)), "OUTTER possible")); // a tester avec une annotation T1 isolée |
|
128 |
tests.add(new Test(T2, V5, Arrays.asList(new Match(47, 47)), "INNER possible")); |
|
129 |
testSuits.put("Creation overlap with another type", tests); |
|
130 |
|
|
131 |
tests = new ArrayList<Test>(); |
|
132 |
tests.add(new Test(T1, V2, Arrays.asList(new Match(47, 47)), "REPLACE TEMP")); |
|
133 |
tests.add(new Test(T1, V2, Arrays.asList(new Match(3, 3)), "REPLACE CQP")); |
|
134 |
testSuits.put("Updating values", tests); |
|
135 |
|
|
136 |
|
|
137 |
LinkedHashMap<String, ArrayList<Test>> testSuits2 = new LinkedHashMap<String, ArrayList<Test>>(); |
|
138 |
tests = new ArrayList<Test>(); |
|
139 |
tests.add(new Test(T2, V2, Arrays.asList(new Match(7, 7)), "DELETE TEMP")); |
|
140 |
tests.add(new Test(T1, V2, Arrays.asList(new Match(3, 3)), "DELETE CQP #del")); |
|
141 |
testSuits2.put("Updating values", tests); |
|
142 |
|
|
143 |
System.out.println("============== Create&Update =============="); |
|
144 |
for (String suit : testSuits.keySet()) { |
|
145 |
tests = testSuits.get(suit); |
|
146 |
System.out.println("======== "+suit+" ========"); |
|
147 |
for (Test test : tests) { |
|
148 |
System.out.println("Test "+test); |
|
149 |
annotsOverlapped = am.createAnnotations(test.type, test.value, test.matches, null); //Annotation on three words : "cela va marcher" |
|
150 |
System.out.println("--> "+test.comment+" for "+test.value+" at "+test.matches+" ? colision = "+annotsOverlapped); |
|
151 |
am.checkData(); |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
System.out.println("============== Deleting =============="); |
|
156 |
for (String suit : testSuits2.keySet()) { |
|
157 |
tests = testSuits2.get(suit); |
|
158 |
for (Test test : tests) { |
|
159 |
System.out.println(test.comment+test.type+" at "+test.matches); |
|
160 |
am.deleteAnnotations(test.type, test.matches, null); |
|
161 |
am.checkData(); |
|
162 |
} |
|
163 |
} |
|
164 |
|
|
165 |
System.out.println("============== CLean all =============="); |
|
166 |
am.getTemporaryManager().deleteAnnotations(); |
|
167 |
} catch (Exception e) { |
|
168 |
// TODO Bloc catch généré automatiquement |
|
169 |
e.printStackTrace(); |
|
170 |
} |
|
171 |
} |
|
172 |
|
|
173 |
public static void checkingJPAManager(KnowledgeRepository kr, MainCorpus c, AnnotationManager am){ |
|
174 |
|
|
175 |
TemporaryAnnotationManager jpamanager = am.getTemporaryManager(); |
|
176 |
try { |
|
177 |
List<Annotation> annotsOverlapped; |
|
178 |
AnnotationType T1 = kr.getType("T1"); |
|
179 |
AnnotationType T2 = kr.getType("T2"); |
|
180 |
|
|
181 |
if (T1 == null || T2 == null) { |
|
182 |
System.out.println("Annotation types are NULL !!!"); |
|
183 |
return; |
|
184 |
} |
|
185 |
|
|
186 |
TypedValue val1 = kr.getValue(T1, "V1"); |
|
187 |
TypedValue val2 = kr.getValue(T1, "V2"); |
|
188 |
TypedValue val3 = kr.getValue(T1, "V3"); |
|
189 |
TypedValue val4 = kr.getValue(T1, "V4"); |
|
190 |
|
|
191 |
TypedValue val5 = kr.getValue(T2, "V5"); |
|
192 |
TypedValue val6 = kr.getValue(T2, "V6"); |
|
193 |
TypedValue val7 = kr.getValue(T2, "V7"); |
|
194 |
TypedValue val8 = kr.getValue(T2, "V8"); |
|
195 |
|
|
196 |
TypedValue val9 = kr.getValue(T1, "V9"); |
|
197 |
|
|
198 |
if(val1!= null && val2!=null && val3!=null && val4!= null && |
|
199 |
val5!=null && val6!=null && val7!= null && val8!=null) { |
|
200 |
//OK |
|
201 |
System.out.println("============== Creation with no overlap =============="); |
|
202 |
annotsOverlapped = jpamanager.createAnnotation(T1, val1, 3, 3); //Annotation on one word : "annoter" |
|
203 |
System.out.println("No overlap for [val1] ? colision = "+annotsOverlapped); |
|
204 |
annotsOverlapped = jpamanager.createAnnotation(T1, val2, 10, 12); //Annotation on three words : "cela va marcher" |
|
205 |
System.out.println("No overlap for [val2] ? colision = "+annotsOverlapped); |
|
206 |
|
|
207 |
jpamanager.checkData(); |
|
208 |
|
|
209 |
//ECHEC normalement car OVERLAP sur même type |
|
210 |
//OVERLAP CASE with same type (on start with val2) => not authorized |
|
211 |
System.out.println(""); |
|
212 |
System.out.println("============== Creation overlap with same type =============="); |
|
213 |
annotsOverlapped = jpamanager.createAnnotation(T1, val3, 9, 12); //Annotation on three words : "si cela va marcher" |
|
214 |
System.out.println("ON START impossible [val3:9-12], colision = "+annotsOverlapped); |
|
215 |
jpamanager.checkData(); |
|
216 |
//OVERLAP CASE with same type (on end with val2) => not authorized |
|
217 |
annotsOverlapped = jpamanager.createAnnotation(T1, val3, 12, 13); //Annotation on two words : "marcher mais" |
|
218 |
System.out.println("ON END impossible [val3:12-13], colision = "+annotsOverlapped); |
|
219 |
//OVERLAP CASE with same type (outterwrap with val2) => not authorized |
|
220 |
annotsOverlapped = jpamanager.createAnnotation(T1, val3, 9, 13); //Annotation on five words : "si cela va marcher mais" |
|
221 |
System.out.println("OUTTER impossible [val3:9-13], colision = "+annotsOverlapped); |
|
222 |
//OVERLAP CASE with same type (innerwrap with val2) => not authorized |
|
223 |
annotsOverlapped = jpamanager.createAnnotation(T1, val3, 11, 11); //Annotation on one words : "va" |
|
224 |
System.out.println("INNER impossible [val3:11], colision = "+annotsOverlapped); |
|
225 |
|
|
226 |
jpamanager.checkData(); |
|
227 |
|
|
228 |
//OK |
|
229 |
annotsOverlapped = jpamanager.createAnnotation(T1, val3, 23, 24); //Annotation on two words : ?? |
|
230 |
System.out.println("No overlap for [val3] ? colision = "+annotsOverlapped); |
|
231 |
annotsOverlapped = jpamanager.createAnnotation(T1, val4, 45, 50);//Annotation on six words : "annotations seront bien prises en compte" |
|
232 |
System.out.println("No overlap for [val4] ? colision = "+annotsOverlapped); |
|
233 |
|
|
234 |
jpamanager.checkData(); |
|
235 |
|
|
236 |
System.out.println(""); |
|
237 |
System.out.println("============== Creation overlap with another type ============="); |
|
238 |
//OVERLAP CASE with another type (on start with val2:10-12) => not authorized |
|
239 |
annotsOverlapped = jpamanager.createAnnotation(T2, val4, 9, 11); //Annotation on three words : "si cela va" |
|
240 |
System.out.println("ON START impossible with [val2:10-12], for [val4:9-11], colision = "+annotsOverlapped); |
|
241 |
|
|
242 |
jpamanager.checkData(); |
|
243 |
|
|
244 |
//OVERLAP CASE with another type (on end with val1) => should be fine |
|
245 |
annotsOverlapped = jpamanager.createAnnotation(T2, val5, 11, 14); //Annotation on three words : "annoter et je" |
|
246 |
System.out.println("ON END impossible with [val2:10-12], for [val5:11-14], colision = "+annotsOverlapped); |
|
247 |
|
|
248 |
jpamanager.checkData(); |
|
249 |
//OVERLAP CASE with another type (outterwrap with val3) => should be fine |
|
250 |
annotsOverlapped = jpamanager.createAnnotation(T2, val6, 22, 26); //Annotation on five words : "est pas trop difficile, car" |
|
251 |
System.out.println("OUTTER possible with [val3:23-24], for [val6:22-26], colision = "+annotsOverlapped); |
|
252 |
|
|
253 |
jpamanager.checkData(); |
|
254 |
//OVERLAP CASE with another type (innerwrap with val4) => should be fine |
|
255 |
annotsOverlapped = jpamanager.createAnnotation(T2, val7, 47, 47); //Annotation on one word : "bien" |
|
256 |
System.out.println("INNER possible with [val4:45-50], for [val7:47], colision = "+annotsOverlapped); |
|
257 |
jpamanager.checkData(); |
|
258 |
|
|
259 |
|
|
260 |
///////////////////// UPDATE /////////////////////////// |
|
261 |
System.out.println(""); |
|
262 |
System.out.println("============== Updating =============="); |
|
263 |
//UPDATE val10, need to have the same startPos and endPos and refType |
|
264 |
List<Annotation> annots = jpamanager.getAnnotations(T1, 23, 25); |
|
265 |
System.out.println("Annot BEFORE UPDATING : "+annots.size()); |
|
266 |
annotsOverlapped = jpamanager.createAnnotation(T1, val9, 23, 25); |
|
267 |
annots = jpamanager.getAnnotations(T1, 23, 25); |
|
268 |
for(Annotation annot : annots){ |
|
269 |
System.out.println("Annot AFTER UPDATING : "+annot.toString()); |
|
270 |
} |
|
271 |
|
|
272 |
//DELETE val8 |
|
273 |
System.out.println(""); |
|
274 |
System.out.println("============== Deleting =============="); |
|
275 |
annotsOverlapped = jpamanager.createAnnotation(T2, val8, 17, 19); //Annotation on three words : "En même temps" |
|
276 |
System.out.println("creating [val8] ? overlap colision = "+annotsOverlapped); |
|
277 |
|
|
278 |
annots = jpamanager.getAnnotations(T2, 17, 19); |
|
279 |
for(Annotation annot : annots){ |
|
280 |
System.out.println("Annot BEFORE DELETING : "+annot); |
|
281 |
} |
|
282 |
|
|
283 |
jpamanager.deleteAnnotation(T2, 17, 19); |
|
284 |
annots = jpamanager.getAnnotations(T2, 17, 19); |
|
285 |
System.out.println("Annot AFTER DELETING : "+annots.size()); |
|
286 |
|
|
287 |
jpamanager.deleteAnnotations(); |
|
288 |
|
|
289 |
}else { |
|
290 |
System.out.println("Valued Types are NULL !!!"); |
|
291 |
} |
|
292 |
|
|
293 |
} catch (Exception e) { |
|
294 |
// TODO Bloc catch généré automatiquement |
|
295 |
e.printStackTrace(); |
|
296 |
} |
|
297 |
} |
|
298 |
|
|
299 |
public static class TestCQP { |
|
300 |
public int start; |
|
301 |
public int end; |
|
302 |
public TestCQP(int start, int end) { |
|
303 |
this.start = start; |
|
304 |
this.end = end; |
|
305 |
} |
|
306 |
|
|
307 |
public String toString() { return "["+start+", "+end+"]"; } |
|
308 |
} |
|
309 |
|
|
310 |
private static void checkingCQPManager(KnowledgeRepository kr, MainCorpus c, AnnotationManager am) { |
|
311 |
CQPAnnotationManager cqpmanager = am.getCQPManager(); |
|
312 |
|
|
313 |
try { |
|
314 |
List<Annotation> annotsOverlapped; |
|
315 |
List<AnnotationType> types = kr.getAllAnnotationTypes(); |
|
316 |
for (AnnotationType type : types) { |
|
317 |
List<Annotation> annotations = cqpmanager.getAnnotations(type); |
|
318 |
System.out.println(type.getId()+" : "+annotations.size()); |
|
319 |
for(Annotation a : annotations){ |
|
320 |
System.out.println("\t"+a.toString()); |
|
321 |
} |
|
322 |
} |
|
323 |
|
|
324 |
ArrayList<TestCQP> tests = new ArrayList<TestCQP>(); |
|
325 |
|
|
326 |
tests.add(new TestCQP(2,2)); |
|
327 |
tests.add(new TestCQP(4,4)); |
|
328 |
tests.add(new TestCQP(3,3)); |
|
329 |
tests.add(new TestCQP(2,3)); |
|
330 |
tests.add(new TestCQP(3,4)); |
|
331 |
tests.add(new TestCQP(2,5)); |
|
332 |
|
|
333 |
ArrayList<TestCQP> tests2 = new ArrayList<TestCQP>(); |
|
334 |
tests2.add(new TestCQP(9,9)); |
|
335 |
tests2.add(new TestCQP(13,13)); |
|
336 |
tests2.add(new TestCQP(11,11)); |
|
337 |
tests2.add(new TestCQP(10,11)); |
|
338 |
tests2.add(new TestCQP(11,12)); |
|
339 |
tests2.add(new TestCQP(9,10)); |
|
340 |
tests2.add(new TestCQP(9,11)); |
|
341 |
tests2.add(new TestCQP(12,14)); |
|
342 |
tests2.add(new TestCQP(9,10)); |
|
343 |
tests2.add(new TestCQP(9,13)); |
|
344 |
|
|
345 |
System.out.println("============== Get overlapping of annotations for a type =============="); |
|
346 |
System.out.println(tests); |
|
347 |
types = kr.getAllAnnotationTypes(); |
|
348 |
for (AnnotationType type : types) { |
|
349 |
for (TestCQP match : tests) { |
|
350 |
annotsOverlapped = cqpmanager.getAnnotations(type, match.start, match.end, true);//jpamanager.createAnnotation(T1, val4, 3, 3); |
|
351 |
System.out.println("Overlaps for "+type+" at "+match+" ? "+annotsOverlapped); |
|
352 |
} |
|
353 |
} |
|
354 |
|
|
355 |
System.out.println("============== Get overlapping of annotations for a type =============="); |
|
356 |
System.out.println(tests2); |
|
357 |
types = kr.getAllAnnotationTypes(); |
|
358 |
for (AnnotationType type : types) { |
|
359 |
for (TestCQP match : tests2) { |
|
360 |
annotsOverlapped = cqpmanager.getAnnotations(type, match.start, match.end, true);//jpamanager.createAnnotation(T1, val4, 3, 3); |
|
361 |
System.out.println("Overlaps for "+type+" at "+match+" ? "+annotsOverlapped); |
|
362 |
} |
|
363 |
} |
|
364 |
|
|
365 |
System.out.println("============== Get ALL overlapping annotations of annotations =============="); |
|
366 |
System.out.println(tests); |
|
367 |
|
|
368 |
for (TestCQP match : tests) { |
|
369 |
annotsOverlapped = cqpmanager.getAnnotations(null, match.start, match.end, true);//jpamanager.createAnnotation(T1, val4, 3, 3); |
|
370 |
System.out.println("Overlaps at "+match+" ? "+annotsOverlapped); |
|
371 |
} |
|
372 |
|
|
373 |
System.out.println("============== Get ALL overlapping annotations of annotations=============="); |
|
374 |
System.out.println(tests2); |
|
375 |
|
|
376 |
for (TestCQP match : tests2) { |
|
377 |
annotsOverlapped = cqpmanager.getAnnotations(null, match.start, match.end, true);//jpamanager.createAnnotation(T1, val4, 3, 3); |
|
378 |
System.out.println("Overlaps at "+match+" ? "+annotsOverlapped); |
|
379 |
} |
|
380 |
|
|
381 |
} catch (Exception e) { |
|
382 |
// TODO Bloc catch généré automatiquement |
|
383 |
e.printStackTrace(); |
|
384 |
} |
|
385 |
} |
|
386 |
|
|
387 |
public static void main(String [] args){ |
|
388 |
|
|
389 |
try { |
|
390 |
|
|
391 |
MainCorpus c = CorpusManager.getCorpusManager().getCorpus("ANNOTATION"); |
|
392 |
if (c == null) return; |
|
393 |
InitializeKnowledgeRepository.get(c); |
|
394 |
KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository("localkrfortesting", c); |
|
395 |
AnnotationManager am = c.getAnnotationManager(); |
|
396 |
|
|
397 |
for (String test : args) { |
|
398 |
System.out.println("******************** *** ********************"); |
|
399 |
System.out.println("******************** "+test+" ********************"); |
|
400 |
System.out.println("******************** *** ********************"); |
|
401 |
if (test.matches("JPA")) { |
|
402 |
checkingJPAManager(kr, c, am); |
|
403 |
} else if (test.matches("CQP")) { |
|
404 |
checkingCQPManager(kr, c, am); |
|
405 |
} else if (test.matches("ALL")) { |
|
406 |
checkingAnnotationManager(kr, c, am); |
|
407 |
} |
|
408 |
} |
|
409 |
} catch (Exception e) { |
|
410 |
e.printStackTrace(); |
|
411 |
} |
|
412 |
} |
|
413 |
} |
|
0 | 414 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/adapters/BaseAdapterFactory.java (revision 100) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
package org.txm.rcp.adapters; |
|
3 |
|
|
4 |
import org.eclipse.core.runtime.IAdapterFactory; |
|
5 |
import org.eclipse.ui.model.IWorkbenchAdapter; |
|
6 |
|
|
7 |
|
|
8 |
/** |
|
9 |
* A factory for creating Adapter objects. |
|
10 |
* Adapters are used to define icon and label in the tree of the corpor view. |
|
11 |
* |
|
12 |
* @author mdecorde |
|
13 |
* @author sjacquot |
|
14 |
*/ |
|
15 |
public abstract class BaseAdapterFactory implements IAdapterFactory { |
|
16 |
|
|
17 |
|
|
18 |
/** |
|
19 |
* Gets the adapter list. |
|
20 |
* |
|
21 |
* @return the adapter list |
|
22 |
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() |
|
23 |
*/ |
|
24 |
@Override |
|
25 |
@SuppressWarnings("unchecked") //$NON-NLS-1$ |
|
26 |
public Class[] getAdapterList() { |
|
27 |
return new Class[] { IWorkbenchAdapter.class}; |
|
28 |
} |
|
29 |
|
|
30 |
} |
|
0 | 31 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java (revision 100) | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package org.txm.rcp.editors; |
|
5 |
|
|
6 |
import org.eclipse.jface.action.ToolBarManager; |
|
7 |
import org.eclipse.swt.SWT; |
|
8 |
import org.eclipse.swt.layout.FillLayout; |
|
9 |
import org.eclipse.swt.layout.FormLayout; |
|
10 |
import org.eclipse.swt.widgets.Composite; |
|
11 |
import org.eclipse.swt.widgets.ToolBar; |
|
12 |
import org.eclipse.ui.menus.IMenuService; |
|
13 |
import org.eclipse.ui.part.EditorPart; |
|
14 |
|
|
15 |
/** |
|
16 |
* Base TXM <code>EditorPart</code>. |
|
17 |
* |
|
18 |
* @author sjacquot |
|
19 |
* |
|
20 |
*/ |
|
21 |
public abstract class TXMEditorPart extends EditorPart { |
|
22 |
|
|
23 |
|
|
24 |
//protected Composite toolBarsComposite; |
|
25 |
|
|
26 |
/** |
|
27 |
* |
|
28 |
*/ |
|
29 |
public TXMEditorPart() { |
|
30 |
// TODO Auto-generated constructor stub |
|
31 |
} |
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
@Override |
|
36 |
public void createPartControl(Composite parent) { |
|
37 |
|
|
38 |
|
|
39 |
// //FillLayout mainLayout = new FillLayout(SWT.VERTICAL); |
|
40 |
//// mainLayout.marginTop = 3; |
|
41 |
//// mainLayout.marginLeft = 0; |
|
42 |
//// mainLayout.spacing = 3; |
|
43 |
// //parent.setLayout(mainLayout); |
|
44 |
// |
|
45 |
// FormLayout mainLayout = new FormLayout(); |
|
46 |
// mainLayout.marginTop = 3; |
|
47 |
// mainLayout.marginLeft = 0; |
|
48 |
// mainLayout.spacing = 3; |
|
49 |
// parent.setLayout(mainLayout); |
|
50 |
// |
|
51 |
// |
|
52 |
//// parent.setLayout(new RowLayout(SWT.VERTICAL)); |
|
53 |
// |
|
54 |
//// RowLayout mainLayout = new RowLayout(SWT.VERTICAL); |
|
55 |
//// //FillLayout fillLayout = new FillLayout(); |
|
56 |
////// mainLayout.marginTop = 3; |
|
57 |
////// mainLayout.marginLeft = 0; |
|
58 |
//// parent.setLayout(mainLayout); |
|
59 |
// |
|
60 |
// toolBarsComposite = new Composite(parent, SWT.NONE); |
|
61 |
// |
|
62 |
// //toolBarsComposite.setLayoutData(new FormData()); |
|
63 |
// |
|
64 |
// |
|
65 |
// toolBarsComposite.setLayout(new FillLayout()); |
|
66 |
|
|
67 |
|
|
68 |
// FIXME: parameter tool bar tests |
|
69 |
// ExpandBar bar = new ExpandBar(parent, SWT.FLAT); |
|
70 |
// Composite composite = new Composite(bar, SWT.NONE); |
|
71 |
// FillLayout layout = new FillLayout(); |
|
72 |
//// layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10; |
|
73 |
//// layout.verticalSpacing = 10; |
|
74 |
// composite.setLayout(layout); |
|
75 |
// |
|
76 |
// composite.setSize(500, 500); |
|
77 |
// |
|
78 |
// ToolBar toolBar = new ToolBar(composite, SWT.FLAT); |
|
79 |
// |
|
80 |
//// Button button = new Button(toolBar, SWT.PUSH); |
|
81 |
//// button.setText("SWT.PUSH"); |
|
82 |
//// button = new Button(toolBar, SWT.RADIO); |
|
83 |
//// button.setText("SWT.RADIO"); |
|
84 |
//// button = new Button(toolBar, SWT.CHECK); |
|
85 |
//// button.setText("SWT.CHECK"); |
|
86 |
//// button = new Button(toolBar, SWT.TOGGLE); |
|
87 |
//// button.setText("SWT.TOGGLE"); |
|
88 |
// |
|
89 |
// ToolBarManager manager = new ToolBarManager(toolBar); |
|
90 |
// IMenuService menuService = (IMenuService) this.getSite().getService(IMenuService.class); |
|
91 |
// menuService.populateContributionManager(manager, "toolbar:EditorParametersToolBar"); //$NON-NLS-1$ |
|
92 |
// |
|
93 |
// |
|
94 |
// ExpandItem item = new ExpandItem(bar, SWT.NONE); |
|
95 |
// item.setText("item 1"); |
|
96 |
// item.setControl(composite); |
|
97 |
// |
|
98 |
// //item.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); |
|
99 |
// item.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); |
|
100 |
|
|
101 |
|
|
102 |
// ToolBar toolBar = new ToolBar(toolBarsComposite, SWT.FLAT); |
|
103 |
// ToolBarManager manager = new ToolBarManager(toolBar); |
|
104 |
// IMenuService menuService = (IMenuService) this.getSite().getService(IMenuService.class); |
|
105 |
// menuService.populateContributionManager(manager, "toolbar:EditorParametersToolBar"); //$NON-NLS-1$ |
|
106 |
|
|
107 |
|
|
108 |
} |
|
109 |
|
|
110 |
|
|
111 |
@Override |
|
112 |
public void setPartName(String partName) { |
|
113 |
super.setPartName(partName); |
|
114 |
} |
|
115 |
|
|
116 |
|
|
117 |
@Override |
|
118 |
protected void setContentDescription(String description) { |
|
119 |
super.setContentDescription(description); |
|
120 |
} |
|
121 |
|
|
122 |
|
|
123 |
} |
|
0 | 124 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/IsXTZCorpus.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.testers; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import org.eclipse.core.expressions.PropertyTester; |
|
6 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
7 |
|
|
8 |
@SuppressWarnings("unchecked") |
|
9 |
public class IsXTZCorpus extends PropertyTester { |
|
10 |
|
|
11 |
public static final String PROPERTY_NAMESPACE = "org.txm.rcp.testers.corpus"; //$NON-NLS-1$ |
|
12 |
public static final String PROPERTY_CAN_SAVE = "xtzCorpus"; |
|
13 |
|
|
14 |
@Override |
|
15 |
public boolean test(Object receiver, String property, Object[] args, |
|
16 |
Object expectedValue) { |
|
17 |
|
|
18 |
if (receiver instanceof List) { |
|
19 |
|
|
20 |
List<Object> list = (List<Object>)receiver; |
|
21 |
if (list.size() == 0) return false; |
|
22 |
receiver = list.get(0); |
|
23 |
} else if (receiver instanceof Corpus) { |
|
24 |
Corpus c = (Corpus) receiver; |
|
25 |
String script = c.getScript(); |
|
26 |
if (script == null) return false; |
|
27 |
return script.startsWith("xtz"); |
|
28 |
} |
|
29 |
return false; |
|
30 |
} |
|
31 |
} |
|
0 | 32 |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/ToolboxTester.java (revision 100) | ||
---|---|---|
1 |
package org.txm.rcp.testers; |
|
2 |
|
|
3 |
import org.eclipse.core.expressions.PropertyTester; |
|
4 |
import org.txm.Toolbox; |
|
5 |
|
|
6 |
/** |
|
7 |
* PropertyTester to check Toolbox states |
|
8 |
* |
|
9 |
* @author mdecorde |
|
10 |
* |
|
11 |
*/ |
|
12 |
public class ToolboxTester extends PropertyTester { |
|
13 |
|
|
14 |
public static final String PROPERTY_NAMESPACE = "org.txm.rcp.testers.engines"; //$NON-NLS-1$ |
|
15 |
|
|
16 |
public static final String PROPERTY_STATE_ENGINE_READY = "StateEngineReady"; //$NON-NLS-1$ |
|
17 |
public static final String PROPERTY_SEARCH_ENGINE_READY = "SearchEngineReady"; //$NON-NLS-1$ |
|
18 |
|
|
19 |
public ToolboxTester() { |
|
20 |
// TODO Auto-generated constructor stub |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
public boolean test(Object receiver, String property, Object[] args, |
|
25 |
Object expectedValue) { |
|
26 |
if (PROPERTY_STATE_ENGINE_READY.equals(property)) { |
|
27 |
System.out.println("TEST: "+property+" = "+Toolbox.isStatEngineInitialized()); //$NON-NLS-1$ //$NON-NLS-2$ |
|
28 |
return Toolbox.isStatEngineInitialized(); |
|
29 |
} else if (PROPERTY_SEARCH_ENGINE_READY.equals(property)) { |
|
30 |
System.out.println("TEST: "+property+" = "+Toolbox.isSearchEngineInitialized()); //$NON-NLS-1$ //$NON-NLS-2$ |
|
31 |
return Toolbox.isSearchEngineInitialized(); |
|
32 |
} |
|
33 |
|
|
34 |
return false; |
|
35 |
} |
|
36 |
} |
|
0 | 37 |
Formats disponibles : Unified diff