Java 类com.intellij.openapi.project.ProjectManagerAdapter 实例源码

项目:intellij-ce-playground    文件:EditorFactoryImpl.java   
public EditorFactoryImpl(ProjectManager projectManager) {
  projectManager.addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectOpened(final Project project) {
      // validate all editors are disposed after fireProjectClosed() was called, because it's the place where editor should be released
      Disposer.register(project, new Disposable() {
        @Override
        public void dispose() {
          final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
          final boolean isLastProjectClosed = openProjects.length == 0;
          validateEditorsAreReleased(project, isLastProjectClosed);
        }
      });
    }
  });
}
项目:intellij-ce-playground    文件:ApplicationStatisticsPersistenceComponent.java   
@Override
public void initComponent() {
  ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() {
    @Override
    public void appClosing() {
      persistOpenedProjects();
      persistOnClosing = false;
    }
  });

  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectClosing(Project project) {
      if (persistOnClosing && project != null) {
        doPersistProjectUsages(project);
      }
    }
  });

  persistPeriodically();
}
项目:form-follows-function    文件:F3Plugin.java   
public void initComponent() {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
        public void run() {
            FileTypeManager.getInstance().registerFileType(F3_FILE_TYPE, F3_FILE_EXTENSION);

            ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
                public void projectOpened(Project project) {
                    CompilerManager compilerManager = CompilerManager.getInstance(project);
                    compilerManager.addCompiler(new F3Compiler());
                    compilerManager.addCompilableFileType(F3_FILE_TYPE);

                    DebuggerManager.getInstance (project).registerPositionManagerFactory (new Function<DebugProcess, PositionManager>() {
                        public PositionManager fun (DebugProcess debugProcess) {
                            return new F3PositionManager (debugProcess);
                        }
                    });
                }
            });
        }
    });
}
项目:tools-idea    文件:WelcomeFrame.java   
public WelcomeFrame() {
  JRootPane rootPane = getRootPane();
  final WelcomeScreen screen = createScreen(rootPane);

  final IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane);
  setGlassPane(glassPane);
  glassPane.setVisible(false);
  setContentPane(screen.getWelcomePanel());
  setTitle(ApplicationNamesInfo.getInstance().getFullProductName());
  AppUIUtil.updateWindowIcon(this);

  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectOpened(Project project) {
      dispose();
    }
  });

  myBalloonLayout = new BalloonLayoutImpl(rootPane.getLayeredPane(), new Insets(8, 8, 8, 8));

  myScreen = screen;
  setupCloseAction();
  new MnemonicHelper().register(this);
  myScreen.setupFrame(this);
}
项目:intellij-ce-playground    文件:WelcomeFrame.java   
public WelcomeFrame() {
  JRootPane rootPane = getRootPane();
  final WelcomeScreen screen = createScreen(rootPane);

  final IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane);
  setGlassPane(glassPane);
  glassPane.setVisible(false);
  setContentPane(screen.getWelcomePanel());
  setTitle(ApplicationNamesInfo.getInstance().getFullProductName());
  AppUIUtil.updateWindowIcon(this);

  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectOpened(Project project) {
      dispose();
    }
  });

  myBalloonLayout = new BalloonLayoutImpl(rootPane, new Insets(8, 8, 8, 8));

  myScreen = screen;
  setupCloseAction(this);
  MnemonicHelper.init(this);
  myScreen.setupFrame(this);
  Disposer.register(ApplicationManager.getApplication(), new Disposable() {
    @Override
    public void dispose() {
      WelcomeFrame.this.dispose();
    }
  });
}
项目:intellij-ce-playground    文件:DummyCachingFileSystem.java   
public DummyCachingFileSystem(String protocol) {
  myProtocol = protocol;

  final Application application = ApplicationManager.getApplication();
  application.getMessageBus().connect(application).subscribe(ProjectManager.TOPIC, new ProjectManagerAdapter() {
    @Override
    public void projectOpened(final Project project) {
      onProjectOpened(project);
    }
  });
  initProjectMap();
}
项目:intellij-ce-playground    文件:CompletionServiceImpl.java   
public CompletionServiceImpl() {
  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectClosing(Project project) {
      CompletionProgressIndicator indicator = getCurrentCompletion();
      if (indicator != null && indicator.getProject() == project) {
        indicator.closeAndFinish(true);
        setCompletionPhase(CompletionPhase.NoCompletion);
      }
      else if (indicator == null) {
        setCompletionPhase(CompletionPhase.NoCompletion);
      }
    }
  });
}
项目:intellij-ce-playground    文件:PsiCopyPasteManager.java   
public PsiCopyPasteManager(CopyPasteManager copyPasteManager, ProjectManager projectManager) {
  myCopyPasteManager = (CopyPasteManagerEx) copyPasteManager;
  projectManager.addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectClosing(Project project) {
      if (myRecentData != null && myRecentData.getProject() == project) {
        myRecentData = null;
      }
    }
  });
}
项目:intellij-ce-playground    文件:CoverageDataManagerImpl.java   
public void projectOpened() {
  EditorFactory.getInstance().addEditorFactoryListener(new CoverageEditorFactoryListener(), myProject);
  ProjectManagerAdapter projectManagerListener = new ProjectManagerAdapter() {
    public void projectClosing(Project project) {
      synchronized (myLock) {
        myIsProjectClosing = true;
      }
    }
  };
  ProjectManager.getInstance().addProjectManagerListener(myProject, projectManagerListener);
}
项目:intellij    文件:ProjectDependencyMigration.java   
@Override
public void initComponent() {
  ProjectManager projectManager = ProjectManager.getInstance();
  projectManager.addProjectManagerListener(
      new ProjectManagerAdapter() {
        @Override
        public void projectOpened(Project project) {
          if (Blaze.isBlazeProject(project)) {
            PluginDependencyHelper.addDependencyOnSyncPlugin(project);
          }
        }
      });
}
项目:intellij    文件:PrefetchProjectInitializer.java   
@Override
public void initComponent() {
  ProjectManager projectManager = ProjectManager.getInstance();
  projectManager.addProjectManagerListener(
      new ProjectManagerAdapter() {
        @Override
        public void projectOpened(Project project) {
          if (prefetchOnProjectOpen.getValue()) {
            prefetchProjectFiles(project);
          }
        }
      });
}
项目:tools-idea    文件:EditorFactoryImpl.java   
public EditorFactoryImpl(ProjectManager projectManager) {
  projectManager.addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectClosed(final Project project) {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          validateEditorsAreReleased(project);
        }
      });
    }
  });
}
项目:tools-idea    文件:CompletionServiceImpl.java   
public CompletionServiceImpl() {
  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectClosing(Project project) {
      CompletionProgressIndicator indicator = getCurrentCompletion();
      if (indicator != null && indicator.getProject() == project) {
        LookupManager.getInstance(indicator.getProject()).hideActiveLookup();
        setCompletionPhase(CompletionPhase.NoCompletion);
      }
      else if (indicator == null) {
        setCompletionPhase(CompletionPhase.NoCompletion);
      }
    }
  });
}
项目:tools-idea    文件:PsiCopyPasteManager.java   
public PsiCopyPasteManager(CopyPasteManager copyPasteManager, ProjectManager projectManager) {
  myCopyPasteManager = (CopyPasteManagerEx) copyPasteManager;
  projectManager.addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectClosing(Project project) {
      if (myRecentData != null && myRecentData.getProject() == project) {
        myRecentData = null;
      }
    }
  });
}
项目:consulo    文件:CoverageDataManagerImpl.java   
public void projectOpened() {
  EditorFactory.getInstance().addEditorFactoryListener(new CoverageEditorFactoryListener(), myProject);
  ProjectManagerAdapter projectManagerListener = new ProjectManagerAdapter() {
    public void projectClosing(Project project) {
      synchronized (myLock) {
        myIsProjectClosing = true;
      }
    }
  };
  ProjectManager.getInstance().addProjectManagerListener(myProject, projectManagerListener);
}
项目:consulo    文件:CompletionServiceImpl.java   
public CompletionServiceImpl() {
  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectClosing(Project project) {
      CompletionProgressIndicator indicator = getCurrentCompletion();
      if (indicator != null && indicator.getProject() == project) {
        indicator.closeAndFinish(true);
        setCompletionPhase(CompletionPhase.NoCompletion);
      } else if (indicator == null) {
        setCompletionPhase(CompletionPhase.NoCompletion);
      }
    }
  });
}
项目:consulo    文件:PsiCopyPasteManager.java   
public PsiCopyPasteManager(CopyPasteManager copyPasteManager, ProjectManager projectManager) {
  myCopyPasteManager = (CopyPasteManagerEx) copyPasteManager;
  projectManager.addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectClosing(Project project) {
      if (myRecentData != null && myRecentData.getProject() == project) {
        myRecentData = null;
      }
    }
  });
}
项目:consulo    文件:FlatWelcomeFrame.java   
@RequiredDispatchThread
public FlatWelcomeFrame() {
  final JRootPane rootPane = getRootPane();
  myScreen = new FlatWelcomeScreen(this);

  final IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane);

  setGlassPane(glassPane);
  glassPane.setVisible(false);
  //setUndecorated(true);
  setContentPane(myScreen);
  setDefaultTitle();
  AppUIUtil.updateWindowIcon(this);
  UIUtil.resetRootPaneAppearance(rootPane);
  setSize(TargetAWT.to(WelcomeFrameManager.getDefaultWindowSize()));
  setResizable(false);
  Point location = DimensionService.getInstance().getLocationNoRealKey(WelcomeFrame.DIMENSION_KEY);
  Rectangle screenBounds = ScreenUtil.getScreenRectangle(location != null ? location : new Point(0, 0));
  setLocation(new Point(screenBounds.x + (screenBounds.width - getWidth()) / 2, screenBounds.y + (screenBounds.height - getHeight()) / 3));

  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectOpened(Project project) {
      Disposer.dispose(FlatWelcomeFrame.this);
    }
  }, this);

  myBalloonLayout = new WelcomeDesktopBalloonLayoutImpl(rootPane, JBUI.insets(8), myScreen.getMainWelcomePanel().myEventListener, myScreen.getMainWelcomePanel().myEventLocation);

  setupCloseAction(this);
  MnemonicHelper.init(this);
  Disposer.register(ApplicationManager.getApplication(), this);
}
项目:intellij-ce-playground    文件:FlatWelcomeFrame.java   
public FlatWelcomeFrame() {
  final JRootPane rootPane = getRootPane();
  myScreen = new FlatWelcomeScreen();

  final IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane) {
    @Override
    public void addNotify() {
      super.addNotify();
      rootPane.remove(getProxyComponent());
      //noinspection SSBasedInspection
      SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          JBProtocolCommand.handleCurrentCommand();
        }
      });
    }
  };

  setGlassPane(glassPane);
  glassPane.setVisible(false);
  //setUndecorated(true);
  setContentPane(myScreen.getWelcomePanel());
  setTitle("Welcome to " + ApplicationNamesInfo.getInstance().getFullProductName());
  AppUIUtil.updateWindowIcon(this);
  final int width = RecentProjectsManager.getInstance().getRecentProjectsActions(false).length == 0 ? 666 : 777;
  setSize(JBUI.size(width, 460));
  setResizable(false);
  //int x = bounds.x + (bounds.width - getWidth()) / 2;
  //int y = bounds.y + (bounds.height - getHeight()) / 2;
  Point location = DimensionService.getInstance().getLocation(WelcomeFrame.DIMENSION_KEY, null);
  Rectangle screenBounds = ScreenUtil.getScreenRectangle(location != null ? location : new Point(0, 0));
  setLocation(new Point(
    screenBounds.x + (screenBounds.width - getWidth()) / 2,
    screenBounds.y + (screenBounds.height - getHeight()) / 3
  ));

  //setLocation(x, y);
  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
    @Override
    public void projectOpened(Project project) {
      dispose();
    }
  });

  myBalloonLayout = new BalloonLayoutImpl(rootPane, JBUI.insets(8));

  WelcomeFrame.setupCloseAction(this);
  MnemonicHelper.init(this);
  Disposer.register(ApplicationManager.getApplication(), new Disposable() {
    @Override
    public void dispose() {
      FlatWelcomeFrame.this.dispose();
    }
  });
}