Cleaned compiler warnings, failing tests
Bug 439625 - NPE in CDTBasedTextEditor#dispose
diff --git a/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/ui/editor/CDTBasedTextEditor.java b/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/ui/editor/CDTBasedTextEditor.java
index 01ce4f5..fd4a440 100644
--- a/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/ui/editor/CDTBasedTextEditor.java
+++ b/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/ui/editor/CDTBasedTextEditor.java
@@ -126,13 +126,17 @@
{
super.editorContextMenuAboutToShow(menu);
- textSearchGroup.fillContextMenu(menu);
+ if (textSearchGroup != null) {
+ textSearchGroup.fillContextMenu(menu);
+ }
}
@Override
public void dispose()
{
- textSearchGroup.dispose();
+ if (textSearchGroup != null) {
+ textSearchGroup.dispose();
+ }
super.dispose();
}
diff --git a/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77
new file mode 100644
index 0000000..d36d3f4
--- /dev/null
+++ b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77
@@ -0,0 +1,4 @@
+ program test
+ include "basic-include.f"
+
+ end program
diff --git a/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77.result b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77.result
new file mode 100644
index 0000000..d36d3f4
--- /dev/null
+++ b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77.result
@@ -0,0 +1,4 @@
+ program test
+ include "basic-include.f"
+
+ end program
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include.f77
diff --git a/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77
new file mode 100644
index 0000000..51f0c4d
--- /dev/null
+++ b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77
@@ -0,0 +1,4 @@
+ program test!<<<<<START
+
+
+ end program!<<<<<END
diff --git a/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77.result b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77.result
new file mode 100644
index 0000000..51f0c4d
--- /dev/null
+++ b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77.result
@@ -0,0 +1,4 @@
+ program test!<<<<<START
+
+
+ end program!<<<<<END
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-file1.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-file1.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-file1.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-file1.f77
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-file2.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-file2.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-file2.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-file2.f77
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-main.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-main.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-main.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-main.f77
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-main.f77.result b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-main.f77.result
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-main.f77.result
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test1-two-includes-main.f77.result
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-five.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-five.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-five.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-five.f77
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-four.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-four.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-four.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-four.f77
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-one.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-one.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-one.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-one.f77
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-three.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-three.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-three.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-three.f77
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-two.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-two.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-two.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-file-to-include-two.f77
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-main-file.f77 b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-main-file.f77
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-main-file.f77
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-main-file.f77
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-main-file.f77.result b/org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-main-file.f77.result
similarity index 100%
rename from org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-main-file.f77.result
rename to org.eclipse.photran.core.vpg.tests.failing/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/test2-lot-includes-main-file.f77.result
diff --git a/org.eclipse.photran.core.vpg.tests/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/FortranIncludeFixedFormTestCase.java b/org.eclipse.photran.core.vpg.tests.failing/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/failing/FortranIncludeFixedFormTestCase.java
similarity index 96%
rename from org.eclipse.photran.core.vpg.tests/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/FortranIncludeFixedFormTestCase.java
rename to org.eclipse.photran.core.vpg.tests.failing/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/failing/FortranIncludeFixedFormTestCase.java
index 9be4d5f..0b04696 100644
--- a/org.eclipse.photran.core.vpg.tests/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/FortranIncludeFixedFormTestCase.java
+++ b/org.eclipse.photran.core.vpg.tests.failing/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/failing/FortranIncludeFixedFormTestCase.java
@@ -8,7 +8,7 @@
* Contributors:
* UIUC - Initial API and implementation
*******************************************************************************/
-package org.eclipse.photran.internal.tests.lexer.preprocessor.fortran_include;
+package org.eclipse.photran.internal.tests.lexer.preprocessor.fortran_include.failing;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -20,7 +20,7 @@
import org.eclipse.photran.core.IFortranAST;
import org.eclipse.photran.internal.core.refactoring.infrastructure.SourcePrinter;
import org.eclipse.photran.internal.core.vpg.PhotranVPG;
-import org.eclipse.photran.internal.tests.Activator;
+import org.eclipse.photran.internal.tests.failing.Activator;
import org.eclipse.photran.internal.tests.PhotranWorkspaceTestCase;
/**
diff --git a/org.eclipse.photran.core.vpg.tests/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/FortranIncludeFixedFormTestSuite.java b/org.eclipse.photran.core.vpg.tests.failing/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/failing/FortranIncludeFixedFormTestSuite.java
similarity index 97%
rename from org.eclipse.photran.core.vpg.tests/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/FortranIncludeFixedFormTestSuite.java
rename to org.eclipse.photran.core.vpg.tests.failing/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/failing/FortranIncludeFixedFormTestSuite.java
index 50fcc91..802bab6 100644
--- a/org.eclipse.photran.core.vpg.tests/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/FortranIncludeFixedFormTestSuite.java
+++ b/org.eclipse.photran.core.vpg.tests.failing/src/org/eclipse/photran/internal/tests/lexer/preprocessor/fortran_include/failing/FortranIncludeFixedFormTestSuite.java
@@ -8,7 +8,7 @@
* Contributors:
* UIUC - Initial API and implementation
*******************************************************************************/
-package org.eclipse.photran.internal.tests.lexer.preprocessor.fortran_include;
+package org.eclipse.photran.internal.tests.lexer.preprocessor.fortran_include.failing;
import junit.framework.Test;
import junit.framework.TestSuite;
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77 b/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77
deleted file mode 100644
index ee3e1e5..0000000
--- a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77
+++ /dev/null
@@ -1,4 +0,0 @@
- program test
- include "basic-include.f"
-
- end program
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77.result b/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77.result
deleted file mode 100644
index ee3e1e5..0000000
--- a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/basic-include-main.f77.result
+++ /dev/null
@@ -1,4 +0,0 @@
- program test
- include "basic-include.f"
-
- end program
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77 b/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77
deleted file mode 100644
index 620d163..0000000
--- a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77
+++ /dev/null
@@ -1,4 +0,0 @@
- program test!<<<<<START
-
-
- end program!<<<<<END
diff --git a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77.result b/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77.result
deleted file mode 100644
index 620d163..0000000
--- a/org.eclipse.photran.core.vpg.tests/fixed-form-test-code/fixed-form-lexer/fortran-include-stmt/no-include.f77.result
+++ /dev/null
@@ -1,4 +0,0 @@
- program test!<<<<<START
-
-
- end program!<<<<<END
diff --git a/org.eclipse.photran.core.vpg/lexer/org/eclipse/photran/internal/core/lexer/preprocessor/fortran_include/PreprocessingFixedFormLexerPhase1.java b/org.eclipse.photran.core.vpg/lexer/org/eclipse/photran/internal/core/lexer/preprocessor/fortran_include/PreprocessingFixedFormLexerPhase1.java
index 252119b..18df808 100644
--- a/org.eclipse.photran.core.vpg/lexer/org/eclipse/photran/internal/core/lexer/preprocessor/fortran_include/PreprocessingFixedFormLexerPhase1.java
+++ b/org.eclipse.photran.core.vpg/lexer/org/eclipse/photran/internal/core/lexer/preprocessor/fortran_include/PreprocessingFixedFormLexerPhase1.java
@@ -10,9 +10,7 @@
*******************************************************************************/
package org.eclipse.photran.internal.core.lexer.preprocessor.fortran_include;
-
import java.io.IOException;
-import java.io.InputStream;
import java.io.Reader;
import org.eclipse.core.resources.IFile;
diff --git a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/analysis/binding/SubprogramTypeCollector.java b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/analysis/binding/SubprogramTypeCollector.java
index 2029724..1d4476e 100644
--- a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/analysis/binding/SubprogramTypeCollector.java
+++ b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/analysis/binding/SubprogramTypeCollector.java
@@ -74,16 +74,23 @@
int paramCount = 0;
for (ASTSubroutineParNode param: subParams) {
Token tmpToken = param.getVariableName();
- String paramText = tmpToken.getText();
+ String paramText;
+ if (tmpToken != null) {
+ paramText = tmpToken.getText();
+ } else {
+ paramText = "*"; //$NON-NLS-1$
+ }
if (paramCount>0)
fullId.append(',');
fullId.append(paramText);
//
- Definition varDef = bindUniquely(tmpToken);
- if (varDef != null) {
- if (varDef.isOptional()) {
- fullId.append('=');
- fullId.append(paramText);
+ if (tmpToken != null) {
+ Definition varDef = bindUniquely(tmpToken);
+ if (varDef != null) {
+ if (varDef.isOptional()) {
+ fullId.append('=');
+ fullId.append(paramText);
+ }
}
}
paramCount=paramCount+1;
diff --git a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/IntroduceCallTreeRefactoring.java b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/IntroduceCallTreeRefactoring.java
index c50979c..d20d233 100644
--- a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/IntroduceCallTreeRefactoring.java
+++ b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/IntroduceCallTreeRefactoring.java
@@ -39,7 +39,7 @@
for (IFile file : selectedFiles) {
IFortranAST ast = vpg.acquirePermanentAST(file);
if (ast == null) {
- status.addError("One of the selected files (" + file.getName() +") cannot be parsed.");
+ status.addError(Messages.bind(Messages.IntroduceCallTreeRefactoring_CannotParse, file.getName()));
} else {
makeChangesTo(file, ast, status, pm);
vpg.releaseAST(file);
@@ -82,7 +82,7 @@
}
String line = line_int.toString();
// Adds entry to the calls buffer of the scope.
- callStmtsOfScope.add(((ASTCallStmtNode)node).getSubroutineName().getText() + " (on line <" +line+">)");
+ callStmtsOfScope.add(Messages.bind(Messages.IntroduceCallTreeRefactoring_OnLine, ((ASTCallStmtNode)node).getSubroutineName().getText() , line));
}
}
if((hasCall== true) && (scopeChanged != null)){
@@ -97,21 +97,21 @@
tab = getBlankCharacters(blank_characters, tab, headerStmt);
String name = ""; //$NON-NLS-1$
if(scopeChanged.isMainProgram()){
- name = " in program ";
+ name = " in program "; //$NON-NLS-1$
}if(scopeChanged.isModule()){
- name = " in module ";
+ name = " in module "; //$NON-NLS-1$
}if(scopeChanged.isSubprogram()){
- name = " in subroutine ";
+ name = " in subroutine "; //$NON-NLS-1$
}
// Prints the call tree of each subroutine.
- firstToken.setText("! " + "Calls" + name + scopeChanged.getName().toUpperCase()+": \n"); //$NON-NLS-1$
+ firstToken.setText("! " + "Calls" + name + scopeChanged.getName().toUpperCase()+": \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
for(int i=0; i<callStmtsOfScope.size(); i++){
String arrow = "="; //$NON-NLS-1$
for(int j=0; j<i; j++){
arrow += "="; //$NON-NLS-1$
}
arrow += ">"; //$NON-NLS-1$
- firstToken.setText(firstToken.getText()+ tab + "! " + arrow + " " + callStmtsOfScope.get(i).toString() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ firstToken.setText(firstToken.getText()+ tab + "! " + arrow + " " + callStmtsOfScope.get(i).toString() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
firstToken.setText(firstToken.getText()+tab + firstTokenText.trim());
}
@@ -191,6 +191,6 @@
@Override
public String getName() {
- return "Introduce Call Tree";
+ return Messages.IntroduceCallTreeRefactoring_Name;
}
}
diff --git a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/Messages.java b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/Messages.java
index ec7132c..b103020 100644
--- a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/Messages.java
+++ b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/Messages.java
@@ -310,6 +310,12 @@
public static String InterchangeLoopsRefactoring_UncheckedTransNotGuaranteedToPreserve;
+ public static String IntroduceCallTreeRefactoring_CannotParse;
+
+ public static String IntroduceCallTreeRefactoring_Name;
+
+ public static String IntroduceCallTreeRefactoring_OnLine;
+
public static String IntroImplicitNoneRefactoring_Name;
public static String IntroImplicitNoneRefactoring_SelectedFileCannotBeParsed;
diff --git a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/VariableCaseRefactoring.java b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/VariableCaseRefactoring.java
index 25c5b85..4268b8d 100644
--- a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/VariableCaseRefactoring.java
+++ b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/VariableCaseRefactoring.java
@@ -30,7 +30,6 @@
import org.eclipse.photran.internal.core.parser.ASTObjectNameNode;
import org.eclipse.photran.internal.core.parser.ASTSubroutineParNode;
import org.eclipse.photran.internal.core.parser.ASTVarOrFnRefNode;
-import org.eclipse.photran.internal.core.parser.GenericASTVisitor;
import org.eclipse.photran.internal.core.parser.IASTNode;
import org.eclipse.photran.internal.core.refactoring.infrastructure.FortranResourceRefactoring;
diff --git a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/messages.properties b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/messages.properties
index 6cd2a42..7675024 100644
--- a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/messages.properties
+++ b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/messages.properties
@@ -93,6 +93,9 @@
InterchangeLoopsRefactoring_Name=Interchange Loops (Unchecked)
InterchangeLoopsRefactoring_SelectTwoPerfNextedLoops=Please select two perfectly-nested loops to refactor.
InterchangeLoopsRefactoring_UncheckedTransNotGuaranteedToPreserve=WARNING: This is an UNCHECKED TRANSFORMATION and is NOT guaranteed to preserve behavior. Proceed at your own risk.
+IntroduceCallTreeRefactoring_CannotParse=One of the selected files ({0}) cannot be parsed.
+IntroduceCallTreeRefactoring_Name=Introduce Call Tree
+IntroduceCallTreeRefactoring_OnLine={0} (on line <{1}>)
IntroImplicitNoneRefactoring_Name=Introduce Implicit None
IntroImplicitNoneRefactoring_SelectedFileCannotBeParsed=One of the selected files ({0}) cannot be parsed.
KeywordCaseRefactoring_Name=Change Keyword Case
diff --git a/org.eclipse.photran.ui.vpg.preprocessor.c/src/org/eclipse/photran/internal/ui/actions/DisplayPreprocessedSource.java b/org.eclipse.photran.ui.vpg.preprocessor.c/src/org/eclipse/photran/internal/ui/actions/DisplayPreprocessedSource.java
index 6fa1fbe..8a0004e 100644
--- a/org.eclipse.photran.ui.vpg.preprocessor.c/src/org/eclipse/photran/internal/ui/actions/DisplayPreprocessedSource.java
+++ b/org.eclipse.photran.ui.vpg.preprocessor.c/src/org/eclipse/photran/internal/ui/actions/DisplayPreprocessedSource.java
@@ -43,24 +43,33 @@
IDocument doc = getFortranEditor().getIDocument();
Reader in = new StringReader(doc.get());
Reader cppIn = new CPreprocessingReader(getFortranEditor().getIFile(), null, in);
-
- File tempFile = File.createTempFile(
- "tmp", //$NON-NLS-1$
- isFixedForm ? ".f" : ".f90"); //$NON-NLS-1$ //$NON-NLS-2$
- tempFile.deleteOnExit();
- PrintStream out =
- new PrintStream(
- new BufferedOutputStream(
- new FileOutputStream(tempFile)));
- for (int c = cppIn.read(); c != -1; c = cppIn.read())
- out.print((char)c);
- out.close();
+ try
+ {
+ File tempFile = File.createTempFile("tmp", //$NON-NLS-1$
+ isFixedForm ? ".f" : ".f90"); //$NON-NLS-1$ //$NON-NLS-2$
+ tempFile.deleteOnExit();
+ PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(
+ tempFile)));
+ try
+ {
+ for (int c = cppIn.read(); c != -1; c = cppIn.read())
+ out.print((char)c);
+ }
+ finally
+ {
+ out.close();
+ }
- IDE.openEditor(
- Workbench.getInstance().getActiveWorkbenchWindow().getActivePage(),
- tempFile.toURI(),
- FortranEditor.EDITOR_ID,
- true);
+ IDE.openEditor(
+ Workbench.getInstance().getActiveWorkbenchWindow().getActivePage(),
+ tempFile.toURI(),
+ FortranEditor.EDITOR_ID,
+ true);
+ }
+ finally
+ {
+ cppIn.close();
+ }
}
catch (Exception e)
{
diff --git a/org.eclipse.rephraserengine.core/src/org/eclipse/rephraserengine/core/vpg/db/cdt/CDTDB.java b/org.eclipse.rephraserengine.core/src/org/eclipse/rephraserengine/core/vpg/db/cdt/CDTDB.java
index 044dcee..e04be0b 100644
--- a/org.eclipse.rephraserengine.core/src/org/eclipse/rephraserengine/core/vpg/db/cdt/CDTDB.java
+++ b/org.eclipse.rephraserengine.core/src/org/eclipse/rephraserengine/core/vpg/db/cdt/CDTDB.java
@@ -188,11 +188,21 @@
{
File tempFile = File.createTempFile("rephraser-tmp", "db"); //$NON-NLS-1$ //$NON-NLS-2$
tempFile.deleteOnExit();
- FileChannel from = new FileInputStream(orig).getChannel();
- FileChannel to = new FileOutputStream(tempFile).getChannel();
- to.transferFrom(from, 0, from.size());
- from.close();
- to.close();
+ FileInputStream fromFile = new FileInputStream(orig);
+ FileOutputStream toFile = new FileOutputStream(tempFile);
+ FileChannel from = fromFile.getChannel();
+ FileChannel to = toFile.getChannel();
+ try
+ {
+ to.transferFrom(from, 0, from.size());
+ }
+ finally
+ {
+ to.close();
+ from.close();
+ toFile.close();
+ fromFile.close();
+ }
return tempFile;
}
diff --git a/org.eclipse.rephraserengine.core/src/org/eclipse/rephraserengine/core/vpg/db/ram/RAMDB.java b/org.eclipse.rephraserengine.core/src/org/eclipse/rephraserengine/core/vpg/db/ram/RAMDB.java
index 268a996..a3549e4 100644
--- a/org.eclipse.rephraserengine.core/src/org/eclipse/rephraserengine/core/vpg/db/ram/RAMDB.java
+++ b/org.eclipse.rephraserengine.core/src/org/eclipse/rephraserengine/core/vpg/db/ram/RAMDB.java
@@ -207,11 +207,21 @@
{
File tempFile = File.createTempFile("rephraser-tmp", "db"); //$NON-NLS-1$ //$NON-NLS-2$
tempFile.deleteOnExit();
- FileChannel from = new FileInputStream(orig).getChannel();
- FileChannel to = new FileOutputStream(tempFile).getChannel();
- to.transferFrom(from, 0, from.size());
- from.close();
- to.close();
+ FileInputStream fromFile = new FileInputStream(orig);
+ FileOutputStream toFile = new FileOutputStream(tempFile);
+ FileChannel from = fromFile.getChannel();
+ FileChannel to = toFile.getChannel();
+ try
+ {
+ to.transferFrom(from, 0, from.size());
+ }
+ finally
+ {
+ to.close();
+ from.close();
+ toFile.close();
+ fromFile.close();
+ }
return tempFile;
}
diff --git a/org.eclipse.rephraserengine.testing.junit3/src/org/eclipse/rephraserengine/testing/junit3/GeneralTestSuiteFromFiles.java b/org.eclipse.rephraserengine.testing.junit3/src/org/eclipse/rephraserengine/testing/junit3/GeneralTestSuiteFromFiles.java
index 01c77cc..f9b9fb5 100644
--- a/org.eclipse.rephraserengine.testing.junit3/src/org/eclipse/rephraserengine/testing/junit3/GeneralTestSuiteFromFiles.java
+++ b/org.eclipse.rephraserengine.testing.junit3/src/org/eclipse/rephraserengine/testing/junit3/GeneralTestSuiteFromFiles.java
@@ -177,11 +177,18 @@
Set<String> result = new HashSet<String>();
BufferedReader r = new BufferedReader(new FileReader(list));
- for (String line = r.readLine(); line != null; line = r.readLine())
+ try
{
- line = line.trim();
- if (!line.equals("") && !line.startsWith("#")) //$NON-NLS-1$ //$NON-NLS-2$
- result.add(line);
+ for (String line = r.readLine(); line != null; line = r.readLine())
+ {
+ line = line.trim();
+ if (!line.equals("") && !line.startsWith("#")) //$NON-NLS-1$ //$NON-NLS-2$
+ result.add(line);
+ }
+ }
+ finally
+ {
+ r.close();
}
return result;