diff --git a/.gitignore b/.gitignore index 0ff8a71..b5f7b54 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,9 @@ test-output/ # IntelliJ project files -.idea/ +#.idea/ *.iws -*.iml +#*.iml *.ipr # Mac diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/.name b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/.name new file mode 100644 index 0000000..2421f28 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/.name @@ -0,0 +1 @@ +Aspose.Email Java for IntelliJ Maven \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/compiler.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/copyright/Aspose_Pty_Ltd.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/copyright/Aspose_Pty_Ltd.xml new file mode 100644 index 0000000..98df6f8 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/copyright/Aspose_Pty_Ltd.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/copyright/profiles_settings.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..a776300 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/copyright/profiles_settings.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/dictionaries/Adeel_Ilyas.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/dictionaries/Adeel_Ilyas.xml new file mode 100644 index 0000000..ef47d47 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/dictionaries/Adeel_Ilyas.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/encodings.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/misc.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/misc.xml new file mode 100644 index 0000000..3800cb6 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/modules.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/modules.xml new file mode 100644 index 0000000..f817630 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/scopes/scope_settings.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/uiDesigner.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/uiDesigner.xml new file mode 100644 index 0000000..2eb9c98 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/uiDesigner.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/vcs.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/workspace.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/workspace.xml new file mode 100644 index 0000000..e38a0ed --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/.idea/workspace.xml @@ -0,0 +1,1122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Android Lint + + + General + + + Maven + + + Plugin DevKit + + + XPath + + + + + Abstraction issues + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + localhost + 5050 + + + + + + + + + + 1395416125898 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Aspose Pty Ltd + + + + + + + + Detection + + + + + + + + + + + + + + + 1.8 + + + + + + + + Aspose.Email Java for IntelliJ (Maven) + + + + + + + + + + + + + + + org.eclipse.jgit-3.4.1.201406201815-r + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/Aspose.Email Java for IntelliJ (Maven).iml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/Aspose.Email Java for IntelliJ (Maven).iml new file mode 100644 index 0000000..71bea68 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/Aspose.Email Java for IntelliJ (Maven).iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/LICENSE b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/LICENSE new file mode 100644 index 0000000..8002026 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2001-2015 Aspose Pty Ltd. + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. + diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/META-INF/plugin.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/META-INF/plugin.xml new file mode 100644 index 0000000..317809c --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/META-INF/plugin.xml @@ -0,0 +1,28 @@ + + + com.aspose.email.java.intellij.maven + Aspose.Email Java for IntelliJ IDEA Maven + 1.0.0.0 + Aspose Pty Ltd. + + + Aspose.Email for Java API allows developers to create as well as read message files, enabling complete processing of message contents.

Aspose.Email for Java enables you to create, read and manipulate Outlook MSG, PST, EML, EMLX and MHT files from within a Java application without the need of using Microsoft Outlook. The API also allows connecting to email servers and send/receive emails. It's support for POP3, IMAP and SMTP protocols provide complete capability of working with SSL as well as non-SSL email servers.

The plugin's Aspose.Email Maven Project wizard lets you create a Aspose.Email Java API maven project by fetching & referencing the latest API mvn artifact from the Aspose Cloud Maven Repository.

Plugin provided wizards also gives you option to download & import the example source codes for using Aspose.Email for Java API.

After the completion of wizard, project will be created and API examples are downloaded. All references and required resources will also be automatically added to the project.

You can then import / use codes (using option File-> New-> Aspose.Email Example) from downloaded examples for your project needs and enhance them as necessary.
+ ]]>
+ + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/README.md b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/README.md new file mode 100644 index 0000000..e52fad3 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/README.md @@ -0,0 +1,44 @@ +## Aspose.Email Java for IntelliJ IDEA (Maven) + +The project is **Intellij IDEA (JetBrains IDE) plugin** allows developer to create, read and manipulate Outlook MSG, PST, EML, EMLX and MHT messages using API -**Aspose.Email for Java** that enables you the processing of email messages from within your Java code without the need of using Microsoft Outlook. + +The plugins is for those who wants to utilize / use **Aspose.Email for Java API** in their java projects. + +The plugin contains two wizards: + +1. **Aspose-Email Maven Project** Wizard - To create **Aspose.Email for Java API** Maven project +2. **Aspose.Email Examples** - To create / download **Aspose.Email for Java API** Examples Source Codes (Which is meant to demonstrate the usages of the API) + +**Wizards Detail:** + +1. **Aspose.Email Maven Project** wizard, after installing the plugin, can be run from **File->New Project->Aspose.Email Maven Project** option. You will have to follow the wizard steps asking for the project information i.e **Project Name, Artifact ID** for your maven project or whether you want to download the Examples Source Codes (for later addition into the project). +2. **Aspose.Email Examples** wizard lets you create /copy downloaded Source Code Examples into your project. All the examples withn the selected category will be copied/ created inside "**com.aspose.email.examples**" package and also the corresponding directory structure for the package will be created within "src/main/resources" folder which is needed to run the examples. + +## What is Aspose.Email Java API? + +Managing and manipulating emails that come in through Microsoft Outlook doesn’t have to be difficult. It doesn’t even have to involve Outlook. **Aspose.Email for Java** lets you focus on the business logic by hiding the complexities of the Microsoft Outlook file formats implementation. It gives you the tools you need to create, read and manipulate **Outlook MSG, PST, EML and MHT** files from within a Java application. + +**Aspose.Email for Java** includes classes that allow you to create as well as read message files, enabling complete processing of message contents. **You can manipulate a number of message formats such as MSG, EML, EMLX, and MHT without the need of using Microsoft Outlook**. You can not only modify the message contents, but also manipulate (add/remove) message attachments. It provides you sufficient ability to customize message headers and also empowers you to completely control a message by exposing its Mapi properties. + +Aspose.Email API also provides the ability to manipulate message storage files i.e. Personal Storage Files (PST) and Offline Storage Files (OST). You can create PST, add messages to it, extract information from various PST folders, and remove items from the PST with just a few lines of code. Its powerful API gives you complete access to the contents of a PST for manipulation. + +For more info about the **Aspose.Email for Java API**, [please check the api documentation - click here](http://goo.gl/idmYQ1) + +## Plugin Documentation + +For the complete documentation of this Intellij IDEA plugin, [please go through this wiki - click here](http://goo.gl/j0rSTJ) + +## Download Latest Versions? + + +* [Latest Releases on Codeplex](https://asposeemailjavaintellij.codeplex.com/releases/view) + + + +## Clone Plugin SourceCodes? + + +This project is also hosted and maintained at CodePlex. To clone navigate to: + + +* [Aspose.Email Java for IntelliJ Maven on CodePlex - click here](https://asposeemailjavaintellij.codeplex.com/SourceControl/latest) diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/lib/org.eclipse.jgit-3.4.1.201406201815-r.jar b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/lib/org.eclipse.jgit-3.4.1.201406201815-r.jar new file mode 100644 index 0000000..1018c85 Binary files /dev/null and b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/lib/org.eclipse.jgit-3.4.1.201406201815-r.jar differ diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/Bundle.properties b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/Bundle.properties new file mode 100644 index 0000000..fbbfc03 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/Bundle.properties @@ -0,0 +1,26 @@ +# +# The MIT License (MIT) +# +# Copyright (c) 2001-2015 Aspose Pty Ltd. +# +# 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: +# +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +# +# 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. +# + +AsposeWizardPanel.myMainPanel.border.title=Description: +AsposeWizardPanel.myMainPanel.description= <
Aspose.Email for Java API allows developers to create as well as read message files, enabling complete processing of message contents.

Aspose.Email for Java enables you to create, read and manipulate Outlook MSG, PST, EML, EMLX and MHT files from within a Java application without the need of using Microsoft Outlook. The API also allows connecting to email servers and send/receive emails. It's support for POP3, IMAP and SMTP protocols provide complete capability of working with SSL as well as non-SSL email servers.

The plugin's Aspose.Email Maven Project wizard lets you create a Aspose.Email Java API maven project by fetching & referencing the latest API mvn artifact from the Aspose Cloud Maven Repository.

Plugin provided wizards also gives you option to download & import the example source codes for using Aspose.Email for Java API.

After the completion of wizard, project will be created and API examples are downloaded. All references and required resources will also be automatically added to the project.

You can then import / use codes (using option File-> New-> Aspose.Email Example) from downloaded examples for your project needs and enhance them as necessary.
+AsposeWizardPanel.WizardStep.ExampleChkbox=Also Download Example Source Codes (of Aspose.Email for Java) +AsposeWizardPanel.WizardStep.headingMavn=Please provide your creating maven project artifact detail: + +AsposeManager.progressMessage=Retrieving Aspose.Email for java - Maven Dependency... +AsposeManager.projectMessage=Creating Aspose.Email maven project... +AsposeManager.progressTitle=Retrieving Latest Maven artifact... +AsposeManager.progressExamplesTitle=Downloading Example Source Codes... +AsposeManager.downloadExamplesMessage=Downloading Aspose.Email for java - Example Source Codes... + +AsposeExamples.title=Aspose.Email Example +AsposeExamples.message=Aspose.Email Examples allow you to add Aspose sourcecode examples to demonstrate Aspose.Email Java API usage. Available samples are displayed in tree format from where you can select one. Selected category examples will be added to current project including source files and required data files. +AsposeExample.jLabel1_text=Aspose.Email for Java (version): diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExampleAction.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExampleAction.java new file mode 100644 index 0000000..e6f3892 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExampleAction.java @@ -0,0 +1,41 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.examples; + +import com.aspose.utils.AsposeMavenProjectManager; +import com.aspose.utils.AsposeEmailJavaAPI; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.project.DumbAware; +import com.intellij.openapi.project.Project; + +import java.util.ResourceBundle; + +/** + * Created by Adeel Ilyas on 9/9/2015. + */ +public class AsposeExampleAction extends AnAction implements DumbAware { + public void actionPerformed(AnActionEvent e) { + final Project project = getEventProject(e); + if (project == null) { + return; + } + ResourceBundle bundle = ResourceBundle.getBundle("Bundle"); + AsposeMavenProjectManager asposeMavenProjectManager = AsposeMavenProjectManager.initialize(project); + AsposeEmailJavaAPI.initialize(asposeMavenProjectManager); + final AsposeExampleDialog dialog = new AsposeExampleDialog(bundle.getString("AsposeExamples.title"),bundle.getString("AsposeExamples.message")); + dialog.show(); + } + + +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExampleCallback.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExampleCallback.java new file mode 100644 index 0000000..cf54f24 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExampleCallback.java @@ -0,0 +1,69 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.examples; + + +import com.aspose.utils.AsposeJavaAPI; +import com.aspose.utils.AsposeEmailJavaAPI; +import com.aspose.utils.execution.CallBackHandler; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; +import com.intellij.openapi.progress.ProgressIndicator; +import org.jetbrains.annotations.NotNull; + +/** + * Created by Adeel Ilyas on 9/9/2015. + */ +public class AsposeExampleCallback implements CallBackHandler { + + public AsposeExamplePanel getPage() { + return page; + } + + private AsposeExamplePanel page; + CustomMutableTreeNode top; + public AsposeExampleCallback(AsposeExamplePanel page,CustomMutableTreeNode top) { + this.page = page; + this.top = top; + } + @Override + public boolean executeTask(@NotNull ProgressIndicator progressIndicator) { + // progressIndicator.setIndeterminate(true); + // Set the progress bar percentage and text + progressIndicator.setFraction(0.10); + + progressIndicator.setText("Preparing to refresh examples"); + + final String item = (String) page.getComponentSelection().getSelectedItem(); + + if (item != null && !item.equals("Select Java API")) { + ApplicationManager.getApplication().invokeAndWait(new Runnable() { + @Override + public void run() { + page.diplayMessage("Please wait. Preparing to refresh examples", true); + } + }, ModalityState.defaultModalityState()); + + progressIndicator.setFraction(0.20); + AsposeJavaAPI component = AsposeEmailJavaAPI.getInstance(); + component.checkAndUpdateRepo(progressIndicator); + if (component.isExamplesDefinitionAvailable()) { + progressIndicator.setFraction(0.60); + page.populateExamplesTree(component, top,progressIndicator); + } + } + + progressIndicator.setFraction(1); + return true; + } +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExampleDialog.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExampleDialog.java new file mode 100644 index 0000000..f79c6b7 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExampleDialog.java @@ -0,0 +1,147 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.examples; + +import com.aspose.utils.*; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.ui.DialogWrapper; +import org.w3c.dom.NodeList; + +import javax.swing.*; +import java.io.File; +import java.io.IOException; + +/** + * Created by Adeel Ilyas on 9/9/2015. + */ + +public class AsposeExampleDialog extends DialogWrapper { + private static final Logger LOG = Logger.getInstance("#com.aspose.examples.AsposeExampleDialog"); + + private final String myDescription; + private AsposeExamplePanel component; + + public AsposeExampleDialog(final String title, String description) { + super(false); + myDescription = description; + setTitle(title); + init(); + setOKButtonText("Create"); + setOKActionEnabled(false); + } + + public void updateControls(boolean selection) { + setOKActionEnabled(selection); + } + + @Override + protected void doOKAction() { + super.doOKAction(); + createExample(); + AsposeMavenProjectManager.getInstance().getProjectHandle().getProjectFile().getFileSystem().refresh(false); + AsposeMavenProjectManager.getInstance().getProjectHandle().getBaseDir().getFileSystem().refresh(false); + } + + @Override + public JComponent getPreferredFocusedComponent() { + AsposeConstants.println("AsposeExamplePanel getComponent(): is called ..."); + if (component == null) { + component = new AsposeExamplePanel(this); + } + + return component.getComponentSelection(); + } + + @Override + protected JComponent createCenterPanel() { + AsposeConstants.println("AsposeExamplePanel getComponent(): is called ..."); + if (component == null) { + component = new AsposeExamplePanel(this); + } + return component; + } + + @Override + protected String getDimensionServiceKey() { + return "#com.aspose.examples.AsposeExampleDialog"; + } + + //========================================================================= + + + //========================================================================= + private boolean createExample() { + String projectPath = component.getSelectedProjectRootPath(); + CustomMutableTreeNode comp = getSelectedNode(); + if (comp == null || !comp.isFolder()) { + return false; + } + try { + + String sourceRepositoryExamplePath = comp.getExPath(); + + String repositorylocation = AsposeEmailJavaAPI.getInstance().getLocalRepositoryPath(); + String repositoryPOM_XML=repositorylocation+File.separator+"Examples"+File.separator+AsposeConstants.MAVEN_POM_XML; + + NodeList examplesNoneAsposeDependencies=AsposeMavenProjectManager.getInstance().getDependenciesFromPOM(repositoryPOM_XML,AsposeConstants.ASPOSE_GROUP_ID); + + AsposeMavenProjectManager.getInstance().addMavenDependenciesInProject(examplesNoneAsposeDependencies); + + NodeList examplesNoneAsposeRepositories=AsposeMavenProjectManager.getInstance().getRepositoriesFromPOM(repositoryPOM_XML, AsposeConstants.ASPOSE_MAVEN_REPOSITORY); + + AsposeMavenProjectManager.getInstance().addMavenRepositoriesInProject(examplesNoneAsposeRepositories); + + String sourceExamplesUtilsPath= repositorylocation+File.separator+AsposeConstants.REPOSITORY_UTIL; + String destinationExamplesUtilsPath = projectPath + File.separator + sourceExamplesUtilsPath.replace(repositorylocation + File.separator + AsposeConstants.SOURCE_API_EXAMPLES_LOCATION, AsposeConstants.DESTINATION_API_EXAMPLES_LOCATION); + + String destinationExamplePath = projectPath + File.separator + sourceRepositoryExamplePath.replace(repositorylocation + File.separator + AsposeConstants.SOURCE_API_EXAMPLES_LOCATION, AsposeConstants.DESTINATION_API_EXAMPLES_LOCATION); + + String destinationResourcePath = projectPath + File.separator + sourceRepositoryExamplePath.replace(repositorylocation + File.separator + AsposeConstants.SOURCE_API_EXAMPLES_LOCATION, AsposeConstants.DESTINATION_API_EXAMPLES_RESOURCES_LOCATION); + + + String sourceRepositoryExampleResourcesPath = sourceRepositoryExamplePath.replace(AsposeConstants.SOURCE_API_EXAMPLES_LOCATION, AsposeConstants.SOURCE_API_EXAMPLES_RESOURCES_LOCATION); + + //Copying Example Category + copyExample(sourceRepositoryExamplePath, destinationExamplePath); + + //Copying Example Resoureces + copyExample(sourceRepositoryExampleResourcesPath, destinationResourcePath); + + + //Copying Utils.java + AsposeMavenProjectManager.copyDirectory(new File(sourceExamplesUtilsPath + File.separator), new File(destinationExamplesUtilsPath + File.separator)); + + if (sourceRepositoryExamplePath == null || comp == null) { + return false; + } + + } catch (Exception ex) { + return false; + } + return true; + } + + //========================================================================= + private CustomMutableTreeNode getSelectedNode() { + return (CustomMutableTreeNode) component.getExamplesTree().getLastSelectedPathComponent(); + } + + //========================================================================= + private void copyExample(String sourcePath, String destinationPath) { + try { + AsposeMavenProjectManager.copyDirectory(sourcePath, destinationPath); + } catch (IOException ex) { + ex.printStackTrace(); + } + } +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExamplePanel.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExamplePanel.java new file mode 100644 index 0000000..ff03818 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/AsposeExamplePanel.java @@ -0,0 +1,355 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ +package com.aspose.examples; + +import com.aspose.utils.AsposeConstants; +import com.aspose.utils.AsposeJavaAPI; +import com.aspose.utils.AsposeMavenProjectManager; +import com.aspose.utils.FormatExamples; +import com.aspose.utils.execution.ModalTaskImpl; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; +import com.intellij.openapi.ui.ComboBox; +import com.intellij.ui.components.JBScrollPane; +import com.intellij.ui.treeStructure.Tree; + +import javax.swing.*; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import java.awt.*; +import java.io.File; +import java.util.*; + +/** + * Created by Adeel Ilyas on 9/9/2015. + */ + +public final class AsposeExamplePanel extends JPanel { + + AsposeExampleDialog dialog; + + /** + * Creates new form AsposeExamplePanel + */ + public AsposeExamplePanel(AsposeExampleDialog dialog) { + initComponents(); + initComponentsUser(); + this.dialog = dialog; + + } + + private void initComponentsUser() { + CustomMutableTreeNode top = new CustomMutableTreeNode(""); + read(); + validateDialog(); + } + + @Override + public String getName() { + return AsposeConstants.API_NAME + " for Java API and Examples"; + } + + private void initComponents() { + ResourceBundle bundle = ResourceBundle.getBundle("Bundle"); + jPanel1 = new JPanel(); + jLabel2 = new JLabel(); + componentSelection = new ComboBox(); + + jLabel1 = new JLabel(); + jLabelMessage = new JLabel(); + jLabelMessage.setOpaque(true); + jScrollPane1 = new JBScrollPane(); + + examplesTree = new Tree(); + + jPanel1.setBackground(new Color(255, 255, 255)); + jPanel1.setBorder(BorderFactory.createEtchedBorder()); + jPanel1.setForeground(new Color(255, 255, 255)); + + jLabel2.setIcon(icon); // NOI18N + jLabel2.setText(""); + + + jLabel2.setHorizontalAlignment(SwingConstants.CENTER); + jLabel2.setDoubleBuffered(true); + jLabel2.setOpaque(true); + jLabel2.addComponentListener(new java.awt.event.ComponentAdapter() { + public void componentResized(java.awt.event.ComponentEvent evt) { + jLabel2ComponentResized(evt); + } + }); + + + GroupLayout jPanel1Layout = new GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup() + .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 390, Short.MAX_VALUE) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup() + .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel2) + .addGap(0, 0, Short.MAX_VALUE)) + ); + componentSelection.setModel(new DefaultComboBoxModel()); + + + componentSelection.addPropertyChangeListener(new java.beans.PropertyChangeListener() { + public void propertyChange(java.beans.PropertyChangeEvent evt) { + componentSelection_Propertychanged(evt); + } + }); + jLabel1.setText(bundle.getString("AsposeExample.jLabel1_text")); + jLabelMessage.setText(""); + examplesTree.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + examplesTree_clicked(evt); + } + }); + jScrollPane1.setViewportView(examplesTree); + + GroupLayout layout = new GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 361, GroupLayout.PREFERRED_SIZE) + .addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) + ); + } + + //========================================================================= + private void jLabel2ComponentResized(java.awt.event.ComponentEvent evt) { + int labelwidth = jLabel2.getWidth(); + int labelheight = jLabel2.getHeight(); + Image img = icon.getImage(); + jLabel2.setIcon(new ImageIcon(img.getScaledInstance(labelwidth, labelheight, Image.SCALE_FAST))); + } + + public String getSelectedProjectRootPath() { + return AsposeMavenProjectManager.getInstance().getProjectHandle().getBasePath(); + } + + //========================================================================= + void read() { + AsposeConstants.println(" === New File Visual Panel.read() === " + AsposeMavenProjectManager.getInstance().getProjectHandle().getBaseDir().getName()); + retrieveAPIDependency(); + retrieveAPIExamples(); + } + + //========================================================================= + private boolean retrieveAPIDependency() { + getComponentSelection().removeAllItems(); + String versionNo = AsposeMavenProjectManager.getInstance().getDependencyVersionFromPOM(AsposeConstants.API_MAVEN_DEPENDENCY); + if (versionNo == null) { + getComponentSelection().addItem(AsposeConstants.API_DEPENDENCY_NOT_FOUND); + } else { + getComponentSelection().addItem(versionNo); + } + return true; + } + + //========================================================================= + private void retrieveAPIExamples() { + final String item = (String) getComponentSelection().getSelectedItem(); + CustomMutableTreeNode top = new CustomMutableTreeNode(""); + DefaultTreeModel model = (DefaultTreeModel) getExamplesTree().getModel(); + model.setRoot(top); + model.reload(top); + if (item != null && !item.equals(AsposeConstants.API_DEPENDENCY_NOT_FOUND)) { + + AsposeExampleCallback callback = new AsposeExampleCallback(this, top); + final ModalTaskImpl modalTask = new ModalTaskImpl(AsposeMavenProjectManager.getInstance().getProjectHandle(), callback, "Please wait..."); + ProgressManager.getInstance().run(modalTask); + top.setTopTreeNodeText(AsposeConstants.API_NAME); + model.setRoot(top); + model.reload(top); + getExamplesTree().expandPath(new TreePath(top.getPath())); + + } + + } + +//========================================================================= + + @Override + public void validate() { + AsposeConstants.println("AsposeExamplePanel validate called.."); + } + + //========================================================================= + public boolean validateDialog() { + if (isExampleSelected()) { + if (dialog != null) + dialog.updateControls(true); + clearMessage(); + return true; + } + final String item = (String) getComponentSelection().getSelectedItem(); + if (item == null || item.equals(AsposeConstants.API_DEPENDENCY_NOT_FOUND)) { + if (dialog != null) + dialog.updateControls(false); + diplayMessage("Please first add maven dependency of " + AsposeConstants.API_NAME + " for java API", true); + return false; + } else if (!isExampleSelected()) { + if (dialog != null) + dialog.updateControls(false); + diplayMessage(AsposeConstants.ASPOSE_SELECT_EXAMPLE, true); + return false; + } + if (dialog != null) + dialog.updateControls(true); + clearMessage(); + return true; + } + + //========================================================================= + + private boolean isExampleSelected() { + CustomMutableTreeNode comp = (CustomMutableTreeNode) getExamplesTree().getLastSelectedPathComponent(); + if (comp == null) { + return false; + } + try { + + if (!comp.isFolder()) { + return false; + } + } catch (Exception ex) { + return false; + } + return true; + } + + //========================================================================= + public void diplayMessage(String message, boolean error) { + + if (error) { + jLabelMessage.setForeground(Color.RED); + } else { + jLabelMessage.setForeground(Color.GREEN); + } + jLabelMessage.setText(message); + } + + //========================================================================= + private void clearMessage() { + jLabelMessage.setText(""); + + } + + //========================================================================= + public int showMessage(String title, String message, int buttons, int icon) { + int result = JOptionPane.showConfirmDialog(null, message, title, buttons, icon); + return result; + } + + + //==================================================================== + public void populateExamplesTree(AsposeJavaAPI asposeComponent, CustomMutableTreeNode top, ProgressIndicator p) + + { + String examplesFullPath = asposeComponent.getLocalRepositoryPath() + File.separator + AsposeConstants.SOURCE_API_EXAMPLES_LOCATION; + File directory = new File(examplesFullPath); + AsposeConstants.println(examplesFullPath+ "exists?"+directory.exists()); + getExamplesTree().removeAll(); + top.setExPath(examplesFullPath); + Queue queue = new LinkedList<>(); + queue.add(new Object[]{null, directory}); + + while (!queue.isEmpty()) { + Object[] _entry = queue.remove(); + File childFile = ((File) _entry[1]); + CustomMutableTreeNode parentItem = ((CustomMutableTreeNode) _entry[0]); + if (childFile.isDirectory()) { + if (parentItem != null) { + CustomMutableTreeNode child = new CustomMutableTreeNode(FormatExamples.formatTitle(childFile.getName())); + child.setExPath(childFile.getAbsolutePath()); + child.setFolder(true); + parentItem.add(child); + parentItem = child; + } else { + parentItem = top; + } + for (File f : childFile.listFiles()) { + String fileName=f.getName().toLowerCase(); + queue.add(new Object[]{parentItem, f}); + } + } else if (childFile.isFile()) { + + String title = FormatExamples.formatTitle(childFile.getName()); + CustomMutableTreeNode child = new CustomMutableTreeNode(title); + child.setFolder(false); + parentItem.add(child); + + } + } + + } + + + private void componentSelection_Propertychanged(java.beans.PropertyChangeEvent evt) { + + } + + //========================================================================= + private void examplesTree_clicked(java.awt.event.MouseEvent evt) + { + // TODO add your handling code here: + TreePath path = getExamplesTree().getSelectionPath(); + + validateDialog(); + } + + // Variables declaration + private JComboBox componentSelection; + private JTree examplesTree; + private JLabel jLabel1; + private JLabel jLabel2; + private JLabel jLabelMessage; + private JPanel jPanel1; + private JScrollPane jScrollPane1; + private ImageIcon icon = new ImageIcon(getClass().getResource("/resources/long_bannerIntelliJ.png")); + // End of variables declaration + + /** + * @return the examplesTree + */ + public JTree getExamplesTree() { + return examplesTree; + } + + /** + * @return the componentSelection + */ + public JComboBox getComponentSelection() { + return componentSelection; + } +} \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/CustomMutableTreeNode.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/CustomMutableTreeNode.java new file mode 100644 index 0000000..40a9b4d --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/examples/CustomMutableTreeNode.java @@ -0,0 +1,55 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.examples; + +import javax.swing.tree.DefaultMutableTreeNode; + +/** + * + * @author Adeel Ilyas + */ +public final class CustomMutableTreeNode extends DefaultMutableTreeNode{ + + private boolean folder; + private String _ExPath; + + public void setTopTreeNodeText(String data) { + this.userObject = data; + } + public CustomMutableTreeNode(String data) + { + this.userObject = data; + } + + /** + * @return the _ExPath + */ + public String getExPath() { + return _ExPath; + } + + /** + * @param ExPath the _ExPath to set + */ + public void setExPath(String ExPath) { + this._ExPath = ExPath; + } + + public boolean isFolder() { + return folder; + } + + public void setFolder(boolean folder) { + this.folder = folder; + } +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/Metadata.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/Metadata.java new file mode 100644 index 0000000..4067ae7 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/Metadata.java @@ -0,0 +1,372 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2014.09.26 at 03:01:37 PM PKT +// + + +package com.aspose.maven.apis.artifacts; + +import javax.xml.bind.annotation.*; +import java.util.ArrayList; +import java.util.List; + + +/** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="groupId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="artifactId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="version" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="versioning">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="latest" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *                   <element name="release" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *                   <element name="versions">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="version" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="lastUpdated" type="{http://www.w3.org/2001/XMLSchema}long"/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "groupId", + "artifactId", + "version", + "versioning", + "classifier" +}) +@XmlRootElement(name = "metadata") +public class Metadata { + + @XmlElement(required = true) + protected String groupId; + @XmlElement(required = true) + protected String artifactId; + @XmlElement(required = true) + protected String version; + @XmlElement(required = true) + protected Metadata.Versioning versioning; + protected String classifier; + + /** + * Gets the value of the groupId property. + * + * @return possible object is + * {@link String } + */ + public String getGroupId() { + return groupId; + } + + /** + * Sets the value of the groupId property. + * + * @param value allowed object is + * {@link String } + */ + public void setGroupId(String value) { + this.groupId = value; + } + + /** + * Gets the value of the artifactId property. + * + * @return possible object is + * {@link String } + */ + public String getArtifactId() { + return artifactId; + } + + /** + * Sets the value of the artifactId property. + * + * @param value allowed object is + * {@link String } + */ + public void setArtifactId(String value) { + this.artifactId = value; + } + + /** + * Gets the value of the version property. + * + * @return possible object is + * {@link String } + */ + public String getVersion() { + return version; + } + + /** + * Sets the value of the version property. + * + * @param value allowed object is + * {@link String } + */ + public void setVersion(String value) { + this.version = value; + } + + /** + * Gets the value of the versioning property. + * + * @return possible object is + * {@link Metadata.Versioning } + */ + public Metadata.Versioning getVersioning() { + return versioning; + } + + /** + * Sets the value of the versioning property. + * + * @param value allowed object is + * {@link Metadata.Versioning } + */ + public void setVersioning(Metadata.Versioning value) { + this.versioning = value; + } + + + /** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="latest" type="{http://www.w3.org/2001/XMLSchema}string"/>
+     *         <element name="release" type="{http://www.w3.org/2001/XMLSchema}string"/>
+     *         <element name="versions">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="version" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="lastUpdated" type="{http://www.w3.org/2001/XMLSchema}long"/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "latest", + "release", + "versions", + "lastUpdated" + }) + public static class Versioning { + + @XmlElement(required = true) + protected String latest; + @XmlElement(required = true) + protected String release; + @XmlElement(required = true) + protected Metadata.Versioning.Versions versions; + protected long lastUpdated; + + /** + * Gets the value of the latest property. + * + * @return possible object is + * {@link String } + */ + public String getLatest() { + return latest; + } + + /** + * Sets the value of the latest property. + * + * @param value allowed object is + * {@link String } + */ + public void setLatest(String value) { + this.latest = value; + } + + /** + * Gets the value of the release property. + * + * @return possible object is + * {@link String } + */ + public String getRelease() { + return release; + } + + /** + * Sets the value of the release property. + * + * @param value allowed object is + * {@link String } + */ + public void setRelease(String value) { + this.release = value; + } + + /** + * Gets the value of the versions property. + * + * @return possible object is + * {@link Metadata.Versioning.Versions } + */ + public Metadata.Versioning.Versions getVersions() { + return versions; + } + + /** + * Sets the value of the versions property. + * + * @param value allowed object is + * {@link Metadata.Versioning.Versions } + */ + public void setVersions(Metadata.Versioning.Versions value) { + this.versions = value; + } + + /** + * Gets the value of the lastUpdated property. + */ + public long getLastUpdated() { + return lastUpdated; + } + + /** + * Sets the value of the lastUpdated property. + */ + public void setLastUpdated(long value) { + this.lastUpdated = value; + } + + + /** + *

Java class for anonymous complex type. + *

+ *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="version" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "version" + }) + public static class Versions { + + protected List version; + + /** + * Gets the value of the version property. + *

+ *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the version property. + *

+ *

+ * For example, to add a new item, do as follows: + *

+             *    getVersion().add(newItem);
+             * 
+ *

+ *

+ *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + */ + public List getVersion() { + if (version == null) { + version = new ArrayList(); + } + return this.version; + } + + } + + } + + /** + * Gets the value of the classifier property. + * + * @return possible object is + * {@link String } + */ + public String getClassifier() { + return classifier; + } + + /** + * Sets the value of the version property. + * + * @param value allowed object is + * {@link String } + */ + public void setClassifier(String value) { + this.classifier = value; + } + + +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/ObjectFactory.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/ObjectFactory.java new file mode 100644 index 0000000..6e66b21 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/ObjectFactory.java @@ -0,0 +1,71 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2014.09.26 at 03:01:37 PM PKT +// + + +package com.aspose.maven.apis.artifacts; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.aspose.maven.apis.artifacts package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.aspose.maven.apis.artifacts + */ + public ObjectFactory() { + } + + + /** + * Create an instance of {@link Metadata.Versioning.Versions } + */ + public Metadata.Versioning.Versions createMetadataVersioningVersions() { + return new Metadata.Versioning.Versions(); + } + + /** + * Create an instance of {@link Metadata } + */ + public Metadata createMetadata() { + return new Metadata(); + } + + /** + * Create an instance of {@link Metadata.Versioning } + */ + public Metadata.Versioning createMetadataVersioning() { + return new Metadata.Versioning(); + } + +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/maven-metada.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/maven-metada.xml new file mode 100644 index 0000000..cf4eeda --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/maven-metada.xml @@ -0,0 +1,29 @@ + + + + + com.aspose + aspose-words + 14.5.0 + + 14.8.0 + 14.8.0 + + 14.5.0 + 14.6.0 + 14.7.0 + 14.8.0 + + 20140924084136 + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/maven-metadata.xsd b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/maven-metadata.xsd new file mode 100644 index 0000000..e0edf85 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/maven/apis/artifacts/maven-metadata.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeConstants.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeConstants.java new file mode 100644 index 0000000..362254b --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeConstants.java @@ -0,0 +1,61 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.utils; + +/* + * @author Adeel Ilyas + */ + +import java.io.File; + +public class AsposeConstants { + + public static final String ASPOSE_MAVEN_REPOSITORY = "http://maven.aspose.com"; + public static final String API_NAME = "Aspose.Email"; + public static final String ASPOSE_GROUP_ID = "com.aspose"; + public static final String API_MAVEN_DEPENDENCY = "aspose-email"; + public static final String API_EXAMPLES_PACKAGE ="com"+File.separator+API_MAVEN_DEPENDENCY.replace("-",File.separator)+File.separator+"examples"; + public static final String SOURCE_API_EXAMPLES_LOCATION ="Examples"+File.separator+"src"+File.separator+"main"+File.separator+"java"+File.separator+API_EXAMPLES_PACKAGE; + public static final String SOURCE_API_EXAMPLES_RESOURCES_LOCATION ="Examples"+File.separator+"src"+File.separator+"main"+File.separator+"resources"+File.separator+API_EXAMPLES_PACKAGE; + public static final String DESTINATION_API_EXAMPLES_LOCATION="src"+File.separator+"main"+File.separator+"java"+File.separator+ API_EXAMPLES_PACKAGE; + public static final String DESTINATION_API_EXAMPLES_RESOURCES_LOCATION="src"+File.separator+"main"+File.separator+"resources"+File.separator+ API_EXAMPLES_PACKAGE; + + public static final String REPOSITORY_UTIL=SOURCE_API_EXAMPLES_LOCATION+File.separator+"Utils.java"; + + public static final String API_DEPENDENCY_NOT_FOUND = "Dependency not found!"; + + public static final String MAVEN_POM_XML = "pom.xml"; + + public static final String WIZARD_NAME = "Aspose.Email Maven Project"; + public static final String ASPOSE_SELECT_EXAMPLE = "Please just select one examples category"; + + public static final String INTERNET_CONNNECTIVITY_PING_URL = "java.sun.com"; + + // Messages UI text + + public static final String MAVEN_INTERNET_CONNECTION_REQUIRED_MESSAGE = "Internet connectivity is not available!\nInternet connectivity is required to retrieve latest Aspose.Email Maven Artifact"; + + public static final String EXAMPLES_INTERNET_CONNECTION_REQUIRED_MESSAGE = "Internet connectivity is required to download examples"; + public static final String MAVEN_ARTIFACTS_RETRIEVE_FAIL = "Unknown Error!\nCould not retrieve latest Aspose.Email Maven Artifact!"; + + public static final String EXAMPLES_DOWNLOAD_FAIL = "Unknown Error!\nCould not download Aspose.Email for Java API example Source codes!"; + public static final String EXAMPLES_NOT_AVAILABLE_MESSAGE = "This component does not have examples yet, We will add examples soon"; + public static final String EXAMPLES_NOT_AVAILABLE_TITLE="Examples not available"; + public static boolean printing_allowed = false; + + public static final void println(String message) { + if (printing_allowed) { + System.out.println(message); + } + } +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeEmailJavaAPI.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeEmailJavaAPI.java new file mode 100644 index 0000000..5ebaa9b --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeEmailJavaAPI.java @@ -0,0 +1,60 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ +package com.aspose.utils; + +/* + * @author Adeel Ilyas + * + */ + +// Singleton Class + +public class AsposeEmailJavaAPI extends AsposeJavaAPI { + private String _name = AsposeConstants.API_NAME; + private String _mavenRepositoryURL = "http://maven.aspose.com/repository/ext-release-local/com/aspose/aspose-email/"; + private String _remoteExamplesRepository = "https://github.com/asposeemail/Aspose_Email_Java"; + + /** + * @return the _name + */ + public String get_name() { + return _name; + } + + /** + * @return the _mavenRepositoryURL + */ + public String get_mavenRepositoryURL() { + return _mavenRepositoryURL; + } + + /** + * @return the _remoteExamplesRepository + */ + public String get_remoteExamplesRepository() { + return _remoteExamplesRepository; + } + + // Singleton instance + private static AsposeJavaAPI asposeEmailAPI; + + public static AsposeJavaAPI getInstance() { + return asposeEmailAPI; + } + public static AsposeJavaAPI initialize(AsposeMavenProjectManager asposeMavenProjectManager) { + asposeEmailAPI= new AsposeEmailJavaAPI(); + asposeEmailAPI.asposeMavenProjectManager =asposeMavenProjectManager; + return asposeEmailAPI; + } + + private AsposeEmailJavaAPI(){} +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeJavaAPI.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeJavaAPI.java new file mode 100644 index 0000000..d16c438 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeJavaAPI.java @@ -0,0 +1,127 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.utils; + +import com.intellij.openapi.progress.ProgressIndicator; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; +import java.io.File; + +/** + * Created by Adeel on 9/9/2015. + */ +public abstract class AsposeJavaAPI { + public abstract String get_name(); + + public abstract String get_mavenRepositoryURL(); + + public abstract String get_remoteExamplesRepository(); + + public boolean isExamplesNotAvailable() { + return examplesNotAvailable; + } + + public boolean examplesNotAvailable; + + public boolean isExamplesDefinitionAvailable() { + return examplesDefinitionAvailable; + } + + public boolean examplesDefinitionAvailable; + + public AsposeMavenProjectManager asposeMavenProjectManager; + + public void checkAndUpdateRepo(ProgressIndicator p) { + + if (null == get_remoteExamplesRepository()) { + AsposeMavenProjectManager.showMessage(AsposeConstants.EXAMPLES_NOT_AVAILABLE_TITLE, get_name() + " - " + AsposeConstants.EXAMPLES_NOT_AVAILABLE_MESSAGE, JOptionPane.CLOSED_OPTION, JOptionPane.INFORMATION_MESSAGE); + examplesNotAvailable = true; + examplesDefinitionAvailable = false; + return; + } else { + examplesNotAvailable = false; + } + + if (isExamplesDefinitionsPresent()) { + try { + examplesDefinitionAvailable = true; + syncRepository(p); + p.setFraction(0.30); + } catch (Exception e) { + } + } else { + updateRepository(p); + if (isExamplesDefinitionsPresent()) { + examplesDefinitionAvailable = true; + + } + + + } + p.setFraction(0.50); + } + public boolean downloadExamples(@NotNull ProgressIndicator progressIndicator) { + try { + checkAndUpdateRepo(progressIndicator); + } catch (Exception rex) { + return false; + } + + return true; + + } + + + public void updateRepository(ProgressIndicator p) + { + AsposeMavenProjectManager.checkAndCreateFolder(getLocalRepositoryPath()); + + try { + + GitHelper.updateRepository(getLocalRepositoryPath(), get_remoteExamplesRepository()); + p.setFraction(1); + + } catch (Exception e) { + } + } + + public void syncRepository(ProgressIndicator p) + { try { + + GitHelper.syncRepository(getLocalRepositoryPath(), get_remoteExamplesRepository()); + p.setFraction(1); + + } catch (Exception e) { + } + } + + + /** + * + * @return boolean + */ + public boolean isExamplesDefinitionsPresent() + { + return new File(getLocalRepositoryPath()).exists(); + } + + /** + * + * @return String + */ + public String getLocalRepositoryPath() + { + return asposeMavenProjectManager.getAsposeHomePath() + "GitConsRepos" + File.separator + get_name(); + } +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeMavenProjectManager.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeMavenProjectManager.java new file mode 100644 index 0000000..7eb0207 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeMavenProjectManager.java @@ -0,0 +1,473 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ +package com.aspose.utils; + +import com.aspose.maven.apis.artifacts.Metadata; +import com.aspose.utils.execution.RunnableHelper; +import com.aspose.wizards.maven.AsposeMavenModuleBuilderHelper; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VirtualFile; +import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; +import org.jetbrains.annotations.NotNull; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import javax.swing.*; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Unmarshaller; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.*; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import javax.xml.xpath.*; +import java.io.*; +import java.net.*; +import java.util.ResourceBundle; + +/* +* @author Adeel Ilyas +* +*/ + +public class AsposeMavenProjectManager { + private boolean examplesNotAvailable; + + private boolean examplesDefinitionAvailable; + + public Project getProjectHandle() { + return projectHandle; + } + + private Project projectHandle; + + public String readURLContents(String Url) throws IOException { + URL url = new URL(Url); + URLConnection con = url.openConnection(); + InputStream in = con.getInputStream(); + String encoding = con.getContentEncoding(); + encoding = encoding == null ? "UTF-8" : encoding; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] buf = new byte[8192]; + int len = 0; + while ((len = in.read(buf)) != -1) { + baos.write(buf, 0, len); + } + String body = new String(baos.toByteArray(), encoding); + return body; + } + + + public Metadata getProductMavenDependency(String productMavenRepositoryUrl) { + final String mavenMetaDataFileName = "maven-metadata.xml"; + Metadata data = null; + + try { + String productMavenInfo; + productMavenInfo = readURLContents(productMavenRepositoryUrl + mavenMetaDataFileName); + JAXBContext jaxbContext = JAXBContext.newInstance(com.aspose.maven.apis.artifacts.ObjectFactory.class); + Unmarshaller unmarshaller; + unmarshaller = jaxbContext.createUnmarshaller(); + AsposeConstants.println(productMavenInfo); + data = (Metadata) unmarshaller.unmarshal(new StreamSource(new StringReader(productMavenInfo))); + + String remoteArtifactFile = productMavenRepositoryUrl + data.getVersioning().getLatest() + "/" + data.getArtifactId() + "-" + data.getVersioning().getLatest(); + + AsposeConstants.println(remoteArtifactFile); + if (!remoteFileExists(remoteArtifactFile + ".jar")) { + AsposeConstants.println("Not Exists"); + data.setClassifier(getResolveSupportedJDK(remoteArtifactFile)); + } else { + AsposeConstants.println("Exists"); + } + } catch (Exception ex) { + ex.printStackTrace(); + data = null; + } + return data; + } + + public String getResolveSupportedJDK(String ProductURL) { + String supportedJDKs[] = {"jdk17", "jdk16", "jdk15", "jdk14", "jdk18"}; + String classifier = null; + for (String jdkCheck : supportedJDKs) { + AsposeConstants.println(ProductURL + "-" + jdkCheck + ".jar"); + if (remoteFileExists(ProductURL + "-" + jdkCheck + ".jar")) { + AsposeConstants.println("Exists"); + classifier = jdkCheck; + break; + } else { + AsposeConstants.println("Not Exists"); + } + } + return classifier; + } + + public boolean remoteFileExists(String URLName) { + try { + HttpURLConnection.setFollowRedirects(false); + // note : you may also need + // HttpURLConnection.setInstanceFollowRedirects(false) + HttpURLConnection con = + (HttpURLConnection) new URL(URLName).openConnection(); + con.setRequestMethod("HEAD"); + return (con.getResponseCode() == HttpURLConnection.HTTP_OK); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + public void addMavenDependenciesInProject(NodeList addTheseDependencies) { + String mavenPomXmlfile = AsposeMavenUtil.getPOMXmlFile(projectHandle); + + VirtualFile vf_mavenPomXmlfilel = LocalFileSystem.getInstance().findFileByPath(mavenPomXmlfile); + + + try { + Document pomDocument = getXmlDocument(mavenPomXmlfile); + + Node dependenciesNode = pomDocument.getElementsByTagName("dependencies").item(0); + + + if (addTheseDependencies != null && addTheseDependencies.getLength() > 0) { + for (int n = 0; n < addTheseDependencies.getLength(); n++) { + String artifactId = addTheseDependencies.item(n).getFirstChild().getNextSibling().getNextSibling().getNextSibling().getFirstChild().getNodeValue(); + + XPathFactory xPathfactory = XPathFactory.newInstance(); + XPath xpath = xPathfactory.newXPath(); + String expression = "//artifactId[text()='" + artifactId + "']"; + + XPathExpression xPathExpr = xpath.compile(expression); + + Node dependencyAlreadyExist = (Node) xPathExpr.evaluate(pomDocument, XPathConstants.NODE); + + if (dependencyAlreadyExist != null) { + Node dependencies = pomDocument.getElementsByTagName("dependencies").item(0); + dependencies.removeChild(dependencyAlreadyExist.getParentNode()); + } + + Node importedNode = pomDocument.importNode(addTheseDependencies.item(n), true); + dependenciesNode.appendChild(importedNode); + + + } + } + removeEmptyLinesfromDOM(pomDocument); + writeXmlDocumentToVirtualFile(vf_mavenPomXmlfilel, pomDocument); + + } catch (IOException io) { + io.printStackTrace(); + } catch (ParserConfigurationException pce) { + pce.printStackTrace(); + } catch (SAXException sae) { + sae.printStackTrace(); + } catch (XPathExpressionException e) { + e.printStackTrace(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + public void addMavenRepositoriesInProject(NodeList addTheseRepositories) { + String mavenPomXmlfile = AsposeMavenUtil.getPOMXmlFile(projectHandle); + + VirtualFile vf_mavenPomXmlfilel = LocalFileSystem.getInstance().findFileByPath(mavenPomXmlfile); + + + try { + Document pomDocument = getXmlDocument(mavenPomXmlfile); + + Node repositoriesNode = pomDocument.getElementsByTagName("repositories").item(0); + + + if (addTheseRepositories != null && addTheseRepositories.getLength() > 0) { + for (int n = 0; n < addTheseRepositories.getLength(); n++) { + String repositoryId = addTheseRepositories.item(n).getFirstChild().getNextSibling().getFirstChild().getNodeValue(); + + XPathFactory xPathfactory = XPathFactory.newInstance(); + XPath xpath = xPathfactory.newXPath(); + String expression = "//id[text()='" + repositoryId + "']"; + + XPathExpression xPathExpr = xpath.compile(expression); + + Boolean repositoryAlreadyExist = (Boolean) xPathExpr.evaluate(pomDocument, XPathConstants.BOOLEAN); + + if (!repositoryAlreadyExist) { + Node importedNode = pomDocument.importNode(addTheseRepositories.item(n), true); + repositoriesNode.appendChild(importedNode); + } + + } + } + removeEmptyLinesfromDOM(pomDocument); + writeXmlDocumentToVirtualFile(vf_mavenPomXmlfilel, pomDocument); + + } catch (XPathExpressionException e) { + e.printStackTrace(); + } catch (SAXException sae) { + sae.printStackTrace(); + } catch (ParserConfigurationException pce) { + pce.printStackTrace(); + } catch (IOException io) { + io.printStackTrace(); + } + } + + + private void removeEmptyLinesfromDOM(Document doc) throws XPathExpressionException { + XPath xp = XPathFactory.newInstance().newXPath(); + NodeList nl = (NodeList) xp.evaluate("//text()[normalize-space(.)='']", doc, XPathConstants.NODESET); + + for (int i = 0; i < nl.getLength(); ++i) { + Node node = nl.item(i); + node.getParentNode().removeChild(node); + } + } + + public void writeXmlDocumentToVirtualFile(VirtualFile pom, Document pomDocument) { + + RunnableHelper.runWriteCommand(projectHandle, new Runnable() { + @Override + public void run() { + try { + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + DOMSource source = new DOMSource(pomDocument); + + ByteOutputStream bytes = new ByteOutputStream(); + + StreamResult result = new StreamResult(bytes); + transformer.transform(source, result); + + VfsUtil.saveText(pom, bytes.toString()); + + } catch (TransformerException tfe) { + tfe.printStackTrace(); + + } catch (Exception ex) { + ex.printStackTrace(); + } + } + }); + } + + public boolean retrieveAsposeMavenDependencies(@NotNull ProgressIndicator progressIndicator) { + try { + AsposeMavenModuleBuilderHelper.getAsposeProjectMavenDependencies().clear(); + progressIndicator.setText(ResourceBundle.getBundle("Bundle").getString("AsposeManager.progressMessage")); + + AsposeJavaAPI component = AsposeEmailJavaAPI.getInstance(); + + Metadata productMavenDependency = getProductMavenDependency(component.get_mavenRepositoryURL()); + + if (productMavenDependency != null) { + AsposeMavenModuleBuilderHelper.getAsposeProjectMavenDependencies().add(productMavenDependency); + } + + } catch (Exception rex) { + return false; + } + if (!AsposeMavenModuleBuilderHelper.getAsposeProjectMavenDependencies().isEmpty()) { + + return true; + } else { + return false; + } + } + + /** + * @return + */ + public static boolean isInternetConnected() { + try { + InetAddress address = InetAddress.getByName(AsposeConstants.INTERNET_CONNNECTIVITY_PING_URL); + if (address == null) { + return false; + } + + } catch (UnknownHostException e) { + e.printStackTrace(); + return false; + } + + return true; + } + + public static int showMessage(String title, String message, int buttons, int icon) { + int result = JOptionPane.showConfirmDialog(null, message, title, buttons, icon); + return result; + } + + private Document getXmlDocument(String mavenPomXmlfile) throws ParserConfigurationException, SAXException, IOException { + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); + Document pomDocument = docBuilder.parse(mavenPomXmlfile); + + return pomDocument; + } + + public String getDependencyVersionFromPOM(String dependencyName) { + try { + String mavenPomXmlfile = AsposeMavenUtil.getPOMXmlFile(projectHandle); + + Document pomDocument = getXmlDocument(mavenPomXmlfile); + + XPathFactory xPathfactory = XPathFactory.newInstance(); + XPath xpath = xPathfactory.newXPath(); + String expression = "//version[ancestor::dependency/artifactId[text()='" + dependencyName + "']]"; + XPathExpression xPathExpr = xpath.compile(expression); + NodeList nl = (NodeList) xPathExpr.evaluate(pomDocument, XPathConstants.NODESET); + if (nl != null && nl.getLength() > 0) { + return nl.item(0).getTextContent(); + } + } catch (IOException io) { + io.printStackTrace(); + } catch (ParserConfigurationException pce) { + pce.printStackTrace(); + } catch (SAXException sae) { + sae.printStackTrace(); + } catch (XPathExpressionException e) { + e.printStackTrace(); + } + return null; + } + + public NodeList getDependenciesFromPOM(String mavenPomXmlfile, String excludeGroup) { + + try { + + Document pomDocument = getXmlDocument(mavenPomXmlfile); + + XPathFactory xPathfactory = XPathFactory.newInstance(); + XPath xpath = xPathfactory.newXPath(); + String expression = "//dependency[child::groupId[text()!='" + excludeGroup + "']]"; + XPathExpression xPathExpr = xpath.compile(expression); + NodeList nl = (NodeList) xPathExpr.evaluate(pomDocument, XPathConstants.NODESET); + if (nl != null && nl.getLength() > 0) { + return nl; + } + } catch (IOException io) { + io.printStackTrace(); + } catch (ParserConfigurationException pce) { + pce.printStackTrace(); + } catch (SAXException sae) { + sae.printStackTrace(); + } catch (XPathExpressionException e) { + e.printStackTrace(); + } + return null; + } + + public NodeList getRepositoriesFromPOM(String mavenPomXmlfile, String excludeURL) { + + try { + + Document pomDocument = getXmlDocument(mavenPomXmlfile); + + XPathFactory xPathfactory = XPathFactory.newInstance(); + XPath xpath = xPathfactory.newXPath(); + String expression = "//repository[child::url[not(starts-with(.,'" + excludeURL + "'))]]"; + XPathExpression xPathExpr = xpath.compile(expression); + NodeList nl = (NodeList) xPathExpr.evaluate(pomDocument, XPathConstants.NODESET); + if (nl != null && nl.getLength() > 0) { + return nl; + } + } catch (IOException io) { + io.printStackTrace(); + } catch (ParserConfigurationException pce) { + pce.printStackTrace(); + } catch (SAXException sae) { + sae.printStackTrace(); + } catch (XPathExpressionException e) { + e.printStackTrace(); + } + return null; + } + + public String getAsposeHomePath() { + + String path = ""; + path = System.getProperty("user.home"); + path = path + File.separator + "aspose" + File.separator; + return path; + } + + public static void copyDirectory(String sourceLocation, String targetLocation) throws IOException { + + checkAndCreateFolder(targetLocation); + copyDirectory(new File(sourceLocation + File.separator), new File(targetLocation + File.separator)); + } + + public static void copyDirectory(File sourceLocation, File targetLocation) throws IOException { + if (sourceLocation.isDirectory()) { + if (!targetLocation.exists()) { + targetLocation.mkdir(); + } + + String[] children = sourceLocation.list(); + for (int i = 0; i < children.length; i++) { + copyDirectory(new File(sourceLocation, children[i]), + new File(targetLocation, children[i])); + } + } else { + + InputStream in = new FileInputStream(sourceLocation); + OutputStream out = new FileOutputStream(targetLocation); + + // Copy the bits from instream to outstream + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } + } + + /** + * @param folderPath + */ + public static void checkAndCreateFolder(String folderPath) { + File folder = new File(folderPath); + if (!folder.exists()) { + folder.mkdirs(); + } + } + + // Singleton instance + private static AsposeMavenProjectManager asposeMavenProjectManager = new AsposeMavenProjectManager(); + + public static AsposeMavenProjectManager getInstance() { + return asposeMavenProjectManager; + } + + public static AsposeMavenProjectManager initialize(Project projectId) { + asposeMavenProjectManager = new AsposeMavenProjectManager(); + asposeMavenProjectManager.projectHandle = projectId; + return asposeMavenProjectManager; + } + + private AsposeMavenProjectManager() { + } + +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeMavenUtil.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeMavenUtil.java new file mode 100644 index 0000000..366e07d --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/AsposeMavenUtil.java @@ -0,0 +1,134 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ +package com.aspose.utils; + +import com.aspose.wizards.maven.MavenId; +import com.intellij.codeInsight.actions.ReformatCodeProcessor; +import com.intellij.codeInsight.template.TemplateManager; +import com.intellij.codeInsight.template.impl.TemplateImpl; +import com.intellij.ide.fileTemplates.FileTemplate; +import com.intellij.ide.fileTemplates.FileTemplateManager; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; +import com.intellij.openapi.application.PathManager; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiManager; +import com.intellij.util.DisposeAwareRunnable; +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.io.IOException; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +public class AsposeMavenUtil { + public static final String MAVEN_NOTIFICATION_GROUP = "Maven"; + public static final String MAVEN_PROJECT_XML_TEMPLATE = "Maven Project.xml"; + + public static void invokeLater(final Project p, final ModalityState state, final Runnable r) { + if (isNoBackgroundMode()) { + r.run(); + } else { + ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state); + } + } + + public static boolean isNoBackgroundMode() { + return (ApplicationManager.getApplication().isUnitTestMode() + || ApplicationManager.getApplication().isHeadlessEnvironment()); + } + + + public static void showError(Project project, String title, Throwable e) { + Notifications.Bus.notify(new Notification(MAVEN_NOTIFICATION_GROUP, title, e.getMessage(), NotificationType.ERROR), project); + } + + public static void runOrApplyMavenProjectFileTemplate(Project project, + VirtualFile file, + @NotNull MavenId projectId) throws IOException { + runOrApplyMavenProjectFileTemplate(project, file, projectId, null, null); + } + + public static void runOrApplyMavenProjectFileTemplate(Project project, + VirtualFile file, + @NotNull MavenId projectId, + MavenId parentId, + VirtualFile parentFile) throws IOException { + Properties properties = new Properties(); + + properties.setProperty("GROUP_ID", projectId.getGroupId()); + properties.setProperty("ARTIFACT_ID", projectId.getArtifactId()); + properties.setProperty("VERSION", projectId.getVersion()); + + runOrApplyFileTemplate(project, file, MAVEN_PROJECT_XML_TEMPLATE, properties); + } + + + private static void runOrApplyFileTemplate(Project project, + VirtualFile file, + String templateName, + Properties properties) throws IOException { + FileTemplateManager manager = FileTemplateManager.getInstance(); + FileTemplate fileTemplate = manager.getJ2eeTemplate(templateName); + Properties allProperties = manager.getDefaultProperties(project); + allProperties.putAll(properties); + String text = fileTemplate.getText(allProperties); + Pattern pattern = Pattern.compile("\\$\\{(.*)\\}"); + Matcher matcher = pattern.matcher(text); + StringBuffer builder = new StringBuffer(); + while (matcher.find()) { + matcher.appendReplacement(builder, "\\$" + matcher.group(1).toUpperCase() + "\\$"); + } + matcher.appendTail(builder); + text = builder.toString(); + + TemplateImpl template = (TemplateImpl) TemplateManager.getInstance(project).createTemplate("", "", text); + for (int i = 0; i < template.getSegmentsCount(); i++) { + if (i == template.getEndSegmentNumber()) continue; + String name = template.getSegmentName(i); + String value = "\"" + properties.getProperty(name, "") + "\""; + template.addVariable(name, value, value, true); + } + + VfsUtil.saveText(file, template.getTemplateText()); + + PsiFile psiFile = PsiManager.getInstance(project).findFile(file); + if (psiFile != null) { + new ReformatCodeProcessor(project, psiFile, null, false).run(); + } + + } + + public static File getPluginSystemDir(String folder) { + // PathManager.getSystemPath() may return relative path + return new File(PathManager.getSystemPath(), "Maven" + "/" + folder).getAbsoluteFile(); + } + + public static String getPOMXmlFile(VirtualFile pomFile) { + return pomFile.getParent().getPath() + File.separator + AsposeConstants.MAVEN_POM_XML; + } + + public static String getPOMXmlFile(Project project) { + String projectPath = project.getBasePath(); + String projectPOM = projectPath + File.separator + AsposeConstants.MAVEN_POM_XML; + return projectPOM; + } + +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/FormatExamples.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/FormatExamples.java new file mode 100644 index 0000000..5c24298 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/FormatExamples.java @@ -0,0 +1,29 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.utils; + +import org.apache.commons.lang.WordUtils; + +/** + * Created by Adeel on 9/9/2015. + */ +public class FormatExamples { + public static String formatTitle(String inputStr) { + String title = inputStr.replaceAll("(_|.java|\\.)", " "); + title = title.replaceAll("([A-Z])", " $1"); + title = WordUtils.capitalize(title); + + + return title; + } +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/GitHelper.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/GitHelper.java new file mode 100644 index 0000000..38567f9 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/GitHelper.java @@ -0,0 +1,87 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.aspose.utils; + +//import com.aspose.examples.otherexamples.OtherExamplesManager; + +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.internal.storage.file.FileRepository; +import org.eclipse.jgit.lib.Repository; + +import java.io.File; + +/** + * @author Adeel Ilyas + * + */ +public class GitHelper { + public static void updateRepository(String localPath, String remotePath) throws Exception { + Repository localRepo; + try { + localRepo = new FileRepository(localPath + "/.git"); + + Git git = new Git(localRepo); + { + AsposeConstants.println("Cloning Repository [" + remotePath + "]...."); + } + + // First try to clone the repository + try { + Git.cloneRepository().setURI(remotePath).setDirectory(new File(localPath)).call(); + } catch (Exception ex) { + // If clone fails, try to pull the changes + try { + git.pull().call(); + } catch (Exception exPull) { + // Pull also failed. Throw this exception to caller + { + AsposeConstants.println("Pull also failed."); + } + throw exPull; // throw it + } + } + } catch (Exception ex) { + throw new Exception("Could not download Repository from Github. Error: " + ex.getMessage()); + } + } + + public static void syncRepository(String localPath, String remotePath) throws Exception { + Repository localRepo; + try { + localRepo = new FileRepository(localPath + "/.git"); + + Git git = new Git(localRepo); + + AsposeConstants.println("Syncronizing Repository [" + remotePath + "]...."); + // Pull the changes + try { + git.pull().call(); + } catch (Exception exPull) { + // If pull failed. Throw this exception to caller + { + AsposeConstants.println("Pull failed."); + } + throw exPull; // throw it + } + + } catch (Exception ex) { + throw new Exception("Could not update Repository from Github. Error: " + ex.getMessage()); + } + } + + +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/execution/CallBackHandler.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/execution/CallBackHandler.java new file mode 100644 index 0000000..a6f29db --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/execution/CallBackHandler.java @@ -0,0 +1,23 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.utils.execution; + +import com.intellij.openapi.progress.ProgressIndicator; +import org.jetbrains.annotations.NotNull; + +/** + * Created by Adeel Ilyas on 9/9/2015. + */ +public interface CallBackHandler { + public boolean executeTask(@NotNull ProgressIndicator progressIndicator); +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/execution/ModalTaskImpl.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/execution/ModalTaskImpl.java new file mode 100644 index 0000000..1d26d53 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/execution/ModalTaskImpl.java @@ -0,0 +1,52 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ +package com.aspose.utils.execution; + +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.Task; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * @author Adeel Ilyas + */ +public class ModalTaskImpl extends Task.Modal { + private boolean done = false; + private CallBackHandler callback; + + public ModalTaskImpl(@Nullable Project project, CallBackHandler callback, String message) { + super(project, message, true); + this.callback = callback; + } + + @Override + public void run(@NotNull ProgressIndicator progressIndicator) { + done = callback.executeTask(progressIndicator); + } + + @Override + public void onSuccess() { + super.onSuccess(); + } + + @Override + public void onCancel() { + super.onCancel(); + done = false; + } + + public boolean isDone() { + return done; + } + +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/execution/RunnableHelper.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/execution/RunnableHelper.java new file mode 100644 index 0000000..c3e912c --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/utils/execution/RunnableHelper.java @@ -0,0 +1,118 @@ + +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + + +package com.aspose.utils.execution; + +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.command.CommandProcessor; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.startup.StartupManager; + +/** + * @author Adeel Ilyas + */ + +public class RunnableHelper + +{ + public static void runWhenInitialized(final Project project, final Runnable r) { + if (project.isDisposed()) return; + + if (!project.isInitialized()) { + StartupManager.getInstance(project).registerStartupActivity(new RunnableHelper.WriteAction(r)); + return; + } + + RunnableHelper.runWriteCommand(project, r); + + } + + public static void runReadCommand(Project project, Runnable cmd) + + { + + CommandProcessor.getInstance().executeCommand(project, new ReadAction(cmd), "Aspose", "Components"); + + } + + + public static void runWriteCommand(Project project, Runnable cmd) + + { + + CommandProcessor.getInstance().executeCommand(project, new WriteAction(cmd), "Aspose", "Components"); + + } + + + public static class ReadAction implements Runnable + + { + + public ReadAction(Runnable cmd) + + { + + this.cmd = cmd; + + } + + + public void run() + + { + + ApplicationManager.getApplication().runReadAction(cmd); + + } + + + Runnable cmd; + + } + + + public static class WriteAction implements Runnable + + { + + public WriteAction(Runnable cmd) + + { + + this.cmd = cmd; + + } + + + public void run() + + { + ApplicationManager.getApplication().invokeLater(new Runnable() { + public void run() { + ApplicationManager.getApplication().runWriteAction(cmd); + } + }); + } + + + Runnable cmd; + + } + + + private RunnableHelper() { + } + +} \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeIntroWizardStep.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeIntroWizardStep.java new file mode 100644 index 0000000..6018561 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeIntroWizardStep.java @@ -0,0 +1,89 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ +package com.aspose.wizards.maven; + + +import com.intellij.ide.util.projectWizard.ModuleWizardStep; +import com.intellij.ide.wizard.CommitStepException; +import com.intellij.openapi.Disposable; + +import javax.swing.*; +import javax.swing.border.TitledBorder; +import java.awt.*; +import java.util.ResourceBundle; + +/** + * @author Adeel Ilyas + */ + +public class AsposeIntroWizardStep extends ModuleWizardStep implements Disposable { + + @Override + public void dispose() { + } + + private JLabel jLabelAsposeIntro; + private JComponent myMainPanel; + + @Override + public JComponent getPreferredFocusedComponent() { + return myMainPanel; + } + + @Override + public void onWizardFinished() throws CommitStepException { + + } + + @Override + public JComponent getComponent() { + + if (myMainPanel == null) { + myMainPanel = new JPanel(); + { + ResourceBundle bundle = ResourceBundle.getBundle("Bundle"); + myMainPanel.setBorder(new TitledBorder(bundle.getString("AsposeWizardPanel.myMainPanel.border.title"))); + myMainPanel.setPreferredSize(new Dimension(333, 364)); + + + jLabelAsposeIntro = new JLabel(); + jLabelAsposeIntro.setText(bundle.getString("AsposeWizardPanel.myMainPanel.description")); + Font labelFont = jLabelAsposeIntro.getFont(); + + jLabelAsposeIntro.setFont(new Font(labelFont.getName(), Font.PLAIN, 14)); + + GroupLayout jPanel4Layout = new GroupLayout(myMainPanel); + myMainPanel.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup() + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(jLabelAsposeIntro) + .addGap(0, 0, Short.MAX_VALUE)) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup() + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(jLabelAsposeIntro) + .addContainerGap(0, Short.MAX_VALUE)) + ); + } + } + return myMainPanel; + } + + @Override + public void updateDataModel() { + + } + + +} \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleBuilder.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleBuilder.java new file mode 100644 index 0000000..a0442f9 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleBuilder.java @@ -0,0 +1,166 @@ + +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ +package com.aspose.wizards.maven; + +import com.aspose.utils.AsposeConstants; +import com.aspose.utils.execution.RunnableHelper; +import com.intellij.ide.util.projectWizard.ModuleBuilder; +import com.intellij.ide.util.projectWizard.ModuleWizardStep; +import com.intellij.ide.util.projectWizard.SettingsStep; +import com.intellij.ide.util.projectWizard.WizardContext; +import com.intellij.openapi.Disposable; +import com.intellij.openapi.module.JavaModuleType; +import com.intellij.openapi.module.ModuleType; +import com.intellij.openapi.module.StdModuleTypes; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.projectRoots.JavaSdkType; +import com.intellij.openapi.projectRoots.SdkTypeId; +import com.intellij.openapi.roots.ModifiableRootModel; +import com.intellij.openapi.roots.ui.configuration.ModulesProvider; +import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VirtualFile; +import icons.AsposeIcons; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; +import java.io.File; +import java.util.ResourceBundle; + +/** + * Author: Adeel Ilyas + */ + +public class AsposeMavenModuleBuilder extends ModuleBuilder { + + private Project myProject; + ResourceBundle bundle = ResourceBundle.getBundle("Bundle"); + + @Override + public String getBuilderId() { + return getClass().getName()+"_"+AsposeConstants.API_NAME; + } + + @Override + public Icon getBigIcon() { + return AsposeIcons.AsposeMedium; + } + + @Override + public Icon getNodeIcon() { + return AsposeIcons.AsposeLogo; + } + + + @Override + public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, @NotNull ModulesProvider modulesProvider) { + return new ModuleWizardStep[]{new AsposeMavenModuleWizardStep(getMyProject(), this, wizardContext, !wizardContext.isNewWizard()), + + }; + } + + private VirtualFile createAndGetContentEntry() { + String path = FileUtil.toSystemIndependentName(getContentEntryPath()); + new File(path).mkdirs(); + return LocalFileSystem.getInstance().refreshAndFindFileByPath(path); + } + + @Override + public void setupRootModel(ModifiableRootModel rootModel) throws com.intellij.openapi.options.ConfigurationException { + + final Project project = rootModel.getProject(); + setMyProject(rootModel.getProject()); + final VirtualFile root = createAndGetContentEntry(); + rootModel.addContentEntry(root); + + rootModel.inheritSdk(); + + RunnableHelper.runWhenInitialized(getMyProject(), new Runnable() { + public void run() { + + AsposeMavenModuleBuilderHelper mavenBuilder = new AsposeMavenModuleBuilderHelper(getMyProjectId(), "Create new Maven module", project, root); + mavenBuilder.configure(); + + } + }); + + } + + @Override + public String getGroupName() { + return JavaModuleType.JAVA_GROUP; + } + + public Project getMyProject() { + return myProject; + } + + public void setMyProject(Project myProject) { + this.myProject = myProject; + } + + @Nullable + public ModuleWizardStep getCustomOptionsStep(WizardContext context, Disposable parentDisposable) { + AsposeIntroWizardStep step = new AsposeIntroWizardStep(); + Disposer.register(parentDisposable, step); + return step; + } + + + public ModuleType getModuleType() { + return StdModuleTypes.JAVA; + } + + @Override + public boolean isSuitableSdkType(SdkTypeId sdkType) { + return sdkType instanceof JavaSdkType; + } + + @Nullable + @Override + public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep) { + return StdModuleTypes.JAVA.modifySettingsStep(settingsStep, this); + } + + + @Nullable + protected static String getPathForOutputPathStep() { + return null; + } + + + public MavenId getMyProjectId() { + return myProjectId; + } + + public void setMyProjectId(MavenId myProjectId) { + this.myProjectId = myProjectId; + } + + private MavenId myProjectId; + + + @Override + public String getPresentableName() { + return AsposeConstants.WIZARD_NAME; + } + + + @Override + public String getDescription() { + return bundle.getString("AsposeWizardPanel.myMainPanel.description"); + } + +} \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleBuilderHelper.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleBuilderHelper.java new file mode 100644 index 0000000..496dd47 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleBuilderHelper.java @@ -0,0 +1,350 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ +package com.aspose.wizards.maven; + +import com.aspose.maven.apis.artifacts.Metadata; +import com.aspose.utils.AsposeConstants; +import com.aspose.utils.AsposeMavenProjectManager; +import com.aspose.utils.AsposeMavenUtil; +import com.intellij.codeInsight.actions.ReformatCodeProcessor; +import com.intellij.ide.util.EditorHelper; +import com.intellij.openapi.application.ModalityState; +import com.intellij.openapi.application.Result; +import com.intellij.openapi.command.WriteCommandAction; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.project.ex.ProjectManagerEx; +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiManager; +import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; +import org.jetbrains.annotations.NotNull; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.*; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import java.io.*; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +public class AsposeMavenModuleBuilderHelper { + private final MavenId myProjectId; + + private final String myCommandName; + private Project project; + private VirtualFile root; + private List intelliJMavenFiles = new ArrayList(); + + public AsposeMavenModuleBuilderHelper(@NotNull MavenId projectId, String commaneName, Project project, VirtualFile root) { + myProjectId = projectId; + this.project = project; + this.root = root; + myCommandName = commaneName; + intelliJMavenFiles.add("untitled.iml"); + intelliJMavenFiles.add("compiler.xml"); + } + + public void configure() { + PsiFile[] psiFiles = PsiFile.EMPTY_ARRAY; + final VirtualFile pom = new WriteCommandAction(project, myCommandName, psiFiles) { + @Override + protected void run(Result result) throws Throwable { + VirtualFile file; + try { + file = root.createChildData(this, AsposeConstants.MAVEN_POM_XML); + + AsposeMavenUtil.runOrApplyMavenProjectFileTemplate(project, file, myProjectId); + result.setResult(file); + } catch (IOException e) { + showError(project, e); + return; + } + + updateProjectPom(project, file); + + + } + }.execute().getResultObject(); + + if (pom == null) return; + + try { + System.out.println("Creating Maven project structure ..."); + VfsUtil.createDirectories(root.getPath() + "/src/main/java"); + VfsUtil.createDirectories(root.getPath() + "/src/main/resources"); + VfsUtil.createDirectories(root.getPath() + "/src/test/java"); + } catch (IOException e) { + + } + // execute when current dialog is closed (e.g. Project Structure) + AsposeMavenUtil.invokeLater(project, ModalityState.NON_MODAL, new Runnable() { + public void run() { + if (!pom.isValid()) return; + copyMavenConfigurationFiles(pom); + + + } + }); + } + + + + private Document getXmlDocument(String xmlfile) throws ParserConfigurationException, SAXException, IOException { + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); + Document pomDocument = docBuilder.parse(xmlfile); + + return pomDocument; + } + + private void addAsposeMavenRepositoryConfiguration(Document pomDocument, Node projectNode) { +// Adding Aspose Cloud Maven Repository configuration + Element repositories = pomDocument.createElement("repositories"); + projectNode.appendChild(repositories); + Element repository = pomDocument.createElement("repository"); + repositories.appendChild(repository); + Element id = pomDocument.createElement("id"); + id.appendChild(pomDocument.createTextNode("AsposeJavaAPI")); + Element name = pomDocument.createElement("name"); + name.appendChild(pomDocument.createTextNode("Aspose Java API")); + Element url = pomDocument.createElement("url"); + url.appendChild(pomDocument.createTextNode("http://maven.aspose.com/artifactory/simple/ext-release-local/")); + repository.appendChild(id); + repository.appendChild(name); + repository.appendChild(url); + } + + // In misc.xml + private void addMavenConfiguration(final VirtualFile miscxml, String mavenMiscXmlfile) { + try { + Document pomDocument = getXmlDocument(mavenMiscXmlfile); + + // Get the root (Project Node) element + Node projectNode = pomDocument.getFirstChild(); + Element component = pomDocument.createElement("component"); + component.setAttribute("name", "MavenProjectsManager"); + projectNode.appendChild(component); + Element option = pomDocument.createElement("option"); + option.setAttribute("name", "originalFiles"); + component.appendChild(option); + Element list = pomDocument.createElement("list"); + option.appendChild(list); + Element listOption = pomDocument.createElement("option"); + listOption.setAttribute("value", "$PROJECT_DIR$/pom.xml"); + list.appendChild(listOption); + + // Write the content into misc xml file + AsposeMavenProjectManager.getInstance().writeXmlDocumentToVirtualFile(miscxml, pomDocument); + } catch (IOException io) { + io.printStackTrace(); + } catch (ParserConfigurationException pce) { + pce.printStackTrace(); + } catch (SAXException sae) { + sae.printStackTrace(); + } + } + + private void addAsposeMavenDependency(Document doc, Element dependenciesTag, Metadata dependency) { + Element dependencyTag = doc.createElement("dependency"); + dependenciesTag.appendChild(dependencyTag); + + Element groupIdTag = doc.createElement("groupId"); + groupIdTag.appendChild(doc.createTextNode(dependency.getGroupId())); + dependencyTag.appendChild(groupIdTag); + + Element artifactId = doc.createElement("artifactId"); + artifactId.appendChild(doc.createTextNode(dependency.getArtifactId())); + dependencyTag.appendChild(artifactId); + Element version = doc.createElement("version"); + version.appendChild(doc.createTextNode(dependency.getVersioning().getLatest())); + dependencyTag.appendChild(version); + if (dependency.getClassifier() != null) { + Element classifer = doc.createElement("classifier"); + classifer.appendChild(doc.createTextNode(dependency.getClassifier())); + dependencyTag.appendChild(classifer); + } + } + + private void updateProjectPom(final Project project, final VirtualFile pom) { + try { + String mavenPomXmlfile = AsposeMavenUtil.getPOMXmlFile(pom); + + Document pomDocument = getXmlDocument(mavenPomXmlfile); + + // Get the root element + Node projectNode = pomDocument.getFirstChild(); + + //Adding Aspose Cloud Maven Repository configuration setting here + addAsposeMavenRepositoryConfiguration(pomDocument, projectNode); + + // Adding Dependencies here + Element dependenciesTag = pomDocument.createElement("dependencies"); + projectNode.appendChild(dependenciesTag); + + for (Metadata dependency : getAsposeProjectMavenDependencies()) { + + addAsposeMavenDependency(pomDocument, dependenciesTag, dependency); + + } + + // Write the content into maven pom xml file + + AsposeMavenProjectManager.getInstance().writeXmlDocumentToVirtualFile(pom, pomDocument); + + + } catch (IOException io) { + io.printStackTrace(); + } catch (ParserConfigurationException pce) { + pce.printStackTrace(); + } catch (SAXException sae) { + sae.printStackTrace(); + } + } + + private static PsiFile getPsiFile(Project project, VirtualFile pom) { + return PsiManager.getInstance(project).findFile(pom); + } + + public String getAsposeMavenWorkSpace() { + final String RepositoryResourcesLocation = "https://raw.githubusercontent.com/asposemarketplace/Aspose_Maven_for_JetBrains/master/src/resources/maven/"; + + String path = ""; + path = System.getProperty("user.home"); + path = path + File.separator + "aspose" + File.separator + "intellijplugin" + File.separator + "maven" + File.separator; + File confirmPath = new File(path); + if (!confirmPath.exists()) { + new File(path).mkdirs(); + for (String fileToDownload : intelliJMavenFiles) { + downloadFileFromInternet(RepositoryResourcesLocation + fileToDownload, path + fileToDownload); + } + + } + return path; + } + + public boolean downloadFileFromInternet(String urlStr, String absoluteOutputFile) { + InputStream input; + int bufferSize = 4096; + + try { + + URL url = new URL(urlStr); + input = url.openStream(); + byte[] buffer = new byte[bufferSize]; + File f = new File(absoluteOutputFile); + OutputStream output = new FileOutputStream(f); + + + try { + int bytesRead; + while ((bytesRead = input.read(buffer, 0, buffer.length)) >= 0) { + output.write(buffer, 0, bytesRead); + + + } + + output.flush(); + output.close(); + + } finally { + } + } catch (Exception ex) { + return false; + } + return true; + } + + private void copyMavenConfigurationFiles(VirtualFile pom) { + try { + + + String projectPath = project.getBasePath(); + + final File workingDir = new File(getAsposeMavenWorkSpace()); + + String projectModulefile = projectPath + File.separator + project.getName() + ".iml"; + String projectIdea_compiler_xml = projectPath + File.separator + ".idea" + File.separator + "compiler.xml"; + + String projectIdea_misc_xml = projectPath + File.separator + ".idea" + File.separator + "misc.xml"; + VirtualFile vf_projectIdea_misc_xml = LocalFileSystem.getInstance().findFileByPath(projectIdea_misc_xml); + + FileUtil.copy(new File(workingDir, intelliJMavenFiles.get(0)), new File(projectModulefile)); + FileUtil.copy(new File(workingDir, intelliJMavenFiles.get(1)), new File(projectIdea_compiler_xml)); + + addMavenConfiguration(vf_projectIdea_misc_xml,projectIdea_misc_xml); + + ProjectManagerEx pm = ProjectManagerEx.getInstanceEx(); + + pm.reloadProject(project); + + EditorHelper.openInEditor(getPsiFile(project, pom)); + + } catch (IOException e) { + showError(project, e); + return; + } catch (Throwable e) { + } + + } + + private static void showError(Project project, Throwable e) { + AsposeMavenUtil.showError(project, "Failed to create a Maven project", e); + } + + private static void updateFileContents(Project project, final VirtualFile vf, final File f) throws Throwable { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + InputStream in = null; + try { + + in = new FileInputStream(f); + + write(in, bytes); + + } finally { + + if (in != null) { + in.close(); + } + } + VfsUtil.saveText(vf, bytes.toString()); + + PsiFile psiFile = PsiManager.getInstance(project).findFile(vf); + if (psiFile != null) { + new ReformatCodeProcessor(project, psiFile, null, false).run(); + } + } + + private static void write(InputStream inputStream, OutputStream os) throws IOException { + byte[] buf = new byte[1024]; + int len; + while ((len = inputStream.read(buf)) > 0) { + os.write(buf, 0, len); + } + } + + public static List getAsposeProjectMavenDependencies() { + return asposeProjectMavenDependencies; + } + + private static List asposeProjectMavenDependencies = new ArrayList(); +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleWizardStep.form b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleWizardStep.form new file mode 100644 index 0000000..27e7c17 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleWizardStep.form @@ -0,0 +1,122 @@ + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleWizardStep.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleWizardStep.java new file mode 100644 index 0000000..ff01088 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/AsposeMavenModuleWizardStep.java @@ -0,0 +1,346 @@ + +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.wizards.maven; + +import com.aspose.utils.AsposeJavaAPI; +import com.aspose.utils.AsposeMavenProjectManager; +import com.aspose.utils.AsposeConstants; +import com.aspose.utils.AsposeEmailJavaAPI; +import com.aspose.utils.execution.CallBackHandler; +import com.aspose.utils.execution.ModalTaskImpl; +import com.intellij.ide.util.projectWizard.ModuleWizardStep; +import com.intellij.ide.util.projectWizard.WizardContext; +import com.intellij.ide.wizard.CommitStepException; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; +import com.intellij.openapi.options.ConfigurationException; +import com.intellij.openapi.progress.ProgressManager; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; +import javax.swing.border.TitledBorder; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.util.ResourceBundle; +/** + * Created by Adeel Ilyas on 9/9/2015. + */ +public class AsposeMavenModuleWizardStep extends ModuleWizardStep { + private ImageIcon icon = new ImageIcon(getClass().getResource("/resources/long_bannerIntelliJ.png")); + + + private final Project myProjectOrNull; + private final AsposeMavenModuleBuilder myBuilder; + private final WizardContext myContext; + + + private JPanel myMainPanel; + + + private JTextField myGroupIdField; + + private JTextField myArtifactIdField; + private JTextField myVersionField; + + + private JPanel myArchetypesPanel; + private JCheckBox alsoDownloadExampleSourceCheckBox; + private JTextPane fieldTextPane; + private JLabel bannerLbl; + + + public AsposeMavenModuleWizardStep(Project project, AsposeMavenModuleBuilder builder, WizardContext context, boolean includeArtifacts) { + myProjectOrNull = project; + myBuilder = builder; + myContext = context; + $$$setupUI$$$(); + initComponents(); + loadSettings(); + bannerLbl.addComponentListener(new ComponentAdapter() { + @Override + public void componentResized(ComponentEvent e) { + int labelwidth = bannerLbl.getWidth(); + int labelheight = bannerLbl.getHeight(); + Image img = icon.getImage(); + bannerLbl.setIcon(new ImageIcon(img.getScaledInstance(labelwidth, labelheight, Image.SCALE_FAST))); + } + }); + } + + private void initComponents() { + + + ActionListener updatingListener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + updateComponents(); + } + }; + + } + + @Override + public JComponent getPreferredFocusedComponent() { + return myGroupIdField; + } + + + @Override + public void onStepLeaving() { + saveSettings(); + } + + private void loadSettings() { + + + } + + private void saveSettings() { + + } + public JComponent getComponent() { + return myMainPanel; + } + + @Override + public boolean validate() throws ConfigurationException { + if (StringUtil.isEmptyOrSpaces(myGroupIdField.getText())) { + throw new ConfigurationException("Please, specify groupId"); + } + + if (StringUtil.isEmptyOrSpaces(myArtifactIdField.getText())) { + throw new ConfigurationException("Please, specify artifactId"); + } + + if (StringUtil.isEmptyOrSpaces(myVersionField.getText())) { + throw new ConfigurationException("Please, specify version"); + } + + return true; + } + + + private static void setTestIfEmpty(@NotNull JTextField artifactIdField, @Nullable String text) { + if (StringUtil.isEmpty(artifactIdField.getText())) { + artifactIdField.setText(StringUtil.notNullize(text)); + } + } + + @Override + public void updateStep() { + + + MavenId projectId = myBuilder.getMyProjectId(); + + if (projectId == null) { + setTestIfEmpty(myArtifactIdField, myBuilder.getName()); + setTestIfEmpty(myGroupIdField, myBuilder.getName()); + setTestIfEmpty(myVersionField, "1.0-SNAPSHOT"); + } else { + setTestIfEmpty(myArtifactIdField, projectId.getArtifactId()); + setTestIfEmpty(myGroupIdField, projectId.getGroupId()); + setTestIfEmpty(myVersionField, projectId.getVersion()); + } + + + updateComponents(); + } + + + private void updateComponents() { + + + myGroupIdField.setEnabled(true); + myVersionField.setEnabled(true); + + + } + + + @Override + public void updateDataModel() { + myContext.setProjectBuilder(myBuilder); + + + myBuilder.setMyProjectId(new MavenId(myGroupIdField.getText(), + myArtifactIdField.getText(), + myVersionField.getText())); + + + if (myContext.getProjectName() == null) { + myContext.setProjectName(myBuilder.getMyProjectId().getArtifactId()); + } + + + } + + + @Override + public String getHelpId() { + return "reference.dialogs.new.project.fromScratch.maven"; + } + + @Override + public void disposeUIResources() { + + } + + @Override + public void onWizardFinished() throws CommitStepException { + + AsposeMavenProjectManager asposeMavenProjectManager = AsposeMavenProjectManager.initialize(myProjectOrNull); + AsposeJavaAPI asposeWordsJavaAPI = AsposeEmailJavaAPI.initialize(asposeMavenProjectManager); + if (alsoDownloadExampleSourceCheckBox.isSelected()) { + if (!AsposeMavenProjectManager.isInternetConnected()) { + + throw new CommitStepException(AsposeConstants.EXAMPLES_INTERNET_CONNECTION_REQUIRED_MESSAGE); + } + CallBackHandler callback = new DownloadExamplesCallback(asposeWordsJavaAPI); + + final ModalTaskImpl modalTaskDownloadExamples = new ModalTaskImpl(myProjectOrNull, callback, ResourceBundle.getBundle("Bundle").getString("AsposeManager.progressExamplesTitle")); + ApplicationManager.getApplication().invokeAndWait(new Runnable() { + @Override + public void run() { + ProgressManager.getInstance().run(modalTaskDownloadExamples); + } + }, ModalityState.defaultModalityState()); + + if (!modalTaskDownloadExamples.isDone()) { + + throw new CommitStepException(AsposeConstants.EXAMPLES_DOWNLOAD_FAIL); + } + } + + if (!AsposeMavenProjectManager.isInternetConnected()) { + + throw new CommitStepException(AsposeConstants.MAVEN_INTERNET_CONNECTION_REQUIRED_MESSAGE); + } + + CallBackHandler callback = new CreateMavenProjectCallback(); + + final ModalTaskImpl modalTaskRetrieveArtifact = new ModalTaskImpl(myProjectOrNull, callback, ResourceBundle.getBundle("Bundle").getString("AsposeManager.progressTitle")); + ApplicationManager.getApplication().invokeAndWait(new Runnable() { + @Override + public void run() { + ProgressManager.getInstance().run(modalTaskRetrieveArtifact); + } + }, ModalityState.defaultModalityState()); + + if (!modalTaskRetrieveArtifact.isDone()) { + + throw new CommitStepException(AsposeConstants.MAVEN_ARTIFACTS_RETRIEVE_FAIL); + } + + + + } + + + /** + * Method generated by IntelliJ IDEA GUI Designer + * >>> IMPORTANT!! <<< + * DO NOT edit this method OR call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + myMainPanel = new JPanel(); + myMainPanel.setLayout(new GridLayoutManager(3, 3, new Insets(0, 0, 0, 0), -1, -1)); + myArchetypesPanel = new JPanel(); + myArchetypesPanel.setLayout(new BorderLayout(0, 0)); + myArchetypesPanel.setInheritsPopupMenu(true); + myMainPanel.add(myArchetypesPanel, new GridConstraints(2, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + alsoDownloadExampleSourceCheckBox = new JCheckBox(); + this.$$$loadButtonText$$$(alsoDownloadExampleSourceCheckBox, ResourceBundle.getBundle("Bundle").getString("AsposeWizardPanel.WizardStep.ExampleChkbox")); + myArchetypesPanel.add(alsoDownloadExampleSourceCheckBox, BorderLayout.SOUTH); + fieldTextPane = new JTextPane(); + fieldTextPane.setText(""); + myArchetypesPanel.add(fieldTextPane, BorderLayout.WEST); + bannerLbl = new JLabel(); + bannerLbl.setAlignmentY(0.0f); + bannerLbl.setHorizontalAlignment(2); + bannerLbl.setHorizontalTextPosition(2); + bannerLbl.setIcon(new ImageIcon(getClass().getResource("/resources/long_bannerIntelliJ.png"))); + bannerLbl.setIconTextGap(0); + bannerLbl.setText(""); + bannerLbl.setVerticalAlignment(1); + bannerLbl.setVerticalTextPosition(1); + myMainPanel.add(bannerLbl, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(10, -1), new Dimension(390, -1), new Dimension(66666, -1), 1, false)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(3, 2, new Insets(10, 10, 10, 10), -1, -1)); + panel1.setAlignmentX(0.0f); + panel1.setAlignmentY(0.0f); + panel1.setOpaque(true); + myMainPanel.add(panel1, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + panel1.setBorder(BorderFactory.createTitledBorder(null, ResourceBundle.getBundle("Bundle").getString("AsposeWizardPanel.WizardStep.headingMavn"), TitledBorder.LEFT, TitledBorder.DEFAULT_POSITION, new Font(panel1.getFont().getName(), panel1.getFont().getStyle(), panel1.getFont().getSize()), new Color(-16777216))); + final JLabel label1 = new JLabel(); + label1.setText("GroupId"); + panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + myGroupIdField = new JTextField(); + panel1.add(myGroupIdField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(444, 24), null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("ArtifactId"); + panel1.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + myArtifactIdField = new JTextField(); + panel1.add(myArtifactIdField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(444, 24), null, 0, false)); + final JLabel label3 = new JLabel(); + label3.setText("Version"); + panel1.add(label3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + myVersionField = new JTextField(); + myVersionField.setText(""); + panel1.add(myVersionField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(444, 24), null, 0, false)); + } + + /** + * @noinspection ALL + */ + private void $$$loadButtonText$$$(AbstractButton component, String text) { + StringBuffer result = new StringBuffer(); + boolean haveMnemonic = false; + char mnemonic = '\0'; + int mnemonicIndex = -1; + for (int i = 0; i < text.length(); i++) { + if (text.charAt(i) == '&') { + i++; + if (i == text.length()) break; + if (!haveMnemonic && text.charAt(i) != '&') { + haveMnemonic = true; + mnemonic = text.charAt(i); + mnemonicIndex = result.length(); + } + } + result.append(text.charAt(i)); + } + component.setText(result.toString()); + if (haveMnemonic) { + component.setMnemonic(mnemonic); + component.setDisplayedMnemonicIndex(mnemonicIndex); + } + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return myMainPanel; + } +} + diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/CreateMavenProjectCallback.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/CreateMavenProjectCallback.java new file mode 100644 index 0000000..cf9173b --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/CreateMavenProjectCallback.java @@ -0,0 +1,36 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.wizards.maven; + +import com.aspose.utils.AsposeMavenProjectManager; +import com.aspose.utils.execution.CallBackHandler; +import com.intellij.openapi.progress.ProgressIndicator; +import org.jetbrains.annotations.NotNull; + +import java.util.ResourceBundle; + +/** + * Created by Adeel Ilyas on 09/9/2015. + */ +public class CreateMavenProjectCallback implements CallBackHandler { + + @Override + public boolean executeTask(@NotNull ProgressIndicator progressIndicator) { + + progressIndicator.setIndeterminate(true); + progressIndicator.setText(ResourceBundle.getBundle("Bundle").getString("AsposeManager.projectMessage")); + AsposeMavenProjectManager comManager = AsposeMavenProjectManager.getInstance(); + + return comManager.retrieveAsposeMavenDependencies(progressIndicator); + } +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/DownloadExamplesCallback.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/DownloadExamplesCallback.java new file mode 100644 index 0000000..f329e67 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/DownloadExamplesCallback.java @@ -0,0 +1,40 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.wizards.maven; + +import com.aspose.utils.AsposeJavaAPI; +import com.aspose.utils.execution.CallBackHandler; +import com.intellij.openapi.progress.ProgressIndicator; +import org.jetbrains.annotations.NotNull; + +import java.util.ResourceBundle; + +/** + * Created by Adeel Ilyas on 9/9/2015. + */ +public class DownloadExamplesCallback implements CallBackHandler { + private AsposeJavaAPI asposeJavaAPI; + + DownloadExamplesCallback(AsposeJavaAPI asposeJavaAPI) { + this.asposeJavaAPI=asposeJavaAPI; + } + @Override + public boolean executeTask(@NotNull ProgressIndicator progressIndicator) { + + progressIndicator.setIndeterminate(true); + progressIndicator.setText(ResourceBundle.getBundle("Bundle").getString("AsposeManager.downloadExamplesMessage")); + + + return asposeJavaAPI.downloadExamples(progressIndicator); + } +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/MavenId.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/MavenId.java new file mode 100644 index 0000000..a281cc4 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/com/aspose/wizards/maven/MavenId.java @@ -0,0 +1,49 @@ + +/* + * The MIT License (MIT) + * + * Copyright (c) 2001-2015 Aspose Pty Ltd. + * + * 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: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * 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. + */ + +package com.aspose.wizards.maven; + +import org.jetbrains.annotations.Nullable; + +public class MavenId { + + @Nullable + private final String myGroupId; + @Nullable + private final String myArtifactId; + @Nullable + private final String myVersion; + + public MavenId(@Nullable String groupId, @Nullable String artifactId, @Nullable String version) { + myGroupId = groupId; + myArtifactId = artifactId; + myVersion = version; + } + + @Nullable + public String getGroupId() { + return myGroupId; + } + + @Nullable + public String getArtifactId() { + return myArtifactId; + } + + @Nullable + public String getVersion() { + return myVersion; + } + + +} diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/icons/AsposeIcons.java b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/icons/AsposeIcons.java new file mode 100644 index 0000000..2ae05e7 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/icons/AsposeIcons.java @@ -0,0 +1,14 @@ +package icons; + +import com.intellij.openapi.util.IconLoader; + +import javax.swing.*; + +public class AsposeIcons { + private static Icon load(String path) { + return IconLoader.getIcon(path, AsposeIcons.class); + } + + public static final Icon AsposeMedium = load("/resources/asposeMedium.png"); + public static final Icon AsposeLogo = load("/resources/asposeSmall.png"); +} \ No newline at end of file diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/aspose.png b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/aspose.png new file mode 100644 index 0000000..b0532d9 Binary files /dev/null and b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/aspose.png differ diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/asposeMedium.png b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/asposeMedium.png new file mode 100644 index 0000000..57d9095 Binary files /dev/null and b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/asposeMedium.png differ diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/asposeSmall.png b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/asposeSmall.png new file mode 100644 index 0000000..9ac17cc Binary files /dev/null and b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/asposeSmall.png differ diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/long_bannerIntelliJ.png b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/long_bannerIntelliJ.png new file mode 100644 index 0000000..9f9c8e8 Binary files /dev/null and b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/long_bannerIntelliJ.png differ diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/maven/compiler.xml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/maven/compiler.xml new file mode 100644 index 0000000..96e3ad9 --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/maven/compiler.xml @@ -0,0 +1,30 @@ + + + + + + diff --git a/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/maven/untitled.iml b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/maven/untitled.iml new file mode 100644 index 0000000..c46d21f --- /dev/null +++ b/Plugins/Aspose_Email_Java_for_IntelliJ(Maven)/src/resources/maven/untitled.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + +