Merge remote-tracking branch 'origin/master' into jzhang/TUP-31920
This commit is contained in:
@@ -205,6 +205,17 @@ public class VersionUtils {
|
||||
return talendVersion;
|
||||
}
|
||||
|
||||
public static String getTalendVersionStr() {
|
||||
org.osgi.framework.Version studioVersion = new org.osgi.framework.Version(getTalendVersion());
|
||||
StringBuffer result = new StringBuffer();
|
||||
result.append(studioVersion.getMajor());
|
||||
result.append('.');
|
||||
result.append(studioVersion.getMinor());
|
||||
result.append('.');
|
||||
result.append(studioVersion.getMicro());
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String getProductVersionWithoutBranding(String fullProductVersion) {
|
||||
String[] splitStr = fullProductVersion.split("-"); //$NON-NLS-1$
|
||||
Pattern pattern = Pattern.compile("((\\d+\\.){2}\\d.*)"); //$NON-NLS-1$
|
||||
|
||||
@@ -12,19 +12,15 @@
|
||||
// ============================================================================
|
||||
package org.talend.core;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.service.IStudioLiteP2Service;
|
||||
|
||||
/**
|
||||
* This class can check whether some specific plugins are loaded or not. <br/>
|
||||
@@ -142,6 +138,13 @@ public class PluginChecker {
|
||||
|
||||
public static final String SWTBOT_PLUGIN_ID = "org.eclipse.swtbot.eclipse.core"; //$NON-NLS-1$
|
||||
|
||||
public static final String PROD_LITE = "org.talend.rcp.branding.lite.product";
|
||||
|
||||
/**
|
||||
* Currently only used by CI, since CI is installed by p2Installer, it will use the cmd product
|
||||
*/
|
||||
public static final String PROD_LITE_CI = "org.talend.rcp.branding.lite.ci.product";
|
||||
|
||||
private static Boolean isStudioLite;
|
||||
|
||||
/**
|
||||
@@ -165,12 +168,10 @@ public class PluginChecker {
|
||||
public static boolean isStudioLite() {
|
||||
if (isStudioLite == null) {
|
||||
try {
|
||||
File studioConfigFile = VersionUtils.getStudioConfigFile();
|
||||
Properties props = new Properties();
|
||||
try (BufferedReader reader = Files.newBufferedReader(studioConfigFile.toPath())) {
|
||||
props.load(reader);
|
||||
}
|
||||
isStudioLite = Boolean.valueOf(props.getProperty("talend.studio.lite"));
|
||||
// IProduct product = Platform.getProduct();
|
||||
// String prodId = product.getId();
|
||||
// isStudioLite = StringUtils.equals(prodId, PROD_LITE) || StringUtils.equals(prodId, PROD_LITE_CI);
|
||||
isStudioLite = IStudioLiteP2Service.get() != null;
|
||||
} catch (Exception e) {
|
||||
isStudioLite = false;
|
||||
ExceptionHandler.process(e);
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.general.Project;
|
||||
@@ -87,14 +86,9 @@ public interface IStudioLiteP2Service extends IService {
|
||||
|
||||
int adaptFeaturesForProject(IProgressMonitor monitor, Project proj) throws Exception;
|
||||
|
||||
void setLocalPatches(Collection<String> localPatchUris) throws Exception;
|
||||
|
||||
public static IStudioLiteP2Service get() {
|
||||
boolean forceLoad = Boolean.getBoolean("talend.studio.studiolite.p2.enable");
|
||||
if (!forceLoad) {
|
||||
if (CommonsPlugin.isHeadless() || CommonsPlugin.isJUnitTest() || CommonsPlugin.isTUJTest()
|
||||
|| CommonsPlugin.isScriptCmdlineMode()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IStudioLiteP2Service.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(IStudioLiteP2Service.class);
|
||||
}
|
||||
@@ -154,9 +148,9 @@ public interface IStudioLiteP2Service extends IService {
|
||||
|
||||
void setRelease(IProgressMonitor monitor, URI uri) throws Exception;
|
||||
|
||||
URI getUpdate(IProgressMonitor monitor) throws Exception;
|
||||
Collection<URI> getUpdates(IProgressMonitor monitor) throws Exception;
|
||||
|
||||
void setUpdate(IProgressMonitor monitor, URI uri) throws Exception;
|
||||
void setUpdates(IProgressMonitor monitor, Collection<URI> uris) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public class ModulesNeededProvider {
|
||||
|
||||
private static IRepositoryService repositoryService = null;
|
||||
|
||||
private static List<ModuleNeeded> importNeedsListForRoutes;
|
||||
private static List<ModuleNeeded> importNeedsListForRoutes = new ArrayList<ModuleNeeded>();;
|
||||
|
||||
private static List<ModuleNeeded> importNeedsListForBeans;
|
||||
|
||||
@@ -686,7 +686,7 @@ public class ModulesNeededProvider {
|
||||
}
|
||||
service = (ILibrariesService) GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
|
||||
|
||||
if (importNeedsListForRoutes == null) {
|
||||
if (importNeedsListForRoutes.isEmpty()) {
|
||||
|
||||
importNeedsListForRoutes = new ArrayList<ModuleNeeded>();
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.List;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
@@ -38,14 +37,9 @@ public class DynamicContentProviderGeneric extends DynamicContentProvider {
|
||||
@Override
|
||||
public void createContent(String id, Element parent) {
|
||||
String dBranding = "default";
|
||||
String branding = null;
|
||||
if (PluginChecker.isStudioLite()) {
|
||||
branding = "LITE";
|
||||
} else {
|
||||
branding = System.getProperty("talend.license.branding");
|
||||
if (branding == null || "".equals(branding)) {
|
||||
branding = dBranding;
|
||||
}
|
||||
String branding = System.getProperty("talend.license.branding");
|
||||
if (branding == null || "".equals(branding)) {
|
||||
branding = dBranding;
|
||||
}
|
||||
Document dom = parent.getOwnerDocument();
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.updates.runtime.engine.P2Manager;
|
||||
import org.talend.updates.runtime.feature.model.Category;
|
||||
import org.talend.updates.runtime.feature.model.Type;
|
||||
@@ -73,9 +74,9 @@ import org.talend.updates.runtime.service.ITaCoKitUpdateService;
|
||||
import org.talend.updates.runtime.service.ITaCoKitUpdateService.ICarInstallationResult;
|
||||
import org.talend.updates.runtime.storage.AbstractFeatureStorage;
|
||||
import org.talend.updates.runtime.storage.IFeatureStorage;
|
||||
import org.talend.updates.runtime.utils.UpdateTools;
|
||||
import org.talend.updates.runtime.utils.PathUtils;
|
||||
import org.talend.updates.runtime.utils.TaCoKitCarUtils;
|
||||
import org.talend.updates.runtime.utils.UpdateTools;
|
||||
import org.talend.utils.files.FileUtils;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
import org.talend.utils.json.JSONException;
|
||||
@@ -259,7 +260,7 @@ public class P2ExtraFeature extends AbstractExtraFeature implements IP2Feature {
|
||||
if (!isTOS && p2RepoUrlFromProp != null) {
|
||||
uriString = p2RepoUrlFromProp;
|
||||
} else {
|
||||
String version = PathUtils.getTalendVersionStr();
|
||||
String version = VersionUtils.getTalendVersionStr();
|
||||
if (uriString == null) {
|
||||
return URI.create(version);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
@@ -42,6 +41,7 @@ import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.commons.utils.resource.FileExtensions;
|
||||
import org.talend.commons.utils.resource.UpdatesHelper;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
@@ -117,8 +117,8 @@ public class ComponentIndexManager {
|
||||
if (componentNodes == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
for (Iterator iter = componentNodes.iterator(); iter.hasNext();) {
|
||||
Element element = (Element) iter.next();
|
||||
for (Object componentNode : componentNodes) {
|
||||
Element element = (Element) componentNode;
|
||||
|
||||
ComponentIndexBean indexBean = new ComponentIndexBean();
|
||||
// try {
|
||||
@@ -487,7 +487,7 @@ public class ComponentIndexManager {
|
||||
MavenArtifact artifact = new MavenArtifact();
|
||||
artifact.setGroupId(COMPONENT_GROUP_ID);
|
||||
artifact.setArtifactId(INDEX);
|
||||
String version = PathUtils.getTalendVersionStr();
|
||||
String version = VersionUtils.getTalendVersionStr();
|
||||
if (!version.endsWith(SNAPSHOT_SUFFIX)) {
|
||||
version = version + SNAPSHOT_SUFFIX;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.eclipse.equinox.p2.metadata.Version;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.runtime.service.ComponentsInstallComponent;
|
||||
import org.talend.commons.runtime.service.PatchComponent;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.commons.utils.resource.FileExtensions;
|
||||
import org.talend.updates.runtime.feature.model.Category;
|
||||
import org.talend.updates.runtime.feature.model.Type;
|
||||
@@ -157,19 +156,6 @@ public class PathUtils {
|
||||
return new File(URI.create(filePath).toURL().getFile());
|
||||
}
|
||||
|
||||
public static String getTalendVersionStr() {
|
||||
org.osgi.framework.Version studioVersion = new org.osgi.framework.Version(VersionUtils.getTalendVersion());
|
||||
|
||||
StringBuffer result = new StringBuffer();
|
||||
result.append(studioVersion.getMajor());
|
||||
result.append('.');
|
||||
result.append(studioVersion.getMinor());
|
||||
result.append('.');
|
||||
result.append(studioVersion.getMicro());
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static Collection<Type> getAllTypeCategories(Collection<Type> types) {
|
||||
Collection<Type> allTypeCategories = new HashSet<>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user