use of com.intellij.openapi.editor.ex.EditorEx in project android by JetBrains.
the class SpecificActivityConfigurable method createUIComponents.
private void createUIComponents() {
final EditorTextField editorTextField = new LanguageTextField(PlainTextLanguage.INSTANCE, myProject, "") {
@Override
protected EditorEx createEditor() {
final EditorEx editor = super.createEditor();
final PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
if (file != null) {
DaemonCodeAnalyzer.getInstance(myProject).setHighlightingEnabled(file, false);
}
editor.putUserData(LaunchOptionConfigurableContext.KEY, myContext);
return editor;
}
};
myActivityField = new ComponentWithBrowseButton<EditorTextField>(editorTextField, null);
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class CodeStyleAbstractPanel method createEditor.
@Nullable
private Editor createEditor() {
if (getPreviewText() == null)
return null;
EditorFactory editorFactory = EditorFactory.getInstance();
Document editorDocument = editorFactory.createDocument("");
EditorEx editor = (EditorEx) editorFactory.createEditor(editorDocument);
fillEditorSettings(editor.getSettings());
myLastDocumentModificationStamp = editor.getDocument().getModificationStamp();
return editor;
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class ImplementationViewComponent method update.
public void update(@NotNull final PsiElement[] elements, final int index) {
update(elements, (psiElements, fileDescriptors) -> {
if (myEditor.isDisposed())
return false;
if (psiElements.length == 0)
return false;
final Project project = psiElements[0].getProject();
myElements = psiElements;
myIndex = index < myElements.length ? index : 0;
PsiFile psiFile = getContainingFile(myElements[myIndex]);
VirtualFile virtualFile = psiFile.getVirtualFile();
EditorHighlighter highlighter;
if (virtualFile != null)
highlighter = HighlighterFactory.createHighlighter(project, virtualFile);
else {
// some artificial psi file, lets do best we can
String fileName = psiFile.getName();
highlighter = HighlighterFactory.createHighlighter(project, fileName);
}
((EditorEx) myEditor).setHighlighter(highlighter);
if (myElements.length > 1) {
myFileChooser.setVisible(true);
myCountLabel.setVisible(true);
myLabel.setVisible(false);
myFileChooser.setModel(new DefaultComboBoxModel(fileDescriptors.toArray(new FileDescriptor[fileDescriptors.size()])));
updateRenderer(project);
} else {
myFileChooser.setVisible(false);
myCountLabel.setVisible(false);
VirtualFile file = psiFile.getVirtualFile();
if (file != null) {
myLabel.setIcon(getIconForFile(psiFile));
myLabel.setForeground(FileStatusManager.getInstance(project).getStatus(file).getColor());
myLabel.setText(file.getPresentableName());
myLabel.setBorder(new CompoundBorder(IdeBorderFactory.createRoundedBorder(), IdeBorderFactory.createEmptyBorder(0, 0, 0, 5)));
myLabel.setVisible(true);
}
}
updateControls();
revalidate();
repaint();
return true;
});
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class InspectionResultsView method showInRightPanel.
private void showInRightPanel(@Nullable final RefEntity refEntity) {
Cursor currentCursor = getCursor();
try {
setCursor(new Cursor(Cursor.WAIT_CURSOR));
final JPanel editorPanel = new JPanel();
editorPanel.setLayout(new BorderLayout());
final int problemCount = myTree.getSelectedProblemCount(true);
JComponent previewPanel = null;
final InspectionToolWrapper tool = myTree.getSelectedToolWrapper(true);
if (tool != null && refEntity != null && refEntity.isValid()) {
final TreePath path = myTree.getSelectionPath();
if (path == null || !(path.getLastPathComponent() instanceof ProblemDescriptionNode)) {
final InspectionToolPresentation presentation = myGlobalInspectionContext.getPresentation(tool);
previewPanel = presentation.getCustomPreviewPanel(refEntity);
}
}
EditorEx previewEditor = null;
if (previewPanel == null) {
final Pair<JComponent, EditorEx> panelAndEditor = createBaseRightComponentFor(problemCount, refEntity);
previewPanel = panelAndEditor.getFirst();
previewEditor = panelAndEditor.getSecond();
}
editorPanel.add(previewPanel, BorderLayout.CENTER);
if (problemCount > 0) {
final JComponent fixToolbar = QuickFixPreviewPanelFactory.create(this);
if (fixToolbar != null) {
if (fixToolbar instanceof InspectionTreeLoadingProgressAware) {
myLoadingProgressPreview = (InspectionTreeLoadingProgressAware) fixToolbar;
}
if (previewEditor != null) {
previewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));
}
editorPanel.add(fixToolbar, BorderLayout.NORTH);
}
}
if (previewEditor != null) {
new ProblemPreviewEditorPresentation(previewEditor, this);
}
mySplitter.setSecondComponent(editorPanel);
} finally {
setCursor(currentCursor);
}
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class MethodSignatureComponent method setSignature.
public void setSignature(String signature) {
setText(signature);
final EditorEx editor = (EditorEx) getEditor();
if (editor != null) {
editor.getScrollingModel().scrollVertically(0);
editor.getScrollingModel().scrollHorizontally(0);
}
}
Aggregations