Skip to content

Commit 66ffcfc

Browse files
committed
a little more cleaning and clarifying
1 parent 799f24b commit 66ffcfc

File tree

1 file changed

+11
-57
lines changed

1 file changed

+11
-57
lines changed

app/src/processing/app/Mode.java

Lines changed: 11 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,6 @@ public abstract class Mode {
8383
*/
8484
protected ClassLoader classLoader;
8585

86-
// static final int BACKGROUND_WIDTH = 1025;
87-
// static final int BACKGROUND_HEIGHT = 65;
88-
// protected Image backgroundImage;
89-
90-
// public Mode(Base base, File folder) {
91-
// this(base, folder, base.getSketchbookLibrariesFolder());
92-
// }
93-
9486

9587
public Mode(Base base, File folder) {
9688
this.base = base;
@@ -186,51 +178,12 @@ public ClassLoader getClassLoader() {
186178
}
187179

188180

189-
// /**
190-
// * Setup additional elements that are only required when running with a GUI,
191-
// * rather than from the command-line. Note that this will not be called when
192-
// * the Mode is used from the command line (because Base will be null).
193-
// */
194-
/*
195-
public void setupGUI() {
196-
try {
197-
// First load the default theme data for the whole PDE.
198-
theme = new Settings(Platform.getContentFile("lib/theme.txt"));
199-
200-
// The mode-specific theme.txt file should only contain additions,
201-
// and in extremely rare cases, it might override entries from the
202-
// main theme. Do not override for style changes unless they are
203-
// objectively necessary for your Mode.
204-
File modeTheme = new File(folder, "theme/theme.txt");
205-
if (modeTheme.exists()) {
206-
// Override the built-in settings with what the theme provides
207-
theme.load(modeTheme);
208-
}
209-
210-
// Against my better judgment, adding the ability to override themes
211-
// https://github.com/processing/processing/issues/5445
212-
File sketchbookTheme =
213-
new File(Base.getSketchbookFolder(), "theme.txt");
214-
if (sketchbookTheme.exists()) {
215-
theme.load(sketchbookTheme);
216-
}
217-
218-
// other things that have to be set explicitly for the defaults
219-
theme.setColor("run.window.bgcolor", SystemColor.control);
220-
221-
} catch (IOException e) {
222-
Messages.showError("Problem loading theme.txt",
223-
"Could not load theme.txt, please re-install Processing", e);
224-
}
225-
}
226-
*/
227-
228-
229181
public File getContentFile(String path) {
230182
return new File(folder, path);
231183
}
232184

233185

186+
@SuppressWarnings("unused")
234187
public InputStream getContentStream(String path) throws FileNotFoundException {
235188
return new FileInputStream(getContentFile(path));
236189
}
@@ -429,6 +382,7 @@ public Library getLibrary(String pkgName) throws SketchException {
429382
// abstract public EditorToolbar createToolbar(Editor editor);
430383

431384

385+
@SuppressWarnings("unused")
432386
public JMenu getToolbarMenu() {
433387
if (toolbarMenu == null) {
434388
rebuildToolbarMenu();
@@ -752,8 +706,8 @@ protected TokenMarker createTokenMarker() {
752706
* For Processing, this is true for .pde files. (Broken out for subclasses.)
753707
* You can override this in your Mode subclass to handle it differently.
754708
*/
755-
public boolean hideExtension(String what) {
756-
return what.equals(getDefaultExtension());
709+
public boolean hideExtension(String ext) {
710+
return ext.equals(getDefaultExtension());
757711
}
758712

759713

@@ -768,21 +722,21 @@ public boolean isDefaultExtension(SketchCode code) {
768722
/**
769723
* True if the specified extension is the default file extension.
770724
*/
771-
public boolean isDefaultExtension(String what) {
772-
return what.equals(getDefaultExtension());
725+
public boolean isDefaultExtension(String ext) {
726+
return ext.equals(getDefaultExtension());
773727
}
774728

775729

776730
/**
777-
* @param f File to be checked against this mode's accepted extensions.
778-
* @return Whether the given file name features an extension supported by this Mode.
731+
* True if this Mode can edit this file (usually meaning that
732+
* its extension matches one that is supported by the Mode).
779733
*/
780-
public boolean canEdit(final File f) {
781-
final int dot = f.getName().lastIndexOf('.');
734+
public boolean canEdit(final File file) {
735+
final int dot = file.getName().lastIndexOf('.');
782736
if (dot < 0) {
783737
return false;
784738
}
785-
return validExtension(f.getName().substring(dot + 1));
739+
return validExtension(file.getName().substring(dot + 1));
786740
}
787741

788742

0 commit comments

Comments
 (0)