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);
}
}
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();
}
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);
}
}
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();
}
}
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);
}
}
Aggregations