org.eclipse.jface.text.source.IVerticalRulerColumn Java Examples

The following examples show how to use org.eclipse.jface.text.source.IVerticalRulerColumn. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GamlEditor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void handlePreferenceStoreChanged(final PropertyChangeEvent event) {
	final LineNumberColumn c;
	super.handlePreferenceStoreChanged(event);
	if (event.getProperty().equals(PREFERENCE_COLOR_BACKGROUND)) {
		// this.fSourceViewerDecorationSupport.updateOverviewDecorations();

		this.getVerticalRuler().getControl()
				.setBackground(GamaColors.get(GamaPreferences.Modeling.EDITOR_BACKGROUND_COLOR.getValue()).color());

		final Iterator e = ((CompositeRuler) getVerticalRuler()).getDecoratorIterator();
		while (e.hasNext()) {
			final IVerticalRulerColumn column = (IVerticalRulerColumn) e.next();
			column.getControl().setBackground(
					GamaColors.get(GamaPreferences.Modeling.EDITOR_BACKGROUND_COLOR.getValue()).color());
			column.redraw();
		}
	}
}
 
Example #2
Source File: SourceCodeTextEditor.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected IVerticalRulerColumn createLineNumberRulerColumn() {
	fLineNumberRulerColumn= new LineNumberChangeRulerColumn(getSharedColors()){
		@Override
		public void redraw() {
			for (IRulerPainter p : rulerPainters) {
				p.beforePaint();
			}
			super.redraw();
		}
		
		@Override
		protected void paintLine(int line, int y, int lineheight, GC gc,
				Display display) {
			boolean isPaintLine = true;
			Rectangle r = new Rectangle(0, y, getWidth(), lineheight);
			for (IRulerPainter p : rulerPainters) {
				isPaintLine = isPaintLine && !p.paintLine(line, r, gc, display);
			}
			if (isPaintLine){
				super.paintLine(line, y, lineheight, gc, display);
			}
		}
	};
	((IChangeRulerColumn) fLineNumberRulerColumn).setHover(createChangeHover());
	initializeLineNumberRulerColumn(fLineNumberRulerColumn);
	return fLineNumberRulerColumn;
}
 
Example #3
Source File: TypeScriptEditor.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Creates a new line number ruler column that is appropriately initialized.
 *
 * @return the created line number column
 */
protected IVerticalRulerColumn createLineNumberRulerColumn() {
	/*
	 * Left for compatibility. See LineNumberColumn.
	 */
	fLineNumberRulerColumn = LineNumberChangeRulerColumnPatch.create(getSharedColors());
	((IChangeRulerColumn) fLineNumberRulerColumn).setHover(createChangeHover());
	initializeLineNumberRulerColumn(fLineNumberRulerColumn);
	return fLineNumberRulerColumn;
}
 
Example #4
Source File: ThemeableEditorExtension.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void overrideRulerColors()
{
	IThemeableEditor editor = this.fEditor.get();

	// default to bg color of surrounding composite
	Color bg = null;
	// Use editor background color if we can
	if (editor != null)
	{
		ISourceViewer sv = editor.getISourceViewer();
		if (sv != null)
		{
			StyledText text = sv.getTextWidget();
			if (text != null)
			{
				bg = text.getBackground();
				// copy the color because for some reason it gets disposed
				bg = ThemePlugin.getDefault().getColorManager().getColor(bg.getRGB());
			}
		}

		// force the colors for all the ruler columns (specifically so we force the folding bg to match).
		CompositeRuler ruler = (CompositeRuler) editor.getIVerticalRuler();
		Iterator<IVerticalRulerColumn> iter = ruler.getDecoratorIterator();
		while (iter.hasNext())
		{
			IVerticalRulerColumn column = iter.next();
			column.getControl().setBackground(bg);
		}
	}

	if (fLineColumn != null)
	{
		fLineColumn.setBackground(bg);
	}
}
 
Example #5
Source File: AbstractThemeableEditor.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected IVerticalRulerColumn createLineNumberRulerColumn()
{
	fLineNumberRulerColumn = new CommonLineNumberChangeRulerColumn(getSharedColors());
	((IChangeRulerColumn) fLineNumberRulerColumn).setHover(createChangeHover());
	initializeLineNumberRulerColumn(fLineNumberRulerColumn);
	return fLineNumberRulerColumn;
}
 
Example #6
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) {
	if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
		return super.createAnnotationRulerColumn(ruler);

	AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess());
	column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() {

		public void doubleClick(DoubleClickEvent event) {
			// for now: just invoke ruler double click action
			triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK);
		}

		private void triggerAction(String actionID) {
			IAction action= getAction(actionID);
			if (action != null) {
				if (action instanceof IUpdate)
					((IUpdate) action).update();
				// hack to propagate line change
				if (action instanceof ISelectionListener) {
					((ISelectionListener)action).selectionChanged(null, null);
				}
				if (action.isEnabled())
					action.run();
			}
		}

	}));

	return column;
}
 
Example #7
Source File: ScriptEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new line number ruler column that is appropriately initialized.
 * @param annotationModel 
 * 
 * @return the created line number column
 */
private IVerticalRulerColumn createLineNumberRulerColumn( )
{
	LineNumberRulerColumn column = new LineNumberRulerColumn( );

	column.setForeground( JSSourceViewerConfiguration.getColorByCategory( PreferenceNames.P_LINENUMBER_COLOR ) );
	return column;
}
 
Example #8
Source File: ExpressionBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new line number ruler column that is appropriately initialized.
 * 
 * @param annotationModel
 * 
 * @return the created line number column
 */
private IVerticalRulerColumn createLineNumberRulerColumn( )
{
	LineNumberRulerColumn column = new LineNumberRulerColumn( );

	column.setForeground( JSSourceViewerConfiguration.getColorByCategory( PreferenceNames.P_LINENUMBER_COLOR ) );
	return column;
}