Revision 1417

tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1417)
540 540
//		IContributionItem[] items = manager.getItems(); 
541 541

  
542 542
		
543
		//this.topToolBar.setEnabled(dirty);
544
		ToolItem computeButton = this.topToolBar.getItemByContributionId("compute");
543
		// enable/disable the compute boutton according to dirty state of the editor
544
		ToolItem computeButton = this.topToolBar.getItemByContributionId("compute"); //$NON-NLS-1$
545 545
		computeButton.setEnabled(dirty);
546 546
		
547 547
		
tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/CurrentEditorIsDirty.java (revision 1417)
1
package org.txm.rcp.testers;
2

  
3
import org.eclipse.core.expressions.PropertyTester;
4
import org.txm.rcp.editors.TXMEditor;
5
import org.txm.rcp.handlers.BaseAbstractHandler;
6

  
7
/**
8
 * Checks if the results persistence is enabled.
9
 * 
10
 * @author sjacquot
11
 *
12
 */
13
public class CurrentEditorIsDirty extends PropertyTester {
14

  
15
	//public static final String PROPERTY_NAMESPACE = "org.txm.rcp.testers"; //$NON-NLS-1$
16
//	
17
//	public static final String PROPERTY_STATE_ENGINE_READY = "CurrentEditorIsDirty"; //$NON-NLS-1$
18

  
19

  
20
	@Override
21
	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
22

  
23
		TXMEditor editor = BaseAbstractHandler.getActiveEditor(null);
24
		
25
		boolean dirty = false;
26
		
27
		if(editor != null)	{
28
			dirty = editor.isDirty();
29
		}
30
		
31
		// DEbug
32
		//System.err.println("Current editor is dirty: " + dirty);
33
		
34
		return dirty;
35
		
36
//		return true;
37
	}
38

  
39
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/IsParentHidden.java (revision 1417)
5 5
import org.eclipse.core.expressions.PropertyTester;
6 6
import org.txm.core.results.TXMResult;
7 7

  
8
/**
9
 * Checks if the results persistence is enabled.
10
 * 
11
 * @author sjacquot
12
 *
13
 */
8

  
14 9
public class IsParentHidden extends PropertyTester {
15 10

  
16 11
	@Override
tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/IsParentVisible.java (revision 1417)
5 5
import org.eclipse.core.expressions.PropertyTester;
6 6
import org.txm.core.results.TXMResult;
7 7

  
8
/**
9
 * Checks if the results persistence is enabled.
10
 * 
11
 * @author sjacquot
12
 *
13
 */
8

  
14 9
public class IsParentVisible extends PropertyTester {
15 10

  
16 11
	@Override
tmp/org.txm.rcp/plugin.xml (revision 1417)
3045 3045
            properties="IsParentHidden"
3046 3046
            type="java.lang.Object">
3047 3047
      </propertyTester>
3048
      <propertyTester
3049
            class="org.txm.rcp.testers.CurrentEditorIsDirty"
3050
            id="org.txm.rcp.testers.CurrentEditorIsDirty"
3051
            namespace="org.txm.rcp.testers"
3052
            properties="CurrentEditorIsDirty"
3053
            type="java.lang.Object">
3054
      </propertyTester>
3055 3048
   </extension>
3056 3049
   <extension
3057 3050
         point="org.eclipse.ui.bindings">

Also available in: Unified diff