Skip to content

Commit

Permalink
Remove unecessary (?) configuration that was causing the TextViewer t…
Browse files Browse the repository at this point in the history
…o use the DefaultTextDoubleClickStrategy which was raising an exception
  • Loading branch information
danlucraft committed May 22, 2010
1 parent f22b86d commit 61c9cbf
Showing 1 changed file with 7 additions and 34 deletions.
41 changes: 7 additions & 34 deletions src/com/redcareditor/mate/MateText.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,22 @@ private void createSourceViewer(Composite parent) {

viewer = new SourceViewer(parent, compositeRuler, SWT.FULL_SELECTION | SWT.HORIZONTAL | SWT.VERTICAL);
viewer.setDocument(document, fAnnotationModel);
viewer.setTextDoubleClickStrategy(null, IDocument.DEFAULT_CONTENT_TYPE);


// hover manager that shows text when we hover
AnnotationHover ah = new AnnotationHover();
AnnotationConfiguration ac = new AnnotationConfiguration();
AnnotationBarHoverManager fAnnotationHoverManager = new AnnotationBarHoverManager(compositeRuler, viewer, ah, ac);
fAnnotationHoverManager.install(annotationRuler.getControl());

// to paint the annotations
annotationPainter = new AnnotationPainter(viewer, fAnnotationAccess);

// this will draw the squigglies under the text
viewer.addPainter(annotationPainter);

viewer.configure(new CodeViewerConfiguration(cc));

createAnnotationMouseListener();
}


private void createAnnotationMouseListener() {
annotationMouseListener = new MouseListener() {
public void mouseUp(MouseEvent event) {
Expand Down Expand Up @@ -392,15 +389,18 @@ public boolean setThemeByName(String name) {
public void setFont(String name, int size) {
Font font = new Font(Display.getCurrent(), name, size, 0);
viewer.getTextWidget().setFont(font);
lineNumbers.setFont(font);
if (!singleLine)
lineNumbers.setFont(font);
}

@SuppressWarnings("unchecked")
public void setGutterBackground(Color color) {
if (singleLine) return;
lineNumbers.setBackground(color);
}

public void setGutterForeground(Color color) {
if (singleLine) return;
lineNumbers.setForeground(color);
}

Expand Down Expand Up @@ -485,24 +485,6 @@ public Object[] getSupertypes(Object annotationType) {
}
}

// source viewer configuration
class CodeViewerConfiguration extends SourceViewerConfiguration {
private ColorCache manager;

public CodeViewerConfiguration(ColorCache manager) {
this.manager = manager;
}

public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
PresentationReconciler reconciler = new PresentationReconciler();
return reconciler;
}

public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new AnnotationHover();
}
}

// annotation hover manager
class AnnotationHover implements IAnnotationHover, ITextHover {
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
Expand Down Expand Up @@ -535,15 +517,6 @@ public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
}
}

//class MateAnnotationRulerColumn extends AnnotationRulerColumn {
// protected void mouseDoubleClicked(int rulerLine) {
// }
//
// protected void mouseClicked(int rulerLine) {
// }

//}

class MateAnnotation extends Annotation {
private IMarker marker;
private String text;
Expand Down

0 comments on commit 61c9cbf

Please sign in to comment.