@Override protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnOpenDir.id) { boolean success = false; try { Class c = Class.forName("java.awt.Desktop"); Object m = c.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]); c.getMethod("browse", new Class[] {URI.class}) .invoke(m, new Object[] {Settings.schematicDirectory.toURI()}); } catch (Throwable e) { success = true; } if (success) { Settings.logger.logInfo("Opening via Sys class!"); Sys.openURL("file://" + Settings.schematicDirectory.getAbsolutePath()); } } else if (guiButton.id == this.btnDone.id) { loadSchematic(); this.mc.displayGuiScreen(this.prevGuiScreen); } else { this.guiSchematicLoadSlot.actionPerformed(guiButton); } } }
@Override protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnOpenDir.id) { boolean retry = false; try { Class c = Class.forName("java.awt.Desktop"); Object m = c.getMethod("getDesktop").invoke(null); c.getMethod("browse", URI.class) .invoke(m, ConfigurationHandler.schematicDirectory.toURI()); } catch (Throwable e) { retry = true; } if (retry) { Reference.logger.info("Opening via Sys class!"); Sys.openURL("file://" + ConfigurationHandler.schematicDirectory.getAbsolutePath()); } } else if (guiButton.id == this.btnDone.id) { if (Schematica.proxy.isLoadEnabled) { loadSchematic(); } this.mc.displayGuiScreen(this.parentScreen); } else { this.guiSchematicLoadSlot.actionPerformed(guiButton); } } }
protected void actionPerformed(GuiButton guibutton) { if (!guibutton.enabled) { return; } if (guibutton.id == 5) { Sys.openURL((new StringBuilder()).append("file://").append(fileLocation).toString()); } else if (guibutton.id == 6) { mc.renderEngine.refreshTextures(); mc.displayGuiScreen(guiScreen); } else { guiTexturePackSlot.actionPerformed(guibutton); } }
/** * Fired when a control is clicked. This is the equivalent of * ActionListener.actionPerformed(ActionEvent e). */ protected void actionPerformed(GuiButton par1GuiButton) { if (par1GuiButton.enabled) { if (par1GuiButton.id == 5) { File var2 = GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c) .func_110612_e(); String var3 = var2.getAbsolutePath(); if (Util.func_110647_a() == EnumOS.MACOS) { try { this.mc.getLogAgent().logInfo(var3); Runtime.getRuntime().exec(new String[] {"/usr/bin/open", var3}); return; } catch (IOException var9) { var9.printStackTrace(); } } else if (Util.func_110647_a() == EnumOS.WINDOWS) { String var4 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {var3}); try { Runtime.getRuntime().exec(var4); return; } catch (IOException var8) { var8.printStackTrace(); } } boolean var10 = false; try { Class var5 = Class.forName("java.awt.Desktop"); Object var6 = var5.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]); var5.getMethod("browse", new Class[] {URI.class}) .invoke(var6, new Object[] {var2.toURI()}); } catch (Throwable var7) { var7.printStackTrace(); var10 = true; } if (var10) { this.mc.getLogAgent().logInfo("Opening via system class!"); Sys.openURL("file://" + var3); } } else if (par1GuiButton.id == 6) { this.mc.displayGuiScreen(this.field_110347_a); } else { this.field_110346_c.actionPerformed(par1GuiButton); } } }
protected void func_73875_a(GuiButton p_73875_1_) { if (p_73875_1_.field_73742_g) { if (p_73875_1_.field_73741_f == 5) { if (Minecraft.func_71376_c() == EnumOS.MACOS) { try { this.field_73882_e.func_98033_al().func_98233_a(this.field_73966_c); Runtime.getRuntime().exec(new String[] {"/usr/bin/open", this.field_73966_c}); return; } catch (IOException var7) { var7.printStackTrace(); } } else if (Minecraft.func_71376_c() == EnumOS.WINDOWS) { String var2 = String.format( "cmd.exe /C start \"Open file\" \"%s\"", new Object[] {this.field_73966_c}); try { Runtime.getRuntime().exec(var2); return; } catch (IOException var6) { var6.printStackTrace(); } } boolean var8 = false; try { Class var3 = Class.forName("java.awt.Desktop"); Object var4 = var3.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]); var3.getMethod("browse", new Class[] {URI.class}) .invoke( var4, new Object[] {(new File(Minecraft.func_71380_b(), "texturepacks")).toURI()}); } catch (Throwable var5) { var5.printStackTrace(); var8 = true; } if (var8) { this.field_73882_e.func_98033_al().func_98233_a("Opening via system class!"); Sys.openURL("file://" + this.field_73966_c); } } else if (p_73875_1_.field_73741_f == 6) { this.field_73882_e.func_71373_a(this.field_73967_a); } else { this.field_73964_d.func_77219_a(p_73875_1_); } } }
/** * Fired when a control is clicked. This is the equivalent of * ActionListener.actionPerformed(ActionEvent e). */ protected void actionPerformed(GuiButton par1GuiButton) { if (par1GuiButton.enabled) { if (par1GuiButton.id == 5) { if (Minecraft.getOs() == EnumOS.MACOS) { try { this.mc.getLogAgent().logInfo(this.fileLocation); Runtime.getRuntime().exec(new String[] {"/usr/bin/open", this.fileLocation}); return; } catch (IOException var7) { var7.printStackTrace(); } } else if (Minecraft.getOs() == EnumOS.WINDOWS) { String var2 = String.format( "cmd.exe /C start \"Open file\" \"%s\"", new Object[] {this.fileLocation}); try { Runtime.getRuntime().exec(var2); return; } catch (IOException var6) { var6.printStackTrace(); } } boolean var8 = false; try { Class var3 = Class.forName("java.awt.Desktop"); Object var4 = var3.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]); var3.getMethod("browse", new Class[] {URI.class}) .invoke( var4, new Object[] {(new File(Minecraft.getMinecraftDir(), "texturepacks")).toURI()}); } catch (Throwable var5) { var5.printStackTrace(); var8 = true; } if (var8) { this.mc.getLogAgent().logInfo("Opening via system class!"); Sys.openURL("file://" + this.fileLocation); } } else if (par1GuiButton.id == 6) { this.mc.displayGuiScreen(this.guiScreen); } else { this.guiTexturePackSlot.actionPerformed(par1GuiButton); } } }
@Override protected void actionPerformed(GuiButton button) { UpdateManagerMod mod = null; if (selected >= 0) mod = mods.get(getSelected()); if (button.enabled) switch (button.id) { case 0: { ModLoader.openGUI( ModLoader.getMinecraftInstance().thePlayer, new GuiModListWithUMButton(parentGui)); break; } case 1: { UpdateManager.openWebpage(UpdateManager.umWebpage); break; } case 2: { try { URL url = new URL("https://dl.dropbox.com/u/43671482/Update%20Manager/MotW.txt"); BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream())); UpdateManager.openWebpage(r.readLine()); } catch (IOException e) { e.printStackTrace(); } break; } case 3: { ModLoader.openGUI(ModLoader.getMinecraftInstance().thePlayer, new GuiSettings(this)); break; } case 4: { UpdateManager.openWebpage(mod.getModURL()); break; } case 5: { ModLoader.openGUI( ModLoader.getMinecraftInstance().thePlayer, new GuiChangelog(this, mod)); break; } case 6: { if (mod.getDisclaimerURL() == null) { if (!ThreadDownloadMod.downloadings.contains(mod.getModName())) { new ThreadDownloadMod(mod.getDirectDownloadURL(), mod); button.enabled = false; } } else ModLoader.openGUI( ModLoader.getMinecraftInstance().thePlayer, new GuiDisclaimer(this, mod)); break; } case 7: { Sys.openURL( "file://" + new File(Minecraft.getMinecraftDir(), "downloadedMods").getAbsolutePath()); break; } case 8: { mod.onSpecialButtonClicked(); break; } } super.actionPerformed(button); }
@Override public boolean openURI(String URI) { return Sys.openURL(URI); }