Package org.eclipse.ui.texteditor.rulers

Examples of org.eclipse.ui.texteditor.rulers.IColumnSupport


   *
   * @param ruler the composite ruler to add contributions to
   * @since 3.3
   */
  protected void updateContributedRulerColumns(CompositeRuler ruler) {
    IColumnSupport support= (IColumnSupport)getAdapter(IColumnSupport.class);
    if (support == null)
      return;
   
    RulerColumnPreferenceAdapter adapter= null;
    if (fPreferenceStore != null)
      adapter= new RulerColumnPreferenceAdapter(getPreferenceStore(), PREFERENCE_RULER_CONTRIBUTIONS);
   
    RulerColumnRegistry registry= RulerColumnRegistry.getDefault();
    List descriptors= registry.getColumnDescriptors();
    for (Iterator it= descriptors.iterator(); it.hasNext();) {
      final RulerColumnDescriptor descriptor= (RulerColumnDescriptor) it.next();
      support.setColumnVisible(descriptor, adapter == null || adapter.isEnabled(descriptor));
    }
  }
View Full Code Here


      return;
    }
   
    if (PREFERENCE_RULER_CONTRIBUTIONS.equals(property)) {
      String[] difference= StringSetSerializer.getDifference((String) event.getOldValue(), (String) event.getNewValue());
      IColumnSupport support= (IColumnSupport) getAdapter(IColumnSupport.class);
      for (int i= 0; i < difference.length; i++) {
        RulerColumnDescriptor desc= RulerColumnRegistry.getDefault().getColumnDescriptor(difference[i]);
        if (desc != null &&  support.isColumnSupported(desc)) {
          boolean newState= !support.isColumnVisible(desc);
          support.setColumnVisible(desc, newState);
        }
      }
      return;
    }
   
View Full Code Here

  public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    if (fSourceViewerDecorationSupport != null)
      fSourceViewerDecorationSupport.install(getPreferenceStore());

    IColumnSupport columnSupport= (IColumnSupport)getAdapter(IColumnSupport.class);
   
    if (isLineNumberRulerVisible()) {
      RulerColumnDescriptor lineNumberColumnDescriptor= RulerColumnRegistry.getDefault().getColumnDescriptor(LineNumberColumn.ID);
      if (lineNumberColumnDescriptor != null)
        columnSupport.setColumnVisible(lineNumberColumnDescriptor, true);
    }

    if (isPrefQuickDiffAlwaysOn())
      showChangeInformation(true);
View Full Code Here

   */
  public void showChangeInformation(boolean show) {
    if (show == isChangeInformationShowing())
      return;

    IColumnSupport columnSupport= (IColumnSupport)getAdapter(IColumnSupport.class);
   
    // only handle visibility of the combined column, but not the number/change only state
    if (show && fLineColumn == null) {
      RulerColumnDescriptor lineNumberColumnDescriptor= RulerColumnRegistry.getDefault().getColumnDescriptor(LineNumberColumn.ID);
      if (lineNumberColumnDescriptor != null)
        columnSupport.setColumnVisible(lineNumberColumnDescriptor, true);
    } else if (!show && fLineColumn != null && !isLineNumberRulerVisible()) {
      columnSupport.setColumnVisible(fLineColumn.getDescriptor(), false);
      fLineColumn= null;
    }
  }
View Full Code Here

        return;
      }

      if (LINE_NUMBER_RULER.equals(property)) {
        // only handle visibility of the combined column, but not the number/change only state
        IColumnSupport columnSupport= (IColumnSupport)getAdapter(IColumnSupport.class);
        if (isLineNumberRulerVisible() && fLineColumn == null) {
          RulerColumnDescriptor lineNumberColumnDescriptor= RulerColumnRegistry.getDefault().getColumnDescriptor(LineNumberColumn.ID);
          if (lineNumberColumnDescriptor != null)
            columnSupport.setColumnVisible(lineNumberColumnDescriptor, true);
        } else if (!isLineNumberRulerVisible() && fLineColumn != null && !fLineColumn.isShowingChangeInformation()) {
          columnSupport.setColumnVisible(fLineColumn.getDescriptor(), false);
          fLineColumn= null;
        }
        return;
      }
View Full Code Here

    super.doSetInput(input);
   
    RulerColumnDescriptor lineNumberColumnDescriptor= RulerColumnRegistry.getDefault().getColumnDescriptor(LineNumberColumn.ID);
    if (lineNumberColumnDescriptor != null) {
      IColumnSupport columnSupport= (IColumnSupport)getAdapter(IColumnSupport.class);
      columnSupport.setColumnVisible(lineNumberColumnDescriptor, isLineNumberRulerVisible() || isPrefQuickDiffAlwaysOn());
    }
  }
View Full Code Here

   * @param menu the ruler context menu
   * @since 3.3
   */
  private void addRulerContributionActions(IMenuManager menu) {
    // store directly in generic editor preferences
    final IColumnSupport support= (IColumnSupport) getAdapter(IColumnSupport.class);
    IPreferenceStore store= EditorsUI.getPreferenceStore();
    final RulerColumnPreferenceAdapter adapter= new RulerColumnPreferenceAdapter(store, AbstractTextEditor.PREFERENCE_RULER_CONTRIBUTIONS);
    List descriptors= RulerColumnRegistry.getDefault().getColumnDescriptors();
    for (Iterator t= descriptors.iterator(); t.hasNext();) {
      final RulerColumnDescriptor descriptor= (RulerColumnDescriptor) 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) {
        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);
View Full Code Here

   *
   * @param ruler the composite ruler to add contributions to
   * @since 3.3
   */
  protected void updateContributedRulerColumns(CompositeRuler ruler) {
    IColumnSupport support= (IColumnSupport)getAdapter(IColumnSupport.class);
    if (support == null)
      return;

    RulerColumnPreferenceAdapter adapter= null;
    if (fPreferenceStore != null)
      adapter= new RulerColumnPreferenceAdapter(getPreferenceStore(), PREFERENCE_RULER_CONTRIBUTIONS);

    RulerColumnRegistry registry= RulerColumnRegistry.getDefault();
    List descriptors= registry.getColumnDescriptors();
    for (Iterator it= descriptors.iterator(); it.hasNext();) {
      final RulerColumnDescriptor descriptor= (RulerColumnDescriptor) it.next();
      support.setColumnVisible(descriptor, adapter == null || adapter.isEnabled(descriptor));
    }
  }
View Full Code Here

      return;
    }

    if (PREFERENCE_RULER_CONTRIBUTIONS.equals(property)) {
      String[] difference= StringSetSerializer.getDifference((String) event.getOldValue(), (String) event.getNewValue());
      IColumnSupport support= (IColumnSupport) getAdapter(IColumnSupport.class);
      for (int i= 0; i < difference.length; i++) {
        RulerColumnDescriptor desc= RulerColumnRegistry.getDefault().getColumnDescriptor(difference[i]);
        if (desc != null &&  support.isColumnSupported(desc)) {
          boolean newState= !support.isColumnVisible(desc);
          support.setColumnVisible(desc, newState);
        }
      }
      return;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.texteditor.rulers.IColumnSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.