mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
new build in active channel
This commit is contained in:
@@ -209,7 +209,7 @@ public class IdeaApplication {
|
||||
|
||||
final List<PluginDownloader> updatedPlugins = UpdateChecker.updatePlugins(false, null);
|
||||
if (checkForUpdateResult.hasNewBuildInSelectedChannel()) {
|
||||
UpdateChecker.showUpdateInfoDialog(true, checkForUpdateResult.getSelected(), updatedPlugins);
|
||||
UpdateChecker.showUpdateInfoDialog(true, checkForUpdateResult.getUpdatedChannel(), updatedPlugins);
|
||||
}
|
||||
else if (updatedPlugins != null) {
|
||||
UpdateChecker.showNoUpdatesDialog(true, updatedPlugins, showConfirmation);
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class CheckForUpdateAction extends AnAction implements DumbAware {
|
||||
if (result.hasNewBuildInSelectedChannel()) {
|
||||
//information about new channel could be there
|
||||
UpdateSettings.getInstance().LAST_TIME_CHECKED = System.currentTimeMillis();
|
||||
UpdateChecker.showUpdateInfoDialog(enableLink, result.getSelected(), updatedPlugins);
|
||||
UpdateChecker.showUpdateInfoDialog(enableLink, result.getUpdatedChannel(), updatedPlugins);
|
||||
}else{
|
||||
//information about new channel could be there
|
||||
UpdateChecker.showNoUpdatesDialog(enableLink, updatedPlugins, true);
|
||||
|
||||
+7
-7
@@ -23,8 +23,8 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class CheckForUpdateResult {
|
||||
@NotNull
|
||||
private final UpdateChannel selected;
|
||||
@Nullable
|
||||
private final UpdateChannel myUpdatedChannel;
|
||||
|
||||
@Nullable
|
||||
private final BuildInfo newBuildInSelectedChannel;
|
||||
@@ -44,12 +44,12 @@ public class CheckForUpdateResult {
|
||||
private final Exception error;
|
||||
|
||||
|
||||
public CheckForUpdateResult(@NotNull UpdateChannel selected,
|
||||
public CheckForUpdateResult(@Nullable UpdateChannel updated,
|
||||
@Nullable BuildInfo newBuildInSelectedChannel,
|
||||
@Nullable Collection<UpdateChannel> newChannels, List<String> allChannelsIds,
|
||||
@Nullable UpdateChannel channelToPropose) {
|
||||
this.newBuildInSelectedChannel = newBuildInSelectedChannel;
|
||||
this.selected = selected;
|
||||
myUpdatedChannel = updated;
|
||||
this.newChannels = newChannels;
|
||||
this.allChannelsIds = allChannelsIds;
|
||||
this.newChannelToPropose = channelToPropose;
|
||||
@@ -62,7 +62,7 @@ public class CheckForUpdateResult {
|
||||
this.newChannels = null;
|
||||
this.allChannelsIds = null;
|
||||
this.newChannelToPropose = null;
|
||||
this.selected = null;
|
||||
this.myUpdatedChannel = null;
|
||||
this.state = state;
|
||||
this.error = e;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public class CheckForUpdateResult {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public UpdateChannel getSelected() {
|
||||
return selected;
|
||||
public UpdateChannel getUpdatedChannel() {
|
||||
return myUpdatedChannel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,4 +82,8 @@ public class UpdateChannel {
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public ChannelStatus getStatus() {
|
||||
return myStatus;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -112,6 +112,7 @@ public class UpdateSettings implements PersistentStateComponent<Element>, UserUp
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ChannelStatus getSelectedChannelStatus() {
|
||||
return ChannelStatus.fromCode(UPDATE_CHANNEL_TYPE);
|
||||
|
||||
+36
-13
@@ -32,28 +32,41 @@ public class UpdateStrategy {
|
||||
|
||||
private UserUpdateSettings updateSettings;
|
||||
private int myMajorVersion;
|
||||
private BuildNumber ourBuild;
|
||||
private BuildNumber myCurrentBuild;
|
||||
|
||||
private ChannelStatus myChannelStatus;
|
||||
private UpdatesInfo updatesInfo;
|
||||
private UpdatesInfo myUpdatesInfo;
|
||||
|
||||
|
||||
public UpdateStrategy(int majorVersion, @NotNull BuildNumber currentBuild, @NotNull UpdatesInfo updatesInfo,
|
||||
@NotNull UserUpdateSettings updateSettings) {
|
||||
myMajorVersion = majorVersion;
|
||||
this.updatesInfo = updatesInfo;
|
||||
myUpdatesInfo = updatesInfo;
|
||||
this.updateSettings = updateSettings;
|
||||
this.ourBuild = currentBuild;
|
||||
this.myCurrentBuild = currentBuild;
|
||||
myChannelStatus = updateSettings.getSelectedChannelStatus();
|
||||
}
|
||||
|
||||
public final CheckForUpdateResult checkForUpdates() {
|
||||
final Product product = updatesInfo.getProduct(ourBuild.getProductCode());
|
||||
final Product product = myUpdatesInfo.getProduct(myCurrentBuild.getProductCode());
|
||||
|
||||
if (product.getChannels().isEmpty()) {
|
||||
if (product == null || product.getChannels().isEmpty()) {
|
||||
return new CheckForUpdateResult(State.NOTHING_LOADED);
|
||||
}
|
||||
|
||||
UpdateChannel updatedChannel = null;
|
||||
BuildInfo newBuild = null;
|
||||
List<UpdateChannel> activeChannels = getActiveChannels(product);
|
||||
for (UpdateChannel channel : activeChannels) {
|
||||
if (hasNewVersion(channel)) {
|
||||
updatedChannel = channel;
|
||||
newBuild = updatedChannel.getLatestBuild();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new CheckForUpdateResult(updatedChannel, newBuild, null, Collections.<String>emptyList(), null);
|
||||
|
||||
/*
|
||||
boolean replacedWithAppDef = false;
|
||||
|
||||
@@ -79,7 +92,17 @@ public class UpdateStrategy {
|
||||
newChannels.getFirst(), getFilteredKnownChannels(product),
|
||||
newChannels.getSecond());
|
||||
*/
|
||||
return new CheckForUpdateResult(State.NOTHING_LOADED);
|
||||
}
|
||||
|
||||
private List<UpdateChannel> getActiveChannels(Product product) {
|
||||
List<UpdateChannel> channels = product.getChannels();
|
||||
List<UpdateChannel> result = new ArrayList<UpdateChannel>();
|
||||
for (UpdateChannel channel : channels) {
|
||||
if (channel.getMajorVersion() == myMajorVersion && channel.getStatus().compareTo(myChannelStatus) >= 0) {
|
||||
result.add(channel);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -93,11 +116,11 @@ public class UpdateStrategy {
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isChannelIsOlderThenBuild(@NotNull UpdateChannel channel) {
|
||||
private boolean hasNewVersion(@NotNull UpdateChannel channel) {
|
||||
if (channel.getLatestBuild() == null || channel.getLatestBuild().getNumber() == null) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return ourBuild.compareTo(channel.getLatestBuild().getNumber()) >= 0;
|
||||
return myCurrentBuild.compareTo(channel.getLatestBuild().getNumber()) < 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -117,7 +140,7 @@ public class UpdateStrategy {
|
||||
@Nullable
|
||||
private BuildInfo getNewVersionInSelectedChannel(@NotNull UpdateChannel channel) {
|
||||
final BuildInfo latestBuild = channel.getLatestBuild();
|
||||
if (ourBuild.compareTo(latestBuild.getNumber()) < 0) {
|
||||
if (myCurrentBuild.compareTo(latestBuild.getNumber()) < 0) {
|
||||
return latestBuild;
|
||||
}
|
||||
return null;
|
||||
@@ -153,10 +176,10 @@ public class UpdateStrategy {
|
||||
|
||||
|
||||
private boolean isInteresting(UpdateChannel channel) {
|
||||
return ourBuild.getBaselineVersion() <= channel.getLatestBuild().getNumber().getBaselineVersion();
|
||||
return myCurrentBuild.getBaselineVersion() <= channel.getLatestBuild().getNumber().getBaselineVersion();
|
||||
}
|
||||
|
||||
private boolean isNewer(UpdateChannel channel) {
|
||||
return channel.getLatestBuild().getNumber().getBaselineVersion() > ourBuild.getBaselineVersion();
|
||||
return channel.getLatestBuild().getNumber().getBaselineVersion() > myCurrentBuild.getBaselineVersion();
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -32,5 +32,6 @@ public interface UserUpdateSettings {
|
||||
|
||||
void setKnownChannelIds(List<String> ids);
|
||||
|
||||
@NotNull
|
||||
ChannelStatus getSelectedChannelStatus();
|
||||
}
|
||||
|
||||
@@ -28,9 +28,6 @@ public class TestUpdateSettings implements UserUpdateSettings {
|
||||
private boolean disabled;
|
||||
private List<String> knowsChannels;
|
||||
|
||||
public TestUpdateSettings() {
|
||||
}
|
||||
|
||||
public TestUpdateSettings(ChannelStatus channelStatus, boolean disabled, String[] knowsChannels) {
|
||||
myChannelStatus = channelStatus;
|
||||
this.disabled = disabled;
|
||||
@@ -58,6 +55,7 @@ public class TestUpdateSettings implements UserUpdateSettings {
|
||||
knowsChannels = ids;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ChannelStatus getSelectedChannelStatus() {
|
||||
return myChannelStatus;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class UpdateStrategyTest extends TestCase {
|
||||
|
||||
//could be if somebody used before previous version of IDEA
|
||||
public void testWithUndefinedSelection() {
|
||||
final TestUpdateSettings settings = new TestUpdateSettings();
|
||||
final TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP, false, null);
|
||||
//first time load
|
||||
UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-98.520"), UpdatesInfoXppParserTest.InfoReader.read("idea-same.xml"), settings);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<product name="IntelliJ IDEA">
|
||||
<code>IU</code>
|
||||
<code>IC</code>
|
||||
<channel id="maiaEAP" name="IntelliJ IDEA 9 updates" status="release"
|
||||
<channel id="maiaEAP" name="IntelliJ IDEA 9 updates" status="release" majorVersion="9"
|
||||
url="http://www.jetbrains.com/idea/whatsnew"
|
||||
feedback="http://youtrack.jetbrains.net">
|
||||
<build number="95.627" version="9.0.4">
|
||||
@@ -13,7 +13,8 @@
|
||||
</build>
|
||||
</channel>
|
||||
|
||||
<channel id="idea90" name="IntelliJ IDEA 9 updates" status="release" url="http://www.jetbrains.com/idea/whatsnew">
|
||||
<channel id="idea90" name="IntelliJ IDEA 9 updates" status="release" majorVersion="9"
|
||||
url="http://www.jetbrains.com/idea/whatsnew">
|
||||
<build number="95.627" version="9.0.4">
|
||||
<message>IntelliJ IDEA 9.0.4 is available.
|
||||
Please visit http://www.jetbrains.com/idea to learn more and download it.
|
||||
@@ -22,7 +23,8 @@
|
||||
</build>
|
||||
</channel>
|
||||
|
||||
<channel id="IDEA10EAP" name="IntelliJ IDEA X EAP" status="eap" url="http://confluence.jetbrains.net/display/IDEADEV/IDEA+X+EAP">
|
||||
<channel id="IDEA10EAP" name="IntelliJ IDEA X EAP" status="eap" majorVersion="9"
|
||||
url="http://confluence.jetbrains.net/display/IDEADEV/IDEA+X+EAP">
|
||||
<build number="98.620" version="10">
|
||||
<message>IntelliJ IDEA X RC is available.
|
||||
Please visit http://confluence.jetbrains.net/display/IDEADEV/IDEA+X+EAP to learn more and download it.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<product name="IntelliJ IDEA">
|
||||
<code>IU</code>
|
||||
<code>IC</code>
|
||||
<channel id="maiaEAP" name="IntelliJ IDEA 9 updates" status="release"
|
||||
<channel id="maiaEAP" name="IntelliJ IDEA 9 updates" status="release" majorVersion="9"
|
||||
url="http://www.jetbrains.com/idea/whatsnew"
|
||||
feedback="http://youtrack.jetbrains.net">
|
||||
<build number="95.627" version="9.0.4">
|
||||
@@ -13,7 +13,8 @@
|
||||
</build>
|
||||
</channel>
|
||||
|
||||
<channel id="idea90" name="IntelliJ IDEA 9 updates" status="release" url="http://www.jetbrains.com/idea/whatsnew">
|
||||
<channel id="idea90" name="IntelliJ IDEA 9 updates" status="release" majorVersion="9"
|
||||
url="http://www.jetbrains.com/idea/whatsnew">
|
||||
<build number="95.627" version="9.0.4">
|
||||
<message>IntelliJ IDEA 9.0.4 is available.
|
||||
Please visit http://www.jetbrains.com/idea to learn more and download it.
|
||||
@@ -22,7 +23,8 @@
|
||||
</build>
|
||||
</channel>
|
||||
|
||||
<channel id="IDEA10EAP" name="IntelliJ IDEA X EAP" status="eap" url="http://confluence.jetbrains.net/display/IDEADEV/IDEA+X+EAP">
|
||||
<channel id="IDEA10EAP" name="IntelliJ IDEA X EAP" status="eap" majorVersion="10"
|
||||
url="http://confluence.jetbrains.net/display/IDEADEV/IDEA+X+EAP">
|
||||
<build number="98.520" version="10">
|
||||
<message>IntelliJ IDEA X RC is available.
|
||||
Please visit http://confluence.jetbrains.net/display/IDEADEV/IDEA+X+EAP to learn more and download it.
|
||||
|
||||
Reference in New Issue
Block a user