@After public void tearDown() throws Exception { UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { try { myVcsManager.unregisterVcs(myVcs); myVcsManager = null; myVcs = null; ((ProjectComponent)myChangeListManager).projectClosed(); ((ProjectComponent)myVcsDirtyScopeManager).projectClosed(); tearDownProject(); if (myTempDirFixture != null) { myTempDirFixture.tearDown(); myTempDirFixture = null; } FileUtil.delete(myClientRoot); } catch (Exception e) { throw new RuntimeException(e); } } }); }
public void projectOpened() { final ProjectComponent[] components = getComponents(ProjectComponent.class); for (ProjectComponent component : components) { try { component.projectOpened(); } catch (Throwable e) { LOG.error(component.toString(), e); } } }
@Override public void updateJavaParameters(RunConfigurationBase configuration, JavaParameters params, RunnerSettings runnerSettings) { if (!isApplicableFor(configuration)) { return; } ApplicationConfiguration appConfiguration = (ApplicationConfiguration) configuration; SnapShooterConfigurationSettings settings = appConfiguration.getUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY); if (settings == null) { settings = new SnapShooterConfigurationSettings(); appConfiguration.putUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY, settings); } if (appConfiguration.ENABLE_SWING_INSPECTOR) { settings.setLastPort(NetUtils.tryToFindAvailableSocketPort()); } if (appConfiguration.ENABLE_SWING_INSPECTOR && settings.getLastPort() != -1) { params.getProgramParametersList().prepend(appConfiguration.MAIN_CLASS_NAME); params.getProgramParametersList().prepend(Integer.toString(settings.getLastPort())); // add +1 because idea_rt.jar will be added as the last entry to the classpath params.getProgramParametersList().prepend(Integer.toString(params.getClassPath().getPathList().size() + 1)); Set<String> paths = new TreeSet<String>(); paths.add(PathUtil.getJarPathForClass(SnapShooter.class)); // ui-designer-impl paths.add(PathUtil.getJarPathForClass(BaseComponent.class)); // appcore-api paths.add(PathUtil.getJarPathForClass(ProjectComponent.class)); // openapi paths.add(PathUtil.getJarPathForClass(LwComponent.class)); // UIDesignerCore paths.add(PathUtil.getJarPathForClass(GridConstraints.class)); // forms_rt paths.add(PathUtil.getJarPathForClass(PaletteGroup.class)); // openapi paths.add(PathUtil.getJarPathForClass(LafManagerListener.class)); // ui-impl paths.add(PathUtil.getJarPathForClass(DataProvider.class)); // action-system-openapi paths.add(PathUtil.getJarPathForClass(XmlStringUtil.class)); // idea paths.add(PathUtil.getJarPathForClass(Navigatable.class)); // pom paths.add(PathUtil.getJarPathForClass(AreaInstance.class)); // extensions paths.add(PathUtil.getJarPathForClass(FormLayout.class)); // jgoodies paths.addAll(PathManager.getUtilClassPath()); for(String path: paths) { params.getClassPath().addFirst(path); } params.setMainClass("com.intellij.uiDesigner.snapShooter.SnapShooter"); } }
protected void startChangeProvider() { ((StartupManagerImpl) StartupManager.getInstance(myProject)).runPostStartupActivities(); myChangeListManager = ChangeListManager.getInstance(myProject); ((ProjectComponent) myChangeListManager).projectOpened(); myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject); ((ProjectComponent) myDirtyScopeManager).projectOpened(); // mapping myVcsManager = ProjectLevelVcsManager.getInstance(myProject); myVcsManager.setDirectoryMappings(Collections.singletonList(new VcsDirectoryMapping(myBaseVf.getPath(), FossilVcs.NAME))); }
protected void tearDownProject() throws Exception { if (myProject != null) { ((ProjectComponent) VcsDirtyScopeManager.getInstance(myProject)).projectClosed(); ((ProjectComponent) ChangeListManager.getInstance(myProject)).projectClosed(); ((ChangeListManagerImpl)ChangeListManager.getInstance(myProject)).stopEveryThingIfInTestMode(); ((ProjectComponent)ProjectLevelVcsManager.getInstance(myProject)).projectClosed(); myProject = null; } if (myProjectFixture != null) { myProjectFixture.tearDown(); myProjectFixture = null; } }
private void projectOpened() { final ProjectComponent[] components = getComponents(ProjectComponent.class); for (ProjectComponent component : components) { try { component.projectOpened(); } catch (Throwable e) { LOG.error(component.toString(), e); } } }
private void projectClosed() { List<ProjectComponent> components = new ArrayList<ProjectComponent>(Arrays.asList(getComponents(ProjectComponent.class))); Collections.reverse(components); for (ProjectComponent component : components) { try { component.projectClosed(); } catch (Throwable e) { LOG.error(e); } } }
@Override protected void tearDown() throws Exception { removeLibs(); ((ProjectComponent)ModuleManager.getInstance(myProject)).projectClosed(); super.tearDown(); }
@Override public void updateJavaParameters(RunConfigurationBase configuration, JavaParameters params, RunnerSettings runnerSettings) { if (!isApplicableFor(configuration)) { return; } ApplicationConfiguration appConfiguration = (ApplicationConfiguration) configuration; SnapShooterConfigurationSettings settings = appConfiguration.getUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY); if (settings == null) { settings = new SnapShooterConfigurationSettings(); appConfiguration.putUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY, settings); } if (appConfiguration.ENABLE_SWING_INSPECTOR) { try { settings.setLastPort(NetUtils.findAvailableSocketPort()); } catch(IOException ex) { settings.setLastPort(-1); } } if (appConfiguration.ENABLE_SWING_INSPECTOR && settings.getLastPort() != -1) { params.getProgramParametersList().prepend(appConfiguration.MAIN_CLASS_NAME); params.getProgramParametersList().prepend(Integer.toString(settings.getLastPort())); // add +1 because idea_rt.jar will be added as the last entry to the classpath params.getProgramParametersList().prepend(Integer.toString(params.getClassPath().getPathList().size() + 1)); Set<String> paths = new TreeSet<String>(); paths.add(PathUtil.getJarPathForClass(SnapShooter.class)); // ui-designer-impl paths.add(PathUtil.getJarPathForClass(BaseComponent.class)); // appcore-api paths.add(PathUtil.getJarPathForClass(ProjectComponent.class)); // openapi paths.add(PathUtil.getJarPathForClass(LwComponent.class)); // UIDesignerCore paths.add(PathUtil.getJarPathForClass(GridConstraints.class)); // forms_rt paths.add(PathUtil.getJarPathForClass(LafManagerListener.class)); // ui-impl paths.add(PathUtil.getJarPathForClass(DataProvider.class)); // action-system-openapi paths.add(PathUtil.getJarPathForClass(XmlStringUtil.class)); // idea paths.add(PathUtil.getJarPathForClass(Navigatable.class)); // pom paths.add(PathUtil.getJarPathForClass(AreaInstance.class)); // extensions paths.add(PathUtil.getJarPathForClass(FormLayout.class)); // jgoodies paths.addAll(PathManager.getUtilClassPath()); for(String path: paths) { params.getClassPath().addFirst(path); } params.setMainClass("com.intellij.uiDesigner.snapShooter.SnapShooter"); } }
@Before @Order(0) public void setUp() throws Throwable { PlatformTestCase.initPlatformLangPrefix(); IdeaTestApplication.getInstance(null); String tempFileName = getClass().getName() + "-" + new Random().nextInt(); myProjectFixture = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(tempFileName).getFixture(); edt(new ThrowableRunnable<Exception>() { @Override public void run() throws Exception { myProjectFixture.setUp(); } }); myProject = myProjectFixture.getProject(); ((ProjectComponent)ChangeListManager.getInstance(myProject)).projectOpened(); ((ProjectComponent)VcsDirtyScopeManager.getInstance(myProject)).projectOpened(); myProjectRoot = myProject.getBasePath(); myProjectDir = myProject.getBaseDir(); myTestRoot = myProjectRoot; myPlatformFacade = ServiceManager.getService(myProject, GitPlatformFacade.class); myGit = ServiceManager.getService(myProject, Git.class); mySettings = myPlatformFacade.getSettings(myProject); mySettings.getAppSettings().setPathToGit(GitExecutor.GIT_EXECUTABLE); // dynamic overriding is used instead of making it in plugin.xml, // because MockVcsHelper is not ready to be a full featured implementation for all tests. myVcsHelper = overrideService(myProject, AbstractVcsHelper.class, MockVcsHelper.class); myChangeListManager = (ChangeListManagerImpl)myPlatformFacade.getChangeListManager(myProject); myNotificator = (TestNotificator)ServiceManager.getService(myProject, Notificator.class); myVcs = GitVcs.getInstance(myProject); virtualCommits = new GitTestVirtualCommitsHolder(); myAsyncTasks = new ArrayList<Future>(); cd(myProjectRoot); myRepository = GitTestUtil.createRepository(myProject, myProjectRoot); ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl)ProjectLevelVcsManager.getInstance(myProject); AbstractVcs vcs = vcsManager.findVcsByName("Git"); Assert.assertEquals(1, vcsManager.getRootsUnderVcs(vcs).length); assumeSupportedGitVersion(); }
@Override public void updateJavaParameters(RunConfigurationBase configuration, OwnJavaParameters params, RunnerSettings runnerSettings) { if (!isApplicableFor(configuration)) { return; } ApplicationConfiguration appConfiguration = (ApplicationConfiguration) configuration; SnapShooterConfigurationSettings settings = appConfiguration.getUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY); if (settings == null) { settings = new SnapShooterConfigurationSettings(); appConfiguration.putUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY, settings); } if (appConfiguration.ENABLE_SWING_INSPECTOR) { try { settings.setLastPort(NetUtils.findAvailableSocketPort()); } catch(IOException ex) { settings.setLastPort(-1); } } if (appConfiguration.ENABLE_SWING_INSPECTOR && settings.getLastPort() != -1) { params.getProgramParametersList().prepend(appConfiguration.MAIN_CLASS_NAME); params.getProgramParametersList().prepend(Integer.toString(settings.getLastPort())); // add +1 because idea_rt.jar will be added as the last entry to the classpath params.getProgramParametersList().prepend(Integer.toString(params.getClassPath().getPathList().size() + 1)); Set<String> paths = new TreeSet<String>(); paths.add(PathUtil.getJarPathForClass(SnapShooter.class)); // ui-designer-impl paths.add(PathUtil.getJarPathForClass(BaseComponent.class)); // appcore-api paths.add(PathUtil.getJarPathForClass(ProjectComponent.class)); // openapi paths.add(PathUtil.getJarPathForClass(LwComponent.class)); // UIDesignerCore paths.add(PathUtil.getJarPathForClass(GridConstraints.class)); // forms_rt paths.add(PathUtil.getJarPathForClass(LafManagerListener.class)); // ui-impl paths.add(PathUtil.getJarPathForClass(DataProvider.class)); // action-system-openapi paths.add(PathUtil.getJarPathForClass(XmlStringUtil.class)); // idea paths.add(PathUtil.getJarPathForClass(Navigatable.class)); // pom paths.add(PathUtil.getJarPathForClass(AreaInstance.class)); // extensions paths.add(PathUtil.getJarPathForClass(FormLayout.class)); // jgoodies paths.addAll(PathManager.getUtilClassPath()); for(String path: paths) { params.getClassPath().addFirst(path); } params.setMainClass("com.intellij.uiDesigner.snapShooter.SnapShooter"); } }