Révision 1416
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorToolBar.java (revision 1416) | ||
---|---|---|
1 | 1 |
package org.txm.rcp.editors; |
2 | 2 |
|
3 |
import java.util.ArrayList; |
|
4 | 3 |
import java.util.HashMap; |
5 | 4 |
import java.util.List; |
6 | 5 |
|
6 |
import org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem; |
|
7 | 7 |
import org.eclipse.jface.action.ToolBarManager; |
8 | 8 |
import org.eclipse.swt.SWT; |
9 | 9 |
import org.eclipse.swt.events.SelectionEvent; |
... | ... | |
22 | 22 |
import org.txm.core.results.TXMResult; |
23 | 23 |
import org.txm.rcp.swt.GLComposite; |
24 | 24 |
import org.txm.rcp.swt.toolbar.DropDownCheckToolItem; |
25 |
import org.txm.rcp.swt.toolbar.DropDownToolItem; |
|
26 | 25 |
import org.txm.rcp.swt.toolbar.OpenCloseToolItem; |
27 | 26 |
|
28 | 27 |
/** |
... | ... | |
288 | 287 |
return this.buttons.get(groupTitle); |
289 | 288 |
} |
290 | 289 |
|
290 |
|
|
291 |
/** |
|
292 |
* Gets a ToolItem from RCP item contribution from plugin.xml by its id. |
|
293 |
* @param id |
|
294 |
* @return |
|
295 |
*/ |
|
296 |
public ToolItem getItemByContributionId(String id) { |
|
297 |
ToolItem item = null; |
|
298 |
for (int i = 0; i < this.getItemCount(); i++) { |
|
299 |
|
|
300 |
if(this.getItem(i).getData() != null && this.getItem(i).getData() instanceof HandledContributionItem) { |
|
301 |
HandledContributionItem contribution = (HandledContributionItem) this.getItem(i).getData(); |
|
302 |
if(contribution.getId().equals(id)) { |
|
303 |
item = this.getItem(i); |
|
304 |
break; |
|
305 |
} |
|
306 |
} |
|
307 |
} |
|
308 |
return item; |
|
309 |
} |
|
310 |
|
|
291 | 311 |
@Override |
292 | 312 |
public void setEnabled(boolean enabled) { |
293 | 313 |
super.setEnabled(enabled); |
294 |
for(Control c: this.getChildren()) { |
|
314 |
for(Control c : this.getChildren()) {
|
|
295 | 315 |
c.setEnabled(enabled); |
296 | 316 |
} |
297 | 317 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1416) | ||
---|---|---|
36 | 36 |
import org.eclipse.swt.layout.RowLayout; |
37 | 37 |
import org.eclipse.swt.widgets.Button; |
38 | 38 |
import org.eclipse.swt.widgets.Composite; |
39 |
import org.eclipse.swt.widgets.Control; |
|
39 | 40 |
import org.eclipse.swt.widgets.Display; |
40 | 41 |
import org.eclipse.swt.widgets.Group; |
41 | 42 |
import org.eclipse.swt.widgets.Menu; |
... | ... | |
535 | 536 |
// FIXME: old version |
536 | 537 |
//this.result.setDirty(dirty); |
537 | 538 |
|
538 |
ToolBarManager manager = new ToolBarManager(this.topToolBar); |
|
539 |
IContributionItem[] items = manager.getItems(); |
|
539 |
// ToolBarManager manager = new ToolBarManager(this.topToolBar);
|
|
540 |
// IContributionItem[] items = manager.getItems();
|
|
540 | 541 |
|
541 | 542 |
|
543 |
//this.topToolBar.setEnabled(dirty); |
|
544 |
ToolItem computeButton = this.topToolBar.getItemByContributionId("compute"); |
|
545 |
computeButton.setEnabled(dirty); |
|
546 |
|
|
547 |
|
|
548 |
// for(Control c : this.topToolBar.getChildren()) { |
|
549 |
// //c.setEnabled(enabled); |
|
550 |
// System.out.println("TXMEditor.setDirty(): " + c); |
|
551 |
// } |
|
552 |
|
|
542 | 553 |
firePropertyChange(IEditorPart.PROP_DIRTY); |
543 | 554 |
CorporaView.refreshObject(this.result); |
544 | 555 |
} |
... | ... | |
558 | 569 |
// FIXME: SJ: tests |
559 | 570 |
//dirty = this.getResult().isDirty() && this.getResult().hasBeenComputedOnce(); |
560 | 571 |
|
572 |
|
|
561 | 573 |
|
562 | 574 |
for (TXMEditorExtension<T> b : extensions) { |
563 | 575 |
try { |
tmp/org.txm.rcp/plugin.xml (revision 1416) | ||
---|---|---|
2301 | 2301 |
<command |
2302 | 2302 |
commandId="org.txm.rcp.handlers.ComputeTXMResult" |
2303 | 2303 |
icon="icons/functions/run.png" |
2304 |
id="compute" |
|
2304 | 2305 |
label="%command.label.36" |
2305 | 2306 |
style="push"> |
2306 | 2307 |
</command> |
... | ... | |
3183 | 3184 |
natureId="org.txm.core.CorpusNature"> |
3184 | 3185 |
</image> |
3185 | 3186 |
</extension> |
3186 |
<extension |
|
3187 |
point="org.eclipse.ui.handlers"> |
|
3188 |
<handler |
|
3189 |
class="org.txm.rcp.handlers.results.ComputeTXMResult" |
|
3190 |
commandId="org.txm.rcp.handlers.ComputeTXMResult"> |
|
3191 |
<enabledWhen> |
|
3192 |
<test |
|
3193 |
property="org.txm.rcp.testers.CurrentEditorIsDirty" |
|
3194 |
value="false"> |
|
3195 |
</test> |
|
3196 |
</enabledWhen> |
|
3197 |
<activeWhen> |
|
3198 |
<reference |
|
3199 |
definitionId="TXMEditorActive"> |
|
3200 |
</reference> |
|
3201 |
</activeWhen> |
|
3202 |
</handler> |
|
3203 |
</extension> |
|
3204 | 3187 |
</plugin> |
tmp/org.txm.rcp/META-INF/MANIFEST.MF (revision 1416) | ||
---|---|---|
37 | 37 |
org.eclipse.ui.views;bundle-version="3.9.0";visibility:=reexport, |
38 | 38 |
org.txm.groovy.core;visibility:=reexport, |
39 | 39 |
org.txm.treetagger.core;visibility:=reexport, |
40 |
org.eclipse.equinox.p2.discovery.compatibility;bundle-version="1.0.201";visibility:=reexport |
|
40 |
org.eclipse.equinox.p2.discovery.compatibility;bundle-version="1.0.201";visibility:=reexport, |
|
41 |
org.eclipse.e4.ui.workbench.renderers.swt |
|
41 | 42 |
Export-Package: junit.extensions, |
42 | 43 |
junit.framework, |
43 | 44 |
junit.runner, |
Formats disponibles : Unified diff