@Override @Nullable public AnAction getClickAction() { return new AnAction() { @Override public void actionPerformed(AnActionEvent e) { List<PsiFile> formFiles = getBoundFormFiles(); if (formFiles.size() > 0) { final VirtualFile virtualFile = formFiles.get(0).getVirtualFile(); if (virtualFile == null) { return; } Project project = myElement.getProject(); FileEditor[] editors = FileEditorManager.getInstance(project).openFile(virtualFile, true); if (myElement instanceof PsiField) { for (FileEditor editor: editors) { if (editor instanceof UIFormEditor) { ((UIFormEditor)editor).selectComponent(((PsiField) myElement).getName()); } } } } } }; }
@Nullable public AnAction getClickAction() { return new AnAction() { public void actionPerformed(AnActionEvent e) { List<PsiFile> formFiles = getBoundFormFiles(); if (formFiles.size() > 0) { final VirtualFile virtualFile = formFiles.get(0).getVirtualFile(); if (virtualFile == null) { return; } Project project = myElement.getProject(); FileEditor[] editors = FileEditorManager.getInstance(project).openFile(virtualFile, true); if (myElement instanceof PsiField) { for (FileEditor editor: editors) { if (editor instanceof UIFormEditor) { ((UIFormEditor)editor).selectComponent(((PsiField) myElement).getName()); } } } } } }; }
/** * @return {@link com.intellij.uiDesigner.designSurface.GuiEditor} from the context. Can be <code>null</code>. */ @Nullable public static GuiEditor getEditorFromContext(@NotNull final DataContext context) { final FileEditor editor = PlatformDataKeys.FILE_EDITOR.getData(context); if (editor instanceof UIFormEditor) { return ((UIFormEditor)editor).getEditor(); } else { return GuiEditor.DATA_KEY.getData(context); } }
public void actionPerformed(AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) return; LoaderFactory.getInstance(project).clearClassLoaderCache(); final FileEditor[] fileEditors = FileEditorManager.getInstance(project).getAllEditors(); for(FileEditor editor: fileEditors) { if (editor instanceof UIFormEditor) { ((UIFormEditor) editor).getEditor().readFromFile(true); } } }
public void navigate(boolean requestFocus) { if (!myVirtualFile.isValid()) return; OpenFileDescriptor descriptor = new OpenFileDescriptor(myProject, myVirtualFile); final List<FileEditor> fileEditors = FileEditorManager.getInstance(myProject).openEditor(descriptor, requestFocus); if (myComponentId != null) { for(FileEditor editor: fileEditors) { if (editor instanceof UIFormEditor) { ((UIFormEditor) editor).selectComponentById(myComponentId); break; } } } }
@Nullable @Override protected DesignerEditorPanelFacade getDesigner(FileEditor editor) { if (editor instanceof UIFormEditor) { UIFormEditor formEditor = (UIFormEditor)editor; return formEditor.getEditor(); } return null; }
@Nullable public UIFormEditor getActiveFormFileEditor() { FileEditor[] fileEditors = myFileEditorManager.getSelectedEditors(); for (FileEditor fileEditor : fileEditors) { if (fileEditor instanceof UIFormEditor) { return (UIFormEditor)fileEditor; } } return null; }
public void actionPerformed(AnActionEvent e) { Project project = e.getData(PlatformDataKeys.PROJECT); if (project == null) return; LoaderFactory.getInstance(project).clearClassLoaderCache(); final FileEditor[] fileEditors = FileEditorManager.getInstance(project).getAllEditors(); for(FileEditor editor: fileEditors) { if (editor instanceof UIFormEditor) { ((UIFormEditor) editor).getEditor().readFromFile(true); } } }
/** * @return {@link com.intellij.uiDesigner.designSurface.GuiEditor} from the context. Can be <code>null</code>. */ @Nullable public static GuiEditor getEditorFromContext(@NotNull final DataContext context) { final FileEditor editor = context.getData(PlatformDataKeys.FILE_EDITOR); if(editor instanceof UIFormEditor) { return ((UIFormEditor) editor).getEditor(); } else { return context.getData(GuiEditor.DATA_KEY); } }
@Nullable @Override protected DesignerEditorPanelFacade getDesigner(FileEditor editor) { if(editor instanceof UIFormEditor) { UIFormEditor formEditor = (UIFormEditor) editor; return formEditor.getEditor(); } return null; }
@NotNull public UIFormEditor getEditor() { return myEditor; }
public void setFormEditor(final UIFormEditor formEditor) { myFormEditor = formEditor; }
@Nullable public GuiEditor getActiveFormEditor() { UIFormEditor formEditor = getActiveFormFileEditor(); return formEditor == null ? null : formEditor.getEditor(); }
public void selectionChanged(@NotNull FileEditorManagerEvent event) { UIFormEditor newEditor = event.getNewEditor() instanceof UIFormEditor ? (UIFormEditor)event.getNewEditor() : null; processFileEditorChange(newEditor); }