mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
working buttons in new channel dialog
This commit is contained in:
+7
-7
@@ -34,8 +34,8 @@ public class CheckForUpdateResult {
|
||||
@NotNull
|
||||
private final Collection<UpdateChannel> myNewChannels;
|
||||
|
||||
@Nullable
|
||||
private final List<String> allChannelsIds;
|
||||
@NotNull
|
||||
private final List<String> myAllChannelIds;
|
||||
|
||||
@Nullable
|
||||
private UpdateChannel myChannelToPropose;
|
||||
@@ -48,11 +48,11 @@ public class CheckForUpdateResult {
|
||||
|
||||
public CheckForUpdateResult(@Nullable UpdateChannel updated,
|
||||
@Nullable BuildInfo newBuildInSelectedChannel,
|
||||
List<String> allChannelsIds) {
|
||||
@NotNull List<String> allChannelsIds) {
|
||||
this.newBuildInSelectedChannel = newBuildInSelectedChannel;
|
||||
myUpdatedChannel = updated;
|
||||
myNewChannels = new ArrayList<UpdateChannel>();
|
||||
this.allChannelsIds = allChannelsIds;
|
||||
this.myAllChannelIds = allChannelsIds;
|
||||
this.state = UpdateStrategy.State.LOADED;
|
||||
this.error = null;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class CheckForUpdateResult {
|
||||
public CheckForUpdateResult(UpdateStrategy.State state, Exception e) {
|
||||
this.newBuildInSelectedChannel = null;
|
||||
myNewChannels = Collections.emptyList();
|
||||
this.allChannelsIds = null;
|
||||
myAllChannelIds = Collections.emptyList();
|
||||
this.myChannelToPropose = null;
|
||||
this.myUpdatedChannel = null;
|
||||
this.state = state;
|
||||
@@ -89,9 +89,9 @@ public class CheckForUpdateResult {
|
||||
return myNewChannels;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public List<String> getAllChannelsIds() {
|
||||
return allChannelsIds;
|
||||
return myAllChannelIds;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+23
@@ -15,11 +15,13 @@
|
||||
*/
|
||||
package com.intellij.openapi.updateSettings.impl;
|
||||
|
||||
import com.intellij.ide.BrowserUtil;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.ui.LicensingFacade;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -34,6 +36,21 @@ public class NewChannelDialog extends DialogWrapper {
|
||||
setTitle("New " + ApplicationNamesInfo.getInstance().getFullProductName() + " Version Available");
|
||||
initInfo();
|
||||
init();
|
||||
setOKButtonText("More Info...");
|
||||
setOKButtonMnemonic('M');
|
||||
setCancelButtonText("Ignore This Update");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Action[] createActions() {
|
||||
Action remindLater = new AbstractAction("Remind Me Later") {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
UpdateSettings.getInstance().forgetChannelId(myChannel.getId());
|
||||
doCancelAction();
|
||||
}
|
||||
};
|
||||
return new Action[] { getOKAction(), remindLater, getCancelAction() };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,4 +79,10 @@ public class NewChannelDialog extends DialogWrapper {
|
||||
}
|
||||
myInformationText = builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doOKAction() {
|
||||
BrowserUtil.launchBrowser(myChannel.getHomePageUrl());
|
||||
super.doOKAction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,4 +69,12 @@ public class Product {
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public List<String> getAllChannelIds() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (UpdateChannel channel : myChannels) {
|
||||
result.add(channel.getId());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-5
@@ -92,15 +92,17 @@ public class UpdateSettings implements PersistentStateComponent<Element>, UserUp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKnownChannelIds(List<String> ids) {
|
||||
public void setKnownChannelIds(@NotNull List<String> ids) {
|
||||
myKnownUpdateChannels.clear();
|
||||
if (ids!=null){
|
||||
for (String id : ids) {
|
||||
myKnownUpdateChannels.add(id);
|
||||
}
|
||||
for (String id : ids) {
|
||||
myKnownUpdateChannels.add(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void forgetChannelId(String id) {
|
||||
myKnownUpdateChannels.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getIgnoredBuildNumbers() {
|
||||
return myIgnoredBuildNumbers;
|
||||
|
||||
+1
-2
@@ -20,7 +20,6 @@ import com.intellij.openapi.util.BuildNumber;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class UpdateStrategy {
|
||||
@@ -61,7 +60,7 @@ public class UpdateStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
CheckForUpdateResult result = new CheckForUpdateResult(updatedChannel, newBuild, Collections.<String>emptyList());
|
||||
CheckForUpdateResult result = new CheckForUpdateResult(updatedChannel, newBuild, product.getAllChannelIds());
|
||||
|
||||
UpdateChannel channelToPropose = null;
|
||||
for (UpdateChannel channel : product.getChannels()) {
|
||||
|
||||
Reference in New Issue
Block a user