本文整理汇总了Java中com.intellij.codeInsight.documentation.DocumentationManager.storeOriginalElement方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentationManager.storeOriginalElement方法的具体用法?Java DocumentationManager.storeOriginalElement怎么用?Java DocumentationManager.storeOriginalElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.documentation.DocumentationManager
的用法示例。
在下文中一共展示了DocumentationManager.storeOriginalElement方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
PsiElement element = getElement(dataContext, editor);
final PsiElement originalElement = getOriginalElement(CommonDataKeys.PSI_FILE.getData(dataContext), editor);
DocumentationManager.storeOriginalElement(CommonDataKeys.PROJECT.getData(dataContext), originalElement, element);
final DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
boolean enabled;
if (provider instanceof ExternalDocumentationProvider) {
final ExternalDocumentationProvider edProvider = (ExternalDocumentationProvider)provider;
enabled = edProvider.hasDocumentationFor(element, originalElement) || edProvider.canPromptToConfigureDocumentation(element);
}
else {
final List<String> urls = provider.getUrlFor(element, originalElement);
enabled = urls != null && !urls.isEmpty();
}
if (editor != null) {
presentation.setEnabled(enabled);
if (ActionPlaces.isMainMenuOrActionSearch(event.getPlace())) {
presentation.setVisible(true);
}
else {
presentation.setVisible(enabled);
}
}
else{
presentation.setEnabled(enabled);
presentation.setVisible(true);
}
}
示例2: update
import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
final PsiElement element = LangDataKeys.PSI_ELEMENT.getData(dataContext);
final PsiElement originalElement = getOriginalElement(LangDataKeys.PSI_FILE.getData(dataContext), editor);
DocumentationManager.storeOriginalElement(PlatformDataKeys.PROJECT.getData(dataContext), originalElement, element);
final DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
boolean enabled;
if (provider instanceof ExternalDocumentationProvider) {
final ExternalDocumentationProvider edProvider = (ExternalDocumentationProvider)provider;
enabled = edProvider.hasDocumentationFor(element, originalElement) || edProvider.canPromptToConfigureDocumentation(element);
}
else {
final List<String> urls = provider.getUrlFor(element, originalElement);
enabled = urls != null && !urls.isEmpty();
}
if (editor != null) {
presentation.setEnabled(enabled);
if (event.getPlace().equals(ActionPlaces.MAIN_MENU)) {
presentation.setVisible(true);
}
else {
presentation.setVisible(enabled);
}
}
else{
presentation.setEnabled(enabled);
presentation.setVisible(true);
}
}
示例3: actionPerformed
import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
Project project = dataContext.getData(CommonDataKeys.PROJECT);
if (project == null) {
return;
}
Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
PsiElement element = getElement(dataContext, editor);
if (element == null) {
Messages.showMessageDialog(
project,
IdeBundle.message("message.please.select.element.for.javadoc"),
IdeBundle.message("title.no.element.selected"),
Messages.getErrorIcon()
);
return;
}
PsiFile context = dataContext.getData(CommonDataKeys.PSI_FILE);
PsiElement originalElement = getOriginalElement(context, editor);
DocumentationManager.storeOriginalElement(project, originalElement, element);
showExternalJavadoc(element, originalElement, null, dataContext);
}
示例4: update
import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
PsiElement element = getElement(dataContext, editor);
final PsiElement originalElement = getOriginalElement(dataContext.getData(CommonDataKeys.PSI_FILE), editor);
DocumentationManager.storeOriginalElement(dataContext.getData(CommonDataKeys.PROJECT), originalElement, element);
final DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
boolean enabled;
if (provider instanceof ExternalDocumentationProvider) {
final ExternalDocumentationProvider edProvider = (ExternalDocumentationProvider)provider;
enabled = edProvider.hasDocumentationFor(element, originalElement) || edProvider.canPromptToConfigureDocumentation(element);
}
else {
final List<String> urls = provider.getUrlFor(element, originalElement);
enabled = urls != null && !urls.isEmpty();
}
if (editor != null) {
presentation.setEnabled(enabled);
if (ActionPlaces.isMainMenuOrActionSearch(event.getPlace())) {
presentation.setVisible(true);
}
else {
presentation.setVisible(enabled);
}
}
else{
presentation.setEnabled(enabled);
presentation.setVisible(true);
}
}
示例5: actionPerformed
import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return;
}
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
PsiElement element = getElement(dataContext, editor);
if (element == null) {
Messages.showMessageDialog(
project,
IdeBundle.message("message.please.select.element.for.javadoc"),
IdeBundle.message("title.no.element.selected"),
Messages.getErrorIcon()
);
return;
}
PsiFile context = CommonDataKeys.PSI_FILE.getData(dataContext);
PsiElement originalElement = getOriginalElement(context, editor);
DocumentationManager.storeOriginalElement(project, originalElement, element);
final DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
if (provider instanceof ExternalDocumentationHandler && ((ExternalDocumentationHandler)provider).handleExternal(element, originalElement)) {
return;
}
final List<String> urls = provider.getUrlFor(element, originalElement);
if (urls != null && !urls.isEmpty()) {
showExternalJavadoc(urls, PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext));
}
else if (provider instanceof ExternalDocumentationProvider) {
final ExternalDocumentationProvider externalDocumentationProvider = (ExternalDocumentationProvider)provider;
if (externalDocumentationProvider.canPromptToConfigureDocumentation(element)) {
externalDocumentationProvider.promptToConfigureDocumentation(element);
}
}
}
示例6: actionPerformed
import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return;
}
PsiElement element = LangDataKeys.PSI_ELEMENT.getData(dataContext);
if (element == null) {
Messages.showMessageDialog(
project,
IdeBundle.message("message.please.select.element.for.javadoc"),
IdeBundle.message("title.no.element.selected"),
Messages.getErrorIcon()
);
return;
}
PsiFile context = LangDataKeys.PSI_FILE.getData(dataContext);
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
PsiElement originalElement = getOriginalElement(context, editor);
DocumentationManager.storeOriginalElement(project, originalElement, element);
final DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
if (provider instanceof ExternalDocumentationHandler && ((ExternalDocumentationHandler)provider).handleExternal(element, originalElement)) {
return;
}
final List<String> urls = provider.getUrlFor(element, originalElement);
if (urls != null && !urls.isEmpty()) {
showExternalJavadoc(urls);
}
else if (provider instanceof ExternalDocumentationProvider) {
final ExternalDocumentationProvider externalDocumentationProvider = (ExternalDocumentationProvider)provider;
if (externalDocumentationProvider.canPromptToConfigureDocumentation(element)) {
externalDocumentationProvider.promptToConfigureDocumentation(element);
}
}
}