@Override protected void update(final GuiEditor editor, final ArrayList<RadComponent> selection, final AnActionEvent e) { PropertyInspectorTable inspector = e.getData(PropertyInspectorTable.DATA_KEY); if(inspector != null) { final Property selectedProperty = inspector.getSelectedProperty(); //noinspection unchecked e.getPresentation().setEnabled(selectedProperty != null && selection.size() > 0 && inspector.isModifiedForSelection(selectedProperty)); } else { e.getPresentation().setEnabled(false); } }
protected void update(final GuiEditor editor, final ArrayList<RadComponent> selection, final AnActionEvent e) { PropertyInspectorTable inspector = PropertyInspectorTable.DATA_KEY.getData(e.getDataContext()); if (inspector != null) { final Property selectedProperty = inspector.getSelectedProperty(); //noinspection unchecked e.getPresentation().setEnabled(selectedProperty != null && selection.size() > 0 && inspector.isModifiedForSelection(selectedProperty)); } else { e.getPresentation().setEnabled(false); } }
@RequiredDispatchThread @Override public void update(@NotNull final AnActionEvent e) { final PropertyInspectorTable inspector = e.getData(PropertyInspectorTable.DATA_KEY); e.getPresentation().setEnabled(inspector != null && inspector.getSelectedIntrospectedProperty() != null && inspector.getComponentClass() != null); }
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(new Runnable() { public void run() { 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(); } }); }
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); }
@RequiredDispatchThread @Override public void actionPerformed(@NotNull final AnActionEvent e) { final PropertyInspectorTable inspector = e.getData(PropertyInspectorTable.DATA_KEY); 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(new Runnable() { @Override public void run() { 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(); } }); }