本文整理汇总了Java中com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl类的典型用法代码示例。如果您正苦于以下问题:Java FileEditorManagerImpl类的具体用法?Java FileEditorManagerImpl怎么用?Java FileEditorManagerImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileEditorManagerImpl类属于com.intellij.openapi.fileEditor.impl包,在下文中一共展示了FileEditorManagerImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getData
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
@Override
public Object getData(final String dataId) {
final Editor e = validateCurrentEditor();
if (e == null) return null;
if (!myProject.isDisposed()) {
final Object o = ((FileEditorManagerImpl)FileEditorManager.getInstance(myProject)).getData(dataId, e, myFile);
if (o != null) return o;
}
if (PlatformDataKeys.EDITOR.is(dataId)) {
return e;
}
if (PlatformDataKeys.VIRTUAL_FILE.is(dataId)) {
return myFile.isValid()? myFile : null; // fix for SCR 40329
}
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:TextEditorComponent.java
示例2: apply
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
public Result apply(final VirtualFile fileToPatch,
final ApplyPatchContext context,
final Project project,
FilePath pathBeforeRename,
Getter<CharSequence> baseContents, CommitContext commitContext) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("apply patch called for : " + fileToPatch.getPath());
}
context.addAffectedFile(getTarget(fileToPatch));
if (myPatch.isNewFile()) {
applyCreate(fileToPatch, commitContext);
} else if (myPatch.isDeletedFile()) {
FileEditorManagerImpl.getInstance(project).closeFile(fileToPatch);
fileToPatch.delete(this);
}
else {
return applyChange(project, fileToPatch, pathBeforeRename, baseContents);
}
return SUCCESS;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ApplyFilePatchBase.java
示例3: collectDescriptorsForEditor
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
public static void collectDescriptorsForEditor(@Nonnull Editor editor, @Nonnull List<HighlightInfo.IntentionActionDescriptor> descriptors) {
Project project = editor.getProject();
if (project == null) return;
FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
if (!(fileEditorManager instanceof FileEditorManagerImpl)) return;
TextEditor fileEditor = TextEditorProvider.getInstance().getTextEditor(editor);
List<JComponent> components = ((FileEditorManagerImpl)fileEditorManager).getTopComponents(fileEditor);
for (JComponent component : components) {
if (component instanceof IntentionActionProvider) {
IntentionActionWithOptions action = ((IntentionActionProvider)component).getIntentionAction();
if (action != null) {
descriptors.add(new HighlightInfo.IntentionActionDescriptor(action, action.getOptions(), null));
}
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:EditorNotificationActions.java
示例4: getActiveEditor
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
public static Editor getActiveEditor( Project project )
{
if( FileEditorManager.getInstance( project ) instanceof FileEditorManagerImpl )
{
// get the active editor without having to use the dispatch thread, which otherwise can cause deadlock
return DataManager.getInstance().getDataContext( KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner() ).getData( PlatformDataKeys.EDITOR );
}
else
{
return FileEditorManager.getInstance( project ).getSelectedTextEditor();
}
}
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:13,代码来源:ResourceToManifoldUtil.java
示例5: setUp
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
DockManager dockManager = DockManager.getInstance(getProject());
myOldDockContainers = dockManager.getContainers();
myManager = new FileEditorManagerImpl(getProject(), dockManager, EditorHistoryManager.getInstance(getProject()));
myOldManager = ((ComponentManagerImpl)getProject()).registerComponentInstance(FileEditorManager.class, myManager);
((FileEditorProviderManagerImpl)FileEditorProviderManager.getInstance()).clearSelectedProviders();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FileEditorManagerTestCase.java
示例6: refreshIcons
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
public void refreshIcons() {
if (this instanceof FileEditorManagerImpl) {
final FileEditorManagerImpl mgr = (FileEditorManagerImpl)this;
Set<EditorsSplitters> splitters = mgr.getAllSplitters();
for (EditorsSplitters each : splitters) {
for (VirtualFile file : mgr.getOpenFiles()) {
each.updateFileIcon(file);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileEditorManagerEx.java
示例7: checkUpdate
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
private void checkUpdate() {
if (myProject.isDisposed()) return;
final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
final boolean insideToolwindow = SwingUtilities.isDescendingFrom(myToolWindow.getComponent(), owner);
if (!myFirstRun && (insideToolwindow || JBPopupFactory.getInstance().isPopupActive())) {
return;
}
final DataContext dataContext = DataManager.getInstance().getDataContext(owner);
if (dataContext.getData(myKey) == this) return;
if (CommonDataKeys.PROJECT.getData(dataContext) != myProject) return;
final VirtualFile[] files = hasFocus() ? null : CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
if (!myToolWindow.isVisible()) {
if (files != null && files.length > 0) {
myFile = files[0];
}
return;
}
if (files != null && files.length == 1) {
setFile(files[0]);
}
else if (files != null && files.length > 1) {
setFile(null);
} else if (myFirstRun) {
final FileEditorManagerImpl editorManager = (FileEditorManagerImpl)FileEditorManager.getInstance(myProject);
final List<Pair<VirtualFile,EditorWindow>> history = editorManager.getSelectionHistory();
if (! history.isEmpty()) {
setFile(history.get(0).getFirst());
}
}
myFirstRun = false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:StructureViewWrapperImpl.java
示例8: dispose
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
@Override
public void dispose() {
Boolean closingToReopen = myFile.getUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN);
myWaitFor.detach();
if (closingToReopen == null || !closingToReopen) {
myFile.getTerminal().close();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:TerminalSessionEditor.java
示例9: setUpProject
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
@Override
protected void setUpProject() throws Exception {
String projectPath = PathManagerEx.getTestDataPath() + "/model/model.ipr";
myProject = ProjectManager.getInstance().loadAndOpenProject(projectPath);
MutablePicoContainer container = (MutablePicoContainer)getProject().getPicoContainer();
container.unregisterComponent(FileEditorManager.class.getName());
((ProjectImpl)getProject()).registerComponentImplementation(FileEditorManager.class, FileEditorManagerImpl.class);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:LoadProjectTest.java
示例10: navigate
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
void navigate() {
final Object[] values = getSelectedList().getSelectedValues();
myPopup.closeOk(null);
if (values.length > 0 && values[0] instanceof ToolWindow) {
((ToolWindow)values[0]).activate(null, true, true);
} else{
IdeFocusManager.getInstance(project).doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
final FileEditorManagerImpl manager = (FileEditorManagerImpl)FileEditorManager.getInstance(project);
for (Object value : values) {
if (value instanceof FileInfo) {
final FileInfo info = (FileInfo)value;
if (info.second != null) {
EditorWindow wnd = findAppropriateWindow(info);
if (wnd != null) {
manager.openFileImpl2(wnd, info.first, true);
manager.addSelectionRecord(info.first, wnd);
}
} else {
manager.openFile(info.first, true, true);
}
}
}
}
});
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:Switcher.java
示例11: setUp
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
public void setUp() throws Exception {
super.setUp();
myManager = new FileEditorManagerImpl(getProject(), DockManager.getInstance(getProject()));
((ComponentManagerImpl)getProject()).registerComponentInstance(FileEditorManager.class, myManager);
((IdeDocumentHistoryImpl)IdeDocumentHistory.getInstance(getProject())).projectOpened();
EditorHistoryManager.getInstance(getProject()).projectOpened();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:HeavyFileEditorManagerTestCase.java
示例12: calcData
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
@Override
public void calcData(DataKey key, DataSink sink) {
if (OpenFileDescriptor.NAVIGATE_IN_EDITOR == key) {
sink.put(OpenFileDescriptor.NAVIGATE_IN_EDITOR, myConsoleEditor);
return;
}
else if (getProject().isInitialized()) {
FileEditorManager editorManager = FileEditorManager.getInstance(getProject());
final Object o = ((FileEditorManagerImpl)editorManager).getData(key.getName(), myConsoleEditor, myVirtualFile);
sink.put(key, o);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:LanguageConsoleImpl.java
示例13: checkUpdate
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
private void checkUpdate() {
if (myProject.isDisposed()) return;
final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
final boolean insideToolwindow = SwingUtilities.isDescendingFrom(myToolWindow.getComponent(), owner);
if (!myFirstRun && (insideToolwindow || JBPopupFactory.getInstance().isPopupActive())) {
return;
}
final DataContext dataContext = DataManager.getInstance().getDataContext(owner);
if (dataContext.getData(myKey) == this) return;
if (PlatformDataKeys.PROJECT.getData(dataContext) != myProject) return;
final VirtualFile[] files = hasFocus() ? null : PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
if (!myToolWindow.isVisible()) {
if (files != null && files.length > 0) {
myFile = files[0];
}
return;
}
if (files != null && files.length == 1) {
setFile(files[0]);
}
else if (files != null && files.length > 1) {
setFile(null);
} else if (myFirstRun) {
final FileEditorManagerImpl editorManager = (FileEditorManagerImpl)FileEditorManager.getInstance(myProject);
final List<Pair<VirtualFile,EditorWindow>> history = editorManager.getSelectionHistory();
if (! history.isEmpty()) {
setFile(history.get(0).getFirst());
}
}
myFirstRun = false;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:StructureViewWrapperImpl.java
示例14: dispose
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
@Override
public void dispose()
{
Boolean closingToReopen = myFile.getUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN);
myWaitFor.detach();
if(closingToReopen == null || !closingToReopen)
{
myFile.getTerminal().close();
}
}
开发者ID:consulo,项目名称:consulo-terminal,代码行数:11,代码来源:TerminalSessionEditor.java
示例15: refreshIcons
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
public void refreshIcons() {
if (this instanceof FileEditorManagerImpl) {
final FileEditorManagerImpl mgr = (FileEditorManagerImpl)this;
Set<EditorSplitters> splitters = mgr.getAllSplitters();
for (EditorSplitters each : splitters) {
for (VirtualFile file : mgr.getOpenFiles()) {
each.updateFileIcon(file);
}
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:FileEditorManagerEx.java
示例16: createNewDockContainerFor
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
@Nonnull
public Pair<FileEditor[], FileEditorProvider[]> createNewDockContainerFor(@Nonnull VirtualFile file, @Nonnull FileEditorManagerImpl fileEditorManager) {
DockContainer container = getFactory(DockableEditorContainerFactory.TYPE).createContainer(null);
register(container);
final DockWindow window = createWindowFor(null, container);
window.show(true);
final EditorWindow editorWindow = ((DockableEditorTabbedContainer)container).getSplitters().getOrCreateCurrentWindow(file);
final Pair<FileEditor[], FileEditorProvider[]> result = fileEditorManager.openFileImpl2(editorWindow, file, true);
container.add(EditorTabbedContainer.createDockableEditor(myProject, null, file, new Presentation(file.getName()), editorWindow), null);
SwingUtilities.invokeLater(() -> window.myUiContainer.setPreferredSize(null));
return result;
}
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:DockManagerImpl.java
示例17: checkUpdate
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
private void checkUpdate() {
if (myProject.isDisposed()) return;
final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
final boolean insideToolwindow = SwingUtilities.isDescendingFrom(myToolWindow.getComponent(), owner);
if (!myFirstRun && (insideToolwindow || JBPopupFactory.getInstance().isPopupActive())) {
return;
}
final DataContext dataContext = DataManager.getInstance().getDataContext(owner);
if (dataContext.getData(ourDataSelectorKey) == this) return;
if (dataContext.getData(CommonDataKeys.PROJECT) != myProject) return;
final VirtualFile[] files = hasFocus() ? null : dataContext.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (!myToolWindow.isVisible()) {
if (files != null && files.length > 0) {
myFile = files[0];
}
return;
}
if (files != null && files.length == 1) {
setFile(files[0]);
}
else if (files != null && files.length > 1) {
setFile(null);
} else if (myFirstRun) {
final FileEditorManagerImpl editorManager = (FileEditorManagerImpl)FileEditorManager.getInstance(myProject);
final List<Pair<VirtualFile, EditorWindow>> history = editorManager.getSelectionHistory();
if (! history.isEmpty()) {
setFile(history.get(0).getFirst());
}
}
myFirstRun = false;
}
开发者ID:consulo,项目名称:consulo,代码行数:37,代码来源:StructureViewWrapperImpl.java
示例18: setUpProject
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
@Override
protected void setUpProject() throws Exception {
String projectPath = "/model/model.ipr";
myProject = ProjectManager.getInstance().loadAndOpenProject(projectPath);
MutablePicoContainer container = (MutablePicoContainer)getProject().getPicoContainer();
container.unregisterComponent(FileEditorManager.class.getName());
((ProjectImpl)getProject()).registerComponentImplementation(FileEditorManager.class, FileEditorManagerImpl.class);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:LoadProjectTest.java
示例19: navigateToFrame
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
private void navigateToFrame(@NotNull XStackFrame frame, boolean focusOnEditor)
{
XSourcePosition position = frame.getSourcePosition();
if(position == null)
{
return;
}
VirtualFile file = position.getFile();
int line = position.getLine();
Project project = myDebugProcess.getProject();
OpenFileHyperlinkInfo info = new OpenFileHyperlinkInfo(project, file, line);
OpenFileDescriptor descriptor = info.getDescriptor();
if(descriptor != null)
{
FileEditorManagerImpl manager = (FileEditorManagerImpl) FileEditorManager.getInstance(project);
VirtualFile lastFile = myEditorState.myLastOpenedFile;
if(myEditorState.myIsNeedToCloseLastOpenedFile && lastFile != null && manager.isFileOpen(lastFile) && !lastFile.equals(descriptor.getFile()))
{
manager.closeFile(myEditorState.myLastOpenedFile, false, true);
}
descriptor.setScrollType(ScrollType.CENTER);
descriptor.setUseCurrentWindow(true);
if(lastFile == null || !lastFile.equals(descriptor.getFile()))
{
myEditorState.myIsNeedToCloseLastOpenedFile = !manager.isFileOpen(descriptor.getFile());
}
descriptor.navigateInEditor(project, focusOnEditor);
FileEditor[] editors = manager.getEditors(descriptor.getFile());
if(editors.length != 0)
{
myEditorState.myLastOpenedFile = descriptor.getFile();
}
}
}
开发者ID:consulo,项目名称:consulo-java,代码行数:41,代码来源:StackFrameList.java
示例20: findNearest
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; //导入依赖的package包/类
public static SourcePosition findNearest(@NotNull DebuggerContextImpl context, @NotNull PsiElement psi, @NotNull PsiFile file) {
final DebuggerSession session = context.getDebuggerSession();
if (session != null) {
try {
final XDebugSession debugSession = session.getXDebugSession();
if (debugSession != null) {
final XSourcePosition position = debugSession.getCurrentPosition();
Editor editor = ((FileEditorManagerImpl)FileEditorManager.getInstance(file.getProject())).getSelectedTextEditor(true);
//final Editor editor = fileEditor instanceof TextEditorImpl ? ((TextEditorImpl)fileEditor).getEditor() : null;
if (editor != null && position != null && file.getVirtualFile().equals(position.getFile())) {
PsiMethod method = PsiTreeUtil.getParentOfType(PositionUtil.getContextElement(context), PsiMethod.class, false);
final Couple<Collection<TextRange>> usages =
IdentifierHighlighterPass.getHighlightUsages(psi, method != null ? method : file, false);
final List<TextRange> ranges = new ArrayList<TextRange>();
ranges.addAll(usages.first);
ranges.addAll(usages.second);
final int breakPointLine = position.getLine();
int bestLine = -1;
int bestOffset = -1;
for (TextRange range : ranges) {
final int line = editor.offsetToLogicalPosition(range.getStartOffset()).line;
if (line > bestLine && line < breakPointLine) {
bestLine = line;
bestOffset = range.getStartOffset();
} else if (line == breakPointLine) {
bestOffset = range.getStartOffset();
break;
}
}
if (bestOffset > -1) {
return SourcePosition.createFromOffset(file, bestOffset);
}
}
}
}
catch (Exception ignore) {
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:DebuggerContextUtil.java
注:本文中的com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论