use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project smali by JesusFreke.
the class SmaliCodeFragmentFactoryTest method createEditor.
protected Editor createEditor(@NotNull VirtualFile file) {
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
Editor editor = FileEditorManager.getInstance(getProject()).openTextEditor(new OpenFileDescriptor(getProject(), file, 0), false);
DaemonCodeAnalyzer.getInstance(getProject()).restart();
((EditorImpl) editor).setCaretActive();
return editor;
}
use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project intellij-community by JetBrains.
the class NewErrorTreeViewPanel method addMessage.
@Override
public void addMessage(int type, @NotNull String[] text, @Nullable String groupName, @NotNull Navigatable navigatable, @Nullable String exportTextPrefix, @Nullable String rendererTextPrefix, @Nullable Object data) {
if (myIsDisposed) {
return;
}
VirtualFile file = data instanceof VirtualFile ? (VirtualFile) data : null;
if (file == null && navigatable instanceof OpenFileDescriptor) {
file = ((OpenFileDescriptor) navigatable).getFile();
}
final String exportPrefix = exportTextPrefix == null ? "" : exportTextPrefix;
final String renderPrefix = rendererTextPrefix == null ? "" : rendererTextPrefix;
final ErrorTreeElementKind kind = ErrorTreeElementKind.convertMessageFromCompilerErrorType(type);
myErrorViewStructure.addNavigatableMessage(groupName, navigatable, kind, text, data, exportPrefix, renderPrefix, file);
myBuilder.updateTree();
}
use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project intellij-community by JetBrains.
the class TestsUIUtil method getOpenFileDescriptor.
private static Navigatable getOpenFileDescriptor(final AbstractTestProxy proxy, final TestConsoleProperties testConsoleProperties, final boolean openFailureLine) {
final Project project = testConsoleProperties.getProject();
if (proxy != null) {
final Location location = proxy.getLocation(project, testConsoleProperties.getScope());
if (openFailureLine) {
return proxy.getDescriptor(location, testConsoleProperties);
}
final OpenFileDescriptor openFileDescriptor = location == null ? null : location.getOpenFileDescriptor();
if (openFileDescriptor != null && openFileDescriptor.getFile().isValid()) {
return openFileDescriptor;
}
}
return null;
}
use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project intellij-community by JetBrains.
the class OpenFileAction method openFile.
public static void openFile(VirtualFile file, @NotNull Project project) {
FileEditorProvider[] providers = FileEditorProviderManager.getInstance().getProviders(project, file);
if (providers.length == 0) {
String message = IdeBundle.message("error.files.of.this.type.cannot.be.opened", ApplicationNamesInfo.getInstance().getProductName());
Messages.showErrorDialog(project, message, IdeBundle.message("title.cannot.open.file"));
return;
}
NonProjectFileWritingAccessProvider.allowWriting(file);
OpenFileDescriptor descriptor = new OpenFileDescriptor(project, file);
FileEditorManager.getInstance(project).openTextEditor(descriptor, true);
}
use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project intellij-community by JetBrains.
the class LightPlatformCodeInsightTestCase method createEditor.
@NotNull
protected static Editor createEditor(@NotNull VirtualFile file) {
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
Editor editor = FileEditorManager.getInstance(getProject()).openTextEditor(new OpenFileDescriptor(getProject(), file, 0), false);
DaemonCodeAnalyzer.getInstance(getProject()).restart();
assertNotNull(editor);
((EditorImpl) editor).setCaretActive();
return editor;
}
Aggregations