| /** |
| * |
| * 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 v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.wizard.ui.basic; |
| |
| import java.io.BufferedInputStream; |
| import java.io.IOException; |
| import java.io.InputStream; |
| import java.net.URISyntaxException; |
| import java.net.URL; |
| import java.nio.file.Files; |
| import java.nio.file.Path; |
| import java.nio.file.Paths; |
| import java.util.ArrayList; |
| import java.util.Arrays; |
| import java.util.Collection; |
| import java.util.Enumeration; |
| import java.util.HashMap; |
| import java.util.HashSet; |
| import java.util.Locale; |
| import java.util.Map; |
| import java.util.Set; |
| import java.util.TreeMap; |
| import java.util.TreeSet; |
| |
| import org.apache.commons.io.IOUtils; |
| import org.apache.commons.lang3.StringUtils; |
| import org.eclipse.core.runtime.FileLocator; |
| import org.eclipse.core.runtime.IPath; |
| import org.eclipse.core.runtime.Platform; |
| import org.osgi.framework.Bundle; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| import org.eclipse.osbp.preferences.DataSourceConfiguration; |
| import org.eclipse.osbp.preferences.EnumDatabaseVendor; |
| import org.eclipse.osbp.preferences.ProductConfiguration; |
| import org.eclipse.osbp.preferences.ProductConfigurationPrefs; |
| import org.eclipse.osbp.preferences.ProductFileConfigurations; |
| import org.eclipse.osbp.preferences.ProductFilePlugins; |
| import org.eclipse.osbp.utils.common.BundleUtilities; |
| import org.eclipse.osbp.utils.themes.ui.VaaclipseUiTheme; |
| import org.eclipse.osbp.wizard.ui.Activator; |
| import org.eclipse.osbp.wizard.ui.allinonedsl.AllInOneDSLsProjectMasterTemplate; |
| import org.eclipse.osbp.wizard.ui.basic.BasicProjectCreator.ManifestAttribute; |
| import org.eclipse.osbp.wizard.ui.theme.ThemeProjectMasterTemplate; |
| |
| public class BasicProjectInfo extends org.eclipse.xtext.ui.wizard.DefaultProjectInfo { |
| |
| private static final Logger LOGGER = LoggerFactory.getLogger(BasicProjectInfo.class); |
| |
| public void log(String text) { |
| Gofl.log(this, text); |
| } |
| |
| private final static String DEFAULT_THEME_NAME = "osbp"; |
| |
| private static final String MANIFEST_MF_ADDONS = "MANIFEST.MF.ADDONS"; |
| |
| protected final static double BREE_MINIMUM = 1.8; |
| |
| public static final String IGNORE_THIS_FILE = "!!IGNORE THIS FILE!!"; |
| |
| private static final String PROJECT_PREFIX = "PROJECT"; |
| private static final String PROJECT_MAIN_PREFIX = PROJECT_PREFIX; |
| private static final String PROJECT_MAIN_PATH = PROJECT_MAIN_PREFIX+"/"; |
| private static final String PROJECT_SUB_PREFIX = PROJECT_PREFIX+"."; |
| private static final String PROJECT_BASIC_POSTFIX = ".__basic__"; |
| private static final String PROJECT_BASIC_NAME = PROJECT_PREFIX+PROJECT_BASIC_POSTFIX; |
| |
| public static final String FILE_PROJECT_NAME = "PROJECTNAME"; |
| public static final String FILE_PROJECT_PATH = "PROJECTPATH"; |
| public static final String FILE_BUSINESS_BUNDLE_CLASS_NAME = "BUSINESSBUNDLECLASSNAME"; |
| public static final String FILE_THEME_BUNDLE_CLASS_NAME = "THEMEBUNDLECLASSNAME"; |
| |
| public static final String PRE = "${{"; |
| public static final String POST = "}}"; |
| |
| public static final String CONTENT_SAMPLE_VENDOR_NAME = PRE+"SAMPLE_VENDOR_NAME"+POST; |
| public static final String CONTENT_SAMPLE_VENDOR_COUNTRY = PRE+"SAMPLE_VENDOR_COUNTRY"+POST; |
| public static final String CONTENT_SAMPLE_VENDOR_ISO3166 = PRE+"SAMPLE_VENDOR_ISO3166"+POST; |
| |
| public static final String CONTENT_BUNDLE_VERSION = PRE+"BUNDLE_VERSION"+POST; |
| public static final String CONTENT_BUSINESS_BUNDLE_CLASS_NAME = PRE+"BUSINESS_BUNDLE_CLASS_NAME"+POST; |
| public static final String CONTENT_BUSINESS_BUNDLE = PRE+"BUSINESS_BUNDLE"+POST; |
| public static final String CONTENT_BUSINESSDATA_DATABASE_SCHEMA = PRE+"BUSINESSDATA_DATABASE_SCHEMA"+POST; |
| public static final String CONTENT_BUSINESSDATA_DATASOURCE_NAME = PRE+"BUSINESSDATA_DATASOURCE_NAME"+POST; |
| public static final String CONTENT_BUSINESSDATA_PERSISTENCE_UNIT = PRE+"BUSINESSDATA_PERSISTENCE_UNIT"+POST; |
| public static final String CONTENT_VAACLIPSE_THEME = PRE+"VAACLIPSE_THEME"+POST; |
| |
| public static final String CONTENT_BASIC_PROJECT_NAME = PRE+"BASIC_PROJECT_NAME"+POST; |
| public static final String CONTENT_BASIC_SYMBLIC_NAME = PRE+"BASIC_SYMBOLIC_NAME"+POST; |
| public static final String CONTENT_MODEL_PROJECT_NAME = PRE+"MODEL_PROJECT_NAME"+POST; |
| public static final String CONTENT_MODEL_SYMBOLIC_NAME = PRE+"MODEL_SYMBOLIC_NAME"+POST; |
| public static final String CONTENT_PRODUCT_PROJECT_NAME = PRE+"PRODUCT_PROJECT_NAME"+POST; |
| public static final String CONTENT_PRODUCT_SYMBLIC_NAME = PRE+"PRODUCT_SYMBOLIC_NAME"+POST; |
| |
| public static final String CONTENT_MOCK_PRODUCT_DATA_FORCE = PRE+"MOCK_PRODUCT_DATA_FORCE"+POST; |
| public static final String CONTENT_MOCK_PRODUCT_DATA_PROJECT_NAME = PRE+"MOCK_PRODUCT_DATA_PROJECT_NAME"+POST; |
| public static final String CONTENT_MOCK_AUTHENTICATION_DATA_FORCE = PRE+"MOCK_AUTHENTICATION_DATA_FORCE"+POST; |
| public static final String CONTENT_MOCK_BLOB_DATA_FORCE = PRE+"MOCK_BLOB_DATA_FORCE"+POST; |
| |
| public static final String CONTENT_PRODUCT_PORT_NO = PRE+"PRODUCT_PORT_NO"+POST; |
| public static final String CONTENT_PRODUCT_URL_PATH = PRE+"PRODUCT_URL_PATH"+POST; |
| public static final String CONTENT_PRODUCT_DESKTOP_URL_PATH = PRE+"PRODUCT_DESKTOP_URL_PATH"+POST; |
| public static final String CONTENT_PRODUCT_MOBILE_URL_PATH = PRE+"PRODUCT_MOBILE_URL_PATH"+POST; |
| |
| public static final String CONTENT_PROJECT_FILE_PATH = PRE+"PROJECT_FILE_PATH"+POST; |
| |
| public static final String CONTENT_THEME_SYMBOLIC_BUNDLE_NAME = PRE+"THEME_SYMBOLIC_BUNDLE_NAME"+POST; |
| public static final String CONTENT_THEME_SYMBOLIC_NAME = PRE+"THEME_SYMBOLIC_NAME"+POST; |
| public static final String CONTENT_THEME_PROJECT_NAME = PRE+"THEME_PROJECT_NAME"+POST; |
| |
| public static final String CONTENT_REQUIRED_PLUGINS = PRE+"REQUIRED_PLUGINS"+POST; |
| public static final String CONTENT_RECOMMENDED_PLUGINS = PRE+"RECOMMENDED_PLUGINS"+POST; |
| public static final String CONTENT_REQUIRED_CONFIGURATIONS = PRE+"REQUIRED_CONFIGURATIONS"+POST; |
| public static final String CONTENT_RECOMMENDED_CONFIGURATIONS = PRE+"RECOMMENDED_CONFIGURATIONS"+POST; |
| |
| public static final String CONTENT_ENTITY_PROPERTY_BASE_ID = PRE+"ENTITY_PROPERTY_BASE_ID"+POST; |
| public static final String CONTENT_ENTITY_PROPERTY_BASE_UUID = PRE+"ENTITY_PROPERTY_BASE_UUID"+POST; |
| |
| public static final String CONTENT_PROJECT_LOC = PRE+"PROJECT_LOC"+POST; |
| private static final String DEFAULT_PROJECT_LOC = "${project_loc}"; |
| |
| protected static final String CONTENT_BREE_VERSION = PRE+"BREE_VERSION"+POST; |
| protected static final String CONTENT_XMS_SIZE = PRE+"XMS_SIZE"+POST; |
| protected static final String CONTENT_XMX_SIZE = PRE+"XMX_SIZE"+POST; |
| |
| private static final String BINARY_PREFIX_EXTENSION = "BINARY."; |
| public static final String TEMPLATE_POSTFIX_EXTENSION = ".TEMPLATE"; |
| private static final String NO_COMMENT_TEMPLATE_POSTFIX_EXTENSION = ".TEMPLATE_NO_COMMENT"; |
| public static final String TEMPLATE_BASE_PATH = "/wizardtemplates/"; |
| protected static final String BASIC_TEMPLATE = "__basic__"; |
| protected static final String PRODUCT_TEMPLATE = "__product__"; |
| |
| protected CommonProjectWizardType wizardType; |
| protected BundleType bundleType; |
| protected IPath projectLocation; |
| protected String postfix; |
| |
| public static enum BundleType { |
| MODEL, |
| PRODUCT, |
| THEME |
| } |
| |
| private static final String[] binaryExtensions = { |
| "bmp", |
| "eot", |
| "ico", |
| "gif", |
| "jar", |
| "jpeg", |
| "jpg", |
| "png", |
| "ttf", |
| "woff" |
| }; |
| |
| private static final Map<String, URL> wizardTemplateFiles = new TreeMap<String, URL>(); |
| |
| private Map<String, URL> getWizardTemplateFiles() { |
| if (wizardTemplateFiles.isEmpty()) { |
| Enumeration<URL> files = thisBundle().findEntries("/", "*", true); |
| Gofl.log(this, "findFilesInBundle('/')"); |
| Gofl.log(this, "files==NULL: <"+(files == null)+" >" ); |
| if(files != null) { |
| // DONT'T DO THIS!!!! Gofl.log(this, "files.hasMoreElements(): <"+(files.hasMoreElements())+" >" ); |
| } |
| while (files != null && files.hasMoreElements()) { |
| URL fileURL = files.nextElement(); |
| String filePath = fileURL.getFile(); |
| if (filePath.contains(TEMPLATE_BASE_PATH) && !filePath.contains("/bin/")) { |
| wizardTemplateFiles.put(filePath, fileURL); |
| Gofl.log(this, " - "+filePath); |
| } |
| } |
| } |
| return wizardTemplateFiles; |
| } |
| |
| private static boolean isBinaryFile(String filePath) { |
| if (filePath.contains(BINARY_PREFIX_EXTENSION)) { |
| return true; |
| } |
| else { |
| String[] items = filePath.split("\\."); |
| String fileExtension = items[items.length-1].toLowerCase(); |
| return (Arrays.asList(binaryExtensions).contains(fileExtension)); |
| } |
| } |
| |
| public BasicProjectInfo(CommonProjectWizardType wizardType) { |
| this.postfix = ""; |
| this.wizardType = wizardType; |
| switch (wizardType) { |
| case AllInOneDSLs: |
| this.bundleType = BundleType.MODEL; |
| setBusinessBundle("Example Business"); |
| setMasterTemplate(AllInOneDSLsProjectMasterTemplate.EMPTY); |
| break; |
| case Theme: |
| this.bundleType = BundleType.THEME; |
| this.masterTemplate = ThemeProjectMasterTemplate.OSBPDEFAULT; |
| setBusinessBundle("Example"); |
| break; |
| } |
| } |
| |
| private void useForAnyFactory() { |
| productFilePlugins = new ProductFilePlugins(ProductConfiguration.prefs(), |
| dataSourceForAuthentication, |
| dataSourceForBLOB, |
| dataSourceForBPM, |
| dataSourceForBusinessData |
| ); |
| productFileConfigurations = new ProductFileConfigurations(ProductConfiguration.prefs(), |
| dataSourceForAuthentication, |
| dataSourceForBLOB, |
| dataSourceForBPM, |
| dataSourceForBusinessData |
| ); |
| } |
| |
| public void useForProductFactory() { |
| useForAnyFactory(); |
| postfix = ""; |
| templateFiles = null; |
| switch (wizardType) { |
| case AllInOneDSLs: |
| bundleType = BundleType.PRODUCT; |
| break; |
| case Theme: |
| break; |
| } |
| } |
| |
| public void useForModelFactory(String postfix) { |
| useForAnyFactory(); |
| templateFiles = null; |
| this.postfix = postfix; |
| switch (wizardType) { |
| case AllInOneDSLs: |
| bundleType = BundleType.MODEL; |
| break; |
| case Theme: |
| break; |
| } |
| } |
| |
| public void useForThemeFactory() { |
| useForAnyFactory(); |
| postfix = ""; |
| templateFiles = null; |
| switch (wizardType) { |
| case AllInOneDSLs: |
| break; |
| case Theme: |
| bundleType = BundleType.THEME; |
| break; |
| } |
| } |
| |
| protected static boolean isDirectory(String filePath) { |
| return (filePath.trim().isEmpty() || filePath.trim().endsWith("/")); |
| } |
| |
| private String addPersistenceUnitConfiguration(String persistenceUnit, String dataSourceName) { |
| DataSourceConfiguration dsc = ProductConfiguration.prefs().getDataSource(dataSourceName); |
| return |
| "\n"+ |
| "persistenceUnit/"+persistenceUnit+"/batchWriting="+dsc.getDefaultBatchWriting()+"\n"+ |
| "persistenceUnit/"+persistenceUnit+"/batchWritingSize=1000\n"+ |
| "persistenceUnit/"+persistenceUnit+"/cacheStatements=true\n"+ |
| "persistenceUnit/"+persistenceUnit+"/cacheStatementsSize=200\n"+ |
| "persistenceUnit/"+persistenceUnit+"/ddlGeneration=create-or-extend-tables\n"+ |
| "persistenceUnit/"+persistenceUnit+"/deployOnStartup=true\n"+ |
| "persistenceUnit/"+persistenceUnit+"/jndiName="+dataSourceName+"\n"+ |
| "persistenceUnit/"+persistenceUnit+"/loggingLevel=off\n"+ |
| "persistenceUnit/"+persistenceUnit+"/persistenceXMLPath=META-INF/persistence.xml\n"+ |
| "persistenceUnit/"+persistenceUnit+"/queryCache=true\n"+ |
| "persistenceUnit/"+persistenceUnit+"/schema="+dsc.getDefaultSchemaName(); |
| } |
| |
| private final static String PRODUCTION_PREFERENCES = ".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.osbp.production.prefs"; |
| |
| public String getCloneWorkspaceProductConfiguration() { |
| String clone = ""; |
| clone += ProductConfigurationPrefs.BUSINESS_BUNDLE_CLASS_NAME+"="+getBusinessBundleClassName(); |
| clone += "\n"+ProductConfigurationPrefs.getCloneWorkspaceProductConfiguration(); |
| clone += "\n"+ProductConfigurationPrefs.AUTHENTICATION_NODE+"/"+ProductConfigurationPrefs.AUTHENTICATION_ENCRYPT_PASSWORDS+"="+(MockDataGenerateType.NONE.equals(mockAuthenticationDataGenerateType) ? "false" : "true"); |
| clone += "\n"+ProductConfigurationPrefs.SHIRO_NODE+"/"+ProductConfigurationPrefs.SHIRO_PROTOCOL_DATASOURCE+"="+getDataSourceForAuthentication(); |
| clone += "\n"+ProductConfigurationPrefs.SHIRO_NODE+"/"+ProductConfigurationPrefs.SHIRO_PROTOCOL_UNIT+"="+ProductConfigurationPrefs.PERSISTENCE_UNIT_AUTHENTICATION; |
| // clone += "\n"+ProductConfigurationPrefs.DATASOURCE_FOR_AUTHENTICATION+"="+getDataSourceForAuthentication(); |
| // clone += "\n"+ProductConfigurationPrefs.DATASOURCE_FOR_BLOB+"="+getDataSourceForBLOB(); |
| // clone += "\n"+ProductConfigurationPrefs.DATASOURCE_FOR_BPM+"="+getDataSourceForBPM(); |
| // clone += "\n"+ProductConfigurationPrefs.DATASOURCE_FOR_BUSINESSDATA+"="+getDataSourceForBusinessData(); |
| clone += addPersistenceUnitConfiguration(ProductConfigurationPrefs.PERSISTENCE_UNIT_AUTHENTICATION, getDataSourceForAuthentication()); |
| clone += addPersistenceUnitConfiguration(ProductConfigurationPrefs.PERSISTENCE_UNIT_BLOB, getDataSourceForBLOB()); |
| clone += addPersistenceUnitConfiguration(ProductConfigurationPrefs.PERSISTENCE_UNIT_BPM, getDataSourceForBPM()); |
| clone += addPersistenceUnitConfiguration(ProductConfigurationPrefs.PERSISTENCE_UNIT_BUSINESSDATA, getDataSourceForBusinessData()); |
| if (templateFiles.containsKey(PRODUCTION_PREFERENCES)) { |
| clone += "\n"+templateFiles.get(PRODUCTION_PREFERENCES).getGeneratedFileContent().trim(); |
| } |
| return clone; |
| } |
| |
| public class TemplateFile { |
| private final String bundlePath; |
| private final String relativePath; |
| private final URL sourceUrl; |
| private final boolean preGeneratedComment; |
| |
| protected TemplateFile(String bundlePath, String relativePath, URL sourceUrl, boolean preGeneratedComment) { |
| this.bundlePath = bundlePath; |
| this.relativePath = relativePath; |
| this.sourceUrl = sourceUrl; |
| this.preGeneratedComment = preGeneratedComment; |
| } |
| |
| protected boolean isDirectory() { |
| return BasicProjectInfo.isDirectory(relativePath); |
| } |
| |
| public String getGeneratedFilePath() { |
| String file = relativePath.replace(PROJECT_MAIN_PATH, ""); |
| file = file.replace(PROJECT_BASIC_NAME, PROJECT_MAIN_PREFIX+postfix); |
| file = file.replace(PROJECT_MAIN_PREFIX+postfix+"/", ""); |
| if (file.startsWith(PROJECT_SUB_PREFIX)) { |
| file = "../"+file.replace(PROJECT_PREFIX, BasicProjectInfo.this.getProjectName()); |
| } |
| if (isDirectory()) { |
| file += "README.TXT"; |
| } |
| return file |
| .replace(BINARY_PREFIX_EXTENSION, "") |
| .replace(NO_COMMENT_TEMPLATE_POSTFIX_EXTENSION, "") |
| .replace(TEMPLATE_POSTFIX_EXTENSION, "") |
| .replace(FILE_BUSINESS_BUNDLE_CLASS_NAME, getBusinessBundleClassName()) |
| .replace(FILE_PROJECT_NAME, getProjectName()) |
| .replace(FILE_PROJECT_PATH, getProjectFilePath()) |
| .replace(FILE_THEME_BUNDLE_CLASS_NAME, getBasicSymbolicName()) |
| ; |
| } |
| |
| private String showLinesFound(String content, String search) { |
| String found = ""; |
| String lines[] = content.split("\n"); |
| for (int line = 0; line < lines.length; line++) { |
| if (lines[line].contains(search)) { |
| found += " - line "+(line+1)+": "+lines[line]+"\n"; |
| } |
| } |
| return found; |
| } |
| |
| public boolean isNotEmpty() throws Exception { |
| String content = null; |
| try { |
| content = getOriginalFileContent(); |
| } |
| catch (URISyntaxException e) {} |
| catch (IOException e) {} |
| return content != null; |
| } |
| |
| public String getOriginalFileContent() throws Exception { |
| String content = ""; |
| if (preGeneratedComment) { |
| content = getWizardGeneratedFileComment(); |
| } |
| try { |
| InputStream fisSourceFile = new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(bundlePath)); |
| content = IOUtils.toString(fisSourceFile, "UTF-8"); |
| if (content != null) { |
| if (content.contains(IGNORE_THIS_FILE)) { |
| content = null; |
| } |
| else if (content.trim().isEmpty()) { |
| content = null; |
| } |
| } |
| } |
| catch (Exception e) { |
| Gofl.log(this, "getOriginalFileContent() - sourceUrl="+sourceUrl.toString()+" - bundlePath="+bundlePath+" relativePath="+relativePath); |
| Gofl.log(this, e); |
| throw e; |
| } |
| return content; |
| } |
| |
| public String getGeneratedFileContent() { |
| Gofl.log(this, "getGeneratedFileContent() "+relativePath+" binary="+isBinaryFile(relativePath)); |
| String content = ""; |
| try { |
| if (isDirectory()) { |
| content = getWizardGeneratedFileComment(); |
| content += "\n\nThis directory is necessary for the bundle to be consistent!"; |
| } |
| else { |
| if (preGeneratedComment) { |
| content = getWizardGeneratedFileComment(); |
| } |
| try { |
| String original = getOriginalFileContent(); |
| if (original != null) { |
| content += original; |
| } |
| } |
| catch (Exception e) { |
| content += sourceUrl+" could not be loaded: "+e.getLocalizedMessage(); |
| } |
| } |
| } |
| catch (Exception e) { |
| Gofl.log(this, "getGeneratedFileContent() "+relativePath+": exception "+e.getClass().getCanonicalName()); |
| Gofl.log(this, e); |
| } |
| if (!isBinaryFile(relativePath)) { |
| content = content |
| .replace(CONTENT_SAMPLE_VENDOR_NAME, getVendor()) |
| .replace(CONTENT_SAMPLE_VENDOR_COUNTRY, getTopLevelDomain().getNativeName()) |
| .replace(CONTENT_SAMPLE_VENDOR_ISO3166, getTopLevelDomain().getTopLevelDomain()) |
| .replace(CONTENT_BUNDLE_VERSION, getVersion()) |
| .replace(CONTENT_BUSINESS_BUNDLE_CLASS_NAME, getBusinessBundleClassName()) |
| .replace(CONTENT_BUSINESS_BUNDLE, getBusinessBundle()) |
| .replace(CONTENT_BUSINESSDATA_DATABASE_SCHEMA, getDatabaseSchemaForBusinessName()) |
| .replace(CONTENT_BUSINESSDATA_DATASOURCE_NAME, ProductConfiguration.getPersistenceUnitJndiName(ProductConfigurationPrefs.PERSISTENCE_UNIT_BUSINESSDATA)) |
| .replace(CONTENT_BUSINESSDATA_PERSISTENCE_UNIT, ProductConfigurationPrefs.PERSISTENCE_UNIT_BUSINESSDATA) |
| .replace(CONTENT_VAACLIPSE_THEME, (getVaaclipseTheme() == null ? DEFAULT_THEME_NAME : getVaaclipseTheme().getId())) |
| .replace(CONTENT_PROJECT_FILE_PATH, getProjectFilePath()) |
| .replace(CONTENT_BASIC_PROJECT_NAME, getBasicProjectName()) |
| .replace(CONTENT_BASIC_SYMBLIC_NAME, getBasicSymbolicName()) |
| .replace(CONTENT_MOCK_AUTHENTICATION_DATA_FORCE, getMockAuthenticationDataForceFlag()) |
| .replace(CONTENT_MOCK_BLOB_DATA_FORCE, getMockBlobDataForceFlag()) |
| .replace(CONTENT_MOCK_PRODUCT_DATA_FORCE, getMockProductDataForceFlag()) |
| .replace(CONTENT_MOCK_PRODUCT_DATA_PROJECT_NAME, getMockProductDataProjectName()) |
| .replace(CONTENT_MODEL_PROJECT_NAME, getModelProjectName()) |
| .replace(CONTENT_MODEL_SYMBOLIC_NAME, getModelSymbolicName()) |
| .replace(CONTENT_PRODUCT_PROJECT_NAME, getProductProjectName()) |
| .replace(CONTENT_PRODUCT_SYMBLIC_NAME, getProductSymbolicName()) |
| .replace(CONTENT_PRODUCT_PORT_NO, getProductPortNo()) |
| .replace(CONTENT_PRODUCT_URL_PATH, getProductDesktopUrlPath()) |
| .replace(CONTENT_PRODUCT_DESKTOP_URL_PATH, getProductDesktopUrlPath()) |
| .replace(CONTENT_PRODUCT_MOBILE_URL_PATH, getProductMobileUrlPath()) |
| .replace(CONTENT_THEME_SYMBOLIC_BUNDLE_NAME, getThisSymbolicName()) |
| .replace(CONTENT_THEME_SYMBOLIC_NAME, getBasicSymbolicName()) |
| .replace(CONTENT_THEME_PROJECT_NAME, getBasicSymbolicName()) |
| .replace(CONTENT_REQUIRED_PLUGINS, getProductFilePlugins().getRequiredAsString()) |
| .replace(CONTENT_RECOMMENDED_PLUGINS, getProductFilePlugins().getRecommendedAsString()) |
| .replace(CONTENT_REQUIRED_CONFIGURATIONS, getProductFileConfigurations().getRequiredAsString()) |
| .replace(CONTENT_RECOMMENDED_CONFIGURATIONS, getProductFileConfigurations().getRecommendedAsString()) |
| .replace(CONTENT_ENTITY_PROPERTY_BASE_ID, getEntityPropertyBaseID()) |
| .replace(CONTENT_ENTITY_PROPERTY_BASE_UUID, getEntityPropertyBaseUUID()) |
| .replace(CONTENT_PROJECT_LOC, getDefaultProjectLoc()) |
| .replace(CONTENT_BREE_VERSION, ""+bree_version) |
| .replace(CONTENT_XMS_SIZE, ""+xms_size) |
| .replace(CONTENT_XMX_SIZE, ""+xmx_size) |
| // .replace(CONTENT_PERM_SIZE, ""+perm_size) |
| // .replace(CONTENT_MAX_PERMSIZE, ""+max_perm_size) |
| ; |
| if (content.contains(PRE)) { |
| IllegalArgumentException e = new IllegalArgumentException("variable could not be replaced in "+(sourceUrl == null ? "<null>" : sourceUrl.toString())+"\n"+showLinesFound(content, PRE)); |
| LOGGER.error("", e); |
| throw e; |
| } |
| } |
| return content; |
| } |
| |
| /* |
| public String getMetaInfBundleName() { |
| } |
| |
| public String getMetaInfBundleSymbolicName() { |
| } |
| */ |
| |
| public boolean getCopyIfBinaryFile() { |
| boolean retcode = false; |
| if (isBinaryFile(relativePath)) { |
| Gofl.log(this, "getCopyIfBinaryFile() "+relativePath+" binary="+isBinaryFile(relativePath)); |
| startExecute(); |
| try { |
| InputStream fisSourceFile = new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(bundlePath)); |
| byte[] bytes = IOUtils.toByteArray(fisSourceFile); |
| IPath targetPath = Platform.getLocation(); |
| targetPath = targetPath.append(BasicProjectInfo.this.getProjectName()); |
| targetPath = targetPath.append(getGeneratedFilePath()); |
| Files.write(Paths.get(targetPath.toString()), bytes); //creates, overwrites |
| retcode = true; |
| } |
| catch (Exception e) { |
| LOGGER.error("ERROR copy binary '"+sourceUrl.toString()+"' to '"+getGeneratedFilePath()+"' : "+e.getLocalizedMessage(), e); |
| Gofl.log(this, "ERROR copy binary '"+sourceUrl.toString()+"' to '"+getGeneratedFilePath()+"' : "+e.getLocalizedMessage()); |
| } |
| endExecute(); |
| } |
| return retcode; |
| } |
| } |
| |
| private final static String OS_BEE_VENDOR = "Loetz GmbH&Co.KG, 69115 Heidelberg, Germany"; |
| private final static String SAMPLE_VENDER = OS_BEE_VENDOR; // ??? "Sample Corp., Smalltown, Sampleland"; |
| |
| private IProjectMasterTemplate masterTemplate; |
| private String vendor = SAMPLE_VENDER; |
| private TopLevelDomain topLevelDomain = TopLevelDomain.getDefault(); |
| private String companyDomain = "osbp"; |
| private String businessBundle; |
| private String version = "0.0.1"; |
| private Map<String, Locale> languages = ProductConfiguration.getLanguages(); |
| private Map<String, TemplateFile> templateFiles; |
| // private String applicationProductBundle = "org.eclipse.osbp.vaaclipse.charts.demo"; |
| // private String jndiName = "CCNGDEFAULT"; |
| private String dataSourceForAuthentication; //ProductConfiguration.getDataSourceNameForAuthentication(); |
| private String dataSourceForBLOB; //ProductConfiguration.getDataSourceNameForBLOB(); |
| private String dataSourceForBPM; //ProductConfiguration.getDataSourceNameForBPM(); |
| private String dataSourceForBusinessData; //ProductConfiguration.getDataSourceNameForBusinessData(); |
| private MockDataGenerateType mockProductDataGenerateType = MockDataGenerateType.ONCE; |
| private MockDataGenerateType mockAuthenticationDataGenerateType = MockDataGenerateType.ONCE; |
| private MockDataGenerateType mockBlobDataGenerateType = MockDataGenerateType.ONCE; |
| private VaaclipseUiTheme vaaclipseTheme = VaaclipseUiTheme.forText(DEFAULT_THEME_NAME); |
| protected double bree_version = BREE_MINIMUM; |
| private int physical_size = 0; |
| private int xms_size = 4096; |
| private int xmx_size = 4096; |
| // private int perm_size = 64; |
| // private int max_perm_size = 512; |
| |
| public void setTotalPhysicalMemoryInMB(int physicalMemoryMB) { |
| physical_size = physicalMemoryMB; |
| setXmsSizeInMB(physicalMemoryMB / 4); |
| setXmxSizeInMB(physicalMemoryMB / 4); |
| // max_perm_size = physicalMemoryMB / 32; |
| // perm_size = physicalMemoryMB / 8; |
| } |
| |
| public String getXmsSizeInMB() { |
| return ""+xms_size; |
| } |
| |
| public String getXmxSizeInMB() { |
| return ""+xmx_size; |
| } |
| |
| public String setXmsSizeInMB(int size) { |
| int min = physical_size / 64; |
| int max = physical_size / 2; |
| xms_size = Math.min(max, Math.max(min, size)); |
| return getXmsSizeInMB(); |
| } |
| |
| public String setXmxSizeInMB(int size) { |
| int min = physical_size / 64; |
| int max = physical_size / 2; |
| xmx_size = Math.min(max, Math.max(min, size)); |
| return getXmxSizeInMB(); |
| } |
| |
| public String getProductPortNo() { |
| return ""+productPortNo; |
| } |
| |
| public String getMockProductDataProjectName() { |
| return getBasicProjectName(); |
| } |
| |
| public String getMockProductDataForceFlag() { |
| switch (mockProductDataGenerateType) { |
| case EVERYTIME: return "FORCE-"; |
| case NONE: return "NEVER-"; |
| case ONCE: return ""; |
| default: return ""; |
| } |
| } |
| |
| public String getMockAuthenticationDataForceFlag() { |
| switch (mockAuthenticationDataGenerateType) { |
| case EVERYTIME: return "FORCE-"; |
| case NONE: return "NEVER-"; |
| case ONCE: return ""; |
| default: return ""; |
| } |
| } |
| |
| public String getMockBlobDataForceFlag() { |
| switch (mockBlobDataGenerateType) { |
| case EVERYTIME: return "FORCE-"; |
| case NONE: return "NEVER-"; |
| case ONCE: return ""; |
| default: return ""; |
| } |
| } |
| |
| public void setProductPortNo(String productPortNo) { |
| try { |
| this.productPortNo = Integer.parseInt(productPortNo); |
| } |
| catch (NumberFormatException nfe) { |
| this.productPortNo = 0; |
| } |
| if (this.productPortNo <= 0) { |
| this.productPortNo = 8081; |
| } |
| } |
| |
| public String getProductDesktopUrlPath() { |
| return productDesktopUrlPath; |
| } |
| |
| private String generateLink(String url) { |
| return "<a href=\""+url+"\">"+url+"</a>"; |
| } |
| |
| public String getProductLocalDesktopLink() { |
| return generateLink("http://localhost:"+getProductPortNo()+getProductDesktopUrlPath()); |
| } |
| |
| public String getProductMobileUrlPath() { |
| return productDesktopUrlPath+MOBILE_POSTFIX; |
| } |
| |
| public String getProductLocalMobileLink() { |
| return generateLink("http://localhost:"+getProductPortNo()+getProductMobileUrlPath()); |
| } |
| |
| public void setProductDesktopUrlPath(String productDesktopUrlPath) { |
| this.productDesktopUrlPath = productDesktopUrlPath; |
| } |
| |
| private final static String MOBILE_POSTFIX = "mobile"; |
| |
| private int productPortNo = 8081; |
| private String productDesktopUrlPath = "/charts"; |
| |
| private ProductFilePlugins productFilePlugins; |
| private ProductFileConfigurations productFileConfigurations; |
| |
| public String getDatabaseSchemaForBusinessName() { |
| return ProductConfiguration.workspacePrefs().getDataSource(dataSourceForBusinessData).getDefaultSchemaName(); |
| } |
| |
| @Override |
| public String getProjectName() { |
| generateProjectName(); |
| if (isExecuting()) { |
| return getProjectName(super.getProjectName(), bundleType); |
| } |
| else { |
| return super.getProjectName(); |
| } |
| } |
| |
| public String getBasicProjectName() { |
| generateProjectName(); |
| return super.getProjectName(); |
| } |
| |
| public String getModelProjectName() { |
| return getProjectName(BundleType.MODEL); |
| } |
| |
| public String getProductProjectName() { |
| return getProjectName(BundleType.PRODUCT); |
| } |
| |
| public String getThisProjectName() { |
| return getProjectName(bundleType); |
| } |
| |
| private String getProjectName(String projectName, BundleType type) { |
| String retcode = projectName; |
| if (type != null) { |
| retcode += "."+type.toString().toLowerCase(); |
| } |
| retcode += postfix; |
| return retcode; |
| } |
| |
| private String getProjectName(BundleType type) { |
| generateProjectName(); |
| return getProjectName(super.getProjectName(), type); |
| } |
| |
| public String getProjectFilePath() { |
| return getBasicProjectName().replace('.','/'); |
| } |
| |
| public ProductFilePlugins getProductFilePlugins() { |
| return productFilePlugins; |
| } |
| |
| public ProductFileConfigurations getProductFileConfigurations() { |
| return productFileConfigurations; |
| } |
| |
| public String getDefaultProjectLoc() { |
| if (ProductConfiguration.projectWizardUsesAbsoluteLocation() && (projectLocation != null)) { |
| return projectLocation.toOSString().replace("\\", "/"); |
| } |
| return DEFAULT_PROJECT_LOC; |
| } |
| |
| // private Set<EnumDatabaseVendor> getNecessaryDataBaseVendors() { |
| // return ProductConfiguration.getNecessaryDataBaseVendors(ProductConfiguration.getPersistenceUnitNames()); |
| // } |
| |
| public String getEntityPropertyBaseID() { |
| DataSourceConfiguration ds = ProductConfiguration.getDataSource(dataSourceForBusinessData); |
| if (ds != null) { |
| return ds.getDatabaseVendor().getEntityPropertyBaseID(); |
| } |
| return "<unknown>"; |
| } |
| |
| public String getEntityPropertyBaseUUID() { |
| DataSourceConfiguration ds = ProductConfiguration.getDataSource(dataSourceForBusinessData); |
| if (ds != null) { |
| return ds.getDatabaseVendor().getEntityPropertyBaseUUID(); |
| } |
| return "<unknown>"; |
| } |
| |
| public String getBasicSymbolicName() { |
| return BundleUtilities.generateSymbolicNameForPackage(getBasicProjectName()); |
| } |
| |
| public String getModelSymbolicName() { |
| return BundleUtilities.generateSymbolicNameForPackage(getModelProjectName()); |
| } |
| |
| public String getProductSymbolicName() { |
| return BundleUtilities.generateSymbolicNameForPackage(getProductProjectName()); |
| } |
| |
| public String getThisSymbolicName() { |
| return BundleUtilities.generateSymbolicNameForPackage(getThisProjectName()); |
| } |
| |
| public String getBusinessBundleClassName() { |
| return StringUtils.stripAccents(businessBundle.trim().toLowerCase().replace(" ", "").replace("-", "")); |
| } |
| |
| public String getBpmProject() { |
| return getBusinessBundleClassName(); |
| } |
| |
| public String getWizardGeneratedFileComment() { |
| return |
| "/******************************************************************\n"+ |
| " * *\n"+ |
| " * Copyright (C) - "+getCopyrightVendor()+"\n"+ |
| " * *\n"+ |
| " * This source was created by OSBP Softwarefactory Wizard! *\n"+ |
| " * *\n"+ |
| " * OSBP is (C) - "+OS_BEE_VENDOR+" *\n"+ |
| " * *\n"+ |
| " *================================================================*\n"+ |
| " * *\n"+ |
| " * @file $HeadURL$\n"+ |
| " * @version $Revision$\n"+ |
| " * @date $Date$\n"+ |
| " * @author $Author$\n"+ |
| " * *\n"+ |
| " ******************************************************************/\n"+ |
| "\n"; |
| } |
| |
| protected Bundle thisBundle() { |
| return Activator.getInstance().getBundle(); |
| } |
| |
| public Set<String> getProjectPostFixes() { |
| Set<String> projectPostFixes = new HashSet<String>(); |
| Map<String,TemplateFile> map = new HashMap<String,TemplateFile>(); |
| // --- first get all basic templates --- |
| findTemplateFiles(map, null, TEMPLATE_BASE_PATH+BundleType.MODEL.toString()+"/"+BASIC_TEMPLATE+"/"); |
| // --- second overwrite with specific templates --- |
| findTemplateFiles(map, null, TEMPLATE_BASE_PATH+BundleType.MODEL.toString()+"/"+masterTemplate.toString()+"/"); |
| for (TemplateFile templateFile : map.values()) { |
| String postfix = templateFile.relativePath.split("/")[0]; |
| if (!PROJECT_BASIC_NAME.equals(postfix) && postfix.startsWith(PROJECT_PREFIX)) { |
| projectPostFixes.add(postfix.replace(PROJECT_PREFIX, "")); |
| } |
| } |
| return projectPostFixes; |
| } |
| |
| public Collection<TemplateFile> getTemplateFiles() { |
| if (templateFiles == null) { |
| Gofl.log(this, "getTemplateFile()"); |
| templateFiles = new HashMap<String,TemplateFile>(); |
| // --- first get all basic templates --- |
| findTemplateFiles(templateFiles, postfix, TEMPLATE_BASE_PATH+BasicProjectInfo.this.bundleType.toString()+"/"+BASIC_TEMPLATE+"/"); |
| // --- second overwrite with specific templates --- |
| findTemplateFiles(templateFiles, postfix, TEMPLATE_BASE_PATH+BasicProjectInfo.this.bundleType.toString()+"/"+masterTemplate.toString()+"/"); |
| Gofl.log(this, "getTemplateFile() found "+templateFiles.size()+" template files"); |
| } |
| return templateFiles.values(); |
| } |
| |
| private void findTemplateFiles(Map<String,TemplateFile> map, String targetPostFix, String searchPath) { |
| Gofl.log(this, "findTemplateFiles('"+searchPath+"')"); |
| for (String filePath : getWizardTemplateFiles().keySet()) { |
| if (filePath.startsWith(searchPath)) { |
| Gofl.log(this, " - "+filePath); |
| String relativePath = filePath.replace(searchPath, ""); |
| if ((relativePath != null) && !relativePath.isEmpty()) { |
| String checkRelativePath = relativePath.replace(PROJECT_MAIN_PATH, ""); |
| checkRelativePath = checkRelativePath.replace(PROJECT_BASIC_NAME, PROJECT_MAIN_PREFIX+targetPostFix); |
| checkRelativePath = checkRelativePath.replace(PROJECT_MAIN_PREFIX+targetPostFix+"/", ""); |
| boolean generateComment = filePath.endsWith(TEMPLATE_POSTFIX_EXTENSION); |
| TemplateFile templateFile = new TemplateFile(filePath, relativePath, getWizardTemplateFiles().get(filePath), generateComment); |
| if ((targetPostFix != null) && checkRelativePath.startsWith(PROJECT_SUB_PREFIX)) { |
| Gofl.log(this, " "+filePath+" / "+relativePath+" "+generateComment+" ignore because wrong sub project type '"+postfix+"'"); |
| map.remove(relativePath); |
| } |
| else if (templateFile.isDirectory()) { |
| Gofl.log(this, " "+filePath+" / "+relativePath+" "+generateComment+" templateFile is a directory"); |
| map.put(relativePath, templateFile); |
| } |
| else { |
| Gofl.log(this, " "+filePath+" / "+relativePath+" "+generateComment+" templateFile is a file"); |
| try { |
| if (templateFile.isNotEmpty()) { |
| map.put(relativePath, templateFile); |
| } |
| else { |
| map.remove(relativePath); |
| } |
| } |
| catch (Exception e) { |
| map.remove(relativePath); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| /** |
| * use setFirstLevelDomain(), setSecondLevelDomain() and setBusinessBundle() instead! |
| */ |
| @Override |
| @Deprecated |
| public final void setProjectName(String projectName) { |
| } |
| |
| /** |
| * <b>important! do not use underscore!</b> |
| * @see org.eclipse.osbp.xtext.reportdsl.jvmmodel.Constants#ODA_PROP_CONFIG_KEY_SEPARATOR |
| */ |
| public static final String REPLACING = ""; |
| |
| /** |
| * @param topLevelDomain |
| * @param companyDomain |
| * @param businessBundle |
| * @return |
| */ |
| public String createProjectName(String topLevelDomain, String companyDomain, String businessBundle) { |
| return StringUtils.stripAccents(topLevelDomain.trim().toLowerCase().replace(" ", REPLACING).replace("-", REPLACING)) |
| +"."+StringUtils.stripAccents(companyDomain.trim().toLowerCase().replace(" ", REPLACING).replace("-", REPLACING)) |
| +"."+StringUtils.stripAccents(businessBundle.trim().toLowerCase().replace(" ", REPLACING).replace("-", REPLACING)); |
| } |
| |
| protected void generateProjectName() { |
| super.setProjectName(createProjectName(topLevelDomain.getTopLevelDomain(), companyDomain, businessBundle)); |
| // setApplicationProductBundle(super.getProjectName()); |
| } |
| |
| public MockDataGenerateType getMockProductDataGenerateType() { |
| return mockProductDataGenerateType; |
| } |
| |
| public void setMockProductDataGenerateType(String item) { |
| setMockProductDataGenerateType(MockDataGenerateType.byText(item)); |
| } |
| |
| public void setMockProductDataGenerateType(MockDataGenerateType type) { |
| this.mockProductDataGenerateType = type; |
| } |
| |
| public MockDataGenerateType getMockAuthenticationDataGenerateType() { |
| return mockAuthenticationDataGenerateType; |
| } |
| |
| public void setMockAuthenticationDataGenerateType(String item) { |
| setMockAuthenticationDataGenerateType(MockDataGenerateType.byText(item)); |
| } |
| |
| public void setMockAuthenticationDataGenerateType(MockDataGenerateType type) { |
| this.mockAuthenticationDataGenerateType = type; |
| } |
| |
| public MockDataGenerateType getMockBlobDataGenerateType() { |
| return mockBlobDataGenerateType; |
| } |
| |
| public void setMockBlobDataGenerateType(String item) { |
| setMockBlobDataGenerateType(MockDataGenerateType.byText(item)); |
| } |
| |
| public void setMockBlobDataGenerateType(MockDataGenerateType type) { |
| this.mockBlobDataGenerateType = type; |
| } |
| |
| public IProjectMasterTemplate getMasterTemplate() { |
| return masterTemplate; |
| } |
| |
| public void setMasterTemplate(String item) { |
| setMasterTemplate(AllInOneDSLsProjectMasterTemplate.byText(item)); |
| } |
| |
| public void setMasterTemplate(IProjectMasterTemplate masterTemplate) { |
| this.masterTemplate = masterTemplate; |
| if (wizardType == CommonProjectWizardType.AllInOneDSLs) { |
| setBusinessBundle(masterTemplate.getDescription() |
| .replace(" project", "") |
| .replace(" Project", "")); |
| } |
| } |
| |
| public String getCopyrightVendor() { |
| return OS_BEE_VENDOR; |
| } |
| |
| public String getVendor() { |
| return vendor; |
| } |
| |
| public void setVendor(String vendor) { |
| this.vendor = vendor; |
| } |
| |
| public TopLevelDomain getTopLevelDomain() { |
| return topLevelDomain; |
| } |
| |
| public void setTopLevelDomain(String topLevelDomain) { |
| setTopLevelDomain(TopLevelDomain.forTopLevelDomain(topLevelDomain)); |
| } |
| |
| public void setTopLevelDomain(TopLevelDomain topLevelDomain) { |
| this.topLevelDomain = topLevelDomain; |
| generateProjectName(); |
| } |
| |
| public String getCompanyDomain() { |
| return companyDomain; |
| } |
| |
| public void setCompanyDomain(String companyDomain) { |
| this.companyDomain = companyDomain; |
| generateProjectName(); |
| } |
| |
| public String getBusinessBundle() { |
| return businessBundle; |
| } |
| |
| public void setBusinessBundle(String businessBundle) { |
| this.businessBundle = businessBundle; |
| generateProjectName(); |
| productDesktopUrlPath = "/"+getBusinessBundleClassName(); |
| } |
| |
| public String getVersion() { |
| return version; |
| } |
| |
| public void setVersion(String version) { |
| this.version = version; |
| } |
| |
| public Map<String, Locale> getLanguages() { |
| return languages; |
| } |
| |
| public void setLanguages(Map<String, Locale> languages) { |
| this.languages = languages; |
| } |
| |
| public String getDataSourceForAuthentication() { |
| return dataSourceForAuthentication; |
| } |
| |
| public String getDataSourceForBLOB() { |
| return dataSourceForBLOB; |
| } |
| |
| public String getDataSourceForBPM() { |
| return dataSourceForBPM; |
| } |
| |
| public String getDataSourceForBusinessData() { |
| return dataSourceForBusinessData; |
| } |
| |
| public void setDataSourceForAuthentication(String dataSource) { |
| this.dataSourceForAuthentication = dataSource; |
| } |
| |
| public void setDataSourceForBLOB(String dataSource) { |
| this.dataSourceForBLOB = dataSource; |
| } |
| |
| public void setDataSourceForBPM(String dataSource) { |
| this.dataSourceForBPM = dataSource; |
| } |
| |
| public void setDataSourceForBusinessData(String dataSource) { |
| this.dataSourceForBusinessData = dataSource; |
| } |
| |
| // private static final String UNDERSCORE = "_"; |
| |
| // public String getProjectPath() { |
| // return getProjectName().replace('.', '/'); |
| // } |
| |
| // public String getSymbolicBundleName() { |
| //// String bundleName = StringUtils.stripAccents(topLevelDomain.getTopLevelDomain().replace(" ", UNDERSCORE).replace("-", UNDERSCORE)) |
| //// +UNDERSCORE+StringUtils.stripAccents(companyDomain.trim().toLowerCase().replace(" ", UNDERSCORE).replace("-", UNDERSCORE)) |
| //// +UNDERSCORE+StringUtils.stripAccents(businessBundle.trim().toLowerCase().replace(" ", UNDERSCORE).replace("-", UNDERSCORE)); |
| //// while (bundleName.contains(UNDERSCORE+UNDERSCORE)) { |
| //// bundleName = bundleName.replace(UNDERSCORE+UNDERSCORE, UNDERSCORE); |
| //// } |
| // String bundleName = getProjectName(); |
| // return Utilities.getSymbolicName(bundleName); |
| // } |
| |
| public VaaclipseUiTheme getVaaclipseTheme() { |
| return vaaclipseTheme; |
| } |
| |
| public void setVaaclipseTheme(String vaaclipseTheme) { |
| setVaaclipseTheme(VaaclipseUiTheme.forText(vaaclipseTheme)); |
| } |
| |
| public void setVaaclipseTheme(VaaclipseUiTheme vaaclipseTheme) { |
| this.vaaclipseTheme = vaaclipseTheme; |
| } |
| |
| private int isExecuting = 0; |
| |
| private boolean isExecuting() { |
| return isExecuting > 0; |
| } |
| |
| public void startExecute() { |
| isExecuting++; |
| } |
| |
| public void endExecute() { |
| isExecuting--; |
| } |
| |
| public void setProjectLocation(IPath projectLocation) { |
| this.projectLocation = projectLocation; |
| } |
| |
| public void setProjectPostFix(String postfix) { |
| this.postfix = postfix; |
| } |
| |
| public String getManifestTemplate(ManifestAttribute manifestAttribute) { |
| String result = ""; |
| for (TemplateFile templateFile : getTemplateFiles()) { |
| if (templateFile.getGeneratedFilePath().contains(MANIFEST_MF_ADDONS)) { |
| try { |
| String[] content = templateFile.getOriginalFileContent().split("\n"); |
| boolean inside = false; |
| for (String line : content) { |
| if (inside) { |
| if (!line.isEmpty() && !line.startsWith("#")) { |
| if (line.charAt(0) == ' ') { |
| result += ","+line.trim(); |
| } |
| else { |
| inside = false; |
| break; |
| } |
| } |
| } |
| else { |
| inside = line.startsWith(manifestAttribute.name()); |
| } |
| } |
| } |
| catch (Exception e) { |
| e.printStackTrace(); |
| } |
| break; |
| } |
| } |
| return result; |
| } |
| } |