remove unused imports, use constant instead of text

This commit is contained in:
Ben Fry
2015-07-14 11:15:23 -04:00
parent edff04495a
commit 005bd4b7d9
2 changed files with 26 additions and 27 deletions

View File

@@ -52,7 +52,7 @@ public class ContributionTab {
JButton restartButton;
JLabel categoryLabel;
JLabel loaderLabel;
JPanel errorPanel;
JTextPane errorMessage;
JButton tryAgainButton;
@@ -62,7 +62,7 @@ public class ContributionTab {
Editor editor;
String category;
ContributionListing contribListing;
JProgressBar progressBar;
@@ -112,8 +112,8 @@ public class ContributionTab {
// panel.add(filler);
// return panel;
// }
public void showFrame(final Editor editor, boolean activateErrorPanel,
@@ -140,7 +140,7 @@ public class ContributionTab {
loaderLabel.setOpaque(false);
loaderLabel.setBackground(Color.WHITE);
}
/*restartButton = new JButton(Language.text("contrib.restart"));
restartButton.setVisible(false);
restartButton.addActionListener(new ActionListener() {
@@ -188,7 +188,7 @@ public class ContributionTab {
});*/
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateContainerGaps(true);
@@ -214,7 +214,7 @@ public class ContributionTab {
}
/** Creates and arranges the Swing components in the dialog.
/** Creates and arranges the Swing components in the dialog.
*/
private void createComponents() {
@@ -222,9 +222,9 @@ public class ContributionTab {
categoryChooser = new JComboBox<String>();
categoryChooser.setMaximumRowCount(20);
updateCategoryChooser();
categoryChooser.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
category = (String) categoryChooser.getSelectedItem();
@@ -237,9 +237,9 @@ public class ContributionTab {
});
filterField = new FilterField();
buildErrorPanel();
}
private void buildErrorPanel(){
errorPanel = new JPanel();
@@ -254,17 +254,17 @@ public class ContributionTab {
+ "Please verify your network connection again, then try connecting again.");
errorMessage.setMaximumSize(new Dimension(450, 50));
errorMessage.setOpaque(false);
StyledDocument doc = errorMessage.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
doc.setParagraphAttributes(0, doc.getLength(), center, false);
closeButton = new JButton("X");
closeButton.setOpaque(false);
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
contributionManagerDialog.makeAndShowTab(false, false);
@@ -272,7 +272,7 @@ public class ContributionTab {
});
tryAgainButton = new JButton("Try Again");
tryAgainButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
contributionManagerDialog.makeAndShowTab(false, true);
@@ -307,11 +307,12 @@ public class ContributionTab {
// }
Collections.sort(categories);
// categories.add(0, ContributionManagerDialog.ANY_CATEGORY);
@SuppressWarnings("unused")
boolean categoriesFound = false;
categoryChooser.addItem(ContributionManagerDialog.ANY_CATEGORY);
for (String s : categories) {
categoryChooser.addItem(s);
if (!s.equals("Unknown")) {
if (!s.equals(Contribution.UNKNOWN_CATEGORY)) {
categoriesFound = true;
}
}
@@ -372,7 +373,7 @@ public class ContributionTab {
}
protected void setFilterText(String filter) {
if (filter == null || filter.isEmpty()) {

View File

@@ -28,13 +28,11 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import processing.app.Base;
import processing.app.Mode;
import processing.app.contrib.LocalContribution.IgnorableException;
public class ModeContribution extends LocalContribution {
@@ -180,9 +178,9 @@ public class ModeContribution extends LocalContribution {
ModeContribution other = (ModeContribution) o;
return loader.equals(other.loader) && mode.equals(other.getMode());
}
public String initLoader(Base base, String className) throws Exception {
File modeDirectory = new File(folder, getTypeName());
if (modeDirectory.exists()) {
Base.log("checking mode folder regarding " + className);
@@ -202,18 +200,18 @@ public class ModeContribution extends LocalContribution {
" class inside " + mainJar.getAbsolutePath());
}
}
ArrayList<URL> extraUrls = new ArrayList<>();
if (imports != null && imports.size() > 0) {
// if the mode has any dependencies (defined as imports in mode.properties),
// add the dependencies to the classloader
HashMap<String, Mode> installedModes = new HashMap<>();
for(Mode m: base.getModeList()){
// Base.log("Mode contrib: " + m.getClass().getName() + " : "+ m.getFolder());
installedModes.put(m.getClass().getName(), m);
}
for(String modeImport: imports){
if (installedModes.containsKey(modeImport)) {
Base.log("Found mode dependency " + modeImport);
@@ -237,13 +235,13 @@ public class ModeContribution extends LocalContribution {
if (archives != null && archives.length > 0) {
int arrLen = archives.length + extraUrls.size();
URL[] urlList = new URL[arrLen];
int j = 0;
for (; j < extraUrls.size(); j++) {
//Base.log("Found archive " + archives[j] + " for " + getName());
urlList[j] = extraUrls.get(j);
}
for (int k = 0; k < archives.length; k++,j++) {
Base.log("Found archive " + archives[k] + " for " + getName());
urlList[j] = archives[k].toURI().toURL();