Révision 3980
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorpusViewLabelProvider.java (revision 3980) | ||
|---|---|---|
| 19 | 19 |
public String getText(Object element) { // cut label if too long
|
| 20 | 20 |
|
| 21 | 21 |
String txt = super.getText(element); |
| 22 |
if (txt == null || txt.length() == 0) return "no_name"; |
|
| 23 |
|
|
| 22 | 24 |
if (txt != null && txt.length() > TXMEditor.MAX_NAME_LENGTH) {
|
| 23 | 25 |
txt = txt.substring(0, TXMEditor.MAX_NAME_LENGTH - 1) + "..."; //$NON-NLS-1$ |
| 24 | 26 |
} |
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/actions/CreatePartitionDialog.java (revision 3980) | ||
|---|---|---|
| 217 | 217 |
|
| 218 | 218 |
if (selectedTab == simpleTab) { // Simple mode
|
| 219 | 219 |
|
| 220 |
partition = simplePanel.createPartition(name); |
|
| 220 |
partition = simplePanel.createPartition(name, null);
|
|
| 221 | 221 |
} |
| 222 | 222 |
else if (selectedTab == assistedTab) { // Assisted mode
|
| 223 | 223 |
|
| ... | ... | |
| 227 | 227 |
Log.info(TXMCoreMessages.bind(TXMUIMessages.noPartitionNameWasSpecifiedTheNameIsP0, name)); |
| 228 | 228 |
} |
| 229 | 229 |
|
| 230 |
partition = this.compositeForAssisted.createPartition(name); |
|
| 230 |
partition = this.compositeForAssisted.createPartition(name, null);
|
|
| 231 | 231 |
} |
| 232 | 232 |
else if (selectedTab == crossedTab) { // Advanced mode
|
| 233 | 233 |
|
| 234 |
partition = crossedPanel.createPartition(name); |
|
| 234 |
partition = crossedPanel.createPartition(name, null);
|
|
| 235 | 235 |
} |
| 236 | 236 |
else if (selectedTab == advancedTab) { // Advanced mode
|
| 237 | 237 |
|
| 238 |
partition = advancedPartitionPanel.createPartition(name); |
|
| 238 |
partition = advancedPartitionPanel.createPartition(name, null);
|
|
| 239 | 239 |
} |
| 240 | 240 |
|
| 241 | 241 |
// Error |
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/CrossedPartitionPanel.java (revision 3980) | ||
|---|---|---|
| 23 | 23 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
| 24 | 24 |
import org.txm.utils.logger.Log; |
| 25 | 25 |
|
| 26 |
public class CrossedPartitionPanel extends Composite {
|
|
| 26 |
public class CrossedPartitionPanel extends Composite implements ParitionParameterGenerator {
|
|
| 27 | 27 |
|
| 28 | 28 |
/** The selected structural unit property. */ |
| 29 | 29 |
private List<StructuralUnitProperty> selectedStructuralUnitProperties = new ArrayList<>(); |
| ... | ... | |
| 83 | 83 |
propertyLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); |
| 84 | 84 |
propertyLabel.setToolTipText("Select at least two properties");
|
| 85 | 85 |
|
| 86 |
propertyCombo = new SuperListViewer(this, SWT.MULTI); |
|
| 86 |
propertyCombo = new SuperListViewer(this, SWT.MULTI|SWT.V_SCROLL);
|
|
| 87 | 87 |
propertyCombo.setLabelProvider(new LabelProvider() {
|
| 88 | 88 |
@Override |
| 89 | 89 |
public String getText(Object element) {
|
| ... | ... | |
| 94 | 94 |
} |
| 95 | 95 |
} |
| 96 | 96 |
}); |
| 97 |
propertyCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
| 97 |
GridData gdata = new GridData(GridData.FILL, GridData.FILL, true, true); |
|
| 98 |
gdata.heightHint = 400; |
|
| 99 |
propertyCombo.setLayoutData(gdata); |
|
| 98 | 100 |
|
| 99 | 101 |
ArrayList<StructuralUnitProperty> all = new ArrayList<>(); |
| 100 | 102 |
for (StructuralUnit su : structuralUnitsFinal) {
|
| ... | ... | |
| 148 | 150 |
return selectedStructuralUnitProperties; |
| 149 | 151 |
} |
| 150 | 152 |
|
| 151 |
public Partition createPartition(String name) {
|
|
| 153 |
public Partition createPartition(String name, Partition partition) {
|
|
| 152 | 154 |
|
| 153 | 155 |
if (selectedStructuralUnitProperties.size() < 2) {
|
| 154 | 156 |
return null; |
| ... | ... | |
| 166 | 168 |
String expandTarget = expandText.getText(); |
| 167 | 169 |
|
| 168 | 170 |
PartitionQueriesGenerator pqg = new PartitionQueriesGenerator(); |
| 169 |
Partition partition; |
|
| 170 | 171 |
try {
|
| 171 |
partition = pqg.createPartition(corpus, false, |
|
| 172 |
partition = pqg.createPartition(corpus, partition, false,
|
|
| 172 | 173 |
name, partNamePrefix, separator, |
| 173 | 174 |
structuralUnits, structuralUnitProperties, |
| 174 | 175 |
structuralUnitToIgnore, expandTarget); |
| ... | ... | |
| 208 | 209 |
* @throws CqiClientException |
| 209 | 210 |
* @throws InterruptedException |
| 210 | 211 |
*/ |
| 211 |
public Partition createPartition(CQPCorpus corpus, boolean debug, |
|
| 212 |
public Partition createPartition(CQPCorpus corpus, Partition partition, boolean debug,
|
|
| 212 | 213 |
String partitionName, String partNamePrefix, String separator, |
| 213 | 214 |
List<String> structuralUnits, List<String> structuralUnitProperties, |
| 214 | 215 |
List<String> structuralUnitToIgnore, String expandTarget) throws CqiClientException, InterruptedException {
|
| ... | ... | |
| 266 | 267 |
|
| 267 | 268 |
// Creating the partition |
| 268 | 269 |
if (!DEBUG && queries.size() == partNames.size()) {
|
| 269 |
Partition partition = new Partition(corpus); |
|
| 270 |
if (partition == null) {
|
|
| 271 |
partition = new Partition(corpus); |
|
| 272 |
} else {
|
|
| 273 |
partition.removeAllParts(); |
|
| 274 |
} |
|
| 270 | 275 |
partition.setParameters(PARTITION_NAME, queries, partNames); |
| 271 | 276 |
partition.compute(); |
| 272 | 277 |
return partition; |
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/ComplexSubcorpusPanel.java (revision 3980) | ||
|---|---|---|
| 59 | 59 |
/** |
| 60 | 60 |
* The Class ComplexSubcorpusPanel. |
| 61 | 61 |
*/ |
| 62 |
public class ComplexSubcorpusPanel extends Composite {
|
|
| 62 |
public class ComplexSubcorpusPanel extends Composite implements SubcorpusParameterGenerator {
|
|
| 63 | 63 |
|
| 64 | 64 |
/** The self. */ |
| 65 | 65 |
|
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/ParitionParameterGenerator.java (revision 3980) | ||
|---|---|---|
| 1 |
package org.txm.rcp.swt.widget.structures; |
|
| 2 |
|
|
| 3 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
| 4 |
|
|
| 5 |
public interface ParitionParameterGenerator {
|
|
| 6 |
|
|
| 7 |
/** |
|
| 8 |
* creates or updates a partition |
|
| 9 |
* @param name |
|
| 10 |
* @param partition |
|
| 11 |
* @return |
|
| 12 |
*/ |
|
| 13 |
public Partition createPartition(String name, Partition partition); |
|
| 14 |
} |
|
| 0 | 15 | |
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/SubcorpusParameterGenerator.java (revision 3980) | ||
|---|---|---|
| 1 |
package org.txm.rcp.swt.widget.structures; |
|
| 2 |
|
|
| 3 |
|
|
| 4 |
public interface SubcorpusParameterGenerator {
|
|
| 5 |
public String getQueryString(); |
|
| 6 |
public String getGeneratedName(); |
|
| 7 |
} |
|
| 0 | 8 | |
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/AdvancedPartitionPanel.java (revision 3980) | ||
|---|---|---|
| 27 | 27 |
import org.txm.utils.io.IOUtils; |
| 28 | 28 |
import org.txm.utils.logger.Log; |
| 29 | 29 |
|
| 30 |
public class AdvancedPartitionPanel extends Composite {
|
|
| 30 |
public class AdvancedPartitionPanel extends Composite implements ParitionParameterGenerator {
|
|
| 31 | 31 |
|
| 32 | 32 |
// for the "advanced" tab |
| 33 | 33 |
/** The queries. */ |
| ... | ... | |
| 189 | 189 |
* |
| 190 | 190 |
* @return the advance part names |
| 191 | 191 |
*/ |
| 192 |
private List<String> getAdvancePartNames() {
|
|
| 192 |
public List<String> getNames() {
|
|
| 193 | 193 |
|
| 194 | 194 |
ArrayList<String> values = new ArrayList<>(); |
| 195 | 195 |
int count = 0; |
| ... | ... | |
| 229 | 229 |
return false; |
| 230 | 230 |
} |
| 231 | 231 |
|
| 232 |
public Partition createPartition(String name) {
|
|
| 232 |
public Partition createPartition(String name, Partition partition) {
|
|
| 233 | 233 |
|
| 234 | 234 |
queriesString.clear(); |
| 235 | 235 |
for (QueryWidget query : queries) {
|
| ... | ... | |
| 237 | 237 |
//query.memorize(); |
| 238 | 238 |
} |
| 239 | 239 |
|
| 240 |
Partition partition = null; |
|
| 241 |
|
|
| 242 | 240 |
try {
|
| 243 | 241 |
// auto-naming if needed |
| 244 | 242 |
if (name.isEmpty()) {
|
| ... | ... | |
| 246 | 244 |
Log.info(TXMCoreMessages.bind(TXMUIMessages.noPartitionNameWasSpecifiedTheNameIsP0, name)); |
| 247 | 245 |
} |
| 248 | 246 |
|
| 249 |
partition = new Partition(this.corpus); |
|
| 250 |
partition.setParameters(name, this.getQueries(), this.getAdvancePartNames()); |
|
| 247 |
if (partition == null) {
|
|
| 248 |
partition = new Partition(this.corpus); |
|
| 249 |
} else {
|
|
| 250 |
partition.removeAllParts(); |
|
| 251 |
} |
|
| 252 |
partition.setParameters(name, this.getQueries(), this.getNames()); |
|
| 251 | 253 |
} |
| 252 | 254 |
catch (Exception e) {
|
| 253 | 255 |
org.txm.utils.logger.Log.printStackTrace(e); |
| ... | ... | |
| 256 | 258 |
|
| 257 | 259 |
return partition; |
| 258 | 260 |
} |
| 261 |
|
|
| 259 | 262 |
} |
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/SimplePartitionPanel.java (revision 3980) | ||
|---|---|---|
| 20 | 20 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
| 21 | 21 |
import org.txm.utils.logger.Log; |
| 22 | 22 |
|
| 23 |
public class SimplePartitionPanel extends Composite {
|
|
| 23 |
public class SimplePartitionPanel extends Composite implements ParitionParameterGenerator {
|
|
| 24 | 24 |
|
| 25 | 25 |
// For the "simple" tab |
| 26 | 26 |
/** The selected structural unit. */ |
| ... | ... | |
| 238 | 238 |
return selectedStructuralUnitProperty; |
| 239 | 239 |
} |
| 240 | 240 |
|
| 241 |
public Partition createPartition(String name) {
|
|
| 241 |
public Partition createPartition(String name, Partition partition) {
|
|
| 242 | 242 |
|
| 243 |
Partition partition = null; |
|
| 244 |
|
|
| 245 | 243 |
// Simple mode |
| 246 | 244 |
|
| 247 | 245 |
StructuralUnit structuralUnit = this.structuralUnitsFinal.get(this.structuralUnitsCombo.getSelectionIndex()); |
| ... | ... | |
| 252 | 250 |
name = property.asFullNameString(); |
| 253 | 251 |
} |
| 254 | 252 |
|
| 255 |
partition = new Partition(corpus); |
|
| 253 |
if (partition == null) {
|
|
| 254 |
partition = new Partition(corpus); |
|
| 255 |
} else {
|
|
| 256 |
partition.removeAllParts(); |
|
| 257 |
} |
|
| 256 | 258 |
partition.setParameters(name, property, null); |
| 257 | 259 |
} |
| 258 | 260 |
catch (Exception e) {
|
| TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/PartitionComposer.java (revision 3980) | ||
|---|---|---|
| 50 | 50 |
import org.txm.core.messages.TXMCoreMessages; |
| 51 | 51 |
import org.txm.rcp.IImageKeys; |
| 52 | 52 |
import org.txm.rcp.messages.TXMUIMessages; |
| 53 |
import org.txm.rcp.swt.widget.structures.ParitionParameterGenerator; |
|
| 53 | 54 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
| 54 | 55 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
| 55 | 56 |
import org.txm.searchengine.cqp.corpus.Partition; |
| ... | ... | |
| 63 | 64 |
/** |
| 64 | 65 |
* used for assisted mode of partition creation @ author mdecorde. |
| 65 | 66 |
*/ |
| 66 |
public class PartitionComposer extends Composite {
|
|
| 67 |
public class PartitionComposer extends Composite implements ParitionParameterGenerator{
|
|
| 67 | 68 |
|
| 68 | 69 |
/** The self. */ |
| 69 | 70 |
PartitionComposer self; |
| ... | ... | |
| 595 | 596 |
* |
| 596 | 597 |
* @return the partition |
| 597 | 598 |
*/ |
| 598 |
public Partition createPartition(String name) {
|
|
| 599 |
public Partition createPartition(String name, Partition partition) {
|
|
| 599 | 600 |
|
| 600 | 601 |
if (this.parts.size() == 0) {
|
| 601 | 602 |
System.out.println(TXMUIMessages.errorColonThisPartitionHasNoPart); |
| 602 | 603 |
return null; |
| 603 | 604 |
} |
| 604 |
|
|
| 605 |
|
|
| 605 | 606 |
List<String> queries = new ArrayList<>(); |
| 606 | 607 |
List<String> partnames = new ArrayList<>(); |
| 607 | 608 |
for (PartItem part : this.parts) {
|
| ... | ... | |
| 618 | 619 |
} |
| 619 | 620 |
|
| 620 | 621 |
try {
|
| 621 |
Partition p = new Partition(corpus); |
|
| 622 |
p.setParameters(name, queries, partnames); |
|
| 623 |
return p; |
|
| 622 |
if (partition == null) {
|
|
| 623 |
partition = new Partition(corpus); |
|
| 624 |
} else {
|
|
| 625 |
partition.removeAllParts(); |
|
| 626 |
} |
|
| 627 |
partition.setParameters(name, queries, partnames); |
|
| 628 |
return partition; |
|
| 624 | 629 |
} |
| 625 | 630 |
catch (Exception e) {
|
| 626 | 631 |
org.txm.utils.logger.Log.printStackTrace(e); |
| ... | ... | |
| 637 | 642 |
|
| 638 | 643 |
return this.availableList.getItemCount() > 0; |
| 639 | 644 |
} |
| 640 |
|
|
| 641 |
public String getGeneratedName() {
|
|
| 642 |
|
|
| 643 |
// TODO Auto-generated method stub |
|
| 644 |
return null; |
|
| 645 |
} |
|
| 645 |
|
|
| 646 | 646 |
} |
| TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java (revision 3980) | ||
|---|---|---|
| 1016 | 1016 |
if (virtualProperties == null) {
|
| 1017 | 1017 |
virtualProperties = new ArrayList<>(); |
| 1018 | 1018 |
virtualProperties.add(new PositionProperty(this)); |
| 1019 |
// virtualProperties.add(new LengthProperty(this));
|
|
| 1019 |
virtualProperties.add(new LengthProperty(this)); |
|
| 1020 | 1020 |
} |
| 1021 | 1021 |
return virtualProperties; |
| 1022 | 1022 |
} |
| TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/WordProperty.java (revision 3980) | ||
|---|---|---|
| 3 | 3 |
import java.io.IOException; |
| 4 | 4 |
import java.util.List; |
| 5 | 5 |
|
| 6 |
import org.apache.commons.lang.StringUtils; |
|
| 6 | 7 |
import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException; |
| 7 | 8 |
import org.txm.searchengine.cqp.corpus.query.CQLQuery; |
| 8 | 9 |
import org.txm.searchengine.cqp.corpus.query.MatchUtils; |
| ... | ... | |
| 117 | 118 |
return sb.toString(); |
| 118 | 119 |
} |
| 119 | 120 |
|
| 121 |
public String combine(List<String> values) {
|
|
| 122 |
return StringUtils.join(values, " "); |
|
| 123 |
} |
|
| 124 |
|
|
| 120 | 125 |
/** |
| 121 | 126 |
* |
| 122 | 127 |
* @return all indexed values in the main corpus |
| TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/LengthProperty.java (revision 3980) | ||
|---|---|---|
| 12 | 12 |
import org.txm.searchengine.cqp.serverException.CqiServerError; |
| 13 | 13 |
|
| 14 | 14 |
/** |
| 15 |
* A CQP property at token/word level |
|
| 15 |
* A CQP property at token/word level
|
|
| 16 | 16 |
* |
| 17 |
* NOT IMPLEMENTED YET: the actual codes needs to accees |
|
| 18 |
* |
|
| 17 | 19 |
* @author mdecorde |
| 18 | 20 |
* |
| 19 | 21 |
*/ |
| TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/VirtualProperty.java (revision 3980) | ||
|---|---|---|
| 58 | 58 |
public String getCQLTest(List<String> values) {
|
| 59 | 59 |
return null; |
| 60 | 60 |
} |
| 61 |
|
|
| 62 | 61 |
} |
| 63 | 62 |
|
| TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 3980) | ||
|---|---|---|
| 143 | 143 |
public boolean _compute_with_lists(TXMProgressMonitor monitor) throws Exception {
|
| 144 | 144 |
|
| 145 | 145 |
if (this.getUserName() == null || this.getUserName().length() == 0) {
|
| 146 |
this.setUserName("no_name");
|
|
| 146 |
this.setUserName("");
|
|
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
Log.finest(NLS.bind(SearchEngineCoreMessages.info_creatingNewPartitionP0OfP1, this.getUserName(), this.getParent())); |
| ... | ... | |
| 742 | 742 |
public List<String> getPartNamesParameter() {
|
| 743 | 743 |
return pPartNames; |
| 744 | 744 |
} |
| 745 |
|
|
| 746 |
public void removeAllParts() {
|
|
| 747 |
|
|
| 748 |
for (Part p : getParts()) {
|
|
| 749 |
p.delete(); |
|
| 750 |
} |
|
| 751 |
} |
|
| 745 | 752 |
} |
| TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/SubcorpusPreferencePage.java (revision 3980) | ||
|---|---|---|
| 37 | 37 |
import org.eclipse.jface.util.PropertyChangeEvent; |
| 38 | 38 |
import org.eclipse.ui.IWorkbench; |
| 39 | 39 |
import org.osgi.service.prefs.Preferences; |
| 40 |
import org.txm.core.preferences.TBXPreferences; |
|
| 41 |
import org.txm.core.preferences.TXMPreferences; |
|
| 40 | 42 |
import org.txm.libs.cqp.CQPLibPreferences; |
| 41 | 43 |
import org.txm.rcp.Application; |
| 44 |
import org.txm.rcp.preferences.RCPPreferences; |
|
| 42 | 45 |
import org.txm.rcp.preferences.TXMPreferencePage; |
| 43 | 46 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
| 44 | 47 |
import org.txm.searchengine.cqp.core.preferences.SubcorpusPreferences; |
| ... | ... | |
| 79 | 82 |
|
| 80 | 83 |
optimized_mode = new BooleanFieldEditor(SubcorpusPreferences.OPTIMIZED_MODE, "Create structured subcorpus using optimized queries", BooleanFieldEditor.DEFAULT, getFieldEditorParent()); |
| 81 | 84 |
addField(optimized_mode); |
| 85 |
|
|
| 86 |
if (TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)) {
|
|
| 87 |
editor_mode = new BooleanFieldEditor(SubcorpusPreferences.EDITORMODE, "Create subcorpus using an editor instead of a dialog", BooleanFieldEditor.DEFAULT, getFieldEditorParent()); |
|
| 88 |
addField(editor_mode); |
|
| 89 |
} |
|
| 82 | 90 |
} |
| 83 | 91 |
|
| 84 | 92 |
/* |
| TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/PartitionPreferencePage.java (revision 3980) | ||
|---|---|---|
| 37 | 37 |
import org.eclipse.jface.util.PropertyChangeEvent; |
| 38 | 38 |
import org.eclipse.ui.IWorkbench; |
| 39 | 39 |
import org.osgi.service.prefs.Preferences; |
| 40 |
import org.txm.core.preferences.TBXPreferences; |
|
| 40 | 41 |
import org.txm.libs.cqp.CQPLibPreferences; |
| 41 | 42 |
import org.txm.rcp.Application; |
| 42 | 43 |
import org.txm.rcp.preferences.TXMPreferencePage; |
| ... | ... | |
| 52 | 53 |
* |
| 53 | 54 |
*/ |
| 54 | 55 |
public class PartitionPreferencePage extends TXMPreferencePage {
|
| 55 |
|
|
| 56 |
|
|
| 56 | 57 |
/** The cqi_server_is_remote. */ |
| 57 | 58 |
private BooleanFieldEditor editor_mode; |
| 58 |
|
|
| 59 |
|
|
| 59 | 60 |
/** |
| 60 | 61 |
* Instantiates a new cQP preference page. |
| 61 | 62 |
*/ |
| 62 | 63 |
public PartitionPreferencePage() {
|
| 63 | 64 |
super(); |
| 64 | 65 |
} |
| 65 |
|
|
| 66 |
|
|
| 66 | 67 |
/** |
| 67 | 68 |
* Creates the field editors. Field editors are abstractions of the common |
| 68 | 69 |
* GUI blocks needed to manipulate various types of preferences. Each field |
| ... | ... | |
| 70 | 71 |
*/ |
| 71 | 72 |
@Override |
| 72 | 73 |
public void createFieldEditors() {
|
| 73 |
|
|
| 74 |
editor_mode = new BooleanFieldEditor(PartitionPreferences.EDITOR_MODE, "Create partitions using the editor mode", BooleanFieldEditor.DEFAULT, getFieldEditorParent()); |
|
| 75 |
addField(editor_mode); |
|
| 74 |
|
|
| 75 |
if (TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)) {
|
|
| 76 |
editor_mode = new BooleanFieldEditor(PartitionPreferences.EDITOR_MODE, "Create partitions using the editor mode", BooleanFieldEditor.DEFAULT, getFieldEditorParent()); |
|
| 77 |
addField(editor_mode); |
|
| 78 |
} |
|
| 76 | 79 |
} |
| 77 |
|
|
| 80 |
|
|
| 78 | 81 |
/* |
| 79 | 82 |
* (non-Javadoc) |
| 80 | 83 |
* |
| TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/PartitionEditor.java (revision 3980) | ||
|---|---|---|
| 1 | 1 |
package org.txm.searchengine.cqp.rcp.editor; |
| 2 | 2 |
|
| 3 |
import org.apache.commons.lang.StringUtils; |
|
| 3 |
import java.util.ArrayList; |
|
| 4 |
import java.util.Arrays; |
|
| 5 |
|
|
| 4 | 6 |
import org.eclipse.jface.layout.GridDataFactory; |
| 5 | 7 |
import org.eclipse.jface.viewers.CellLabelProvider; |
| 6 | 8 |
import org.eclipse.jface.viewers.ISelection; |
| ... | ... | |
| 18 | 20 |
import org.eclipse.swt.events.SelectionEvent; |
| 19 | 21 |
import org.eclipse.swt.events.SelectionListener; |
| 20 | 22 |
import org.eclipse.swt.layout.GridData; |
| 23 |
import org.eclipse.swt.layout.GridLayout; |
|
| 21 | 24 |
import org.eclipse.swt.widgets.Button; |
| 25 |
import org.eclipse.swt.widgets.Composite; |
|
| 26 |
import org.eclipse.swt.widgets.Control; |
|
| 22 | 27 |
import org.eclipse.swt.widgets.Event; |
| 28 |
import org.eclipse.swt.widgets.Group; |
|
| 23 | 29 |
import org.eclipse.swt.widgets.Label; |
| 24 | 30 |
import org.eclipse.swt.widgets.Text; |
| 25 | 31 |
import org.txm.core.preferences.TXMPreferences; |
| 26 | 32 |
import org.txm.core.results.Parameter; |
| 33 |
import org.txm.rcp.IImageKeys; |
|
| 27 | 34 |
import org.txm.rcp.editors.TXMEditor; |
| 28 | 35 |
import org.txm.rcp.editors.listeners.ComputeKeyListener; |
| 36 |
import org.txm.rcp.messages.TXMUIMessages; |
|
| 37 |
import org.txm.rcp.swt.GLComposite; |
|
| 29 | 38 |
import org.txm.rcp.swt.widget.AssistedQueryWidget; |
| 39 |
import org.txm.rcp.swt.widget.PartitionComposer; |
|
| 40 |
import org.txm.rcp.swt.widget.structures.CrossedPartitionPanel; |
|
| 41 |
import org.txm.rcp.swt.widget.structures.SimplePartitionPanel; |
|
| 30 | 42 |
import org.txm.rcp.views.corpora.CorporaView; |
| 31 | 43 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
| 32 | 44 |
import org.txm.searchengine.cqp.corpus.Part; |
| ... | ... | |
| 34 | 46 |
import org.txm.utils.logger.Log; |
| 35 | 47 |
|
| 36 | 48 |
public class PartitionEditor extends TXMEditor<Partition> {
|
| 37 |
|
|
| 49 |
|
|
| 50 |
protected static final String ASSISTANTS_GROUPNAME = "Assistants"; |
|
| 51 |
|
|
| 38 | 52 |
TableViewer partsViewer; |
| 39 | 53 |
TableViewerColumn nameColumn; |
| 40 | 54 |
TableViewerColumn queryColumn; |
| ... | ... | |
| 46 | 60 |
|
| 47 | 61 |
private Text partNameWidget; |
| 48 | 62 |
private AssistedQueryWidget queryWidget; |
| 63 |
private Group modeGroups; |
|
| 64 |
private Button updateQueryFromAssistance; |
|
| 65 |
private Composite assistantPanel; |
|
| 49 | 66 |
|
| 50 | 67 |
@Override |
| 51 | 68 |
public void _createPartControl() throws Exception {
|
| ... | ... | |
| 57 | 74 |
getMainParametersComposite().getLayout().numColumns = 7; |
| 58 | 75 |
|
| 59 | 76 |
Label l = new Label(getMainParametersComposite(), SWT.NONE); |
| 60 |
l.setText("Name");
|
|
| 77 |
l.setText(TXMUIMessages.name);
|
|
| 61 | 78 |
l.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
| 62 | 79 |
|
| 63 | 80 |
nameWidget = new Text(getMainParametersComposite(), SWT.BORDER); |
| 64 |
nameWidget.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
|
| 81 |
GridData gdata = new GridData(SWT.LEFT, SWT.CENTER, false, false); |
|
| 82 |
gdata.minimumWidth = 300; |
|
| 83 |
nameWidget.setLayoutData(gdata); |
|
| 65 | 84 |
nameWidget.addModifyListener(new ModifyListener() {
|
| 66 | 85 |
|
| 67 | 86 |
@Override |
| ... | ... | |
| 81 | 100 |
miniInfoLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
| 82 | 101 |
|
| 83 | 102 |
partNameWidget = new Text(getMainParametersComposite(), SWT.BORDER); |
| 84 |
partNameWidget.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
|
| 103 |
gdata = new GridData(SWT.LEFT, SWT.CENTER, false, false); |
|
| 104 |
gdata.minimumWidth = 300; |
|
| 105 |
partNameWidget.setLayoutData(gdata); |
|
| 85 | 106 |
|
| 86 | 107 |
// [ (v)] |
| 87 | 108 |
// queryWidget = new QueryWidget(queryArea, SWT.DROP_DOWN); |
| 88 | 109 |
queryWidget = new AssistedQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN, getResult().getCorpus()); |
| 89 |
queryWidget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
|
| 110 |
gdata = new GridData(SWT.LEFT, SWT.CENTER, false, false); |
|
| 111 |
gdata.minimumWidth = 400; |
|
| 112 |
queryWidget.setLayoutData(gdata); |
|
| 90 | 113 |
queryWidget.addKeyListener(new ComputeKeyListener(this) {
|
| 91 | 114 |
@Override |
| 92 | 115 |
public void keyPressed(KeyEvent e) {
|
| ... | ... | |
| 131 | 154 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
| 132 | 155 |
}); |
| 133 | 156 |
|
| 157 |
ArrayList<String> modes = new ArrayList<String>(); |
|
| 158 |
final ArrayList<SelectionListener> listeners = new ArrayList<SelectionListener>(); |
|
| 159 |
|
|
| 160 |
// MODE TABS |
|
| 161 |
SelectionListener openCloseSelectionListener = new SelectionListener() {
|
|
| 162 |
@Override |
|
| 163 |
public void widgetSelected(SelectionEvent e) {
|
|
| 164 |
|
|
| 165 |
if (e.getSource() == updateQueryFromAssistance) { // copy query
|
|
| 166 |
Control c = modeGroups.getChildren()[0]; |
|
| 167 |
|
|
| 168 |
if (c instanceof SimplePartitionPanel) {
|
|
| 169 |
|
|
| 170 |
SimplePartitionPanel ssp = (SimplePartitionPanel)c; |
|
| 171 |
ssp.createPartition("", getResult());
|
|
| 172 |
} else if (c instanceof CrossedPartitionPanel) {
|
|
| 173 |
|
|
| 174 |
CrossedPartitionPanel ssp = (CrossedPartitionPanel)c; |
|
| 175 |
ssp.createPartition("", getResult());
|
|
| 176 |
} else if (c instanceof PartitionComposer) {
|
|
| 177 |
|
|
| 178 |
PartitionComposer ssp = (PartitionComposer)c; |
|
| 179 |
ssp.createPartition(nameWidget.getText(), getResult()); |
|
| 180 |
} |
|
| 181 |
|
|
| 182 |
compute(false); |
|
| 183 |
|
|
| 184 |
try {
|
|
| 185 |
updateEditorFromResult(false); |
|
| 186 |
} |
|
| 187 |
catch (Exception e1) {
|
|
| 188 |
// TODO Auto-generated catch block |
|
| 189 |
e1.printStackTrace(); |
|
| 190 |
} |
|
| 191 |
|
|
| 192 |
} else {
|
|
| 193 |
|
|
| 194 |
for (Control c2 : modeGroups.getChildren()) c2.dispose(); |
|
| 195 |
|
|
| 196 |
boolean v = getTopToolbar().isVisible(ASSISTANTS_GROUPNAME); |
|
| 197 |
if (v) { // not visible remove all composites
|
|
| 198 |
updateQueryFromAssistance.setEnabled(false); |
|
| 199 |
getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, false); |
|
| 200 |
} else {
|
|
| 201 |
updateQueryFromAssistance.setEnabled(true); |
|
| 202 |
if (modeGroups.getChildren().length == 0) { // select first mode by default
|
|
| 203 |
listeners.get(0).widgetSelected(e); |
|
| 204 |
} |
|
| 205 |
} |
|
| 206 |
|
|
| 207 |
modeGroups.layout(true); |
|
| 208 |
getResultArea().getParent().layout(true); |
|
| 209 |
} |
|
| 210 |
} |
|
| 211 |
|
|
| 212 |
@Override |
|
| 213 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 214 |
}; |
|
| 215 |
|
|
| 216 |
modes.add("Simple");
|
|
| 217 |
modes.add("Assisted");
|
|
| 218 |
modes.add("Crossed");
|
|
| 219 |
|
|
| 220 |
listeners.add(new SelectionListener() { // create alistener to instantiate a new AnnotationArea
|
|
| 221 |
|
|
| 222 |
@Override |
|
| 223 |
public void widgetSelected(SelectionEvent e) {
|
|
| 224 |
try {
|
|
| 225 |
for (Control c : modeGroups.getChildren()) c.dispose(); // clean |
|
| 226 |
|
|
| 227 |
getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, true); |
|
| 228 |
|
|
| 229 |
assistantPanel = new SimplePartitionPanel(modeGroups, SWT.BORDER, getResult().getCorpus()); |
|
| 230 |
assistantPanel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
| 231 |
|
|
| 232 |
modeGroups.layout(true); |
|
| 233 |
getResultArea().getParent().layout(true); |
|
| 234 |
updateQueryFromAssistance.setEnabled(true); |
|
| 235 |
|
|
| 236 |
} catch (Exception e1) {
|
|
| 237 |
// TODO Auto-generated catch block |
|
| 238 |
e1.printStackTrace(); |
|
| 239 |
} |
|
| 240 |
} |
|
| 241 |
|
|
| 242 |
@Override |
|
| 243 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 244 |
}); |
|
| 245 |
listeners.add(new SelectionListener() { // create alistener to instantiate a new AnnotationArea
|
|
| 246 |
|
|
| 247 |
@Override |
|
| 248 |
public void widgetSelected(SelectionEvent e) {
|
|
| 249 |
try {
|
|
| 250 |
for (Control c : modeGroups.getChildren()) c.dispose(); // clean |
|
| 251 |
|
|
| 252 |
getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, true); |
|
| 253 |
|
|
| 254 |
assistantPanel = new PartitionComposer(modeGroups, SWT.BORDER, getResult().getCorpus()); |
|
| 255 |
assistantPanel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
| 256 |
|
|
| 257 |
modeGroups.layout(true); |
|
| 258 |
getResultArea().getParent().layout(true); |
|
| 259 |
updateQueryFromAssistance.setEnabled(true); |
|
| 260 |
|
|
| 261 |
} catch (Exception e1) {
|
|
| 262 |
// TODO Auto-generated catch block |
|
| 263 |
e1.printStackTrace(); |
|
| 264 |
} |
|
| 265 |
} |
|
| 266 |
|
|
| 267 |
@Override |
|
| 268 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 269 |
}); |
|
| 270 |
listeners.add(new SelectionListener() { // create alistener to instantiate a new AnnotationArea
|
|
| 271 |
|
|
| 272 |
@Override |
|
| 273 |
public void widgetSelected(SelectionEvent e) {
|
|
| 274 |
try {
|
|
| 275 |
for (Control c : modeGroups.getChildren()) c.dispose(); // clean |
|
| 276 |
|
|
| 277 |
getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, true); |
|
| 278 |
|
|
| 279 |
assistantPanel = new CrossedPartitionPanel(modeGroups, SWT.BORDER, getResult().getCorpus()); |
|
| 280 |
assistantPanel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
| 281 |
|
|
| 282 |
modeGroups.layout(true); |
|
| 283 |
getResultArea().getParent().layout(true); |
|
| 284 |
updateQueryFromAssistance.setEnabled(true); |
|
| 285 |
|
|
| 286 |
} catch (Exception e1) {
|
|
| 287 |
// TODO Auto-generated catch block |
|
| 288 |
e1.printStackTrace(); |
|
| 289 |
} |
|
| 290 |
} |
|
| 291 |
|
|
| 292 |
@Override |
|
| 293 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 294 |
}); |
|
| 295 |
modeGroups = this.getTopToolbar().installAlternativesGroup(ASSISTANTS_GROUPNAME, ASSISTANTS_GROUPNAME, IImageKeys.ACTION_ASSISTQUERY, null, false, openCloseSelectionListener, modes, listeners); |
|
| 296 |
modeGroups.setLayout(new GridLayout(1, true)); |
|
| 297 |
|
|
| 298 |
// RESULT AREA |
|
| 299 |
|
|
| 300 |
GLComposite buttons = new GLComposite(this.getResultArea(), SWT.NONE, "buttons"); |
|
| 301 |
buttons.getLayout().numColumns = 10; |
|
| 302 |
buttons.getLayout().horizontalSpacing = 2; |
|
| 303 |
|
|
| 304 |
Button deleteAllButton = new Button(buttons, SWT.PUSH); |
|
| 305 |
deleteAllButton.setText("Clear");
|
|
| 306 |
deleteAllButton.addSelectionListener(new SelectionListener() {
|
|
| 307 |
|
|
| 308 |
@Override |
|
| 309 |
public void widgetSelected(SelectionEvent e) {
|
|
| 310 |
|
|
| 311 |
for (Part p : getResult().getParts()) {
|
|
| 312 |
p.delete(); |
|
| 313 |
} |
|
| 314 |
|
|
| 315 |
partsViewer.setInput(getResult()); |
|
| 316 |
try {
|
|
| 317 |
updateEditorFromResult(false); |
|
| 318 |
} catch (Exception e1) {
|
|
| 319 |
// TODO Auto-generated catch block |
|
| 320 |
e1.printStackTrace(); |
|
| 321 |
} |
|
| 322 |
} |
|
| 323 |
|
|
| 324 |
@Override |
|
| 325 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 326 |
}); |
|
| 327 |
|
|
| 328 |
updateQueryFromAssistance = new Button(buttons, SWT.PUSH); |
|
| 329 |
updateQueryFromAssistance.setText("Add parts from from assitant");
|
|
| 330 |
updateQueryFromAssistance.addSelectionListener(openCloseSelectionListener); |
|
| 331 |
updateQueryFromAssistance.setEnabled(false); |
|
| 332 |
|
|
| 134 | 333 |
partsViewer = new TableViewer(this.getResultArea()); |
| 135 | 334 |
partsViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().align(GridData.FILL, GridData.FILL).grab(true, true).create()); |
| 136 | 335 |
partsViewer.getTable().setHeaderVisible(true); |
| ... | ... | |
| 143 | 342 |
if (e.keyCode == SWT.DEL) {
|
| 144 | 343 |
ISelection isel = partsViewer.getSelection(); |
| 145 | 344 |
IStructuredSelection sel = (IStructuredSelection)isel; |
| 146 |
Object o = sel.getFirstElement(); |
|
| 147 |
if (o != null && o instanceof Part) {
|
|
| 148 |
Part p = (Part)o; |
|
| 149 |
p.delete(); |
|
| 150 |
partsViewer.setInput(getResult()); |
|
| 151 |
try {
|
|
| 152 |
updateEditorFromResult(false); |
|
| 153 |
} catch (Exception e1) {
|
|
| 154 |
// TODO Auto-generated catch block |
|
| 155 |
e1.printStackTrace(); |
|
| 345 |
for (Object o : sel.toList()) {
|
|
| 346 |
if (o != null && o instanceof Part) {
|
|
| 347 |
Part p = (Part)o; |
|
| 348 |
p.delete(); |
|
| 156 | 349 |
} |
| 157 | 350 |
} |
| 351 |
|
|
| 352 |
partsViewer.setInput(getResult()); |
|
| 353 |
try {
|
|
| 354 |
updateEditorFromResult(false); |
|
| 355 |
} catch (Exception e1) {
|
|
| 356 |
// TODO Auto-generated catch block |
|
| 357 |
e1.printStackTrace(); |
|
| 358 |
} |
|
| 158 | 359 |
} |
| 159 | 360 |
} |
| 160 | 361 |
|
| ... | ... | |
| 169 | 370 |
if (inputElement instanceof Partition) {
|
| 170 | 371 |
return ((Partition)inputElement).getParts().toArray(); |
| 171 | 372 |
} |
| 172 |
|
|
| 373 |
|
|
| 173 | 374 |
return new Object[0]; |
| 174 | 375 |
} |
| 175 | 376 |
|
| ... | ... | |
| 249 | 450 |
|
| 250 | 451 |
partsViewer.setInput(getResult()); |
| 251 | 452 |
} |
| 252 |
|
|
| 453 |
|
|
| 253 | 454 |
/** |
| 254 | 455 |
* |
| 255 | 456 |
* @param event |
| ... | ... | |
| 288 | 489 |
return false; |
| 289 | 490 |
} |
| 290 | 491 |
|
| 492 |
/** |
|
| 493 |
* |
|
| 494 |
* @return success state |
|
| 495 |
*/ |
|
| 496 |
public boolean addMultiParts(ArrayList<String> queries, ArrayList<String> names) {
|
|
| 497 |
System.out.println("Add parts: "+queries+" "+names);
|
|
| 498 |
|
|
| 499 |
if (queries.size() == 0) {
|
|
| 500 |
Log.warning("Error: no queries");
|
|
| 501 |
return false; |
|
| 502 |
} |
|
| 503 |
if (names.size() == 0) {
|
|
| 504 |
Log.warning("Error: no names.");
|
|
| 505 |
return false; |
|
| 506 |
} |
|
| 507 |
if (names.size() != queries.size()) {
|
|
| 508 |
Log.warning("Error: names and queries sizes differ.");
|
|
| 509 |
return false; |
|
| 510 |
} |
|
| 511 |
try {
|
|
| 512 |
for (int i = 0 ; i < names.size() ; i++) {
|
|
| 513 |
Part p = new Part(getResult(), names.get(i), queries.get(i)); |
|
| 514 |
|
|
| 515 |
if (p.compute() && p.getSize() > 0) { // the part is OK, update the partition parameters
|
|
| 516 |
getResult().getQueriesParameter().add(queries.get(i)); |
|
| 517 |
getResult().getPartNamesParameter().add(names.get(i)); |
|
| 518 |
} else {
|
|
| 519 |
p.delete(); // remove bad results |
|
| 520 |
} |
|
| 521 |
} |
|
| 522 |
|
|
| 523 |
compute(false); |
|
| 524 |
|
|
| 525 |
updateEditorFromResult(false); |
|
| 526 |
} |
|
| 527 |
catch (Exception e) {
|
|
| 528 |
// TODO Auto-generated catch block |
|
| 529 |
e.printStackTrace(); |
|
| 530 |
return false; |
|
| 531 |
} |
|
| 532 |
return true; |
|
| 533 |
} |
|
| 534 |
|
|
| 291 | 535 |
@Override |
| 292 | 536 |
public void updateResultFromEditor() {
|
| 293 | 537 |
// nothing to do |
| 294 | 538 |
} |
| 295 |
|
|
| 539 |
|
|
| 296 | 540 |
@Override |
| 297 | 541 |
public void updateEditorFromResult(boolean update) throws Exception {
|
| 298 | 542 |
partsViewer.setInput(getResult()); |
| TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/SubcorpusEditor.java (revision 3980) | ||
|---|---|---|
| 11 | 11 |
import org.eclipse.swt.events.SelectionListener; |
| 12 | 12 |
import org.eclipse.swt.layout.GridData; |
| 13 | 13 |
import org.eclipse.swt.layout.GridLayout; |
| 14 |
import org.eclipse.swt.widgets.Button; |
|
| 15 |
import org.eclipse.swt.widgets.Composite; |
|
| 14 | 16 |
import org.eclipse.swt.widgets.Control; |
| 15 | 17 |
import org.eclipse.swt.widgets.Group; |
| 16 | 18 |
import org.eclipse.swt.widgets.Label; |
| ... | ... | |
| 27 | 29 |
import org.txm.rcp.messages.TXMUIMessages; |
| 28 | 30 |
import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget; |
| 29 | 31 |
import org.txm.rcp.swt.widget.structures.ComplexSubcorpusPanel; |
| 32 |
import org.txm.rcp.swt.widget.structures.ContextsSubcorpusPanel; |
|
| 30 | 33 |
import org.txm.rcp.swt.widget.structures.SimpleSubcorpusPanel; |
| 31 | 34 |
import org.txm.rcp.views.corpora.CorporaView; |
| 32 | 35 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
| 33 | 36 |
import org.txm.searchengine.cqp.corpus.query.Match; |
| 34 | 37 |
|
| 35 | 38 |
public class SubcorpusEditor extends TXMEditor<Subcorpus> {
|
| 36 |
|
|
| 39 |
|
|
| 37 | 40 |
protected static final String ASSISTANTS_GROUPNAME = "Assistants"; |
| 38 | 41 |
private Label nameLabel; |
| 39 | 42 |
@Parameter(key = TXMPreferences.USER_NAME) |
| 40 |
|
|
| 43 |
|
|
| 41 | 44 |
private Text nameText; |
| 42 |
|
|
| 45 |
|
|
| 43 | 46 |
private Label queryLabel; |
| 44 |
|
|
| 47 |
|
|
| 45 | 48 |
@Parameter(key = TXMPreferences.QUERY) |
| 46 | 49 |
private AssistedChoiceQueryWidget queryWidget; |
| 47 |
|
|
| 50 |
|
|
| 48 | 51 |
Label matchesInfo; |
| 49 | 52 |
Text matchStartsEndsInfo; |
| 53 |
Composite assistantPanel; |
|
| 50 | 54 |
private Group modeGroups; |
| 51 | 55 |
private ToolItem refreshQueryButton; |
| 52 |
|
|
| 56 |
private Button updateQueryFromAssistance; |
|
| 57 |
|
|
| 53 | 58 |
@Override |
| 54 | 59 |
public void _createPartControl() throws Exception {
|
| 55 |
|
|
| 60 |
|
|
| 56 | 61 |
getSite().getPage().addPartListener(new IPartListener() {
|
| 57 |
|
|
| 62 |
|
|
| 58 | 63 |
@Override |
| 59 | 64 |
public void partOpened(IWorkbenchPart part) { }
|
| 60 |
|
|
| 65 |
|
|
| 61 | 66 |
@Override |
| 62 | 67 |
public void partDeactivated(IWorkbenchPart part) { }
|
| 63 |
|
|
| 68 |
|
|
| 64 | 69 |
@Override |
| 65 | 70 |
public void partClosed(IWorkbenchPart part) {
|
| 66 | 71 |
TXMResult r = getResult(); |
| ... | ... | |
| 69 | 74 |
CorporaView.refresh(); |
| 70 | 75 |
} |
| 71 | 76 |
} |
| 72 |
|
|
| 77 |
|
|
| 73 | 78 |
@Override |
| 74 | 79 |
public void partBroughtToTop(IWorkbenchPart part) { }
|
| 75 |
|
|
| 80 |
|
|
| 76 | 81 |
@Override |
| 77 | 82 |
public void partActivated(IWorkbenchPart part) { }
|
| 78 | 83 |
}); |
| 79 |
|
|
| 84 |
|
|
| 80 | 85 |
// Modified computing listeners to manage multi lines query widgets |
| 81 |
ComputeKeyListener computeKeyListener = new ComputeKeyListener(this) {
|
|
| 82 |
|
|
| 83 |
@Override
|
|
| 84 |
public void keyPressed(KeyEvent e) {
|
|
| 85 |
|
|
| 86 |
if (queryWidget.getQuery() == null) return;
|
|
| 87 |
if (!queryWidget.getQuery().getSearchEngine().hasMultiLineQueries()) super.keyPressed(e);
|
|
| 88 |
}
|
|
| 89 |
};
|
|
| 86 |
ComputeKeyListener computeKeyListener = new ComputeKeyListener(this) {
|
|
| 87 |
|
|
| 88 |
@Override |
|
| 89 |
public void keyPressed(KeyEvent e) {
|
|
| 90 |
|
|
| 91 |
if (queryWidget.getQuery() == null) return; |
|
| 92 |
if (!queryWidget.getQuery().getSearchEngine().hasMultiLineQueries()) super.keyPressed(e); |
|
| 93 |
} |
|
| 94 |
}; |
|
| 90 | 95 |
|
| 91 | 96 |
getMainParametersComposite().getLayout().numColumns = 4; |
| 92 |
|
|
| 97 |
|
|
| 93 | 98 |
nameLabel = new Label(getMainParametersComposite(), SWT.NONE); |
| 94 | 99 |
nameLabel.setText(TXMUIMessages.name); |
| 95 | 100 |
nameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
| 96 |
|
|
| 101 |
|
|
| 97 | 102 |
nameText = new Text(this.getMainParametersComposite(), SWT.BORDER); |
| 98 | 103 |
GridData gdata = new GridData(SWT.FILL, SWT.CENTER, true, false); |
| 99 | 104 |
nameText.setLayoutData(gdata); |
| 100 | 105 |
gdata.widthHint = 150; |
| 101 | 106 |
nameText.addModifyListener(computeKeyListener); |
| 102 |
|
|
| 107 |
|
|
| 103 | 108 |
queryLabel = new Label(getMainParametersComposite(), SWT.NONE); |
| 104 | 109 |
queryLabel.setText(TXMUIMessages.ampQuery); |
| 105 | 110 |
queryLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
| 106 |
|
|
| 111 |
|
|
| 107 | 112 |
queryWidget = new AssistedChoiceQueryWidget(this.getMainParametersComposite(), SWT.BORDER|SWT.DROP_DOWN | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL, getResult()); |
| 108 |
queryWidget.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true)); |
|
| 113 |
gdata = new GridData(SWT.FILL, SWT.FILL, true, true); |
|
| 114 |
gdata.minimumWidth = 400; |
|
| 115 |
queryWidget.setLayoutData(gdata); |
|
| 109 | 116 |
queryWidget.addKeyListener(computeKeyListener); |
| 110 | 117 |
queryWidget.getQueryWidget().addModifyListener(computeKeyListener); |
| 111 |
|
|
| 118 |
|
|
| 112 | 119 |
ArrayList<String> modes = new ArrayList<String>(); |
| 113 | 120 |
final ArrayList<SelectionListener> listeners = new ArrayList<SelectionListener>(); |
| 114 |
|
|
| 121 |
|
|
| 115 | 122 |
// MODE TABS |
| 116 | 123 |
SelectionListener openCloseSelectionListener = new SelectionListener() {
|
| 117 | 124 |
@Override |
| 118 | 125 |
public void widgetSelected(SelectionEvent e) {
|
| 119 |
|
|
| 120 |
boolean v = getTopToolbar().isVisible(ASSISTANTS_GROUPNAME); |
|
| 121 |
if (!v) { // not visible remove all composites
|
|
| 122 |
if (modeGroups.getChildren().length > 0) {
|
|
| 123 |
Control c = modeGroups.getChildren()[0]; |
|
| 124 |
if (c instanceof SimpleSubcorpusPanel) {
|
|
| 125 |
SimpleSubcorpusPanel ssp = (SimpleSubcorpusPanel)c; |
|
| 126 |
String q = ssp.getQueryString(); |
|
| 127 |
if (q.length() > 0) {
|
|
| 128 |
queryWidget.setText(q); |
|
| 129 |
} |
|
| 130 |
} else if (c instanceof ComplexSubcorpusPanel) {
|
|
| 131 |
ComplexSubcorpusPanel ssp = (ComplexSubcorpusPanel)c; |
|
| 132 |
GridData gdata = new GridData(GridData.FILL, GridData.FILL, true, true); |
|
| 133 |
ssp.setLayoutData(gdata); |
|
| 134 |
gdata.heightHint = 600; |
|
| 135 |
String q = ssp.getQueryString(); |
|
| 136 |
if (q.length() > 0) {
|
|
| 137 |
queryWidget.setText(q); |
|
| 138 |
} |
|
| 126 |
|
|
| 127 |
if (e.getSource() == updateQueryFromAssistance) { // copy query
|
|
| 128 |
Control c = modeGroups.getChildren()[0]; |
|
| 129 |
if (c instanceof SimpleSubcorpusPanel) {
|
|
| 130 |
SimpleSubcorpusPanel ssp = (SimpleSubcorpusPanel)c; |
|
| 131 |
String q = ssp.getQueryString(); |
|
| 132 |
if (q.length() > 0) {
|
|
| 133 |
queryWidget.setText(q); |
|
| 134 |
nameText.setText(ssp.getGeneratedName()); |
|
| 139 | 135 |
} |
| 140 |
for (Control c2 : modeGroups.getChildren()) c2.dispose(); |
|
| 136 |
} else if (c instanceof ComplexSubcorpusPanel) {
|
|
| 137 |
ComplexSubcorpusPanel ssp = (ComplexSubcorpusPanel)c; |
|
| 138 |
String q = ssp.getQueryString(); |
|
| 139 |
if (q.length() > 0) {
|
|
| 140 |
queryWidget.setText(q); |
|
| 141 |
nameText.setText(ssp.getGeneratedName()); |
|
| 142 |
} |
|
| 141 | 143 |
} |
| 142 |
} else {
|
|
| 144 |
} else {
|
|
| 143 | 145 |
|
| 144 |
for (Control c : modeGroups.getChildren()) c.dispose();
|
|
| 146 |
for (Control c2 : modeGroups.getChildren()) c2.dispose();
|
|
| 145 | 147 |
|
| 146 |
if (modeGroups.getChildren().length == 0) {
|
|
| 147 |
listeners.get(0).widgetSelected(e); |
|
| 148 |
boolean v = getTopToolbar().isVisible(ASSISTANTS_GROUPNAME); |
|
| 149 |
if (v) { // not visible remove all composites
|
|
| 150 |
|
|
| 151 |
updateQueryFromAssistance.setEnabled(false); |
|
| 152 |
getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, false); |
|
| 153 |
} else {
|
|
| 154 |
|
|
| 155 |
updateQueryFromAssistance.setEnabled(true); |
|
| 156 |
if (modeGroups.getChildren().length == 0) { // select first mode by default
|
|
| 157 |
listeners.get(0).widgetSelected(e); |
|
| 158 |
} |
|
| 148 | 159 |
} |
| 160 |
|
|
| 161 |
modeGroups.layout(true); |
|
| 162 |
getResultArea().getParent().layout(true); |
|
| 149 | 163 |
} |
| 150 | 164 |
} |
| 151 |
|
|
| 165 |
|
|
| 152 | 166 |
@Override |
| 153 | 167 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
| 154 | 168 |
}; |
| 155 |
|
|
| 169 |
|
|
| 156 | 170 |
modes.add("Simple");
|
| 157 | 171 |
modes.add("Assisted");
|
| 158 |
|
|
| 172 |
modes.add("Contexts");
|
|
| 173 |
|
|
| 159 | 174 |
listeners.add(new SelectionListener() { // create alistener to instantiate a new AnnotationArea
|
| 160 |
|
|
| 175 |
|
|
| 161 | 176 |
@Override |
| 162 | 177 |
public void widgetSelected(SelectionEvent e) {
|
| 163 | 178 |
try {
|
| 164 |
for (Control c : modeGroups.getChildren()) c.dispose(); |
|
| 165 |
|
|
| 179 |
for (Control c : modeGroups.getChildren()) c.dispose(); // clean
|
|
| 180 |
|
|
| 166 | 181 |
getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, true); |
| 167 |
|
|
| 168 |
SimpleSubcorpusPanel panel = new SimpleSubcorpusPanel(modeGroups, SWT.BORDER, null, getResult().getCorpusParent());
|
|
| 169 |
panel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
|
| 170 |
|
|
| 182 |
|
|
| 183 |
assistantPanel = new SimpleSubcorpusPanel(modeGroups, SWT.BORDER, null, getResult().getCorpusParent());
|
|
| 184 |
assistantPanel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
|
| 185 |
|
|
| 171 | 186 |
modeGroups.layout(true); |
| 172 | 187 |
getResultArea().getParent().layout(true); |
| 173 |
|
|
| 188 |
updateQueryFromAssistance.setEnabled(true); |
|
| 189 |
|
|
| 174 | 190 |
} catch (Exception e1) {
|
| 175 | 191 |
// TODO Auto-generated catch block |
| 176 | 192 |
e1.printStackTrace(); |
| 177 | 193 |
} |
| 178 | 194 |
} |
| 179 |
|
|
| 195 |
|
|
| 180 | 196 |
@Override |
| 181 | 197 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
| 182 | 198 |
}); |
| 183 | 199 |
listeners.add(new SelectionListener() { // create alistener to instantiate a new AnnotationArea
|
| 184 |
|
|
| 200 |
|
|
| 185 | 201 |
@Override |
| 186 | 202 |
public void widgetSelected(SelectionEvent e) {
|
| 187 | 203 |
try {
|
| 188 |
for (Control c : modeGroups.getChildren()) c.dispose(); |
|
| 189 |
|
|
| 204 |
for (Control c : modeGroups.getChildren()) c.dispose(); // clean
|
|
| 205 |
|
|
| 190 | 206 |
getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, true); |
| 191 |
|
|
| 192 |
ComplexSubcorpusPanel panel = new ComplexSubcorpusPanel(modeGroups, SWT.BORDER, getResult().getCorpusParent());
|
|
| 193 |
panel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
|
| 194 |
|
|
| 207 |
|
|
| 208 |
assistantPanel = new ComplexSubcorpusPanel(modeGroups, SWT.BORDER, getResult().getCorpusParent());
|
|
| 209 |
assistantPanel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
|
| 210 |
|
|
| 195 | 211 |
modeGroups.layout(true); |
| 196 | 212 |
getResultArea().getParent().layout(true); |
| 197 |
|
|
| 213 |
updateQueryFromAssistance.setEnabled(true); |
|
| 214 |
|
|
| 198 | 215 |
} catch (Exception e1) {
|
| 199 | 216 |
// TODO Auto-generated catch block |
| 200 | 217 |
e1.printStackTrace(); |
| 201 | 218 |
} |
| 202 | 219 |
} |
| 203 |
|
|
| 220 |
|
|
| 204 | 221 |
@Override |
| 205 | 222 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
| 206 | 223 |
}); |
| 224 |
listeners.add(new SelectionListener() { // create alistener to instantiate a new AnnotationArea
|
|
| 225 |
|
|
| 226 |
@Override |
|
| 227 |
public void widgetSelected(SelectionEvent e) {
|
|
| 228 |
try {
|
|
| 229 |
for (Control c : modeGroups.getChildren()) c.dispose(); // clean |
|
| 230 |
|
|
| 231 |
getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, true); |
|
| 232 |
|
|
| 233 |
assistantPanel = new ContextsSubcorpusPanel(modeGroups, SWT.BORDER, getResult().getCorpusParent()); |
|
| 234 |
assistantPanel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
| 235 |
|
|
| 236 |
modeGroups.layout(true); |
|
| 237 |
getResultArea().getParent().layout(true); |
|
| 238 |
updateQueryFromAssistance.setEnabled(true); |
|
| 239 |
|
|
| 240 |
} catch (Exception e1) {
|
|
| 241 |
// TODO Auto-generated catch block |
|
| 242 |
e1.printStackTrace(); |
|
| 243 |
} |
|
| 244 |
} |
|
| 245 |
|
|
| 246 |
@Override |
|
| 247 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 248 |
}); |
|
| 207 | 249 |
modeGroups = this.getTopToolbar().installAlternativesGroup(ASSISTANTS_GROUPNAME, ASSISTANTS_GROUPNAME, IImageKeys.ACTION_ASSISTQUERY, null, false, openCloseSelectionListener, modes, listeners); |
| 208 | 250 |
modeGroups.setLayout(new GridLayout(1, true)); |
| 209 |
|
|
| 251 |
|
|
| 210 | 252 |
// RESULT AREA |
| 211 |
|
|
| 253 |
|
|
| 254 |
updateQueryFromAssistance = new Button(this.getResultArea(), SWT.PUSH); |
|
| 255 |
updateQueryFromAssistance.setText("Update query from query assitant");
|
|
| 256 |
updateQueryFromAssistance.addSelectionListener(openCloseSelectionListener); |
|
| 257 |
updateQueryFromAssistance.setEnabled(false); |
|
| 258 |
|
|
| 212 | 259 |
matchesInfo = new Label(this.getResultArea(), SWT.NONE); |
| 213 | 260 |
matchesInfo.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false)); |
| 214 |
|
|
| 261 |
|
|
| 215 | 262 |
matchStartsEndsInfo = new Text(this.getResultArea(), SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); |
| 216 | 263 |
matchStartsEndsInfo.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, true)); |
| 217 | 264 |
} |
| 218 |
|
|
| 265 |
|
|
| 219 | 266 |
protected void refreshQuery() {
|
| 220 | 267 |
System.out.println("Refresh query...");
|
| 221 | 268 |
} |
| 222 |
|
|
| 269 |
|
|
| 223 | 270 |
@Override |
| 224 | 271 |
public void updateResultFromEditor() {
|
| 225 | 272 |
// nothing to do |
| 226 | 273 |
} |
| 227 |
|
|
| 274 |
|
|
| 228 | 275 |
@Override |
| 229 | 276 |
public void updateEditorFromResult(boolean update) throws Exception {
|
| 230 |
|
|
| 277 |
|
|
| 231 | 278 |
List<? extends org.txm.objects.Match> matches = getResult().getMatches(); |
| 232 | 279 |
if (matches == null || matches.size() == 0) {
|
| 233 |
|
|
| 280 |
|
|
| 234 | 281 |
if (getResult().hasBeenComputedOnce()) {
|
| 235 | 282 |
matchesInfo.setText(NLS.bind("{0} match and {1} token", 0, 0));
|
| 236 | 283 |
} else {
|
| 237 |
matchesInfo.setText("(not computed yes)");
|
|
| 284 |
matchesInfo.setText("(not computed yet)");
|
|
| 238 | 285 |
} |
| 239 | 286 |
matchStartsEndsInfo.setText("");
|
| 240 | 287 |
} else {
|
| TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/plugin.xml (revision 3980) | ||
|---|---|---|
| 99 | 99 |
id="org.txm.searchengine.cqp.rcp.preferences.SubcorpusPreferencePage" |
| 100 | 100 |
name="%page.name.0"> |
| 101 | 101 |
</page> |
| 102 |
<page |
|
| 103 |
category="org.txm.rcp.preferences.UserPreferencePage" |
|
| 104 |
class="org.txm.searchengine.cqp.rcp.preferences.PartitionPreferencePage" |
|
| 105 |
id="org.txm.searchengine.cqp.rcp.preferences.PartitionPreferencePage" |
|
| 106 |
name="Partition"> |
|
| 107 |
</page> |
|
| 102 | 108 |
</extension> |
| 103 | 109 |
<extension |
| 104 | 110 |
point="org.eclipse.ui.menus"> |
| TXM/trunk/bundles/org.txm.partition.rcp/src/org/txm/partition/rcp/preferences/PartitionPreferencePage.java (revision 3980) | ||
|---|---|---|
| 1 |
// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté |
|
| 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.partition.rcp.preferences; |
|
| 29 |
|
|
| 30 |
import org.eclipse.jface.preference.BooleanFieldEditor; |
|
| 31 |
import org.eclipse.swt.widgets.Composite; |
|
| 32 |
import org.eclipse.ui.IWorkbench; |
|
| 33 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
|
| 34 |
import org.txm.core.messages.TXMCoreMessages; |
|
| 35 |
import org.txm.partition.core.preferences.PartitionDimensionsPreferences; |
|
| 36 |
import org.txm.partition.rcp.messages.PartitionUIMessages; |
|
| 37 |
import org.txm.rcp.preferences.TXMPreferencePage; |
|
| 38 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
|
| 39 |
|
|
| 40 |
/** |
|
| 41 |
* Partition preference page. |
|
| 42 |
* @author mdecorde |
|
| 43 |
* @author sjacquot |
|
| 44 |
* |
|
| 45 |
*/ |
|
| 46 |
public class PartitionPreferencePage extends TXMPreferencePage {
|
|
| 47 |
|
|
| 48 |
/** |
|
| 49 |
* Creates the field editors. Field editors are abstractions of the common |
|
| 50 |
* GUI blocks needed to manipulate various types of preferences. Each field |
|
| 51 |
* editor knows how to save and restore itself. |
|
| 52 |
*/ |
|
| 53 |
@Override |
|
| 54 |
public void createFieldEditors() {
|
|
| 55 |
|
|
| 56 |
// Charts rendering |
|
| 57 |
Composite chartsTab = SWTChartsComponentsProvider.createChartsRenderingPreferencesTabFolderComposite(this.getFieldEditorParent(), PartitionUIMessages.dimensionsChartRendering); |
|
| 58 |
|
|
| 59 |
this.addField(new BooleanFieldEditor(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE, PartitionUIMessages.sortByPartSize, chartsTab)); |
|
| 60 |
this.addField(new BooleanFieldEditor(PartitionDimensionsPreferences.CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE, PartitionUIMessages.displayPartsCountInChartTitle, chartsTab)); |
|
| 61 |
|
|
| 62 |
// other shared preferences |
|
| 63 |
SWTChartsComponentsProvider.createChartsRenderingPreferencesFields(this, chartsTab); |
|
| 64 |
|
|
| 65 |
} |
|
| 66 |
|
|
| 67 |
@Override |
|
| 68 |
public void init(IWorkbench workbench) {
|
|
| 69 |
this.setPreferenceStore(new TXMPreferenceStore(PartitionDimensionsPreferences.getInstance().getPreferencesNodeQualifier())); |
|
| 70 |
this.setTitle(TXMCoreMessages.common_description); |
|
| 71 |
} |
|
| 72 |
} |
|
| TXM/trunk/bundles/org.txm.partition.rcp/src/org/txm/partition/rcp/preferences/PartitionDimensionsPreferencePage.java (revision 3980) | ||
|---|---|---|
| 1 |
// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté |
|
| 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.partition.rcp.preferences; |
|
| 29 |
|
|
| 30 |
import org.eclipse.jface.preference.BooleanFieldEditor; |
|
| 31 |
import org.eclipse.swt.widgets.Composite; |
|
| 32 |
import org.eclipse.ui.IWorkbench; |
|
| 33 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
|
| 34 |
import org.txm.core.messages.TXMCoreMessages; |
|
| 35 |
import org.txm.partition.core.preferences.PartitionDimensionsPreferences; |
|
| 36 |
import org.txm.partition.rcp.messages.PartitionUIMessages; |
|
| 37 |
import org.txm.rcp.preferences.TXMPreferencePage; |
|
| 38 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
|
| 39 |
|
|
| 40 |
/** |
|
| 41 |
* Partition preference page. |
|
| 42 |
* @author mdecorde |
|
| 43 |
* @author sjacquot |
|
| 44 |
* |
|
| 45 |
*/ |
|
| 46 |
public class PartitionDimensionsPreferencePage extends TXMPreferencePage {
|
|
| 47 |
|
|
| 48 |
/** |
|
| 49 |
* Creates the field editors. Field editors are abstractions of the common |
|
| 50 |
* GUI blocks needed to manipulate various types of preferences. Each field |
|
| 51 |
* editor knows how to save and restore itself. |
|
| 52 |
*/ |
|
| 53 |
@Override |
|
| 54 |
public void createFieldEditors() {
|
|
| 55 |
|
|
| 56 |
// Charts rendering |
|
| 57 |
Composite chartsTab = SWTChartsComponentsProvider.createChartsRenderingPreferencesTabFolderComposite(this.getFieldEditorParent(), PartitionUIMessages.dimensionsChartRendering); |
|
| 58 |
|
|
| 59 |
this.addField(new BooleanFieldEditor(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE, PartitionUIMessages.sortByPartSize, chartsTab)); |
|
| 60 |
this.addField(new BooleanFieldEditor(PartitionDimensionsPreferences.CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE, PartitionUIMessages.displayPartsCountInChartTitle, chartsTab)); |
|
| 61 |
|
|
| 62 |
// other shared preferences |
|
| 63 |
SWTChartsComponentsProvider.createChartsRenderingPreferencesFields(this, chartsTab); |
|
| 64 |
|
|
| 65 |
} |
|
| 66 |
|
|
| 67 |
@Override |
|
| 68 |
public void init(IWorkbench workbench) {
|
|
| 69 |
this.setPreferenceStore(new TXMPreferenceStore(PartitionDimensionsPreferences.getInstance().getPreferencesNodeQualifier())); |
|
| 70 |
this.setTitle(TXMCoreMessages.common_description); |
|
| 71 |
} |
|
| 72 |
} |
|
| 0 | 73 | |
| TXM/trunk/bundles/org.txm.partition.rcp/OSGI-INF/l10n/bundle.properties (revision 3980) | ||
|---|---|---|
| 4 | 4 |
command.name=Dimensions |
| 5 | 5 |
command.tooltip=Dimensions |
| 6 | 6 |
editor.name=Dimensions |
| 7 |
page.name=Partition |
|
| 7 |
page.name=Partition dimensions |
|
| TXM/trunk/bundles/org.txm.partition.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 3980) | ||
|---|---|---|
| 4 | 4 |
command.name=Dimensions |
| 5 | 5 |
command.tooltip=Dimensions |
| 6 | 6 |
editor.name=Dimensions |
| 7 |
page.name=Partition |
|
| 7 |
page.name=Partition dimensions |
|
| TXM/trunk/bundles/org.txm.partition.rcp/plugin.xml (revision 3980) | ||
|---|---|---|
| 69 | 69 |
point="org.eclipse.ui.preferencePages"> |
| 70 | 70 |
<page |
| 71 | 71 |
category="org.txm.rcp.preferences.UserPreferencePage" |
| 72 |
class="org.txm.partition.rcp.preferences.PartitionPreferencePage" |
|
| 72 |
class="org.txm.partition.rcp.preferences.PartitionDimensionsPreferencePage"
|
|
| 73 | 73 |
id="org.txm.rcp.partition.preferences.PartitionPreferencePage" |
| 74 | 74 |
name="%page.name"> |
| 75 | 75 |
</page> |
| TXM/trunk/bundles/org.txm.index.core/src/org/txm/index/core/functions/Line.java (revision 3980) | ||
|---|---|---|
| 198 | 198 |
* @return the string |
| 199 | 199 |
*/ |
| 200 | 200 |
public String toString(String separator) {
|
| 201 |
|
|
| 201 | 202 |
String rez = ""; //$NON-NLS-1$ |
| 202 | 203 |
int len = 0; |
| 203 | 204 |
for (int i = 0; i < properties.size();) {
|
Formats disponibles : Unified diff