From cfb3f0e0da35c35e41d558d8da2b0b4140ee4b04 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sat, 20 Apr 2013 16:20:52 -0400 Subject: [PATCH] layout tweaks and fix for #1701, errant msgs about backup folder on update --- .../app/contrib/ContributionPanel.java | 116 +++--------------- .../app/contrib/ContributionType.java | 9 +- todo.txt | 7 +- 3 files changed, 23 insertions(+), 109 deletions(-) diff --git a/app/src/processing/app/contrib/ContributionPanel.java b/app/src/processing/app/contrib/ContributionPanel.java index 6f1f6ce5b..9f0ff9a60 100644 --- a/app/src/processing/app/contrib/ContributionPanel.java +++ b/app/src/processing/app/contrib/ContributionPanel.java @@ -59,7 +59,8 @@ class ContributionPanel extends JPanel { private boolean enableHyperlinks; private HyperlinkListener conditionalHyperlinkOpener; private JTextPane descriptionBlock; - private JTextPane notificationBlock; +// private JTextPane notificationBlock; + private JLabel notificationBlock; private JButton updateButton; private JProgressBar installProgressBar; private JButton installRemoveButton; @@ -161,19 +162,8 @@ class ContributionPanel extends JPanel { * library panel is not clicked. */ private void addPaneComponents() { -// setLayout(new GridBagLayout()); setLayout(new BorderLayout()); -// { // Header text area. The name of the contribution and its authors. -// GridBagConstraints c = new GridBagConstraints(); -// c.gridx = 0; -// c.gridy = 0; -// c.weightx = 1; -// c.weighty = 1; -// c.gridwidth = 2; -// c.fill = GridBagConstraints.BOTH; -// c.anchor = GridBagConstraints.WEST; - descriptionBlock = new JTextPane(); descriptionBlock.setInheritsPopupMenu(true); Insets margin = descriptionBlock.getMargin(); @@ -182,103 +172,24 @@ class ContributionPanel extends JPanel { descriptionBlock.setContentType("text/html"); setTextStyle(descriptionBlock); descriptionBlock.setOpaque(false); - stripTextSelectionListeners(descriptionBlock); -// } +// stripTextSelectionListeners(descriptionBlock); + descriptionBlock.setBorder(new EmptyBorder(4, 7, 7, 7)); descriptionBlock.setHighlighter(null); add(descriptionBlock, BorderLayout.CENTER); -// { // Header text area. The name of the contribution and its authors. -// GridBagConstraints c = new GridBagConstraints(); -// c.gridx = 0; -// c.gridy = 0; -// c.weightx = 1; -// c.fill = GridBagConstraints.BOTH; -// c.anchor = GridBagConstraints.WEST; -// -// headerText = new JTextPane(); -// headerText.setInheritsPopupMenu(true); -// Insets margin = headerText.getMargin(); -// margin.bottom = 0; -// headerText.setMargin(margin); -// headerText.setContentType("text/html"); -// setTextStyle(headerText); -// headerText.setOpaque(false); -//// headerPaneSet.add(headerText); -// stripTextSelectionListeners(headerText); -// add(headerText, c); -// } -// -// { // The bottom right of the description, used to show text describing it -// GridBagConstraints c = new GridBagConstraints(); -// c.gridx = 0; -// c.gridy = 1; -// c.weighty = 1; -// c.weightx = 1; -// c.gridwidth = 2; -// c.fill = GridBagConstraints.BOTH; -// c.anchor = GridBagConstraints.NORTHEAST; -// -// JPanel descriptionPanel = new JPanel(new GridBagLayout()); -// descriptionPanel.setInheritsPopupMenu(true); -// descriptionPanel.setOpaque(false); -// add(descriptionPanel, c); -// -// { -// GridBagConstraints dc = new GridBagConstraints(); -// dc.fill = GridBagConstraints.HORIZONTAL; -// dc.weightx = 1; -// -// descriptionText = new JTextPane(); -// descriptionText.setInheritsPopupMenu(true); -// descriptionText.setContentType("text/html"); -// setTextStyle(descriptionText); -// descriptionText.setOpaque(false); -// descriptionPanel.add(descriptionText, dc); -// } -// -// int margin = Base.isMacOS() ? 15 : 5; -// { -// GridBagConstraints dc = new GridBagConstraints(); -// dc.gridx = 1; -// descriptionPanel.add(Box.createHorizontalStrut(margin), dc); -// } -// } - -// { // A label below the description text showing notifications for when -// // updates are available, or instructing the user to restart the PDE if -// // necessary -// GridBagConstraints c = new GridBagConstraints(); -// c.gridx = 0; -// c.gridy = 2; -// c.weightx = 1; -// c.insets = new Insets(-5, 0, 0, 0); -// c.fill = GridBagConstraints.HORIZONTAL; -// c.anchor = GridBagConstraints.EAST; - Box updateBox = Box.createHorizontalBox(); //new BoxLayout(filterPanel, BoxLayout.X_AXIS) -// BoxLayout - notificationBlock = new JTextPane(); + notificationBlock = new JLabel(); notificationBlock.setInheritsPopupMenu(true); notificationBlock.setVisible(false); notificationBlock.setOpaque(false); - notificationBlock.setContentType("text/html"); - notificationBlock.setHighlighter(null); - - setTextStyle(notificationBlock); - stripTextSelectionListeners(notificationBlock); -// add(updateNotificationLabel, c); -// } - -// { // An update button, shown in the description area, but only visible for -// // contributions that do not require a restart. -// GridBagConstraints c = new GridBagConstraints(); -// c.gridx = 1; -// c.gridy = 2; -// c.weightx = 1; -// c.insets = new Insets(-5, 0, 0, 0); -// c.anchor = GridBagConstraints.EAST; + // not needed after changing to JLabel +// notificationBlock.setContentType("text/html"); +// notificationBlock.setHighlighter(null); +// setTextStyle(notificationBlock); + notificationBlock.setFont(new Font("Verdana", Font.ITALIC, 10)); +// stripTextSelectionListeners(notificationBlock); updateButton = new JButton("Update"); updateButton.setInheritsPopupMenu(true); @@ -543,7 +454,9 @@ class ContributionPanel extends JPanel { } - void stripTextSelectionListeners(JEditorPane editorPane) { + // This doesn't actually seem to work? + /* + static void stripTextSelectionListeners(JEditorPane editorPane) { for (MouseListener listener : editorPane.getMouseListeners()) { String className = listener.getClass().getName(); if (className.endsWith("MutableCaretEvent") || @@ -553,6 +466,7 @@ class ContributionPanel extends JPanel { } } } + */ protected void resetInstallProgressBarState() { diff --git a/app/src/processing/app/contrib/ContributionType.java b/app/src/processing/app/contrib/ContributionType.java index 26ce4fd51..4c3b69fee 100644 --- a/app/src/processing/app/contrib/ContributionType.java +++ b/app/src/processing/app/contrib/ContributionType.java @@ -177,13 +177,14 @@ public enum ContributionType { File createBackupFolder(StatusPanel status) { File backupFolder = new File(getSketchbookFolder(), "old"); - if (!backupFolder.isDirectory()) { - status.setErrorMessage("Remove the file named \"old\" from the " + + if (backupFolder.isDirectory()) { + status.setErrorMessage("First remove the folder named \"old\" from the " + getFolderName() + " folder in the sketchbook."); return null; } - if (!backupFolder.exists() && !backupFolder.mkdirs()) { - status.setErrorMessage("Could not create a " + toString() + " backup folder."); + if (!backupFolder.mkdirs()) { + status.setErrorMessage("Could not create a backup folder in the " + + "sketchbook " + toString() + " folder."); return null; } return backupFolder; diff --git a/todo.txt b/todo.txt index 5c56fa080..6d8e1d97c 100644 --- a/todo.txt +++ b/todo.txt @@ -19,10 +19,9 @@ X https://github.com/processing/processing/issues/1684 X shift color of installed items when selected X was ugly gray over selection color X fix layout of the update button -_ get update text to align vertically - -_ "Update" not working in the library manager -_ https://github.com/processing/processing/issues/1701 +X get update text to align vertically +X "Update" not working in the library manager +X https://github.com/processing/processing/issues/1701 _ how does new JDI affect Experimental? duplicate libs? loader issues? _ move Android mode out to its own repo