本文整理汇总了Java中com.intellij.util.text.VersionComparatorUtil.compare方法的典型用法代码示例。如果您正苦于以下问题:Java VersionComparatorUtil.compare方法的具体用法?Java VersionComparatorUtil.compare怎么用?Java VersionComparatorUtil.compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.text.VersionComparatorUtil
的用法示例。
在下文中一共展示了VersionComparatorUtil.compare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isIpythonNewFormat
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
public static boolean isIpythonNewFormat(@NotNull final VirtualFile virtualFile) {
final Project project = ProjectUtil.guessProjectForFile(virtualFile);
if (project != null) {
final Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(virtualFile);
if (module != null) {
final Sdk sdk = PythonSdkType.findPythonSdk(module);
if (sdk != null) {
try {
final PyPackage ipython = PyPackageManager.getInstance(sdk).findPackage("ipython", true);
if (ipython != null && VersionComparatorUtil.compare(ipython.getVersion(), "3.0") <= 0) {
return false;
}
}
catch (ExecutionException ignored) {
}
}
}
}
return true;
}
示例2: selectVersion
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
@Nullable
private String selectVersion(@NotNull ExternalLibraryDescriptor descriptor) {
Set<String> versions = myIndicesManager.getVersions(descriptor.getLibraryGroupId(), descriptor.getLibraryArtifactId());
List<String> suitableVersions = new ArrayList<String>();
String minVersion = descriptor.getMinVersion();
String maxVersion = descriptor.getMaxVersion();
for (String version : versions) {
if ((minVersion == null || VersionComparatorUtil.compare(minVersion, version) <= 0)
&& (maxVersion == null || VersionComparatorUtil.compare(version, maxVersion) < 0)) {
suitableVersions.add(version);
}
}
if (suitableVersions.isEmpty()) {
return null;
}
return Collections.max(suitableVersions, VersionComparatorUtil.COMPARATOR);
}
示例3: process
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
@Override
public void process(MavenModifiableModelsProvider mavenModifiableModelsProvider,
Module module,
MavenRootModelAdapter mavenRootModelAdapter,
MavenProjectsTree mavenProjectsTree,
MavenProject mavenProject,
MavenProjectChanges mavenProjectChanges,
Map<MavenProject, String> map,
List<MavenProjectsProcessorTask> list)
{
GoogleGuiceMutableModuleExtension extension = (GoogleGuiceMutableModuleExtension) enableModuleExtension(module, mavenModifiableModelsProvider, GoogleGuiceModuleExtension.class);
List<MavenArtifact> artifactList = mavenProject.findDependencies("com.google.inject", "guice");
for(MavenArtifact mavenArtifact : artifactList)
{
String version = mavenArtifact.getVersion();
if(VersionComparatorUtil.compare(version, "3.0") >= 0)
{
extension.setUseJSR330(true);
}
}
}
示例4: tryOldAPI
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
private static boolean tryOldAPI(Project project) {
String settingName = "Configure Kotlin: info notification";
NotificationsConfiguration.getNotificationsConfiguration().changeSettings(settingName,
NotificationDisplayType.NONE, true, false);
KotlinProjectConfigurator configuratorByName = ConfigureKotlinInProjectUtilsKt.getConfiguratorByName("java");
if (configuratorByName == null) {
LOG.info("Failed to find configurator");
return false;
}
Class<?> confClass = configuratorByName.getClass();
while (confClass != KotlinWithLibraryConfigurator.class) {
confClass = confClass.getSuperclass();
}
String lib = FileUIUtils.createRelativePath(project, project.getBaseDir(), "lib");
//collector arg was added in Kotlin plugin 1.0.1
IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("org.jetbrains.kotlin"));
if (plugin == null) {
return false;
}
if (VersionComparatorUtil.compare(plugin.getVersion(), "1.0.1") > 0) {
if (configureWithCollector(project, confClass, configuratorByName, lib)) {
return true;
}
} else {
if (!configureWithoutCollector(project, confClass, configuratorByName, lib)) {
configuratorByName.configure(project, Collections.emptyList());
}
}
NotificationsConfiguration.getNotificationsConfiguration().changeSettings(settingName,
NotificationDisplayType.STICKY_BALLOON, true, false);
return true;
}
示例5: findLatestVersion
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
@NotNull
private static Sdk findLatestVersion(@NotNull Sdk mainSdk, @NotNull Set<Sdk> sdks) {
Sdk result = mainSdk;
for (Sdk sdk : sdks) {
if (VersionComparatorUtil.compare(result.getVersionString(), sdk.getVersionString()) < 0) {
result = sdk;
}
}
return result;
}
示例6: checkVersion
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
private void checkVersion() throws Exception {
HttpMethod method = doREST("/rest/workflow/version", false);
try {
InputStream stream = method.getResponseBodyAsStream();
Element element = new SAXBuilder(false).build(stream).getRootElement();
final boolean timeTrackingAvailable = element.getName().equals("version") && VersionComparatorUtil.compare(element.getChildText("version"), "4.1") >= 0;
if (!timeTrackingAvailable) {
throw new Exception("This version of Youtrack the time tracking is not supported");
}
}
finally {
method.releaseConnection();
}
}
示例7: checkAllProjectsAvailable
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
private boolean checkAllProjectsAvailable(MantisConnectPortType soap) throws Exception {
// Check whether All Projects is available supported by server
try {
String version = soap.mc_version();
boolean available = !DEBUG_ALL_PROJECTS && VersionComparatorUtil.compare(version, "1.2.9") >= 0;
if (!available) {
LOG.info("Using Mantis version without 'All Projects' support: " + version);
}
return available;
}
catch (Exception e) {
throw handleException(e);
}
}
示例8: actionPerformed
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Properties updatesInfo = new Properties();
InputStream infoStream = null;
String url = R2MConstants.PUBLIC_VERSION_URL;
try {
infoStream = URLHelper.loadUrl(url);
updatesInfo.load(infoStream);
} catch (Exception ex) {
UIHelper.showErrorMessage("Couldn't access version URL: " + R2MConstants.PUBLIC_VERSION_URL);
Logger.error(CheckUpdatesAction.class, ex.getMessage());
return;
} finally {
if (infoStream != null) {
try {
infoStream.close();
} catch (IOException e1) {
// ignore
}
}
}
String latestVersion = updatesInfo.getProperty(R2MConstants.LATEST_VERSION_KEY);
String installedVersion = getInstalledVersion();
Project project = e.getData(CommonDataKeys.PROJECT);
if (VersionComparatorUtil.compare(installedVersion, latestVersion) >= 0) {
showNoUpdateDialog(project, installedVersion, updatesInfo);
return;
}
showUpdatesAvailableDialog(project, installedVersion, updatesInfo);
}
示例9: checkVersion
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
private void checkVersion() throws Exception {
HttpMethod method = doREST("/rest/workflow/version", false);
InputStream stream = method.getResponseBodyAsStream();
Element element = new SAXBuilder(false).build(stream).getRootElement();
final boolean timeTrackingAvailable = element.getName().equals("version") && VersionComparatorUtil.compare(element.getChildText("version"), "4.1") >= 0;
if (!timeTrackingAvailable) {
throw new Exception("This version of Youtrack the time tracking is not supported");
}
}
示例10: findLatestVersion
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
private Sdk findLatestVersion(@NotNull Sdk mainSdk, @NotNull Set<Sdk> sdks) {
Sdk result = mainSdk;
for (Sdk sdk : sdks) {
if (VersionComparatorUtil.compare(result.getVersionString(), sdk.getVersionString()) < 0) {
result = sdk;
}
}
return result;
}
示例11: findLatestVersion
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
@NotNull
private static Sdk findLatestVersion(@NotNull Sdk mainSdk, @NotNull Set<Sdk> sdks)
{
Sdk result = mainSdk;
for(Sdk sdk : sdks)
{
if(VersionComparatorUtil.compare(result.getVersionString(), sdk.getVersionString()) < 0)
{
result = sdk;
}
}
return result;
}
示例12: compareVersion
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
/**
* Examples: 1.0rc1 < 1.0release, 1.0 < 1.0.1, 1.1 > 1.02
*
* @return 0 if cms version equals given version, positive value if cms version > given version, negative value if cms version < given version
*/
public static Integer compareVersion(@NotNull Project project, String version) {
String typo3Version = getTYPO3Version(project);
return VersionComparatorUtil.compare(typo3Version, version);
}
示例13: compareMajorMinorVersion
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
/**
* Examples: 1.0rc1 < 1.0release, 1.0 < 1.0.1, 1.1 > 1.02
*
* @return 0 if cms version equals given version, positive value if cms version > given version, negative value if cms version < given version
*/
public static Integer compareMajorMinorVersion(@NotNull Project project, String version) {
String typo3Version = getTYPO3Branch(project);
return VersionComparatorUtil.compare(typo3Version, version);
}
示例14: comparePluginVersions
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
public static int comparePluginVersions(String newPluginVersion, String oldPluginVersion) {
return VersionComparatorUtil.compare(newPluginVersion, oldPluginVersion);
}
示例15: compareTo
import com.intellij.util.text.VersionComparatorUtil; //导入方法依赖的package包/类
@Override
public int compareTo(@NotNull JiraVersion o) {
return VersionComparatorUtil.compare(toString(), o.toString());
}