Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Overbey2008-06-20 15:07:18 +0000
committerJeffrey Overbey2008-06-20 15:07:18 +0000
commitedd4698b7fdec66f51bc5099f1d511d792d60d93 (patch)
tree9dd76a287929c0857bb397bed7d28915fd5006d8
parent84728ca6b01854d0a86cac136e12621c8f151994 (diff)
downloadorg.eclipse.photran-edd4698b7fdec66f51bc5099f1d511d792d60d93.tar.gz
org.eclipse.photran-edd4698b7fdec66f51bc5099f1d511d792d60d93.tar.xz
org.eclipse.photran-edd4698b7fdec66f51bc5099f1d511d792d60d93.zip
VPG improvements -- fixed NullPointerExceptions, separated dependency calculation from edge/annotation calculation; added Refresh VPG Database action to menuv20080620_BeforeNewModuleLoader
-rw-r--r--org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java81
-rw-r--r--org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPGBuilder.java146
-rw-r--r--org.eclipse.photran.ui.vpg/plugin.xml5
-rw-r--r--org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/actions/OpenDeclaration.java6
-rw-r--r--org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/actions/RefreshVPGDatabase.java41
-rwxr-xr-xorg.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranEditorTasks.java (renamed from org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranEditorVPGTasks.java)105
-rwxr-xr-xorg.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranVPGReconcilingStrategy.java4
-rwxr-xr-xorg.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/contentassist/FortranCompletionProcessor.java6
-rw-r--r--org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/views/DeclarationView.java6
9 files changed, 269 insertions, 131 deletions
diff --git a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java
index 7737433c..2eb74f4d 100644
--- a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java
+++ b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java
@@ -1,7 +1,5 @@
package org.eclipse.photran.core.vpg;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;
@@ -15,22 +13,14 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.photran.core.FortranAST;
import org.eclipse.photran.core.IFortranAST;
-import org.eclipse.photran.internal.core.analysis.binding.Binder;
import org.eclipse.photran.internal.core.analysis.binding.Definition;
import org.eclipse.photran.internal.core.analysis.types.Type;
-import org.eclipse.photran.internal.core.lexer.IAccumulatingLexer;
-import org.eclipse.photran.internal.core.lexer.IncludeLoaderCallback;
-import org.eclipse.photran.internal.core.lexer.LexerFactory;
-import org.eclipse.photran.internal.core.lexer.SourceForm;
import org.eclipse.photran.internal.core.lexer.Token;
-import org.eclipse.photran.internal.core.parser.ASTExecutableProgramNode;
import org.eclipse.photran.internal.core.parser.Parser;
import org.eclipse.photran.internal.core.preferences.FortranPreferences;
import org.eclipse.photran.internal.core.properties.SearchPathProperties;
-import bz.over.vpg.VPGDependency;
import bz.over.vpg.eclipse.EclipseVPG;
/**
@@ -38,7 +28,7 @@ import bz.over.vpg.eclipse.EclipseVPG;
*
* @author Jeff Overbey
*/
-public class PhotranVPG extends EclipseVPG<IFortranAST, Token, PhotranTokenRef, PhotranVPGDB>
+public abstract class PhotranVPG extends EclipseVPG<IFortranAST, Token, PhotranTokenRef, PhotranVPGDB>
{
// Copied from FortranCorePlugin to avoid dependencies on the Photran Core plug-in
// (since our parser declares classes with the same name)
@@ -154,6 +144,12 @@ public class PhotranVPG extends EclipseVPG<IFortranAST, Token, PhotranTokenRef,
return System.getenv("TESTING") != null;
}
+ @Override
+ protected boolean shouldListFileInIndexerProgressMessages(String filename)
+ {
+ return !filename.startsWith("module:");
+ }
+
@Override
protected boolean shouldProcessFile(IFile file)
{
@@ -249,69 +245,6 @@ public class PhotranVPG extends EclipseVPG<IFortranAST, Token, PhotranTokenRef,
return forToken.getTokenRef();
}
- @Override
- protected IFortranAST parse(final String filename)
- {
- if (filename.startsWith("module:")) return null;
-
- IFile file = getIFileForFilename(filename);
-
- IContentType contentType2 = Platform.getContentTypeManager().findContentTypeFor(filename);
- String contentType = contentType2 == null ? null : contentType2.getId();
- // In CDT, String contentType = CoreModel.getRegistedContentTypeId(file.getProject(), file.getName());
-
- SourceForm sourceForm;
- if (contentType != null && contentType.equals(FIXED_FORM_CONTENT_TYPE))
- sourceForm = SourceForm.FIXED_FORM;
- else
- {
- sourceForm = SourceForm.preprocessedFreeForm(new IncludeLoaderCallback(file.getProject())
- {
- @Override
- public InputStream getIncludedFileAsStream(String fileToInclude) throws FileNotFoundException
- {
- // When we encounter an INCLUDE directive, set up a file dependency in the VPG
-
- db.ensure(new VPGDependency<IFortranAST, Token, PhotranTokenRef>(PhotranVPG.this,
- filename,
- getFilenameForIFile(getIncludedFile(fileToInclude))));
-
- return super.getIncludedFileAsStream(fileToInclude);
- }
- });
- }
-
- try
- {
- IAccumulatingLexer lexer = LexerFactory.createLexer(file, sourceForm, true);
- long start = System.currentTimeMillis();
- ASTExecutableProgramNode ast = parser.parse(lexer);
- debug(" - Elapsed time in Parser#parse: " + (System.currentTimeMillis()-start) + " ms", filename);
- return new FortranAST(file, ast, lexer.getTokenList());
- }
- catch (Exception e)
- {
- logError(e);
- return null;
- }
- }
-
- @Override
- protected void populateVPG(String filename, IFortranAST ast)
- {
- if (!filename.startsWith("module:"))
- {
- db.deleteAllIncomingDependenciesFor(filename);
- db.deleteAllOutgoingDependenciesFor(filename);
- }
-
- if (ast == null) return;
-
- long start = System.currentTimeMillis();
- Binder.bind(ast, getIFileForFilename(filename));
- debug(" - Elapsed time in Binder#bind: " + (System.currentTimeMillis()-start) + " ms", filename);
- }
-
public IFortranAST acquireTransientAST(IFile file)
{
return acquireTransientAST(getFilenameForIFile(file));
diff --git a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPGBuilder.java b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPGBuilder.java
index f724536c..a693a7e6 100644
--- a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPGBuilder.java
+++ b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPGBuilder.java
@@ -10,12 +10,25 @@
*******************************************************************************/
package org.eclipse.photran.core.vpg;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.photran.core.FortranAST;
import org.eclipse.photran.core.IFortranAST;
+import org.eclipse.photran.internal.core.analysis.binding.Binder;
import org.eclipse.photran.internal.core.analysis.binding.Definition;
import org.eclipse.photran.internal.core.analysis.binding.ImplicitSpec;
import org.eclipse.photran.internal.core.analysis.binding.ScopingNode;
+import org.eclipse.photran.internal.core.lexer.IAccumulatingLexer;
+import org.eclipse.photran.internal.core.lexer.IncludeLoaderCallback;
+import org.eclipse.photran.internal.core.lexer.LexerFactory;
+import org.eclipse.photran.internal.core.lexer.SourceForm;
+import org.eclipse.photran.internal.core.lexer.Terminal;
import org.eclipse.photran.internal.core.lexer.Token;
+import org.eclipse.photran.internal.core.parser.ASTExecutableProgramNode;
import bz.over.vpg.VPGDependency;
import bz.over.vpg.VPGEdge;
@@ -75,4 +88,137 @@ public class PhotranVPGBuilder extends PhotranVPG
{
db.setAnnotation(scope.getRepresentativeToken(), SCOPE_DEFAULT_VISIBILITY_IS_PRIVATE_ANNOTATION_TYPE, Boolean.TRUE);
}
+
+ @Override
+ protected void calculateDependencies(final String filename)
+ {
+ if (filename.startsWith("module:")) return;
+
+ SourceForm sourceForm = determineSourceForm(filename);
+ try
+ {
+ IAccumulatingLexer lexer = LexerFactory.createLexer(getIFileForFilename(filename), sourceForm, false);
+ long start = System.currentTimeMillis();
+ calculateDependencies(filename, lexer);
+ debug(" - Elapsed time in calculateDependencies: " + (System.currentTimeMillis()-start) + " ms", filename);
+ }
+ catch (Exception e)
+ {
+ logError(e);
+ }
+ }
+
+ private SourceForm determineSourceForm(final String filename)
+ {
+ IFile file = getIFileForFilename(filename);
+ IContentType contentType2 = Platform.getContentTypeManager().findContentTypeFor(filename);
+ String contentType = contentType2 == null ? null : contentType2.getId();
+ // In CDT, String contentType = CoreModel.getRegistedContentTypeId(file.getProject(), file.getName());
+
+ SourceForm sourceForm;
+ if (contentType != null && contentType.equals(FIXED_FORM_CONTENT_TYPE))
+ sourceForm = SourceForm.FIXED_FORM;
+ else
+ {
+ sourceForm = SourceForm.preprocessedFreeForm(new IncludeLoaderCallback(file.getProject())
+ {
+ @Override
+ public InputStream getIncludedFileAsStream(String fileToInclude) throws FileNotFoundException
+ {
+ // When we encounter an INCLUDE directive, set up a file dependency in the VPG
+
+ db.ensure(new VPGDependency<IFortranAST, Token, PhotranTokenRef>(PhotranVPGBuilder.this,
+ filename,
+ getFilenameForIFile(getIncludedFile(fileToInclude))));
+
+ return super.getIncludedFileAsStream(fileToInclude);
+ }
+ });
+ }
+ return sourceForm;
+ }
+
+ private void calculateDependencies(String filename, IAccumulatingLexer lexer)
+ {
+ if (!filename.startsWith("module:"))
+ {
+ db.deleteAllIncomingDependenciesFor(filename);
+ db.deleteAllOutgoingDependenciesFor(filename);
+ }
+
+ if (lexer == null) return;
+
+ try
+ {
+ IFile file = getIFileForFilename(filename);
+ final int WAITING_FOR_TOKEN = 0, LAST_TOKEN_WAS_USE = 1, LAST_TOKEN_WAS_MODULE = 2;
+
+ int state = WAITING_FOR_TOKEN;
+ for (Token tok = lexer.yylex(); tok != null && tok.getTerminal() != Terminal.END_OF_INPUT; tok = lexer.yylex())
+ {
+ if (state == WAITING_FOR_TOKEN && tok.getTerminal() == Terminal.T_USE)
+ {
+ state = LAST_TOKEN_WAS_USE;
+ }
+ else if (state == WAITING_FOR_TOKEN && tok.getTerminal() == Terminal.T_MODULE)
+ {
+ state = LAST_TOKEN_WAS_MODULE;
+ }
+ else if (state == LAST_TOKEN_WAS_USE)
+ {
+ if (tok.getTerminal() == Terminal.T_IDENT)
+ markFileAsImportingModule(file, tok.getText());
+ state = WAITING_FOR_TOKEN;
+ }
+ else if (state == LAST_TOKEN_WAS_MODULE)
+ {
+ if (tok.getTerminal() == Terminal.T_IDENT)
+ markFileAsExportingModule(file, tok.getText());
+ state = WAITING_FOR_TOKEN;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ logError(e);
+ }
+ }
+
+ @Override
+ protected IFortranAST parse(final String filename)
+ {
+ if (filename.startsWith("module:")) return null;
+
+ IFile file = getIFileForFilename(filename);
+ SourceForm sourceForm = determineSourceForm(filename);
+ try
+ {
+ IAccumulatingLexer lexer = LexerFactory.createLexer(file, sourceForm, true);
+ long start = System.currentTimeMillis();
+ ASTExecutableProgramNode ast = parser.parse(lexer);
+ debug(" - Elapsed time in Parser#parse: " + (System.currentTimeMillis()-start) + " ms", filename);
+ return new FortranAST(file, ast, lexer.getTokenList());
+ }
+ catch (Exception e)
+ {
+ logError(e);
+ return null;
+ }
+ }
+
+ @Override
+ protected void populateVPG(String filename, IFortranAST ast)
+ {
+ if (!filename.startsWith("module:"))
+ {
+ db.deleteAllIncomingDependenciesFor(filename);
+ db.deleteAllOutgoingDependenciesFor(filename);
+ }
+
+ if (ast == null) return;
+
+ long start = System.currentTimeMillis();
+ Binder.bind(ast, getIFileForFilename(filename));
+ debug(" - Elapsed time in Binder#bind: " + (System.currentTimeMillis()-start) + " ms", filename);
+ }
}
diff --git a/org.eclipse.photran.ui.vpg/plugin.xml b/org.eclipse.photran.ui.vpg/plugin.xml
index fd56e881..29a2f8f4 100644
--- a/org.eclipse.photran.ui.vpg/plugin.xml
+++ b/org.eclipse.photran.ui.vpg/plugin.xml
@@ -308,6 +308,11 @@
label="Clear VPG Database"
menubarPath="org.eclipse.jdt.ui.refactoring.menu/org.eclipse.photran.ui.AnalysisDebuggingMenu/vpgdb"/>
<action
+ class="org.eclipse.photran.internal.ui.actions.RefreshVPGDatabase"
+ id="org.eclipse.photran.ui.RefreshVPGDatabaseAction"
+ label="Refresh VPG Database"
+ menubarPath="org.eclipse.jdt.ui.refactoring.menu/org.eclipse.photran.ui.AnalysisDebuggingMenu/vpgdb"/>
+ <action
class="org.eclipse.photran.internal.ui.actions.DisplayVPGDatabase"
id="org.eclipse.photran.ui.DisplayVPGDatabaseAction"
label="Display VPG Database"
diff --git a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/actions/OpenDeclaration.java b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/actions/OpenDeclaration.java
index 8a9789cc..061cb537 100644
--- a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/actions/OpenDeclaration.java
+++ b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/actions/OpenDeclaration.java
@@ -21,7 +21,7 @@ import org.eclipse.photran.internal.core.lexer.TokenList;
import org.eclipse.photran.internal.core.parser.ASTExecutableProgramNode;
import org.eclipse.photran.internal.ui.editor.AbstractFortranEditor;
import org.eclipse.photran.internal.ui.editor_vpg.DefinitionMap;
-import org.eclipse.photran.internal.ui.editor_vpg.FortranEditorVPGTasks;
+import org.eclipse.photran.internal.ui.editor_vpg.FortranEditorTasks;
import org.eclipse.photran.internal.ui.editor_vpg.IFortranEditorASTTask;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -36,6 +36,8 @@ import org.eclipse.ui.ide.IDE;
* If multiple declarations are found, a dialog is opened so that the user can see the various declarations and
* decide which to open.
*
+ * TODO: Open Declaration does not work on module names in USE statements since these are not in the DefinitionMap
+ *
* @author Jeff Overbey
*/
public class OpenDeclaration extends FortranEditorASTActionDelegate
@@ -47,7 +49,7 @@ public class OpenDeclaration extends FortranEditorASTActionDelegate
Shell shell = editor.getShell();
IWorkbenchPage page = editor.getEditorSite().getPage();
- FortranEditorVPGTasks tasks = FortranEditorVPGTasks.instance(editor);
+ FortranEditorTasks tasks = FortranEditorTasks.instance(editor);
tasks.addASTTask(new OpenDeclarationASTTask(editor, selection, shell, page));
tasks.getRunner().runTasks(false);
}
diff --git a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/actions/RefreshVPGDatabase.java b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/actions/RefreshVPGDatabase.java
new file mode 100644
index 00000000..b2268dff
--- /dev/null
+++ b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/actions/RefreshVPGDatabase.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 University of Illinois at Urbana-Champaign and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * UIUC - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.photran.internal.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.photran.core.vpg.PhotranVPG;
+
+/**
+ * Implements the Clear VPG Database action in the Refactor/(Debugging) menu
+ *
+ * @author Jeff Overbey
+ */
+public class RefreshVPGDatabase extends FortranEditorActionDelegate
+{
+ public void run(IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException
+ {
+ try
+ {
+ progressMonitor.beginTask("Waiting for background work to complete (Photran indexer)", IProgressMonitor.UNKNOWN);
+ PhotranVPG.getInstance().queueJobToEnsureVPGIsUpToDate();
+ }
+ catch (Exception e)
+ {
+ throw new InvocationTargetException(e);
+ }
+ finally
+ {
+ progressMonitor.done();
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranEditorVPGTasks.java b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranEditorTasks.java
index 40f67e6b..f63d2fcb 100755
--- a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranEditorVPGTasks.java
+++ b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranEditorTasks.java
@@ -25,21 +25,21 @@ import org.eclipse.photran.internal.ui.editor.AbstractFortranEditor;
import bz.over.vpg.eclipse.VPGJob;
-public class FortranEditorVPGTasks
+public class FortranEditorTasks
{
/**
- * @return the instance of FortranEditorVPGTasks associated with the given
+ * @return the instance of FortranEditorTasks associated with the given
* editor, creating the instance on-demand if necessary
*/
- public static FortranEditorVPGTasks instance(AbstractFortranEditor editor)
+ public static FortranEditorTasks instance(AbstractFortranEditor editor)
{
if (editor.reconcilerTasks == null)
- editor.reconcilerTasks = new FortranEditorVPGTasks(editor);
+ editor.reconcilerTasks = new FortranEditorTasks(editor);
- return (FortranEditorVPGTasks)editor.reconcilerTasks;
+ return (FortranEditorTasks)editor.reconcilerTasks;
}
- private FortranEditorVPGTasks(AbstractFortranEditor editor)
+ private FortranEditorTasks(AbstractFortranEditor editor)
{
this.editor = editor;
editor.reconcilerTasks = this;
@@ -121,7 +121,7 @@ public class FortranEditorVPGTasks
{
if (dispatchASTTasksJob != null) return; // Already running an update
- dispatchASTTasksJob = new Job("Updating editor")
+ dispatchASTTasksJob = new Job("Updating Fortran editor with new parse information")
{
@Override
protected IStatus run(IProgressMonitor monitor)
@@ -129,24 +129,28 @@ public class FortranEditorVPGTasks
ASTExecutableProgramNode astRootNode = null;
try
{
- String editorContents = editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
- IAccumulatingLexer lexer = LexerFactory.createLexer(new ByteArrayInputStream(editorContents.getBytes()),
- null,
- SourceForm.preprocessedFreeForm(new IncludeLoaderCallback(editor.getIFile().getProject())),
- false);
- astRootNode = parser.parse(lexer);
- if (astRootNode == null) return Status.OK_STATUS;
-
- HashSet<IFortranEditorASTTask> tasksToRemove = new HashSet<IFortranEditorASTTask>();
- synchronized (FortranEditorVPGTasks.instance(editor))
+ if (editor.getDocumentProvider() != null)
{
- for (IFortranEditorASTTask task : FortranEditorVPGTasks.instance(editor).astTasks)
- if (!task.handle(astRootNode, lexer.getTokenList(), defMap))
- tasksToRemove.add(task);
+ String editorContents = editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
+
+ IAccumulatingLexer lexer = LexerFactory.createLexer(new ByteArrayInputStream(editorContents.getBytes()),
+ null,
+ SourceForm.preprocessedFreeForm(new IncludeLoaderCallback(editor.getIFile().getProject())),
+ false);
+ astRootNode = parser.parse(lexer);
+ if (astRootNode == null) return Status.OK_STATUS;
+
+ HashSet<IFortranEditorASTTask> tasksToRemove = new HashSet<IFortranEditorASTTask>();
+ synchronized (FortranEditorTasks.instance(editor))
+ {
+ for (IFortranEditorASTTask task : FortranEditorTasks.instance(editor).astTasks)
+ if (!task.handle(astRootNode, lexer.getTokenList(), defMap))
+ tasksToRemove.add(task);
+ }
+ FortranEditorTasks.instance(editor).astTasks.removeAll(tasksToRemove);
}
- FortranEditorVPGTasks.instance(editor).astTasks.removeAll(tasksToRemove);
}
- catch (Exception e)
+ catch (Throwable e)
{
;
}
@@ -165,15 +169,22 @@ public class FortranEditorVPGTasks
if (vpgAST == null || vpg.db.isOutOfDate(PhotranVPG.getFilenameForIFile(editor.getIFile())))
{
+ vpg.queueJobToEnsureVPGIsUpToDate();
+
vpgAST = null;
- updateVPGJob = new VPGJob<IFortranAST, Token>("Updating editor model")
+ updateVPGJob = new VPGJob<IFortranAST, Token>("Updating Fortran editor with new analysis information")
{
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException
{
vpgAST = vpg.acquireTransientAST(PhotranVPG.getFilenameForIFile(editor.getIFile()));
updateVPGJob = null;
- scheduleVPGTaskDispatchJob();
+ //scheduleVPGTaskDispatchJob();
+
+ defMap = createDefMap();
+ for (IFortranEditorVPGTask task : FortranEditorTasks.instance(editor).vpgTasks)
+ task.handle(editor.getIFile(), vpgAST, defMap);
+
return Status.OK_STATUS;
}
};
@@ -182,25 +193,25 @@ public class FortranEditorVPGTasks
}
}
- private void scheduleVPGTaskDispatchJob()
- {
- dispatchVPGTasksJob = new Job("Updating editor")
- {
- @Override
- protected IStatus run(IProgressMonitor monitor)
- {
- if (vpgAST != null) // Parse might have failed
- {
- synchronized (FortranEditorVPGTasks.instance(editor))
- {
- defMap = createDefMap();
- for (IFortranEditorVPGTask task : FortranEditorVPGTasks.instance(editor).vpgTasks)
- task.handle(editor.getIFile(), vpgAST, defMap);
- }
- }
- dispatchVPGTasksJob = null;
- return Status.OK_STATUS;
- }
+// private void scheduleVPGTaskDispatchJob()
+// {
+// dispatchVPGTasksJob = new Job("Updating Fortran editor (3/3)")
+// {
+// @Override
+// protected IStatus run(IProgressMonitor monitor)
+// {
+// if (vpgAST != null) // Parse might have failed
+// {
+// synchronized (FortranEditorTasks.instance(editor))
+// {
+// defMap = createDefMap();
+// for (IFortranEditorVPGTask task : FortranEditorTasks.instance(editor).vpgTasks)
+// task.handle(editor.getIFile(), vpgAST, defMap);
+// }
+// }
+// dispatchVPGTasksJob = null;
+// return Status.OK_STATUS;
+// }
private DefinitionMap<Definition> createDefMap()
{
@@ -212,9 +223,9 @@ public class FortranEditorVPGTasks
}
};
}
- };
- dispatchVPGTasksJob.setPriority(Job.DECORATE);
- dispatchVPGTasksJob.schedule();
- }
+// };
+// dispatchVPGTasksJob.setPriority(Job.DECORATE);
+// dispatchVPGTasksJob.schedule();
+// }
}
}
diff --git a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranVPGReconcilingStrategy.java b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranVPGReconcilingStrategy.java
index d3e6c95d..7742e95d 100755
--- a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranVPGReconcilingStrategy.java
+++ b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/FortranVPGReconcilingStrategy.java
@@ -27,12 +27,12 @@ public class FortranVPGReconcilingStrategy extends CCompositeReconcilingStrategy
@Override public void initialReconcile()
{
super.initialReconcile();
- FortranEditorVPGTasks.instance(editor).getRunner().runTasks();
+ FortranEditorTasks.instance(editor).getRunner().runTasks();
}
@Override public void reconcile(IRegion region)
{
super.reconcile(region);
- FortranEditorVPGTasks.instance(editor).getRunner().runTasks();
+ FortranEditorTasks.instance(editor).getRunner().runTasks();
}
}
diff --git a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/contentassist/FortranCompletionProcessor.java b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/contentassist/FortranCompletionProcessor.java
index 2c3aff1f..4abf06fa 100755
--- a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/contentassist/FortranCompletionProcessor.java
+++ b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/editor_vpg/contentassist/FortranCompletionProcessor.java
@@ -19,7 +19,7 @@ import org.eclipse.photran.internal.core.analysis.binding.Definition;
import org.eclipse.photran.internal.core.analysis.binding.Intrinsics;
import org.eclipse.photran.internal.core.properties.SearchPathProperties;
import org.eclipse.photran.internal.ui.editor.AbstractFortranEditor;
-import org.eclipse.photran.internal.ui.editor_vpg.FortranEditorVPGTasks;
+import org.eclipse.photran.internal.ui.editor_vpg.FortranEditorTasks;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
@@ -40,8 +40,8 @@ public class FortranCompletionProcessor implements IContentAssistProcessor
{
final Color LIGHT_YELLOW = new Color(null, new RGB(255, 255, 191));
- FortranEditorVPGTasks.instance(editor).addASTTask(new FortranCompletionProcessorASTTask(this));
- FortranEditorVPGTasks.instance(editor).addVPGTask(new FortranCompletionProcessorVPGTask(this));
+ FortranEditorTasks.instance(editor).addASTTask(new FortranCompletionProcessorASTTask(this));
+ FortranEditorTasks.instance(editor).addVPGTask(new FortranCompletionProcessorVPGTask(this));
ContentAssistant assistant = new ContentAssistant();
for (String partitionType : AbstractFortranEditor.PARTITION_TYPES)
diff --git a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/views/DeclarationView.java b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/views/DeclarationView.java
index d853d9b8..491550da 100644
--- a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/views/DeclarationView.java
+++ b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/views/DeclarationView.java
@@ -21,7 +21,7 @@ import org.eclipse.photran.internal.core.properties.SearchPathProperties;
import org.eclipse.photran.internal.ui.editor.AbstractFortranEditor;
import org.eclipse.photran.internal.ui.editor.FortranKeywordRuleBasedScanner;
import org.eclipse.photran.internal.ui.editor_vpg.DefinitionMap;
-import org.eclipse.photran.internal.ui.editor_vpg.FortranEditorVPGTasks;
+import org.eclipse.photran.internal.ui.editor_vpg.FortranEditorTasks;
import org.eclipse.photran.internal.ui.editor_vpg.IFortranEditorASTTask;
import org.eclipse.photran.internal.ui.editor_vpg.IFortranEditorVPGTask;
import org.eclipse.swt.SWT;
@@ -172,7 +172,7 @@ public class DeclarationView extends ViewPart
SearchPathProperties.ENABLE_CONTENT_ASSIST_PROPERTY_NAME).equals("true"))
{
addCaretMovementListenerTo(editor);
- FortranEditorVPGTasks tasks = FortranEditorVPGTasks.instance(editor);
+ FortranEditorTasks tasks = FortranEditorTasks.instance(editor);
tasks.addASTTask(this);
tasks.addVPGTask(this);
return editor;
@@ -198,7 +198,7 @@ public class DeclarationView extends ViewPart
if (editor != null)
{
removeCaretMovementListenerFrom(editor);
- FortranEditorVPGTasks tasks = FortranEditorVPGTasks.instance(editor);
+ FortranEditorTasks tasks = FortranEditorTasks.instance(editor);
tasks.removeASTTask(this);
tasks.removeVPGTask(this);
}

Back to the top