Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7ffb5a5

Browse files
committedMar 25, 2016
Merge pull request #16 from ali-salman/master
Aspose.Slides Java Plugin for Eclipse - v1.0
2 parents b3d218f + 599d07c commit 7ffb5a5

38 files changed

+3502
-0
lines changed
 
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>AsposeSlidesEclipseFeature</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.pde.FeatureBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.pde.FeatureNature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin.includes = feature.xml
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<feature
3+
id="com.aspose.slides.java.maven"
4+
label="Aspose.Slides Java (Maven) for Eclipse"
5+
version="1.0"
6+
provider-name="http://www.aspose.com">
7+
8+
<description>
9+
Aspose.Slides Maven Project wizard creates Maven Project for using Aspose.Slides for Java API within Eclipse IDE.
10+
Aspose.Slides for Java is a unique PowerPoint management component that enables Java applications to read, write and manipulate PowerPoint documents (PPT, PPTX, POS, PPS, POTX, PPSX) PDF, HTML and image file formats without using Microsoft PowerPoint.
11+
Aspose.Slides for Java is the first and only Java component that provides functionality to manage PowerPoint documents within your own applications.
12+
Aspose.Slides Maven Project wizard fetch and configures the latest
13+
Maven dependency reference of Aspose.Slides for Java from the
14+
Aspose
15+
Cloud Maven Repository.
16+
The wizard also gives you option to download the Code Examples
17+
to use Aspose.Slides for Java API.
18+
Once you are finished with this wizard - created Maven project
19+
and downloaded Code Examples, next you can insert those Code
20+
Examples to use Aspose.Slides for Java API in your Project from
21+
File -&gt; New -&gt; Other -&gt; Aspose.Slides Code Example
22+
The newly created project and the Code Examples you added is
23+
now ready to be enhanced, all required resources and references
24+
are also automatically added.
25+
</description>
26+
27+
<license url="">
28+
The MIT License (MIT)
29+
Copyright (c) 2001-2016 Aspose Pty Ltd
30+
31+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
32+
33+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
34+
35+
THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36+
</license>
37+
38+
<plugin
39+
id="com.aspose.slides.java.maven.plugin"
40+
download-size="0"
41+
install-size="0"
42+
version="1.0.0"
43+
unpack="false"/>
44+
45+
</feature>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
4+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5+
<classpathentry kind="src" path="src"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>AsposeSlidesEclipsePlugin</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.pde.PluginNature</nature>
26+
<nature>org.eclipse.jdt.core.javanature</nature>
27+
</natures>
28+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4+
org.eclipse.jdt.core.compiler.compliance=1.7
5+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7+
org.eclipse.jdt.core.compiler.source=1.7
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = META-INF/,\
4+
.,\
5+
plugin.xml,\
6+
resources/
7+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.4"?>
3+
<plugin>
4+
<extension
5+
point="org.eclipse.ui.newWizards">
6+
<wizard
7+
category="org.eclipse.m2e"
8+
class="com.aspose.slides.maven.AsposeMavenProjectWizard"
9+
icon="resources/Aspose.png"
10+
id="asposeplugin.wizard.new.mavenprojectwizard"
11+
name="Aspose.Slides Maven Project"
12+
project="true">
13+
</wizard>
14+
<wizard
15+
category="org.eclipse.jdt.ui.java"
16+
class="com.aspose.slides.maven.examples.AsposeExampleWizard"
17+
icon="resources/Aspose.png"
18+
id="asposeplugin.wizard.new.mavenexamplewizard"
19+
name="Aspose.Slides Code Example"
20+
project="false">
21+
</wizard>
22+
</extension>
23+
24+
</plugin>
3.37 KB
Loading
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
</attributes>
19+
</classpathentry>
20+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21+
<attributes>
22+
<attribute name="maven.pomderived" value="true"/>
23+
</attributes>
24+
</classpathentry>
25+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
26+
<attributes>
27+
<attribute name="maven.pomderived" value="true"/>
28+
</attributes>
29+
</classpathentry>
30+
<classpathentry kind="output" path="target/classes"/>
31+
</classpath>
46.2 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
3+
org.eclipse.jdt.core.compiler.compliance=1.7
4+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5+
org.eclipse.jdt.core.compiler.source=1.7
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.mycompany</groupId>
5+
<artifactId>mavenproject1</artifactId>
6+
<version>2</version>
7+
<packaging>jar</packaging>
8+
<repositories>
9+
<repository>
10+
<id>Aspose-Maven-Repository</id>
11+
<name>Aspose Maven Repository</name>
12+
<url>http://maven.aspose.com/artifactory/simple/ext-release-local/</url>
13+
</repository>
14+
</repositories>
15+
<properties>
16+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17+
<maven.compiler.source>1.7</maven.compiler.source>
18+
<maven.compiler.target>1.7</maven.compiler.target>
19+
</properties>
20+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides;
13+
14+
import java.io.IOException;
15+
import java.net.URISyntaxException;
16+
import java.net.URL;
17+
import org.eclipse.core.runtime.FileLocator;
18+
import org.eclipse.ui.plugin.AbstractUIPlugin;
19+
import org.osgi.framework.BundleContext;
20+
21+
/**
22+
* The activator class controls the plug-in life cycle
23+
*/
24+
public class Activator extends AbstractUIPlugin {
25+
26+
// The plug-in ID
27+
public static final String PLUGIN_ID = "AsposeSlidesEclipsePlugin";
28+
29+
// The shared instance
30+
private static Activator plugin;
31+
32+
/**
33+
* The constructor
34+
*/
35+
public Activator() {
36+
}
37+
38+
public static String getResourceFilePath(String resourceFileName) {
39+
String fileURL = null;
40+
try {
41+
URL url = getDefault().getBundle().getEntry("resources/" + resourceFileName);
42+
fileURL = FileLocator.toFileURL(url).toURI().normalize().getPath();
43+
} catch (IOException | URISyntaxException e) {
44+
e.printStackTrace();
45+
}
46+
return fileURL;
47+
}
48+
49+
/*
50+
* (non-Javadoc)
51+
*
52+
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.
53+
* BundleContext)
54+
*/
55+
public void start(BundleContext context) throws Exception {
56+
super.start(context);
57+
plugin = this;
58+
}
59+
60+
/*
61+
* (non-Javadoc)
62+
*
63+
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.
64+
* BundleContext)
65+
*/
66+
public void stop(BundleContext context) throws Exception {
67+
plugin = null;
68+
super.stop(context);
69+
}
70+
71+
/**
72+
* Returns the shared instance
73+
*
74+
* @return the shared instance
75+
*/
76+
public static Activator getDefault() {
77+
return plugin;
78+
}
79+
80+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides;
13+
14+
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
15+
import org.eclipse.core.runtime.preferences.InstanceScope;
16+
17+
/**
18+
*
19+
* @author Adeel
20+
*/
21+
public final class MavenSettings {
22+
23+
private static final String PROP_LAST_ARCHETYPE_GROUPID = "lastArchetypeGroupId";
24+
private static final String PROP_LAST_ARCHETYPE_VERSION = "lastArchetypeVersion";
25+
26+
private IEclipsePreferences getPreferences() {
27+
return InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
28+
}
29+
30+
/**
31+
*
32+
* @return
33+
*/
34+
public String getLastArchetypeGroupId() {
35+
return getPreferences().get(PROP_LAST_ARCHETYPE_GROUPID, "com.mycompany");
36+
}
37+
38+
/**
39+
*
40+
* @return
41+
*/
42+
public String getLastArchetypeVersion() {
43+
return getPreferences().get(PROP_LAST_ARCHETYPE_VERSION, "1.0-SNAPSHOT");
44+
}
45+
46+
/**
47+
*
48+
* @param version
49+
*/
50+
public void setLastArchetypeVersion(String version) {
51+
putProperty(PROP_LAST_ARCHETYPE_VERSION, version);
52+
}
53+
54+
/**
55+
*
56+
* @param groupId
57+
*/
58+
public void setLastArchetypeGroupId(String groupId) {
59+
putProperty(PROP_LAST_ARCHETYPE_GROUPID, groupId);
60+
}
61+
62+
private String putProperty(String key, String value) {
63+
String retval = getProperty(key);
64+
if (value != null) {
65+
getPreferences().put(key, value);
66+
} else {
67+
getPreferences().remove(key);
68+
}
69+
return retval;
70+
}
71+
private static final MavenSettings INSTANCE = new MavenSettings();
72+
73+
/**
74+
*
75+
* @return
76+
*/
77+
public static MavenSettings getDefault() {
78+
return INSTANCE;
79+
}
80+
81+
private String getProperty(String key) {
82+
return getPreferences().get(key, null);
83+
}
84+
85+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven;
13+
14+
import java.net.URI;
15+
import java.nio.file.Files;
16+
import org.eclipse.core.resources.ICommand;
17+
import org.eclipse.core.resources.IContainer;
18+
import org.eclipse.core.resources.IFolder;
19+
import org.eclipse.core.resources.IProject;
20+
import org.eclipse.core.resources.IProjectDescription;
21+
import org.eclipse.core.resources.IResource;
22+
import org.eclipse.core.resources.ResourcesPlugin;
23+
import org.eclipse.core.runtime.CoreException;
24+
import org.eclipse.core.runtime.IProgressMonitor;
25+
import org.eclipse.jface.operation.IRunnableWithProgress;
26+
import com.aspose.slides.Activator;
27+
import com.aspose.slides.maven.utils.AsposeJavaAPI;
28+
import com.aspose.slides.maven.utils.AsposeMavenProjectManager;
29+
import com.aspose.slides.maven.utils.AsposeSlidesJavaAPI;
30+
import java.io.File;
31+
import java.io.IOException;
32+
import java.lang.reflect.InvocationTargetException;
33+
34+
public class AsposeMavenProjectSupport implements IRunnableWithProgress {
35+
36+
private String projectName;
37+
private URI location;
38+
private String packageName;
39+
private boolean downloadExamples;
40+
private String version;
41+
private String groupId;
42+
43+
public AsposeMavenProjectSupport(String projectName, URI location, String packageName, boolean downloadExamples,
44+
String version, String groupId) {
45+
this.projectName = projectName;
46+
this.location = location;
47+
this.packageName = packageName;
48+
this.downloadExamples = downloadExamples;
49+
this.version = version;
50+
this.groupId = groupId;
51+
}
52+
53+
@Override
54+
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
55+
monitor.beginTask("Processing...", IProgressMonitor.UNKNOWN);
56+
createProject(monitor);
57+
monitor.done();
58+
}
59+
60+
private IProject createProject(IProgressMonitor monitor) {
61+
IProject project = createBaseProject(projectName, location);
62+
try {
63+
monitor.setTaskName("Creating project...");
64+
String[] paths = { "src/main/java/" + packageName.replace(".", "/"), "src/test/java", "src/main/resources" };
65+
addToProjectStructure(project, paths);
66+
67+
Files.copy(new File(Activator.getResourceFilePath("pom-xml-template.txt")).toPath(),
68+
new File(location.getPath() + "/pom.xml").toPath());
69+
Files.copy(new File(Activator.getResourceFilePath("classpath-template.txt")).toPath(),
70+
new File(location.getPath() + "/.classpath").toPath());
71+
72+
Files.createDirectories(new File(location.getPath() + "/.settings").toPath());
73+
Files.copy(new File(Activator.getResourceFilePath("org-eclipse-jdt-core.txt")).toPath(),
74+
new File(location.getPath() + "/.settings/org.eclipse.jdt.core.prefs").toPath());
75+
76+
AsposeMavenProjectManager asposeMavenProjectManager = AsposeMavenProjectManager
77+
.initialize(new File(location));
78+
asposeMavenProjectManager.configureProjectMavenPOM(groupId, projectName, version);
79+
project.refreshLocal(IResource.DEPTH_INFINITE, null);
80+
81+
if (downloadExamples) {
82+
monitor.setTaskName("Downloading code examples...");
83+
AsposeMavenProjectManager.initialize(new File(location));
84+
AsposeJavaAPI component = AsposeSlidesJavaAPI.initialize(AsposeMavenProjectManager.getInstance());
85+
component.checkAndUpdateRepo();
86+
}
87+
88+
} catch (CoreException e) {
89+
e.printStackTrace();
90+
project = null;
91+
} catch (IOException e) {
92+
e.printStackTrace();
93+
}
94+
95+
return project;
96+
}
97+
98+
private IProject createBaseProject(String projectName, URI location) {
99+
IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
100+
String natures[] = { "org.eclipse.jdt.core.javanature", "org.eclipse.m2e.core.maven2Nature" };
101+
102+
if (!newProject.exists()) {
103+
URI projectLocation = location;
104+
IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName());
105+
106+
ICommand commandJavaBuilder = (ICommand) desc.newCommand();
107+
ICommand commandMaven2Builder = (ICommand) desc.newCommand();
108+
commandJavaBuilder.setBuilderName("org.eclipse.jdt.core.javabuilder");
109+
commandMaven2Builder.setBuilderName("org.eclipse.m2e.core.maven2Builder");
110+
ICommand buildspecs[] = { commandJavaBuilder, commandMaven2Builder };
111+
112+
desc.setBuildSpec(buildspecs);
113+
desc.setNatureIds(natures);
114+
115+
if (location != null && ResourcesPlugin.getWorkspace().getRoot().getLocationURI().equals(location)) {
116+
projectLocation = null;
117+
}
118+
119+
desc.setLocationURI(projectLocation);
120+
try {
121+
newProject.create(desc, null);
122+
if (!newProject.isOpen()) {
123+
newProject.open(null);
124+
}
125+
} catch (CoreException e) {
126+
e.printStackTrace();
127+
}
128+
}
129+
130+
return newProject;
131+
}
132+
133+
private void createFolder(IFolder folder) throws CoreException {
134+
IContainer parent = folder.getParent();
135+
if (parent instanceof IFolder) {
136+
createFolder((IFolder) parent);
137+
}
138+
if (!folder.exists()) {
139+
folder.create(false, true, null);
140+
}
141+
}
142+
143+
/**
144+
* Create a folder structure with a parent root, overlay, and a few child
145+
* folders.
146+
*
147+
* @param newProject
148+
* @param paths
149+
* @throws CoreException
150+
*/
151+
private void addToProjectStructure(IProject newProject, String[] paths) throws CoreException {
152+
for (String path : paths) {
153+
IFolder etcFolders = newProject.getFolder(path);
154+
createFolder(etcFolders);
155+
}
156+
}
157+
158+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven;
13+
14+
import java.lang.reflect.InvocationTargetException;
15+
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
16+
import org.eclipse.jface.viewers.IStructuredSelection;
17+
import org.eclipse.jface.wizard.Wizard;
18+
import org.eclipse.ui.INewWizard;
19+
import org.eclipse.ui.IWorkbench;
20+
21+
public class AsposeMavenProjectWizard extends Wizard implements INewWizard {
22+
23+
private AsposeMavenProjectWizardPage wizardPage;
24+
25+
public AsposeMavenProjectWizard() {
26+
setWindowTitle("Aspose.Slides Maven Project");
27+
}
28+
29+
@Override
30+
public void init(IWorkbench workbench, IStructuredSelection selection) {
31+
32+
}
33+
34+
@Override
35+
public void addPages() {
36+
super.addPages();
37+
wizardPage = new AsposeMavenProjectWizardPage();
38+
addPage(wizardPage);
39+
}
40+
41+
@Override
42+
public boolean performFinish() {
43+
AsposeMavenProjectSupport asposeMavenProjectSupport = new AsposeMavenProjectSupport(wizardPage.getProjectName(),
44+
wizardPage.getLocationURI(), wizardPage.getPackageName(), wizardPage.isDownloadExamplesChecked(),
45+
wizardPage.getVersion(), wizardPage.getGroupId());
46+
try {
47+
new ProgressMonitorDialog(this.getShell()).run(true, false, asposeMavenProjectSupport);
48+
} catch (InvocationTargetException | InterruptedException e) {
49+
e.printStackTrace();
50+
}
51+
return true;
52+
}
53+
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,370 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven;
13+
14+
import java.io.File;
15+
import java.net.URI;
16+
import org.eclipse.core.resources.IProject;
17+
import org.eclipse.core.resources.ResourcesPlugin;
18+
import org.eclipse.core.runtime.CoreException;
19+
import org.eclipse.jface.wizard.WizardPage;
20+
import org.eclipse.swt.SWT;
21+
import org.eclipse.swt.events.SelectionAdapter;
22+
import org.eclipse.swt.events.SelectionEvent;
23+
import org.eclipse.swt.widgets.Button;
24+
import org.eclipse.swt.widgets.Composite;
25+
import org.eclipse.swt.widgets.DirectoryDialog;
26+
import org.eclipse.swt.widgets.Label;
27+
import org.eclipse.swt.widgets.Shell;
28+
import org.eclipse.swt.widgets.Text;
29+
import org.eclipse.wb.swt.SWTResourceManager;
30+
import com.aspose.slides.Activator;
31+
import com.aspose.slides.maven.utils.MavenSettings;
32+
import org.eclipse.swt.events.ModifyListener;
33+
import org.eclipse.swt.events.ModifyEvent;
34+
import org.eclipse.jface.fieldassist.ControlDecoration;
35+
import org.eclipse.jface.fieldassist.FieldDecoration;
36+
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
37+
38+
public class AsposeMavenProjectWizardPage extends WizardPage {
39+
40+
public static final String PROP_PROJECT_NAME = "projectName";
41+
public static final String PROP_GROUP_ID = "groupId";
42+
43+
private Text txtProjectLocation;
44+
private Text txtProjectName;
45+
private Text txtProjectFolder;
46+
private Text txtArtifactId;
47+
private Text txtGroupId;
48+
private Text txtVersion;
49+
private Text txtPackage;
50+
private Button chkDownloadExamples;
51+
52+
private ControlDecoration txtProjectNameDecoration;
53+
private ControlDecoration txtProjectLocationDecoration;
54+
private ControlDecoration txtGroupIdDecoration;
55+
private ControlDecoration txtVersionDecoration;
56+
private ControlDecoration txtProjectFolderDecoration;
57+
private ControlDecoration txtPackageDecoration;
58+
59+
/**
60+
* Create the wizard.
61+
*/
62+
public AsposeMavenProjectWizardPage() {
63+
super("wizardPage");
64+
setTitle("New Project");
65+
setDescription("Name and Location");
66+
}
67+
68+
private String getDefaultProjectName() {
69+
String defaultName = "asposemavenproject";
70+
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
71+
try {
72+
for (int i = 1; i < 100; i++) {
73+
74+
boolean match = false;
75+
for (IProject project : projects) {
76+
if (project.getDescription().getName().equals(defaultName + i)) {
77+
match = true;
78+
break;
79+
}
80+
81+
}
82+
if (!match) {
83+
defaultName = defaultName + i;
84+
break;
85+
}
86+
}
87+
} catch (CoreException e) {
88+
e.printStackTrace();
89+
}
90+
return defaultName;
91+
}
92+
93+
private void initControls() {
94+
txtGroupId.setText(MavenSettings.getDefault().getLastArchetypeGroupId());
95+
txtVersion.setText(MavenSettings.getDefault().getLastArchetypeVersion());
96+
txtProjectName.setText(getDefaultProjectName());
97+
txtProjectName.setSelection(txtProjectName.getCharCount());
98+
txtProjectLocation.setText(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
99+
txtProjectFolder.setText(txtProjectLocation.getText() + File.separator + txtProjectName.getText());
100+
txtArtifactId.setText(txtProjectName.getText());
101+
txtPackage.setText(txtGroupId.getText() + "." + txtProjectName.getText());
102+
}
103+
104+
private void initDecorators() {
105+
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
106+
.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
107+
108+
txtProjectNameDecoration = new ControlDecoration(txtProjectName, SWT.TOP | SWT.RIGHT);
109+
txtProjectNameDecoration.setImage(fieldDecoration.getImage());
110+
txtProjectNameDecoration.hide();
111+
112+
txtProjectLocationDecoration = new ControlDecoration(txtProjectLocation, SWT.TOP | SWT.RIGHT);
113+
txtProjectLocationDecoration.setImage(fieldDecoration.getImage());
114+
txtProjectLocationDecoration.hide();
115+
116+
txtGroupIdDecoration = new ControlDecoration(txtGroupId, SWT.TOP | SWT.RIGHT);
117+
txtGroupIdDecoration.setImage(fieldDecoration.getImage());
118+
txtGroupIdDecoration.hide();
119+
120+
txtVersionDecoration = new ControlDecoration(txtVersion, SWT.TOP | SWT.RIGHT);
121+
txtVersionDecoration.setImage(fieldDecoration.getImage());
122+
txtVersionDecoration.hide();
123+
124+
txtProjectFolderDecoration = new ControlDecoration(txtProjectFolder, SWT.TOP | SWT.RIGHT);
125+
txtProjectFolderDecoration.setImage(fieldDecoration.getImage());
126+
txtProjectFolderDecoration.hide();
127+
128+
txtPackageDecoration = new ControlDecoration(txtPackage, SWT.TOP | SWT.RIGHT);
129+
txtPackageDecoration.setImage(fieldDecoration.getImage());
130+
txtPackageDecoration.hide();
131+
}
132+
133+
private void onProjectNameChange() {
134+
txtProjectNameDecoration.hide();
135+
setPageComplete(true);
136+
if (txtProjectName.getText().trim().length() == 0) {
137+
txtProjectNameDecoration.setDescriptionText("Project Name is not a valid folder name");
138+
txtProjectNameDecoration.show();
139+
setPageComplete(false);
140+
}
141+
txtProjectFolder.setText(txtProjectLocation.getText() + File.separator + txtProjectName.getText());
142+
txtArtifactId.setText(txtProjectName.getText());
143+
txtPackage.setText("com.mycompany." + txtProjectName.getText());
144+
}
145+
146+
private void onProjectLocationChange() {
147+
txtProjectLocationDecoration.hide();
148+
setPageComplete(true);
149+
if (!new File(txtProjectLocation.getText().trim()).isDirectory()) {
150+
txtProjectLocationDecoration.setDescriptionText("Project Folder is not a valid path");
151+
txtProjectLocationDecoration.show();
152+
setPageComplete(false);
153+
}
154+
txtProjectFolder.setText(txtProjectLocation.getText() + File.separator + txtProjectName.getText());
155+
}
156+
157+
private void onVersionChange() {
158+
txtVersionDecoration.hide();
159+
setPageComplete(true);
160+
if (txtVersion.getText().trim().length() == 0) {
161+
txtVersionDecoration.setDescriptionText("Version may not be empty");
162+
txtVersionDecoration.show();
163+
setPageComplete(false);
164+
}
165+
}
166+
167+
private void onPackageChange() {
168+
txtPackageDecoration.hide();
169+
setPageComplete(true);
170+
String packageName = txtPackage.getText().trim();
171+
if (!(packageName.equals("")
172+
|| packageName.matches("([\\p{L}_$][\\p{L}\\p{N}_$]*\\.)*[\\p{L}_$][\\p{L}\\p{N}_$]*"))) {
173+
txtPackageDecoration.setDescriptionText("Package may not be empty");
174+
txtPackageDecoration.show();
175+
setPageComplete(false);
176+
}
177+
}
178+
179+
private void onGroupIdChange() {
180+
txtGroupIdDecoration.hide();
181+
setPageComplete(true);
182+
if (txtGroupId.getText().trim().length() == 0) {
183+
txtGroupIdDecoration.setDescriptionText("GroupdId may not be empty");
184+
txtGroupIdDecoration.show();
185+
setPageComplete(false);
186+
}
187+
txtPackage.setText(txtGroupId.getText() + "." + txtProjectName.getText());
188+
}
189+
190+
private void onProjectFolderChange() {
191+
txtProjectFolderDecoration.hide();
192+
setPageComplete(true);
193+
File projLoc = new File(
194+
(new File(txtProjectLocation.getText()).getAbsoluteFile()).toURI().normalize().getPath());
195+
File destFolder = new File(
196+
(new File(txtProjectFolder.getText()).getAbsoluteFile()).toURI().normalize().getPath());
197+
198+
while (projLoc != null && !projLoc.exists()) {
199+
projLoc = projLoc.getParentFile();
200+
}
201+
if (projLoc == null || !projLoc.canWrite()) {
202+
txtProjectFolderDecoration.setDescriptionText("Project Folder cannot be created");
203+
txtProjectFolderDecoration.show();
204+
setPageComplete(false);
205+
} else {
206+
File[] kids = destFolder.listFiles();
207+
if (destFolder.exists() && kids != null && kids.length > 0) {
208+
txtProjectFolderDecoration.setDescriptionText("Project Folder already exists and is not empty");
209+
txtProjectFolderDecoration.show();
210+
setPageComplete(false);
211+
}
212+
}
213+
}
214+
215+
public String getProjectName() {
216+
return txtProjectName.getText();
217+
}
218+
219+
public String getPackageName() {
220+
return txtPackage.getText();
221+
}
222+
223+
public URI getLocationURI() {
224+
return new File(txtProjectFolder.getText()).toURI();
225+
}
226+
227+
public String getVersion() {
228+
return txtVersion.getText();
229+
}
230+
231+
public String getGroupId() {
232+
return txtGroupId.getText();
233+
}
234+
235+
public boolean isDownloadExamplesChecked() {
236+
return chkDownloadExamples.getSelection();
237+
}
238+
239+
/**
240+
* Create contents of the wizard.
241+
*
242+
* @param parent
243+
*/
244+
public void createControl(Composite parent) {
245+
Composite container = new Composite(parent, SWT.NULL);
246+
247+
setControl(container);
248+
249+
Label lblNewLabel = new Label(container, SWT.NONE);
250+
lblNewLabel.setImage(SWTResourceManager.getImage(Activator.getResourceFilePath("long_banner.png")));
251+
lblNewLabel.setBounds(10, 0, 500, 80);
252+
253+
Label lblPleaseEnterProject = new Label(container, SWT.NONE);
254+
lblPleaseEnterProject.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
255+
lblPleaseEnterProject.setBounds(5, 98, 179, 15);
256+
lblPleaseEnterProject.setText("Please enter project detail:");
257+
258+
Label lblPleaseEnterMaven = new Label(container, SWT.NONE);
259+
lblPleaseEnterMaven.setText("Please enter maven artifact detail:");
260+
lblPleaseEnterMaven.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
261+
lblPleaseEnterMaven.setBounds(5, 194, 213, 15);
262+
263+
Label lblProjectName = new Label(container, SWT.NONE);
264+
lblProjectName.setBounds(5, 118, 84, 15);
265+
lblProjectName.setText("Project Name:");
266+
267+
Label lblProjectLocation = new Label(container, SWT.NONE);
268+
lblProjectLocation.setBounds(5, 146, 94, 15);
269+
lblProjectLocation.setText("Project Location:");
270+
271+
Label lblProjectFolder = new Label(container, SWT.NONE);
272+
lblProjectFolder.setText("Project Folder:");
273+
lblProjectFolder.setBounds(5, 173, 94, 15);
274+
275+
Label lblArtifactId = new Label(container, SWT.NONE);
276+
lblArtifactId.setText("Artifact Id:");
277+
lblArtifactId.setBounds(5, 215, 94, 15);
278+
279+
Label lblGroupId = new Label(container, SWT.NONE);
280+
lblGroupId.setText("Group Id:");
281+
lblGroupId.setBounds(5, 242, 94, 15);
282+
283+
Label lblVersion = new Label(container, SWT.NONE);
284+
lblVersion.setText("Version:");
285+
lblVersion.setBounds(5, 270, 94, 15);
286+
287+
Label lblPackage = new Label(container, SWT.NONE);
288+
lblPackage.setText("Package:");
289+
lblPackage.setBounds(5, 296, 94, 15);
290+
291+
txtProjectName = new Text(container, SWT.BORDER);
292+
txtProjectName.addModifyListener(new ModifyListener() {
293+
public void modifyText(ModifyEvent e) {
294+
onProjectNameChange();
295+
}
296+
});
297+
txtProjectName.setBounds(118, 116, 319, 21);
298+
299+
txtProjectLocation = new Text(container, SWT.BORDER);
300+
txtProjectLocation.addModifyListener(new ModifyListener() {
301+
public void modifyText(ModifyEvent e) {
302+
onProjectLocationChange();
303+
}
304+
});
305+
txtProjectLocation.setBounds(118, 143, 319, 21);
306+
307+
Button btnNewButton = new Button(container, SWT.NONE);
308+
btnNewButton.addSelectionListener(new SelectionAdapter() {
309+
@Override
310+
public void widgetSelected(SelectionEvent e) {
311+
DirectoryDialog dialog = new DirectoryDialog(new Shell(), SWT.NULL);
312+
String path = dialog.open();
313+
if (path != null) {
314+
txtProjectLocation.setText(path);
315+
}
316+
}
317+
});
318+
btnNewButton.setBounds(443, 141, 75, 25);
319+
btnNewButton.setText("Browse...");
320+
321+
txtProjectFolder = new Text(container, SWT.BORDER);
322+
txtProjectFolder.addModifyListener(new ModifyListener() {
323+
public void modifyText(ModifyEvent e) {
324+
onProjectFolderChange();
325+
}
326+
});
327+
txtProjectFolder.setEditable(false);
328+
txtProjectFolder.setBounds(118, 170, 319, 21);
329+
330+
txtArtifactId = new Text(container, SWT.BORDER);
331+
txtArtifactId.setEnabled(false);
332+
txtArtifactId.setEditable(false);
333+
txtArtifactId.setBounds(118, 212, 319, 21);
334+
335+
txtGroupId = new Text(container, SWT.BORDER);
336+
txtGroupId.addModifyListener(new ModifyListener() {
337+
public void modifyText(ModifyEvent e) {
338+
onGroupIdChange();
339+
}
340+
});
341+
txtGroupId.setBounds(118, 239, 319, 21);
342+
343+
txtVersion = new Text(container, SWT.BORDER);
344+
txtVersion.addModifyListener(new ModifyListener() {
345+
public void modifyText(ModifyEvent e) {
346+
onVersionChange();
347+
}
348+
});
349+
txtVersion.setBounds(118, 266, 319, 21);
350+
351+
txtPackage = new Text(container, SWT.BORDER);
352+
txtPackage.addModifyListener(new ModifyListener() {
353+
public void modifyText(ModifyEvent e) {
354+
onPackageChange();
355+
}
356+
});
357+
txtPackage.setBounds(118, 293, 319, 21);
358+
359+
chkDownloadExamples = new Button(container, SWT.CHECK);
360+
chkDownloadExamples.setBounds(5, 325, 492, 16);
361+
chkDownloadExamples.setText("Also Download Code Examples (for using Aspose.Slides for Java)");
362+
363+
Label lblNewLabel_1 = new Label(container, SWT.NONE);
364+
lblNewLabel_1.setBounds(443, 296, 55, 15);
365+
lblNewLabel_1.setText("(Optional)");
366+
367+
initDecorators();
368+
initControls();
369+
}
370+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,362 @@
1+
//
2+
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
3+
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
4+
// Any modifications to this file will be lost upon recompilation of the source schema.
5+
// Generated on: 2014.09.26 at 03:01:37 PM PKT
6+
//
7+
package com.aspose.slides.maven.artifacts;
8+
9+
import javax.xml.bind.annotation.*;
10+
import java.util.ArrayList;
11+
import java.util.List;
12+
13+
/**
14+
* <p>
15+
* Java class for anonymous complex type.
16+
* <p/>
17+
* <p>
18+
* The following schema fragment specifies the expected content contained within
19+
* this class.
20+
* <p/>
21+
* <
22+
* pre>
23+
* &lt;complexType> &lt;complexContent> &lt;restriction
24+
* base="{http://www.w3.org/2001/XMLSchema}anyType"> &lt;sequence> &lt;element
25+
* name="groupId" type="{http://www.w3.org/2001/XMLSchema}string"/> &lt;element
26+
* name="artifactId" type="{http://www.w3.org/2001/XMLSchema}string"/>
27+
* &lt;element name="version" type="{http://www.w3.org/2001/XMLSchema}string"/>
28+
* &lt;element name="versioning"> &lt;complexType> &lt;complexContent>
29+
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
30+
* &lt;sequence> &lt;element name="latest"
31+
* type="{http://www.w3.org/2001/XMLSchema}string"/> &lt;element name="release"
32+
* type="{http://www.w3.org/2001/XMLSchema}string"/> &lt;element
33+
* name="versions"> &lt;complexType> &lt;complexContent> &lt;restriction
34+
* base="{http://www.w3.org/2001/XMLSchema}anyType"> &lt;sequence> &lt;element
35+
* name="version" type="{http://www.w3.org/2001/XMLSchema}string"
36+
* maxOccurs="unbounded" minOccurs="0"/> &lt;/sequence> &lt;/restriction>
37+
* &lt;/complexContent> &lt;/complexType> &lt;/element> &lt;element
38+
* name="lastUpdated" type="{http://www.w3.org/2001/XMLSchema}long"/>
39+
* &lt;/sequence> &lt;/restriction> &lt;/complexContent> &lt;/complexType>
40+
* &lt;/element> &lt;/sequence> &lt;/restriction> &lt;/complexContent>
41+
* &lt;/complexType>
42+
* </pre>
43+
*/
44+
@XmlAccessorType(XmlAccessType.FIELD)
45+
@XmlType(name = "", propOrder = {
46+
"groupId",
47+
"artifactId",
48+
"version",
49+
"versioning",
50+
"classifier"
51+
})
52+
@XmlRootElement(name = "metadata")
53+
public class Metadata {
54+
55+
/**
56+
*
57+
*/
58+
@XmlElement(required = true)
59+
protected String groupId;
60+
61+
/**
62+
*
63+
*/
64+
@XmlElement(required = true)
65+
protected String artifactId;
66+
67+
/**
68+
*
69+
*/
70+
@XmlElement(required = true)
71+
protected String version;
72+
73+
/**
74+
*
75+
*/
76+
@XmlElement(required = true)
77+
protected Metadata.Versioning versioning;
78+
79+
/**
80+
*
81+
*/
82+
protected String classifier;
83+
84+
/**
85+
* Gets the value of the groupId property.
86+
*
87+
* @return possible object is {@link String }
88+
*/
89+
public String getGroupId() {
90+
return groupId;
91+
}
92+
93+
/**
94+
* Sets the value of the groupId property.
95+
*
96+
* @param value allowed object is {@link String }
97+
*/
98+
public void setGroupId(String value) {
99+
this.groupId = value;
100+
}
101+
102+
/**
103+
* Gets the value of the artifactId property.
104+
*
105+
* @return possible object is {@link String }
106+
*/
107+
public String getArtifactId() {
108+
return artifactId;
109+
}
110+
111+
/**
112+
* Sets the value of the artifactId property.
113+
*
114+
* @param value allowed object is {@link String }
115+
*/
116+
public void setArtifactId(String value) {
117+
this.artifactId = value;
118+
}
119+
120+
/**
121+
* Gets the value of the version property.
122+
*
123+
* @return possible object is {@link String }
124+
*/
125+
public String getVersion() {
126+
return version;
127+
}
128+
129+
/**
130+
* Sets the value of the version property.
131+
*
132+
* @param value allowed object is {@link String }
133+
*/
134+
public void setVersion(String value) {
135+
this.version = value;
136+
}
137+
138+
/**
139+
* Gets the value of the versioning property.
140+
*
141+
* @return possible object is {@link Metadata.Versioning }
142+
*/
143+
public Metadata.Versioning getVersioning() {
144+
return versioning;
145+
}
146+
147+
/**
148+
* Sets the value of the versioning property.
149+
*
150+
* @param value allowed object is {@link Metadata.Versioning }
151+
*/
152+
public void setVersioning(Metadata.Versioning value) {
153+
this.versioning = value;
154+
}
155+
156+
/**
157+
* <p>
158+
* Java class for anonymous complex type.
159+
* <p/>
160+
* <p>
161+
* The following schema fragment specifies the expected content contained
162+
* within this class.
163+
* <p/>
164+
* <
165+
* pre>
166+
* &lt;complexType> &lt;complexContent> &lt;restriction
167+
* base="{http://www.w3.org/2001/XMLSchema}anyType"> &lt;sequence>
168+
* &lt;element name="latest"
169+
* type="{http://www.w3.org/2001/XMLSchema}string"/> &lt;element
170+
* name="release" type="{http://www.w3.org/2001/XMLSchema}string"/>
171+
* &lt;element name="versions"> &lt;complexType> &lt;complexContent>
172+
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
173+
* &lt;sequence> &lt;element name="version"
174+
* type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"
175+
* minOccurs="0"/> &lt;/sequence> &lt;/restriction> &lt;/complexContent>
176+
* &lt;/complexType> &lt;/element> &lt;element name="lastUpdated"
177+
* type="{http://www.w3.org/2001/XMLSchema}long"/> &lt;/sequence>
178+
* &lt;/restriction> &lt;/complexContent> &lt;/complexType>
179+
* </pre>
180+
*/
181+
@XmlAccessorType(XmlAccessType.FIELD)
182+
@XmlType(name = "", propOrder = {
183+
"latest",
184+
"release",
185+
"versions",
186+
"lastUpdated"
187+
})
188+
public static class Versioning {
189+
190+
/**
191+
*
192+
*/
193+
@XmlElement(required = true)
194+
protected String latest;
195+
196+
/**
197+
*
198+
*/
199+
@XmlElement(required = true)
200+
protected String release;
201+
202+
/**
203+
*
204+
*/
205+
@XmlElement(required = true)
206+
protected Metadata.Versioning.Versions versions;
207+
208+
/**
209+
*
210+
*/
211+
protected long lastUpdated;
212+
213+
/**
214+
* Gets the value of the latest property.
215+
*
216+
* @return possible object is {@link String }
217+
*/
218+
public String getLatest() {
219+
return latest;
220+
}
221+
222+
/**
223+
* Sets the value of the latest property.
224+
*
225+
* @param value allowed object is {@link String }
226+
*/
227+
public void setLatest(String value) {
228+
this.latest = value;
229+
}
230+
231+
/**
232+
* Gets the value of the release property.
233+
*
234+
* @return possible object is {@link String }
235+
*/
236+
public String getRelease() {
237+
return release;
238+
}
239+
240+
/**
241+
* Sets the value of the release property.
242+
*
243+
* @param value allowed object is {@link String }
244+
*/
245+
public void setRelease(String value) {
246+
this.release = value;
247+
}
248+
249+
/**
250+
* Gets the value of the versions property.
251+
*
252+
* @return possible object is {@link Metadata.Versioning.Versions }
253+
*/
254+
public Metadata.Versioning.Versions getVersions() {
255+
return versions;
256+
}
257+
258+
/**
259+
* Sets the value of the versions property.
260+
*
261+
* @param value allowed object is {@link Metadata.Versioning.Versions }
262+
*/
263+
public void setVersions(Metadata.Versioning.Versions value) {
264+
this.versions = value;
265+
}
266+
267+
/**
268+
* Gets the value of the lastUpdated property.
269+
* @return
270+
*/
271+
public long getLastUpdated() {
272+
return lastUpdated;
273+
}
274+
275+
/**
276+
* Sets the value of the lastUpdated property.
277+
* @param value
278+
*/
279+
public void setLastUpdated(long value) {
280+
this.lastUpdated = value;
281+
}
282+
283+
/**
284+
* <p>
285+
* Java class for anonymous complex type.
286+
* <p/>
287+
* <p>
288+
* The following schema fragment specifies the expected content
289+
* contained within this class.
290+
* <p/>
291+
* <
292+
* pre>
293+
* &lt;complexType> &lt;complexContent> &lt;restriction
294+
* base="{http://www.w3.org/2001/XMLSchema}anyType"> &lt;sequence>
295+
* &lt;element name="version"
296+
* type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"
297+
* minOccurs="0"/> &lt;/sequence> &lt;/restriction> &lt;/complexContent>
298+
* &lt;/complexType>
299+
* </pre>
300+
*/
301+
@XmlAccessorType(XmlAccessType.FIELD)
302+
@XmlType(name = "", propOrder = {
303+
"version"
304+
})
305+
public static class Versions {
306+
307+
/**
308+
*
309+
*/
310+
protected List<String> version;
311+
312+
/**
313+
* Gets the value of the version property.
314+
* <p/>
315+
* <p/>
316+
* This accessor method returns a reference to the live list, not a
317+
* snapshot. Therefore any modification you make to the returned
318+
* list will be present inside the JAXB object. This is why there is
319+
* not a <CODE>set</CODE> method for the version property.
320+
* <p/>
321+
* <p/>
322+
* For example, to add a new item, do as follows:
323+
* <pre>
324+
* getVersion().add(newItem);
325+
* </pre>
326+
* <p/>
327+
* <p/>
328+
* <p/>
329+
* Objects of the following type(s) are allowed in the list
330+
* {@link String }
331+
* @return
332+
*/
333+
public List<String> getVersion() {
334+
if (version == null) {
335+
version = new ArrayList<String>();
336+
}
337+
return this.version;
338+
}
339+
340+
}
341+
342+
}
343+
344+
/**
345+
* Gets the value of the classifier property.
346+
*
347+
* @return possible object is {@link String }
348+
*/
349+
public String getClassifier() {
350+
return classifier;
351+
}
352+
353+
/**
354+
* Sets the value of the version property.
355+
*
356+
* @param value allowed object is {@link String }
357+
*/
358+
public void setClassifier(String value) {
359+
this.classifier = value;
360+
}
361+
362+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//
2+
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
3+
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
4+
// Any modifications to this file will be lost upon recompilation of the source schema.
5+
// Generated on: 2014.09.26 at 03:01:37 PM PKT
6+
//
7+
package com.aspose.slides.maven.artifacts;
8+
9+
import javax.xml.bind.annotation.XmlRegistry;
10+
11+
/**
12+
* This object contains factory methods for each Java content interface and Java
13+
* element interface generated in the com.aspose.maven.artifacts package.
14+
* <p>
15+
* An ObjectFactory allows you to programatically construct new instances of the
16+
* Java representation for XML content. The Java representation of XML content
17+
* can consist of schema derived interfaces and classes representing the binding
18+
* of schema type definitions, element declarations and model groups. Factory
19+
* methods for each of these are provided in this class.
20+
*/
21+
@XmlRegistry
22+
public class ObjectFactory {
23+
24+
/**
25+
* Create a new ObjectFactory that can be used to create new instances of
26+
* schema derived classes for package: com.aspose.maven.apis.artifacts
27+
*/
28+
public ObjectFactory() {
29+
}
30+
31+
/**
32+
* Create an instance of {@link Metadata.Versioning.Versions }
33+
* @return
34+
*/
35+
public Metadata.Versioning.Versions createMetadataVersioningVersions() {
36+
return new Metadata.Versioning.Versions();
37+
}
38+
39+
/**
40+
* Create an instance of {@link Metadata }
41+
* @return
42+
*/
43+
public Metadata createMetadata() {
44+
return new Metadata();
45+
}
46+
47+
/**
48+
* Create an instance of {@link Metadata.Versioning }
49+
* @return
50+
*/
51+
public Metadata.Versioning createMetadataVersioning() {
52+
return new Metadata.Versioning();
53+
}
54+
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<metadata>
3+
<groupId>com.aspose</groupId>
4+
<artifactId>aspose-slides</artifactId>
5+
<version>14.5.0</version>
6+
<versioning>
7+
<latest>14.8.0</latest>
8+
<release>14.8.0</release>
9+
<versions>
10+
<version>14.5.0</version>
11+
<version>14.6.0</version>
12+
<version>14.7.0</version>
13+
<version>14.8.0</version>
14+
</versions>
15+
<lastUpdated>20140924084136</lastUpdated>
16+
</versioning>
17+
</metadata>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
2+
xmlns:xs="http://www.w3.org/2001/XMLSchema">
3+
<xs:element name="metadata">
4+
<xs:complexType>
5+
<xs:sequence>
6+
<xs:element type="xs:string" name="groupId"/>
7+
<xs:element type="xs:string" name="artifactId"/>
8+
<xs:element type="xs:string" name="version"/>
9+
<xs:element name="versioning">
10+
<xs:complexType>
11+
<xs:sequence>
12+
<xs:element type="xs:string" name="latest"/>
13+
<xs:element type="xs:string" name="release"/>
14+
<xs:element name="versions">
15+
<xs:complexType>
16+
<xs:sequence>
17+
<xs:element type="xs:string" name="version" maxOccurs="unbounded"
18+
minOccurs="0"/>
19+
</xs:sequence>
20+
</xs:complexType>
21+
</xs:element>
22+
<xs:element type="xs:long" name="lastUpdated"/>
23+
</xs:sequence>
24+
</xs:complexType>
25+
</xs:element>
26+
</xs:sequence>
27+
</xs:complexType>
28+
</xs:element>
29+
30+
</xs:schema>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven.examples;
13+
14+
import java.nio.file.Files;
15+
import java.nio.file.Path;
16+
import java.nio.file.StandardCopyOption;
17+
18+
import org.apache.commons.io.FileUtils;
19+
import org.eclipse.core.resources.IProject;
20+
import org.eclipse.core.resources.IResource;
21+
import org.eclipse.core.runtime.CoreException;
22+
import org.eclipse.core.runtime.IProgressMonitor;
23+
import org.eclipse.jface.operation.IRunnableWithProgress;
24+
import org.w3c.dom.NodeList;
25+
import com.aspose.slides.maven.utils.AsposeConstants;
26+
import com.aspose.slides.maven.utils.AsposeMavenProjectManager;
27+
import java.io.File;
28+
import java.io.IOException;
29+
import java.lang.reflect.InvocationTargetException;
30+
31+
public class AsposeExampleSupport implements IRunnableWithProgress {
32+
33+
private String selectedProjectPath;
34+
private String exampleCategory;
35+
private IProject project;
36+
37+
final static String localExampleFolder = "aspose/GitConsRepos/Aspose.Slides/Examples";
38+
final static String localExampleSourceFolder = "src/main/java/com/aspose/slides/examples";
39+
final static String localExampleResourceFolder = "src/main/resources/com/aspose/slides/examples";
40+
41+
public AsposeExampleSupport(String selectedProjectPath, String exampleCategory, IProject project) {
42+
this.selectedProjectPath = selectedProjectPath;
43+
this.exampleCategory = exampleCategory;
44+
this.project = project;
45+
}
46+
47+
@Override
48+
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
49+
monitor.beginTask("Adding example code in project " + project.getName() + "...", IProgressMonitor.UNKNOWN);
50+
createExample();
51+
monitor.done();
52+
}
53+
54+
public void createExample() {
55+
String srcExamplePath = System.getProperty("user.home") + File.separator + localExampleFolder + File.separator
56+
+ localExampleSourceFolder;
57+
String srcExampleResourcePath = System.getProperty("user.home") + File.separator + localExampleFolder
58+
+ File.separator + localExampleResourceFolder;
59+
60+
String destProjectExamplePath = selectedProjectPath + File.separator + localExampleSourceFolder;
61+
String destProjectExampleResourcePath = selectedProjectPath + File.separator + localExampleResourceFolder;
62+
63+
File srcExampleCategoryPath = new File(srcExamplePath + File.separator + exampleCategory);
64+
File destExampleCategoryPath = new File(destProjectExamplePath + File.separator + exampleCategory);
65+
66+
Path srcUtil = new File(srcExamplePath + File.separator + "Utils.java").toPath();
67+
Path destUtil = new File(destProjectExamplePath + File.separator + "Utils.java").toPath();
68+
69+
File srcExampleResourceCategoryPath = new File(srcExampleResourcePath + File.separator + exampleCategory);
70+
File destExampleResourceCategoryPath = new File(
71+
destProjectExampleResourcePath + File.separator + exampleCategory);
72+
73+
String repositoryPOM_XML = System.getProperty("user.home") + File.separator + localExampleFolder
74+
+ File.separator + AsposeConstants.MAVEN_POM_XML;
75+
76+
try {
77+
FileUtils.copyDirectory(srcExampleCategoryPath, destExampleCategoryPath);
78+
Files.copy(srcUtil, destUtil, StandardCopyOption.REPLACE_EXISTING);
79+
FileUtils.copyDirectory(srcExampleResourceCategoryPath, destExampleResourceCategoryPath);
80+
81+
NodeList examplesNoneAsposeDependencies = AsposeMavenProjectManager.getInstance()
82+
.getDependenciesFromPOM(repositoryPOM_XML, AsposeConstants.ASPOSE_GROUP_ID);
83+
AsposeMavenProjectManager.getInstance().addMavenDependenciesInProject(examplesNoneAsposeDependencies);
84+
85+
NodeList examplesNoneAsposeRepositories = AsposeMavenProjectManager.getInstance()
86+
.getRepositoriesFromPOM(repositoryPOM_XML, AsposeConstants.ASPOSE_MAVEN_REPOSITORY);
87+
AsposeMavenProjectManager.getInstance().addMavenRepositoriesInProject(examplesNoneAsposeRepositories);
88+
89+
project.refreshLocal(IResource.DEPTH_INFINITE, null);
90+
91+
} catch (IOException | CoreException e) {
92+
e.printStackTrace();
93+
}
94+
95+
}
96+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven.examples;
13+
14+
import java.io.File;
15+
import java.lang.reflect.InvocationTargetException;
16+
17+
import org.eclipse.core.resources.IProject;
18+
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
19+
import org.eclipse.jface.viewers.IStructuredSelection;
20+
import org.eclipse.jface.wizard.Wizard;
21+
import org.eclipse.ui.INewWizard;
22+
import org.eclipse.ui.IWorkbench;
23+
24+
public class AsposeExampleWizard extends Wizard implements INewWizard {
25+
26+
private AsposeExampleWizardPage wizardPage;
27+
28+
public AsposeExampleWizard() {
29+
setWindowTitle("Aspose.Slides Code Example");
30+
}
31+
32+
@Override
33+
public void init(IWorkbench workbench, IStructuredSelection selection) {
34+
35+
}
36+
37+
@Override
38+
public void addPages() {
39+
super.addPages();
40+
wizardPage = new AsposeExampleWizardPage();
41+
addPage(wizardPage);
42+
}
43+
44+
@Override
45+
public boolean performFinish() {
46+
47+
String selectedProjectPath = wizardPage.getSelectedProjectPath();
48+
String exampleCategory = wizardPage.getSelectedExampleCategory();
49+
IProject project = wizardPage.getIProject();
50+
51+
AsposeExampleSupport asposeExampleSupport = new AsposeExampleSupport(selectedProjectPath, exampleCategory,
52+
project);
53+
try {
54+
new ProgressMonitorDialog(this.getShell()).run(true, false, asposeExampleSupport);
55+
} catch (InvocationTargetException | InterruptedException e) {
56+
e.printStackTrace();
57+
}
58+
59+
return true;
60+
}
61+
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven.examples;
13+
14+
import java.io.File;
15+
import java.lang.reflect.InvocationTargetException;
16+
import java.net.URI;
17+
import java.util.LinkedList;
18+
import java.util.Queue;
19+
import org.eclipse.core.resources.IProject;
20+
import org.eclipse.core.resources.ResourcesPlugin;
21+
import org.eclipse.core.runtime.CoreException;
22+
import org.eclipse.core.runtime.IProgressMonitor;
23+
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
24+
import org.eclipse.jface.fieldassist.ControlDecoration;
25+
import org.eclipse.jface.fieldassist.FieldDecoration;
26+
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
27+
import org.eclipse.jface.operation.IRunnableWithProgress;
28+
import org.eclipse.jface.wizard.WizardPage;
29+
import org.eclipse.swt.SWT;
30+
import org.eclipse.swt.widgets.Composite;
31+
import org.eclipse.swt.widgets.Combo;
32+
import org.eclipse.swt.widgets.Tree;
33+
import org.eclipse.swt.widgets.TreeItem;
34+
import org.eclipse.swt.widgets.Label;
35+
import org.eclipse.wb.swt.SWTResourceManager;
36+
import com.aspose.slides.Activator;
37+
import com.aspose.slides.maven.utils.AsposeConstants;
38+
import com.aspose.slides.maven.utils.AsposeJavaAPI;
39+
import com.aspose.slides.maven.utils.AsposeMavenProjectManager;
40+
import com.aspose.slides.maven.utils.AsposeSlidesJavaAPI;
41+
import com.aspose.slides.maven.utils.FormatExamples;
42+
import org.eclipse.swt.events.SelectionAdapter;
43+
import org.eclipse.swt.events.SelectionEvent;
44+
import org.eclipse.swt.events.ModifyListener;
45+
import org.eclipse.swt.events.ModifyEvent;
46+
47+
public class AsposeExampleWizardPage extends WizardPage {
48+
49+
private Combo cbProject;
50+
private Combo cbVersion;
51+
private Tree examplesTree;
52+
53+
private ControlDecoration cbProjectDecoration;
54+
private ControlDecoration cbVersionDecoration;
55+
private ControlDecoration examplesTreeDecoration;
56+
57+
/**
58+
* Create the wizard.
59+
*/
60+
public AsposeExampleWizardPage() {
61+
super("wizardPage");
62+
setTitle("New Aspose.Slides Code Example");
63+
setDescription("Aspose.Slides Java API - Code Examples");
64+
}
65+
66+
public IProject getIProject() {
67+
return (IProject) cbProject.getData(cbProject.getText());
68+
}
69+
70+
public String getSelectedProjectPath() {
71+
String projectPath = null;
72+
try {
73+
IProject project = (IProject) cbProject.getData(cbProject.getText());
74+
projectPath = project.getDescription().getLocationURI().getPath();
75+
76+
} catch (CoreException e) {
77+
e.printStackTrace();
78+
}
79+
return projectPath;
80+
}
81+
82+
public String getSelectedProjectName() {
83+
return cbProject.getText();
84+
}
85+
86+
public String getSelectedExampleCategory() {
87+
String categoryFolderPath = examplesTree.getSelection()[0].getData().toString().replace('\\', '/');
88+
int index = categoryFolderPath.indexOf(AsposeExampleSupport.localExampleSourceFolder) + AsposeExampleSupport.localExampleSourceFolder.length() + 1;
89+
return categoryFolderPath.substring(index, categoryFolderPath.length());
90+
}
91+
92+
private void downloadExamplesRepo() {
93+
// download code examples with status progress
94+
try {
95+
new ProgressMonitorDialog(this.getShell()).run(true, false, new IRunnableWithProgress() {
96+
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
97+
monitor.beginTask("Downloading latest example categories...", IProgressMonitor.UNKNOWN);
98+
99+
AsposeMavenProjectManager.initialize(null);
100+
AsposeJavaAPI component = AsposeSlidesJavaAPI.initialize(AsposeMavenProjectManager.getInstance());
101+
component.checkAndUpdateRepo();
102+
103+
monitor.done();
104+
}
105+
});
106+
} catch (InvocationTargetException | InterruptedException e) {
107+
e.printStackTrace();
108+
}
109+
}
110+
111+
private void initControls() {
112+
113+
downloadExamplesRepo();
114+
115+
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
116+
URI path = null;
117+
try {
118+
for (IProject project : projects) {
119+
path = project.getDescription().getLocationURI();
120+
if (path != null) {
121+
cbProject.add(project.getDescription().getName());
122+
cbProject.setData(project.getDescription().getName(), project);
123+
}
124+
}
125+
cbProjectDecoration.hide();
126+
setPageComplete(true);
127+
if (cbProject.getItemCount() == 0) {
128+
cbProject.add(AsposeConstants.API_PROJECT_NOT_FOUND);
129+
cbProjectDecoration.show();
130+
setPageComplete(false);
131+
}
132+
133+
cbProject.select(0);
134+
} catch (CoreException e) {
135+
e.printStackTrace();
136+
}
137+
}
138+
139+
private void initDecorators() {
140+
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
141+
.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
142+
143+
cbProjectDecoration = new ControlDecoration(cbProject, SWT.TOP | SWT.RIGHT);
144+
cbProjectDecoration.setImage(fieldDecoration.getImage());
145+
cbProjectDecoration.setDescriptionText("Please first create a Maven project");
146+
cbProjectDecoration.hide();
147+
148+
cbVersionDecoration = new ControlDecoration(cbVersion, SWT.TOP | SWT.RIGHT);
149+
cbVersionDecoration.setImage(fieldDecoration.getImage());
150+
cbVersionDecoration.setDescriptionText(
151+
"Please first add maven dependency of " + AsposeConstants.API_NAME + " for java API");
152+
cbVersionDecoration.hide();
153+
154+
examplesTreeDecoration = new ControlDecoration(examplesTree, SWT.TOP | SWT.RIGHT);
155+
examplesTreeDecoration.setImage(fieldDecoration.getImage());
156+
examplesTreeDecoration.setDescriptionText("Please select one example category");
157+
examplesTreeDecoration.hide();
158+
}
159+
160+
private void onProjectModify() {
161+
try {
162+
cbVersion.removeAll();
163+
IProject selectedProject = (IProject) cbProject.getData(cbProject.getText());
164+
if (selectedProject != null) {
165+
String versionNo = AsposeMavenProjectManager.getInstance().getDependencyVersionFromPOM(
166+
selectedProject.getDescription().getLocationURI(), AsposeConstants.API_MAVEN_DEPENDENCY);
167+
cbVersionDecoration.hide();
168+
setPageComplete(true);
169+
if (versionNo == null) {
170+
cbVersionDecoration.show();
171+
setPageComplete(false);
172+
}
173+
if (versionNo == null) {
174+
versionNo = AsposeConstants.API_DEPENDENCY_NOT_FOUND;
175+
}
176+
cbVersion.add(versionNo);
177+
cbVersion.select(0);
178+
}
179+
} catch (CoreException e) {
180+
e.printStackTrace();
181+
}
182+
183+
}
184+
185+
private void onVersionModify() {
186+
try {
187+
examplesTree.removeAll();
188+
if (!cbVersion.getText().equals(AsposeConstants.API_DEPENDENCY_NOT_FOUND)) {
189+
IProject selectedProject = (IProject) cbProject.getData(cbProject.getText());
190+
if (selectedProject != null) {
191+
AsposeMavenProjectManager.initialize(new File(selectedProject.getDescription().getLocationURI()));
192+
AsposeJavaAPI component = AsposeSlidesJavaAPI.initialize(AsposeMavenProjectManager.getInstance());
193+
populateExamplesTree(component);
194+
examplesTreeDecoration.show();
195+
setPageComplete(false);
196+
}
197+
}
198+
} catch (CoreException e) {
199+
e.printStackTrace();
200+
}
201+
}
202+
203+
private void onTreeSelection() {
204+
examplesTreeDecoration.show();
205+
setPageComplete(false);
206+
TreeItem[] selectedItems = examplesTree.getSelection();
207+
if (selectedItems[0].getParentItem() != null && selectedItems[0].getItemCount() > 0) {
208+
examplesTreeDecoration.hide();
209+
setPageComplete(true);
210+
}
211+
}
212+
213+
/**
214+
*
215+
* @param asposeComponent
216+
* @param top
217+
* @param panel
218+
*/
219+
public void populateExamplesTree(AsposeJavaAPI asposeComponent) {
220+
String examplesFullPath = asposeComponent.getLocalRepositoryPath() + File.separator
221+
+ AsposeConstants.GITHUB_EXAMPLES_SOURCE_LOCATION;
222+
File directory = new File(examplesFullPath);
223+
examplesTree.removeAll();
224+
Queue<Object[]> queue = new LinkedList<>();
225+
queue.add(new Object[] { null, directory });
226+
TreeItem top = new TreeItem(examplesTree, 0);
227+
top.setText("Aspose.Slides");
228+
229+
while (!queue.isEmpty()) {
230+
Object[] _entry = queue.remove();
231+
File childFile = ((File) _entry[1]);
232+
TreeItem parentItem = (TreeItem) _entry[0];
233+
if (childFile.isDirectory()) {
234+
if (parentItem != null) {
235+
TreeItem child = new TreeItem(parentItem, SWT.NONE);
236+
child.setText(FormatExamples.formatTitle(childFile.getName()));
237+
child.setData(childFile);
238+
parentItem = child;
239+
} else {
240+
parentItem = top;
241+
}
242+
for (File f : childFile.listFiles()) {
243+
queue.add(new Object[] { parentItem, f });
244+
}
245+
} else if (childFile.isFile()) {
246+
TreeItem child = new TreeItem(parentItem, SWT.NONE);
247+
child.setText(FormatExamples.formatTitle(childFile.getName()));
248+
}
249+
}
250+
}
251+
252+
/**
253+
* Create contents of the wizard.
254+
*
255+
* @param parent
256+
*/
257+
public void createControl(Composite parent) {
258+
Composite container = new Composite(parent, SWT.NULL);
259+
260+
setControl(container);
261+
262+
cbProject = new Combo(container, SWT.READ_ONLY);
263+
cbProject.addModifyListener(new ModifyListener() {
264+
public void modifyText(ModifyEvent e) {
265+
onProjectModify();
266+
}
267+
});
268+
cbProject.setBounds(181, 101, 323, 23);
269+
270+
examplesTree = new Tree(container, SWT.BORDER);
271+
examplesTree.addSelectionListener(new SelectionAdapter() {
272+
@Override
273+
public void widgetSelected(SelectionEvent e) {
274+
onTreeSelection();
275+
}
276+
});
277+
examplesTree.setBounds(10, 170, 494, 206);
278+
279+
Label label = new Label(container, SWT.NONE);
280+
label.setImage(SWTResourceManager.getImage(Activator.getResourceFilePath("long_banner.png")));
281+
label.setBounds(10, 0, 500, 80);
282+
283+
Label lblProject = new Label(container, SWT.NONE);
284+
lblProject.setBounds(134, 104, 40, 15);
285+
lblProject.setText("Project:");
286+
287+
Label lblAsposeslidesForJava = new Label(container, SWT.NONE);
288+
lblAsposeslidesForJava.setBounds(5, 131, 170, 15);
289+
lblAsposeslidesForJava.setText("Aspose.Slides for Java (version):");
290+
291+
cbVersion = new Combo(container, SWT.READ_ONLY);
292+
cbVersion.addModifyListener(new ModifyListener() {
293+
public void modifyText(ModifyEvent e) {
294+
onVersionModify();
295+
}
296+
});
297+
cbVersion.setBounds(181, 128, 323, 23);
298+
299+
initDecorators();
300+
initControls();
301+
}
302+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven.utils;
13+
14+
/*
15+
* @author Adeel Ilyas <adeel.ilyas@aspose.com>
16+
*/
17+
import java.io.File;
18+
19+
/**
20+
*
21+
* @author Adeel
22+
*/
23+
public class AsposeConstants {
24+
25+
/**
26+
*
27+
*/
28+
public static final String API_NAME = "Aspose.Slides";
29+
30+
/**
31+
*
32+
*/
33+
public static final String API_MAVEN_DEPENDENCY = "aspose-slides";
34+
35+
/**
36+
*
37+
*/
38+
public static final String API_EXAMPLES_PACKAGE = "com" + File.separator + API_MAVEN_DEPENDENCY.replace("-", File.separator) + File.separator + "examples";
39+
40+
/**
41+
*
42+
*/
43+
public static final String GITHUB_EXAMPLES_SOURCE_LOCATION = "Examples" + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + API_EXAMPLES_PACKAGE;
44+
45+
/**
46+
*
47+
*/
48+
public static final String GITHUB_EXAMPLES_RESOURCES_LOCATION = "Examples" + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator + API_EXAMPLES_PACKAGE;
49+
50+
/**
51+
*
52+
*/
53+
public static final String PROJECT_EXAMPLES_SOURCE_LOCATION = "src" + File.separator + "main" + File.separator + "java" + File.separator + API_EXAMPLES_PACKAGE;
54+
55+
/**
56+
*
57+
*/
58+
public static final String PROJECT_EXAMPLES_RESOURCES_LOCATION = "src" + File.separator + "main" + File.separator + "resources" + File.separator + API_EXAMPLES_PACKAGE;
59+
60+
/**
61+
*
62+
*/
63+
public static final String EXAMPLES_UTIL = GITHUB_EXAMPLES_SOURCE_LOCATION + File.separator + "Utils.java";
64+
65+
/**
66+
*
67+
*/
68+
public static final String API_DEPENDENCY_NOT_FOUND = "Dependency not found!";
69+
70+
public static final String API_PROJECT_NOT_FOUND = "No projects found!";
71+
72+
/**
73+
*
74+
*/
75+
public static final String MAVEN_POM_XML = "pom.xml";
76+
77+
/**
78+
*
79+
*/
80+
public static final String WIZARD_NAME = "Aspose.Slides Maven Project";
81+
82+
/**
83+
*
84+
*/
85+
public static final String ASPOSE_SELECT_EXAMPLE = "Please just select one examples category";
86+
87+
/**
88+
*
89+
*/
90+
public static final String INTERNET_CONNNECTIVITY_PING_URL = "java.sun.com";
91+
92+
/**
93+
*
94+
*/
95+
public static final String ASPOSE_MAVEN_REPOSITORY = "http://maven.aspose.com";
96+
97+
/**
98+
*
99+
*/
100+
public static final String ASPOSE_GROUP_ID = "com.aspose";
101+
102+
/**
103+
*
104+
*/
105+
public static final String INTERNET_REQUIRED_MSG = "Internet connectivity is not available!\nInternet connectivity is required to retrieve latest Aspose.Slides Maven Artifact";
106+
107+
/**
108+
*
109+
*/
110+
public static final String EXAMPLES_INTERNET_REQUIRED_MSG = "Internet connectivity is required to download examples";
111+
112+
/**
113+
*
114+
*/
115+
public static final String MAVEN_ARTIFACTS_RETRIEVE_FAIL = "Unknown Error!\nCould not retrieve latest Aspose.Slides Maven Artifact!";
116+
117+
/**
118+
*
119+
*/
120+
public static final String EXAMPLES_DOWNLOAD_FAIL = "Unknown Error!\nCould not download Aspose.Slides for Java API example Source codes!";
121+
122+
/**
123+
*
124+
*/
125+
public static final String EXAMPLES_NOT_AVAILABLE_MSG = "This component does not have examples yet, We will add examples soon";
126+
127+
/**
128+
*
129+
*/
130+
public static final String EXAMPLES_NOT_AVAILABLE_TITLE = "Examples not available";
131+
132+
/**
133+
*
134+
*/
135+
public static boolean printingAllowed = false;
136+
137+
/**
138+
*
139+
* @param message
140+
*/
141+
public static final void println(String message) {
142+
if (printingAllowed) {
143+
System.out.println(message);
144+
}
145+
}
146+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven.utils;
13+
14+
import javax.swing.*;
15+
import java.io.File;
16+
17+
18+
public abstract class AsposeJavaAPI {
19+
20+
/**
21+
*
22+
* @return
23+
*/
24+
public abstract String get_name();
25+
26+
/**
27+
*
28+
* @return
29+
*/
30+
public abstract String get_mavenRepositoryURL();
31+
32+
/**
33+
*
34+
* @return
35+
*/
36+
public abstract String get_remoteExamplesRepository();
37+
38+
/**
39+
*
40+
* @return
41+
*/
42+
public boolean isExamplesNotAvailable() {
43+
return examplesNotAvailable;
44+
}
45+
46+
/**
47+
*
48+
*/
49+
public boolean examplesNotAvailable;
50+
51+
/**
52+
*
53+
* @return
54+
*/
55+
public boolean isExamplesDefinitionAvailable() {
56+
return examplesDefinitionAvailable;
57+
}
58+
59+
/**
60+
*
61+
*/
62+
public boolean examplesDefinitionAvailable;
63+
64+
/**
65+
*
66+
*/
67+
public AsposeMavenProjectManager asposeMavenProjectManager;
68+
69+
/**
70+
*
71+
* @param p
72+
*/
73+
public void checkAndUpdateRepo() {
74+
75+
if (null == get_remoteExamplesRepository()) {
76+
AsposeMavenProjectManager.showMessage(AsposeConstants.EXAMPLES_NOT_AVAILABLE_TITLE, get_name() + " - " + AsposeConstants.EXAMPLES_NOT_AVAILABLE_MSG, JOptionPane.CLOSED_OPTION, JOptionPane.INFORMATION_MESSAGE);
77+
examplesNotAvailable = true;
78+
examplesDefinitionAvailable = false;
79+
return;
80+
} else {
81+
examplesNotAvailable = false;
82+
}
83+
84+
if (isExamplesDefinitionsPresent()) {
85+
try {
86+
examplesDefinitionAvailable = true;
87+
syncRepository();
88+
} catch (Exception e) {
89+
}
90+
} else {
91+
updateRepository();
92+
if (isExamplesDefinitionsPresent()) {
93+
examplesDefinitionAvailable = true;
94+
95+
}
96+
}
97+
}
98+
99+
/**
100+
*
101+
* @param p
102+
* @return
103+
*/
104+
public boolean downloadExamples() {
105+
try {
106+
checkAndUpdateRepo();
107+
} catch (Exception rex) {
108+
rex.printStackTrace();
109+
return false;
110+
}
111+
112+
return true;
113+
114+
}
115+
116+
/**
117+
*
118+
* @param p
119+
*/
120+
public void updateRepository() {
121+
AsposeMavenProjectManager.checkAndCreateFolder(getLocalRepositoryPath());
122+
123+
try {
124+
GitHelper.updateRepository(getLocalRepositoryPath(), get_remoteExamplesRepository());
125+
126+
} catch (Exception e) {
127+
e.printStackTrace();
128+
}
129+
}
130+
131+
/**
132+
*
133+
* @param p
134+
*/
135+
public void syncRepository() {
136+
try {
137+
GitHelper.syncRepository(getLocalRepositoryPath(), get_remoteExamplesRepository());
138+
139+
} catch (Exception e) {
140+
e.printStackTrace();
141+
}
142+
}
143+
144+
/**
145+
*
146+
* @return boolean
147+
*/
148+
public boolean isExamplesDefinitionsPresent() {
149+
return new File(getLocalRepositoryPath()).exists();
150+
}
151+
152+
/**
153+
*
154+
* @return String
155+
*/
156+
public String getLocalRepositoryPath() {
157+
return asposeMavenProjectManager.getAsposeHomePath() + "GitConsRepos" + File.separator + get_name();
158+
}
159+
}

‎Plugins/Aspose_Slides_Java_Maven_for_Eclipse/AsposeSlidesEclipsePlugin/src/com/aspose/slides/maven/utils/AsposeMavenProjectManager.java

Lines changed: 499 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven.utils;
13+
14+
/*
15+
* @author Adeel Ilyas <adeel.ilyas@aspose.com>
16+
*
17+
*/
18+
// Singleton Class
19+
20+
/**
21+
*
22+
* @author Adeel
23+
*/
24+
public class AsposeSlidesJavaAPI extends AsposeJavaAPI {
25+
26+
private final String _name = AsposeConstants.API_NAME;
27+
private final String _mavenRepositoryURL = "http://maven.aspose.com/repository/ext-release-local/com/aspose/aspose-slides/";
28+
private final String _remoteExamplesRepository = "https://github.com/asposeslides/Aspose_Slides_Java";
29+
30+
/**
31+
* @return the _name
32+
*/
33+
@Override
34+
public String get_name() {
35+
return _name;
36+
}
37+
38+
/**
39+
* @return the _mavenRepositoryURL
40+
*/
41+
@Override
42+
public String get_mavenRepositoryURL() {
43+
return _mavenRepositoryURL;
44+
}
45+
46+
/**
47+
* @return the _remoteExamplesRepository
48+
*/
49+
@Override
50+
public String get_remoteExamplesRepository() {
51+
return _remoteExamplesRepository;
52+
}
53+
54+
// Singleton instance
55+
private static AsposeJavaAPI asposeSlidesAPI;
56+
57+
/**
58+
*
59+
* @return
60+
*/
61+
public static AsposeJavaAPI getInstance() {
62+
return asposeSlidesAPI;
63+
}
64+
65+
/**
66+
*
67+
* @param asposeMavenProjectManager
68+
* @return
69+
*/
70+
public static AsposeJavaAPI initialize(AsposeMavenProjectManager asposeMavenProjectManager) {
71+
asposeSlidesAPI = new AsposeSlidesJavaAPI();
72+
asposeSlidesAPI.asposeMavenProjectManager = asposeMavenProjectManager;
73+
return asposeSlidesAPI;
74+
}
75+
76+
private AsposeSlidesJavaAPI() {
77+
}
78+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven.utils;
13+
14+
import org.apache.commons.lang.WordUtils;
15+
16+
public class FormatExamples {
17+
18+
/**
19+
*
20+
* @param inputStr
21+
* @return
22+
*/
23+
public static String formatTitle(String inputStr) {
24+
String title = inputStr.replaceAll("(_|.java|\\.)", " ");
25+
title = title.replaceAll("([A-Z])", " $1");
26+
title = WordUtils.capitalize(title);
27+
28+
return title;
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package com.aspose.slides.maven.utils;
6+
7+
import org.eclipse.jgit.api.Git;
8+
import org.eclipse.jgit.internal.storage.file.FileRepository;
9+
import org.eclipse.jgit.lib.Repository;
10+
11+
import java.io.File;
12+
13+
/**
14+
* @author Adeel Ilyas
15+
*
16+
*/
17+
public class GitHelper {
18+
19+
/**
20+
*
21+
* @param localPath
22+
* @param remotePath
23+
* @throws Exception
24+
*/
25+
public static void updateRepository(String localPath, String remotePath) throws Exception {
26+
Repository localRepo;
27+
try {
28+
localRepo = new FileRepository(localPath + "/.git");
29+
30+
Git git = new Git(localRepo);
31+
32+
// First try to clone the repository
33+
try {
34+
Git.cloneRepository().setURI(remotePath).setDirectory(new File(localPath)).call();
35+
} catch (Exception ex) {
36+
// If clone fails, try to pull the changes
37+
try {
38+
git.pull().call();
39+
} catch (Exception exPull) {
40+
// Pull also failed. Throw this exception to caller
41+
throw exPull; // throw it
42+
}
43+
} finally {
44+
git.close();
45+
}
46+
} catch (Exception ex) {
47+
throw new Exception("Could not download Repository from Github. Error: " + ex.getMessage());
48+
}
49+
}
50+
51+
/**
52+
*
53+
* @param localPath
54+
* @param remotePath
55+
* @throws Exception
56+
*/
57+
public static void syncRepository(String localPath, String remotePath) throws Exception {
58+
Repository localRepo;
59+
try {
60+
localRepo = new FileRepository(localPath + "/.git");
61+
62+
Git git = new Git(localRepo);
63+
64+
// Pull the changes
65+
try {
66+
git.pull().call();
67+
} catch (Exception exPull) {
68+
// If pull failed. Throw this exception to caller
69+
70+
throw exPull; // throw it
71+
} finally {
72+
git.close();
73+
}
74+
75+
} catch (Exception ex) {
76+
throw new Exception("Could not update Repository from Github. Error: " + ex.getMessage());
77+
}
78+
}
79+
80+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 1998-2016 Aspose Pty Ltd.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
*
8+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
*
10+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
*/
12+
package com.aspose.slides.maven.utils;
13+
14+
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
15+
import org.eclipse.core.runtime.preferences.InstanceScope;
16+
17+
import com.aspose.slides.Activator;
18+
19+
/**
20+
*
21+
* @author Adeel
22+
*/
23+
public final class MavenSettings {
24+
25+
private static final String PROP_LAST_ARCHETYPE_GROUPID = "lastArchetypeGroupId";
26+
private static final String PROP_LAST_ARCHETYPE_VERSION = "lastArchetypeVersion";
27+
28+
private IEclipsePreferences getPreferences() {
29+
return InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
30+
}
31+
32+
/**
33+
*
34+
* @return
35+
*/
36+
public String getLastArchetypeGroupId() {
37+
return getPreferences().get(PROP_LAST_ARCHETYPE_GROUPID, "com.mycompany");
38+
}
39+
40+
/**
41+
*
42+
* @return
43+
*/
44+
public String getLastArchetypeVersion() {
45+
return getPreferences().get(PROP_LAST_ARCHETYPE_VERSION, "1.0-SNAPSHOT");
46+
}
47+
48+
/**
49+
*
50+
* @param version
51+
*/
52+
public void setLastArchetypeVersion(String version) {
53+
putProperty(PROP_LAST_ARCHETYPE_VERSION, version);
54+
}
55+
56+
/**
57+
*
58+
* @param groupId
59+
*/
60+
public void setLastArchetypeGroupId(String groupId) {
61+
putProperty(PROP_LAST_ARCHETYPE_GROUPID, groupId);
62+
}
63+
64+
private String putProperty(String key, String value) {
65+
String retval = getProperty(key);
66+
if (value != null) {
67+
getPreferences().put(key, value);
68+
} else {
69+
getPreferences().remove(key);
70+
}
71+
return retval;
72+
}
73+
74+
private static final MavenSettings INSTANCE = new MavenSettings();
75+
76+
/**
77+
*
78+
* @return
79+
*/
80+
public static MavenSettings getDefault() {
81+
return INSTANCE;
82+
}
83+
84+
private String getProperty(String key) {
85+
return getPreferences().get(key, null);
86+
}
87+
88+
}

‎Plugins/Aspose_Slides_Java_Maven_for_Eclipse/AsposeSlidesEclipsePlugin/src/org/eclipse/wb/swt/SWTResourceManager.java

Lines changed: 447 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>AsposeSlidesEclipseSite</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.pde.UpdateSiteBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.pde.UpdateSiteNature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<site>
3+
<description name="Aspose.Slides Java (Maven) for Eclipse - Eclipse Update Site" url="http://cdn.aspose.com/marketplace/eclipse/java/maven/asposeslides/">
4+
Aspose.Slides Maven Project wizard creates Maven Project for using Aspose.Slides for Java API within Eclipse IDE.
5+
Aspose.Slides for Java is a unique PowerPoint management component that enables Java applications to read, write and manipulate PowerPoint documents (PPT, PPTX, POS, PPS, POTX, PPSX) PDF, HTML and image file formats without using Microsoft PowerPoint.
6+
Aspose.Slides for Java is the first and only Java component that provides functionality to manage PowerPoint documents within your own applications.
7+
Aspose.Slides Maven Project wizard fetch and configures the latest Maven dependency reference of Aspose.Slides for Java from the Aspose Cloud Maven Repository.
8+
The wizard also gives you option to download the Code Examples to use Aspose.Slides for Java API.
9+
</description>
10+
<feature url="features/com.aspose.slides.java.maven_1.0.0.jar" id="com.aspose.slides.java.maven" version="1.0">
11+
<category name="com.aspose.slides.java.maven.category"/>
12+
</feature>
13+
<category-def name="com.aspose.slides.java.maven.category" label="Aspose.Slides Java (Maven) for Eclipse"/>
14+
</site>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2001-2016 Aspose Pty Ltd
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Aspose.Slides Java (Maven) for Eclipse
2+
3+
This project is **Eclipse IDE plugin** which lets developers use [Aspose.Slides for Java](http://www.aspose.com/java/powerpoint-component.aspx) in their Maven based Java projects.
4+
5+
## Who is supposed to use this **Plugin?**
6+
7+
This Plugin is intended for developers using Maven platform for Java developments and want to use [Aspose.Slides for Java](http://www.aspose.com/java/powerpoint-component.aspx) in their projects.
8+
9+
**NOTE:** [Aspose.Slides for Java](http://www.aspose.com/java/powerpoint-component.aspx) is Java API developed by [Aspose](http://aspose.com) that enables Java applications to read, write and manipulate PowerPoint documents (PPT, PPTX, POS, PPS, POTX, PPSX) PDF, HTML and image file formats without using Microsoft PowerPoint. For the API detailed features list check the [link](http://www.aspose.com/java/powerpoint-component.aspx).
10+
11+
## **Features**
12+
13+
The plugin provides following features to work with [Aspose.Slides for Java](http://www.aspose.com/java/powerpoint-component.aspx) API within **Eclipse IDE** comfortably:
14+
15+
### Aspose.Slides Maven Project (wizard)
16+
![plugin title shot](http://i.imgur.com/ZybtnEL.png)
17+
* By using this wizard plugin creates Maven project for using [Aspose.Slides for Java](http://www.aspose.com/java/powerpoint-component.aspx) from **New -> Project -> Maven-> Aspose.Slides Maven Project**
18+
* The wizard will also give option for downloading latest available Code Examples for using the API.
19+
20+
### Aspose.Slides Code Example (wizard)
21+
![plugin title shot](http://i.imgur.com/K1LvEO4.png)
22+
* By using this wizard plugin lets you copy the downloaded Code Examples into your project for using [Aspose.Slides for Java](http://www.aspose.com/java/powerpoint-component.aspx) from **New -> Other -> Java -> Aspose.Slides Code Example**
23+
* The wizard will also look for and updates for newly available Code Examples from [Aspose.Slides for Java examples repository.](https://github.com/asposeslides/Aspose_Slides_Java/tree/master/Examples)
24+
**NOTE:** Selected Code Examples (category) source codes will be copied under **"com.aspose.slides.examples"** package. Resources needed for running examples will be copied to the corresponding directory (package) within **"src/main/resources"**.
25+
26+
### Other Features
27+
28+
* Supports latest **Eclipse Mars.1 (4.5.1)** version
29+
* Compatible with **Mac**, **Linux Flavors** and **Windows**
30+
* Native IDE user experience
31+
* Open Source
32+
33+
## What is Aspose.Slides Java API?
34+
35+
**Aspose.Slides for Java** is a unique PowerPoint management component that enables Java applications to read, write and manipulate PowerPoint documents (PPT, PPTX, POS, PPS, POTX, PPSX) PDF, HTML and image file formats without using Microsoft PowerPoint.
36+
37+
**Aspose.Slides for Java** is the first and only Java component that provides functionality to manage PowerPoint documents within your own applications. As with all Aspose Java components, Aspose.Slides for Java is written in pure Java, incredibly priced and lightning fast.
38+
39+
For more info about the **Aspose.Slides for Java API**, [please check the api documentation - click here](http://www.aspose.com/java/powerpoint-component.aspx)
40+
41+
## Plugin Documentation
42+
43+
For the most complete documentation, [Please check this WIKI](http://www.aspose.com/docs/display/slidesjava/Aspose.Slides+Java+%28Maven%29+for+Eclipse)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Aspose.Slides Java (Maven) for Eclipse - Release Notes</title>
5+
</head>
6+
<body>
7+
8+
9+
<b>Aspose.Slides Java (Maven) for Eclipse - v1.0</b>
10+
<p> This is new Plugin for Eclipse IDE by <a href="http://aspose.com">Aspose</a>. The Plugin intended for developers using Maven platform for Java developments and want to use <a href="http://www.aspose.com/java/powerpoint-component.aspx">Aspose.Slides for Java</a> in their projects.</p>
11+
<p><b>NOTE:</b> <a href="http://www.aspose.com/java/powerpoint-component.aspx">Aspose.Slides for Java</a> is Java API developed by <a href="http://aspose.com">Aspose</a> that enables Java applications to read, write and manipulate PowerPoint documents (PPT, PPTX, POS, PPS, POTX, PPSX) PDF, HTML and image file formats without using Microsoft PowerPoint. For the API detailed features list check the <a href="http://www.aspose.com/java/powerpoint-component.aspx">link</a>.
12+
</p><p> The plugin provides following features to work with <a href="http://www.aspose.com/java/powerpoint-component.aspx">Aspose.Slides for Java</a> API within <b>Eclipse IDE</b> comfortably:
13+
</p><ul><li><b>Aspose.Slides Maven Project</b><br><ul><li>By using this wizard plugin creates Maven project for using <a href="http://www.aspose.com/java/powerpoint-component.aspx">Aspose.Slides for Java</a> from <b>New -> Project -> Maven-> Aspose.Slides Maven Project</b></li><li>The wizard will also give option for downloading latest available Code Examples for using the API.</li></ul></li>
14+
<li><b>Aspose.Slides Code Example</b><ul><li>By using this wizard plugin lets you copy the downloaded Code Examples into your project for using <a href="http://www.aspose.com/java/powerpoint-component.aspx">Aspose.Slides for Java</a> from <b>New -> Other -> Java -> Aspose.Slides Code Example</b></li><li>The wizard will also look for and updates for newly available Code Examples from <a href="https://github.com/asposeslides/Aspose_Slides_Java/tree/master/Examples">Aspose.Slides for Java examples repository.</a></li></ul></li>
15+
<li><b>Other Features</b><ul><li>Supports latest <b>Eclipse Mars.1 (4.5.1)</b> version</li><li>Compatible with <b>Mac</b>, <b>Linux Flavors</b> and <b>Windows</b></li><li>Native IDE user experience</li><li>Open Source</li></ul></li></ul>
16+
</body>
17+
</html>

0 commit comments

Comments
 (0)
Please sign in to comment.