本文整理汇总了Java中com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider类的典型用法代码示例。如果您正苦于以下问题:Java PsiAwareTextEditorProvider类的具体用法?Java PsiAwareTextEditorProvider怎么用?Java PsiAwareTextEditorProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PsiAwareTextEditorProvider类属于com.intellij.openapi.fileEditor.impl.text包,在下文中一共展示了PsiAwareTextEditorProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SwaggerUIEditorProvider
import com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider; //导入依赖的package包/类
public SwaggerUIEditorProvider() {
this.editorProvider = new PsiAwareTextEditorProvider();
this.fileDetector = new FileDetector();
}
示例2: createHeaderComponent
import com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider; //导入依赖的package包/类
private JComponent createHeaderComponent(FileEditor fileEditor, Editor editor) {
final JSGraphQLEditorHeaderComponent headerComponent = new JSGraphQLEditorHeaderComponent();
// variables & settings actions
final DefaultActionGroup settingsActions = new DefaultActionGroup();
settingsActions.add(new JSGraphQLEditEndpointsAction());
settingsActions.add(new JSGraphQLToggleVariablesAction());
final JComponent settingsToolbar = createToolbar(settingsActions);
headerComponent.add(settingsToolbar, BorderLayout.WEST);
// query execute
final DefaultActionGroup queryActions = new DefaultActionGroup();
final AnAction executeGraphQLAction = ActionManager.getInstance().getAction(JSGraphQLExecuteEditorAction.class.getName());
queryActions.add(executeGraphQLAction);
final JComponent queryToolbar = createToolbar(queryActions);
// configured endpoints combo box
final List<JSGraphQLEndpoint> endpoints = JSGraphQLConfigurationProvider.getService(myProject).getEndpoints();
final JSGraphQLEndpointsModel endpointsModel = new JSGraphQLEndpointsModel(endpoints, PropertiesComponent.getInstance(myProject));
final ComboBox endpointComboBox = new ComboBox(endpointsModel);
endpointComboBox.setToolTipText("GraphQL endpoint");
editor.putUserData(JS_GRAPH_QL_ENDPOINTS_MODEL, endpointsModel);
final JPanel endpointComboBoxPanel = new JPanel(new BorderLayout());
endpointComboBoxPanel.setBorder(BorderFactory.createEmptyBorder(1, 2, 2, 2));
endpointComboBoxPanel.add(endpointComboBox);
// splitter to resize endpoints
final OnePixelSplitter splitter = new OnePixelSplitter(false, .25F);
splitter.setBorder(BorderFactory.createEmptyBorder());
splitter.setFirstComponent(endpointComboBoxPanel);
splitter.setSecondComponent(queryToolbar);
splitter.setHonorComponentsMinimumSize(true);
splitter.setAndLoadSplitterProportionKey("JSGraphQLEndpointSplitterProportion");
splitter.setOpaque(false);
splitter.getDivider().setOpaque(false);
headerComponent.add(splitter, BorderLayout.CENTER);
// variables editor
final LightVirtualFile virtualFile = new LightVirtualFile(GRAPH_QL_VARIABLES_JSON, JsonFileType.INSTANCE, "");
final FileEditor variablesFileEditor = PsiAwareTextEditorProvider.getInstance().createEditor(myProject, virtualFile);
final EditorEx variablesEditor = (EditorEx)((TextEditor)variablesFileEditor).getEditor();
virtualFile.putUserData(IS_GRAPH_QL_VARIABLES_VIRTUAL_FILE, Boolean.TRUE);
variablesEditor.setPlaceholder("{ variables }");
variablesEditor.setShowPlaceholderWhenFocused(true);
variablesEditor.getSettings().setRightMarginShown(false);
variablesEditor.getSettings().setAdditionalLinesCount(0);
variablesEditor.getSettings().setShowIntentionBulb(false);
variablesEditor.getSettings().setFoldingOutlineShown(false);
variablesEditor.getSettings().setLineNumbersShown(false);
variablesEditor.getSettings().setLineMarkerAreaShown(false);
variablesEditor.getSettings().setCaretRowShown(false);
variablesEditor.putUserData(JS_GRAPH_QL_ENDPOINTS_MODEL, endpointsModel);
// hide variables by default
variablesEditor.getComponent().setVisible(false);
// link the query and variables editor together
variablesEditor.putUserData(GRAPH_QL_QUERY_EDITOR, editor);
editor.putUserData(GRAPH_QL_VARIABLES_EDITOR, variablesEditor);
final NonOpaquePanel variablesPanel = new NonOpaquePanel(variablesFileEditor.getComponent());
variablesPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));
Disposer.register(fileEditor, variablesFileEditor);
headerComponent.add(variablesPanel, BorderLayout.SOUTH);
return headerComponent;
}
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:73,代码来源:JSGraphQLLanguageUIProjectService.java
示例3: createToolWindowResultEditor
import com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider; //导入依赖的package包/类
private void createToolWindowResultEditor(ToolWindow toolWindow) {
final LightVirtualFile virtualFile = new LightVirtualFile("GraphQL.result.json", JsonFileType.INSTANCE, "");
fileEditor = PsiAwareTextEditorProvider.getInstance().createEditor(myProject, virtualFile);
if(fileEditor instanceof TextEditor) {
final Editor editor = ((TextEditor) fileEditor).getEditor();
final EditorEx editorEx = (EditorEx)editor;
// set read-only mode
editorEx.setViewer(true);
editorEx.getSettings().setShowIntentionBulb(false);
editor.getSettings().setAdditionalLinesCount(0);
editor.getSettings().setCaretRowShown(false);
editor.getSettings().setBlinkCaret(false);
// query result header
final JSGraphQLEditorHeaderComponent header = new JSGraphQLEditorHeaderComponent();
querySuccessLabel = new JBLabel();
querySuccessLabel.setVisible(false);
querySuccessLabel.setIconTextGap(0);
header.add(querySuccessLabel, BorderLayout.WEST);
queryResultLabel = new JBLabel("", null, SwingConstants.LEFT);
queryResultLabel.setBorder(new EmptyBorder(4, 6, 4, 6));
queryResultLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
queryResultLabel.setVisible(false);
queryResultLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
final String fileUrl = (String)queryResultLabel.getClientProperty(FILE_URL_PROPERTY);
if(fileUrl != null) {
final VirtualFile queryFile = VirtualFileManager.getInstance().findFileByUrl(fileUrl);
if(queryFile != null) {
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
fileEditorManager.openFile(queryFile, true, true);
}
}
}
});
header.add(queryResultLabel, BorderLayout.CENTER);
// finally set the header as permanent such that it's restored after searches
editor.setHeaderComponent(header);
editorEx.setPermanentHeaderComponent(header);
}
Disposer.register(this, fileEditor);
final ContentImpl content = new ContentImpl(fileEditor.getComponent(), "Query result", true);
content.setCloseable(false);
toolWindow.getContentManager().addContent(content);
}
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:58,代码来源:JSGraphQLLanguageUIProjectService.java
示例4: AsciiDocSplitEditorProvider
import com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider; //导入依赖的package包/类
public AsciiDocSplitEditorProvider() {
super(new PsiAwareTextEditorProvider(), new AsciiDocPreviewEditorProvider());
}