use of org.eclipse.titan.designer.parsers.ProjectSourceParser in project titan.EclipsePlug-ins by eclipse.
the class DocumentSetupParticipant method analyze.
void analyze(final IDocument document, final boolean isInitial) {
final IFile editedFile = (IFile) editor.getEditorInput().getAdapter(IFile.class);
if (editedFile == null || ResourceExclusionHelper.isExcluded(editedFile)) {
return;
}
IProject project = editedFile.getProject();
if (project == null) {
return;
}
ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(project);
projectSourceParser.reportOutdating(editedFile);
if (isInitial || !editor.isSemanticCheckingDelayed()) {
projectSourceParser.analyzeAll();
} else {
projectSourceParser.reportSyntacticOutdatingOnly(editedFile);
projectSourceParser.analyzeAllOnlySyntactically();
}
}
use of org.eclipse.titan.designer.parsers.ProjectSourceParser in project titan.EclipsePlug-ins by eclipse.
the class OutlinePage method getModule.
private Module getModule() {
final IFile file = (IFile) editor.getEditorInput().getAdapter(IFile.class);
if (file == null) {
return null;
}
ProjectSourceParser sourceParser = GlobalParser.getProjectSourceParser(file.getProject());
return sourceParser.containedModule(file);
}
use of org.eclipse.titan.designer.parsers.ProjectSourceParser in project titan.EclipsePlug-ins by eclipse.
the class DefinitionFinder method getDefinitionsOfProject.
private List<Object> getDefinitionsOfProject(final IProject project) {
final List<Object> result = new ArrayList<Object>();
ProjectSourceParser parser = GlobalParser.getProjectSourceParser(project);
if (filter.showOnlyModules()) {
result.addAll(parser.getModules());
} else {
for (Module module : parser.getModules()) {
if (filter.filter(module)) {
result.add(module);
}
for (Assignment ass : module.getAssignments()) {
if (filter.filter(ass)) {
result.add(ass);
}
}
}
}
return result;
}
use of org.eclipse.titan.designer.parsers.ProjectSourceParser in project titan.EclipsePlug-ins by eclipse.
the class ChangeCreator method createFileChange.
private Change createFileChange(final IFile toVisit) {
if (toVisit == null) {
return null;
}
final ProjectSourceParser sourceParser = GlobalParser.getProjectSourceParser(toVisit.getProject());
final Module module = sourceParser.containedModule(toVisit);
if (module == null) {
return null;
}
if (selection instanceof Def_Type) {
final Def_Type df = (Def_Type) selection;
type = df.getType(CompilationTimeStamp.getBaseTimestamp());
}
final DefinitionVisitor vis = new DefinitionVisitor(type);
module.accept(vis);
final NavigableSet<ILocateableNode> nodes = vis.getLocations();
if (nodes.isEmpty()) {
return null;
}
final TextFileChange tfc = new TextFileChange(toVisit.getName(), toVisit);
final MultiTextEdit rootEdit = new MultiTextEdit();
try {
final WorkspaceJob job1 = calculateEditLocations(nodes, toVisit, rootEdit);
job1.join();
} catch (InterruptedException ie) {
ErrorReporter.logExceptionStackTrace(ie);
} catch (CoreException ce) {
ErrorReporter.logError("InsertFieldRefactoring/CreateChange.createFileChange(): " + "CoreException while calculating edit locations. ");
ErrorReporter.logExceptionStackTrace(ce);
}
if (!rootEdit.hasChildren()) {
return null;
}
tfc.setEdit(rootEdit);
return tfc;
}
use of org.eclipse.titan.designer.parsers.ProjectSourceParser in project titan.EclipsePlug-ins by eclipse.
the class ChangeCreator method createFileChange.
private Change createFileChange(final IFile toVisit) {
if (toVisit == null) {
return null;
}
final ProjectSourceParser sourceParser = GlobalParser.getProjectSourceParser(toVisit.getProject());
final Module module = sourceParser.containedModule(toVisit);
if (module == null) {
return null;
}
final DefinitionVisitor vis = new DefinitionVisitor();
module.accept(vis);
final List<FormalParameter> nodes = vis.getLocations();
// Calculate edit locations
final List<Location> locations = new ArrayList<Location>();
try {
final WorkspaceJob job1 = calculateEditLocations(nodes, toVisit, locations);
job1.join();
} catch (InterruptedException ie) {
ErrorReporter.logExceptionStackTrace(ie);
} catch (CoreException ce) {
ErrorReporter.logError("LazyficationRefactoring: " + "CoreException while calculating edit locations in " + toVisit.getName() + ".");
ErrorReporter.logExceptionStackTrace(ce);
}
if (locations.isEmpty()) {
return null;
}
// Create a change for each edit location
final TextFileChange tfc = new TextFileChange(toVisit.getName(), toVisit);
final MultiTextEdit rootEdit = new MultiTextEdit();
tfc.setEdit(rootEdit);
for (Location l : locations) {
rootEdit.addChild(new InsertEdit(l.getOffset(), "@lazy "));
}
return tfc;
}
Aggregations