View | Details | Raw Unified | Return to bug 41926 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/texteditor/AbstractTextEditor.java (-1 / +13 lines)
Lines 4781-4784 Link Here
4781
	public boolean isChangeInformationShowing() {
4781
	public boolean isChangeInformationShowing() {
4782
		return false;
4782
		return false;
4783
	}
4783
	}
4784
}
4784
    
4785
    /**
4786
     * Checks whether the given control is the same as the control being used 
4787
     * internally by the editor.
4788
     * @param control The control with which to compare; may be 
4789
     * <code>null</code>.
4790
     * @return <code>true</code> if the control is the same; <code>false</code>
4791
     * otherwise.
4792
     */
4793
    public final boolean usesControl(final Control control) {
4794
        return (getSourceViewer().getTextWidget() == control);
4795
    }
4796
}
(-)src/org/eclipse/ui/texteditor/TextOperationAction.java (-3 / +21 lines)
Lines 15-26 Link Here
15
15
16
import java.util.ResourceBundle;
16
import java.util.ResourceBundle;
17
17
18
import org.eclipse.jface.text.ITextOperationTarget;
18
import org.eclipse.swt.custom.BusyIndicator;
19
import org.eclipse.swt.custom.BusyIndicator;
19
import org.eclipse.swt.widgets.Display;
20
import org.eclipse.swt.widgets.Display;
20
import org.eclipse.swt.widgets.Shell;
21
import org.eclipse.swt.widgets.Shell;
21
22
import org.eclipse.jface.text.ITextOperationTarget;
23
24
import org.eclipse.ui.IWorkbenchPartSite;
22
import org.eclipse.ui.IWorkbenchPartSite;
25
23
26
24
Lines 93-98 Link Here
93
		fRunsOnReadOnly= runsOnReadOnly;
91
		fRunsOnReadOnly= runsOnReadOnly;
94
		update();
92
		update();
95
	}
93
	}
94
    
95
    /**
96
     * Checks whether the action should be enabled.  This verifies that the text
97
     * editor on which the operation is meant to act is the same as the control
98
     * that currently has focus.  Otherwise, it allows its super class to 
99
     * decide.
100
     * @return <code>false</code> if the control with focus is not the control
101
     * used by this text editor; otherwise decided by the super class.  
102
     */
103
    public final boolean isEnabled() {
104
        final ITextEditor textEditor = getTextEditor();
105
        if (textEditor instanceof AbstractTextEditor) {
106
            final AbstractTextEditor abstractEditor = (AbstractTextEditor) textEditor;
107
            if (!abstractEditor.usesControl(Display.getCurrent().getFocusControl())) {
108
                return false;
109
            }
110
        }
111
        
112
        return super.isEnabled();
113
    }
96
	
114
	
97
	/**
115
	/**
98
	 * The <code>TextOperationAction</code> implementation of this 
116
	 * The <code>TextOperationAction</code> implementation of this 

Return to bug 41926