Révision 35
tmp/org.txm.progression.rcp/plugin.xml (revision 35) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<?eclipse version="3.4"?> |
|
3 |
<plugin> |
|
4 |
<extension |
|
5 |
point="org.eclipse.ui.preferencePages"> |
|
6 |
<page |
|
7 |
category="org.txm.rcpapplication.preferences.UserPreferencePage" |
|
8 |
class="org.txm.progression.rcp.preferences.ProgressionPreferencePage" |
|
9 |
id="org.txm.rcp.progression.preferences.ProgressionPreferencePage" |
|
10 |
name="%page.name"> |
|
11 |
</page> |
|
12 |
</extension> |
|
13 |
<extension |
|
14 |
point="org.eclipse.ui.commands"> |
|
15 |
<command |
|
16 |
categoryId="org.txm.rcpapplication.category.txm" |
|
17 |
defaultHandler="org.txm.progression.rcp.handlers.ComputeProgression" |
|
18 |
id="ComputeProgression" |
|
19 |
name="%command.name"> |
|
20 |
</command> |
|
21 |
</extension> |
|
22 |
<extension |
|
23 |
point="org.eclipse.ui.menus"> |
|
24 |
<menuContribution |
|
25 |
allPopups="false" |
|
26 |
locationURI="toolbar:org.txm.rcpapplication.toolbartools"> |
|
27 |
<command |
|
28 |
commandId="ComputeProgression" |
|
29 |
icon="icons/functions/progression.png" |
|
30 |
label="%command.label" |
|
31 |
style="push" |
|
32 |
tooltip="%command.tooltip"> |
|
33 |
<visibleWhen |
|
34 |
checkEnabled="false"> |
|
35 |
<or> |
|
36 |
<reference |
|
37 |
definitionId="OneCorpusSelected"> |
|
38 |
</reference> |
|
39 |
</or> |
|
40 |
</visibleWhen> |
|
41 |
</command> |
|
42 |
</menuContribution> |
|
43 |
<menuContribution |
|
44 |
allPopups="false" |
|
45 |
locationURI="popup:org.txm.rcpapplication.views.CorporaView"> |
|
46 |
<command |
|
47 |
commandId="ComputeProgression" |
|
48 |
icon="icons/functions/progression.png" |
|
49 |
label="%command.label" |
|
50 |
style="push" |
|
51 |
tooltip="%command.tooltip"> |
|
52 |
<visibleWhen |
|
53 |
checkEnabled="false"> |
|
54 |
<or> |
|
55 |
<reference |
|
56 |
definitionId="OneCorpusSelected"> |
|
57 |
</reference> |
|
58 |
</or> |
|
59 |
</visibleWhen> |
|
60 |
</command> |
|
61 |
</menuContribution> |
|
62 |
<menuContribution |
|
63 |
locationURI="menu:menu.tools"> |
|
64 |
<command |
|
65 |
commandId="ComputeProgression" |
|
66 |
icon="icons/functions/progression.png" |
|
67 |
label="%command.label" |
|
68 |
style="push" |
|
69 |
tooltip="%command.tooltip"> |
|
70 |
<visibleWhen |
|
71 |
checkEnabled="false"> |
|
72 |
<or> |
|
73 |
<reference |
|
74 |
definitionId="OneCorpusSelected"> |
|
75 |
</reference> |
|
76 |
</or> |
|
77 |
</visibleWhen> |
|
78 |
</command> |
|
79 |
</menuContribution> |
|
80 |
</extension> |
|
81 |
<extension |
|
82 |
point="org.txm.chartsengine.eventcallback"> |
|
83 |
<EventCallBack |
|
84 |
chartsEngineName="jfreechart_charts_engine" |
|
85 |
class="org.txm.progression.rcp.chartsengine.jfreechart.events.ProgressionEventCallBack" |
|
86 |
resultDataClass="org.txm.progression.tbx.functions.Progression2"> |
|
87 |
</EventCallBack> |
|
88 |
</extension> |
|
89 |
<extension |
|
90 |
point="org.eclipse.core.runtime.adapters"> |
|
91 |
<factory |
|
92 |
adaptableType="org.txm.progression.core.functions.Progression2" |
|
93 |
class="org.txm.progression.rcp.adapters.ProgressionAdapterFactory"> |
|
94 |
<adapter |
|
95 |
type="org.eclipse.ui.model.IWorkbenchAdapter"> |
|
96 |
</adapter> |
|
97 |
</factory> |
|
98 |
</extension> |
|
99 |
<extension |
|
100 |
point="org.eclipse.ui.editors"> |
|
101 |
<editor |
|
102 |
class="org.txm.chartsengine.rcp.editors.ChartEditorPart" |
|
103 |
default="false" |
|
104 |
icon="icons/functions/progression.png" |
|
105 |
id="org.txm.progression.core.functions.Progression2" |
|
106 |
name="Progression"> |
|
107 |
</editor> |
|
108 |
</extension> |
|
109 |
|
|
110 |
</plugin> |
|
0 | 111 |
tmp/org.txm.progression.rcp/.settings/org.eclipse.jdt.core.prefs (revision 35) | ||
---|---|---|
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.progression.rcp/.classpath (revision 35) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> |
|
4 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> |
|
5 |
<classpathentry kind="src" path="src"/> |
|
6 |
<classpathentry kind="output" path="bin"/> |
|
7 |
</classpath> |
|
0 | 8 |
tmp/org.txm.progression.rcp/META-INF/MANIFEST.MF (revision 35) | ||
---|---|---|
1 |
Manifest-Version: 1.0 |
|
2 |
Bundle-ManifestVersion: 2 |
|
3 |
Bundle-Name: %Bundle-Name |
|
4 |
Bundle-SymbolicName: org.txm.progression.rcp;singleton:=true |
|
5 |
Bundle-Version: 1.0.0.qualifier |
|
6 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
|
7 |
Require-Bundle: org.txm.chartsengine.jfreechart.core;bundle-version="1.0.0", |
|
8 |
org.eclipse.swt, |
|
9 |
org.txm.rcpapplication, |
|
10 |
org.txm.chartsengine.core, |
|
11 |
org.txm.chartsengine.r.core;bundle-version="1.0.0", |
|
12 |
org.eclipse.core.runtime;bundle-version="3.10.0", |
|
13 |
org.txm.chartsengine.svgbatik.rcp;bundle-version="1.0.0", |
|
14 |
org.txm.progression.core;bundle-version="1.0.0", |
|
15 |
org.txm.chartsengine.rcp;bundle-version="1.0.0" |
|
16 |
Export-Package: org.txm.progression.rcp.adapters |
|
0 | 17 |
tmp/org.txm.progression.rcp/.project (revision 35) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.txm.progression.rcp</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>org.eclipse.pde.ManifestBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
<buildCommand> |
|
19 |
<name>org.eclipse.pde.SchemaBuilder</name> |
|
20 |
<arguments> |
|
21 |
</arguments> |
|
22 |
</buildCommand> |
|
23 |
</buildSpec> |
|
24 |
<natures> |
|
25 |
<nature>org.eclipse.pde.PluginNature</nature> |
|
26 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
27 |
</natures> |
|
28 |
</projectDescription> |
|
0 | 29 |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java (revision 35) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.progression.rcp.preferences; |
|
29 |
|
|
30 |
import org.apache.batik.gvt.event.SelectionAdapter; |
|
31 |
import org.apache.batik.gvt.event.SelectionEvent; |
|
32 |
import org.eclipse.jface.preference.BooleanFieldEditor; |
|
33 |
import org.eclipse.swt.SWT; |
|
34 |
import org.eclipse.swt.layout.GridData; |
|
35 |
import org.eclipse.swt.widgets.Button; |
|
36 |
import org.eclipse.swt.widgets.Composite; |
|
37 |
import org.eclipse.swt.widgets.Group; |
|
38 |
import org.eclipse.swt.widgets.TabFolder; |
|
39 |
import org.eclipse.swt.widgets.TabItem; |
|
40 |
import org.eclipse.ui.IWorkbench; |
|
41 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
|
42 |
import org.txm.progression.core.preferences.ProgressionPreferences; |
|
43 |
import org.txm.progression.rcp.messages.RCPProgressionMessages; |
|
44 |
import org.txm.rcp.preferences.TXMPreferencePage; |
|
45 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
|
46 |
import org.txm.rcpapplication.TxmPreferences; |
|
47 |
import org.txm.rcpapplication.jface.DoubleFieldEditor; |
|
48 |
// TODO: Auto-generated Javadoc |
|
49 |
/** |
|
50 |
* This class represents a preference page that is contributed to the |
|
51 |
* Preferences dialog. By subclassing <samp>FieldEditorPreferencePage</samp>, we |
|
52 |
* can use the field support built into JFace that allows us to create a page |
|
53 |
* that is small and knows how to save, restore and apply itself. |
|
54 |
* <p> |
|
55 |
* This page is used to modif y preferences only. They are stored in the |
|
56 |
* preference store that belongs to the main plug-in class. That way, |
|
57 |
* preferences can be accessed directly via the preference store. |
|
58 |
*/ |
|
59 |
|
|
60 |
public class ProgressionPreferencePage extends TXMPreferencePage { |
|
61 |
|
|
62 |
/** The Constant ID. */ |
|
63 |
public static final String ID = "org.txm.rcp.progression.preferences.ProgressionPreferencePage"; //$NON-NLS-1$ |
|
64 |
|
|
65 |
/** The bande multiplier field. */ |
|
66 |
private DoubleFieldEditor bandemultiplierfield; |
|
67 |
|
|
68 |
|
|
69 |
/** |
|
70 |
* Instantiates a new progression preference page. |
|
71 |
*/ |
|
72 |
public ProgressionPreferencePage() { |
|
73 |
super(); |
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
/** |
|
78 |
* |
|
79 |
* @return |
|
80 |
*/ |
|
81 |
public static TXMPreferenceStore getNewPreferenceStore() { |
|
82 |
return new TXMPreferenceStore(ProgressionPreferences.PREFERENCES_NODE); |
|
83 |
} |
|
84 |
|
|
85 |
|
|
86 |
/** |
|
87 |
* Creates the field editors. Field editors are abstractions of the common |
|
88 |
* GUI blocks needed to manipulate various types of preferences. Each field |
|
89 |
* editor knows how to save and restore itself. |
|
90 |
*/ |
|
91 |
@Override |
|
92 |
public void createFieldEditors() { |
|
93 |
|
|
94 |
|
|
95 |
// FIXME: tabbed preferences page test |
|
96 |
// TabFolder tabFolder = new TabFolder(this.getFieldEditorParent(), SWT.TOP); |
|
97 |
// tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
|
98 |
//// for(int i = 1; i < 4; i++) { |
|
99 |
// TabItem tabItem = new TabItem(tabFolder, SWT.NULL); |
|
100 |
// tabItem.setText("Graphiques"); |
|
101 |
// Composite composite = new Composite(tabFolder, SWT.NULL); |
|
102 |
// tabItem.setControl(composite); |
|
103 |
// this.addField(new BooleanFieldEditor(ProgressionPreferences.CUMULATIVE, RCPProgressionMessages.ProgressionPreferencePage_3, composite)); |
|
104 |
//// } |
|
105 |
|
|
106 |
|
|
107 |
// Charts rendering |
|
108 |
Group chartsGroup = SWTChartsComponentsProvider.createChartsRenderingPreferencesGroup(this.getFieldEditorParent()); |
|
109 |
|
|
110 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.CUMULATIVE, RCPProgressionMessages.ProgressionPreferencePage_3, chartsGroup)); |
|
111 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.MONOCHROMATIC, RCPProgressionMessages.ProgressionPreferencePage_4, chartsGroup)); |
|
112 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.MONO_STYLE, RCPProgressionMessages.ProgressionPreferencePage_5, chartsGroup)); |
|
113 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.REPEAT_VALUES, RCPProgressionMessages.ProgressionPreferencePage_6, chartsGroup)); |
|
114 |
|
|
115 |
|
|
116 |
float test = TxmPreferences.getFloat(ProgressionPreferences.BANDE_MULTIPLIER, 999f); |
|
117 |
if (test == 999f) { |
|
118 |
TxmPreferences.set(ProgressionPreferences.BANDE_MULTIPLIER, 1.0f); |
|
119 |
} |
|
120 |
|
|
121 |
DoubleFieldEditor bandemultiplierfield = new DoubleFieldEditor(ProgressionPreferences.BANDE_MULTIPLIER, RCPProgressionMessages.ProgressionPreferencePage_7, chartsGroup); |
|
122 |
this.addField(bandemultiplierfield); |
|
123 |
// FIXME: valid range |
|
124 |
//if (bandemultiplierfield.getIntValue() == 0) |
|
125 |
// bandemultiplierfield.setStringValue("1"); |
|
126 |
//bandemultiplierfield.setValidRange(1, 10); |
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
} |
|
132 |
|
|
133 |
@Override |
|
134 |
public void init(IWorkbench workbench) { |
|
135 |
this.setPreferenceStore(getNewPreferenceStore()); |
|
136 |
//setDescription("Progression"); |
|
137 |
this.setTitle(RCPProgressionMessages.ProgressionPreferencePage_2); |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
} |
|
0 | 142 |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/dialogs/ProgressionDialog.java (revision 35) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.progression.rcp.dialogs; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.List; |
|
32 |
import java.util.regex.Pattern; |
|
33 |
import java.util.regex.PatternSyntaxException; |
|
34 |
|
|
35 |
import org.eclipse.jface.dialogs.Dialog; |
|
36 |
import org.eclipse.swt.SWT; |
|
37 |
import org.eclipse.swt.custom.ScrolledComposite; |
|
38 |
import org.eclipse.swt.events.SelectionEvent; |
|
39 |
import org.eclipse.swt.events.SelectionListener; |
|
40 |
import org.eclipse.swt.layout.FormAttachment; |
|
41 |
import org.eclipse.swt.layout.FormData; |
|
42 |
import org.eclipse.swt.layout.FormLayout; |
|
43 |
import org.eclipse.swt.layout.GridData; |
|
44 |
import org.eclipse.swt.layout.GridLayout; |
|
45 |
import org.eclipse.swt.widgets.Button; |
|
46 |
import org.eclipse.swt.widgets.Combo; |
|
47 |
import org.eclipse.swt.widgets.Composite; |
|
48 |
import org.eclipse.swt.widgets.Control; |
|
49 |
import org.eclipse.swt.widgets.Event; |
|
50 |
import org.eclipse.swt.widgets.Group; |
|
51 |
import org.eclipse.swt.widgets.Label; |
|
52 |
import org.eclipse.swt.widgets.Listener; |
|
53 |
import org.eclipse.swt.widgets.Shell; |
|
54 |
import org.eclipse.swt.widgets.Text; |
|
55 |
import org.txm.progression.core.functions.Progression2; |
|
56 |
import org.txm.progression.core.preferences.ProgressionPreferences; |
|
57 |
import org.txm.progression.rcp.preferences.ProgressionPreferencePage; |
|
58 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
|
59 |
import org.txm.rcpapplication.Messages; |
|
60 |
import org.txm.rcpapplication.StatusLine; |
|
61 |
import org.txm.rcpapplication.TxmPreferences; |
|
62 |
import org.txm.rcpapplication.swt.widget.AssistedQueryWidget; |
|
63 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
64 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
|
65 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
|
66 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
67 |
import org.txm.utils.logger.Log; |
|
68 |
|
|
69 |
/** |
|
70 |
* Allow the user to choose : the type of the graphic the structural units, |
|
71 |
* property and values to be shown the queries of each curves. |
|
72 |
* |
|
73 |
* @author mdecorde |
|
74 |
* @author sjacquot |
|
75 |
*/ |
|
76 |
public class ProgressionDialog extends Dialog { |
|
77 |
|
|
78 |
/** The query widgets. */ |
|
79 |
protected List<AssistedQueryWidget> queryWidgets = new ArrayList<AssistedQueryWidget>(); |
|
80 |
|
|
81 |
/** The queries. */ |
|
82 |
List<Query> queries; |
|
83 |
|
|
84 |
/** The corpus. */ |
|
85 |
private Corpus corpus; |
|
86 |
|
|
87 |
/** The selected structural unit. */ |
|
88 |
private StructuralUnit selectedStructuralUnit; |
|
89 |
|
|
90 |
/** The selected structural unit property. */ |
|
91 |
private StructuralUnitProperty selectedStructuralUnitProperty; |
|
92 |
|
|
93 |
/** The regexproperty value. */ |
|
94 |
private String regexpropertyValue; |
|
95 |
|
|
96 |
/** The graphtype. */ |
|
97 |
private boolean cumulative = true; |
|
98 |
|
|
99 |
/** The monochrome. */ |
|
100 |
private boolean monochrome = true; |
|
101 |
|
|
102 |
/** The monostyle. */ |
|
103 |
private boolean monostyle = true; |
|
104 |
|
|
105 |
/** The repeatvalues. */ |
|
106 |
private boolean repeatvalues = false; |
|
107 |
|
|
108 |
/** The linewidth. */ |
|
109 |
private int linewidth = 2; |
|
110 |
|
|
111 |
/** The bandemultiplier. */ |
|
112 |
private float bandemultiplier = 2; |
|
113 |
|
|
114 |
/** The structural units combo. */ |
|
115 |
Combo structuralUnitsCombo; |
|
116 |
|
|
117 |
/** The structural units. */ |
|
118 |
List<StructuralUnit> structuralUnits; |
|
119 |
|
|
120 |
/** The structural units properties. */ |
|
121 |
List<StructuralUnitProperty> structuralUnitsProperties; |
|
122 |
|
|
123 |
/** The property combo. */ |
|
124 |
private Combo propertyCombo; |
|
125 |
|
|
126 |
/** The regex value. */ |
|
127 |
private Text regexValue; |
|
128 |
|
|
129 |
/** The focus composite. */ |
|
130 |
Composite focusComposite; |
|
131 |
|
|
132 |
/** The main panel. */ |
|
133 |
Composite mainPanel; |
|
134 |
|
|
135 |
/** The bande field. */ |
|
136 |
Text bandeField; |
|
137 |
|
|
138 |
/** The cumu button. */ |
|
139 |
Button cumuButton; |
|
140 |
|
|
141 |
/** The repeat button. */ |
|
142 |
Button repeatButton; |
|
143 |
|
|
144 |
/** The color button. */ |
|
145 |
Button colorButton; |
|
146 |
|
|
147 |
/** The style button. */ |
|
148 |
Button styleButton; |
|
149 |
|
|
150 |
/** The colors. */ |
|
151 |
String[] colors = Progression2.colors; |
|
152 |
|
|
153 |
/** The self. */ |
|
154 |
ProgressionDialog self; |
|
155 |
|
|
156 |
/** The parent. */ |
|
157 |
private Composite parent; |
|
158 |
|
|
159 |
private ScrolledComposite sc1; |
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
/** |
|
164 |
* Instantiates a new progression dialog. |
|
165 |
* |
|
166 |
* @param parentShell the parent shell |
|
167 |
* @param corpus the corpus |
|
168 |
*/ |
|
169 |
public ProgressionDialog(Shell parentShell, Corpus corpus) { |
|
170 |
super(parentShell); |
|
171 |
this.corpus = corpus; |
|
172 |
this.setShellStyle(this.getShellStyle() | SWT.RESIZE); |
|
173 |
} |
|
174 |
|
|
175 |
/** |
|
176 |
* Instantiates a new progression dialog. |
|
177 |
* |
|
178 |
* @param parentShell the parent shell |
|
179 |
* @param corpus the corpus |
|
180 |
* @param queries the queries |
|
181 |
*/ |
|
182 |
public ProgressionDialog(Shell parentShell, Corpus corpus, |
|
183 |
List<Query> queries) { |
|
184 |
super(parentShell); |
|
185 |
this.corpus = corpus; |
|
186 |
this.queries = queries; |
|
187 |
this.setShellStyle(this.getShellStyle() | SWT.RESIZE); |
|
188 |
} |
|
189 |
|
|
190 |
/* (non-Javadoc) |
|
191 |
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) |
|
192 |
*/ |
|
193 |
@Override |
|
194 |
protected void configureShell(Shell newShell) { |
|
195 |
super.configureShell(newShell); |
|
196 |
newShell.setText(Messages.ProgressionDialog_0); |
|
197 |
newShell.setMinimumSize(300, 460); |
|
198 |
|
|
199 |
} |
|
200 |
|
|
201 |
/* (non-Javadoc) |
|
202 |
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) |
|
203 |
*/ |
|
204 |
@Override |
|
205 |
protected Control createDialogArea(Composite p) { |
|
206 |
try { |
|
207 |
this.self = this; |
|
208 |
this.parent = p; |
|
209 |
|
|
210 |
// get preferences values |
|
211 |
TXMPreferenceStore store = ProgressionPreferencePage.getNewPreferenceStore(); |
|
212 |
this.monochrome = store.getBoolean(ProgressionPreferences.MONOCHROMATIC); |
|
213 |
this.monostyle = store.getBoolean(ProgressionPreferences.MONO_STYLE); |
|
214 |
this.cumulative = store.getBoolean(ProgressionPreferences.CUMULATIVE); |
|
215 |
this.repeatvalues = store.getBoolean(ProgressionPreferences.REPEAT_VALUES); |
|
216 |
this.bandemultiplier = store.getFloat(ProgressionPreferences.BANDE_MULTIPLIER); |
|
217 |
|
|
218 |
// System.out.println(parent.getLayout()); |
|
219 |
FormLayout mainlayout = new FormLayout(); |
|
220 |
mainPanel = new Composite(parent, SWT.NONE); |
|
221 |
mainPanel.setLayout(mainlayout); |
|
222 |
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true); |
|
223 |
mainPanel.setLayoutData(gridData); |
|
224 |
|
|
225 |
Composite paramPanel = new Composite(mainPanel, SWT.NONE); |
|
226 |
// set the QueryWidget's tab |
|
227 |
|
|
228 |
sc1 = new ScrolledComposite(mainPanel, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); |
|
229 |
sc1.setLayout(new GridLayout(1, true)); |
|
230 |
sc1.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
231 |
sc1.setExpandHorizontal( true ); |
|
232 |
sc1.setExpandVertical( true ); |
|
233 |
sc1.setMinSize( 0, 250 ); |
|
234 |
|
|
235 |
focusComposite = new Composite(sc1, SWT.NONE); |
|
236 |
focusComposite.setLayout(new GridLayout(1, true)); |
|
237 |
sc1.setContent(focusComposite); |
|
238 |
|
|
239 |
FormData paramPanelData = new FormData(); |
|
240 |
paramPanelData.top = new FormAttachment(0); |
|
241 |
paramPanelData.left = new FormAttachment(0); |
|
242 |
paramPanelData.right = new FormAttachment(100); |
|
243 |
paramPanel.setLayoutData(paramPanelData); |
|
244 |
|
|
245 |
FormData queriesPanelData = new FormData(); |
|
246 |
queriesPanelData.top = new FormAttachment(paramPanel); |
|
247 |
queriesPanelData.left = new FormAttachment(0); |
|
248 |
queriesPanelData.right = new FormAttachment(100); |
|
249 |
queriesPanelData.bottom = new FormAttachment(100); |
|
250 |
sc1.setLayoutData(queriesPanelData); |
|
251 |
|
|
252 |
paramPanel.setLayout(new GridLayout(3, true)); |
|
253 |
|
|
254 |
// controls |
|
255 |
// graph param |
|
256 |
Label typeLabel = new Label(paramPanel, SWT.NONE); |
|
257 |
typeLabel.setText(Messages.ProgressionDialog_1); |
|
258 |
typeLabel.setAlignment(SWT.CENTER); |
|
259 |
|
|
260 |
cumuButton = new Button(paramPanel, SWT.RADIO); |
|
261 |
cumuButton.setText(Messages.ProgressionDialog_2); |
|
262 |
cumuButton.setSelection(cumulative); |
|
263 |
|
|
264 |
Button densityButton = new Button(paramPanel, SWT.RADIO); |
|
265 |
densityButton.setText(Messages.ProgressionDialog_3); |
|
266 |
densityButton.setSelection(!cumulative); |
|
267 |
|
|
268 |
//Bande size |
|
269 |
typeLabel = new Label(paramPanel, SWT.NONE); |
|
270 |
typeLabel.setText(Messages.ProgressionDialog_11); |
|
271 |
typeLabel.setAlignment(SWT.CENTER); |
|
272 |
|
|
273 |
bandeField = new Text(paramPanel, SWT.BORDER); |
|
274 |
bandeField.setText(""+bandemultiplier); //$NON-NLS-1$ |
|
275 |
bandeField.setLayoutData(new GridData(GridData.FILL, |
|
276 |
GridData.FILL, true, true, 2, 1)); |
|
277 |
// Structural units param |
|
278 |
Group displayParam = new Group(paramPanel, SWT.BORDER); |
|
279 |
displayParam.setText(Messages.ProgressionDialog_13); |
|
280 |
displayParam.setLayout(new GridLayout(3, true)); |
|
281 |
displayParam.setLayoutData(new GridData(GridData.FILL, |
|
282 |
GridData.FILL, true, true, 3, 1)); |
|
283 |
|
|
284 |
Label structLabel = new Label(displayParam, SWT.NONE); |
|
285 |
structLabel.setText(Messages.ProgressionDialog_4); |
|
286 |
structLabel.setAlignment(SWT.CENTER); |
|
287 |
|
|
288 |
structuralUnitsCombo = new Combo(displayParam, SWT.READ_ONLY); |
|
289 |
structuralUnitsCombo.setLayoutData(new GridData(GridData.FILL, |
|
290 |
GridData.FILL, true, true, 2, 1)); |
|
291 |
|
|
292 |
structuralUnitsCombo.addSelectionListener(new SelectionListener() { |
|
293 |
@Override |
|
294 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
295 |
} |
|
296 |
|
|
297 |
@Override |
|
298 |
public void widgetSelected(SelectionEvent event) { |
|
299 |
reloadProperties(); |
|
300 |
} |
|
301 |
}); |
|
302 |
|
|
303 |
try {// get |
|
304 |
structuralUnitsCombo.add(" "); //$NON-NLS-1$ |
|
305 |
structuralUnits = corpus.getOrderedStructuralUnits(); |
|
306 |
for (StructuralUnit unit : structuralUnits) { |
|
307 |
structuralUnitsCombo.add(unit.getName()); |
|
308 |
} |
|
309 |
} catch (Exception e) { |
|
310 |
Log.severe(Messages.ObjectExplorer_9 |
|
311 |
+ Log.toString(e)); |
|
312 |
return null; |
|
313 |
} |
|
314 |
structuralUnitsCombo.select(0); |
|
315 |
|
|
316 |
// if (structuralUnitsCombo.getItemCount() == 0) { |
|
317 |
// this.getButton(IDialogConstants.OK_ID).setEnabled(false); |
|
318 |
// } else { |
|
319 |
// selectedStructuralUnit = structuralUnits.get(0); |
|
320 |
// } |
|
321 |
|
|
322 |
// properties combo |
|
323 |
Label propLabel = new Label(displayParam, SWT.NONE); |
|
324 |
propLabel.setText(Messages.LexicalTable_1); |
|
325 |
propLabel.setAlignment(SWT.CENTER); |
|
326 |
|
|
327 |
propertyCombo = new Combo(displayParam, SWT.READ_ONLY); |
|
328 |
propertyCombo.setLayoutData(new GridData(GridData.FILL, |
|
329 |
GridData.FILL, true, true, 2, 1)); |
|
330 |
reloadProperties(); |
|
331 |
|
|
332 |
// property value field |
|
333 |
Label regexLabel = new Label(displayParam, SWT.NONE); |
|
334 |
regexLabel.setText(Messages.ProgressionDialog_7); |
|
335 |
regexLabel.setAlignment(SWT.CENTER); |
|
336 |
|
|
337 |
regexValue = new Text(displayParam, SWT.SINGLE | SWT.BORDER); |
|
338 |
regexValue.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
|
339 |
true, true, 2, 1)); |
|
340 |
|
|
341 |
//spacer |
|
342 |
styleButton = new Button(displayParam, SWT.CHECK); |
|
343 |
styleButton.setText(Messages.ProgressionDialog_14); |
|
344 |
styleButton.setSelection(monostyle); |
|
345 |
|
|
346 |
//Repeat options |
|
347 |
repeatButton = new Button(displayParam, SWT.CHECK); |
|
348 |
repeatButton.setText(Messages.ProgressionDialog_15); |
|
349 |
repeatButton.setSelection(repeatvalues); |
|
350 |
|
|
351 |
//Color options |
|
352 |
colorButton = new Button(displayParam, SWT.CHECK); |
|
353 |
colorButton.setText(Messages.ProgressionPreferencePage_4); |
|
354 |
colorButton.setSelection(monochrome); |
|
355 |
|
|
356 |
// queries param |
|
357 |
Label focusLabel = new Label(paramPanel, SWT.NONE); |
|
358 |
focusLabel.setText(Messages.ProgressionDialog_8); |
|
359 |
focusLabel.setAlignment(SWT.CENTER); |
|
360 |
|
|
361 |
Button plusButton = new Button(paramPanel, SWT.NONE); |
|
362 |
plusButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
|
363 |
true, true)); |
|
364 |
plusButton.setText(Messages.ProgressionDialog_9); |
|
365 |
plusButton.addListener(SWT.Selection, new Listener() { |
|
366 |
@Override |
|
367 |
public void handleEvent(Event event) { |
|
368 |
if (colors.length > queryWidgets.size()) { |
|
369 |
Log.info("add query field"); |
|
370 |
createTypeFocusField(); |
|
371 |
sc1.layout(true); |
|
372 |
focusComposite.layout(true); |
|
373 |
sc1.setMinSize(focusComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
|
374 |
} |
|
375 |
} |
|
376 |
}); |
|
377 |
|
|
378 |
Button minusButton = new Button(paramPanel, SWT.NONE); |
|
379 |
minusButton.setLayoutData(new GridData(GridData.FILL, |
|
380 |
GridData.FILL, true, true)); |
|
381 |
minusButton.setText(Messages.ProgressionDialog_5); |
|
382 |
minusButton.addListener(SWT.Selection, new Listener() { |
|
383 |
@Override |
|
384 |
public void handleEvent(Event event) { |
|
385 |
if (queryWidgets.size() > 0) { |
|
386 |
// System.out.println("remove field"); |
|
387 |
AssistedQueryWidget lastwidget = queryWidgets |
|
388 |
.get(queryWidgets.size() - 1); |
|
389 |
lastwidget.setSize(200, 30); |
|
390 |
queryWidgets.remove(queryWidgets.size() - 1); |
|
391 |
lastwidget.dispose(); |
|
392 |
sc1.layout(true); |
|
393 |
focusComposite.layout(true); |
|
394 |
sc1.setMinSize(focusComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
|
395 |
} |
|
396 |
} |
|
397 |
}); |
|
398 |
|
|
399 |
if (queries == null) { |
|
400 |
createTypeFocusField(); |
|
401 |
} else { |
|
402 |
for (Query q : queries) { |
|
403 |
createTypeFocusField().setText(q.getQueryString()); |
|
404 |
} |
|
405 |
} |
|
406 |
return mainPanel; |
|
407 |
} catch (Exception e) { |
|
408 |
Log.printStackTrace(e); |
|
409 |
} |
|
410 |
return null; |
|
411 |
} |
|
412 |
|
|
413 |
/** |
|
414 |
* Creates the type focus field. |
|
415 |
* |
|
416 |
* @return the assisted query widget |
|
417 |
*/ |
|
418 |
private AssistedQueryWidget createTypeFocusField() { |
|
419 |
AssistedQueryWidget focusTextBox = new AssistedQueryWidget( |
|
420 |
focusComposite, SWT.BORDER, this.corpus); |
|
421 |
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, |
|
422 |
false); |
|
423 |
focusTextBox.setLayoutData(gridData); |
|
424 |
|
|
425 |
queryWidgets.add(focusTextBox); |
|
426 |
return focusTextBox; |
|
427 |
} |
|
428 |
|
|
429 |
/* (non-Javadoc) |
|
430 |
* @see org.eclipse.jface.dialogs.Dialog#okPressed() |
|
431 |
*/ |
|
432 |
@Override |
|
433 |
protected void okPressed() { |
|
434 |
|
|
435 |
queries = new ArrayList<Query>(); |
|
436 |
for (AssistedQueryWidget wid : queryWidgets) { |
|
437 |
if (!wid.getQueryString().equals("\"\"")) //$NON-NLS-1$ |
|
438 |
{ |
|
439 |
queries.add(new Query(wid.getQueryString())); |
|
440 |
wid.memorize(); |
|
441 |
} |
|
442 |
} |
|
443 |
|
|
444 |
if (propertyCombo.getSelectionIndex() > 0) |
|
445 |
selectedStructuralUnitProperty = structuralUnitsProperties |
|
446 |
.get(propertyCombo.getSelectionIndex() - 1); |
|
447 |
else |
|
448 |
selectedStructuralUnitProperty = null; |
|
449 |
|
|
450 |
if (structuralUnitsCombo.getSelectionIndex() > 0) |
|
451 |
selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo |
|
452 |
.getSelectionIndex() - 1); |
|
453 |
else { |
|
454 |
selectedStructuralUnit = null; |
|
455 |
selectedStructuralUnitProperty = null;// need a structuralunit |
|
456 |
} |
|
457 |
|
|
458 |
try { |
|
459 |
Pattern.compile(regexValue.getText()); |
|
460 |
regexpropertyValue = regexValue.getText(); |
|
461 |
|
|
462 |
if (regexpropertyValue.length() == 0) |
|
463 |
regexpropertyValue = null; |
|
464 |
} catch (PatternSyntaxException e) { |
|
465 |
System.out.println(Messages.ProgressionDialog_10 + e); |
|
466 |
} |
|
467 |
|
|
468 |
cumulative = cumuButton.getSelection(); |
|
469 |
monochrome = colorButton.getSelection(); |
|
470 |
monostyle = styleButton.getSelection(); |
|
471 |
repeatvalues = repeatButton.getSelection(); |
|
472 |
String smultibande = bandeField.getText(); |
|
473 |
if (smultibande != null && smultibande.length() > 0) |
|
474 |
{ |
|
475 |
try |
|
476 |
{ bandemultiplier = Float.parseFloat(smultibande); |
|
477 |
|
|
478 |
}catch(Exception e){ |
|
479 |
bandemultiplier = 1.0f; |
|
480 |
System.out.println(Messages.ProgressionDialog_17+e); |
|
481 |
StatusLine.error(Messages.ProgressionDialog_17+e); |
|
482 |
} |
|
483 |
} |
|
484 |
else |
|
485 |
bandemultiplier = 1.0f; |
|
486 |
|
|
487 |
super.okPressed(); |
|
488 |
} |
|
489 |
|
|
490 |
/** |
|
491 |
* Reload properties. |
|
492 |
*/ |
|
493 |
private void reloadProperties() { |
|
494 |
propertyCombo.removeAll(); |
|
495 |
propertyCombo.add(" "); //$NON-NLS-1$ |
|
496 |
|
|
497 |
if (structuralUnitsCombo.getSelectionIndex() > 0) { |
|
498 |
selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo |
|
499 |
.getSelectionIndex() - 1); |
|
500 |
structuralUnitsProperties = selectedStructuralUnit.getOrderedProperties(); |
|
501 |
for (StructuralUnitProperty property : structuralUnitsProperties) { |
|
502 |
propertyCombo.add(property.getName()); |
|
503 |
} |
|
504 |
} |
|
505 |
if (propertyCombo.getItemCount() > 0) { |
|
506 |
propertyCombo.select(0); |
|
507 |
} |
|
508 |
} |
|
509 |
|
|
510 |
/** |
|
511 |
* Gets the corpus. |
|
512 |
* |
|
513 |
* @return the corpus |
|
514 |
*/ |
|
515 |
public Corpus getCorpus() { |
|
516 |
return corpus; |
|
517 |
} |
|
518 |
|
|
519 |
/** |
|
520 |
* Gets the queries. |
|
521 |
* |
|
522 |
* @return the queries |
|
523 |
*/ |
|
524 |
public List<Query> getQueries() { |
|
525 |
return queries; |
|
526 |
} |
|
527 |
|
|
528 |
/** |
|
529 |
* Gets the colors. |
|
530 |
* |
|
531 |
* @return the colors |
|
532 |
*/ |
|
533 |
public List<String> getColors() { |
|
534 |
return null; |
|
535 |
} |
|
536 |
|
|
537 |
/** |
|
538 |
* Gets the structural unit. |
|
539 |
* |
|
540 |
* @return the structural unit |
|
541 |
*/ |
|
542 |
public StructuralUnit getStructuralUnit() { |
|
543 |
return selectedStructuralUnit; |
|
544 |
} |
|
545 |
|
|
546 |
/** |
|
547 |
* Gets the graph type. |
|
548 |
* |
|
549 |
* @return the graph type |
|
550 |
*/ |
|
551 |
public boolean isCumulativeType() { |
|
552 |
return cumulative; |
|
553 |
} |
|
554 |
|
|
555 |
/** |
|
556 |
* Gets the bande multiplier. |
|
557 |
* |
|
558 |
* @return the bande multiplier |
|
559 |
*/ |
|
560 |
public float getBandeMultiplier() |
|
561 |
{ |
|
562 |
return bandemultiplier; |
|
563 |
} |
|
564 |
|
|
565 |
/** |
|
566 |
* Checks if is monochrome. |
|
567 |
* |
|
568 |
* @return true, if is monochrome |
|
569 |
*/ |
|
570 |
public boolean isMonochrome() { |
|
571 |
return monochrome; |
|
572 |
} |
|
573 |
|
|
574 |
/** |
|
575 |
* Checks if is repeatvalues. |
|
576 |
* |
|
577 |
* @return true, if is repeatvalues |
|
578 |
*/ |
|
579 |
public boolean isRepeatvalues() { |
|
580 |
return repeatvalues; |
|
581 |
} |
|
582 |
|
|
583 |
/** |
|
584 |
* Gets the structural property. |
|
585 |
* |
|
586 |
* @return the structural property |
|
587 |
*/ |
|
588 |
public StructuralUnitProperty getStructuralProperty() { |
|
589 |
return selectedStructuralUnitProperty; |
|
590 |
} |
|
591 |
|
|
592 |
/** |
|
593 |
* Gets the propertyregex. |
|
594 |
* |
|
595 |
* @return the propertyregex |
|
596 |
*/ |
|
597 |
public String getPropertyregex() { |
|
598 |
return regexpropertyValue; |
|
599 |
} |
|
600 |
|
|
601 |
/** |
|
602 |
* Checks if is mono style. |
|
603 |
* |
|
604 |
* @return true, if is mono style |
|
605 |
*/ |
|
606 |
public boolean isMonoStyle() { |
|
607 |
|
|
608 |
return monostyle; |
|
609 |
} |
|
610 |
|
|
611 |
/** |
|
612 |
* Gets the line width. |
|
613 |
* |
|
614 |
* @return the line width |
|
615 |
*/ |
|
616 |
public int getLineWidth() |
|
617 |
{ |
|
618 |
return linewidth; |
|
619 |
} |
|
620 |
} |
|
0 | 621 |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/adapters/ProgressionAdapterFactory.java (revision 35) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
package org.txm.progression.rcp.adapters; |
|
3 |
|
|
4 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
5 |
import org.eclipse.ui.model.IWorkbenchAdapter; |
|
6 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
7 |
import org.osgi.framework.FrameworkUtil; |
|
8 |
import org.txm.progression.core.functions.Progression2; |
|
9 |
import org.txm.rcp.adapters.BaseAdapterFactory; |
|
10 |
|
|
11 |
|
|
12 |
/** |
|
13 |
* A factory for creating Adapter objects. |
|
14 |
* |
|
15 |
* @author mdecorde |
|
16 |
* @author sjacquot |
|
17 |
*/ |
|
18 |
public class ProgressionAdapterFactory extends BaseAdapterFactory { |
|
19 |
|
|
20 |
|
|
21 |
/** |
|
22 |
* Gets the adapter. |
|
23 |
* |
|
24 |
* @param adaptableObject the adaptable object |
|
25 |
* @param adapterType the adapter type |
|
26 |
* @return the adapter |
|
27 |
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) |
|
28 |
*/ |
|
29 |
@Override |
|
30 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
|
31 |
|
|
32 |
if(adapterType == IWorkbenchAdapter.class) { |
|
33 |
if(adaptableObject instanceof Progression2) { |
|
34 |
return new IWorkbenchAdapter() { |
|
35 |
@Override |
|
36 |
public Object[] getChildren(Object resultData) { |
|
37 |
return new Object[0]; |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
42 |
return AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(ProgressionAdapterFactory.class).getSymbolicName(), "platform:/plugin/org.txm.progression.rcp/icons/functions/progression.png"); //$NON-NLS-1$ |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public String getLabel(Object resultData) { |
|
47 |
return ((Progression2) resultData).getDetails(); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public Object getParent(Object resultData) { |
|
52 |
return ((Progression2) resultData).getCorpus(); |
|
53 |
} |
|
54 |
}; |
|
55 |
} |
|
56 |
} |
|
57 |
return null; |
|
58 |
} |
|
59 |
|
|
60 |
|
|
61 |
} |
|
0 | 62 |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/forms/ProgressionParametersComposite.java (revision 35) | ||
---|---|---|
1 |
package org.txm.progression.rcp.forms; |
|
2 |
import org.eclipse.swt.SWT; |
|
3 |
import org.eclipse.swt.custom.SashForm; |
|
4 |
import org.eclipse.swt.custom.ScrolledComposite; |
|
5 |
import org.eclipse.swt.layout.FillLayout; |
|
6 |
import org.eclipse.swt.layout.GridData; |
|
7 |
import org.eclipse.swt.layout.GridLayout; |
|
8 |
import org.eclipse.swt.widgets.Button; |
|
9 |
import org.eclipse.swt.widgets.Combo; |
|
10 |
import org.eclipse.swt.widgets.Composite; |
|
11 |
import org.eclipse.swt.widgets.Label; |
|
12 |
import org.eclipse.swt.widgets.Table; |
|
13 |
import org.eclipse.swt.widgets.Text; |
|
14 |
import org.txm.rcpapplication.Messages; |
|
15 |
|
|
16 |
|
|
17 |
public class ProgressionParametersComposite extends Composite { |
|
18 |
SashForm sashForm; |
|
19 |
|
|
20 |
private Table table; |
|
21 |
private Text scaleTextEdit; |
|
22 |
private Text regTextEdit; |
|
23 |
|
|
24 |
Button btnSupprimer; |
|
25 |
Button cumulBtn; |
|
26 |
Button densiBtn; |
|
27 |
|
|
28 |
Combo structCombo; |
|
29 |
Combo propCombo; |
|
30 |
private Button styleRadio; |
|
31 |
private Button repeatRadio; |
|
32 |
private Button NBRadio; |
|
33 |
private Button btnNewButton; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* Creates the composite. |
|
38 |
* @param parent |
|
39 |
* @param style |
|
40 |
*/ |
|
41 |
public ProgressionParametersComposite(Composite parent, int style) { |
|
42 |
super(parent, style); |
|
43 |
|
|
44 |
|
|
45 |
//parent.setLayout(new GridLayout(1, true)); |
|
46 |
|
|
47 |
// ExpandBar bar = new ExpandBar(parent, SWT.NONE); |
|
48 |
|
|
49 |
// sashForm = new SashForm(parent, SWT.VERTICAL); |
|
50 |
// sashForm.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
ScrolledComposite scrolledComposite_1 = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); |
|
55 |
scrolledComposite_1.setExpandHorizontal(true); |
|
56 |
scrolledComposite_1.setExpandVertical(true); |
|
57 |
|
|
58 |
// Composite scrolledComposite_1 = new Composite(this, SWT.BORDER); |
|
59 |
|
|
60 |
Composite composite_1 = new Composite(scrolledComposite_1, SWT.NONE); |
|
61 |
composite_1.setLayout(new FillLayout(SWT.VERTICAL)); |
|
62 |
|
|
63 |
Composite composite = new Composite(composite_1, SWT.NONE); |
|
64 |
composite.setLayout(new GridLayout(5, false)); |
|
65 |
|
|
66 |
Label label = new Label(composite, SWT.NONE); |
|
67 |
GridData gd_label = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
|
68 |
gd_label.widthHint = 29; |
|
69 |
label.setLayoutData(gd_label); |
|
70 |
label.setText(Messages.ProgressionForm_0); |
|
71 |
|
|
72 |
cumulBtn = new Button(composite, SWT.RADIO); |
|
73 |
cumulBtn.setText(Messages.ProgressionForm_1); |
|
74 |
cumulBtn.setSelection(true); |
|
75 |
|
|
76 |
densiBtn = new Button(composite, SWT.RADIO); |
|
77 |
densiBtn.setText(Messages.ProgressionForm_2); |
|
78 |
|
|
79 |
Label lblEchelle = new Label(composite, SWT.NONE); |
|
80 |
lblEchelle.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
81 |
lblEchelle.setText(Messages.ProgressionForm_3); |
|
82 |
|
|
83 |
scaleTextEdit = new Text(composite, SWT.BORDER); |
|
84 |
scaleTextEdit.setText("1.0"); //$NON-NLS-1$ |
|
85 |
|
|
86 |
Label lblOptionsDaffichage = new Label(composite, SWT.NONE); |
|
87 |
lblOptionsDaffichage.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1)); |
|
88 |
lblOptionsDaffichage.setText(Messages.ProgressionForm_5); |
|
89 |
new Label(composite, SWT.NONE); |
|
90 |
|
|
91 |
Label label_6 = new Label(composite, SWT.NONE); |
|
92 |
label_6.setText(Messages.ProgressionForm_6); |
|
93 |
|
|
94 |
structCombo = new Combo(composite, SWT.NONE); |
|
95 |
|
|
96 |
Label label_5 = new Label(composite, SWT.NONE); |
|
97 |
label_5.setText(Messages.ProgressionForm_7); |
|
98 |
|
|
99 |
propCombo = new Combo(composite, SWT.NONE); |
|
100 |
propCombo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); |
|
101 |
new Label(composite, SWT.NONE); |
|
102 |
new Label(composite, SWT.NONE); |
|
103 |
|
|
104 |
Label label_7 = new Label(composite, SWT.NONE); |
|
105 |
label_7.setText(Messages.ProgressionForm_8); |
|
106 |
|
|
107 |
regTextEdit = new Text(composite, SWT.BORDER); |
|
108 |
regTextEdit.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); |
|
109 |
new Label(composite, SWT.NONE); |
|
110 |
|
|
111 |
styleRadio = new Button(composite, SWT.CHECK); |
|
112 |
styleRadio.setText(Messages.ProgressionForm_9); |
|
113 |
styleRadio.setSelection(true); |
|
114 |
|
|
115 |
repeatRadio = new Button(composite, SWT.CHECK); |
|
116 |
repeatRadio.setText(Messages.ProgressionForm_10); |
|
117 |
|
|
118 |
NBRadio = new Button(composite, SWT.CHECK); |
|
119 |
NBRadio.setText(Messages.ProgressionForm_11); |
|
120 |
new Label(composite, SWT.NONE); |
|
121 |
|
|
122 |
Composite composite_2 = new Composite(composite_1, SWT.NONE); |
|
123 |
composite_2.setLayout(new GridLayout(1, false)); |
|
124 |
|
|
125 |
Composite composite_3 = new Composite(composite_2, SWT.NONE); |
|
126 |
composite_3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); |
|
127 |
composite_3.setLayout(new FillLayout(SWT.HORIZONTAL)); |
|
128 |
|
|
129 |
Label lblRequetes = new Label(composite_3, SWT.NONE); |
|
130 |
lblRequetes.setText(Messages.ProgressionForm_12); |
|
131 |
|
|
132 |
btnNewButton = new Button(composite_3, SWT.NONE); |
|
133 |
btnNewButton.setText(Messages.ProgressionForm_13); |
|
134 |
|
|
135 |
btnSupprimer = new Button(composite_3, SWT.NONE); |
|
136 |
btnSupprimer.setText(Messages.ProgressionForm_14); |
|
137 |
|
|
138 |
scrolledComposite_1.setContent(composite_1); |
|
139 |
scrolledComposite_1.setMinSize(composite_1.computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
|
140 |
|
|
141 |
|
|
142 |
// table = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION); |
|
143 |
// table.setHeaderVisible(true); |
|
144 |
// table.setLinesVisible(true); |
|
145 |
// sashForm.setWeights(new int[] {215, 334}); |
|
146 |
//return sashForm; |
|
147 |
|
|
148 |
|
|
149 |
scrolledComposite_1.setBounds(20, 20, 800, 800); |
|
150 |
|
|
151 |
} |
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
public void setTable(Table table) { |
|
156 |
this.table = table; |
|
157 |
//table = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION); |
|
158 |
table.setHeaderVisible(true); |
|
159 |
table.setLinesVisible(true); |
|
160 |
sashForm.setWeights(new int[] {215, 334}); |
|
161 |
} |
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
public SashForm getSash() { |
|
166 |
return sashForm; |
|
167 |
} |
|
168 |
|
|
169 |
/** |
|
170 |
* @return the table |
|
171 |
*/ |
|
172 |
public Table getTable() { |
|
173 |
return table; |
|
174 |
} |
|
175 |
|
|
176 |
/** |
|
177 |
* @return the scaleTextEdit |
|
178 |
*/ |
|
179 |
public Text getScaleTextEdit() { |
|
180 |
return scaleTextEdit; |
|
181 |
} |
|
182 |
|
|
183 |
/** |
|
184 |
* @return the regTextEdit |
|
185 |
*/ |
|
186 |
public Text getRegTextEdit() { |
|
187 |
return regTextEdit; |
|
188 |
} |
|
189 |
|
|
190 |
/** |
|
191 |
* @return the btnSupprimer |
|
192 |
*/ |
|
193 |
public Button getBtnSupprimer() { |
|
194 |
return btnSupprimer; |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* @return the cumulBtn |
|
199 |
*/ |
|
200 |
public Button getCumulBtn() { |
|
201 |
return cumulBtn; |
|
202 |
} |
|
203 |
|
|
204 |
/** |
|
205 |
* @return the densiBtn |
|
206 |
*/ |
|
207 |
public Button getDensiBtn() { |
|
208 |
return densiBtn; |
|
209 |
} |
|
210 |
|
|
211 |
/** |
|
212 |
* @return the structCombo |
|
213 |
*/ |
|
214 |
public Combo getStructCombo() { |
|
215 |
return structCombo; |
|
216 |
} |
|
217 |
|
|
218 |
/** |
|
219 |
* @return the propCombo |
|
220 |
*/ |
|
221 |
public Combo getPropCombo() { |
|
222 |
return propCombo; |
|
223 |
} |
|
224 |
|
|
225 |
/** |
|
226 |
* @return the styleRadio |
|
227 |
*/ |
|
228 |
public Button getStyleRadio() { |
|
229 |
return styleRadio; |
|
230 |
} |
|
231 |
|
|
232 |
/** |
|
233 |
* @return the repeatRadio |
|
234 |
*/ |
|
235 |
public Button getRepeatRadio() { |
|
236 |
return repeatRadio; |
|
237 |
} |
|
238 |
|
|
239 |
/** |
|
240 |
* @return the nBRadio |
|
241 |
*/ |
|
242 |
public Button getNBRadio() { |
|
243 |
return NBRadio; |
|
244 |
} |
|
245 |
|
|
246 |
/** |
|
247 |
* @return the btnNewButton |
|
248 |
*/ |
|
249 |
public Button getBtnNewButton() { |
|
250 |
return btnNewButton; |
|
251 |
} |
|
252 |
|
|
253 |
|
|
254 |
} |
|
0 | 255 |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/RCPProgressionMessages.java (revision 35) | ||
---|---|---|
1 |
package org.txm.progression.rcp.messages; |
|
2 |
|
|
3 |
import org.eclipse.osgi.util.NLS; |
|
4 |
|
|
5 |
public class RCPProgressionMessages extends NLS { |
|
6 |
private static final String BUNDLE_NAME = "org.txm.progression.rcp.messages.messages"; //$NON-NLS-1$ |
|
7 |
|
|
8 |
public static String ProgressionPreferencePage_2; |
|
9 |
public static String ProgressionPreferencePage_3; |
|
10 |
public static String ProgressionPreferencePage_4; |
|
11 |
public static String ProgressionPreferencePage_5; |
|
12 |
public static String ProgressionPreferencePage_6; |
|
13 |
public static String ProgressionPreferencePage_7; |
|
14 |
|
|
15 |
|
|
16 |
static { |
|
17 |
// initialize resource bundle |
|
18 |
NLS.initializeMessages(BUNDLE_NAME, RCPProgressionMessages.class); |
|
19 |
} |
|
20 |
|
|
21 |
private RCPProgressionMessages() { |
|
22 |
} |
|
23 |
} |
|
0 | 24 |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages_fr.properties (revision 35) | ||
---|---|---|
1 |
ProgressionPreferencePage_2=Progression |
|
2 |
ProgressionPreferencePage_3=Graphe de progression cumulatif |
|
3 |
ProgressionPreferencePage_4=Niveaux de gris |
|
4 |
ProgressionPreferencePage_5=Style de ligne unique |
|
5 |
ProgressionPreferencePage_6=R?p?ter les valeurs de propri?t?s de structures |
|
6 |
ProgressionPreferencePage_7=\u00C9chelle des limites de structures |
|
0 | 7 |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages.properties (revision 35) | ||
---|---|---|
1 |
ProgressionPreferencePage_2=Progression |
|
2 |
ProgressionPreferencePage_3=Default graph type is cumulative |
|
3 |
ProgressionPreferencePage_4=Grayscale |
|
4 |
ProgressionPreferencePage_5=Single line style |
|
5 |
ProgressionPreferencePage_6=Repeat the values of the structure properties |
|
6 |
ProgressionPreferencePage_7=Bande size multiplier |
|
0 | 7 |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/jfreechart/events/ProgressionSelectionListener.java (revision 35) | ||
---|---|---|
1 |
package org.txm.progression.rcp.chartsengine.jfreechart.events; |
|
2 |
|
|
3 |
import org.eclipse.swt.events.SelectionEvent; |
|
4 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
|
5 |
import org.txm.chartsengine.rcp.events.BaseSelectionListener; |
|
6 |
|
|
7 |
/** |
|
8 |
* Progression selection listener. |
|
9 |
* @author sjacquot |
|
10 |
* |
|
11 |
*/ |
|
12 |
public class ProgressionSelectionListener extends BaseSelectionListener { |
|
13 |
|
|
14 |
|
|
15 |
/** |
|
16 |
* |
|
17 |
* @param chartEditor |
|
18 |
* @param commandId |
|
19 |
*/ |
|
20 |
public ProgressionSelectionListener(ChartEditorPart chartEditor, int commandId) { |
|
21 |
super(chartEditor, commandId); |
|
22 |
} |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
@Override |
|
27 |
public void widgetSelected(SelectionEvent e) { |
|
28 |
|
|
29 |
|
|
30 |
// FIXME: to discuss |
|
31 |
// Send to other command |
|
32 |
// if(this.commandId == ProgressionSelectionListener.SEND_TO_INDEX || this.commandId == ProgressionSelectionListener.SEND_TO_CONCORDANCE |
|
33 |
// || this.commandId == ProgressionSelectionListener.SEND_TO_COOCCURRENCE) { |
|
34 |
// |
|
35 |
// |
|
36 |
// Progression progression = (Progression) this.chartEditor.getResultData(); |
|
37 |
// // gets the progression queries from the current selected chart series |
|
38 |
// String query = progression.getQueriesString(chartEditor.getEditorInput().getSWTChartComponentsProvider().getChartsEngine().getProgressionChartSelectedSeries(chartEditor.getChart())); |
|
39 |
// |
|
40 |
// // Send to index |
|
41 |
// if(this.commandId == ProgressionSelectionListener.SEND_TO_INDEX) { |
|
42 |
// |
|
43 |
// IndexEditorInput editorInput = new IndexEditorInput(progression.getCorpus()); |
|
44 |
// |
|
45 |
// try { |
|
46 |
// IWorkbenchPage page = this.chartEditor.getEditorSite().getWorkbenchWindow().getActivePage(); |
|
47 |
// IndexEditor editor = (IndexEditor) page.openEditor(editorInput, IndexEditor.ID); |
|
48 |
// editor.setFocus(query); |
|
49 |
// editor.compute(); |
|
50 |
// } |
|
51 |
// catch(PartInitException e1) { |
|
52 |
// e1.printStackTrace(); |
|
53 |
// } |
|
54 |
// } |
|
55 |
// // Send to concordance |
|
56 |
// else if(this.commandId == ProgressionSelectionListener.SEND_TO_CONCORDANCE) { |
|
57 |
// |
|
58 |
// ConcordancesEditorInput editorInput = new ConcordancesEditorInput(progression.getCorpus(), null); |
|
59 |
// |
|
60 |
// try { |
|
61 |
// IWorkbenchPage page = this.chartEditor.getEditorSite().getWorkbenchWindow().getActivePage(); |
|
62 |
// ConcordancesEditor editor = (ConcordancesEditor) page.openEditor(editorInput, "org.txm.rcpapplication.editors.ConcordancesEditor"); //$NON-NLS-1$ |
|
63 |
// editor.setQuery(query); |
|
64 |
// editor.compute(); |
|
65 |
// |
|
66 |
// // move in the concordance to the line of the selected progression point |
|
67 |
// final ArrayList<Integer> selectedPointPositions = chartEditor.getEditorInput().getSWTChartComponentsProvider().getChartsEngine().getProgressionChartSelectedPointPositions(chartEditor.getChart()); |
|
68 |
// ArrayList<EditorPart> linkedEditors = new ArrayList<EditorPart>(); |
|
69 |
// linkedEditors.add(editor); |
|
70 |
// new ProgressionEventCallBack(this.chartEditor).updateLinkedConcordanceEditor(linkedEditors, selectedPointPositions); |
|
71 |
// |
|
72 |
// |
|
73 |
// } |
|
74 |
// catch(PartInitException e1) { |
|
75 |
// e1.printStackTrace(); |
|
76 |
// } |
|
77 |
// } |
|
78 |
// // Send to cooccurrence |
|
79 |
// else if(this.commandId == ProgressionSelectionListener.SEND_TO_COOCCURRENCE) { |
|
80 |
// |
|
81 |
// CooccurrenceEditorInput editorInput = new CooccurrenceEditorInput(progression.getCorpus()); |
|
82 |
// |
|
83 |
// try { |
Formats disponibles : Unified diff