use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project intellij-community by JetBrains.
the class ExtractMethodHandler method openEditor.
@Nullable
private static Editor openEditor(final Project project, final PsiFile file) {
final VirtualFile virtualFile = file.getVirtualFile();
LOG.assertTrue(virtualFile != null);
final OpenFileDescriptor fileDescriptor = new OpenFileDescriptor(project, virtualFile);
return FileEditorManager.getInstance(project).openTextEditor(fileDescriptor, false);
}
use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project intellij-plugins by JetBrains.
the class CPUSnapshotNode method getNavigatable.
@Override
public Navigatable getNavigatable() {
if (navigatableCache == null) {
final String name = runConfigurationName + " " + getTitle();
VirtualFile virtualFile = new LightVirtualFile(name, new CpuSnapshotFileType(), "") {
@NotNull
@Override
public String getPath() {
return getName();
}
};
virtualFile.putUserData(ProfileData.CALL_TREE_KEY, callTree);
navigatableCache = new OpenFileDescriptor(module.getProject(), virtualFile);
}
return navigatableCache;
}
use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project android by JetBrains.
the class EditorFixture method open.
/**
* Opens up a different file. This will run through the "Open File..." dialog to
* find and select the given file.
*
* @param file the file to open
* @param tab which tab to open initially, if there are multiple editors
*/
public EditorFixture open(@NotNull final VirtualFile file, @NotNull final Tab tab) {
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
// TODO: Use UI to navigate to the file instead
Project project = myFrame.getProject();
FileEditorManager manager = FileEditorManager.getInstance(project);
if (tab == Tab.EDITOR) {
manager.openTextEditor(new OpenFileDescriptor(project, file), true);
} else {
manager.openFile(file, true);
}
}
});
selectEditorTab(tab);
Wait.seconds(5).expecting("file " + quote(file.getPath()) + " to be opened and loaded").until(() -> {
if (!file.equals(getCurrentFile())) {
return false;
}
FileEditor fileEditor = FileEditorManager.getInstance(myFrame.getProject()).getSelectedEditor(file);
JComponent editorComponent = fileEditor.getComponent();
if (editorComponent instanceof JBLoadingPanel) {
return !((JBLoadingPanel) editorComponent).isLoading();
}
return true;
});
myFrame.requestFocusIfLost();
robot.waitForIdle();
return this;
}
use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project intellij-plugins by JetBrains.
the class SocketInputHandlerImpl method openDocument.
private void openDocument() throws IOException {
Project project = readProject();
int documentFactoryId = reader.readUnsignedShort();
int textOffset = reader.readInt();
boolean activateApp = reader.readBoolean();
DocumentFactoryManager.DocumentInfo info = DocumentFactoryManager.getInstance().getInfo(documentFactoryId);
navigateToFile(new OpenFileDescriptor(project, info.getElement(), info.getRangeMarker(textOffset).getStartOffset()), activateApp);
}
use of com.intellij.openapi.fileEditor.OpenFileDescriptor in project android by JetBrains.
the class DependencySetupErrors method reportErrors.
public void reportErrors() {
reportModulesNotFoundIssues(getMissingModules());
for (String dependent : getMissingNames()) {
String msg = String.format("Module '%1$s' depends on modules that do not have a name.", dependent);
mySyncMessages.report(new SyncMessage(MISSING_DEPENDENCIES, ERROR, msg));
}
for (String dependent : getDependentsOnLibrariesWithoutBinaryPath()) {
String msg = String.format("Module '%1$s' depends on libraries that do not have a 'binary' path.", dependent);
mySyncMessages.report(new SyncMessage(MISSING_DEPENDENCIES, ERROR, msg));
}
for (DependencySetupErrors.InvalidModuleDependency dependency : myInvalidModuleDependencies) {
String msg = String.format("Ignoring dependency of module '%1$s' on module '%2$s'. %3$s", dependency.dependent, dependency.dependency.getName(), dependency.causeDescription);
VirtualFile buildFile = getGradleBuildFile(dependency.dependency);
assert buildFile != null;
OpenFileDescriptor navigatable = new OpenFileDescriptor(dependency.dependency.getProject(), buildFile, 0);
mySyncMessages.report(new SyncMessage(MISSING_DEPENDENCIES, WARNING, navigatable, msg));
}
reportModulesNotFoundIssues(getMissingModulesWithBackupLibraries());
clear();
}
Aggregations