use of com.intellij.execution.filters.Filter in project intellij-community by JetBrains.
the class StackTraceElementObjectRenderer method getFullValueEvaluator.
@Nullable
@Override
public XFullValueEvaluator getFullValueEvaluator(final EvaluationContextImpl evaluationContext, final ValueDescriptorImpl valueDescriptor) {
return new JavaValue.JavaFullValueEvaluator(DebuggerBundle.message("message.node.navigate"), evaluationContext) {
@Override
public void evaluate(@NotNull XFullValueEvaluationCallback callback) {
Value value = valueDescriptor.getValue();
ClassType type = ((ClassType) value.type());
Method toString = type.concreteMethodByName("toString", "()Ljava/lang/String;");
if (toString != null) {
try {
Value res = evaluationContext.getDebugProcess().invokeMethod(evaluationContext, (ObjectReference) value, toString, Collections.emptyList());
if (res instanceof StringReference) {
callback.evaluated("");
final String line = ((StringReference) res).value();
ApplicationManager.getApplication().runReadAction(() -> {
ExceptionFilter filter = new ExceptionFilter(evaluationContext.getDebugProcess().getSession().getSearchScope());
Filter.Result result = filter.applyFilter(line, line.length());
if (result != null) {
final HyperlinkInfo info = result.getFirstHyperlinkInfo();
if (info != null) {
DebuggerUIUtil.invokeLater(() -> info.navigate(valueDescriptor.getProject()));
}
}
});
}
} catch (EvaluateException e) {
LOG.info("Exception while getting stack info", e);
}
}
}
@Override
public boolean isShowValuePopup() {
return false;
}
};
}
use of com.intellij.execution.filters.Filter in project intellij-community by JetBrains.
the class GradleConsoleFilterProvider method getDefaultFilters.
@NotNull
@Override
public Filter[] getDefaultFilters(@NotNull Project project) {
return new Filter[] { new GradleConsoleFilter(project), new RegexpFilter(project, RegexpFilter.FILE_PATH_MACROS + ":" + RegexpFilter.LINE_MACROS) {
private CachedValue<Boolean> myIsGradleProject = new CachedValueImpl<>(() -> CachedValueProvider.Result.create(isGradleProject(), ProjectRootModificationTracker.getInstance(project)));
@Override
public Result applyFilter(String line, int entireLength) {
if (line == null || !FileUtil.isAbsolutePlatformIndependent(line))
return null;
if (Boolean.FALSE.equals(myIsGradleProject.getValue()))
return null;
Result result = super.applyFilter(line, entireLength);
if (result == null)
return null;
Pattern pattern = getPattern();
Matcher matcher = pattern.matcher(StringUtil.newBombedCharSequence(line, 100));
if (!matcher.lookingAt())
return result;
int lineStart = entireLength - line.length();
int start = lineStart + matcher.start();
int end = lineStart + matcher.end();
return new Result(start, end, result.getFirstHyperlinkInfo());
}
private boolean isGradleProject() {
return !GradleSettings.getInstance(project).getLinkedProjectsSettings().isEmpty();
}
} };
}
use of com.intellij.execution.filters.Filter in project intellij-plugins by JetBrains.
the class RubyMotionUtilImpl method generateApp.
public void generateApp(final VirtualFile dir, final Module module, Sdk sdk, final ProjectType projectType) {
final Project project = module.getProject();
final String applicationHomePath = dir.getPath();
final File tempDirectory;
try {
tempDirectory = FileUtil.createTempDirectory("RubyMotion", ".RubyMine");
} catch (IOException e) {
throw new Error(e);
}
final File generatedApp = new File(tempDirectory, module.getName());
final Filter[] filters = null;
final ProcessAdapter processListener = new ProcessAdapter() {
public void processTerminated(ProcessEvent event) {
FileUtil.moveDirWithContent(generatedApp, VfsUtilCore.virtualToIoFile(dir));
tempDirectory.delete();
if (module.isDisposed()) {
return;
}
RModuleUtil.getInstance().refreshRubyModuleTypeContent(module);
GeneratorsUtil.openFileInEditor(project, "app/app_delegate.rb", applicationHomePath);
GeneratorsUtil.openFileInEditor(project, RakeUtilBase.RAKE_FILE, applicationHomePath);
GeneratorsUtil.openFileInEditor(project, BundlerUtil.GEMFILE, applicationHomePath);
}
};
final MergingCommandLineArgumentsProvider resultProvider = new MergingCommandLineArgumentsProvider(new String[] { getRubyMotionPath() + "/bin/motion", "create", "--template=" + projectType.name().toLowerCase(Locale.US), module.getName() }, null, null, null, sdk);
ConsoleRunner.run(module, null, processListener, filters, null, ConsoleRunner.ProcessLaunchMode.BACKGROUND_TASK_WITH_PROGRESS, "Generating RubyMotion Application '" + module.getName() + "'...", tempDirectory.getAbsolutePath(), resultProvider, null, false);
}
Aggregations