use of org.eclipse.xtext.util.StopWatch in project xtext-xtend by eclipse.
the class XtendQuickfixProvider method getResolutions.
@Override
public List<IssueResolution> getResolutions(Issue issue) {
StopWatch stopWatch = new StopWatch(logger);
try {
if (LINKING_ISSUE_CODES.contains(issue.getCode())) {
List<IssueResolution> result = new ArrayList<IssueResolution>();
result.addAll(getResolutionsForLinkingIssue(issue));
if (!result.isEmpty())
return result;
}
return super.getResolutions(issue);
} finally {
stopWatch.resetAndLog("#getResolutions");
}
}
use of org.eclipse.xtext.util.StopWatch in project xtext-eclipse by eclipse.
the class ProfilerAbstractBuilderTest method testFullBuildBigProjectWithRefeernceToJar.
@Test
public void testFullBuildBigProjectWithRefeernceToJar() throws Exception {
IJavaProject project = workspace.createJavaProject("foo");
workspace.addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
IFolder folder = project.getProject().getFolder("src");
IFile jarFile = project.getProject().getFile("my.jar");
jarFile.create(jarInputStream(new TextFile("my/element" + F_EXT, "object ReferenceMe")), true, workspace.monitor());
workspace.addJarToClasspath(project, jarFile);
int NUM_FILES = 2000;
IFile[] files = new IFile[NUM_FILES];
StopWatch timer = new StopWatch();
for (int i = 0; i < NUM_FILES; i++) {
IFile file = folder.getFile("Test_" + i + "_" + F_EXT);
files[i] = file;
String contents = "object Foo" + i + " references ReferenceMe";
file.create(new StringInputStream(contents), true, workspace.monitor());
}
logAndReset("Creating files", timer);
workspace.build();
logAndReset("Auto build", timer);
IMarker[] iMarkers = folder.findMarkers(EValidator.MARKER, true, IResource.DEPTH_INFINITE);
for (IMarker iMarker : iMarkers) {
System.out.println(iMarker.getAttribute(IMarker.MESSAGE));
}
assertEquals(0, iMarkers.length);
}
use of org.eclipse.xtext.util.StopWatch in project xtext-eclipse by eclipse.
the class ProfilerAbstractBuilderTest method testFullBuildBigProjectWithLinkingErrors.
@Test
public void testFullBuildBigProjectWithLinkingErrors() throws Exception {
IJavaProject project = workspace.createJavaProject("foo");
workspace.addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
IFolder folder = project.getProject().getFolder("src");
int NUM_FILES = 200;
IFile[] files = new IFile[NUM_FILES];
StopWatch timer = new StopWatch();
for (int i = 0; i < NUM_FILES; i++) {
IFile file = folder.getFile("Test_" + i + "_" + F_EXT);
files[i] = file;
String contents = "object Foo" + i + " references Foo" + (i * 1000);
if (i == NUM_FILES)
contents = "object Foo" + i;
file.create(new StringInputStream(contents), true, workspace.monitor());
}
logAndReset("Creating files", timer);
workspace.build();
logAndReset("Auto build", timer);
IMarker[] iMarkers = folder.findMarkers(EValidator.MARKER, true, IResource.DEPTH_INFINITE);
assertEquals(NUM_FILES - 1, iMarkers.length);
}
use of org.eclipse.xtext.util.StopWatch in project xtext-eclipse by eclipse.
the class DefaultQuickfixProvider method getResolutions.
@Override
public List<IssueResolution> getResolutions(Issue issue) {
StopWatch stopWatch = new StopWatch(logger);
try {
if (Diagnostic.LINKING_DIAGNOSTIC.equals(issue.getCode())) {
List<IssueResolution> result = new ArrayList<IssueResolution>();
result.addAll(getResolutionsForLinkingIssue(issue));
result.addAll(super.getResolutions(issue));
return result;
} else
return super.getResolutions(issue);
} finally {
stopWatch.resetAndLog("#getResolutions");
}
}
Aggregations