mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Initial
This commit is contained in:
@@ -101,18 +101,7 @@ public class ContributionManagerDialog {
|
||||
this.editor = editor;
|
||||
|
||||
// Calculating index to switch to the required tab
|
||||
int index;
|
||||
if (contributionType == ContributionType.LIBRARY) {
|
||||
index = 0;
|
||||
} else if (contributionType == ContributionType.MODE) {
|
||||
index = 1;
|
||||
} else if (contributionType == ContributionType.TOOL) {
|
||||
index = 2;
|
||||
} else if (contributionType == ContributionType.EXAMPLES) {
|
||||
index = 3;
|
||||
} else {
|
||||
index = 4;
|
||||
}
|
||||
int index = getIndex(contributionType);
|
||||
if (dialog == null) {
|
||||
makeFrame(editor);
|
||||
// done before as downloadAndUpdateContributionListing()
|
||||
@@ -134,6 +123,36 @@ public class ContributionManagerDialog {
|
||||
}
|
||||
|
||||
|
||||
int getIndex(ContributionType contributionType) {
|
||||
int index;
|
||||
if (contributionType == ContributionType.LIBRARY) {
|
||||
index = 0;
|
||||
} else if (contributionType == ContributionType.MODE) {
|
||||
index = 1;
|
||||
} else if (contributionType == ContributionType.TOOL) {
|
||||
index = 2;
|
||||
} else if (contributionType == ContributionType.EXAMPLES) {
|
||||
index = 3;
|
||||
} else {
|
||||
index = 4;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
ContributionTab getTab(ContributionType contributionType) {
|
||||
if (contributionType == ContributionType.LIBRARY) {
|
||||
return librariesContributionTab;
|
||||
} else if (contributionType == ContributionType.MODE) {
|
||||
return modesContributionTab;
|
||||
} else if (contributionType == ContributionType.TOOL) {
|
||||
return toolsContributionTab;
|
||||
} else if (contributionType == ContributionType.EXAMPLES) {
|
||||
return examplesContributionTab;
|
||||
}
|
||||
return updatesContributionTab;
|
||||
}
|
||||
|
||||
|
||||
private void makeFrame(final Editor editor) {
|
||||
dialog = new JFrame(title);
|
||||
dialog.setMinimumSize(new Dimension(750, 500));
|
||||
|
||||
@@ -237,6 +237,11 @@ class StatusPanel extends JPanel {
|
||||
|
||||
|
||||
public void update(ContributionPanel panel) {
|
||||
if(contributionTab.contributionManagerDialog.updatesContributionTab.contributionListPanel.panelByContribution.values().contains(panel)){
|
||||
System.out.println("same");
|
||||
}else{
|
||||
System.out.println("diff");
|
||||
}
|
||||
progressPanel.removeAll();
|
||||
|
||||
iconLabel.setIcon(panel.getContrib().isSpecial() ? foundationIcon : null);
|
||||
|
||||
@@ -2,6 +2,7 @@ package processing.app.contrib;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -297,6 +298,32 @@ public class UpdateContributionTab extends ContributionTab {
|
||||
}
|
||||
((UpdateStatusPanel)statusPanel).update();
|
||||
}
|
||||
@Override
|
||||
public void contributionAdded(final Contribution contribution) {
|
||||
if (filter.matches(contribution)) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ContributionPanel newPanel = contributionManagerDialog
|
||||
.getTab(contributionType).contributionListPanel.panelByContribution
|
||||
.get(contribution);
|
||||
if (newPanel == null) {
|
||||
newPanel = new ContributionPanel(UpdateContribListingPanel.this);
|
||||
}
|
||||
if (!panelByContribution.containsKey(contribution)) {
|
||||
synchronized (panelByContribution) {
|
||||
panelByContribution.put(contribution, newPanel);
|
||||
}
|
||||
}
|
||||
if (newPanel != null) {
|
||||
newPanel.setContribution(contribution);
|
||||
add(newPanel);
|
||||
updatePanelOrdering(panelByContribution.keySet());
|
||||
updateColors(); // XXX this is the place
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user