more cleaning, fix NPE when opening updates (regression from last night)

This commit is contained in:
Ben Fry
2022-03-12 07:02:02 -05:00
parent 9df13bed48
commit faaefcf685
4 changed files with 28 additions and 31 deletions

View File

@@ -421,9 +421,11 @@ public class ContributionListing {
}
/*
protected boolean listDownloadSuccessful() {
return !listDownloadFailed;
}
*/
private List<AvailableContribution> parseContribList(File file) {

View File

@@ -37,12 +37,11 @@ import processing.app.ui.Toolkit;
public class ContributionTab extends JPanel {
//static final String ANY_CATEGORY = Language.text("contrib.all");
static final int FILTER_WIDTH = Toolkit.zoom(180);
Base base;
ContributionType contribType;
ManagerFrame contribDialog;
ManagerFrame managerFrame;
Contribution.Filter filter;
JComboBox<String> categoryChooser;
@@ -64,12 +63,14 @@ public class ContributionTab extends JPanel {
JProgressBar progressBar;
public ContributionTab() { }
public ContributionTab(ManagerFrame dialog) {
this.managerFrame = dialog;
this.base = dialog.base;
}
public ContributionTab(ManagerFrame dialog, ContributionType type) {
this.base = dialog.base;
this.contribDialog = dialog;
this(dialog);
this.contribType = type;
// long t1 = System.currentTimeMillis();
@@ -89,6 +90,7 @@ public class ContributionTab extends JPanel {
// System.out.println("ContributionTab.<init> " + (t4-t1) + " " + (t5-t4) + " " + (t6-t5));
}
public void showFrame(boolean error, boolean loading) {
setLayout(error, loading);
contributionListPanel.setVisible(!loading);
@@ -189,31 +191,24 @@ public class ContributionTab extends JPanel {
errorMessage = new JTextPane();
errorMessage.setEditable(false);
errorMessage.setContentType("text/html");
errorMessage.setText("<html><body><center>Could not connect to the Processing server.<br>"
+ "Contributions cannot be installed or updated without an Internet connection.<br>"
+ "Please verify your network connection again, then try connecting again.</center></body></html>");
//DetailPanel.setTextStyle(errorMessage, "1em");
//errorMessage.addStyle(DetailPanel.getBodyStyle());
errorMessage.setText("<html><body><center>" +
"Could not connect to the Processing server.<br>" +
"Contributions cannot be installed or updated without an Internet connection.<br>" +
"Please verify your network connection again, then try connecting again." +
"</center></body></html>");
Dimension dim = new Dimension(550, 60);
errorMessage.setMaximumSize(dim);
errorMessage.setMinimumSize(dim);
errorMessage.setOpaque(false);
/*
StyledDocument doc = errorMessage.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
doc.setParagraphAttributes(0, doc.getLength(), center, false);
*/
closeButton = Toolkit.createIconButton("manager/close");
closeButton.setContentAreaFilled(false);
closeButton.addActionListener(e -> contribDialog.makeAndShowTab(false, false));
closeButton.addActionListener(e -> managerFrame.makeAndShowTab(false, false));
tryAgainButton = new JButton("Try Again");
tryAgainButton.setFont(ManagerFrame.NORMAL_PLAIN);
tryAgainButton.addActionListener(e -> {
contribDialog.makeAndShowTab(false, true);
contribDialog.downloadAndUpdateContributionListing(base);
managerFrame.makeAndShowTab(false, true);
managerFrame.downloadAndUpdateContributionListing(base);
});
layout.setHorizontalGroup(layout.createSequentialGroup()
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,

View File

@@ -12,8 +12,7 @@ import processing.app.ui.Toolkit;
public class UpdateContributionTab extends ContributionTab {
public UpdateContributionTab(ManagerFrame dialog) {
super();
this.contribDialog = dialog;
super(dialog);
filter = contrib -> {
if (contrib instanceof ListPanel.SectionHeaderContribution) {
@@ -25,7 +24,6 @@ public class UpdateContributionTab extends ContributionTab {
return false;
};
contributionListPanel = new UpdateListPanel(this, filter);
// contributionListPanel.setBorder(new EmptyBorder(8, 8, 8, 8));
statusPanel = new UpdateStatusPanel(this);
contribListing = ContributionListing.getInstance();
@@ -43,7 +41,6 @@ public class UpdateContributionTab extends ContributionTab {
loaderLabel = new JLabel(Toolkit.getLibIcon("manager/loader.gif"));
loaderLabel.setOpaque(false);
// loaderLabel.setBackground(Color.WHITE);
}
GroupLayout layout = new GroupLayout(this);

View File

@@ -22,17 +22,14 @@ X remove extra ContribProgressMonitor class
X removing the current Mode (with no windows open) will cause an exception
X when next opening a sketch, nextMode is set to the old guy
_ allow update of the current Mode
_ lots of rewriting to use SwingWorker
_ https://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html
unzip -d ~/coconut/sketchbook4/modes/ ~/Desktop/p5jsMode.zip
_ an incompatible Mode prevents the PDE from quitting after last window is closed
_ https://github.com/processing/processing/issues/5112
_ remove checkbox for detaching sketch name
_ just do this manually, and Save As will reset the name
_ update wiki with recent changes (i.e. separating sketch folder)
_ https://github.com/processing/processing4/wiki/Processing-4
_ clicking "Update All" on the Updates tab throws NPE
_ https://github.com/processing/processing4/issues/440
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "javax.swing.JProgressBar.setVisible(boolean)" because "this.progressBar" is null
@@ -45,6 +42,12 @@ Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot in
_ on release: submit to Microsoft
_ https://www.microsoft.com/en-us/wdsi/filesubmission
_ remove checkbox for detaching sketch name
_ just do this manually, and Save As will reset the name
_ update wiki with recent changes (i.e. separating sketch folder)
_ https://github.com/processing/processing4/wiki/Processing-4
python
X add JavaFX handler
X opening an example throws an NPE