diff options
author | David Schweinsberg <[email protected]> | 2015-12-16 00:20:53 -0800 |
---|---|---|
committer | David Schweinsberg <[email protected]> | 2015-12-16 00:20:53 -0800 |
commit | c7ac6c8d031aaafd9a5301b78a2b7f43b594f9ab (patch) | |
tree | 1d7a9506a10d07f8601f268f536a53725e4071f9 | |
parent | f8a7f607c81a3e74fd992984a502ebfc0d4d6bbb (diff) |
More cleanup
-rw-r--r-- | src/net/java/dev/typecast/app/editor/Main.java | 14 | ||||
-rw-r--r-- | src/net/java/dev/typecast/app/editor/Main.properties | 4 | ||||
-rw-r--r-- | src/net/java/dev/typecast/app/editor/OSXAdapter.java | 25 |
3 files changed, 12 insertions, 31 deletions
diff --git a/src/net/java/dev/typecast/app/editor/Main.java b/src/net/java/dev/typecast/app/editor/Main.java index 942e971..a427e3b 100644 --- a/src/net/java/dev/typecast/app/editor/Main.java +++ b/src/net/java/dev/typecast/app/editor/Main.java @@ -28,7 +28,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; -import java.util.List; import java.util.ResourceBundle; import java.util.prefs.Preferences; import javax.swing.JFileChooser; @@ -45,7 +44,6 @@ import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; -import net.java.dev.typecast.app.framework.EditorView; import net.java.dev.typecast.edit.CharacterMap; import net.java.dev.typecast.exchange.Exporter; import net.java.dev.typecast.exchange.SVGExporter; @@ -73,18 +71,6 @@ public class Main { private OTFont _selectedFont = null; private TableTreeNode _selectedCollectionNode; - private class ModelViewPair { - Class _model; - Class<EditorView> _view; - ModelViewPair(Class model, Class<EditorView> view) { - _model = model; - _view = view; - } - } - - private List<ModelViewPair> _modelViewPairs = - new ArrayList<>(); - /** * Typecast constructor. */ diff --git a/src/net/java/dev/typecast/app/editor/Main.properties b/src/net/java/dev/typecast/app/editor/Main.properties index 4d4cdf2..7de32db 100644 --- a/src/net/java/dev/typecast/app/editor/Main.properties +++ b/src/net/java/dev/typecast/app/editor/Main.properties @@ -1,9 +1,7 @@ # -# $Id: Main.properties,v 1.6 2007-02-08 04:27:07 davidsch Exp $ -# # Typecast - The Font Development Environment # -# Copyright (c) 2004-2007 David Schweinsberg +# Copyright (c) 2004-2015 David Schweinsberg # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/net/java/dev/typecast/app/editor/OSXAdapter.java b/src/net/java/dev/typecast/app/editor/OSXAdapter.java index 6de5aba..f8412b0 100644 --- a/src/net/java/dev/typecast/app/editor/OSXAdapter.java +++ b/src/net/java/dev/typecast/app/editor/OSXAdapter.java @@ -59,7 +59,6 @@ Copyright � 2003-2007 Apple, Inc., All Rights Reserved package net.java.dev.typecast.app.editor; import java.lang.reflect.*; -import java.util.HashMap; public class OSXAdapter implements InvocationHandler { @@ -87,10 +86,9 @@ public class OSXAdapter implements InvocationHandler { // com.apple.eawt.Application reflectively try { Method enableAboutMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledAboutMenu", new Class[] { boolean.class }); - enableAboutMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enableAboutMenu) }); - } catch (Exception ex) { + enableAboutMethod.invoke(macOSXApplication, new Object[] { enableAboutMenu}); + } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { System.err.println("OSXAdapter could not access the About Menu"); - ex.printStackTrace(); } } @@ -105,10 +103,9 @@ public class OSXAdapter implements InvocationHandler { // com.apple.eawt.Application reflectively try { Method enablePrefsMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledPreferencesMenu", new Class[] { boolean.class }); - enablePrefsMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enablePrefsMenu) }); - } catch (Exception ex) { + enablePrefsMethod.invoke(macOSXApplication, new Object[] { enablePrefsMenu }); + } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { System.err.println("OSXAdapter could not access the About Menu"); - ex.printStackTrace(); } } @@ -119,13 +116,14 @@ public class OSXAdapter implements InvocationHandler { setHandler(new OSXAdapter("handleOpenFile", target, fileHandler) { // Override OSXAdapter.callTarget to send information on the // file to be opened + @Override public boolean callTarget(Object appleEvent) { if (appleEvent != null) { try { Method getFilenameMethod = appleEvent.getClass().getDeclaredMethod("getFilename", (Class[])null); String filename = (String) getFilenameMethod.invoke(appleEvent, (Object[])null); this.targetMethod.invoke(this.targetObject, new Object[] { filename }); - } catch (Exception ex) { + } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { } } @@ -148,9 +146,8 @@ public class OSXAdapter implements InvocationHandler { addListenerMethod.invoke(macOSXApplication, new Object[] { osxAdapterProxy }); } catch (ClassNotFoundException cnfe) { System.err.println("This version of Mac OS X does not support the Apple EAWT. ApplicationEvent handling has been disabled (" + cnfe + ")"); - } catch (Exception ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods + } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods System.err.println("Mac OS X Adapter could not talk to EAWT:"); - ex.printStackTrace(); } } @@ -170,11 +167,12 @@ public class OSXAdapter implements InvocationHandler { if (result == null) { return true; } - return Boolean.valueOf(result.toString()).booleanValue(); + return Boolean.valueOf(result.toString()); } // InvocationHandler implementation // This is the entry point for our proxy object; it is called every time an ApplicationListener method is invoked + @Override public Object invoke (Object proxy, Method method, Object[] args) throws Throwable { if (isCorrectMethod(method, args)) { boolean handled = callTarget(args[0]); @@ -197,10 +195,9 @@ public class OSXAdapter implements InvocationHandler { try { Method setHandledMethod = event.getClass().getDeclaredMethod("setHandled", new Class[] { boolean.class }); // If the target method returns a boolean, use that as a hint - setHandledMethod.invoke(event, new Object[] { Boolean.valueOf(handled) }); - } catch (Exception ex) { + setHandledMethod.invoke(event, new Object[] { handled}); + } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { System.err.println("OSXAdapter was unable to handle an ApplicationEvent: " + event); - ex.printStackTrace(); } } } |