@Override protected ISourceViewer createTypeScriptSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean isOverviewRulerVisible, int styles, IPreferenceStore store) { return new AdaptedSourceViewer(parent, verticalRuler, overviewRuler, isOverviewRulerVisible, styles, store) { @Override protected void handleDispose() { super.handleDispose(); // dispose the compilation unit adapter dispose(); fEditor.remove(this); if (fEditor.isEmpty()) { fEditor = null; fSite = null; } fSourceViewer.remove(this); if (fSourceViewer.isEmpty()) fSourceViewer = null; } }; }
@Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { Composite composite = new Composite(parent, SWT.NONE); GridLayout compositeLayout = new GridLayout(1, false); compositeLayout.marginHeight = 0; compositeLayout.marginWidth = 0; compositeLayout.horizontalSpacing = 0; compositeLayout.verticalSpacing = 0; composite.setLayout(compositeLayout); topPanel = new Composite(composite, SWT.NONE); topPanel.setLayout(new StackLayout()); topPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); Composite editorComposite = new Composite(composite, SWT.NONE); editorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); FillLayout fillLayout = new FillLayout(SWT.VERTICAL); fillLayout.marginHeight = 0; fillLayout.marginWidth = 0; fillLayout.spacing = 0; editorComposite.setLayout(fillLayout); ISourceViewer result = doCreateSourceViewer(editorComposite, ruler, styles); return result; }
@Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer sourceViewer = super.createSourceViewer(parent, ruler, styles); // Apply preference settings from the default editor IPreferenceStore store = EditorsUI.getPreferenceStore(); Color backgroundColor = PreferenceUtils.colorFromString( store.getString(PREFERENCE_COLOR_BACKGROUND)); Color foregroundColor = PreferenceUtils.colorFromString( store.getString(PREFERENCE_COLOR_FOREGROUND)); Color selectionBackgroundColor = PreferenceUtils.colorFromString( store.getString(PREFERENCE_COLOR_SELECTION_BACKGROUND), new RGB(99, 99, 99)); Color selectionForegroundColor = PreferenceUtils.colorFromString( store.getString(PREFERENCE_COLOR_SELECTION_FOREGROUND), new RGB(0, 0, 0)); final StyledText textWidget = sourceViewer.getTextWidget(); textWidget.setBackground(backgroundColor); textWidget.setForeground(foregroundColor); textWidget.setSelectionBackground(selectionBackgroundColor); textWidget.setSelectionForeground(selectionForegroundColor); return sourceViewer; }
@Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { fAnnotationAccess = createAnnotationAccess(); fOverviewRuler = createOverviewRuler(getSharedColors()); ProjectionViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); fProjectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors()); fProjectionSupport.addSummarizableAnnotationType(ANNOTATION_TYPE_APEX_ERROR); //$NON-NLS-1$ fProjectionSupport.addSummarizableAnnotationType(ANNOTATION_TYPE_APEX_WARNING); //$NON-NLS-1$ fProjectionSupport.install(); setTitleToolTip(EDITOR_NAME); // ensure source viewer decoration support has been created and configured getSourceViewerDecorationSupport(viewer); fBracketInserter = new BracketInserter(this, viewer); return viewer; }
protected ISourceViewer createSourceViewer( Composite parent, IVerticalRuler ruler, int styles ) { fAnnotationAccess = getAnnotationAccess( ); fOverviewRuler = createOverviewRuler( getSharedColors( ) ); ProjectionViewer viewer = new ProjectionViewer( parent, ruler, getOverviewRuler( ), isOverviewRulerVisible( ), styles ); ProjectionSupport fProjectionSupport = new ProjectionSupport( viewer, getAnnotationAccess( ), getSharedColors( ) ); fProjectionSupport.addSummarizableAnnotationType( "org.eclipse.ui.workbench.texteditor.error" ); //$NON-NLS-1$ fProjectionSupport.addSummarizableAnnotationType( "org.eclipse.ui.workbench.texteditor.warning" ); //$NON-NLS-1$ fProjectionSupport.install( ); // Ensures source viewer decoration support has been created and // configured. getSourceViewerDecorationSupport( viewer ); return viewer; }
public PythonSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { super(parent, ruler, null, false, styles, new PyAbstractIndentGuidePreferencesProvider() { @Override public int getTabWidth() { return DefaultIndentPrefs.get(null).getTabWidth(); } }); StyledText text = this.getTextWidget(); text.addBidiSegmentListener(new BidiSegmentListener() { @Override public void lineGetSegments(BidiSegmentEvent event) { try { event.segments = getBidiLineSegments(event.lineOffset); } catch (BadLocationException x) { // ignore } } }); updateViewerFont(); updateViewerColors(); getPreferenceStore().addPropertyChangeListener(propertyChangeListener); }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) { public void setSelection(ISelection selection, boolean reveal) { if (!DwprofileEditor.this.setSelection(selection, reveal)) { super.setSelection(selection, reveal); } } }; // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) { public void setSelection(ISelection selection, boolean reveal) { if (!HyexpressionEditor.this.setSelection(selection, reveal)) { super.setSelection(selection, reveal); } } }; // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) { public void setSelection(ISelection selection, boolean reveal) { if (!HyvalidityformulaEditor.this.setSelection(selection, reveal)) { super.setSelection(selection, reveal); } } }; // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) { public void setSelection(ISelection selection, boolean reveal) { if (!HydatavalueEditor.this.setSelection(selection, reveal)) { super.setSelection(selection, reveal); } } }; // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) { public void setSelection(ISelection selection, boolean reveal) { if (!HymappingEditor.this.setSelection(selection, reveal)) { super.setSelection(selection, reveal); } } }; // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) { public void setSelection(ISelection selection, boolean reveal) { if (!HyconstraintsEditor.this.setSelection(selection, reveal)) { super.setSelection(selection, reveal); } } }; // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) { public void setSelection(ISelection selection, boolean reveal) { if (!HymanifestEditor.this.setSelection(selection, reveal)) { super.setSelection(selection, reveal); } } }; // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
public FtcSourceViewer(IResource resource, Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler, boolean overviewRulerVisible, int styles) { super(parent, ruler, overviewRuler, overviewRulerVisible, styles); this.resource = resource; this.syntaxColoring = new SyntaxColoring(this); }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { fOverviewRuler = createOverviewRuler(getSharedColors()); ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ProjectionViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); // ensure decoration support has been created and configured. // @see org.eclipse.ui.texteditor.ExtendedTextEditor#createSourceViewer getSourceViewerDecorationSupport(viewer); return viewer; }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
protected final ISourceViewer createSourceViewer(Composite parent, IVerticalRuler verticalRuler, int styles) { IPreferenceStore store = getPreferenceStore(); ISourceViewer viewer = createTypeScriptSourceViewer(parent, verticalRuler, getOverviewRuler(), isOverviewRulerVisible(), styles, store); // JavaUIHelp.setHelp(this, viewer.getTextWidget(), // IJavaHelpContextIds.JAVA_EDITOR); TypeScriptSourceViewer TypeScriptSourceViewer = null; if (viewer instanceof TypeScriptSourceViewer) TypeScriptSourceViewer = (TypeScriptSourceViewer) viewer; /* * This is a performance optimization to reduce the computation of the * text presentation triggered by {@link #setVisibleDocument(IDocument)} */ if (TypeScriptSourceViewer != null && isFoldingEnabled() && (store == null || !store.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS))) { // TypeScriptSourceViewer.prepareDelayedProjection(); } // // do not even install projection support until folding is actually // // enabled // if (isFoldingEnabled()) { // installProjectionSupport(TypeScriptSourceViewer); // } // fProjectionModelUpdater = // JavaScriptPlugin.getDefault().getFoldingStructureProviderRegistry() // .getCurrentFoldingProvider(); // if (fProjectionModelUpdater != null) { // fProjectionModelUpdater.install(this, projectionViewer); // } // ensure source viewer decoration support has been created and // configured getSourceViewerDecorationSupport(viewer); return viewer; }
@Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { if (log.isDebugEnabled()) log.debug("Creating Xtext source viewer."); // overwrite superclass implementation to allow folding fAnnotationAccess = createAnnotationAccess(); fOverviewRuler = createOverviewRuler(getSharedColors()); ISourceViewer projectionViewer = sourceViewerFactory.createSourceViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); getSourceViewerDecorationSupport(projectionViewer); return projectionViewer; }
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { fAnnotationAccess = createAnnotationAccess(); fOverviewRuler = createOverviewRuler(getSharedColors()); ISourceViewer viewer = new ProjectionViewer(parent, ruler, fOverviewRuler, true, styles); // ensure decoration support has been created and configured: getSourceViewerDecorationSupport(viewer); return viewer; }
@Override protected ISourceViewer createSourceViewer(Composite parent, final IVerticalRuler ruler, int styles) { fAnnotationAccess = getAnnotationAccess(); fOverviewRuler = createOverviewRuler(getSharedColors()); // Need to make it a projection viewer now that we have folding... CommonProjectionViewer viewer = new CommonProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) { @SuppressWarnings("rawtypes") @Override public Object getAdapter(Class adapter) { if (AbstractThemeableEditor.class == adapter || ITextEditor.class == adapter) { return AbstractThemeableEditor.this; } return super.getAdapter(adapter); } }; // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); fThemeableEditorColorsExtension.createBackgroundPainter(viewer); return viewer; }
@Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { // if (true) return super.createSourceViewer(parent, ruler, styles); // Create with code-folding ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); // ensure decoration support has been created and configured. SourceViewerDecorationSupport decSupport = getSourceViewerDecorationSupport(viewer); // SourceViewer viewer = (SourceViewer) super.createSourceViewer(parent, ruler, styles); // Setup word-wrapping final StyledText widget = viewer.getTextWidget(); // Listen to pref changes prefChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(MarkdownPreferencePage.PREF_WORD_WRAP)) { widget.setWordWrap(MarkdownPreferencePage.wordWrap()); } } }; pStore.addPropertyChangeListener(prefChangeListener); // Switch on word-wrapping if (MarkdownPreferencePage.wordWrap()) { widget.setWordWrap(true); } return viewer; }
@Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
@Override protected ProjectionViewer createPreviewViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles, IPreferenceStore store) { return new ScriptSourceViewer( parent, verticalRuler, overviewRuler, showAnnotationsOverview, styles, store); }
/** * Creates the vertical ruler to be used by this editor. * * @return the vertical ruler */ protected IVerticalRuler createVerticalRuler( ) { CompositeRuler ruler = createCompositeRuler( ); ruler.addDecorator( 0, createLineNumberRulerColumn( ) ); return ruler; }
/** * Creates the source viewer to be used by this editor. * * @param parent * the parent control * @return the source viewer */ protected SourceViewer createSourceViewer( Composite parent ) { IVerticalRuler ruler = createVerticalRuler( ); Composite composite = new Composite( parent, SWT.BORDER | SWT.LEFT_TO_RIGHT ); composite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); composite.setLayout( UIUtil.createGridLayoutWithoutMargin( ) ); int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; SourceViewer viewer = new SourceViewer( composite, ruler, styles ); viewer.configure( sourceViewerConfiguration ); updateStyledTextColors( viewer.getTextWidget( ) ); JSEditorInput editorInput = new JSEditorInput( expression, getEncoding( ) ); JSDocumentProvider documentProvider = new JSDocumentProvider( ); try { documentProvider.connect( editorInput ); } catch ( CoreException e ) { ExceptionHandler.handle( e ); } viewer.setDocument( documentProvider.getDocument( editorInput ), ruler == null ? null : ruler.getModel( ) ); return viewer; }
/** * Creates the vertical ruler to be used by this editor. * * @return the vertical ruler */ private IVerticalRuler createVerticalRuler( ) { IVerticalRuler ruler = createCompositeRuler( ); if ( ruler instanceof CompositeRuler ) { CompositeRuler compositeRuler = (CompositeRuler) ruler; compositeRuler.addDecorator( 0, createLineNumberRulerColumn( ) ); } return ruler; }
public BaseSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles, IVerticalIndentGuidePreferencesProvider verticalIndentPrefs) { super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, styles); verticalLinesPainter = new VerticalIndentGuidesPainter( getIndentGuide(verticalIndentPrefs)); StyledText styledText = this.getTextWidget(); verticalLinesPainter.setStyledText(styledText); styledText.addPaintListener(verticalLinesPainter); styledText.setLeftMargin(Math.max(styledText.getLeftMargin(), 2)); }
@Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { IOverviewRuler overviewRuler = getOverviewRuler(); PySourceViewer viewer = new PySourceViewer(parent, ruler, overviewRuler, isOverviewRulerVisible(), styles, this); //ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
public PySourceViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler, boolean showsAnnotationOverview, int styles, final PyEditProjection projection) { super(parent, ruler, overviewRuler, showsAnnotationOverview, styles, new PyAbstractIndentGuidePreferencesProvider() { @Override public int getTabWidth() { return ((PyEdit) projection).getIndentPrefs().getTabWidth(); } }); this.projection = new WeakReference<PyEdit>((PyEdit) projection); }
@Override protected final ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { LangSourceViewer viewer = doCreateSourceViewer(parent, ruler, styles); assertInstance(viewer, SourceViewer.class); assertInstance(viewer, ISourceViewerExt.class); return viewer; }
protected LangSourceViewer doCreateSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { LangSourceViewer viewer = new LangSourceViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); return viewer; }
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(); }
public TMViewer(Composite parent, IVerticalRuler ruler, int styles) { super(parent, ruler, styles); init(); }
public TMViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles) { super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, styles); init(); }
public EiffelSourceViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler, boolean showAnnotationOverview, int styles, EiffelEditor editor) { super(parent, ruler, overviewRuler, showAnnotationOverview, styles); }
public EiffelSourceViewer(Composite parent, IVerticalRuler ruler, int styles, EiffelEditor editor) { super(parent, ruler, styles); eiffelEditor = editor; }
public EiffelSourceViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler, boolean showAnnotationOverview, int styles, EiffelEditor editor) { super(parent, ruler, overviewRuler, showAnnotationOverview, styles); eiffelEditor = editor; }