import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextOperationAction;
-
/**
* Groups the JDT folding actions.
- *
+ *
* @since 3.0
*/
public class FoldingToggleRulerAction extends AbstractRulerActionDelegate {
private IAction fUIAction;
+
private TextOperationAction fAction;
+
private ITextEditor fTextEditor;
/*
- * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.source.IVerticalRulerInfo)
+ * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(org.eclipse.ui.texteditor.ITextEditor,
+ * org.eclipse.jface.text.source.IVerticalRulerInfo)
*/
- protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
- fTextEditor= editor;
- fAction= new TextOperationAction(ActionMessages.getResourceBundle(), "Projection.Toggle.", editor, ProjectionViewer.TOGGLE, true); //$NON-NLS-1$
+ protected IAction createAction(ITextEditor editor,
+ IVerticalRulerInfo rulerInfo) {
+ fTextEditor = editor;
+ fAction = new TextOperationAction(ActionMessages.getResourceBundle(),
+ "Projection.Toggle.", editor, ProjectionViewer.TOGGLE, true); //$NON-NLS-1$
fAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_TOGGLE);
return fAction;
}
-
+
/*
- * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
+ * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction,
+ * org.eclipse.ui.IEditorPart)
*/
public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
- fUIAction= callerAction;
+ fUIAction = callerAction;
super.setActiveEditor(callerAction, targetEditor);
}
-
+
/*
* @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
*/
update();
super.menuAboutToShow(manager);
}
-
+
private void update() {
if (fTextEditor instanceof PHPEditor) {
- ISourceViewer viewer= ((PHPEditor) fTextEditor).getViewer();
+ ISourceViewer viewer = ((PHPEditor) fTextEditor).getViewer();
if (viewer instanceof ProjectionViewer) {
- boolean enabled= ((ProjectionViewer) viewer).getProjectionAnnotationModel() != null;
+ boolean enabled = ((ProjectionViewer) viewer)
+ .getProjectionAnnotationModel() != null;
fUIAction.setChecked(enabled);
}
}