| /** |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.wizard.ui.theme; |
| |
| import java.util.HashSet; |
| import java.util.List; |
| import java.util.Set; |
| |
| import org.eclipse.core.resources.IProject; |
| import org.eclipse.core.runtime.CoreException; |
| import org.eclipse.core.runtime.IProgressMonitor; |
| import org.eclipse.osbp.wizard.ui.basic.BasicProjectCreator; |
| import org.eclipse.osbp.wizard.ui.basic.BasicProjectInfo; |
| import org.eclipse.osbp.wizard.ui.basic.CommonProjectWizardType; |
| import org.eclipse.xtext.ui.util.PluginProjectFactory; |
| import org.eclipse.xtext.ui.util.ProjectFactory; |
| |
| import com.google.common.collect.ImmutableList; |
| import com.google.common.collect.Lists; |
| |
| // TODO: Auto-generated Javadoc |
| /** |
| * The Theme Project Creator. |
| */ |
| public class ThemeProjectCreator extends BasicProjectCreator { |
| |
| @Override |
| protected String getPrimaryModelFileExtension() { |
| try { |
| return super.getPrimaryModelFileExtension(); |
| } |
| catch (Exception e) { |
| return "product"; |
| } |
| } |
| |
| public ThemeProjectCreator() { |
| super(); |
| } |
| |
| /** |
| * @return an explicit theme project factory |
| */ |
| @Override |
| protected PluginProjectFactory createProjectFactory() { |
| return new ThemeProjectFactory(); //super.createProjectFactory(); |
| } |
| |
| /** |
| * Configure the factory with relevant information. |
| * @param factory to be configured |
| */ |
| @Override |
| protected ProjectFactory configureProjectFactory(ProjectFactory factory) { |
| ProjectFactory result = super.configureProjectFactory(factory); |
| ((ThemeProjectFactory)result).configureFrom((BasicProjectInfo) getProjectInfo()); |
| ((ThemeProjectFactory)result).setProjectName(getProjectInfo().getProjectName()+"."+CommonProjectWizardType.Theme.toString().toLowerCase()); |
| ((ThemeProjectFactory)result).setRule(getRule()); |
| return result; |
| } |
| |
| /** |
| * @return no activator class name for the theme project |
| */ |
| @Override |
| protected String getActivatorClassName() { |
| return null; // getProjectBasePackage()+".Activator"; //super.getActivatorClassName(); |
| } |
| |
| /** |
| * Enhance the project and display the progress on the monitor |
| * @param project to be enhanced |
| * @param monitor displaying the progress |
| */ |
| protected void enhanceProject(final IProject project, final IProgressMonitor monitor) throws CoreException { |
| enhanceProject(project, monitor, "theme"); |
| } |
| |
| /** |
| * @return the folder <code>src</code> for the model |
| */ |
| @Override |
| protected String getModelFolderName() { |
| return "src"; |
| } |
| |
| /** |
| * @return all folder names |
| */ |
| @Override |
| protected List<String> getAllFolders() { |
| return ImmutableList.of("src"); |
| } |
| |
| /** |
| * @return all required bundles for the theme project |
| */ |
| @Override |
| protected List<String> getRequiredBundles() { |
| // There is no need for the super required bundles! |
| List<String> result = Lists.newArrayList(); // super.getRequiredBundles()); |
| return addFromMultiLine(result, |
| ManifestAttribute.REQUIRED_BUNDLE, |
| // NOT NECESSARY INSIDE THE META-INF - "com.vaadin.sass-compiler;bundle-version=\"0.9.10\","+ |
| "org.w3c.css.sac;bundle-version=\"1.3.1\","+ |
| "org.w3c.flute;bundle-version=\"1.3.0\","+ |
| "" |
| ); |
| } |
| |
| /** |
| * @return all imported packages for the theme project |
| */ |
| @Override |
| protected List<String> getImportedPackages() { |
| List<String> result = Lists.newArrayList(); // super.getImportedPackages()); |
| return result; |
| } |
| |
| /** |
| * @return all project natures for the theme project |
| */ |
| @Override |
| protected String[] getProjectNatures() { |
| Set<String> projectNatures = new HashSet<String>(); |
| projectNatures.add("org.eclipse.pde.PluginNature"); |
| projectNatures.add("org.eclipse.jdt.core.javanature"); |
| return projectNatures.toArray(new String[0]); |
| } |
| |
| } |