use of org.eclipse.titanium.markers.utils.Analyzer in project titan.EclipsePlug-ins by eclipse.
the class CustomExpansionListener method performOk.
@Override
public boolean performOk() {
final boolean result = super.performOk();
// the others should be checked too.
if (changed) {
ErrorReporter.parallelWarningDisplayInMessageDialog("Code smell markers", "Settings of the code smell analyzer have changed," + " the known projects have to be re-analyzed completly.\nThis might take some time.");
final IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects();
final Analyzer analyzer = AnalyzerCache.withPreference();
for (final IProject project : projs) {
if (TITANNature.hasTITANNature(project)) {
final WorkspaceJob op = new WorkspaceJob("Code smells") {
@Override
public IStatus runInWorkspace(final IProgressMonitor monitor) {
MarkerHandler mh;
synchronized (project) {
mh = analyzer.analyzeProject(monitor, project);
}
mh.showAll(project);
return Status.OK_STATUS;
}
};
op.setPriority(Job.SHORT);
op.setSystem(false);
op.setUser(true);
op.schedule();
}
}
}
return result;
}
use of org.eclipse.titanium.markers.utils.Analyzer in project titan.EclipsePlug-ins by eclipse.
the class CheckCodeSmells method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final IWorkbenchPage iwPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
final ISelection selection = iwPage.getSelection();
final List<IResource> res = org.eclipse.titan.common.utils.SelectionUtils.getResourcesFromSelection(selection);
final Map<IProject, List<IFile>> files = new HashMap<IProject, List<IFile>>();
final List<IProject> projects = new ArrayList<IProject>();
collectResourcesToBeAnalyzed(new LinkedList<IResource>(res), files, projects);
final String titaniumId = Activator.PLUGIN_ID;
final String onTheFlyPref = PreferenceConstants.ON_THE_FLY_SMELLS;
final boolean onTheFlyEnabled = Platform.getPreferencesService().getBoolean(titaniumId, onTheFlyPref, false, null);
final Analyzer analyzer = AnalyzerCache.withPreference();
// Clear the files, that will be analyzed inside projects.
for (final IProject project : projects) {
files.remove(project);
}
// check projects
checkProjects(projects, onTheFlyEnabled, analyzer);
// check separate files of project
checkSeparateFiles(files, onTheFlyEnabled, analyzer);
return null;
}
Aggregations