@Override protected IOverviewRuler createOverviewRuler(ISharedTextColors sharedColors) { // Note: create the minimap overview ruler regardless of whether it should be shown or not // (the setting to show it will control what's drawn). if (MinimapOverviewRulerPreferencesPage.useMinimap()) { IOutlineModel outlineModel = (IOutlineModel) this.getAdapter(IOutlineModel.class); IOverviewRuler ruler = new MinimapOverviewRuler(getAnnotationAccess(), sharedColors, outlineModel); Iterator e = getAnnotationPreferences().getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference preference = (AnnotationPreference) e.next(); if (preference.contributesToHeader()) { ruler.addHeaderAnnotationType(preference.getAnnotationType()); } } return ruler; } else { return super.createOverviewRuler(sharedColors); } }
public static LineNumberChangeRulerColumn create(ISharedTextColors sharedColors) { try { ProxyFactory factory = new ProxyFactory(); factory.setSuperclass(LineNumberChangeRulerColumn.class); factory.setHandler(new LineNumberChangeRulerColumnMethodHandler()); return (LineNumberChangeRulerColumn) factory.create(new Class[] { ISharedTextColors.class }, new Object[] { sharedColors }); } catch (Exception e) { e.printStackTrace(); return new LineNumberChangeRulerColumn(sharedColors); } }
public SQLEditorSourceViewerConfiguration(ISharedTextColors sharedColors, IPreferenceStore store, SQLEditor editor) { super(store); fSharedColors= sharedColors; this.prefs = Activator.getDefault().getPreferenceStore(); this.editor = editor; }
private SourceViewerDecorationSupport configureAnnotationPreferences() { ISharedTextColors textColors = EditorsUI.getSharedTextColors(); IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess(); final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport( sourceViewer, null, annotationAccess, textColors); List annotationPreferences = new MarkerAnnotationPreferences() .getAnnotationPreferences(); Iterator e = annotationPreferences.iterator(); while (e.hasNext()) support.setAnnotationPreference((AnnotationPreference) e.next()); support.install(EditorsUI.getPreferenceStore()); return support; }
public MinimapOverviewRuler(IAnnotationAccess annotationAccess, ISharedTextColors sharedColors, IOutlineModel outlineModel) { super(annotationAccess, MinimapOverviewRulerPreferencesPage.getMinimapWidth(), sharedColors); this.fOutlineModel = outlineModel; propertyListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (MinimapOverviewRulerPreferencesPage.MINIMAP_WIDTH.equals(event.getProperty())) { updateWidth(); } } }; if (outlineModel != null) { modelListener = new ICallbackListener<IOutlineModel>() { @Override public Object call(IOutlineModel obj) { lastModelChange = System.currentTimeMillis(); update(); return null; } }; ICallbackWithListeners<IOutlineModel> onModelChangedListener = outlineModel.getOnModelChangedCallback(); onModelChangedListener.registerListener(modelListener); } }
public SourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles, IAnnotationAccess annotationAccess, ISharedTextColors sharedColors, IDocument document) { super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, SWT.BOLD); int id = currentId++; filename = VIEWER_CLASS_NAME + id++ + ".java"; this.sharedColors=sharedColors; this.annotationAccess=annotationAccess; this.fOverviewRuler=overviewRuler; oldAnnotations= new HashMap<ProjectionAnnotation, Position>(); IJavaProject javaProject = JavaCore.create(BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject()); try { IPackageFragmentRoot[] ipackageFragmentRootList=javaProject.getPackageFragmentRoots(); IPackageFragmentRoot ipackageFragmentRoot=null; for(IPackageFragmentRoot tempIpackageFragmentRoot:ipackageFragmentRootList) { if(tempIpackageFragmentRoot.getKind()==IPackageFragmentRoot.K_SOURCE && StringUtils.equals(PathConstant.TEMP_BUILD_PATH_SETTINGS_FOLDER,tempIpackageFragmentRoot.getPath().removeFirstSegments(1).toString())) { ipackageFragmentRoot=tempIpackageFragmentRoot; break; } } IPackageFragment compilationUnitPackage= ipackageFragmentRoot.createPackageFragment(HYDROGRAPH_COMPILATIONUNIT_PACKAGE, true, new NullProgressMonitor()); compilatioUnit= compilationUnitPackage.createCompilationUnit(filename,document.get(),true, new NullProgressMonitor()); } catch (Exception exception) { LOGGER.warn("Exception occurred while initializing source viewer", exception); } finally { if (javaProject != null) { try { javaProject.close(); } catch (JavaModelException javaModelException) { LOGGER.warn("Exception occurred while closing java-project", javaModelException); } } } initializeViewer(document); updateContents(); }
protected ISharedTextColors getSharedColors() { return EditorsUI.getSharedTextColors(); }
public void createPartControl(Composite parent) { int VERTICAL_RULER_WIDTH = 12; int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; ISharedTextColors sharedColors = EditorsPlugin.getDefault().getSharedTextColors(); IOverviewRuler overviewRuler = new OverviewRuler(null, VERTICAL_RULER_WIDTH, sharedColors); CompositeRuler ruler = new CompositeRuler(VERTICAL_RULER_WIDTH); _document = new Document(); _document.set(_docString); _annotationModel = new AnnotationModel(); _annotationModel.connect(_document); _sourceViewer = new SourceViewer(parent, ruler, overviewRuler, true, styles); _sourceViewer.configure(new SourceViewerConfiguration()); _sds = new SourceViewerDecorationSupport(_sourceViewer, overviewRuler, null, sharedColors); AnnotationPreference ap = new AnnotationPreference(); ap.setColorPreferenceKey(ANNO_KEY_COLOR); ap.setHighlightPreferenceKey(ANNO_KEY_HIGHLIGHT); ap.setVerticalRulerPreferenceKey(ANNO_KEY_VERTICAL); ap.setOverviewRulerPreferenceKey(ANNO_KEY_OVERVIEW); ap.setTextPreferenceKey(ANNO_KEY_TEXT); ap.setAnnotationType(ANNO_TYPE); _sds.setAnnotationPreference(ap); // _sds.install(EditorsPlugin.getDefault().getPreferenceStore()); _sourceViewer.setDocument(_document, _annotationModel); _sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); ruler.addDecorator(0, new LineNumberRulerColumn()); Annotation annotation = new Annotation(false); annotation.setType(ANNO_TYPE); Position position = new Position(0, 4); _annotationModel.addAnnotation(annotation, position); parent.layout(); }
protected ISharedTextColors getSharedColors() { return EditorsPlugin.getDefault().getSharedTextColors(); }
public SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager, IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter) { return new XMLSourceViewerConfiguration(preferenceStore, (AbstractThemeableEditor) editor); }
public SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager, IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter) { return new CSSSourceViewerConfiguration(preferenceStore, (AbstractThemeableEditor) editor); }
public SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager, IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter) { return new JSSourceViewerConfiguration(preferenceStore, (AbstractThemeableEditor) editor); }
SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager, IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter);
public SourceViewerConfiguration createSimpleSourceViewerConfiguration(ISharedTextColors colorManager, IPreferenceStore preferenceStore, ITextEditor editor, boolean configureFormatter) { return new HTMLSourceViewerConfiguration(preferenceStore, (AbstractThemeableEditor) editor); }
/** * Creates a new instance. * * @param sharedColors the shared colors provider to use */ public CommonLineNumberChangeRulerColumn(ISharedTextColors sharedColors) { Assert.isNotNull(sharedColors); fRevisionPainter= new RevisionPainter(this, sharedColors); fDiffPainter= new DiffPainter(this, sharedColors); }
@Override protected ISharedTextColors getSharedColors() { ISharedTextColors sharedColors = ForceIdeUIPlugin.getSharedTextColors(); return sharedColors; }
public static ISharedTextColors getSharedTextColors() { if (sharedTextColors == null) { sharedTextColors = new SharedTextColors(); } return sharedTextColors; }
protected ISharedTextColors getColorManager() { return ColorManager.getDefault(); }
/** * Constructs a overview ruler of the given width using the given annotation * access and the given color manager. * * @param annotationAccess the annotation access * @param width the width of the vertical ruler * @param sharedColors the color manager * @param discolorTemporaryAnnotation <code>true</code> if temporary annotations should be discolored * @since 3.4 */ public CopiedOverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors, boolean discolorTemporaryAnnotation) { fAnnotationAccess = annotationAccess; fWidth = width; fSharedTextColors = sharedColors; fIsTemporaryAnnotationDiscolored = discolorTemporaryAnnotation; }
/** * Constructs a overview ruler of the given width using the given annotation access and the given * color manager. * <p><strong>Note:</strong> As of 3.4, temporary annotations are no longer discolored. * Use {@link #OverviewRuler(IAnnotationAccess, int, ISharedTextColors, boolean)} if you * want to keep the old behavior.</p> * * @param annotationAccess the annotation access * @param width the width of the vertical ruler * @param sharedColors the color manager */ public CopiedOverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors) { this(annotationAccess, width, sharedColors, false); }