Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Renamed Examples-Packages to Examples
  • Loading branch information
joelmoniz committed Nov 17, 2014
1 parent b5096c4 commit 31a186a
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 49 deletions.
16 changes: 8 additions & 8 deletions app/src/processing/app/Base.java
Expand Up @@ -121,7 +121,7 @@ public class Base {
private Mode[] coreModes;
protected ArrayList<ModeContribution> modeContribs;

protected ArrayList<ExamplesPackageContribution> exampleContribs;
protected ArrayList<ExamplesContribution> exampleContribs;

private JMenu sketchbookMenu;

Expand Down Expand Up @@ -321,9 +321,9 @@ void rebuildContribModes() {
*/
void rebuildContribExamples() {
if (exampleContribs == null) {
exampleContribs = new ArrayList<ExamplesPackageContribution>();
exampleContribs = new ArrayList<ExamplesContribution>();
}
ExamplesPackageContribution.loadMissing(this);
ExamplesContribution.loadMissing(this);
}


Expand Down Expand Up @@ -376,7 +376,7 @@ public Base(String[] args) throws Exception {
modeManagerFrame =
new ContributionManagerDialog(ContributionType.MODE);
exampleManagerFrame =
new ContributionManagerDialog(ContributionType.EXAMPLES_PACKAGE);
new ContributionManagerDialog(ContributionType.EXAMPLES);
updateManagerFrame =
new ContributionManagerDialog(null);

Expand Down Expand Up @@ -496,7 +496,7 @@ public ArrayList<Mode> getModeList() {
}


public ArrayList<ExamplesPackageContribution> getExampleContribs() {
public ArrayList<ExamplesContribution> getExampleContribs() {
return exampleContribs;
}

Expand Down Expand Up @@ -1673,7 +1673,7 @@ static public void locateSketchbookFolder() {
getSketchbookLibrariesFolder().mkdir();
getSketchbookToolsFolder().mkdir();
getSketchbookModesFolder().mkdir();
getSketchbookExamplesPackagesFolder().mkdir();
getSketchbookExamplesFolder().mkdir();
// System.err.println("sketchbook: " + sketchbookFolder);
}

Expand Down Expand Up @@ -1705,8 +1705,8 @@ static public File getSketchbookModesFolder() {
}


static public File getSketchbookExamplesPackagesFolder() {
return new File(sketchbookFolder, "examples-packages");
static public File getSketchbookExamplesFolder() {
return new File(sketchbookFolder, "examples");
}


Expand Down
10 changes: 5 additions & 5 deletions app/src/processing/app/Mode.java
Expand Up @@ -37,7 +37,7 @@
import javax.swing.tree.*;

import processing.app.contrib.ContributionType;
import processing.app.contrib.ExamplesPackageContribution;
import processing.app.contrib.ExamplesContribution;
import processing.app.syntax.*;
import processing.core.PApplet;

Expand Down Expand Up @@ -108,7 +108,7 @@ public Mode(Base base, File folder) {
referenceFolder = new File(folder, "reference");

// Get path to the contributed examples compatible with this mode
examplesContribFolder = Base.getSketchbookExamplesPackagesFolder();
examplesContribFolder = Base.getSketchbookExamplesFolder();

// rebuildToolbarMenu();
rebuildLibraryList();
Expand Down Expand Up @@ -688,19 +688,19 @@ public DefaultMutableTreeNode buildContributedExamplesTrees() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("Contributed Examples");

try {
File[] subfolders = ContributionType.EXAMPLES_PACKAGE.listCandidates(examplesContribFolder);
File[] subfolders = ContributionType.EXAMPLES.listCandidates(examplesContribFolder);
if (subfolders == null) {
subfolders = new File[0]; //empty array
}
for (File sub : subfolders) {
if (!ExamplesPackageContribution.isExamplesPackageCompatible(base, sub))
if (!ExamplesContribution.isExamplesCompatible(base, sub))
continue;
DefaultMutableTreeNode subNode = new DefaultMutableTreeNode(sub.getName());
if (base.addSketches(subNode, sub)) {
node.add(subNode);
int exampleNodeNumber = -1;
for (int y = 0; y < subNode.getChildCount(); y++)
if (subNode.getChildAt(y).toString().equals("examples-package"))
if (subNode.getChildAt(y).toString().equals("examples"))
exampleNodeNumber = y;
if (exampleNodeNumber == -1)
continue;
Expand Down
4 changes: 2 additions & 2 deletions app/src/processing/app/contrib/AvailableContribution.java
Expand Up @@ -288,7 +288,7 @@ public boolean writePropertiesFile(File propFile) {

String compatibleContribsList = null;

if (getType() == ContributionType.EXAMPLES_PACKAGE) {
if (getType() == ContributionType.EXAMPLES) {
compatibleContribsList = properties.get("compatibleModesList");
}

Expand Down Expand Up @@ -336,7 +336,7 @@ public boolean writePropertiesFile(File propFile) {
writer.println("lastUpdated=" + lastUpdated);
writer.println("minRevision=" + minRev);
writer.println("maxRevision=" + maxRev);
if (getType() == ContributionType.EXAMPLES_PACKAGE) {
if (getType() == ContributionType.EXAMPLES) {
writer.println("compatibleModesList=" + compatibleContribsList);
}

Expand Down
8 changes: 4 additions & 4 deletions app/src/processing/app/contrib/ContributionManagerDialog.java
Expand Up @@ -80,9 +80,9 @@ else if (type == ContributionType.LIBRARY) {
title = Language.text("contrib.manager_title.library");
compatibleCheckboxLabel = Language.text("contrib.show_only_compatible.library");
}
else if (type == ContributionType.EXAMPLES_PACKAGE) {
title = Language.text("contrib.manager_title.examples-package");
compatibleCheckboxLabel = Language.text("contrib.show_only_compatible.examples-package");
else if (type == ContributionType.EXAMPLES) {
title = Language.text("contrib.manager_title.examples");
compatibleCheckboxLabel = Language.text("contrib.show_only_compatible.examples");
}

filter = type.createFilter();
Expand Down Expand Up @@ -437,7 +437,7 @@ protected void updateContributionListing() {
ArrayList<ModeContribution> modes = editor.getBase().getModeContribs();
contributions.addAll(modes);

ArrayList<ExamplesPackageContribution> examples = editor.getBase().getExampleContribs();
ArrayList<ExamplesContribution> examples = editor.getBase().getExampleContribs();
contributions.addAll(examples);

// ArrayList<LibraryCompilation> compilations = LibraryCompilation.list(libraries);
Expand Down
26 changes: 13 additions & 13 deletions app/src/processing/app/contrib/ContributionType.java
Expand Up @@ -31,7 +31,7 @@
import processing.app.Library;

public enum ContributionType {
LIBRARY, TOOL, MODE, EXAMPLES_PACKAGE;
LIBRARY, TOOL, MODE, EXAMPLES;


public String toString() {
Expand All @@ -42,8 +42,8 @@ public String toString() {
return "tool";
case MODE:
return "mode";
case EXAMPLES_PACKAGE:
return "examples-package";
case EXAMPLES:
return "examples";
}
return null; // should be unreachable
};
Expand All @@ -55,7 +55,7 @@ public String toString() {
*/
public String getTitle() {
String s = toString();
if (this == EXAMPLES_PACKAGE)
if (this == EXAMPLES)
return Character.toUpperCase(s.charAt(0))
+ s.substring(1, s.indexOf('-') + 1)
+ Character.toUpperCase(s.charAt(s.indexOf('-') + 1))
Expand All @@ -73,8 +73,8 @@ public String getFolderName() {
return "tools";
case MODE:
return "modes";
case EXAMPLES_PACKAGE:
return "examples-package";
case EXAMPLES:
return "examples";
}
return null; // should be unreachable
}
Expand Down Expand Up @@ -116,8 +116,8 @@ static public ContributionType fromName(String s) {
if ("mode".equalsIgnoreCase(s)) {
return MODE;
}
if ("examples-package".equalsIgnoreCase(s)) {
return EXAMPLES_PACKAGE;
if ("examples".equalsIgnoreCase(s)) {
return EXAMPLES;
}
}
return null;
Expand All @@ -132,8 +132,8 @@ public File getSketchbookFolder() {
return Base.getSketchbookToolsFolder();
case MODE:
return Base.getSketchbookModesFolder();
case EXAMPLES_PACKAGE:
return Base.getSketchbookExamplesPackagesFolder();
case EXAMPLES:
return Base.getSketchbookExamplesFolder();
}
return null;
}
Expand Down Expand Up @@ -196,8 +196,8 @@ LocalContribution load(Base base, File folder) {
return ToolContribution.load(folder);
case MODE:
return ModeContribution.load(base, folder);
case EXAMPLES_PACKAGE:
return ExamplesPackageContribution.load(folder);
case EXAMPLES:
return ExamplesContribution.load(folder);
}
return null;
}
Expand All @@ -215,7 +215,7 @@ ArrayList<LocalContribution> listContributions(Editor editor) {
case MODE:
contribs.addAll(editor.getBase().getModeContribs());
break;
case EXAMPLES_PACKAGE:
case EXAMPLES:
contribs.addAll(editor.getBase().getExampleContribs());
break;
}
Expand Down
Expand Up @@ -7,15 +7,15 @@
import processing.app.Base;
import processing.core.PApplet;

public class ExamplesPackageContribution extends LocalContribution {
public class ExamplesContribution extends LocalContribution {

private ArrayList<String> compatibleModesList;

static public ExamplesPackageContribution load(File folder) {
return new ExamplesPackageContribution(folder);
static public ExamplesContribution load(File folder) {
return new ExamplesContribution(folder);
}

private ExamplesPackageContribution(File folder) {
private ExamplesContribution(File folder) {
super(folder);
compatibleModesList = parseCompatibleModesList(properties
.get("compatibleModesList"));
Expand All @@ -40,10 +40,10 @@ private static ArrayList<String> parseCompatibleModesList(String unparsedModes)
* @return true if the example is compatible with the mode of the currently
* active editor
*/
public static boolean isExamplesPackageCompatible(Base base,
public static boolean isExamplesCompatible(Base base,
File exampleLocationFolder) {
File propertiesFile = new File(exampleLocationFolder,
ContributionType.EXAMPLES_PACKAGE.toString()
ContributionType.EXAMPLES.toString()
+ ".properties");
if (propertiesFile.exists()) {
ArrayList<String> compModesList = parseCompatibleModesList(Base
Expand All @@ -58,28 +58,28 @@ public static boolean isExamplesPackageCompatible(Base base,
}

static public void loadMissing(Base base) {
File examplesFolder = Base.getSketchbookExamplesPackagesFolder();
ArrayList<ExamplesPackageContribution> contribExamples = base.getExampleContribs();
File examplesFolder = Base.getSketchbookExamplesFolder();
ArrayList<ExamplesContribution> contribExamples = base.getExampleContribs();

HashMap<File, ExamplesPackageContribution> existing = new HashMap<File, ExamplesPackageContribution>();
for (ExamplesPackageContribution contrib : contribExamples) {
HashMap<File, ExamplesContribution> existing = new HashMap<File, ExamplesContribution>();
for (ExamplesContribution contrib : contribExamples) {
existing.put(contrib.getFolder(), contrib);
}
File[] potential = ContributionType.EXAMPLES_PACKAGE.listCandidates(examplesFolder);
File[] potential = ContributionType.EXAMPLES.listCandidates(examplesFolder);
// If modesFolder does not exist or is inaccessible (folks might like to
// mess with folders then report it as a bug) 'potential' will be null.
if (potential != null) {
for (File folder : potential) {
if (!existing.containsKey(folder)) {
contribExamples.add(new ExamplesPackageContribution(folder));
contribExamples.add(new ExamplesContribution(folder));
}
}
}
}

@Override
public ContributionType getType() {
return ContributionType.EXAMPLES_PACKAGE;
return ContributionType.EXAMPLES;
}

public ArrayList<String> getCompatibleModesList() {
Expand Down
4 changes: 2 additions & 2 deletions build/shared/lib/languages/PDE.properties
Expand Up @@ -342,13 +342,13 @@ contrib.manager_title.update = Update Manager
contrib.manager_title.mode = Mode Manager
contrib.manager_title.tool = Tool Manager
contrib.manager_title.library = Library Manager
contrib.manager_title.examples-package = Examples-Package Manager
contrib.manager_title.examples = Examples Manager
contrib.category = Category:
contrib.filter_your_search = Filter your search...
contrib.show_only_compatible.mode = Show Only Compatible Modes
contrib.show_only_compatible.tool = Show Only Compatible Tools
contrib.show_only_compatible.library = Show Only Compatible Libraries
contrib.show_only_compatible.examples-package = Show Only Compatible Examples
contrib.show_only_compatible.examples = Show Only Compatible Examples
contrib.show_only_compatible.update = Show Only Compatible Updates
contrib.restart = Restart Processing
contrib.unsaved_changes = Unsaved changes have been found
Expand Down
2 changes: 1 addition & 1 deletion build/shared/lib/languages/PDE_de.properties
Expand Up @@ -333,7 +333,7 @@ contrib.filter_your_search = Suche filtern ...
contrib.show_only_compatible.mode = Zeige nur kompatible Modes an
contrib.show_only_compatible.tool = Zeige nur kompatible Tools an
contrib.show_only_compatible.library = Zeige nur kompatible Libraries an
contrib.show_only_compatible.examples-package = Zeige nur kompatible Beispiele an
contrib.show_only_compatible.examples = Zeige nur kompatible Beispiele an
contrib.show_only_compatible.update = Zeige nur kompatible Updates an
contrib.restart = Neustart von Processing
contrib.unsaved_changes = Unsaved changes have been found
Expand Down
2 changes: 1 addition & 1 deletion build/shared/lib/languages/PDE_es.properties
Expand Up @@ -273,7 +273,7 @@ contrib.manager_title.update = Gestor de actualizaciones
contrib.manager_title.mode = Gestor de Modos
contrib.manager_title.tool = Gestor de Herramientas
contrib.manager_title.library = Gestor de Bibliotecas
contrib.manager_title.examples-package = Gestor de Paquetes de Ejemplo
contrib.manager_title.examples = Gestor de Paquetes de Ejemplo
contrib.category = Categoría:
contrib.filter_your_search = Filtrar tu búsqueda...
contrib.show_only_compatible.mode = Mostrar sólo modos compatibles
Expand Down

0 comments on commit 31a186a

Please sign in to comment.