Search in sources :

Example 6 with IColumnSupport

use of org.eclipse.ui.texteditor.rulers.IColumnSupport in project eclipse.platform.text by eclipse.

the class AbstractDecoratedTextEditor method addRulerContributionActions.

/**
 * Adds "show" actions for all contributed rulers that support it.
 *
 * @param menu the ruler context menu
 * @since 3.3
 */
private void addRulerContributionActions(IMenuManager menu) {
    // store directly in generic editor preferences
    final IColumnSupport support = getAdapter(IColumnSupport.class);
    IPreferenceStore store = EditorsUI.getPreferenceStore();
    final RulerColumnPreferenceAdapter adapter = new RulerColumnPreferenceAdapter(store, AbstractTextEditor.PREFERENCE_RULER_CONTRIBUTIONS);
    List<RulerColumnDescriptor> descriptors = RulerColumnRegistry.getDefault().getColumnDescriptors();
    for (Iterator<RulerColumnDescriptor> t = descriptors.iterator(); t.hasNext(); ) {
        final RulerColumnDescriptor descriptor = t.next();
        if (!descriptor.isIncludedInMenu() || !support.isColumnSupported(descriptor))
            continue;
        final boolean isVisible = support.isColumnVisible(descriptor);
        IAction action = new Action(MessageFormat.format(TextEditorMessages.AbstractDecoratedTextEditor_show_ruler_label, new Object[] { descriptor.getName() }), IAction.AS_CHECK_BOX) {

            @Override
            public void run() {
                if (descriptor.isGlobal())
                    // column state is modified via preference listener of AbstractTextEditor
                    adapter.setEnabled(descriptor, !isVisible);
                else
                    // directly modify column for this editor instance
                    support.setColumnVisible(descriptor, !isVisible);
            }
        };
        action.setChecked(isVisible);
        action.setImageDescriptor(descriptor.getIcon());
        menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, action);
    }
}
Also used : RevertLineAction(org.eclipse.ui.internal.editors.quickdiff.RevertLineAction) RevertBlockAction(org.eclipse.ui.internal.editors.quickdiff.RevertBlockAction) BooleanPreferenceToggleAction(org.eclipse.ui.internal.texteditor.BooleanPreferenceToggleAction) RevertSelectionAction(org.eclipse.ui.internal.editors.quickdiff.RevertSelectionAction) CompositeRevertAction(org.eclipse.ui.internal.editors.quickdiff.CompositeRevertAction) RestoreAction(org.eclipse.ui.internal.editors.quickdiff.RestoreAction) IAction(org.eclipse.jface.action.IAction) RefreshEditorAction(org.eclipse.ui.internal.editors.text.RefreshEditorAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) RulerColumnDescriptor(org.eclipse.ui.texteditor.rulers.RulerColumnDescriptor) IColumnSupport(org.eclipse.ui.texteditor.rulers.IColumnSupport) RulerColumnPreferenceAdapter(org.eclipse.ui.texteditor.rulers.RulerColumnPreferenceAdapter) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 7 with IColumnSupport

use of org.eclipse.ui.texteditor.rulers.IColumnSupport in project eclipse.platform.text by eclipse.

the class AbstractDecoratedTextEditor method createPartControl.

/*
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(Composite)
	 */
@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    if (fSourceViewerDecorationSupport != null)
        fSourceViewerDecorationSupport.install(getPreferenceStore());
    IColumnSupport columnSupport = getAdapter(IColumnSupport.class);
    if (isLineNumberRulerVisible()) {
        RulerColumnDescriptor lineNumberColumnDescriptor = RulerColumnRegistry.getDefault().getColumnDescriptor(LineNumberColumn.ID);
        if (lineNumberColumnDescriptor != null)
            columnSupport.setColumnVisible(lineNumberColumnDescriptor, true);
    }
    if (isPrefQuickDiffAlwaysOn())
        showChangeInformation(true);
    if (fOverviewRuler instanceof IOverviewRulerExtension)
        ((IOverviewRulerExtension) fOverviewRuler).setUseSaturatedColors(isPrefUseSaturatedColorsOn());
    if (!isOverwriteModeEnabled())
        enableOverwriteMode(false);
    if (!isRangeIndicatorEnabled()) {
        getSourceViewer().removeRangeIndication();
        getSourceViewer().setRangeIndicator(null);
    }
    // Assign the quick assist assistant to the annotation access.
    ISourceViewer viewer = getSourceViewer();
    if (fAnnotationAccess instanceof IAnnotationAccessExtension2 && viewer instanceof ISourceViewerExtension3)
        ((IAnnotationAccessExtension2) fAnnotationAccess).setQuickAssistAssistant(((ISourceViewerExtension3) viewer).getQuickAssistAssistant());
    createOverviewRulerContextMenu();
}
Also used : RulerColumnDescriptor(org.eclipse.ui.texteditor.rulers.RulerColumnDescriptor) IAnnotationAccessExtension2(org.eclipse.jface.text.source.IAnnotationAccessExtension2) IColumnSupport(org.eclipse.ui.texteditor.rulers.IColumnSupport) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) ISourceViewerExtension3(org.eclipse.jface.text.source.ISourceViewerExtension3) IOverviewRulerExtension(org.eclipse.jface.text.source.IOverviewRulerExtension)

Example 8 with IColumnSupport

use of org.eclipse.ui.texteditor.rulers.IColumnSupport in project dbeaver by serge-rider.

the class SQLEditor method showScriptPositionRuler.

private void showScriptPositionRuler(boolean show) {
    IColumnSupport columnSupport = getAdapter(IColumnSupport.class);
    if (columnSupport != null) {
        RulerColumnDescriptor positionColumn = RulerColumnRegistry.getDefault().getColumnDescriptor(ScriptPositionColumn.ID);
        columnSupport.setColumnVisible(positionColumn, show);
    }
}
Also used : RulerColumnDescriptor(org.eclipse.ui.texteditor.rulers.RulerColumnDescriptor) IColumnSupport(org.eclipse.ui.texteditor.rulers.IColumnSupport)

Example 9 with IColumnSupport

use of org.eclipse.ui.texteditor.rulers.IColumnSupport in project tdi-studio-se by Talend.

the class AbstractMultiPageTalendEditor method beforeDispose.

public void beforeDispose() {
    if (null != jobletEditor) {
        IColumnSupport cs = (IColumnSupport) jobletEditor.getAdapter(IColumnSupport.class);
        cs.dispose();
    }
}
Also used : IColumnSupport(org.eclipse.ui.texteditor.rulers.IColumnSupport)

Example 10 with IColumnSupport

use of org.eclipse.ui.texteditor.rulers.IColumnSupport in project dbeaver by dbeaver.

the class SQLEditor method showScriptPositionRuler.

private void showScriptPositionRuler(boolean show) {
    IColumnSupport columnSupport = (IColumnSupport) getAdapter(IColumnSupport.class);
    if (columnSupport != null) {
        RulerColumnDescriptor positionColumn = RulerColumnRegistry.getDefault().getColumnDescriptor(ScriptPositionColumn.ID);
        columnSupport.setColumnVisible(positionColumn, show);
    }
}
Also used : RulerColumnDescriptor(org.eclipse.ui.texteditor.rulers.RulerColumnDescriptor) IColumnSupport(org.eclipse.ui.texteditor.rulers.IColumnSupport)

Aggregations

IColumnSupport (org.eclipse.ui.texteditor.rulers.IColumnSupport)10 RulerColumnDescriptor (org.eclipse.ui.texteditor.rulers.RulerColumnDescriptor)9 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)3 IAction (org.eclipse.jface.action.IAction)2 ITextViewerExtension6 (org.eclipse.jface.text.ITextViewerExtension6)2 IHyperlinkDetector (org.eclipse.jface.text.hyperlink.IHyperlinkDetector)2 IOverviewRulerExtension (org.eclipse.jface.text.source.IOverviewRulerExtension)2 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)2 Point (org.eclipse.swt.graphics.Point)2 RulerColumnPreferenceAdapter (org.eclipse.ui.texteditor.rulers.RulerColumnPreferenceAdapter)2 Action (org.eclipse.jface.action.Action)1 ITextViewerExtension8 (org.eclipse.jface.text.ITextViewerExtension8)1 CompositeRuler (org.eclipse.jface.text.source.CompositeRuler)1 IAnnotationAccessExtension2 (org.eclipse.jface.text.source.IAnnotationAccessExtension2)1 ISourceViewerExtension3 (org.eclipse.jface.text.source.ISourceViewerExtension3)1 IVerticalRuler (org.eclipse.jface.text.source.IVerticalRuler)1 CompositeRevertAction (org.eclipse.ui.internal.editors.quickdiff.CompositeRevertAction)1 RestoreAction (org.eclipse.ui.internal.editors.quickdiff.RestoreAction)1 RevertBlockAction (org.eclipse.ui.internal.editors.quickdiff.RevertBlockAction)1 RevertLineAction (org.eclipse.ui.internal.editors.quickdiff.RevertLineAction)1