Search in sources :

Example 1 with PropertyInspectorTable

use of com.intellij.uiDesigner.propertyInspector.PropertyInspectorTable in project intellij-community by JetBrains.

the class ShowJavadocAction method update.

public void update(final AnActionEvent e) {
    final PropertyInspectorTable inspector = PropertyInspectorTable.DATA_KEY.getData(e.getDataContext());
    e.getPresentation().setEnabled(inspector != null && inspector.getSelectedIntrospectedProperty() != null && inspector.getComponentClass() != null);
}
Also used : PropertyInspectorTable(com.intellij.uiDesigner.propertyInspector.PropertyInspectorTable)

Example 2 with PropertyInspectorTable

use of com.intellij.uiDesigner.propertyInspector.PropertyInspectorTable in project intellij-community by JetBrains.

the class ShowJavadocAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final PropertyInspectorTable inspector = PropertyInspectorTable.DATA_KEY.getData(e.getDataContext());
    final IntrospectedProperty introspectedProperty = inspector.getSelectedIntrospectedProperty();
    final PsiClass aClass = inspector.getComponentClass();
    final PsiMethod getter = PropertyUtil.findPropertyGetter(aClass, introspectedProperty.getName(), false, true);
    LOG.assertTrue(getter != null);
    final PsiMethod setter = PropertyUtil.findPropertySetter(aClass, introspectedProperty.getName(), false, true);
    LOG.assertTrue(setter != null);
    final DocumentationManager documentationManager = DocumentationManager.getInstance(aClass.getProject());
    final DocumentationComponent component1 = new DocumentationComponent(documentationManager);
    final DocumentationComponent component2 = new DocumentationComponent(documentationManager);
    final Disposable disposable = Disposer.newDisposable();
    final TabbedPaneWrapper tabbedPane = new TabbedPaneWrapper(disposable);
    tabbedPane.addTab(UIDesignerBundle.message("tab.getter"), component1);
    tabbedPane.addTab(UIDesignerBundle.message("tab.setter"), component2);
    documentationManager.fetchDocInfo(getter, component1);
    documentationManager.queueFetchDocInfo(setter, component2).doWhenProcessed(() -> {
        final JBPopup hint = JBPopupFactory.getInstance().createComponentPopupBuilder(tabbedPane.getComponent(), component1).setDimensionServiceKey(aClass.getProject(), DocumentationManager.JAVADOC_LOCATION_AND_SIZE, false).setResizable(true).setMovable(true).setRequestFocus(true).setTitle(UIDesignerBundle.message("property.javadoc.title", introspectedProperty.getName())).createPopup();
        component1.setHint(hint);
        component2.setHint(hint);
        Disposer.register(hint, component1);
        Disposer.register(hint, component2);
        Disposer.register(hint, disposable);
        hint.show(new RelativePoint(inspector, new Point(0, 0)));
    //component1.requestFocus();
    });
}
Also used : Disposable(com.intellij.openapi.Disposable) DocumentationManager(com.intellij.codeInsight.documentation.DocumentationManager) PropertyInspectorTable(com.intellij.uiDesigner.propertyInspector.PropertyInspectorTable) PsiMethod(com.intellij.psi.PsiMethod) DocumentationComponent(com.intellij.codeInsight.documentation.DocumentationComponent) TabbedPaneWrapper(com.intellij.ui.TabbedPaneWrapper) IntrospectedProperty(com.intellij.uiDesigner.propertyInspector.IntrospectedProperty) PsiClass(com.intellij.psi.PsiClass) RelativePoint(com.intellij.ui.awt.RelativePoint) RelativePoint(com.intellij.ui.awt.RelativePoint) JBPopup(com.intellij.openapi.ui.popup.JBPopup)

Aggregations

PropertyInspectorTable (com.intellij.uiDesigner.propertyInspector.PropertyInspectorTable)2 DocumentationComponent (com.intellij.codeInsight.documentation.DocumentationComponent)1 DocumentationManager (com.intellij.codeInsight.documentation.DocumentationManager)1 Disposable (com.intellij.openapi.Disposable)1 JBPopup (com.intellij.openapi.ui.popup.JBPopup)1 PsiClass (com.intellij.psi.PsiClass)1 PsiMethod (com.intellij.psi.PsiMethod)1 TabbedPaneWrapper (com.intellij.ui.TabbedPaneWrapper)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 IntrospectedProperty (com.intellij.uiDesigner.propertyInspector.IntrospectedProperty)1