use of com.aspose.cells.maven.utils.AsposeMavenProjectManager in project Aspose.Cells-for-Java by aspose-cells.
the class AsposeExampleWizardPanel method readSettings.
/**
* @param wiz
*/
@Override
public void readSettings(WizardDescriptor wiz) {
Project selectedProject = Templates.getProject(wiz);
File projdir = new File(selectedProject.getProjectDirectory().getPath());
wiz.putProperty("projdir", projdir);
AsposeMavenProjectManager asposeMavenProjectManager = AsposeMavenProjectManager.initialize(wiz);
AsposeCellsJavaAPI.initialize(asposeMavenProjectManager);
component.read();
}
use of com.aspose.cells.maven.utils.AsposeMavenProjectManager in project Aspose.Cells-for-Java by aspose-cells.
the class AsposeMavenProjectWizardIterator method instantiate.
/**
* @param ph
* @return
* @throws IOException
*/
@Override
public Set instantiate(ProgressHandle ph) throws IOException {
ph.start();
ph.switchToIndeterminate();
ph.progress("Processing...");
final AsposeMavenProjectManager asposeMavenProjectManager = AsposeMavenProjectManager.initialize(wiz);
final AsposeJavaAPI asposeCellsJavaAPI = AsposeCellsJavaAPI.initialize(asposeMavenProjectManager);
boolean isDownloadExamplesSelected = (boolean) wiz.getProperty("downloadExamples");
// Downloading Aspose.Cells Java (mvn based) examples...
if (isDownloadExamplesSelected) {
TasksExecutor tasksExecutionDownloadExamples = new TasksExecutor(NbBundle.getMessage(AsposeMavenProjectWizardIterator.class, "AsposeManager.progressExamplesTitle"));
// Downloading Aspose API mvn based examples
tasksExecutionDownloadExamples.addNewTask(asposeMavenProjectManager.createDownloadExamplesTask(asposeCellsJavaAPI));
// Execute the tasks
tasksExecutionDownloadExamples.processTasks();
}
TasksExecutor tasksExecutionRetrieve = new TasksExecutor(NbBundle.getMessage(AsposeMavenProjectWizardIterator.class, "AsposeManager.progressTitle"));
// Retrieving Aspose.Cells Java Maven artifact...
tasksExecutionRetrieve.addNewTask(asposeMavenProjectManager.retrieveAsposeAPIMavenTask(asposeCellsJavaAPI));
// Execute the tasks
tasksExecutionRetrieve.processTasks();
// Creating Maven project
ph.progress(NbBundle.getMessage(AsposeMavenProjectWizardIterator.class, "AsposeManager.projectMessage"));
Set<FileObject> resultSet = new LinkedHashSet<>();
File projectDir = FileUtil.normalizeFile((File) wiz.getProperty("projdir"));
projectDir.mkdirs();
FileObject template = Templates.getTemplate(wiz);
FileObject projectRoot = FileUtil.toFileObject(projectDir);
createAsposeMavenProject(template.getInputStream(), projectRoot);
createStartupPackage(projectRoot);
resultSet.add(projectRoot);
// Look for nested projects to open as well:
Enumeration<? extends FileObject> e = projectRoot.getFolders(true);
while (e.hasMoreElements()) {
FileObject subfolder = e.nextElement();
if (ProjectManager.getDefault().isProject(subfolder)) {
resultSet.add(subfolder);
}
}
File parent = projectDir.getParentFile();
if (parent != null && parent.exists()) {
ProjectChooser.setProjectsFolder(parent);
}
ph.finish();
return resultSet;
}
use of com.aspose.cells.maven.utils.AsposeMavenProjectManager in project Aspose.Cells-for-Java by aspose-cells.
the class AsposeMavenProjectSupport method createProject.
private IProject createProject(IProgressMonitor monitor) {
IProject project = createBaseProject(projectName, location);
try {
monitor.setTaskName("Creating project...");
String[] paths = { "src/main/java/" + packageName.replace(".", "/"), "src/test/java", "src/main/resources" };
addToProjectStructure(project, paths);
Files.copy(new File(Activator.getResourceFilePath("pom-xml-template.txt")).toPath(), new File(location.getPath() + "/pom.xml").toPath());
Files.copy(new File(Activator.getResourceFilePath("classpath-template.txt")).toPath(), new File(location.getPath() + "/.classpath").toPath());
Files.createDirectories(new File(location.getPath() + "/.settings").toPath());
Files.copy(new File(Activator.getResourceFilePath("org-eclipse-jdt-core.txt")).toPath(), new File(location.getPath() + "/.settings/org.eclipse.jdt.core.prefs").toPath());
AsposeMavenProjectManager asposeMavenProjectManager = AsposeMavenProjectManager.initialize(new File(location));
asposeMavenProjectManager.configureProjectMavenPOM(groupId, projectName, version);
project.refreshLocal(IResource.DEPTH_INFINITE, null);
if (downloadExamples) {
monitor.setTaskName("Downloading code examples...");
AsposeMavenProjectManager.initialize(new File(location));
AsposeJavaAPI component = AsposeCellsJavaAPI.initialize(AsposeMavenProjectManager.getInstance());
component.checkAndUpdateRepo();
}
} catch (CoreException e) {
e.printStackTrace();
project = null;
} catch (IOException e) {
e.printStackTrace();
}
return project;
}
Aggregations