mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge pull request #2964 from joelmoniz/renameExaplesPackage
Renamed Examples-Package to Examples
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -321,9 +321,9 @@ public class Base {
|
||||
*/
|
||||
void rebuildContribExamples() {
|
||||
if (exampleContribs == null) {
|
||||
exampleContribs = new ArrayList<ExamplesPackageContribution>();
|
||||
exampleContribs = new ArrayList<ExamplesContribution>();
|
||||
}
|
||||
ExamplesPackageContribution.loadMissing(this);
|
||||
ExamplesContribution.loadMissing(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ public class Base {
|
||||
modeManagerFrame =
|
||||
new ContributionManagerDialog(ContributionType.MODE);
|
||||
exampleManagerFrame =
|
||||
new ContributionManagerDialog(ContributionType.EXAMPLES_PACKAGE);
|
||||
new ContributionManagerDialog(ContributionType.EXAMPLES);
|
||||
updateManagerFrame =
|
||||
new ContributionManagerDialog(null);
|
||||
|
||||
@@ -496,7 +496,7 @@ public class Base {
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<ExamplesPackageContribution> getExampleContribs() {
|
||||
public ArrayList<ExamplesContribution> getExampleContribs() {
|
||||
return exampleContribs;
|
||||
}
|
||||
|
||||
@@ -1673,7 +1673,7 @@ public class Base {
|
||||
getSketchbookLibrariesFolder().mkdir();
|
||||
getSketchbookToolsFolder().mkdir();
|
||||
getSketchbookModesFolder().mkdir();
|
||||
getSketchbookExamplesPackagesFolder().mkdir();
|
||||
getSketchbookExamplesFolder().mkdir();
|
||||
// System.err.println("sketchbook: " + sketchbookFolder);
|
||||
}
|
||||
|
||||
@@ -1705,8 +1705,8 @@ public class Base {
|
||||
}
|
||||
|
||||
|
||||
static public File getSketchbookExamplesPackagesFolder() {
|
||||
return new File(sketchbookFolder, "examples-packages");
|
||||
static public File getSketchbookExamplesFolder() {
|
||||
return new File(sketchbookFolder, "examples");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import javax.swing.plaf.basic.BasicTreeUI;
|
||||
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;
|
||||
|
||||
@@ -108,7 +108,7 @@ public abstract class Mode {
|
||||
referenceFolder = new File(folder, "reference");
|
||||
|
||||
// Get path to the contributed examples compatible with this mode
|
||||
examplesContribFolder = Base.getSketchbookExamplesPackagesFolder();
|
||||
examplesContribFolder = Base.getSketchbookExamplesFolder();
|
||||
|
||||
// rebuildToolbarMenu();
|
||||
rebuildLibraryList();
|
||||
@@ -688,19 +688,19 @@ public abstract class Mode {
|
||||
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;
|
||||
|
||||
@@ -288,7 +288,7 @@ class AvailableContribution extends Contribution {
|
||||
|
||||
String compatibleContribsList = null;
|
||||
|
||||
if (getType() == ContributionType.EXAMPLES_PACKAGE) {
|
||||
if (getType() == ContributionType.EXAMPLES) {
|
||||
compatibleContribsList = properties.get("compatibleModesList");
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ class AvailableContribution extends Contribution {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,9 +80,9 @@ public class ContributionManagerDialog {
|
||||
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();
|
||||
@@ -437,7 +437,7 @@ public class ContributionManagerDialog {
|
||||
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);
|
||||
|
||||
@@ -31,7 +31,7 @@ import processing.app.Editor;
|
||||
import processing.app.Library;
|
||||
|
||||
public enum ContributionType {
|
||||
LIBRARY, TOOL, MODE, EXAMPLES_PACKAGE;
|
||||
LIBRARY, TOOL, MODE, EXAMPLES;
|
||||
|
||||
|
||||
public String toString() {
|
||||
@@ -42,8 +42,8 @@ public enum ContributionType {
|
||||
return "tool";
|
||||
case MODE:
|
||||
return "mode";
|
||||
case EXAMPLES_PACKAGE:
|
||||
return "examples-package";
|
||||
case EXAMPLES:
|
||||
return "examples";
|
||||
}
|
||||
return null; // should be unreachable
|
||||
};
|
||||
@@ -55,7 +55,7 @@ public enum ContributionType {
|
||||
*/
|
||||
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))
|
||||
@@ -73,8 +73,8 @@ public enum ContributionType {
|
||||
return "tools";
|
||||
case MODE:
|
||||
return "modes";
|
||||
case EXAMPLES_PACKAGE:
|
||||
return "examples-package";
|
||||
case EXAMPLES:
|
||||
return "examples";
|
||||
}
|
||||
return null; // should be unreachable
|
||||
}
|
||||
@@ -116,8 +116,8 @@ public enum ContributionType {
|
||||
if ("mode".equalsIgnoreCase(s)) {
|
||||
return MODE;
|
||||
}
|
||||
if ("examples-package".equalsIgnoreCase(s)) {
|
||||
return EXAMPLES_PACKAGE;
|
||||
if ("examples".equalsIgnoreCase(s)) {
|
||||
return EXAMPLES;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -132,8 +132,8 @@ public enum ContributionType {
|
||||
return Base.getSketchbookToolsFolder();
|
||||
case MODE:
|
||||
return Base.getSketchbookModesFolder();
|
||||
case EXAMPLES_PACKAGE:
|
||||
return Base.getSketchbookExamplesPackagesFolder();
|
||||
case EXAMPLES:
|
||||
return Base.getSketchbookExamplesFolder();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -196,8 +196,8 @@ public enum ContributionType {
|
||||
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;
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public enum ContributionType {
|
||||
case MODE:
|
||||
contribs.addAll(editor.getBase().getModeContribs());
|
||||
break;
|
||||
case EXAMPLES_PACKAGE:
|
||||
case EXAMPLES:
|
||||
contribs.addAll(editor.getBase().getExampleContribs());
|
||||
break;
|
||||
}
|
||||
|
||||
+13
-13
@@ -7,15 +7,15 @@ import java.util.HashMap;
|
||||
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"));
|
||||
@@ -40,10 +40,10 @@ public class ExamplesPackageContribution extends LocalContribution {
|
||||
* @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
|
||||
@@ -58,20 +58,20 @@ public class ExamplesPackageContribution extends LocalContribution {
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class ExamplesPackageContribution extends LocalContribution {
|
||||
|
||||
@Override
|
||||
public ContributionType getType() {
|
||||
return ContributionType.EXAMPLES_PACKAGE;
|
||||
return ContributionType.EXAMPLES;
|
||||
}
|
||||
|
||||
public ArrayList<String> getCompatibleModesList() {
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user