Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frameworks and fixes #253

Merged
merged 16 commits into from Jan 21, 2018
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
34a5adc
Fixed: RoboVmPlugin.getRoboVmModules extended to return only modules …
dkimitsa Jan 12, 2018
6c83589
Templater: added template for framework target, templater is modified…
dkimitsa Jan 12, 2018
86b6fc5
Templater: included framework template into root pom
dkimitsa Jan 12, 2018
17db26b
RoboVm libs: added framework support lib to make it easier to build f…
dkimitsa Jan 12, 2018
afeee1a
Framework target: linking with framework support lib
dkimitsa Jan 12, 2018
0184bb0
Idea: added RoboVM main menu, added Clean robovm cache and New projec…
dkimitsa Jan 12, 2018
257b7fb
Idea: added create framework functionality to RoboVM menu
dkimitsa Jan 12, 2018
9740908
Idea: added create framework functionality, missed plugin.xml added
dkimitsa Jan 12, 2018
452177c
Idea: added new RoboVM project/module type 'Framework target'
dkimitsa Jan 12, 2018
8b35f57
corrected framework support lib name to robovm-frameworksupport
dkimitsa Jan 12, 2018
0e985e0
Fixed completely broken “Add new module” functionality in Idea:
dkimitsa Jan 12, 2018
1b5090a
Fixed bug when launcher was putting get-task-allow: true for cases wh…
dkimitsa Jan 12, 2018
17e9b68
Fixed broken compilation of framework support lib
dkimitsa Jan 12, 2018
f1ae9ff
Fixed bug. it was tried to add menu twice this produced and warning t…
dkimitsa Jan 15, 2018
1f553f4
Added workaround to run Idea plugin in both Android studio and Idea
dkimitsa Jan 15, 2018
fd71297
Framework Template updated to generate Module map, this allows framew…
dkimitsa Jan 16, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+87 −28
Diff settings

Always

Just for now

Idea: added new RoboVM project/module type 'Framework target'

  • Loading branch information...
dkimitsa committed Jan 12, 2018
commit 452177c62b8ebfde2066f3c8cb514b3fbc4309ef
@@ -16,26 +16,6 @@
*/
package org.robovm.idea.builder;

import java.io.File;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

import com.intellij.openapi.externalSystem.service.project.ProjectDataManager;
import com.intellij.openapi.module.*;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.project.MavenProjectsManager;
import org.jetbrains.plugins.gradle.service.project.wizard.GradleProjectImportBuilder;
import org.jetbrains.plugins.gradle.service.project.wizard.GradleProjectImportProvider;
import org.jetbrains.plugins.gradle.settings.DistributionType;
import org.robovm.compiler.Version;
import org.robovm.idea.RoboVmPlugin;
import org.robovm.idea.sdk.RoboVmSdkType;
import org.robovm.templater.Templater;

import com.intellij.ide.actions.ImportModuleAction;
import com.intellij.ide.util.newProjectWizard.AddModuleWizard;
import com.intellij.ide.util.projectWizard.JavaModuleBuilder;
@@ -44,14 +24,25 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.externalSystem.model.ExternalSystemDataKeys;
import com.intellij.openapi.externalSystem.service.project.ProjectDataManager;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.SourceFolder;
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.util.io.FileUtil;
@@ -60,6 +51,24 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.projectImport.ProjectImportProvider;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.project.MavenProjectsManager;
import org.jetbrains.plugins.gradle.service.project.wizard.GradleProjectImportBuilder;
import org.jetbrains.plugins.gradle.service.project.wizard.GradleProjectImportProvider;
import org.jetbrains.plugins.gradle.settings.DistributionType;
import org.robovm.compiler.Version;
import org.robovm.idea.RoboVmPlugin;
import org.robovm.idea.sdk.RoboVmSdkType;
import org.robovm.templater.Templater;

import java.io.File;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;

/**
* Creates all the files for a new project/module using the templater. See
@@ -72,21 +81,28 @@
public static final String PACKAGE_NAME_PLACEHOLDER = "__packageName__";
public static final String APP_NAME_PLACEHOLDER = "__appName__";

protected String templateName;
protected final String templateName;
protected final Map<String, String> templateCustomValues;
protected String packageName;
protected String mainClassName;
protected String appName;
protected String appId;
protected String robovmDir;
protected final String robovmDir;
protected BuildSystem buildSystem;

public RoboVmModuleBuilder(String templateName) {
this(templateName, (Map<String, String>)null);
}

public RoboVmModuleBuilder(String templateName, Map<String, String> customValues) {
this.templateName = templateName;
this.templateCustomValues = customValues;
this.robovmDir = "";
}

public RoboVmModuleBuilder(String templateName, String robovmDir) {
this.templateName = templateName;
this.templateCustomValues = null;
this.robovmDir = robovmDir;
}

@@ -103,7 +119,7 @@ public ModuleType getModuleType() {

@Override
public ModuleWizardStep[] createWizardSteps(WizardContext wizardContext, ModulesProvider modulesProvider) {
RoboVmModuleWizardStep wizardStep = new RoboVmModuleWizardStep(this, wizardContext, modulesProvider);
RoboVmModuleWizardStep wizardStep = new RoboVmModuleWizardStep(this, wizardContext, modulesProvider, this.templateCustomValues);

if (!robovmDir.isEmpty()) {
wizardStep.disableBuildSystem();
@@ -21,6 +21,7 @@
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;

import javax.swing.*;
import java.util.Map;

/**
* Custom project wizard step that lets the user specify
@@ -30,9 +31,12 @@
private final RoboVmNewModuleEditor editor;
private final RoboVmModuleBuilder builder;

public RoboVmModuleWizardStep(RoboVmModuleBuilder builder, WizardContext wizardContext, ModulesProvider modulesProvider) {
public RoboVmModuleWizardStep(RoboVmModuleBuilder builder, WizardContext wizardContext, ModulesProvider modulesProvider,
Map<String, String> customValues) {
super();
this.editor = new RoboVmNewModuleEditor();
if (customValues != null)
applyCustomValues(customValues);
this.builder = builder;
}

@@ -62,4 +66,29 @@ public void updateDataModel() {
builder.setBuildSystem(RoboVmModuleBuilder.BuildSystem.None);
}
}

/**
* dkimitsa: applies custom titles for project templates that requires this. Ex. ios framework
*/
private void applyCustomValues(Map<String, String> customTitles) {
applyCustomTitle(customTitles.get("appIdLabel"), editor.appIdLabel);
applyCustomTitle(customTitles.get("appNameLabel"), editor.appNameLabel);
applyCustomTitle(customTitles.get("packageNameLabel"), editor.packageNameLabel);
applyCustomTitle(customTitles.get("mainClassNameLabel"), editor.mainClassNameLabel);

applyCustomValue(customTitles.get("appId"), editor.appId);
applyCustomValue(customTitles.get("appName"), editor.appName);
applyCustomValue(customTitles.get("packageName"), editor.packageName);
applyCustomValue(customTitles.get("mainClassName"), editor.mainClassName);
}

private void applyCustomTitle(String title, JLabel label) {
if (title != null)
label.setText(title);
}

private void applyCustomValue(String value, JTextField field) {
if (value != null)
field.setText(value);
}
}
@@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
<component id="152a4" class="javax.swing.JLabel">
<component id="152a4" class="javax.swing.JLabel" binding="packageNameLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
@@ -29,15 +29,15 @@
<text value="Main Class Name"/>
</properties>
</component>
<component id="57783" class="javax.swing.JLabel">
<component id="57783" class="javax.swing.JLabel" binding="appNameLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Application Name"/>
</properties>
</component>
<component id="30d3c" class="javax.swing.JLabel">
<component id="30d3c" class="javax.swing.JLabel" binding="appIdLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
@@ -19,6 +19,10 @@
import javax.swing.*;

public class RoboVmNewModuleEditor {
public JLabel packageNameLabel;
public JLabel appNameLabel;
public JLabel appIdLabel;
public JLabel mainClassNameLabel;
public JTextField packageName;
public JTextField appName;
public JTextField appId;
@@ -27,6 +27,7 @@
import org.robovm.idea.RoboVmIcons;

import javax.swing.*;
import java.util.HashMap;

/**
* Returns a project template for every template known
@@ -61,6 +62,15 @@ public Icon getGroupIcon(String group) {
public ProjectTemplate[] createTemplates(String group, WizardContext context) {
return new ProjectTemplate[] {
new RoboVmProjectTemplate("RoboVM iOS App without storyboards", "A basic single view app without storyboards", new RoboVmModuleBuilder("ios-single-view-no-ib")),
new RoboVmProjectTemplate("RoboVM iOS Framework", "A basic iOS framework template ", new RoboVmModuleBuilder("ios-framework",
new HashMap<String, String>(){{
put("appNameLabel", "Framework Name");
put("appIdLabel", "Framework Id");
put("mainClassName", "MyFramework");
put("packageName", "com.mycompany.myframework");
put("appName", "MyFramework");
put("appId", "com.mycompany.myframework");
}})),
new RoboVmProjectTemplate("RoboVM Console App", "A console app for Mac OS X or Linux", new RoboVmModuleBuilder("console")),
};
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.