FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge branch 'master' of https://github.com/processing/processing · ftrc/processing@f2b8d90 · GitHub

Repository navigation

Commit f2b8d90

Browse files
committed
2 parents 0d2bfd8 + 58064dc commit f2b8d90

48 files changed

Lines changed: 327 additions & 206 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎app/src/processing/app/Base.java‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ public void run() {
111111
try {
112112
createAndShowGUI(args);
113113
} 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);
117117
}
118118
}
119119
});
@@ -209,7 +209,7 @@ public void run() {
209209
try {
210210
new Welcome(base, prompt);
211211
} catch (IOException e) {
212-
Messages.showBadnessTrace("Unwelcoming",
212+
Messages.showTrace("Unwelcoming",
213213
"Please report this error to\n" +
214214
"https://github.com/processing/processing/issues", e, false);
215215
}
@@ -224,7 +224,7 @@ public void run() {
224224
// show this one so that it's not truncated in the error window.
225225
t = t.getCause();
226226
}
227-
Messages.showBadnessTrace("We're off on the wrong foot",
227+
Messages.showTrace("We're off on the wrong foot",
228228
"An error occurred during startup.", t, true);
229229
}
230230
Messages.log("done creating base..."); //$NON-NLS-1$
@@ -915,11 +915,11 @@ protected Editor handleOpen(String path, boolean untitled,
915915
"Try updating the Mode or contact its author for a new version.", nsme);
916916
} catch (Throwable t) {
917917
if (nextMode.equals(getDefaultMode())) {
918-
Messages.showBadnessTrace("Serious Problem",
918+
Messages.showTrace("Serious Problem",
919919
"An unexpected, unknown, and unrecoverable error occurred\n" +
920920
"while opening a new editor window. Please report this.", t, true);
921921
} else {
922-
Messages.showBadnessTrace("Mode Problems",
922+
Messages.showTrace("Mode Problems",
923923
"A nasty error occurred while trying to use " + nextMode.getTitle() + ".\n" +
924924
"It may not be compatible with this version of Processing.\n" +
925925
"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,
943943
*/
944944

945945
} catch (Throwable t) {
946-
Messages.showBadnessTrace("Terrible News",
946+
Messages.showTrace("Terrible News",
947947
"A serious error occurred while " +
948948
"trying to create a new editor window.", t,
949949
nextMode == getDefaultMode()); // quit if default

‎app/src/processing/app/Messages.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static public void showError(String title, String message, Throwable e) {
155155
/**
156156
* Testing a new warning window that includes the stack trace.
157157
*/
158-
static void showBadnessTrace(String title, String message,
158+
static public void showTrace(String title, String message,
159159
Throwable t, boolean fatal) {
160160
if (title == null) title = fatal ? "Error" : "Warning";
161161

‎app/src/processing/app/contrib/ContributionListPanel.java‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public void hyperlinkUpdate(HyperlinkEvent e) { }
5959
protected ContributionListing contribListing = ContributionListing.getInstance();
6060
protected JTable table;
6161
DefaultTableModel dtm;
62+
JScrollPane scrollPane;
63+
Font myFont;
6264

6365
public ContributionListPanel() {
6466
// TODO Auto-generated constructor stub
@@ -96,11 +98,12 @@ public Component prepareRenderer(
9698
return c;
9799
}
98100
};
99-
101+
100102
// There is a space before Status
101103
String[] colName = { " Status", "Name", "Author" };
102104
dtm.setColumnIdentifiers(colName);
103-
JScrollPane scrollPane = new JScrollPane(table);
105+
scrollPane = new JScrollPane(table);
106+
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
104107
table.setFillsViewportHeight(true);
105108
// table.setBorder();
106109
table.setDefaultRenderer(Contribution.class, new StatusRendere());
@@ -345,9 +348,11 @@ public Component getTableCellRendererComponent(JTable table, Object value,
345348
label.setFont(ContributionManagerDialog.myFont);
346349
label.setOpaque(true);
347350
} 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+
}
351356
String authorList = contribution.getAuthorList();
352357
String name = getAuthorNameWithoutMarkup(authorList);
353358
label.setText(name.toString());
@@ -379,7 +384,7 @@ public Class<?> getColumnClass(int columnIndex) {
379384
return Contribution.class;
380385
}
381386
}
382-
387+
383388
String getAuthorNameWithoutMarkup(String authorList) {
384389
StringBuilder name = new StringBuilder("");
385390
if (authorList != null) {

‎app/src/processing/app/contrib/ContributionManager.java‎

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@
3838

3939

4040
public class ContributionManager {
41-
static public final ContributionListing contribListing;
42-
43-
static {
44-
contribListing = ContributionListing.getInstance();
45-
}
41+
static final ContributionListing listing = ContributionListing.getInstance();
4642

4743

4844
/**
@@ -72,9 +68,9 @@ static boolean download(URL source, byte[] post,
7268
if (post == null) {
7369
conn.setRequestMethod("GET");
7470
conn.connect();
71+
7572
} else {
7673
post = gzipEncode(post);
77-
7874
conn.setRequestMethod("POST");
7975
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
8076
conn.setRequestProperty("Content-Encoding", "gzip");
@@ -178,7 +174,7 @@ public void run() {
178174
ad.install(editor.getBase(), contribZip, false, status);
179175

180176
if (contribution != null) {
181-
contribListing.replaceContribution(ad, contribution);
177+
listing.replaceContribution(ad, contribution);
182178
if (contribution.getType() == ContributionType.MODE) {
183179
List<ModeContribution> contribModes = editor.getBase().getModeContribs();
184180
if (!contribModes.contains(contribution)) {
@@ -263,7 +259,7 @@ public void run() {
263259
false, null);
264260

265261
if (contribution != null) {
266-
contribListing.replaceContribution(ad, contribution);
262+
listing.replaceContribution(ad, contribution);
267263
if (contribution.getType() == ContributionType.MODE) {
268264
List<ModeContribution> contribModes = base.getModeContribs();
269265
if (contribModes != null && !contribModes.contains(contribution)) {
@@ -396,7 +392,7 @@ public static void downloadAndInstallOnImport(final Base base,
396392
false, null);
397393

398394
if (contribution != null) {
399-
contribListing.replaceContribution(ad, contribution);
395+
listing.replaceContribution(ad, contribution);
400396
if (base.getActiveEditor() != null) {
401397
refreshInstalled(base.getActiveEditor());
402398
}
@@ -432,11 +428,8 @@ public static void downloadAndInstallOnImport(final Base base,
432428
}
433429

434430

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()) {
440433
ed.getMode().rebuildImportMenu();
441434
ed.getMode().rebuildExamplesFrame();
442435
ed.rebuildToolMenu();
@@ -502,7 +495,6 @@ static public String getFileName(File libFile) {
502495
* Also updates all entries previously marked for update.
503496
*/
504497
static public void cleanup(final Base base) throws Exception {
505-
506498
deleteTemp(Base.getSketchbookModesFolder());
507499
deleteTemp(Base.getSketchbookToolsFolder());
508500

@@ -530,8 +522,6 @@ protected Void doInBackground() throws Exception {
530522
};
531523
s.execute();
532524

533-
534-
535525
clearRestartFlags(Base.getSketchbookModesFolder());
536526
clearRestartFlags(Base.getSketchbookToolsFolder());
537527
}
@@ -545,32 +535,23 @@ protected Void doInBackground() throws Exception {
545535
* @param root
546536
*/
547537
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+
}
559543
}
560544
}
561545

562546

563547
/**
564548
* Deletes all the modes/tools/libs that are flagged for removal.
565-
*
566-
* @param root
567-
* @throws Exception
568549
*/
569550
static private void deleteFlagged(File root) throws Exception {
570551
File[] markedForDeletion = root.listFiles(new FileFilter() {
571552
public boolean accept(File folder) {
572-
return (folder.isDirectory() && LocalContribution
573-
.isDeletionFlagged(folder));
553+
return (folder.isDirectory() &&
554+
LocalContribution.isDeletionFlagged(folder));
574555
}
575556
});
576557
for (File folder : markedForDeletion) {
@@ -590,19 +571,16 @@ public boolean accept(File folder) {
590571
static private void installPreviouslyFailed(Base base, File root) throws Exception {
591572
File[] installList = root.listFiles(new FileFilter() {
592573
public boolean accept(File folder) {
593-
return (folder.isFile());
574+
return folder.isFile();
594575
}
595576
});
596577

597578
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())) {
602581
file.delete();
603-
installOnStartUp(base, availableContrib);
604-
contribListing
605-
.replaceContribution(availableContrib, availableContrib);
582+
installOnStartUp(base, contrib);
583+
listing.replaceContribution(contrib, contrib);
606584
}
607585
}
608586
}
@@ -619,8 +597,8 @@ public boolean accept(File folder) {
619597
static private void updateFlagged(Base base, File root) throws Exception {
620598
File[] markedForUpdate = root.listFiles(new FileFilter() {
621599
public boolean accept(File folder) {
622-
return (folder.isDirectory() && LocalContribution
623-
.isUpdateFlagged(folder));
600+
return (folder.isDirectory() &&
601+
LocalContribution.isUpdateFlagged(folder));
624602
}
625603
});
626604

@@ -643,7 +621,7 @@ else if (type.equalsIgnoreCase("libraries")) //putting this here, just in case
643621
Util.removeDir(folder);
644622
}
645623

646-
Iterator<AvailableContribution> iter = contribListing.advertisedContributions.iterator();
624+
Iterator<AvailableContribution> iter = listing.advertisedContributions.iterator();
647625
while (iter.hasNext()) {
648626
AvailableContribution availableContribs = iter.next();
649627
if (updateContribsNames.contains(availableContribs.getName())) {
@@ -655,7 +633,7 @@ else if (type.equalsIgnoreCase("libraries")) //putting this here, just in case
655633
while (iter2.hasNext()) {
656634
AvailableContribution contribToUpdate = iter2.next();
657635
installOnStartUp(base, contribToUpdate);
658-
contribListing.replaceContribution(contribToUpdate, contribToUpdate);
636+
listing.replaceContribution(contribToUpdate, contribToUpdate);
659637
}
660638
}
661639

‎app/src/processing/app/contrib/ContributionPanel.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ public void setContribution(Contribution contrib) {
447447
this.contrib = contrib;
448448

449449
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?
452452
iconLabel.setBorder(new EmptyBorder(4, 7, 7, 7));
453453
iconLabel.setVerticalAlignment(SwingConstants.TOP);
454454
add(iconLabel, BorderLayout.WEST);
@@ -462,7 +462,7 @@ public void setContribution(Contribution contrib) {
462462
description.append("<a href=\"" + contrib.getUrl() + "\">" + contrib.getName() + "</a>");
463463
}
464464
description.append("</b> ");
465-
465+
466466
String version = contrib.getPrettyVersion();
467467

468468
// 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
476476
description.append(version);
477477
}
478478
description.append(" <br/>");
479-
479+
480480
String authorList = contrib.getAuthorList();
481481
if (authorList != null && !authorList.isEmpty()) {
482482
description.append(toHtmlLinks(contrib.getAuthorList()));

‎app/src/processing/app/contrib/ContributionTab.java‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.awt.Color;
2626
import java.awt.Dimension;
2727
import java.awt.Font;
28+
import java.awt.Graphics;
2829
import java.awt.event.*;
2930
import java.util.*;
3031

@@ -135,7 +136,15 @@ public void setLayout(final Editor editor, boolean activateErrorPanel, boolean i
135136
progressBar = new JProgressBar();
136137
progressBar.setVisible(false);
137138
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+
};
139148
loaderLabel = new JLabel(Toolkit.getLibIcon("manager/loader.gif"));
140149
loaderLabel.setOpaque(false);
141150
loaderLabel.setBackground(Color.WHITE);
@@ -188,6 +197,7 @@ public void actionPerformed(ActionEvent arg0) {
188197
189198
});*/
190199

200+
int catChooserWidth = ContributionManagerDialog.AUTHOR_WIDTH + contributionListPanel.scrollPane.getVerticalScrollBar().getPreferredSize().width - 10;
191201

192202
GroupLayout layout = new GroupLayout(panel);
193203
panel.setLayout(layout);
@@ -206,9 +216,9 @@ public void actionPerformed(ActionEvent arg0) {
206216
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
207217
GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
208218
.addComponent(categoryChooser,
209-
ContributionManagerDialog.AUTHOR_WIDTH - 10,
210-
ContributionManagerDialog.AUTHOR_WIDTH - 10,
211-
ContributionManagerDialog.AUTHOR_WIDTH - 10)
219+
catChooserWidth,
220+
catChooserWidth,
221+
catChooserWidth)
212222
.addContainerGap()).addComponent(loaderLabel)
213223
.addComponent(contributionListPanel).addComponent(errorPanel)
214224
.addComponent(statusPanel));
@@ -373,6 +383,7 @@ protected void updateContributionListing() {
373383

374384
List<Library> libraries =
375385
new ArrayList<Library>(editor.getMode().contribLibraries);
386+
libraries.addAll(editor.getMode().coreLibraries);
376387
contributions.addAll(libraries);
377388

378389
//ArrayList<ToolContribution> tools = editor.contribTools;

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL