Search in sources :

Example 1 with UIFormEditor

use of com.intellij.uiDesigner.editor.UIFormEditor in project intellij-community by JetBrains.

the class ReloadCustomComponentsAction method actionPerformed.

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);
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) FileEditor(com.intellij.openapi.fileEditor.FileEditor) UIFormEditor(com.intellij.uiDesigner.editor.UIFormEditor)

Example 2 with UIFormEditor

use of com.intellij.uiDesigner.editor.UIFormEditor in project intellij-community by JetBrains.

the class BoundIconRenderer method getClickAction.

@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());
                        }
                    }
                }
            }
        }
    };
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) FileEditor(com.intellij.openapi.fileEditor.FileEditor) UIFormEditor(com.intellij.uiDesigner.editor.UIFormEditor) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnAction(com.intellij.openapi.actionSystem.AnAction) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with UIFormEditor

use of com.intellij.uiDesigner.editor.UIFormEditor in project intellij-community by JetBrains.

the class FormElementNavigatable method navigate.

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;
            }
        }
    }
}
Also used : FileEditor(com.intellij.openapi.fileEditor.FileEditor) UIFormEditor(com.intellij.uiDesigner.editor.UIFormEditor) OpenFileDescriptor(com.intellij.openapi.fileEditor.OpenFileDescriptor)

Aggregations

FileEditor (com.intellij.openapi.fileEditor.FileEditor)3 UIFormEditor (com.intellij.uiDesigner.editor.UIFormEditor)3 Project (com.intellij.openapi.project.Project)2 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Nullable (org.jetbrains.annotations.Nullable)1