public void installSymfony(IProgressMonitor monitor) { if (monitor == null) monitor = new NullProgressMonitor(); SymfonyProjectWizardFirstPage firstPage = (SymfonyProjectWizardFirstPage) fFirstPage; monitor.beginTask("Installing symfony...", 100); monitor.worked(10); IProject projectHandle = fFirstPage.getProjectHandle(); final IScriptProject scriptProject = DLTKCore.create(projectHandle); File file = null; final List<IBuildpathEntry> entries = new ArrayList<IBuildpathEntry>(); level = 0; try { file = new File(firstPage.getLibraryPath()); symfonyPath = new Path(firstPage.getLibraryPath()).toString(); if (file.isDirectory()) { final File[] files = file.listFiles(); if (!scriptProject.isOpen()) { scriptProject.open(monitor); } if (files != null && scriptProject != null && scriptProject.isOpen()) { for (File f : files) { importFile(f, scriptProject.getProject(), entries); } BuildPathUtils.addEntriesToBuildPath(scriptProject, entries); monitor.worked(90); } } } catch (ModelException e) { e.printStackTrace(); Logger.logException(e); } catch (Exception e) { e.printStackTrace(); Logger.logException(e); } finally { monitor.worked(100); monitor.done(); } }
@Override protected void updateProject(IProgressMonitor monitor) throws CoreException, InterruptedException { IProject projectHandle = fFirstPage.getProjectHandle(); IScriptProject create = DLTKCore.create(projectHandle); super.init(create, null, false); fCurrProjectLocation = getProjectLocationURI(); boolean installSymfony = true; if (monitor == null) { monitor = new NullProgressMonitor(); } try { monitor.beginTask(NewWizardMessages.ScriptProjectWizardSecondPage_operation_initialize, 70); if (monitor.isCanceled()) { throw new OperationCanceledException(); } URI realLocation = fCurrProjectLocation; if (fCurrProjectLocation == null) { // inside workspace try { URI rootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocationURI(); realLocation = new URI( rootLocation.getScheme(), null, Path.fromPortableString(rootLocation.getPath()) .append(getProject().getName()) .toString(), null); } catch (URISyntaxException e) { Assert.isTrue(false, "Can't happen"); // $NON-NLS-1$ } } rememberExistingFiles(realLocation); createProject(getProject(), fCurrProjectLocation, new SubProgressMonitor(monitor, 20)); IBuildpathEntry[] buildpathEntries = null; IncludePath[] includepathEntries = null; SymfonyProjectWizardFirstPage firstPage = (SymfonyProjectWizardFirstPage) fFirstPage; if (firstPage.getDetect()) { installSymfony = false; includepathEntries = setProjectBaseIncludepath(); if (!getProject().getFile(FILENAME_BUILDPATH).exists()) { IDLTKLanguageToolkit toolkit = DLTKLanguageManager.getLanguageToolkit(getScriptNature()); final BuildpathDetector detector = createBuildpathDetector(monitor, toolkit); buildpathEntries = detector.getBuildpath(); } else { monitor.worked(20); } } else if (firstPage.hasSymfonyStandardEdition()) { // flat project layout IPath projectPath = getProject().getFullPath(); List cpEntries = new ArrayList(); cpEntries.add(DLTKCore.newSourceEntry(projectPath)); // buildpathEntries = (IBuildpathEntry[]) cpEntries // .toArray(new IBuildpathEntry[cpEntries.size()]); // includepathEntries = setProjectBaseIncludepath(); buildpathEntries = new IBuildpathEntry[0]; includepathEntries = new IncludePath[0]; monitor.worked(20); } else { // flat project layout IPath projectPath = getProject().getFullPath(); List cpEntries = new ArrayList(); cpEntries.add(DLTKCore.newSourceEntry(projectPath)); // buildpathEntries = (IBuildpathEntry[]) cpEntries // .toArray(new IBuildpathEntry[cpEntries.size()]); // includepathEntries = setProjectBaseIncludepath(); buildpathEntries = new IBuildpathEntry[0]; includepathEntries = new IncludePath[0]; monitor.worked(20); } if (monitor.isCanceled()) { throw new OperationCanceledException(); } init(DLTKCore.create(getProject()), buildpathEntries, false); // setting PHP4/5 and ASP-Tags : setPhpLangOptions(); configureScriptProject(new SubProgressMonitor(monitor, 30)); SymfonyProjectWizardFirstPage p = (SymfonyProjectWizardFirstPage) getFirstPage(); // checking and adding JS nature,libs, include path if needed if (p.shouldSupportJavaScript()) { addJavaScriptNature(monitor); } // adding build paths, and language-Container: getScriptProject().setRawBuildpath(buildpathEntries, new NullProgressMonitor()); LanguageModelInitializer.enableLanguageModelFor(getScriptProject()); // init, and adding include paths: getBuildPathsBlock().init(getScriptProject(), new IBuildpathEntry[] {}); IncludePathManager.getInstance().setIncludePath(getProject(), includepathEntries); if (installSymfony) installSymfony(new SubProgressMonitor(monitor, 50)); } finally { monitor.done(); } }