mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
I just...
This commit is contained in:
@@ -30,6 +30,7 @@ import javax.swing.SwingWorker;
|
||||
import processing.app.Base;
|
||||
import processing.app.Language;
|
||||
import processing.app.Messages;
|
||||
import processing.app.Settings;
|
||||
import processing.app.Util;
|
||||
import processing.app.ui.Editor;
|
||||
import processing.core.PApplet;
|
||||
@@ -58,7 +59,6 @@ public class ContributionManager {
|
||||
File dest, ContribProgressMonitor progress) {
|
||||
boolean success = false;
|
||||
try {
|
||||
|
||||
HttpURLConnection conn = (HttpURLConnection) source.openConnection();
|
||||
HttpURLConnection.setFollowRedirects(true);
|
||||
conn.setConnectTimeout(15 * 1000);
|
||||
@@ -250,25 +250,13 @@ public class ContributionManager {
|
||||
|
||||
if (contribution != null) {
|
||||
listing.replaceContribution(ad, contribution);
|
||||
// if (contribution.getType() == ContributionType.MODE) {
|
||||
// List<ModeContribution> contribModes = base.getModeContribs();
|
||||
// if (contribModes != null && !contribModes.contains(contribution)) {
|
||||
// contribModes.add((ModeContribution) contribution);
|
||||
// }
|
||||
// }
|
||||
// if (base.getActiveEditor() != null) {
|
||||
// refreshInstalled(base.getActiveEditor());
|
||||
// }
|
||||
base.refreshContribs(contribution.getType());
|
||||
}
|
||||
|
||||
contribZip.delete();
|
||||
|
||||
handleUpdateFailedMarkers(ad, filename.substring(0, filename.lastIndexOf('.')));
|
||||
|
||||
} catch (Exception e) {
|
||||
// Chuck the stack trace. The user might have no idea why it is appearing, or what (s)he did wrong...
|
||||
// e.printStackTrace();
|
||||
String arg = "contrib.startup.errors.download_install";
|
||||
System.err.println(Language.interpolate(arg, ad.getName()));
|
||||
}
|
||||
@@ -281,42 +269,47 @@ public class ContributionManager {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* After install, this function checks whether everything went properly or not.
|
||||
* If not, it adds a marker file so that the next time Processing is started, installPreviouslyFailed()
|
||||
* can install the contribution.
|
||||
* @param ac
|
||||
* The contribution just installed.
|
||||
* @param filename
|
||||
* The name of the folder in which the contribution is supposed to be stored.
|
||||
*/
|
||||
static private void handleUpdateFailedMarkers(final AvailableContribution ac, String filename) {
|
||||
/**
|
||||
* After install, this function checks whether everything went properly.
|
||||
* If not, it adds a marker file so that the next time Processing is started,
|
||||
* installPreviouslyFailed() can install the contribution.
|
||||
* @param c the contribution just installed
|
||||
* @param filename name of the folder for the contribution
|
||||
*/
|
||||
static private void handleUpdateFailedMarkers(final AvailableContribution c,
|
||||
String filename) {
|
||||
File typeFolder = c.getType().getSketchbookFolder();
|
||||
|
||||
File contribLocn = ac.getType().getSketchbookFolder();
|
||||
|
||||
for (File contribDir : contribLocn.listFiles())
|
||||
for (File contribDir : typeFolder.listFiles()) {
|
||||
if (contribDir.isDirectory()) {
|
||||
/*
|
||||
File[] contents = contribDir.listFiles(new FilenameFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File dir, String file) {
|
||||
return file.equals(ac.getType() + ".properties");
|
||||
return file.equals(c.getType() + ".properties");
|
||||
}
|
||||
});
|
||||
if (contents.length > 0 && Util.readSettings(contents[0]).get("name").equals(ac.getName())) {
|
||||
if (contents.length > 0 && Util.readSettings(contents[0]).get("name").equals(c.getName())) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
File propsFile = new File(contribDir, c.getType() + ".properties");
|
||||
if (propsFile.exists()) {
|
||||
StringDict props = Util.readSettings(propsFile);
|
||||
if (c.getName().equals(props.get("name"))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
new File(contribLocn, ac.getName()).createNewFile();
|
||||
} catch (IOException e) {
|
||||
// Again, forget about the stack trace. The user ain't done wrong
|
||||
// e.printStackTrace();
|
||||
String arg = "contrib.startup.errors.new_marker";
|
||||
System.err.println(Language.interpolate(arg, ac.getName()));
|
||||
}
|
||||
|
||||
try {
|
||||
new File(typeFolder, c.getName()).createNewFile();
|
||||
} catch (IOException e) {
|
||||
String arg = "contrib.startup.errors.new_marker";
|
||||
System.err.println(Language.interpolate(arg, c.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -169,25 +169,12 @@ public class ManagerFrame {
|
||||
updateTabLabel.setForeground(Color.BLACK);
|
||||
}
|
||||
getActiveTab().contributionListPanel.scrollPane.requestFocusInWindow();
|
||||
// // When the tab is changed update status to the current selected panel
|
||||
// ContributionPanel currentPanel = getActiveTab().contributionListPanel
|
||||
// .getSelectedPanel();
|
||||
// if (currentPanel != null) {
|
||||
// getActiveTab().contributionListPanel.setSelectedPanel(currentPanel);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
// GroupLayout layout = new GroupLayout(dialog.getContentPane());
|
||||
// dialog.getContentPane().setLayout(layout);
|
||||
frame.setResizable(true);
|
||||
// layout.setAutoCreateContainerGaps(true);
|
||||
// layout.setHorizontalGroup(layout.createParallelGroup().addComponent(tabbedPane));
|
||||
// layout.setVerticalGroup(layout.createParallelGroup().addComponent(tabbedPane));
|
||||
// layout.setHonorsVisibility(tabbedPane, true);
|
||||
tabbedPane.setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER));
|
||||
frame.getContentPane().add(tabbedPane);
|
||||
//TODO set color here
|
||||
frame.getContentPane().setBackground(new Color(0x132638));
|
||||
frame.validate();
|
||||
frame.repaint();
|
||||
@@ -370,6 +357,7 @@ public class ManagerFrame {
|
||||
}
|
||||
|
||||
|
||||
// TODO move this to ContributionTab (this is handled weirdly, period) [fry]
|
||||
void downloadAndUpdateContributionListing(Base base) {
|
||||
//activeTab is required now but should be removed
|
||||
//as there is only one instance of contribListing and it should be present in this class
|
||||
@@ -410,12 +398,12 @@ public class ManagerFrame {
|
||||
}
|
||||
|
||||
|
||||
void makeAndShowTab(boolean activateErrorPanel, boolean isLoading) {
|
||||
librariesTab.showFrame(editor, activateErrorPanel, isLoading);
|
||||
modesTab.showFrame(editor, activateErrorPanel, isLoading);
|
||||
toolsTab.showFrame(editor, activateErrorPanel, isLoading);
|
||||
examplesTab.showFrame(editor, activateErrorPanel, isLoading);
|
||||
updatesTab.showFrame(editor, activateErrorPanel, isLoading);
|
||||
void makeAndShowTab(boolean error, boolean loading) {
|
||||
librariesTab.showFrame(editor, error, loading);
|
||||
modesTab.showFrame(editor, error, loading);
|
||||
toolsTab.showFrame(editor, error, loading);
|
||||
examplesTab.showFrame(editor, error, loading);
|
||||
updatesTab.showFrame(editor, error, loading);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user