Révision 3148
tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/ImportWizard.java (revision 3148) | ||
---|---|---|
97 | 97 |
project.getEditionDefinition("default").setEnableCollapsible(false); |
98 | 98 |
project.getEditionDefinition("default").setPageBreakTag("pb"); |
99 | 99 |
project.getEditionDefinition("default").setPaginateEdition(true); |
100 |
project.getEditionDefinition("default").setWordsPerPage(500);
|
|
100 |
project.getEditionDefinition("default").setWordsPerPage(1000);
|
|
101 | 101 |
project.getEditionDefinition("default").setBuildEdition(true); |
102 | 102 |
|
103 | 103 |
Log.info(NLS.bind(TXMUIMessages.theP0CorpusWillBeCreatedFromTheP1Directory, project.getName(), project.getSrcdir())); |
... | ... | |
128 | 128 |
date = Calendar.getInstance().getTime(); // today |
129 | 129 |
} |
130 | 130 |
|
131 |
if (MessageDialog.openQuestion(ImportWizard.this.getShell(), NLS.bind(TXMUIMessages.p0Import, project), NLS.bind(TXMUIMessages.theP1P0CorpusWillBeReplaced+"\nContinue ?", project, date))) { |
|
131 |
// if (MessageDialog.openQuestion(ImportWizard.this.getShell(), NLS.bind(TXMUIMessages.p0Import, project), NLS.bind(TXMUIMessages.theP1P0CorpusWillBeReplaced+"\nContinue ?", project, date))) {
|
|
132 | 132 |
Log.info(NLS.bind(TXMUIMessages.theP1P0CorpusWillBeReplaced, project, date)); |
133 |
} else { |
|
134 |
Log.info(TXMUIMessages.abort); |
|
135 |
return false; |
|
136 |
} |
|
133 |
// } else {
|
|
134 |
// Log.info(TXMUIMessages.abort);
|
|
135 |
// return false;
|
|
136 |
// }
|
|
137 | 137 |
|
138 | 138 |
|
139 | 139 |
} |
... | ... | |
141 | 141 |
// if (!project.hasEditionDefinition("default")) { |
142 | 142 |
// EditionDefinition def = project.getEditionDefinition("default"); |
143 | 143 |
// def.setBuildEdition(true); |
144 |
// def.setWordsPerPage(500);
|
|
144 |
// def.setWordsPerPage(1000);
|
|
145 | 145 |
// def.setPageBreakTag("pb"); |
146 | 146 |
// } |
147 | 147 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/menu/MacrosMenuContribution.java (revision 3148) | ||
---|---|---|
16 | 16 |
import org.eclipse.ui.IWorkbenchPart; |
17 | 17 |
import org.eclipse.ui.IWorkbenchWindow; |
18 | 18 |
import org.txm.Toolbox; |
19 |
import org.txm.rcp.IImageKeys; |
|
19 | 20 |
import org.txm.rcp.TXMWindows; |
20 | 21 |
import org.txm.rcp.handlers.scripts.ExecuteGroovyMacro; |
21 | 22 |
import org.txm.rcp.views.corpora.CorporaView; |
22 | 23 |
import org.txm.utils.logger.Log; |
23 | 24 |
|
24 | 25 |
public class MacrosMenuContribution extends ContributionItem { |
25 |
|
|
26 |
|
|
26 | 27 |
Menu menu; |
27 | 28 |
int index; |
28 | 29 |
public MacrosMenuContribution() { |
... | ... | |
31 | 32 |
public MacrosMenuContribution(String id) { |
32 | 33 |
super(id); |
33 | 34 |
} |
34 |
|
|
35 |
|
|
35 | 36 |
@Override |
36 | 37 |
public void fill(Menu menu, int index) { |
37 | 38 |
this.menu = menu; |
38 | 39 |
this.index = index; |
39 |
|
|
40 |
|
|
40 |
|
|
41 |
|
|
41 | 42 |
menu.addMenuListener(new MenuListener() { |
42 |
|
|
43 |
|
|
43 | 44 |
@Override |
44 | 45 |
public void menuShown(MenuEvent e) { |
45 | 46 |
onOpen(MacrosMenuContribution.this.menu, MacrosMenuContribution.this.index); |
46 | 47 |
} |
47 |
|
|
48 |
|
|
48 | 49 |
@Override |
49 | 50 |
public void menuHidden(MenuEvent e) { } |
50 | 51 |
}); |
51 | 52 |
} |
52 |
|
|
53 |
|
|
53 | 54 |
public File getMacroDirectory() { |
54 | 55 |
//create the menu item |
55 | 56 |
String w = Toolbox.getTxmHomePath(); |
56 | 57 |
if (w == null || w.length() == 0) return null; |
57 |
|
|
58 |
return new File(w, "scripts/groovy/user/"+this.getId().replace(".", "/"));
|
|
58 |
|
|
59 |
return new File(w, "scripts/groovy/user/org/txm/macro/");
|
|
59 | 60 |
} |
60 |
|
|
61 |
|
|
61 | 62 |
public void onOpen(Menu menu, int index) { |
62 |
|
|
63 |
|
|
63 | 64 |
File macroDirectory = getMacroDirectory(); |
64 | 65 |
if (macroDirectory == null) return; |
65 |
|
|
66 |
|
|
67 |
//System.out.println(macroDirectory); |
|
66 | 68 |
File[] files = macroDirectory.listFiles(); |
69 |
//System.out.println(files.length); |
|
67 | 70 |
if (files == null || files.length == 0) { |
68 |
|
|
71 |
|
|
69 | 72 |
MenuItem[] menuItems = menu.getItems(); |
70 | 73 |
for (int i = 0; i < menuItems.length; i++) { |
71 | 74 |
menuItems[i].dispose(); |
72 | 75 |
} |
73 |
|
|
76 |
|
|
74 | 77 |
MenuItem menuItem = new MenuItem(menu, SWT.CHECK, index); |
75 | 78 |
menuItem.setText("<no macro>"); |
76 | 79 |
menuItem.addSelectionListener(new SelectionAdapter() { |
... | ... | |
81 | 84 |
}); |
82 | 85 |
return; |
83 | 86 |
} |
84 |
|
|
87 |
|
|
85 | 88 |
populate(menu, macroDirectory, index); |
86 | 89 |
} |
87 |
|
|
90 |
|
|
88 | 91 |
public static void populate(Menu menu, File directory, int index) { |
89 |
|
|
92 |
|
|
90 | 93 |
// First empty |
91 | 94 |
MenuItem[] menuItems = menu.getItems(); |
92 | 95 |
for (int i = 0; i < menuItems.length; i++) { |
93 | 96 |
menuItems[i].dispose(); |
94 | 97 |
} |
95 |
|
|
98 |
|
|
96 | 99 |
// Find files |
97 | 100 |
File[] files = directory.listFiles(); |
98 |
|
|
101 |
|
|
99 | 102 |
// first are directories |
100 | 103 |
Arrays.sort(files, new Comparator<File>() { |
101 | 104 |
@Override |
... | ... | |
112 | 115 |
return 1; |
113 | 116 |
} |
114 | 117 |
} |
115 |
|
|
118 |
|
|
116 | 119 |
}); |
117 | 120 |
for (File f : files) { |
118 | 121 |
if (f.getName().endsWith("Macro.groovy")) { |
119 | 122 |
MenuItem menuItem = new MenuItem(menu, SWT.PUSH); |
120 | 123 |
menuItem.setText(f.getName().substring(0, f.getName().length()-12).replaceAll("([A-Z])([^A-Z])", " $1$2")); |
124 |
menuItem.setImage(IImageKeys.getImage(IImageKeys.SCRIPT_RUN)); |
|
121 | 125 |
menuItem.addSelectionListener(new MacroSelectionAdapter(f)); |
122 | 126 |
} else if (f.isDirectory()) { |
123 |
MenuItem subMenuItem = new MenuItem(menu, SWT.CASCADE); |
|
124 |
subMenuItem.setText(f.getName()); |
|
125 |
Menu submenu = new Menu(menu); |
|
126 |
subMenuItem.setMenu(submenu); |
|
127 |
populate(submenu, f, 0); |
|
127 |
File[] tmp = f.listFiles(); |
|
128 |
if (tmp != null && tmp.length > 0) { |
|
129 |
MenuItem subMenuItem = new MenuItem(menu, SWT.CASCADE); |
|
130 |
subMenuItem.setText(f.getName()); |
|
131 |
Menu submenu = new Menu(menu); |
|
132 |
subMenuItem.setMenu(submenu); |
|
133 |
populate(submenu, f, 0); |
|
134 |
} |
|
128 | 135 |
} |
129 | 136 |
} |
130 | 137 |
} |
131 |
|
|
138 |
|
|
132 | 139 |
public static class MacroSelectionAdapter extends SelectionAdapter { |
133 | 140 |
File macro; |
134 | 141 |
public MacroSelectionAdapter(File macro) { |
135 | 142 |
this.macro = macro; |
136 | 143 |
} |
137 |
|
|
144 |
|
|
138 | 145 |
public void widgetSelected(SelectionEvent e) { |
139 | 146 |
IWorkbenchWindow acWindow = TXMWindows.getActiveWindow(); |
140 | 147 |
IWorkbenchPart page = acWindow.getActivePage().getActivePart(); |
141 | 148 |
ExecuteGroovyMacro.execute(macro.getAbsolutePath(), page, CorporaView.getInstance().getTreeViewer().getSelection(), ""); |
142 | 149 |
} |
143 | 150 |
} |
144 |
|
|
151 |
|
|
145 | 152 |
public static class MacroDirectoryMenu extends Menu { |
146 |
|
|
153 |
|
|
147 | 154 |
File directory; |
148 | 155 |
int index; |
149 |
|
|
156 |
|
|
150 | 157 |
public MacroDirectoryMenu(Menu parentMenu, File dir, int i) { |
151 | 158 |
super(parentMenu); |
152 | 159 |
this.directory = dir; |
153 | 160 |
this.index = i; |
154 | 161 |
this.addMenuListener(new MenuListener() { |
155 |
|
|
162 |
|
|
156 | 163 |
@Override |
157 | 164 |
public void menuShown(MenuEvent e) { |
158 | 165 |
populate(MacroDirectoryMenu.this, directory, index); |
159 | 166 |
} |
160 |
|
|
167 |
|
|
161 | 168 |
@Override |
162 | 169 |
public void menuHidden(MenuEvent e) { } |
163 | 170 |
}); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 3148) | ||
---|---|---|
99 | 99 |
|
100 | 100 |
advancedUserMode = Advanced user mode |
101 | 101 |
|
102 |
allCriteria = All criteria (&) |
|
102 |
allCriteria = All criteria (&&)
|
|
103 | 103 |
|
104 | 104 |
alwaysSaveBeforeLaunching = Always save before launching |
105 | 105 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java (revision 3148) | ||
---|---|---|
109 | 109 |
tmpLabel = toolkit.createLabel(sectionClient, TXMUIMessages.wordsPerPage); |
110 | 110 |
tmpLabel.setLayoutData(getLabelGridData()); |
111 | 111 |
|
112 |
wordsPerPageText = toolkit.createText(sectionClient, "500", SWT.BORDER); //$NON-NLS-1$
|
|
112 |
wordsPerPageText = toolkit.createText(sectionClient, "1000", SWT.BORDER); //$NON-NLS-1$
|
|
113 | 113 |
TableWrapData gdata = getTextGridData(); |
114 | 114 |
wordsPerPageText.setLayoutData(gdata); |
115 | 115 |
} |
... | ... | |
305 | 305 |
if (pageBreakText != null) { |
306 | 306 |
page_break_tag = pageBreakText.getText(); |
307 | 307 |
} |
308 |
int words_per_page = 500;
|
|
308 |
int words_per_page = 1000;
|
|
309 | 309 |
if (wordsPerPageText != null) { |
310 | 310 |
words_per_page = Integer.parseInt(wordsPerPageText.getText()); |
311 | 311 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/ComplexSubcorpusPanel.java (revision 3148) | ||
---|---|---|
139 | 139 |
|
140 | 140 |
andBtn = new Button(andorGroup, SWT.RADIO); |
141 | 141 |
andBtn.setText(TXMUIMessages.allCriteria); |
142 |
andBtn.setSelection(true);
|
|
142 |
andBtn.setSelection(false);
|
|
143 | 143 |
|
144 | 144 |
Button orBtn = new Button(andorGroup, SWT.RADIO); |
145 | 145 |
orBtn.setText(TXMUIMessages.someCriteria); |
146 |
orBtn.setSelection(true); |
|
146 | 147 |
|
147 | 148 |
// structure choice |
148 | 149 |
Label l = new Label(this, SWT.None); |
... | ... | |
185 | 186 |
queryField = new Text(this, SWT.BORDER); |
186 | 187 |
queryField.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); |
187 | 188 |
Button refreshBtn = new Button(this, SWT.PUSH); |
188 |
refreshBtn.setText(TXMUIMessages.common_refresh);
|
|
189 |
refreshBtn.setText("Refresh the query");
|
|
189 | 190 |
refreshBtn.addSelectionListener(new SelectionListener() { |
190 | 191 |
|
191 | 192 |
@Override |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ChangeTXMWorkspace.java (revision 3148) | ||
---|---|---|
46 | 46 |
import org.eclipse.ui.internal.ide.ChooseWorkspaceData; |
47 | 47 |
import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog; |
48 | 48 |
import org.txm.Toolbox; |
49 |
import org.txm.core.preferences.TBXPreferences; |
|
49 | 50 |
import org.txm.rcp.Application; |
50 | 51 |
import org.txm.rcp.JobsTimer; |
51 | 52 |
import org.txm.rcp.messages.TXMUIMessages; |
... | ... | |
111 | 112 |
return false; |
112 | 113 |
} |
113 | 114 |
launchData.workspaceSelected(path); |
115 |
TBXPreferences.getInstance().put(TBXPreferences.USER_TXM_HOME, path); |
|
116 |
TBXPreferences.saveAll(); |
|
114 | 117 |
|
115 | 118 |
// Switch workspace : |
116 | 119 |
try { |
117 | 120 |
URL url = new URL("file", "", path); |
121 |
|
|
118 | 122 |
launchData.writePersistedData(); |
119 | 123 |
ChooseWorkspaceData.setShowDialogValue(false); |
120 | 124 |
PlatformUI.getWorkbench().restart(); // need to restart TXM to apply changes |
Formats disponibles : Unified diff