Permalink
Browse files

Cleanup

  • Loading branch information...
1 parent 81a9f7b commit bfb0695133779895a8d33db54a755a1f2e2e8c48 @jakobc jakobc committed Mar 1, 2013
@@ -62,6 +62,7 @@
private IndentAction indentAction;
private ToggleCommentAction toggleCommentAction;
private InformationPresenter fInformationPresenter;
+ private IErlScanner erlScanner;
public abstract void reconcileNow();
@@ -73,7 +74,14 @@
public abstract IDocument getDocument();
- public abstract IErlScanner getScanner();
+ public IErlScanner getScanner() {
+ if (erlScanner == null) {
+ erlScanner = getNewScanner();
+ }
+ return erlScanner;
+ }
+
+ protected abstract IErlScanner getNewScanner();
@Override
protected void configureSourceViewerDecorationSupport(
@@ -436,4 +444,5 @@ public void createPartControl(final Composite parent) {
.setDocumentPartitioning(getSourceViewerConfiguration()
.getConfiguredDocumentPartitioning(getSourceViewer()));
}
+
}
@@ -149,7 +149,6 @@
new ActivationListener());
private String stateDirCached;
- private IErlScanner scanner;
/**
* Simple constructor
@@ -607,8 +606,8 @@ public IErlModule getModule() {
try {
fModule = ErlModelUtils.getModule(getEditorInput());
fModule.createScanner();
- scanner = fModule.getScanner();
- scanner.dispose();
+ final IErlScanner erlScanner = fModule.getScanner();
+ erlScanner.dispose();
} catch (final CoreException e) {
}
}
@@ -1288,8 +1287,7 @@ public void resetAndCacheScannerAndParser() {
resetReconciler();
try {
module.createScanner();
- scanner = module.getScanner();
- scanner.dispose();
+ module.getScanner().dispose();
module.resetAndCacheScannerAndParser(getDocument().get());
} catch (final ErlModelException e) {
ErlLogger.error(e);
@@ -1572,8 +1570,8 @@ String getStateDir() {
}
@Override
- public IErlScanner getScanner() {
- return scanner;
+ protected IErlScanner getNewScanner() {
+ return getModule().getScanner();
}
/**
Oops, something went wrong.

0 comments on commit bfb0695

Please sign in to comment.