use of org.intellij.plugins.xpathView.Config in project intellij-community by JetBrains.
the class FindByXPathAction method executeSearch.
private void executeSearch(@NotNull final Project project, final Module module) {
final Config settings = XPathAppComponent.getInstance().getConfig();
final XPathProjectComponent projectComponent = XPathProjectComponent.getInstance(project);
final FindByExpressionDialog dlg = new FindByExpressionDialog(project, settings, projectComponent.getFindHistory(), module);
if (!dlg.show(null)) {
return;
}
final SearchScope scope = dlg.getScope();
settings.MATCH_RECURSIVELY = dlg.isMatchRecursively();
settings.SEARCH_SCOPE = dlg.getScope();
final InputExpressionDialog.Context context = dlg.getContext();
projectComponent.addFindHistory(context.input);
final String expression = context.input.expression;
if (!validateExpression(project, expression)) {
return;
}
final UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setTargetsNodeText(settings.MATCH_RECURSIVELY ? "XPath Pattern" : "XPath Expression");
presentation.setCodeUsages(false);
presentation.setCodeUsagesString("Found Matches in " + scope.getName());
presentation.setNonCodeUsagesString("Result");
presentation.setUsagesString("results matching '" + expression + '\'');
presentation.setUsagesWord("match");
presentation.setTabText(StringUtil.shortenTextWithEllipsis("XPath '" + expression + '\'', 60, 0, true));
presentation.setScopeText(scope.getName());
presentation.setOpenInNewTab(FindSettings.getInstance().isShowResultsInSeparateView());
final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation(presentation);
processPresentation.setProgressIndicatorFactory(() -> new FindProgressIndicator(project, scope.getName()));
processPresentation.setShowPanelIfOnlyOneUsage(true);
processPresentation.setShowNotFoundMessage(true);
final XPathEvalAction.MyUsageTarget usageTarget = new XPathEvalAction.MyUsageTarget(context.input.expression, null);
final UsageTarget[] usageTargets = new UsageTarget[] { usageTarget };
final Factory<UsageSearcher> searcherFactory = () -> new XPathUsageSearcher(project, context.input, scope, settings.MATCH_RECURSIVELY);
final UsageViewManager.UsageViewStateListener stateListener = new UsageViewManager.UsageViewStateListener() {
public void usageViewCreated(@NotNull UsageView usageView) {
usageView.addButtonToLowerPane(new MyEditExpressionAction(project, module), "&Edit Expression");
}
public void findingUsagesFinished(UsageView usageView) {
}
};
UsageViewManager.getInstance(project).searchAndShowUsages(usageTargets, searcherFactory, processPresentation, presentation, stateListener);
}
use of org.intellij.plugins.xpathView.Config in project intellij-community by JetBrains.
the class ConfigUI method getConfig.
@NotNull
public Config getConfig() {
final Config config = new Config();
config.setHighlightStartTagOnly(highlightStartTagOnly.isSelected());
config.setUseContextAtCursor(useContextAtCursor.isSelected());
config.setScrollToFirst(scrollToFirst.isSelected());
config.setAddErrorStripe(addErrorStripe.isSelected());
config.SHOW_IN_TOOLBAR = showInToolbar.isSelected();
config.SHOW_IN_MAIN_MENU = showInMainMenu.isSelected();
config.getAttributes().setBackgroundColor(chooseHighlight.getSelectedColor());
if (useContextAtCursor.isSelected()) {
config.getContextAttributes().setBackgroundColor(chooseContext.getSelectedColor());
}
return config;
}
Aggregations