| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
48 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -111,9 +111,9 @@ public void run() { | |||
| 111 | 111 | try { | |
| 112 | 112 | createAndShowGUI(args); | |
| 113 | 113 | } catch (Throwable t) { | |
| 114 | - Messages.showBadnessTrace("It was not meant to be", | ||
| 115 | - "A serious problem happened during startup. Please report:\n" + | ||
| 116 | - "http://github.com/processing/processing/issues/new", t, true); | ||
| 114 | + Messages.showTrace("It was not meant to be", | ||
| 115 | + "A serious problem happened during startup. Please report:\n" + | ||
| 116 | + "http://github.com/processing/processing/issues/new", t, true); | ||
| 117 | 117 | } | |
| 118 | 118 | } | |
| 119 | 119 | }); | |
@@ -209,7 +209,7 @@ public void run() { | |||
| 209 | 209 | try { | |
| 210 | 210 | new Welcome(base, prompt); | |
| 211 | 211 | } catch (IOException e) { | |
| 212 | - Messages.showBadnessTrace("Unwelcoming", | ||
| 212 | + Messages.showTrace("Unwelcoming", | ||
| 213 | 213 | "Please report this error to\n" + | |
| 214 | 214 | "https://github.com/processing/processing/issues", e, false); | |
| 215 | 215 | } | |
@@ -224,7 +224,7 @@ public void run() { | |||
| 224 | 224 | // show this one so that it's not truncated in the error window. | |
| 225 | 225 | t = t.getCause(); | |
| 226 | 226 | } | |
| 227 | - Messages.showBadnessTrace("We're off on the wrong foot", | ||
| 227 | + Messages.showTrace("We're off on the wrong foot", | ||
| 228 | 228 | "An error occurred during startup.", t, true); | |
| 229 | 229 | } | |
| 230 | 230 | Messages.log("done creating base..."); //$NON-NLS-1$ | |
@@ -915,11 +915,11 @@ protected Editor handleOpen(String path, boolean untitled, | |||
| 915 | 915 | "Try updating the Mode or contact its author for a new version.", nsme); | |
| 916 | 916 | } catch (Throwable t) { | |
| 917 | 917 | if (nextMode.equals(getDefaultMode())) { | |
| 918 | - Messages.showBadnessTrace("Serious Problem", | ||
| 918 | + Messages.showTrace("Serious Problem", | ||
| 919 | 919 | "An unexpected, unknown, and unrecoverable error occurred\n" + | |
| 920 | 920 | "while opening a new editor window. Please report this.", t, true); | |
| 921 | 921 | } else { | |
| 922 | - Messages.showBadnessTrace("Mode Problems", | ||
| 922 | + Messages.showTrace("Mode Problems", | ||
| 923 | 923 | "A nasty error occurred while trying to use " + nextMode.getTitle() + ".\n" + | |
| 924 | 924 | "It may not be compatible with this version of Processing.\n" + | |
| 925 | 925 | "Try updating the Mode or contact its author for a new version.", t, false); | |
@@ -943,7 +943,7 @@ protected Editor handleOpen(String path, boolean untitled, | |||
| 943 | 943 | */ | |
| 944 | 944 | ||
| 945 | 945 | } catch (Throwable t) { | |
| 946 | - Messages.showBadnessTrace("Terrible News", | ||
| 946 | + Messages.showTrace("Terrible News", | ||
| 947 | 947 | "A serious error occurred while " + | |
| 948 | 948 | "trying to create a new editor window.", t, | |
| 949 | 949 | nextMode == getDefaultMode()); // quit if default | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,7 +155,7 @@ static public void showError(String title, String message, Throwable e) { | |||
| 155 | 155 | /** | |
| 156 | 156 | * Testing a new warning window that includes the stack trace. | |
| 157 | 157 | */ | |
| 158 | - static void showBadnessTrace(String title, String message, | ||
| 158 | + static public void showTrace(String title, String message, | ||
| 159 | 159 | Throwable t, boolean fatal) { | |
| 160 | 160 | if (title == null) title = fatal ? "Error" : "Warning"; | |
| 161 | 161 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,6 +59,8 @@ public void hyperlinkUpdate(HyperlinkEvent e) { } | |||
| 59 | 59 | protected ContributionListing contribListing = ContributionListing.getInstance(); | |
| 60 | 60 | protected JTable table; | |
| 61 | 61 | DefaultTableModel dtm; | |
| 62 | + JScrollPane scrollPane; | ||
| 63 | + Font myFont; | ||
| 62 | 64 | ||
| 63 | 65 | public ContributionListPanel() { | |
| 64 | 66 | // TODO Auto-generated constructor stub | |
@@ -96,11 +98,12 @@ public Component prepareRenderer( | |||
| 96 | 98 | return c; | |
| 97 | 99 | } | |
| 98 | 100 | }; | |
| 99 | - | ||
| 101 | + | ||
| 100 | 102 | // There is a space before Status | |
| 101 | 103 | String[] colName = { " Status", "Name", "Author" }; | |
| 102 | 104 | dtm.setColumnIdentifiers(colName); | |
| 103 | - JScrollPane scrollPane = new JScrollPane(table); | ||
| 105 | + scrollPane = new JScrollPane(table); | ||
| 106 | + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); | ||
| 104 | 107 | table.setFillsViewportHeight(true); | |
| 105 | 108 | // table.setBorder(); | |
| 106 | 109 | table.setDefaultRenderer(Contribution.class, new StatusRendere()); | |
@@ -345,9 +348,11 @@ public Component getTableCellRendererComponent(JTable table, Object value, | |||
| 345 | 348 | label.setFont(ContributionManagerDialog.myFont); | |
| 346 | 349 | label.setOpaque(true); | |
| 347 | 350 | } else { | |
| 348 | - label = new JLabel( | ||
| 349 | - contribution.isSpecial() ? Toolkit | ||
| 350 | - .getLibIcon("icons/pde-16.png") : null); | ||
| 351 | + if (contribution.isSpecial()) { | ||
| 352 | + label = new JLabel(Toolkit.getLibIcon("icons/foundation-16.png")); | ||
| 353 | + } else { | ||
| 354 | + label = new JLabel(); | ||
| 355 | + } | ||
| 351 | 356 | String authorList = contribution.getAuthorList(); | |
| 352 | 357 | String name = getAuthorNameWithoutMarkup(authorList); | |
| 353 | 358 | label.setText(name.toString()); | |
@@ -379,7 +384,7 @@ public Class<?> getColumnClass(int columnIndex) { | |||
| 379 | 384 | return Contribution.class; | |
| 380 | 385 | } | |
| 381 | 386 | } | |
| 382 | - | ||
| 387 | + | ||
| 383 | 388 | String getAuthorNameWithoutMarkup(String authorList) { | |
| 384 | 389 | StringBuilder name = new StringBuilder(""); | |
| 385 | 390 | if (authorList != null) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,11 +38,7 @@ | |||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | 40 | public class ContributionManager { | |
| 41 | - static public final ContributionListing contribListing; | ||
| 42 | - | ||
| 43 | - static { | ||
| 44 | - contribListing = ContributionListing.getInstance(); | ||
| 45 | - } | ||
| 41 | + static final ContributionListing listing = ContributionListing.getInstance(); | ||
| 46 | 42 | ||
| 47 | 43 | ||
| 48 | 44 | /** | |
@@ -72,9 +68,9 @@ static boolean download(URL source, byte[] post, | |||
| 72 | 68 | if (post == null) { | |
| 73 | 69 | conn.setRequestMethod("GET"); | |
| 74 | 70 | conn.connect(); | |
| 71 | + | ||
| 75 | 72 | } else { | |
| 76 | 73 | post = gzipEncode(post); | |
| 77 | - | ||
| 78 | 74 | conn.setRequestMethod("POST"); | |
| 79 | 75 | conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); | |
| 80 | 76 | conn.setRequestProperty("Content-Encoding", "gzip"); | |
@@ -178,7 +174,7 @@ public void run() { | |||
| 178 | 174 | ad.install(editor.getBase(), contribZip, false, status); | |
| 179 | 175 | ||
| 180 | 176 | if (contribution != null) { | |
| 181 | - contribListing.replaceContribution(ad, contribution); | ||
| 177 | + listing.replaceContribution(ad, contribution); | ||
| 182 | 178 | if (contribution.getType() == ContributionType.MODE) { | |
| 183 | 179 | List<ModeContribution> contribModes = editor.getBase().getModeContribs(); | |
| 184 | 180 | if (!contribModes.contains(contribution)) { | |
@@ -263,7 +259,7 @@ public void run() { | |||
| 263 | 259 | false, null); | |
| 264 | 260 | ||
| 265 | 261 | if (contribution != null) { | |
| 266 | - contribListing.replaceContribution(ad, contribution); | ||
| 262 | + listing.replaceContribution(ad, contribution); | ||
| 267 | 263 | if (contribution.getType() == ContributionType.MODE) { | |
| 268 | 264 | List<ModeContribution> contribModes = base.getModeContribs(); | |
| 269 | 265 | if (contribModes != null && !contribModes.contains(contribution)) { | |
@@ -396,7 +392,7 @@ public static void downloadAndInstallOnImport(final Base base, | |||
| 396 | 392 | false, null); | |
| 397 | 393 | ||
| 398 | 394 | if (contribution != null) { | |
| 399 | - contribListing.replaceContribution(ad, contribution); | ||
| 395 | + listing.replaceContribution(ad, contribution); | ||
| 400 | 396 | if (base.getActiveEditor() != null) { | |
| 401 | 397 | refreshInstalled(base.getActiveEditor()); | |
| 402 | 398 | } | |
@@ -432,11 +428,8 @@ public static void downloadAndInstallOnImport(final Base base, | |||
| 432 | 428 | } | |
| 433 | 429 | ||
| 434 | 430 | ||
| 435 | - static public void refreshInstalled(Editor e) { | ||
| 436 | - | ||
| 437 | - Iterator<Editor> iter = e.getBase().getEditors().iterator(); | ||
| 438 | - while (iter.hasNext()) { | ||
| 439 | - Editor ed = iter.next(); | ||
| 431 | + static void refreshInstalled(Editor e) { | ||
| 432 | + for (Editor ed : e.getBase().getEditors()) { | ||
| 440 | 433 | ed.getMode().rebuildImportMenu(); | |
| 441 | 434 | ed.getMode().rebuildExamplesFrame(); | |
| 442 | 435 | ed.rebuildToolMenu(); | |
@@ -502,7 +495,6 @@ static public String getFileName(File libFile) { | |||
| 502 | 495 | * Also updates all entries previously marked for update. | |
| 503 | 496 | */ | |
| 504 | 497 | static public void cleanup(final Base base) throws Exception { | |
| 505 | - | ||
| 506 | 498 | deleteTemp(Base.getSketchbookModesFolder()); | |
| 507 | 499 | deleteTemp(Base.getSketchbookToolsFolder()); | |
| 508 | 500 | ||
@@ -530,8 +522,6 @@ protected Void doInBackground() throws Exception { | |||
| 530 | 522 | }; | |
| 531 | 523 | s.execute(); | |
| 532 | 524 | ||
| 533 | - | ||
| 534 | - | ||
| 535 | 525 | clearRestartFlags(Base.getSketchbookModesFolder()); | |
| 536 | 526 | clearRestartFlags(Base.getSketchbookToolsFolder()); | |
| 537 | 527 | } | |
@@ -545,32 +535,23 @@ protected Void doInBackground() throws Exception { | |||
| 545 | 535 | * @param root | |
| 546 | 536 | */ | |
| 547 | 537 | static private void deleteTemp(File root) { | |
| 548 | - | ||
| 549 | - LinkedList<File> deleteList = new LinkedList<File>(); | ||
| 550 | - | ||
| 551 | - for (File f : root.listFiles()) | ||
| 552 | - if (f.getName().matches(root.getName().substring(0, 4) + "\\d*" + "tmp")) | ||
| 553 | - deleteList.add(f); | ||
| 554 | - | ||
| 555 | - Iterator<File> folderIter = deleteList.iterator(); | ||
| 556 | - | ||
| 557 | - while (folderIter.hasNext()) { | ||
| 558 | - Util.removeDir(folderIter.next()); | ||
| 538 | + String pattern = root.getName().substring(0, 4) + "\\d*" + "tmp"; | ||
| 539 | + for (File f : root.listFiles()) { | ||
| 540 | + if (f.getName().matches(pattern)) { | ||
| 541 | + Util.removeDir(f); | ||
| 542 | + } | ||
| 559 | 543 | } | |
| 560 | 544 | } | |
| 561 | 545 | ||
| 562 | 546 | ||
| 563 | 547 | /** | |
| 564 | 548 | * Deletes all the modes/tools/libs that are flagged for removal. | |
| 565 | - * | ||
| 566 | - * @param root | ||
| 567 | - * @throws Exception | ||
| 568 | 549 | */ | |
| 569 | 550 | static private void deleteFlagged(File root) throws Exception { | |
| 570 | 551 | File[] markedForDeletion = root.listFiles(new FileFilter() { | |
| 571 | 552 | public boolean accept(File folder) { | |
| 572 | - return (folder.isDirectory() && LocalContribution | ||
| 573 | - .isDeletionFlagged(folder)); | ||
| 553 | + return (folder.isDirectory() && | ||
| 554 | + LocalContribution.isDeletionFlagged(folder)); | ||
| 574 | 555 | } | |
| 575 | 556 | }); | |
| 576 | 557 | for (File folder : markedForDeletion) { | |
@@ -590,19 +571,16 @@ public boolean accept(File folder) { | |||
| 590 | 571 | static private void installPreviouslyFailed(Base base, File root) throws Exception { | |
| 591 | 572 | File[] installList = root.listFiles(new FileFilter() { | |
| 592 | 573 | public boolean accept(File folder) { | |
| 593 | - return (folder.isFile()); | ||
| 574 | + return folder.isFile(); | ||
| 594 | 575 | } | |
| 595 | 576 | }); | |
| 596 | 577 | ||
| 597 | 578 | for (File file : installList) { | |
| 598 | - Iterator<AvailableContribution> iter = contribListing.advertisedContributions.iterator(); | ||
| 599 | - while (iter.hasNext()) { | ||
| 600 | - AvailableContribution availableContrib = iter.next(); | ||
| 601 | - if (file.getName().equals(availableContrib.getName())) { | ||
| 579 | + for (AvailableContribution contrib : listing.advertisedContributions) { | ||
| 580 | + if (file.getName().equals(contrib.getName())) { | ||
| 602 | 581 | file.delete(); | |
| 603 | - installOnStartUp(base, availableContrib); | ||
| 604 | - contribListing | ||
| 605 | - .replaceContribution(availableContrib, availableContrib); | ||
| 582 | + installOnStartUp(base, contrib); | ||
| 583 | + listing.replaceContribution(contrib, contrib); | ||
| 606 | 584 | } | |
| 607 | 585 | } | |
| 608 | 586 | } | |
@@ -619,8 +597,8 @@ public boolean accept(File folder) { | |||
| 619 | 597 | static private void updateFlagged(Base base, File root) throws Exception { | |
| 620 | 598 | File[] markedForUpdate = root.listFiles(new FileFilter() { | |
| 621 | 599 | public boolean accept(File folder) { | |
| 622 | - return (folder.isDirectory() && LocalContribution | ||
| 623 | - .isUpdateFlagged(folder)); | ||
| 600 | + return (folder.isDirectory() && | ||
| 601 | + LocalContribution.isUpdateFlagged(folder)); | ||
| 624 | 602 | } | |
| 625 | 603 | }); | |
| 626 | 604 | ||
@@ -643,7 +621,7 @@ else if (type.equalsIgnoreCase("libraries")) //putting this here, just in case | |||
| 643 | 621 | Util.removeDir(folder); | |
| 644 | 622 | } | |
| 645 | 623 | ||
| 646 | - Iterator<AvailableContribution> iter = contribListing.advertisedContributions.iterator(); | ||
| 624 | + Iterator<AvailableContribution> iter = listing.advertisedContributions.iterator(); | ||
| 647 | 625 | while (iter.hasNext()) { | |
| 648 | 626 | AvailableContribution availableContribs = iter.next(); | |
| 649 | 627 | if (updateContribsNames.contains(availableContribs.getName())) { | |
@@ -655,7 +633,7 @@ else if (type.equalsIgnoreCase("libraries")) //putting this here, just in case | |||
| 655 | 633 | while (iter2.hasNext()) { | |
| 656 | 634 | AvailableContribution contribToUpdate = iter2.next(); | |
| 657 | 635 | installOnStartUp(base, contribToUpdate); | |
| 658 | - contribListing.replaceContribution(contribToUpdate, contribToUpdate); | ||
| 636 | + listing.replaceContribution(contribToUpdate, contribToUpdate); | ||
| 659 | 637 | } | |
| 660 | 638 | } | |
| 661 | 639 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -447,8 +447,8 @@ public void setContribution(Contribution contrib) { | |||
| 447 | 447 | this.contrib = contrib; | |
| 448 | 448 | ||
| 449 | 449 | if (contrib.isSpecial()) { | |
| 450 | - ImageIcon processingIcon = Toolkit.getLibIcon("icons/pde-48.png"); | ||
| 451 | - JLabel iconLabel = new JLabel(processingIcon); | ||
| 450 | + JLabel iconLabel = | ||
| 451 | + new JLabel(Toolkit.getLibIcon("icons/foundation-32.png")); // was 48? | ||
| 452 | 452 | iconLabel.setBorder(new EmptyBorder(4, 7, 7, 7)); | |
| 453 | 453 | iconLabel.setVerticalAlignment(SwingConstants.TOP); | |
| 454 | 454 | add(iconLabel, BorderLayout.WEST); | |
@@ -462,7 +462,7 @@ public void setContribution(Contribution contrib) { | |||
| 462 | 462 | description.append("<a href=\"" + contrib.getUrl() + "\">" + contrib.getName() + "</a>"); | |
| 463 | 463 | } | |
| 464 | 464 | description.append("</b> "); | |
| 465 | - | ||
| 465 | + | ||
| 466 | 466 | String version = contrib.getPrettyVersion(); | |
| 467 | 467 | ||
| 468 | 468 | // TODO this has no place here, we shouldn't be cleaning up contrib | |
@@ -476,7 +476,7 @@ else if (version.toLowerCase().startsWith("v")) // For ketai library | |||
| 476 | 476 | description.append(version); | |
| 477 | 477 | } | |
| 478 | 478 | description.append(" <br/>"); | |
| 479 | - | ||
| 479 | + | ||
| 480 | 480 | String authorList = contrib.getAuthorList(); | |
| 481 | 481 | if (authorList != null && !authorList.isEmpty()) { | |
| 482 | 482 | description.append(toHtmlLinks(contrib.getAuthorList())); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,6 +25,7 @@ | |||
| 25 | 25 | import java.awt.Color; | |
| 26 | 26 | import java.awt.Dimension; | |
| 27 | 27 | import java.awt.Font; | |
| 28 | + import java.awt.Graphics; | ||
| 28 | 29 | import java.awt.event.*; | |
| 29 | 30 | import java.util.*; | |
| 30 | 31 | ||
@@ -135,7 +136,15 @@ public void setLayout(final Editor editor, boolean activateErrorPanel, boolean i | |||
| 135 | 136 | progressBar = new JProgressBar(); | |
| 136 | 137 | progressBar.setVisible(false); | |
| 137 | 138 | createComponents(); | |
| 138 | - panel = new JPanel(false); | ||
| 139 | + panel = new JPanel(false){ | ||
| 140 | + @Override | ||
| 141 | + protected void paintComponent(Graphics g) { | ||
| 142 | + super.paintComponent(g); | ||
| 143 | + g.setColor(new Color(0xe0fffd)); | ||
| 144 | + g.fillRect(getX(), panel.getY() - ContributionManagerDialog.TAB_HEIGHT - 2 , panel.getWidth(), 2); | ||
| 145 | + | ||
| 146 | + } | ||
| 147 | + }; | ||
| 139 | 148 | loaderLabel = new JLabel(Toolkit.getLibIcon("manager/loader.gif")); | |
| 140 | 149 | loaderLabel.setOpaque(false); | |
| 141 | 150 | loaderLabel.setBackground(Color.WHITE); | |
@@ -188,6 +197,7 @@ public void actionPerformed(ActionEvent arg0) { | |||
| 188 | 197 | ||
| 189 | 198 | });*/ | |
| 190 | 199 | ||
| 200 | + int catChooserWidth = ContributionManagerDialog.AUTHOR_WIDTH + contributionListPanel.scrollPane.getVerticalScrollBar().getPreferredSize().width - 10; | ||
| 191 | 201 | ||
| 192 | 202 | GroupLayout layout = new GroupLayout(panel); | |
| 193 | 203 | panel.setLayout(layout); | |
@@ -206,9 +216,9 @@ public void actionPerformed(ActionEvent arg0) { | |||
| 206 | 216 | .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, | |
| 207 | 217 | GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) | |
| 208 | 218 | .addComponent(categoryChooser, | |
| 209 | - ContributionManagerDialog.AUTHOR_WIDTH - 10, | ||
| 210 | - ContributionManagerDialog.AUTHOR_WIDTH - 10, | ||
| 211 | - ContributionManagerDialog.AUTHOR_WIDTH - 10) | ||
| 219 | + catChooserWidth, | ||
| 220 | + catChooserWidth, | ||
| 221 | + catChooserWidth) | ||
| 212 | 222 | .addContainerGap()).addComponent(loaderLabel) | |
| 213 | 223 | .addComponent(contributionListPanel).addComponent(errorPanel) | |
| 214 | 224 | .addComponent(statusPanel)); | |
@@ -373,6 +383,7 @@ protected void updateContributionListing() { | |||
| 373 | 383 | ||
| 374 | 384 | List<Library> libraries = | |
| 375 | 385 | new ArrayList<Library>(editor.getMode().contribLibraries); | |
| 386 | + libraries.addAll(editor.getMode().coreLibraries); | ||
| 376 | 387 | contributions.addAll(libraries); | |
| 377 | 388 | ||
| 378 | 389 | //ArrayList<ToolContribution> tools = editor.contribTools; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments