2121Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2222*/
2323
24- package processing .mode . java ;
24+ package processing .app . ui ;
2525
2626import processing .app .Language ;
2727import processing .app .Platform ;
2828import processing .app .Preferences ;
2929import processing .app .SketchException ;
30- import processing .app .ui .ColorChooser ;
31- import processing .app .ui .Editor ;
30+ import processing .app .platform .MacPlatform ;
3231import processing .core .PApplet ;
3332import processing .data .StringDict ;
3433import processing .data .StringList ;
4140import java .awt .event .ActionListener ;
4241import java .awt .event .MouseAdapter ;
4342import java .awt .event .MouseEvent ;
44- import java .io .IOException ;
4543import java .util .ArrayList ;
4644import java .util .List ;
4745
4846
4947public class ExportPrompt {
5048 static final String MACOS_EXPORT_WIKI =
5149 "https://github.com/processing/processing4/wiki/Exporting-Applications#macos" ;
52- static final String EXPORT_VARIANTS = "export.application.variants" ;
50+ static public final String EXPORT_VARIANTS = "export.application.variants" ;
5351
5452 static public final String JAVA_DOWNLOAD_URL = "https://adoptium.net/" ;
5553
@@ -59,12 +57,14 @@ public class ExportPrompt {
5957 List <JCheckBox > variantButtons ;
6058
6159 final Editor editor ;
60+ final Runnable callback ;
6261
63- static ExportPrompt inst ;
62+ // static ExportPrompt inst;
6463
6564
66- private ExportPrompt (JavaEditor editor ) {
65+ public ExportPrompt (Editor editor , Runnable callback ) {
6766 this .editor = editor ;
67+ this .callback = callback ;
6868
6969 String pref = Preferences .get (EXPORT_VARIANTS );
7070 if (pref == null ) {
@@ -111,15 +111,7 @@ protected boolean anyExportButton() {
111111 }
112112
113113
114- static protected boolean trigger (JavaEditor editor ) throws IOException , SketchException {
115- if (inst == null ) {
116- inst = new ExportPrompt (editor );
117- }
118- return inst .trigger ();
119- }
120-
121-
122- protected boolean trigger () throws IOException , SketchException {
114+ public boolean trigger () throws SketchException {
123115 final JDialog dialog = new JDialog (editor , Language .text ("export" ), true );
124116
125117 JPanel panel = new JPanel ();
@@ -264,7 +256,7 @@ public void mousePressed(MouseEvent event) {
264256 "or they will be reported as damaged or unsafe. " ;
265257
266258 //if (false && new File("/usr/bin/codesign_allocate").exists()) {
267- if (JavaBuild .isXcodeInstalled ()) {
259+ if (MacPlatform .isXcodeInstalled ()) {
268260 thePain += "<br/>" +
269261 "This application will be “self-signed” which means that " +
270262 "macOS may complain that it comes from an unidentified developer. " +
@@ -293,14 +285,14 @@ public void mousePressed(MouseEvent event) {
293285
294286 area .addMouseListener (new MouseAdapter () {
295287 public void mousePressed (MouseEvent event ) {
296- if (JavaBuild .isXcodeInstalled ()) {
288+ if (MacPlatform .isXcodeInstalled ()) {
297289 Platform .openURL (MACOS_EXPORT_WIKI );
298290
299291 } else {
300292 // Launch the process asynchronously
301293 PApplet .exec ("xcode-select" , "--install" );
302294 // Reset the installed state so that the message will change.
303- JavaBuild .resetXcodeInstalled ();
295+ MacPlatform .resetXcodeInstalled ();
304296 // Close the window so that we can rebuild it with different text
305297 // once they've finished installing the Command Line Tools.
306298 dialog .setVisible (false );
@@ -349,7 +341,8 @@ public void mousePressed(MouseEvent event) {
349341
350342 Object value = optionPane .getValue ();
351343 if (value .equals (exportButton )) {
352- return ((JavaMode ) editor .getMode ()).handleExportApplication (editor .getSketch ());
344+ //return ((JavaMode) editor.getMode()).handleExportApplication(editor.getSketch());
345+ callback .run ();
353346 } else if (value .equals (cancelButton ) || value .equals (-1 )) {
354347 // closed window by hitting Cancel or ESC
355348 editor .statusNotice (Language .text ("export.notice.exporting.cancel" ));
0 commit comments