Skip to content

Commit

Permalink
status message for „search all“
Browse files Browse the repository at this point in the history
  • Loading branch information
gdelmas committed Dec 16, 2017
1 parent 43824be commit 85f1eb9
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/de/dreamlab/dash/SearchService.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void search(@Nonnull Editor editor, @Nullable Project project, @Nullable
}

// open dash
showStatusMessage(project, null, null);
launcher.search(new ArrayList<>(), query);
}

Expand All @@ -106,32 +107,37 @@ public void smartSearch(@Nonnull Editor editor, @Nullable Project project, @Null
return;
}

// open dash
showStatusMessage(project, resolvedLanguage, language);
launcher.search(keywordLookup.findKeywords(new LookupInfoDictionary(language, psiElement, project, psiFile, virtualFile)), query);

/*
use the following command to display information about the sdk in use in the event log. intended for development purposes.
showSdkDebug(AbstractSdkKeyword.findSdk(psiElement, project, psiFile, virtualFile));
*/
}

private void showStatusMessage(final @Nullable Project project, final @Nullable String resolvedLanguage, final @Nullable Language language)
{
if ( project == null ) {
return;
}

// show status message for potential troubleshooting
final StringBuilder messageBuilder = new StringBuilder();

if ( resolvedLanguage == null ) {
messageBuilder.append("Searching all docsets in Dash");
messageBuilder.append("Searching all documentation");
}
else {
messageBuilder.append(String.format("Searching \"%s\" docsets in Dash", resolvedLanguage));
messageBuilder.append(String.format("Smart-Searching \"%s\" documentation", resolvedLanguage));
}

if ( language != null && !language.getID().equals(resolvedLanguage) ) {
messageBuilder.append(String.format(". Based on \"%s\" context.", language.getID()));
}

if ( project != null ) {
StatusBarUtil.setStatusBarInfo(project, messageBuilder.toString());
}

// open dash
launcher.search(keywordLookup.findKeywords(new LookupInfoDictionary(language, psiElement, project, psiFile, virtualFile)), query);

/*
use the following command to display information about the sdk in use in the event log. intended for development purposes.
showSdkDebug(AbstractSdkKeyword.findSdk(psiElement, project, psiFile, virtualFile));
*/
StatusBarUtil.setStatusBarInfo(project, messageBuilder.toString());
}

private void showSdkDebug(@Nullable Sdk sdk)
Expand Down

0 comments on commit 85f1eb9

Please sign in to comment.