List of usage examples for org.eclipse.jdt.internal.compiler.problem DefaultProblem getArguments
@Override
public String[] getArguments()
From source file:org.eclim.plugin.jdt.command.include.ImportMissingCommand.java
License:Open Source License
/** * {@inheritDoc}//from w ww . j a v a 2 s . c om * @see org.eclim.command.Command#execute(CommandLine) */ public String execute(CommandLine commandLine) throws Exception { String file = commandLine.getValue(Options.FILE_OPTION); String projectName = commandLine.getValue(Options.PROJECT_OPTION); IJavaProject project = JavaUtils.getJavaProject(projectName); ICompilationUnit src = JavaUtils.getCompilationUnit(project, file); IProblem[] problems = JavaUtils.getProblems(src); ArrayList<String> missing = new ArrayList<String>(); for (IProblem problem : problems) { if (problem instanceof DefaultProblem) { DefaultProblem p = (DefaultProblem) problem; if (p.getCategoryID() == DefaultProblem.CAT_TYPE || p.getCategoryID() == DefaultProblem.CAT_MEMBER) { String[] args = p.getArguments(); if (args.length == 1) { String cls = args[0]; Matcher matcher = GENERIC.matcher(cls); if (matcher.matches()) { cls = matcher.replaceFirst("$1"); } if (!missing.contains(cls)) { missing.add(cls); } } } } } ArrayList<ImportMissingResult> results = new ArrayList<ImportMissingResult>(); for (String type : missing) { results.add(new ImportMissingResult(type, findImport(project, type))); } return ImportMissingFilter.instance.filter(commandLine, results); }