Révision 3084
tmp/org.txm.rcp/src/main/java/org/txm/rcp/IImageKeys.java (revision 3084) | ||
---|---|---|
139 | 139 |
/** The Constant SCRIPT. */ |
140 | 140 |
public static final String SCRIPT = "icons/objects/script.png"; //$NON-NLS-1$ |
141 | 141 |
|
142 |
/** The Constant SCRIPT. */ |
|
143 |
public static final String SCRIPT_RUN = "icons/functions/page_go.png"; //$NON-NLS-1$ |
|
144 |
|
|
142 | 145 |
/** The Constant SUBCORPUS. */ |
143 | 146 |
public static final String SUBCORPUS = "icons/objects/subcorpus.png"; //$NON-NLS-1$ |
144 | 147 |
|
... | ... | |
238 | 241 |
|
239 | 242 |
public static final String TXM = "icons/logo/TXM_logo_64x64.png"; |
240 | 243 |
|
244 |
public static final String TXM1616 = "icons/logo/TXM_logo_16x16.png"; |
|
245 |
|
|
241 | 246 |
public static final String SPLASH = "splash.bmp"; |
242 | 247 |
|
243 | 248 |
public static final String OPEN_DECORATOR = "icons/decorators/bullet_arrow_down.png"; |
... | ... | |
246 | 251 |
|
247 | 252 |
public static final String TXM_FLAT_LOGO = "icons/logo/TXM_flat_logo.png"; |
248 | 253 |
|
254 |
public static final String FILE_IMAGE = "icons/objects/file_image.png"; //$NON-NLS-1$ ; |
|
255 |
|
|
256 |
public static final String FILE_AUDIO = "icons/objects/file_audio.png"; //$NON-NLS-1$ ; |
|
257 |
|
|
258 |
public static final String FILE_VIDEO = "icons/objects/file_video.png"; //$NON-NLS-1$ ; |
|
259 |
|
|
260 |
public static final String FILE_DOC = "icons/objects/file_doc.png"; //$NON-NLS-1$ ; |
|
261 |
|
|
249 | 262 |
/** |
250 | 263 |
* Gets the image. |
251 | 264 |
* |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMBrowser.java (revision 3084) | ||
---|---|---|
108 | 108 |
return webbrowser.getBrowser(); |
109 | 109 |
} |
110 | 110 |
|
111 |
public void load(String url, String partName) { |
|
112 |
this.getBrowser().setUrl(url); |
|
113 |
setPartName(partName); |
|
114 |
} |
|
115 |
|
|
116 | 111 |
@Override |
117 | 112 |
public void setPartName(String partName) { |
118 | 113 |
super.setPartName(partName); |
... | ... | |
637 | 632 |
+ "else \n" |
638 | 633 |
+ "return node.ChildNodes;\n" |
639 | 634 |
+ "}\n" |
640 |
+ "function findSpans(c, a) {\n" + |
|
635 |
+ "findSpans = function findSpans(c, a) {\n" +
|
|
641 | 636 |
" for (var i = 0 ; i < c.length ; i++) {\n" + |
642 | 637 |
" if (c.item(i).tagName == \"SPAN\") {\n" + |
643 | 638 |
" var id = c.item(i).getAttribute(\"id\")\n" + |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 3084) | ||
---|---|---|
66 | 66 |
import org.txm.core.results.BeanParameters; |
67 | 67 |
import org.txm.core.results.Parameter; |
68 | 68 |
import org.txm.core.results.TXMResult; |
69 |
import org.txm.objects.CorpusBuild; |
|
69 | 70 |
import org.txm.rcp.JobsTimer; |
70 | 71 |
import org.txm.rcp.StatusLine; |
71 | 72 |
import org.txm.rcp.TXMWindows; |
... | ... | |
1044 | 1045 |
* @param result |
1045 | 1046 |
* @param editorPartId |
1046 | 1047 |
*/ |
1047 |
public static TXMEditor openEditor(TXMResult result, String editorPartId) { |
|
1048 |
public static TXMEditor<? extends TXMResult> openEditor(TXMResult result, String editorPartId) {
|
|
1048 | 1049 |
return openEditor(new TXMResultEditorInput<>(result), editorPartId); |
1049 | 1050 |
} |
1050 | 1051 |
|
... | ... | |
1068 | 1069 |
|
1069 | 1070 |
// since some editor fields need some values of their parent, |
1070 | 1071 |
// ensure the parents branch is ready (e.g. Sub-corpus properties in Cooccurrence editor, etc.) |
1071 |
// show modal blocking cancelable progression dialog
|
|
1072 |
// show modal blocking&cancelable progression dialog
|
|
1072 | 1073 |
if (!wasAlreadyOpened |
1073 | 1074 |
// && !editorInput.getResult().getParent().hasBeenComputedOnce() |
1074 | 1075 |
) { |
... | ... | |
1079 | 1080 |
// StatusLine.setMessage(editorInput.getResult().getComputingStartMessage()); |
1080 | 1081 |
// } |
1081 | 1082 |
// catch (Exception e) { |
1082 |
// // TODO Auto-generated catch block |
|
1083 | 1083 |
// e.printStackTrace(); |
1084 | 1084 |
// } |
1085 | 1085 |
// } |
... | ... | |
1126 | 1126 |
// editor.compute(false); // FIXME: temporary fix for the AHC SVG bug but there are 2 computing (skipped but it stays a quick'n'dirty fix) |
1127 | 1127 |
editor.refresh(false); |
1128 | 1128 |
|
1129 |
// TODO: SJ: focus in the main widget
|
|
1130 |
// or maybe better to do the call directly at the end of TXMEditor.refresh()?
|
|
1129 |
// TODO SJ: focus in the main widget or maybe better to do the call directly at the end of TXMEditor.refresh()?
|
|
1130 |
// TODO MD: I don't think because it will force focus when a linked editor is refreshed
|
|
1131 | 1131 |
// editor.setFocus(); |
1132 | 1132 |
|
1133 | 1133 |
// } |
... | ... | |
1160 | 1160 |
return; |
1161 | 1161 |
} |
1162 | 1162 |
|
1163 |
String className = this.getClass().getSimpleName(); |
|
1164 |
if (className.isEmpty()) { // anonymous class case |
|
1165 |
className = this.getClass().getSuperclass().getSimpleName(); |
|
1166 |
} |
|
1167 |
|
|
1163 | 1168 |
// this.parent.setRedraw(false); |
1164 | 1169 |
|
1165 | 1170 |
this.notifyExtensions("notifyStartOfRefresh"); //$NON-NLS-1$ |
... | ... | |
1181 | 1186 |
// SJ: need to check all works fine, it also was dedicated to not refresh the Editor from result after a computing, it's not needed since the computing has been done |
1182 | 1187 |
// from fields themselves |
1183 | 1188 |
// if (!update) { |
1184 |
// FIXME: debug |
|
1185 |
String className = this.getClass().getSimpleName(); |
|
1186 |
if (className.isEmpty()) { // anonymous class case |
|
1187 |
className = this.getClass().getSuperclass().getSimpleName(); |
|
1188 |
} |
|
1189 | 1189 |
|
1190 |
this.initializeEditorFieldsFromResult(update); |
|
1191 |
|
|
1190 | 1192 |
Log.finest("TXMEditor.refresh(): " + className + ": auto updating editor from result: " + this.getResult().getClass().getSimpleName() + "."); //$NON-NLS-1$ |
1191 | 1193 |
this.autoUpdateEditorFieldsFromResult(update); // auto update from Parameter annotations |
1192 | 1194 |
|
1193 |
// FIXME: debug |
|
1194 | 1195 |
Log.finest("TXMEditor.refresh(): " + className + ": updating subclass editor from result: " + this.getResult().getClass().getSimpleName() + "."); //$NON-NLS-1$ //$NON-NLS-2$ |
1195 | 1196 |
this.updateEditorFromResult(update); // subclasses manual settings |
1196 | 1197 |
// } |
... | ... | |
1255 | 1256 |
// this.parent.setRedraw(true); |
1256 | 1257 |
} |
1257 | 1258 |
|
1259 |
protected boolean firstFieldsInitializationDone = false; |
|
1260 |
|
|
1258 | 1261 |
/** |
1262 |
* Fields initialization to be done before setting new values from the TXMResult in the refresh() before calling autoUpdateFieldsValuesFromResult() |
|
1263 |
* |
|
1264 |
* @param update |
|
1265 |
*/ |
|
1266 |
private void initializeEditorFieldsFromResult(boolean update) throws Exception { |
|
1267 |
if (!firstFieldsInitializationDone) { |
|
1268 |
firstInitializeEditorFieldsFromResult(update); |
|
1269 |
firstFieldsInitializationDone = true; |
|
1270 |
} |
|
1271 |
reinitializeEditorFieldsFromResult(update); |
|
1272 |
} |
|
1273 |
|
|
1274 |
/** |
|
1275 |
* Fields re-initialization to be done before setting new values from the TXMResult in the refresh() before calling autoUpdateFieldsValuesFromResult() |
|
1276 |
* |
|
1277 |
* eg, if a new property is available a List can update its available values |
|
1278 |
* |
|
1279 |
* rewrite this method if you need extra initialization to be done |
|
1280 |
* |
|
1281 |
* TODO MD: see if this method should be abstract to force TXMEditors initialization pattern |
|
1282 |
* |
|
1283 |
* @param update |
|
1284 |
*/ |
|
1285 |
protected void reinitializeEditorFieldsFromResult(boolean update) throws Exception { |
|
1286 |
|
|
1287 |
} |
|
1288 |
|
|
1289 |
/** |
|
1290 |
* First fields initialization to be done before setting default/new values from the TXMResult |
|
1291 |
* |
|
1292 |
* This method will be called only one time by initializeEditorFieldsFromResult() |
|
1293 |
* |
|
1294 |
* rewrite this method if you need extra first initialization to be done |
|
1295 |
* |
|
1296 |
* TODO MD: see if this method should be abstract to force TXMEditors initialization pattern |
|
1297 |
* |
|
1298 |
* @param update |
|
1299 |
*/ |
|
1300 |
protected void firstInitializeEditorFieldsFromResult(boolean update) throws Exception { |
|
1301 |
|
|
1302 |
} |
|
1303 |
|
|
1304 |
/** |
|
1259 | 1305 |
* Synchronizes the result parameters with editor widgets. |
1260 | 1306 |
* |
1261 | 1307 |
* It should be called or called itself in the UI thread when accessing Widget parameters. |
... | ... | |
1372 | 1418 |
((PropertiesSelector) object).setSelectedProperties((List) value); |
1373 | 1419 |
} |
1374 | 1420 |
else if (value instanceof ReferencePattern) { |
1375 |
((PropertiesSelector) object).setSelectedProperties(((ReferencePattern) value).getProperties()); |
|
1421 |
((PropertiesSelector<Property>) object).setSelectedProperties(((ReferencePattern) value).getProperties());
|
|
1376 | 1422 |
} |
1377 | 1423 |
// single |
1378 | 1424 |
else { |
1379 |
((PropertiesSelector) object).setSelectedProperty((Property) value); |
|
1425 |
((PropertiesSelector<Property>) object).setSelectedProperty((Property) value);
|
|
1380 | 1426 |
} |
1381 | 1427 |
} |
1382 | 1428 |
else if (object instanceof NewNavigationWidget) { |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorToolBar.java (revision 3084) | ||
---|---|---|
35 | 35 |
* |
36 | 36 |
*/ |
37 | 37 |
public class TXMEditorToolBar extends ToolBar { |
38 |
|
|
38 |
|
|
39 | 39 |
/** |
40 | 40 |
* The linked <code>TXMEditor</code>. |
41 | 41 |
*/ |
42 | 42 |
protected TXMEditor<? extends TXMResult> editorPart; |
43 |
|
|
43 |
|
|
44 | 44 |
/** |
45 | 45 |
* Contains references to installed groups to composite. |
46 | 46 |
*/ |
47 |
private HashMap<String, Composite> groups = new HashMap<String, Composite>();
|
|
48 |
|
|
47 |
private HashMap<String, Composite> groups = new HashMap<>(); |
|
48 |
|
|
49 | 49 |
private GLComposite subWidgetComposite; |
50 | 50 |
|
51 | 51 |
/** |
52 | 52 |
* Contains references to installed groups to ToolItem. |
53 | 53 |
*/ |
54 |
private HashMap<String, ToolItem> buttons = new HashMap<String, ToolItem>();
|
|
55 |
|
|
54 |
private HashMap<String, ToolItem> buttons = new HashMap<>(); |
|
55 |
|
|
56 | 56 |
private ToolBarManager manager; |
57 |
|
|
57 |
|
|
58 | 58 |
/** |
59 | 59 |
* |
60 | 60 |
* The parent layout must be a GridLayout. |
... | ... | |
72 | 72 |
this.subWidgetComposite = subWidgetComposite; |
73 | 73 |
// permit to contribute via RCP plugin.xml menu extension |
74 | 74 |
manager = new ToolBarManager(this); |
75 |
IMenuService menuService = (IMenuService) this.editorPart.getSite().getService(IMenuService.class);
|
|
75 |
IMenuService menuService = this.editorPart.getSite().getService(IMenuService.class); |
|
76 | 76 |
menuService.populateContributionManager(manager, "toolbar:" + toolbarId); //$NON-NLS-1$ |
77 | 77 |
} |
78 |
|
|
78 |
|
|
79 | 79 |
@Override |
80 |
protected void checkSubclass() { |
|
81 |
} |
|
82 |
|
|
80 |
protected void checkSubclass() {} |
|
81 |
|
|
83 | 82 |
public ToolBarManager getToolBarManager() { |
84 | 83 |
return manager; |
85 | 84 |
} |
... | ... | |
91 | 90 |
public GLComposite getSubWidgetComposite() { |
92 | 91 |
return subWidgetComposite; |
93 | 92 |
} |
94 |
|
|
93 |
|
|
95 | 94 |
/** |
96 | 95 |
* Gets the <code>TXMEditor</code> linked to this tool bar. |
96 |
* |
|
97 | 97 |
* @return the editorPart |
98 | 98 |
*/ |
99 | 99 |
public TXMEditor<? extends TXMResult> getEditorPart() { |
100 | 100 |
return editorPart; |
101 | 101 |
} |
102 |
|
|
102 |
|
|
103 | 103 |
/** |
104 | 104 |
* Sets the visibility state of the specified composite. |
105 | 105 |
* The mechanism is based on GridData.exclude to hide the composite therefore the composite must have a GridData as layout data. |
... | ... | |
107 | 107 |
* @param composite |
108 | 108 |
* |
109 | 109 |
*/ |
110 |
public void setVisible(String id, boolean visible) {
|
|
110 |
public void setVisible(String id, boolean visible) {
|
|
111 | 111 |
if (groups.containsKey(id) && !groups.get(id).isDisposed()) { |
112 | 112 |
Composite composite = groups.get(id); |
113 | 113 |
setVisible(composite, visible); |
114 | 114 |
} |
115 | 115 |
} |
116 |
|
|
116 |
|
|
117 | 117 |
/** |
118 | 118 |
* Sets the visibility state of the specified composite. |
119 | 119 |
* The mechanism is based on GridData.exclude to hide the composite therefore the composite must have a GridData as layout data. |
... | ... | |
121 | 121 |
* @param composite |
122 | 122 |
* |
123 | 123 |
*/ |
124 |
protected void setVisible(Composite composite, boolean visible) {
|
|
124 |
protected void setVisible(Composite composite, boolean visible) {
|
|
125 | 125 |
|
126 |
((GridData)composite.getLayoutData()).exclude = !visible; |
|
126 |
((GridData) composite.getLayoutData()).exclude = !visible;
|
|
127 | 127 |
composite.setVisible(visible); |
128 | 128 |
subWidgetComposite.layout(true); |
129 | 129 |
composite.layout(true); |
130 | 130 |
editorPart.layout(true); |
131 | 131 |
} |
132 |
|
|
133 |
|
|
132 |
|
|
133 |
|
|
134 | 134 |
/** |
135 | 135 |
* TODO not generic enough and call editorPart.getParametersGroupsComposite() |
136 | 136 |
* Shows/hides the command parameters group. |
137 |
* |
|
137 | 138 |
* @param visible |
138 | 139 |
*/ |
139 |
public void setComputingParametersVisible(boolean visible) {
|
|
140 |
public void setComputingParametersVisible(boolean visible) {
|
|
140 | 141 |
setVisible(TXMEditor.COMPUTING_PARAMETERS_GROUP_ID, visible); |
141 | 142 |
} |
142 |
|
|
143 |
|
|
143 |
|
|
144 |
|
|
144 | 145 |
/** |
145 | 146 |
* Adds the specified control to this toolbar. |
146 | 147 |
* Convenience method to add non-ToolItem controls to the toolbar using the SWT.SEPARATOR trick, plus packing and setting the right width. |
147 | 148 |
* |
148 | 149 |
* Warning: the item size is not synchronized with the control size |
150 |
* |
|
149 | 151 |
* @param control |
150 | 152 |
*/ |
151 |
public void addControl(final Control control) {
|
|
153 |
public void addControl(final Control control) {
|
|
152 | 154 |
final ToolItem itemSeparator = new ToolItem(this, SWT.SEPARATOR); |
153 | 155 |
control.pack(); |
154 | 156 |
itemSeparator.setWidth(control.getBounds().width); |
... | ... | |
161 | 163 |
} |
162 | 164 |
}); |
163 | 165 |
} |
164 |
|
|
166 |
|
|
165 | 167 |
/** |
166 | 168 |
* Creates a <code>GLComposite</code> in the toolbar subwidgets container. |
167 | 169 |
* |
168 |
* @param groupTitle the composite uniq title in the toolbar
|
|
170 |
* @param groupTitle the composite uniq title in the toolbar |
|
169 | 171 |
* @return |
170 | 172 |
*/ |
171 |
public GLComposite installGLComposite(String groupTitle, int numColumns, boolean makeColumnsEqualWidth) {
|
|
173 |
public GLComposite installGLComposite(String groupTitle, int numColumns, boolean makeColumnsEqualWidth) {
|
|
172 | 174 |
if (this.groups.containsKey(groupTitle)) { |
173 | 175 |
return (GLComposite) this.groups.get(groupTitle); |
174 | 176 |
} |
175 |
final GLComposite comp = new GLComposite(subWidgetComposite, SWT.NONE, "Group: "+groupTitle); |
|
177 |
final GLComposite comp = new GLComposite(subWidgetComposite, SWT.NONE, "Group: " + groupTitle); |
|
178 |
comp.getLayout().horizontalSpacing = 1; |
|
176 | 179 |
comp.getLayout().numColumns = numColumns; |
177 | 180 |
comp.getLayout().makeColumnsEqualWidth = makeColumnsEqualWidth; |
178 | 181 |
return comp; |
179 | 182 |
} |
180 |
|
|
183 |
|
|
181 | 184 |
/** |
182 | 185 |
* Creates a group with a dropdown button and multiple modes |
186 |
* |
|
183 | 187 |
* @param groupTitle |
184 | 188 |
* @param buttonToolTip |
185 | 189 |
* @param openIconFilePath |
... | ... | |
195 | 199 |
final DropDownCheckToolItem openCloseButton = new DropDownCheckToolItem(this, buttonToolTip, openIconFilePath, closeIconFilePath); |
196 | 200 |
|
197 | 201 |
openCloseButton.addSelectionListener(new SelectionListener() { |
198 |
|
|
202 |
|
|
199 | 203 |
@Override |
200 | 204 |
public void widgetSelected(SelectionEvent e) { |
201 | 205 |
if (e.doit) { |
... | ... | |
203 | 207 |
selectionListener.widgetSelected(e); |
204 | 208 |
} |
205 | 209 |
} |
206 |
|
|
210 |
|
|
207 | 211 |
@Override |
208 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
212 |
public void widgetDefaultSelected(SelectionEvent e) {} |
|
209 | 213 |
}); |
210 | 214 |
|
211 | 215 |
org.txm.rcp.swt.listeners.DropdownSelectionListener listenerOne = openCloseButton.getDropDownListener(); |
212 |
//listenerOne.setDefaultSelectionListener(selectionListener); |
|
213 |
for (int i = 0 ; i < modes.size() && i < modeSelectionListeners.size(); i++) {
|
|
216 |
// listenerOne.setDefaultSelectionListener(selectionListener);
|
|
217 |
for (int i = 0; i < modes.size() && i < modeSelectionListeners.size(); i++) { |
|
214 | 218 |
MenuItem item1 = new MenuItem(listenerOne.getMenu(), SWT.PUSH); |
215 | 219 |
item1.setText(modes.get(i)); |
216 | 220 |
item1.addSelectionListener(modeSelectionListeners.get(i)); |
... | ... | |
240 | 244 |
* @param openIconFilePath |
241 | 245 |
* @return the Group widget created |
242 | 246 |
*/ |
243 |
public Group installGroup(String groupTitle, String buttonToolTip, String openIconFilePath, String closeIconFilePath, boolean showGroup) {
|
|
244 |
|
|
247 |
public Group installGroup(String groupTitle, String buttonToolTip, String openIconFilePath, String closeIconFilePath, boolean showGroup) {
|
|
248 |
|
|
245 | 249 |
if (this.groups.containsKey(groupTitle)) { |
246 | 250 |
return (Group) this.groups.get(groupTitle); |
247 | 251 |
} |
248 |
|
|
252 |
|
|
249 | 253 |
final Group group = new Group(subWidgetComposite, SWT.NONE); |
250 | 254 |
group.setText(groupTitle); |
251 |
|
|
255 |
|
|
252 | 256 |
// FIXME: SJ: new version to avoid to redefine the grid layout in each subclasses editors |
253 |
// GridLayout layout = new GridLayout();
|
|
254 |
// layout.marginLeft = 5;
|
|
255 |
// layout.marginWidth = 0;
|
|
256 |
// layout.marginBottom = 0;
|
|
257 |
// layout.marginHeight = 0;
|
|
258 |
// layout.marginTop = 0;
|
|
259 |
|
|
257 |
// GridLayout layout = new GridLayout();
|
|
258 |
// layout.marginLeft = 5;
|
|
259 |
// layout.marginWidth = 0;
|
|
260 |
// layout.marginBottom = 0;
|
|
261 |
// layout.marginHeight = 0;
|
|
262 |
// layout.marginTop = 0;
|
|
263 |
|
|
260 | 264 |
// FIXME: SJ: old version |
261 | 265 |
RowLayout layout = new RowLayout(); |
262 | 266 |
layout.wrap = true; |
263 | 267 |
layout.center = true; |
264 | 268 |
layout.spacing = 8; |
265 | 269 |
layout.marginWidth = layout.marginBottom = layout.marginHeight = layout.marginTop = 0; |
266 |
|
|
270 |
|
|
267 | 271 |
group.setLayout(layout); |
268 |
|
|
272 |
|
|
269 | 273 |
GridData gd2 = new GridData(GridData.FILL_BOTH); |
270 | 274 |
gd2.grabExcessVerticalSpace = false; |
271 | 275 |
gd2.grabExcessHorizontalSpace = true; |
272 | 276 |
gd2.exclude = true; |
273 | 277 |
group.setLayoutData(gd2); |
274 | 278 |
group.setVisible(false); |
275 |
|
|
279 |
|
|
276 | 280 |
// add finally a button to the toolbar to show/hide the Group |
277 | 281 |
OpenCloseToolItem showParameters = new OpenCloseToolItem(this, groupTitle, openIconFilePath, closeIconFilePath, buttonToolTip); |
278 | 282 |
this.setVisible(group, showGroup); // default init |
279 |
|
|
283 |
|
|
280 | 284 |
showParameters.addSelectionListener(new SelectionListener() { |
281 |
|
|
285 |
|
|
282 | 286 |
@Override |
283 | 287 |
public void widgetSelected(SelectionEvent e) { |
284 | 288 |
OpenCloseToolItem b = (OpenCloseToolItem) e.widget; |
285 | 289 |
setVisible(group, b.getSelection()); |
286 | 290 |
} |
287 |
|
|
291 |
|
|
288 | 292 |
@Override |
289 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
293 |
public void widgetDefaultSelected(SelectionEvent e) {} |
|
290 | 294 |
}); |
291 |
|
|
295 |
|
|
292 | 296 |
this.groups.put(groupTitle, group); |
293 | 297 |
this.buttons.put(groupTitle, showParameters); |
294 | 298 |
return group; |
295 | 299 |
} |
296 |
|
|
300 |
|
|
297 | 301 |
public void unInstallGroup(String groupTitle) { |
298 | 302 |
if (this.groups.containsKey(groupTitle)) { |
299 |
this.groups.get(groupTitle).dispose();
|
|
303 |
this.groups.get(groupTitle).dispose(); |
|
300 | 304 |
} |
301 | 305 |
if (this.buttons.containsKey(groupTitle)) { |
302 |
this.buttons.get(groupTitle).dispose();
|
|
306 |
this.buttons.get(groupTitle).dispose(); |
|
303 | 307 |
} |
304 | 308 |
} |
305 |
|
|
309 |
|
|
306 | 310 |
public ToolItem getGroupButton(String groupTitle) { |
307 | 311 |
return this.buttons.get(groupTitle); |
308 | 312 |
} |
309 | 313 |
|
310 |
|
|
314 |
|
|
311 | 315 |
/** |
312 | 316 |
* Gets a ToolItem from RCP item contribution from plugin.xml by its id. |
317 |
* |
|
313 | 318 |
* @param id |
314 | 319 |
* @return |
315 | 320 |
*/ |
316 |
public ToolItem getItemByContributionId(String id) {
|
|
321 |
public ToolItem getItemByContributionId(String id) {
|
|
317 | 322 |
ToolItem item = null; |
318 | 323 |
for (int i = 0; i < this.getItemCount(); i++) { |
319 | 324 |
|
320 |
if(this.getItem(i).getData() != null && this.getItem(i).getData() instanceof HandledContributionItem) {
|
|
321 |
HandledContributionItem contribution = (HandledContributionItem) this.getItem(i).getData();
|
|
322 |
if(contribution.getId().equals(id)) {
|
|
325 |
if (this.getItem(i).getData() != null && this.getItem(i).getData() instanceof HandledContributionItem) {
|
|
326 |
HandledContributionItem contribution = (HandledContributionItem) this.getItem(i).getData(); |
|
327 |
if (contribution.getId().equals(id)) {
|
|
323 | 328 |
item = this.getItem(i); |
324 | 329 |
break; |
325 | 330 |
} |
... | ... | |
331 | 336 |
@Override |
332 | 337 |
public void setEnabled(boolean enabled) { |
333 | 338 |
super.setEnabled(enabled); |
334 |
for(Control c : this.getChildren()) { |
|
335 |
c.setEnabled(enabled);
|
|
339 |
for (Control c : this.getChildren()) {
|
|
340 |
c.setEnabled(enabled);
|
|
336 | 341 |
} |
337 | 342 |
} |
338 |
|
|
343 |
|
|
339 | 344 |
public boolean isVisible(String id) { |
340 | 345 |
if (!groups.containsKey(id)) return false; |
341 | 346 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/toolbar/DropDownCheckToolItem.java (revision 3084) | ||
---|---|---|
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
public class DropDownCheckToolItem extends ToolItem { |
19 |
|
|
19 |
|
|
20 | 20 |
boolean selected = false; |
21 |
|
|
21 | 22 |
private DropdownSelectionListener dropDownListener; |
23 |
|
|
22 | 24 |
private SelectionListener listener; |
23 | 25 |
|
24 | 26 |
/** |
... | ... | |
30 | 32 |
*/ |
31 | 33 |
public DropDownCheckToolItem(ToolBar parent, String title, String openIconFilePath, String closeIconFilePath) { |
32 | 34 |
super(parent, SWT.DROP_DOWN); |
33 |
|
|
34 |
this.dropDownListener = new org.txm.rcp.swt.listeners.DropdownSelectionListener(this); |
|
35 |
this.addSelectionListener(dropDownListener); // activate |
|
36 | 35 |
|
36 |
this.dropDownListener = new org.txm.rcp.swt.listeners.DropdownSelectionListener(parent, this); |
|
37 |
this.addSelectionListener(dropDownListener); // activate |
|
38 |
|
|
37 | 39 |
if (openIconFilePath != null) { |
38 | 40 |
openIcon = IImageKeys.getImage(openIconFilePath); |
39 | 41 |
this.setImage(openIcon); |
... | ... | |
41 | 43 |
if (closeIconFilePath != null) { |
42 | 44 |
closeIcon = IImageKeys.getImage(closeIconFilePath); |
43 | 45 |
} |
44 |
} else { |
|
46 |
} |
|
47 |
else { |
|
45 | 48 |
this.setText(title); |
46 | 49 |
} |
47 | 50 |
|
... | ... | |
68 | 71 |
if (closeIcon != null) { |
69 | 72 |
if (getSelection()) { |
70 | 73 |
setImage(closeIcon); |
71 |
} else { |
|
74 |
} |
|
75 |
else { |
|
72 | 76 |
setImage(openIcon); |
73 | 77 |
} |
74 | 78 |
} |
75 | 79 |
} |
76 |
|
|
80 |
|
|
81 |
@Override |
|
77 | 82 |
public boolean getSelection() { |
78 | 83 |
return selected; |
79 | 84 |
} |
... | ... | |
82 | 87 |
listener.widgetSelected(null); |
83 | 88 |
} |
84 | 89 |
|
90 |
@Override |
|
85 | 91 |
public void setSelection(boolean selected) { |
86 | 92 |
this.selected = selected; |
87 | 93 |
updateIcon(); |
88 | 94 |
} |
89 | 95 |
|
90 | 96 |
@Override |
91 |
public void checkSubclass() { }
|
|
92 |
|
|
97 |
public void checkSubclass() {} |
|
98 |
|
|
93 | 99 |
protected Image openIcon; |
100 |
|
|
94 | 101 |
protected Image closeIcon; |
95 |
|
|
102 |
|
|
96 | 103 |
public DropdownSelectionListener getDropDownListener() { |
97 | 104 |
return dropDownListener; |
98 | 105 |
} |
99 |
} |
|
106 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/NewNavigationWidget.java (revision 3084) | ||
---|---|---|
30 | 30 |
import org.eclipse.swt.SWT; |
31 | 31 |
import org.eclipse.swt.events.KeyEvent; |
32 | 32 |
import org.eclipse.swt.events.KeyListener; |
33 |
import org.eclipse.swt.events.MouseEvent; |
|
34 |
import org.eclipse.swt.events.MouseWheelListener; |
|
33 | 35 |
import org.eclipse.swt.events.SelectionEvent; |
34 | 36 |
import org.eclipse.swt.events.SelectionListener; |
35 | 37 |
import org.eclipse.swt.graphics.Color; |
... | ... | |
107 | 109 |
this.shift = 1; |
108 | 110 |
this.currentPosition = 0; |
109 | 111 |
|
110 |
this.setLayout(new GridLayout(6, false)); |
|
112 |
GridLayout layout = new GridLayout(6, false); |
|
113 |
layout.horizontalSpacing = 1; |
|
114 |
this.setLayout(layout); |
|
111 | 115 |
|
112 | 116 |
// | [|<] [<] [info] [>] [>|] | |
113 | 117 |
|
... | ... | |
158 | 162 |
currentPositionText.addKeyListener(new KeyListener() { |
159 | 163 |
|
160 | 164 |
@Override |
161 |
public void keyReleased(KeyEvent e) { |
|
162 |
// TODO Auto-generated method stub |
|
163 |
|
|
164 |
} |
|
165 |
public void keyReleased(KeyEvent e) {} |
|
165 | 166 |
|
166 | 167 |
@Override |
167 | 168 |
public void keyPressed(KeyEvent e) { |
... | ... | |
171 | 172 |
} |
172 | 173 |
} |
173 | 174 |
}); |
175 |
MouseWheelListener wheelListener = new MouseWheelListener() { |
|
176 |
|
|
177 |
@Override |
|
178 |
public void mouseScrolled(MouseEvent e) { |
|
179 |
if (e.count > 0) { |
|
180 |
currentPosition++; |
|
181 |
refresh(); |
|
182 |
} |
|
183 |
else { |
|
184 |
currentPosition--; |
|
185 |
refresh(); |
|
186 |
} |
|
187 |
} |
|
188 |
}; |
|
189 |
currentPositionText.addMouseWheelListener(wheelListener); |
|
174 | 190 |
|
175 |
|
|
176 | 191 |
// [info] |
177 | 192 |
infoLine = new Label(this, SWT.NONE); |
178 |
GridData layoutData = new GridData(GridData.VERTICAL_ALIGN_CENTER, SWT.CENTER, true, false); |
|
193 |
GridData layoutData = new GridData(GridData.CENTER, SWT.CENTER, true, false); |
|
194 |
layoutData.minimumWidth = 50; |
|
179 | 195 |
infoLine.setLayoutData(layoutData); |
180 | 196 |
|
181 | 197 |
whiteColor = currentPositionText.getBackground(); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersDialog.java (revision 3084) | ||
---|---|---|
58 | 58 |
|
59 | 59 |
protected Map args; // store values given by another Macro, if contains all the needed values, no dialog is shown |
60 | 60 |
|
61 |
protected int numberOfParameters; // number of parameters to show in the dialog box (not set by 'args'), if 0 parameters no dialog is shown |
|
61 |
// protected int numberOfParameters; // number of parameters to show in the dialog box (not set by 'args'), if 0 parameters no dialog is shown
|
|
62 | 62 |
|
63 |
protected ArrayList<String> parametersToSetByTheUser; |
|
64 |
|
|
63 | 65 |
protected boolean mustShowDialog; // show dialog if args.size == 0 OR if there is at least one mandatory field to set |
64 | 66 |
|
65 | 67 |
HashMap<String, Object> values = new HashMap<>(); // store the values of the parameters (may not contains all the values needed |
... | ... | |
69 | 71 |
Properties defaultScriptValues = new Properties(); // default values set by the Groovy script @Field@def annotation attribute |
70 | 72 |
|
71 | 73 |
File propFile; |
74 |
|
|
75 |
protected ArrayList<String> mandatoryParametersToSetByTheUser; |
|
72 | 76 |
// private int titleWidth; |
73 | 77 |
// private Composite parent; |
74 | 78 |
|
... | ... | |
91 | 95 |
|
92 | 96 |
// count the number of fields to show. If "0" then don't show the dialog, see the "open()" function |
93 | 97 |
// and select only the NamedOptionDef annotations |
94 |
numberOfParameters = 0; // number of parameters not set by args |
|
95 |
int numberOfMandatoryFields = 0; |
|
98 |
// numberOfParameters = 0; // number of parameters not set by args |
|
99 |
parametersToSetByTheUser = new ArrayList<>(); |
|
100 |
mandatoryParametersToSetByTheUser = new ArrayList<>(); |
|
96 | 101 |
for (OptionHandler arg : allParameters) { |
97 | 102 |
if (arg.option instanceof NamedOptionDef) { |
98 | 103 |
NamedOptionDef option = (NamedOptionDef) arg.option; |
... | ... | |
103 | 108 |
} |
104 | 109 |
|
105 | 110 |
// count number of mandatory fields set AND add exception for "Separator" widget types |
106 |
if (option.required() || "Separator".equals(option.widget())) numberOfMandatoryFields++; |
|
107 |
numberOfParameters++; |
|
111 |
if (option.required() || "Separator".equals(option.widget())) { |
|
112 |
mandatoryParametersToSetByTheUser.add(option.name()); |
|
113 |
} |
|
114 |
parametersToSetByTheUser.add(option.name()); |
|
108 | 115 |
} |
109 | 116 |
} |
110 | 117 |
|
111 |
mustShowDialog = numberOfMandatoryFields > 0 || (args.size() == 0 && numberOfParameters > 0);
|
|
118 |
mustShowDialog = mandatoryParametersToSetByTheUser.size() > 0 || (args.size() == 0 && parametersToSetByTheUser.size() > 0);
|
|
112 | 119 |
|
113 | 120 |
// initialize the properties file default values store |
114 | 121 |
defaultValues = new Properties(); |
... | ... | |
279 | 286 |
} |
280 | 287 |
} |
281 | 288 |
}); |
282 |
if (numberOfParameters == 0) button.setEnabled(false);
|
|
289 |
if (parametersToSetByTheUser.size() == 0) button.setEnabled(false);
|
|
283 | 290 |
|
284 | 291 |
super.createButtonsForButtonBar(parent); |
285 | 292 |
this.getButton(IDialogConstants.OK_ID).setText(TXMUIMessages.run); |
... | ... | |
326 | 333 |
// } ); |
327 | 334 |
|
328 | 335 |
|
329 |
if (numberOfParameters > MAX_PARAMETERS_PER_LINE) {
|
|
330 |
columns.getLayout().numColumns = 1 + (numberOfParameters / MAX_PARAMETERS_PER_LINE);
|
|
336 |
if (parametersToSetByTheUser.size() > MAX_PARAMETERS_PER_LINE) {
|
|
337 |
columns.getLayout().numColumns = 1 + (parametersToSetByTheUser.size() / MAX_PARAMETERS_PER_LINE);
|
|
331 | 338 |
} |
332 | 339 |
|
333 | 340 |
GLComposite column = new GLComposite(columns, SWT.NONE, "column"); |
... | ... | |
593 | 600 |
Log.finest("Activating shell:" + shell); |
594 | 601 |
shell.setActive(); |
595 | 602 |
} |
596 |
if (dialog.getMustShowDialog()) { |
|
597 |
Log.finest("The parameters dialog must be opened to fill all mandatory fields."); |
|
603 |
|
|
604 |
ArrayList missingParameters = dialog.getParametersToSet(); |
|
605 |
ArrayList missingMandatoryParameters = dialog.getMandatoryParametersToSet(); |
|
606 |
if (missingParameters.size() > 0) { |
|
607 |
Log.finer("The parameters dialog must be opened to fill parameters " + missingParameters + " and all mandatory fields: " + missingMandatoryParameters); |
|
598 | 608 |
retOpen = dialog.open() == ParametersDialog.OK; |
599 | 609 |
errorOpen = dialog.isError(); |
600 | 610 |
} |
... | ... | |
627 | 637 |
return retOpen && !errorOpen; |
628 | 638 |
} |
629 | 639 |
|
640 |
protected ArrayList getMandatoryParametersToSet() { |
|
641 |
return mandatoryParametersToSetByTheUser; |
|
642 |
} |
|
643 |
|
|
644 |
protected ArrayList getParametersToSet() { |
|
645 |
return parametersToSetByTheUser; |
|
646 |
} |
|
647 |
|
|
630 | 648 |
public boolean getMustShowDialog() { |
631 | 649 |
return mustShowDialog; |
632 | 650 |
} |
633 | 651 |
|
634 | 652 |
protected int getNumberOfFields() { |
635 |
return numberOfParameters;
|
|
653 |
return parametersToSetByTheUser.size();
|
|
636 | 654 |
} |
637 | 655 |
|
638 | 656 |
// TODO: uncomment this to enable "args" detection |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/PropertiesSelector.java (revision 3084) | ||
---|---|---|
170 | 170 |
|
171 | 171 |
if (p instanceof StructuralUnitProperty || p instanceof VirtualProperty) { |
172 | 172 |
buffer.append(p.getFullName()); |
173 |
} else { |
|
173 |
} |
|
174 |
else { |
|
174 | 175 |
buffer.append(p.getName()); |
175 |
}
|
|
176 |
} |
|
176 | 177 |
} |
177 | 178 |
if (buffer.length() > 0) { |
178 | 179 |
int l = buffer.length(); |
... | ... | |
291 | 292 |
} |
292 | 293 |
|
293 | 294 |
/** |
294 |
* Sets the properties.
|
|
295 |
* Sets the available properties and reset the selected ones.
|
|
295 | 296 |
* |
296 | 297 |
* @param available a list of properties set to the this.availableProperties list |
297 | 298 |
*/ |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/listeners/DropdownSelectionListener.java (revision 3084) | ||
---|---|---|
7 | 7 |
import org.eclipse.swt.graphics.Point; |
8 | 8 |
import org.eclipse.swt.graphics.Rectangle; |
9 | 9 |
import org.eclipse.swt.widgets.Menu; |
10 |
import org.eclipse.swt.widgets.ToolBar; |
|
10 | 11 |
import org.eclipse.swt.widgets.ToolItem; |
11 | 12 |
|
12 | 13 |
public class DropdownSelectionListener extends SelectionAdapter { |
13 |
|
|
14 |
|
|
14 | 15 |
private Menu menu; |
16 |
|
|
15 | 17 |
private SelectionListener defaultListener; |
16 |
public DropdownSelectionListener(ToolItem dropdown) { |
|
17 |
menu = new Menu(dropdown.getDisplay().getActiveShell(), SWT.POP_UP); |
|
18 |
|
|
19 |
public DropdownSelectionListener(ToolBar parent, ToolItem dropdown) { |
|
20 |
menu = new Menu(parent.getShell(), SWT.POP_UP); |
|
18 | 21 |
} |
19 |
|
|
22 |
|
|
20 | 23 |
public void setDefaultSelectionListener(SelectionListener defaultListener) { |
21 |
this.defaultListener = defaultListener;
|
|
24 |
this.defaultListener = defaultListener; |
|
22 | 25 |
} |
23 |
|
|
26 |
|
|
24 | 27 |
public Menu getMenu() { |
25 | 28 |
return menu; |
26 | 29 |
} |
27 |
|
|
30 |
|
|
31 |
@Override |
|
28 | 32 |
public void widgetSelected(SelectionEvent event) { |
29 | 33 |
if (event.detail == SWT.ARROW) { |
30 | 34 |
ToolItem item = (ToolItem) event.widget; |
... | ... | |
33 | 37 |
menu.setLocation(pt.x, pt.y + rect.height); |
34 | 38 |
menu.setVisible(true); |
35 | 39 |
event.doit = false; |
36 |
} else { |
|
40 |
} |
|
41 |
else { |
|
37 | 42 |
if (defaultListener != null) { |
38 | 43 |
defaultListener.widgetSelected(event); |
39 | 44 |
} |
40 | 45 |
} |
41 | 46 |
} |
42 |
} |
|
47 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 3084) | ||
---|---|---|
343 | 343 |
|
344 | 344 |
if (txm_date.equals(build_date)) { |
345 | 345 |
System.out.println(NLS.bind(TXMUIMessages.startingUpP0, |
346 |
v.getMajor()+"."+v.getMinor()+"."+v.getMicro(), build_date)); |
|
347 |
} else { |
|
346 |
v.getMajor() + "." + v.getMinor() + "." + v.getMicro(), build_date)); |
|
347 |
} |
|
348 |
else { |
|
348 | 349 |
System.out.println(NLS.bind(TXMUIMessages.startingUpP0, |
349 |
v.getMajor()+"."+v.getMinor()+"."+v.getMicro(), "update "+txm_date+ " - build "+build_date));
|
|
350 |
v.getMajor() + "." + v.getMinor() + "." + v.getMicro(), "update " + txm_date + " - build " + build_date));
|
|
350 | 351 |
} |
351 | 352 |
} |
352 | 353 |
|
... | ... | |
837 | 838 |
txmhomedir = new File(Toolbox.getTxmHomePath().trim()); |
838 | 839 |
} |
839 | 840 |
corporaDir = new File(txmhomedir, "corpora"); //$NON-NLS-1$ |
840 |
corporaDir.mkdir(); |
|
841 | 841 |
|
842 |
File previous080CorporaDirectory = new File(System.getProperty("user.home"), "TXM-0.8.0/corpora"); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ |
|
843 |
File previous079CorporaDirectory = new File(System.getProperty("user.home"), "TXM/corpora"); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ |
|
842 |
String previousVersions[] = { "0.8.1", "0.8.0", "0.7.9" }; |
|
843 |
String previousVersionLabels[] = new String[previousVersions.length]; |
|
844 |
File previousVersionCorporaDirectories[] = new File[previousVersions.length]; |
|
844 | 845 |
|
846 |
for (int i = 0; i < previousVersions.length; i++) { |
|
847 |
String v = previousVersions[i]; |
|
848 |
|
|
849 |
previousVersionLabels[i] = TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, v); |
|
850 |
|
|
851 |
File dir = new File(System.getProperty("user.home"), "TXM-" + v + "/corpora"); |
|
852 |
if ("0.7.9".equals(v)) { |
|
853 |
dir = new File(System.getProperty("user.home"), "TXM/corpora"); |
|
854 |
} |
|
855 |
previousVersionCorporaDirectories[i] = dir; |
|
856 |
} |
|
857 |
|
|
845 | 858 |
Version v = Activator.getDefault().getBundle().getVersion(); |
846 | 859 |
String vv = v.getMajor() + "." + v.getMinor() + "." + v.getMicro(); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ |
847 |
String SAMPLES = "1. " + TXMUIMessages.bind(TXMUIMessages.sampleCorporaOfCurrentTXMP0, vv);//$NON-NLS-1$ |
|
848 |
String V081 = "2. " + TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, vv);//$NON-NLS-1$ |
|
849 |
String V080 = "3. " + TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, "0.8.0"); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ |
|
850 |
String V079 = "4. " + TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, "0.7.9"); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ |
|
851 |
String OTHER = "5. " + TXMUIMessages.selectAnotherTXMCorporaToRestore;//$NON-NLS-1$ |
|
860 |
String SAMPLES = "1. " + TXMUIMessages.bind(TXMUIMessages.sampleCorporaOfCurrentTXMP0, vv); |
|
861 |
String vCURRENT = "2. " + TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, vv); |
|
852 | 862 |
|
863 |
int n = 3; |
|
864 |
final ArrayList<Object> selectedCorporaDirs = new ArrayList<>(); |
|
865 |
selectedCorporaDirs.add(SAMPLES); |
|
866 |
selectedCorporaDirs.add(vCURRENT); |
|
853 | 867 |
|
854 |
final ArrayList<Object> corporaDirs = new ArrayList<>(); |
|
855 |
corporaDirs.add(SAMPLES); |
|
856 |
corporaDirs.add(V081); |
|
857 |
corporaDirs.add(V080); |
|
858 |
corporaDirs.add(V079); |
|
859 |
corporaDirs.add(OTHER); |
|
868 |
if (corporaDir.exists() && corporaDir.listFiles(IOUtils.HIDDENFILE_FILTER).length > 0) selectedCorporaDirs.add(vCURRENT); |
|
860 | 869 |
|
870 |
for (int i = 0; i < previousVersions.length; i++) { |
|
871 |
if (previousVersionCorporaDirectories[i].exists() |
|
872 |
&& previousVersionCorporaDirectories[i].listFiles(IOUtils.HIDDENFILE_FILTER).length > 0) { |
|
873 |
selectedCorporaDirs.add("" + (n++) + ". " + previousVersionLabels[i]); |
|
874 |
} |
|
875 |
} |
|
876 |
|
|
877 |
String OTHER = "" + (n++) + ". " + TXMUIMessages.selectAnotherTXMCorporaToRestore; |
|
878 |
selectedCorporaDirs.add(OTHER); |
|
879 |
|
|
861 | 880 |
final ArrayList<Object> initialCorporaDirs = new ArrayList<>(); |
862 | 881 |
initialCorporaDirs.add(SAMPLES); |
863 |
initialCorporaDirs.add(V081);
|
|
882 |
initialCorporaDirs.add(vCURRENT);
|
|
864 | 883 |
|
865 | 884 |
Display.getDefault().syncExec(new Runnable() { |
866 | 885 |
|
... | ... | |
868 | 887 |
public void run() { |
869 | 888 |
Display display = Display.getDefault(); |
870 | 889 |
Shell shell = display.getActiveShell(); |
871 |
ListSelectionDialog dialog = new ListSelectionDialog(shell, corporaDirs,
|
|
890 |
ListSelectionDialog dialog = new ListSelectionDialog(shell, selectedCorporaDirs,
|
|
872 | 891 |
new ArrayContentProvider(), new LabelProvider(), TXMUIMessages.corporaWillBeRestoredInTheFollowingOrderCorporaAlreadyRestoredWillNotBeReplaced); |
873 | 892 |
dialog.setTitle(TXMUIMessages.selectThecorporaSetsToRestore); |
874 | 893 |
dialog.setInitialElementSelections(initialCorporaDirs); |
875 | 894 |
if (dialog.open() == ListSelectionDialog.OK) { |
876 |
corporaDirs.clear();
|
|
895 |
selectedCorporaDirs.clear();
|
|
877 | 896 |
List<Object> selection = Arrays.asList(dialog.getResult()); |
878 |
corporaDirs.addAll(selection);
|
|
897 |
selectedCorporaDirs.addAll(selection);
|
|
879 | 898 |
} |
880 | 899 |
else { |
881 |
corporaDirs.clear();
|
|
900 |
selectedCorporaDirs.clear();
|
|
882 | 901 |
} |
883 | 902 |
} |
884 | 903 |
}); |
885 | 904 |
|
886 |
// move previous TXM 0.8.2 corpora |
|
905 |
// move the previous TXM 0.8.2 corpora
|
|
887 | 906 |
File backupDir = new File(corporaDir.getAbsolutePath() + "-previous"); //$NON-NLS-1$ |
888 | 907 |
if (corporaDir.exists()) { |
889 | 908 |
backupDir.mkdirs(); |
... | ... | |
894 | 913 |
} |
895 | 914 |
} |
896 | 915 |
|
916 |
corporaDir.mkdir(); |
|
917 |
|
|
897 | 918 |
// load TXM-0.8.2 sample corpora (from the install directory) |
898 |
if (corporaDirs.contains(SAMPLES) && sampleCorporaDirectory.exists()) {
|
|
919 |
if (selectedCorporaDirs.contains(SAMPLES) && sampleCorporaDirectory.exists()) {
|
|
899 | 920 |
|
900 | 921 |
Log.info(TXMUIMessages.installingSampleCorpus); |
901 | 922 |
|
... | ... | |
909 | 930 |
} |
910 | 931 |
} |
911 | 932 |
|
912 |
// TXM-0.8.2 previous installation corpora
|
|
913 |
if (corporaDirs.contains(V081) && backupDir.listFiles(IOUtils.HIDDENFILE_FILTER).length > 0) { // not a new install, restore corpus from the corpora-previous directory
|
|
914 |
Log.info(NLS.bind(TXMUIMessages.installingPreviousCorpusFromP0, "0.8.2", corporaDir)); //$NON-NLS-1$
|
|
933 |
// TXM-CURRENT previous installation corpora
|
|
934 |
if (selectedCorporaDirs.contains(vCURRENT) && backupDir.listFiles(IOUtils.HIDDENFILE_FILTER).length > 0) { // not a new install, restore corpus from the corpora-previous directory
|
|
935 |
Log.info(NLS.bind(TXMUIMessages.installingPreviousCorpusFromP0, vv, corporaDir));
|
|
915 | 936 |
JobHandler job = LoadBinaryCorporaDirectory.loadBinaryCorpusFromCorporaDirectory(backupDir, false, false, true); |
916 | 937 |
try { |
917 | 938 |
job.join(); |
... | ... | |
921 | 942 |
} |
922 | 943 |
} |
923 | 944 |
|
924 |
// TXM-0.8.0 previous installation corpora |
|
925 |
if (corporaDirs.contains(V080) && previous080CorporaDirectory.exists() |
|
926 |
&& previous080CorporaDirectory.listFiles(IOUtils.HIDDENFILE_FILTER).length > 0) { // not a new install, restore corpus from the corpora-previous directory |
|
927 |
Log.info(NLS.bind(TXMUIMessages.installingPreviousCorpusFromP0, "0.8.0", corporaDir)); //$NON-NLS-1$ |
|
928 |
JobHandler job = LoadBinaryCorporaDirectory.loadBinaryCorpusFromCorporaDirectory(previous080CorporaDirectory, false, false, true); |
|
929 |
try { |
|
930 |
job.join(); |
|
945 |
for (int i = 0; i < previousVersions.length; i++) { |
|
946 |
if (selectedCorporaDirs.contains(previousVersionLabels[i])) { |
|
947 |
|
|
948 |
Log.info(NLS.bind(TXMUIMessages.installingPreviousCorpusFromP0, previousVersions[i], previousVersionCorporaDirectories[i])); |
|
949 |
|
|
950 |
JobHandler job = LoadBinaryCorporaDirectory.loadBinaryCorpusFromCorporaDirectory(previousVersionCorporaDirectories[i], false, false, true); |
|
951 |
try { |
|
952 |
job.join(); |
|
953 |
} |
|
954 |
catch (InterruptedException e) { |
|
955 |
e.printStackTrace(); |
|
956 |
} |
|
931 | 957 |
} |
932 |
catch (InterruptedException e) { |
|
933 |
e.printStackTrace(); |
|
934 |
} |
|
935 | 958 |
} |
936 | 959 |
|
937 |
// TXM previous installation corpora |
|
938 |
if (corporaDirs.contains(V079) && previous079CorporaDirectory.exists()) { // new installation (empty corpora directory) |
|
939 |
Log.info(NLS.bind(TXMUIMessages.installingPreviousCorpusFromP0, "0.7.9", previous079CorporaDirectory)); //$NON-NLS-1$ |
|
940 |
JobHandler job = LoadBinaryCorporaDirectory.loadBinaryCorpusFromCorporaDirectory(previous079CorporaDirectory, false, false, true); |
|
941 |
try { |
|
942 |
job.join(); |
|
943 |
} |
|
944 |
catch (InterruptedException e) { |
|
945 |
e.printStackTrace(); |
|
946 |
} |
|
947 |
} |
|
948 |
|
|
949 |
// TXM previous installation corpora |
|
950 |
if (corporaDirs.contains(OTHER)) { // new installation (empty corpora directory) |
|
960 |
// recovery from an other corpora directory to select by the user |
|
961 |
if (selectedCorporaDirs.contains(OTHER)) { // new installation (empty corpora directory) |
|
951 | 962 |
final HashMap<String, String> bindings = new HashMap<>(); |
952 | 963 |
Display.getDefault().syncExec(new Runnable() { |
953 | 964 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/perspective/TXMPerspective.java (revision 3084) | ||
---|---|---|
36 | 36 |
|
37 | 37 |
// TODO: Auto-generated Javadoc |
38 | 38 |
/** |
39 |
* define which view are opened at TXM start up |
|
39 |
* define which view are opened at TXM start up |
|
40 |
* |
|
40 | 41 |
* @author mdecorde. |
41 | 42 |
*/ |
42 | 43 |
public class TXMPerspective implements IPerspectiveFactory { |
43 |
|
|
44 |
|
|
44 | 45 |
/** The Constant ID. */ |
45 | 46 |
public static final String ID = "org.txm.rcp.perspective.TXMPerspective"; //$NON-NLS-1$ |
47 |
|
|
46 | 48 |
static IPageLayout initialLayout; |
47 | 49 |
|
48 |
/* (non-Javadoc) |
|
50 |
/* |
|
51 |
* (non-Javadoc) |
|
49 | 52 |
* @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) |
50 | 53 |
*/ |
51 | 54 |
@Override |
52 | 55 |
public void createInitialLayout(IPageLayout layout) { |
53 | 56 |
|
54 | 57 |
TXMPerspective.initialLayout = layout; |
55 |
//System.out.println("INITIAL LAYOUT="+initialLayout); |
|
58 |
// System.out.println("INITIAL LAYOUT="+initialLayout);
|
|
56 | 59 |
String editorArea = layout.getEditorArea(); |
57 | 60 |
layout.setEditorAreaVisible(true); |
58 |
|
|
61 |
|
|
59 | 62 |
IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.20f, editorArea); //$NON-NLS-1$ |
60 | 63 |
left.addView(CorporaView.ID); |
61 | 64 |
left.addView(Explorer.ID); |
62 |
|
|
65 |
|
|
63 | 66 |
layout.getViewLayout(CorporaView.ID).setCloseable(false); |
64 |
layout.getViewLayout(Explorer.ID).setCloseable(false);
|
|
67 |
layout.getViewLayout(Explorer.ID).setCloseable(true);
|
|
65 | 68 |
|
66 | 69 |
IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.7f, editorArea); //$NON-NLS-1$ |
67 | 70 |
// bottom.addView(IPageLayout.ID_OUTLINE); |
68 | 71 |
bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW); |
69 |
//bottom.addView("org.eclipse.ui.views.ProgressView"); //$NON-NLS-1$ |
|
72 |
// bottom.addView("org.eclipse.ui.views.ProgressView"); //$NON-NLS-1$
|
|
70 | 73 |
// bottom.addView(GroovyConsole.ID); |
71 | 74 |
// bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW); |
72 | 75 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/DeleteFile.java (revision 3084) | ||
---|---|---|
82 | 82 |
|
83 | 83 |
Shell shell = new Shell(); |
84 | 84 |
MessageBox dialog = new MessageBox(shell, SWT.YES | SWT.NO); |
85 |
dialog.setMessage(TXMUIMessages.areYouSureYouWantToDeleteP0Colon + file + " ? "); //$NON-NLS-1$
|
|
85 |
dialog.setMessage(TXMUIMessages.bind(TXMUIMessages.areYouSureYouWantToDeleteP0Colon, file));
|
|
86 | 86 |
|
87 | 87 |
int buttonID = dialog.open(); |
88 | 88 |
switch (buttonID) { |
... | ... | |
112 | 112 |
public static void delete(List files) { |
113 | 113 |
Shell shell = new Shell(); |
114 | 114 |
MessageBox dialog = new MessageBox(shell, SWT.YES | SWT.NO); |
115 |
dialog.setMessage(TXMUIMessages.areYouSureYouWantToDeleteP0Colon + files + " ? "); //$NON-NLS-1$
|
|
115 |
dialog.setMessage(TXMUIMessages.bind(TXMUIMessages.areYouSureYouWantToDeleteP0Colon, files));
|
|
116 | 116 |
|
117 | 117 |
int buttonID = dialog.open(); |
118 | 118 |
switch (buttonID) { |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 3084) | ||
---|---|---|
4 | 4 |
|
5 | 5 |
EMPTY = \ \n |
6 | 6 |
|
7 |
Explorer_4 = 🡅
|
|
7 |
Explorer_4 = ⇧
|
|
8 | 8 |
|
9 |
Explorer_5 = ???
|
|
9 |
Explorer_5 = ???
|
|
10 | 10 |
|
11 | 11 |
Explorer_7 = ⌂ |
12 | 12 |
|
... | ... | |
479 | 479 |
failedToLoadBinaryCorpusNullError = ** Échec de chargement du corpus binaire (null error). |
480 | 480 |
|
481 | 481 |
failedToLoadCorpusFromDirectoryColonP0WeCannotFindTheNecessaryComponents = ** Échec du chargement du corpus à partir du dossier {0}.\nImpossible de trouver les composants nécessaires. |
482 |
|
|
482 |
LoadBinaryCorporaDirectory_selectTheTXMCorpusToLoadIn=Selectionner les corpus à charger à partir de {0}. |
|
483 | 483 |
failedToLoadCorpusP0 = ** Échec du chargement du corpus {0} |
484 | 484 |
|
485 | 485 |
failedToMoveCorpus = ** Impossible de déplacer le corpus {0} vers {1}. |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java (revision 3084) | ||
---|---|---|
1126 | 1126 |
|
1127 | 1127 |
public static String LoadBinaryCorporaDirectory_loadingCorporaFromTheP0Directory; |
1128 | 1128 |
|
1129 |
public static String LoadBinaryCorporaDirectory_selectTheTXMCorpusToLoad; |
|
1129 |
public static String LoadBinaryCorporaDirectory_selectTheTXMCorpusToLoadIn;
|
|
1130 | 1130 |
|
1131 | 1131 |
public static String selectAnotherTXMCorporaToRestore; |
1132 | 1132 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 3084) | ||
---|---|---|
7 | 7 |
|
8 | 8 |
EMPTY = \ \n |
9 | 9 |
|
10 |
Explorer_4 = 🡅
|
|
11 |
Explorer_5 = ???
|
|
10 |
Explorer_4 = ⇧
|
|
11 |
Explorer_5 = ???
|
|
12 | 12 |
Explorer_7 = ⌂ |
13 | 13 |
|
14 | 14 |
FileTreeContentProvider_4 = ' |
... | ... | |
18 | 18 |
LoadBinaryCorporaDirectory_corporaDirectoryNotFoundAborting = Corpora directory not found. Aborting. |
19 | 19 |
LoadBinaryCorporaDirectory_corpusLoad = Corpus load |
20 | 20 |
LoadBinaryCorporaDirectory_loadingCorporaFromTheP0Directory = Loading corpora from the {0} directory... |
21 |
LoadBinaryCorporaDirectory_selectTheTXMCorpusToLoad = Select the '.txm' corpus to load.
|
|
21 |
LoadBinaryCorporaDirectory_selectTheTXMCorpusToLoadIn=Select the corpus to load of {0}.
|
|
22 | 22 |
|
23 | 23 |
P0CorpusLoaded = {0} corpus loaded. |
24 | 24 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/FileTreeLabelProvider.java (revision 3084) | ||
---|---|---|
38 | 38 |
import org.txm.rcp.Application; |
39 | 39 |
import org.txm.rcp.IImageKeys; |
40 | 40 |
|
41 |
// TODO: Auto-generated Javadoc |
|
42 | 41 |
/** |
43 |
* The Class FileTreeLabelProvider.
|
|
42 |
* The Class FileTreeLabelProvider: cache of TXM images and utility methods to get an image of a plugin
|
|
44 | 43 |
*/ |
45 | 44 |
public class FileTreeLabelProvider extends LabelProvider { |
46 | 45 |
|
47 | 46 |
/** The image table. */ |
48 |
private Map<ImageDescriptor, Image> imageTable = new HashMap<ImageDescriptor, Image>(
|
|
49 |
7); |
|
50 |
|
|
51 |
/* (non-Javadoc)
|
|
47 |
private Map<ImageDescriptor, Image> imageTable = new HashMap<>();
|
|
48 |
|
|
49 |
/* |
|
50 |
* (non-Javadoc)
|
|
52 | 51 |
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) |
53 | 52 |
*/ |
54 | 53 |
@Override |
55 | 54 |
public String getText(Object element) { |
56 | 55 |
return ((File) element).getName(); |
57 | 56 |
} |
58 |
|
|
59 |
/* (non-Javadoc) |
|
57 |
|
|
58 |
/* |
|
59 |
* (non-Javadoc) |
|
60 | 60 |
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) |
61 | 61 |
*/ |
62 | 62 |
@Override |
63 | 63 |
public final Image getImage(Object element) { |
64 | 64 |
File f = ((File) element); |
65 |
ImageDescriptor imageDescriptor = AbstractUIPlugin |
|
66 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
67 |
IImageKeys.FILE); |
|
68 |
if (f.isDirectory()) |
|
65 |
ImageDescriptor imageDescriptor = null; |
|
66 |
if (f.isDirectory()) { |
|
69 | 67 |
imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin( |
70 | 68 |
Application.PLUGIN_ID, IImageKeys.FOLDER); |
69 |
} |
|
70 |
else if (f.isFile()) { |
|
71 |
if (f.getName().matches(".*\\.(mp4|avi|mkv|ogv|mpg|webm)")) { |
|
72 |
imageDescriptor = AbstractUIPlugin |
|
73 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
74 |
IImageKeys.FILE_VIDEO); |
|
75 |
} |
|
76 |
else if (f.getName().endsWith(".txm")) { |
|
77 |
imageDescriptor = AbstractUIPlugin |
|
78 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
79 |
IImageKeys.TXM1616); |
|
80 |
} |
|
81 |
else if (f.getName().matches(".*\\.(mp3|ogg|wav|flac)")) { |
|
82 |
imageDescriptor = AbstractUIPlugin |
|
83 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
84 |
IImageKeys.FILE_AUDIO); |
|
85 |
} |
|
86 |
else if (f.getName().matches(".*\\.(png|jpg|jpeg|bmp|gif)")) { |
|
87 |
imageDescriptor = AbstractUIPlugin |
|
88 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
89 |
IImageKeys.FILE_IMAGE); |
|
90 |
} |
|
91 |
else if (f.getName().endsWith("Macro.groovy")) { |
|
92 |
imageDescriptor = AbstractUIPlugin |
|
93 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
94 |
IImageKeys.SCRIPT_RUN); |
|
95 |
} |
|
96 |
else if (f.getName().matches(".*\\.(groovy|R|py|pl|java|rb|sh|bat)")) { |
|
97 |
imageDescriptor = AbstractUIPlugin |
|
98 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
99 |
IImageKeys.SCRIPT); |
|
100 |
} |
|
101 |
else if (f.getName().matches(".*\\.(doc.|od.|pdf)")) { |
|
102 |
imageDescriptor = AbstractUIPlugin |
|
103 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
104 |
IImageKeys.FILE_DOC); |
|
105 |
} |
|
106 |
else { |
|
107 |
imageDescriptor = AbstractUIPlugin |
|
108 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
109 |
IImageKeys.FILE); |
|
110 |
} |
|
111 |
} |
|
112 |
|
|
71 | 113 |
Image image = imageTable.get(imageDescriptor); |
72 | 114 |
if (image == null) { |
73 | 115 |
image = imageDescriptor.createImage(); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroTreeLabelProvider.java (revision 3084) | ||
---|---|---|
55 | 55 |
|
56 | 56 |
|
57 | 57 |
private MacroExplorer explorer; |
58 |
|
|
58 | 59 |
private Font font; |
59 |
|
|
60 |
|
|
60 | 61 |
public MacroTreeLabelProvider(MacroExplorer explorer) { |
61 | 62 |
this.explorer = explorer; |
62 | 63 |
|
63 | 64 |
Font font = Display.getCurrent().getSystemFont(); |
64 |
FontData fontData = font.getFontData()[0];
|
|
65 |
FontData fontData = font.getFontData()[0];
|
|
65 | 66 |
fontData.setStyle(SWT.ITALIC); |
66 |
this.font = new Font(Display.getCurrent(), fontData);
|
|
67 |
this.font = new Font(Display.getCurrent(), fontData);
|
|
67 | 68 |
} |
68 | 69 |
|
69 | 70 |
/** The image table. */ |
70 |
private Map<ImageDescriptor, Image> imageTable = new HashMap<ImageDescriptor, Image>(7); |
|
71 |
|
|
72 |
/* (non-Javadoc) |
|
71 |
private Map<ImageDescriptor, Image> imageTable = new HashMap<>(7); |
|
72 |
|
|
73 |
/* |
|
74 |
* (non-Javadoc) |
|
73 | 75 |
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) |
74 | 76 |
*/ |
75 | 77 |
@Override |
76 | 78 |
public String getText(Object element) { |
77 |
|
|
79 |
|
|
78 | 80 |
File f = (File) element; |
79 | 81 |
String name = f.getName(); |
80 | 82 |
if (f.isDirectory()) { |
81 | 83 |
return name; |
82 |
} else { |
|
84 |
} |
|
85 |
else { |
|
83 | 86 |
int idx = name.indexOf("Macro.groovy"); //$NON-NLS-1$ |
84 | 87 |
if (idx > 0) return name.substring(0, idx); |
85 | 88 |
|
86 | 89 |
return name; |
87 | 90 |
} |
88 | 91 |
} |
89 |
|
|
90 |
/* (non-Javadoc) |
|
92 |
|
|
93 |
/* |
|
94 |
* (non-Javadoc) |
|
91 | 95 |
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) |
92 | 96 |
*/ |
93 | 97 |
@Override |
... | ... | |
96 | 100 |
File f = ((File) element); |
97 | 101 |
ImageDescriptor imageDescriptor = null; |
98 | 102 |
if (f.isFile()) { |
99 |
if (f.getName().endsWith(".groovy")) { |
|
103 |
if (f.getName().endsWith("Macro.groovy")) {
|
|
100 | 104 |
imageDescriptor = AbstractUIPlugin |
101 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
102 |
IImageKeys.SCRIPT); |
|
103 |
} else { |
|
105 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
106 |
IImageKeys.SCRIPT_RUN); |
|
107 |
} |
|
108 |
else if (f.getName().endsWith(".groovy")) { |
|
104 | 109 |
imageDescriptor = AbstractUIPlugin |
105 | 110 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
111 |
IImageKeys.SCRIPT); |
|
112 |
} |
|
113 |
else { |
|
114 |
imageDescriptor = AbstractUIPlugin |
|
115 |
.imageDescriptorFromPlugin(Application.PLUGIN_ID, |
|
106 | 116 |
IImageKeys.FILE); |
107 | 117 |
} |
108 |
} else if (f.isDirectory()) { |
|
118 |
} |
|
119 |
else if (f.isDirectory()) { |
|
109 | 120 |
imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin( |
110 | 121 |
Application.PLUGIN_ID, IImageKeys.FOLDER); |
111 | 122 |
} |
... | ... | |
117 | 128 |
} |
118 | 129 |
return image; |
119 | 130 |
} |
120 |
|
|
131 |
|
|
121 | 132 |
public StyledString getStyledText(Object element) { |
122 | 133 |
|
123 |
//if (!explorer.isUserScriptExists(element)) return new StyledString(getText(element), BOLD_FONT_STYLER); |
|
134 |
// if (!explorer.isUserScriptExists(element)) return new StyledString(getText(element), BOLD_FONT_STYLER);
|
|
124 | 135 |
|
125 | 136 |
return new StyledString(getText(element)); |
126 | 137 |
} |
127 | 138 |
|
128 | 139 |
Styler BOLD_FONT_STYLER = new BoldFontStyler(); |
129 |
public class BoldFontStyler extends Styler { |
|
130 |
@Override |
|
131 |
public void applyStyles(final TextStyle textStyle) { |
|
132 |
textStyle.font = font; |
|
133 |
} |
|
140 |
|
|
141 |
public class BoldFontStyler extends Styler { |
|
142 |
|
|
143 |
@Override |
|
144 |
public void applyStyles(final TextStyle textStyle) { |
|
145 |
textStyle.font = font; |
|
146 |
} |
|
134 | 147 |
} |
135 | 148 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/Explorer.java (revision 3084) | ||
---|---|---|
30 | 30 |
import java.io.File; |
31 | 31 |
import java.util.List; |
32 | 32 |
|
33 |
import org.eclipse.core.commands.ExecutionException; |
|
33 | 34 |
import org.eclipse.jface.action.MenuManager; |
34 | 35 |
import org.eclipse.jface.viewers.DoubleClickEvent; |
35 | 36 |
import org.eclipse.jface.viewers.IDoubleClickListener; |
... | ... | |
47 | 48 |
import org.eclipse.swt.layout.FormAttachment; |
48 | 49 |
import org.eclipse.swt.layout.FormData; |
49 | 50 |
import org.eclipse.swt.layout.FormLayout; |
51 |
import org.eclipse.swt.layout.GridData; |
|
52 |
import org.eclipse.swt.program.Program; |
|
50 | 53 |
import org.eclipse.swt.widgets.Button; |
51 | 54 |
import org.eclipse.swt.widgets.Composite; |
52 | 55 |
import org.eclipse.swt.widgets.Menu; |
56 |
import org.eclipse.swt.widgets.MessageBox; |
|
53 | 57 |
import org.eclipse.swt.widgets.Text; |
54 | 58 |
import org.eclipse.swt.widgets.TreeItem; |
55 | 59 |
import org.eclipse.ui.PlatformUI; |
56 | 60 |
import org.eclipse.ui.part.ViewPart; |
57 | 61 |
import org.txm.Toolbox; |
58 |
import org.txm.core.preferences.TBXPreferences;
|
|
62 |
import org.txm.rcp.IImageKeys;
|
|
59 | 63 |
import org.txm.rcp.commands.OpenBrowser; |
60 | 64 |
import org.txm.rcp.commands.OpenGraph; |
65 |
import org.txm.rcp.commands.workspace.LoadBinaryCorpus; |
|
61 | 66 |
import org.txm.rcp.handlers.files.CopyFile; |
62 | 67 |
import org.txm.rcp.handlers.files.CutFile; |
63 | 68 |
import org.txm.rcp.handlers.files.DeleteFile; |
... | ... | |
65 | 70 |
import org.txm.rcp.handlers.files.PasteFile; |
66 | 71 |
import org.txm.rcp.handlers.files.RenameFile; |
67 | 72 |
import org.txm.rcp.messages.TXMUIMessages; |
73 |
import org.txm.rcp.swt.GLComposite; |
|
74 |
import org.txm.utils.DeleteDir; |
|
75 |
import org.txm.utils.FileUtils; |
|
68 | 76 |
|
69 | 77 |
/** |
70 | 78 |
* Simple file explorer |
71 |
*
|
|
79 |
* |
|
72 | 80 |
* @author mdecorde. |
73 | 81 |
*/ |
74 | 82 |
public class Explorer extends ViewPart { |
75 |
|
|
83 |
|
|
76 | 84 |
/** The ID. */ |
77 | 85 |
static public String ID = "org.txm.rcp.views.fileexplorer.Explorer"; //$NON-NLS-1$ |
78 |
|
|
86 |
|
|
79 | 87 |
/** Initialize currentPath with user home directory */ |
80 |
private String currentPath = System.getProperty("user.home");//Toolbox.getTxmHomePath(); //$NON-NLS-1$
|
|
81 |
|
|
88 |
private String currentPath = System.getProperty("user.home");// Toolbox.getTxmHomePath(); //$NON-NLS-1$
|
|
89 |
|
|
82 | 90 |
/** The tv. */ |
83 | 91 |
TreeViewer tv; |
84 |
|
|
92 |
|
|
85 | 93 |
/** The address. */ |
86 | 94 |
Text address; |
87 |
|
|
95 |
|
|
88 | 96 |
/** |
89 | 97 |
* Instantiates a new explorer. |
90 | 98 |
*/ |
91 | 99 |
public Explorer() { |
92 |
|
|
100 |
|
|
93 | 101 |
} |
94 |
|
|
102 |
|
|
95 | 103 |
/** |
96 | 104 |
* Refresh. |
97 | 105 |
*/ |
98 |
public static void refresh() |
|
99 |
{ |
|
106 |
public static void refresh() { |
|
100 | 107 |
Explorer explorerView = (Explorer) PlatformUI.getWorkbench() |
101 | 108 |
.getActiveWorkbenchWindow().getActivePage().findView( |
102 | 109 |
Explorer.ID); |
103 |
|
|
110 |
|
Formats disponibles : Unified diff