Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixing filename validation performance regression in launch configuration #3

Merged
merged 2 commits into from

2 participants

@otrosien

isValid is called on every keystroke, e.g. when inserting command-line parameters. This change fixes creation of monstrous string arrays for comparing with a single filename.

otrosien added some commits
@otrosien otrosien Fixing filename validation performance regression in launch configura…
…tion when working on big projects
b67beed
@otrosien otrosien Windows unit test compatibilty issues
e.g. I'm getting a different exception message: "Die Pipe wird gerade geschlossen"
8063f43
@jploski jploski merged commit 7b0f503 into jploski:testing
@jploski
Owner

Cross-reference for ChangeLog: https://sourceforge.net/p/e-p-i-c/bugs/660/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 31, 2013
  1. @otrosien

    Fixing filename validation performance regression in launch configura…

    otrosien authored
    …tion when working on big projects
  2. @otrosien

    Windows unit test compatibilty issues

    otrosien authored
    e.g. I'm getting a different exception message: "Die Pipe wird gerade geschlossen"
This page is out of date. Refresh to see the latest.
View
25 org.epic.debug/src/org/epic/debug/ui/ProjectAndFileBlock.java
@@ -134,14 +134,13 @@ public boolean isValid(ILaunchConfiguration config) {
setErrorMessage("Startup File is not specified");
return false;
}
- String[] files = getPerlFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].equals(name)) {
- return true;
- }
+
+ if (! existsFile(name)) {
+ setErrorMessage("File does not exist or match to the project");
+ return false;
}
- setErrorMessage("File does not exist or match to the project");
- return false;
+
+ return true;
}
private void createScriptFileEditor(Composite parent) {
@@ -191,6 +190,18 @@ public void modifyText(ModifyEvent evt) {
}
return ((PerlProjectVisitor) visitor).getList();
}
+
+ private boolean existsFile(String filename) {
+ String projectName = getSelectedProject();
+
+ if (projectName == null || projectName.length() == 0) {
+ return false;
+ }
+
+ IWorkspaceRoot workspaceRoot = PerlDebugPlugin.getWorkspace().getRoot();
+ IProject project = workspaceRoot.getProject(projectName);
+ return project.getFile(filename).exists();
+ }
protected void newProjectSelected()
{
View
4 org.epic.perleditor-test/src/org/epic/core/model/TestSourceFile.java
@@ -54,10 +54,10 @@ private void _testFile(String inFile, String outFile) throws IOException
buf.append(sub.getName());
buf.append(':');
buf.append(sub.getBlockLevel());
- buf.append('\n');
+ buf.append(String.format("%n"));
}
buf.append('}');
- buf.append('\n');
+ buf.append(String.format("%n"));
}
/*
View
5 org.epic.perleditor-test/src/org/epic/perleditor/editors/TestPerlPartitioner.java
@@ -6,9 +6,10 @@
public class TestPerlPartitioner extends BaseTestCase
{
+ // this test expects unix newlines
public void testSyntax() throws Exception
{
- Document doc = new Document(readFile("workspace/EPICTest/syntax.pl"));
+ Document doc = new Document(readFile("workspace/EPICTest/syntax.pl").replace("\r",""));
PerlPartitioner partitioner = new PerlPartitioner(new Log(), doc);
ITypedRegion[] partitioning =
@@ -30,7 +31,7 @@ public void testSyntax() throws Exception
buf.append('\n');
}
- String expected = readFile("test.in/TestPerlPartitioner-expected.txt");
+ String expected = readFile("test.in/TestPerlPartitioner-expected.txt").replace("\r","");
assertEquals(expected, buf.toString());
//System.err.println(buf);
}
View
2  org.epic.perleditor-test/src/org/epic/perleditor/editors/util/PerlValidatorStub.java
@@ -32,7 +32,7 @@ protected void brokenPipe(IOException e)
throws IOException
{
if (e.getMessage().indexOf("Broken pipe") == 0 ||
- e.getMessage().indexOf("Die Pipe wurde beendet") == 0)
+ e.getMessage().indexOf("Die Pipe ") == 0)
{
PerlValidatorStub.gotBrokenPipe = true;
}
View
2  org.epic.perleditor-test/test.properties
@@ -2,7 +2,7 @@
# See README.txt.
# Path to the Perl interpreter
-org.epic.perleditor-test.perl = /usr/bin/perl
+org.epic.perleditor-test.perl = perl
# TestPerlMultiLexer is very machine-specific, disable it to avoid false alarms
org.epic.perleditor-test.TestPerlMultiLexer.enabled = false
Something went wrong with that request. Please try again.