if (toggleAction != null && toggleAction.isEnabled() && toggleAction.isChecked()) {
boolean enable= toggleAction != null; if (enable && editorPart instanceof JavaEditor) enable= JavaPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS); else enable= enable && toggleAction.isEnabled() && toggleAction.isChecked(); if (enable) {
	private static void initializeHighlightRange(IEditorPart editorPart) {		if (editorPart instanceof ITextEditor) {			IAction toggleAction= editorPart.getEditorSite().getActionBars().getGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY);			if (toggleAction != null && toggleAction.isEnabled() && toggleAction.isChecked()) {				if (toggleAction instanceof TextEditorAction) {					// Reset the action					((TextEditorAction)toggleAction).setEditor(null);					// Restore the action					((TextEditorAction)toggleAction).setEditor((ITextEditor)editorPart);				} else {					// Un-check					toggleAction.run();					// Check					toggleAction.run();				}			}		}	}