rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
handler.emitError ("File execution failed", "The installation was not completed"); | handler.emitError( "File execution failed", "The installation was not completed"); | public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java |
performUpdateChecks (updatechecks); | performUpdateChecks(updatechecks); | public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java |
} catch (Exception err) | } catch (Exception err) | public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java |
handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally | handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally | public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java |
instances.remove(instances.indexOf(this)); | instances.remove(instances.indexOf(this)); | public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java |
else if (OsVersion.IS_TRU64) | else if (OsVersion.IS_HPUX) | public static long getFreeSpace(String path) { long retval = -1; if (OsVersion.IS_WINDOWS) { String command = "cmd.exe"; if (System.getProperty("os.name").toLowerCase().indexOf("windows 9") > -1) return (-1); String[] params = { command, "/C", "\"dir /D /-C \"" + path + "\"\""}; String[] output = new String[2]; FileExecutor fe = new FileExecutor(); fe.executeCommand(params, output); retval = extractLong(output[0], -3, 3, "%"); } else if (OsVersion.IS_SUNOS) { String[] params = { "df", "-k", path}; String[] output = new String[2]; FileExecutor fe = new FileExecutor(); fe.executeCommand(params, output); retval = extractLong(output[0], -3, 3, "%") * 1024; } else if (OsVersion.IS_TRU64) { String[] params = { "bdf", path }; String[] output = new String[2]; FileExecutor fe = new FileExecutor(); fe.executeCommand(params, output); retval = extractLong(output[0], -3, 3, "%") * 1024; } else if (OsVersion.IS_UNIX) { String[] params = { "df", "-Pk", path}; String[] output = new String[2]; FileExecutor fe = new FileExecutor(); fe.executeCommand(params, output); retval = extractLong(output[0], -3, 3, "%") * 1024; } return retval; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d13f01f9238a429395352963f571764fba65842e/IoHelper.java/buggy/src/lib/com/izforge/izpack/util/IoHelper.java |
Vector left = components[LEFT]; Vector right = components[RIGHT]; for (int i = 0; i < left.size(); i++) { TwoColumnConstraints constraints = (TwoColumnConstraints) left.get(i); if (constraints == null) { continue; } Component ctemp = constraints.component; if (ctemp != null && ctemp.equals(comp)) { if (constraints.position == TwoColumnConstraints.BOTH || constraints.position == TwoColumnConstraints.WESTONLY) { right.remove(i); } break; } } for (int j = 0; j < right.size(); j++) { TwoColumnConstraints constraints = (TwoColumnConstraints) right.get(j); if (constraints == null) { continue; } Component ctemp = constraints.component; if (ctemp != null && ctemp.equals(comp)) { if (constraints.position == TwoColumnConstraints.BOTH || constraints.position == TwoColumnConstraints.EASTONLY) { left.remove(j); } break; } } | public void removeLayoutComponent(Component comp) { } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/14735d0b8e1a2936b12b94b393eb95418604b4d4/TwoColumnLayout.java/buggy/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java |
|
JButton cdb = null; if (nextButton.isEnabled()) cdb = nextButton; else if (quitButton.isEnabled()) cdb = quitButton; getRootPane().setDefaultButton(cdb); } | JButton cdb = null; if (nextButton.isEnabled()) { cdb = nextButton; quitButton.setDefaultCapable(false); prevButton.setDefaultCapable(false); nextButton.setDefaultCapable(true); } else if (quitButton.isEnabled()) { cdb = quitButton; quitButton.setDefaultCapable(true); prevButton.setDefaultCapable(false); nextButton.setDefaultCapable(false); } getRootPane().setDefaultButton(cdb); } | protected void switchPanel(int last) { try { if (installdata.curPanelNumber < last) { isBack = true; } panelsContainer.setVisible(false); IzPanel panel = (IzPanel) installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = (IzPanel) installdata.panels.get(last); // instead of writing data here which leads to duplicated entries in // auto-installation script (bug # 4551), let's make data only immediately before // writing out that script. // l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last)); // No previos button in the first visible panel if (((Integer) visiblePanelMapping.get(installdata.curPanelNumber)).intValue() == 0) { prevButton.setVisible(false); lockPrevButton(); unlockNextButton(); // if we push the button back at the license // panel } // Only the exit button in the last panel. else if (((Integer) visiblePanelMapping.get(installdata.panels.size())).intValue() == installdata.curPanelNumber) { prevButton.setVisible(false); nextButton.setVisible(false); lockNextButton(); } else { prevButton.setVisible(true); nextButton.setVisible(true); unlockPrevButton(); unlockNextButton(); } // With VM version >= 1.5 setting default button one time will not work. // Therefore we set it every panel switch and that also later. But in // the moment it seems so that the quit button will not used as default button. // No idea why... (Klaus Bartz, 06.09.25) SwingUtilities.invokeLater(new Runnable() { public void run() { JButton cdb = null; if (nextButton.isEnabled()) cdb = nextButton; else if (quitButton.isEnabled()) cdb = quitButton; getRootPane().setDefaultButton(cdb); } }); // Change panels container to the current one. panelsContainer.remove(l_panel); l_panel.panelDeactivate(); panelsContainer.add(panel); if (panel.getInitialFocus() != null) { // Initial focus hint should be performed after current panel // was added to the panels container, else the focus hint will // be ignored. // Give a hint for the initial focus to the system. final Component inFoc = panel.getInitialFocus(); if (JAVA_SPECIFICATION_VERSION < 1.35) { inFoc.requestFocus(); } else { // On java VM version >= 1.5 it works only if // invoke later will be used. SwingUtilities.invokeLater(new Runnable() { public void run() { inFoc.requestFocusInWindow(); } }); } /* * On editable text components position the caret to the end of the cust existent * text. */ if (inFoc instanceof JTextComponent) { JTextComponent inText = (JTextComponent) inFoc; if (inText.isEditable() && inText.getDocument() != null) { inText.setCaretPosition(inText.getDocument().getLength()); } } } performHeading(panel); performHeadingCounter(panel); panel.panelActivate(); panelsContainer.setVisible(true); Panel metadata = panel.getMetadata(); if ((metadata != null) && (!"UNKNOWN".equals(metadata.getPanelid()))) { loadAndShowImage(((Integer) visiblePanelMapping.get(installdata.curPanelNumber)) .intValue(), metadata.getPanelid()); } else { loadAndShowImage(((Integer) visiblePanelMapping.get(installdata.curPanelNumber)) .intValue()); } isBack = false; callGUIListener(GUIListener.PANEL_SWITCHED); } catch (Exception err) { err.printStackTrace(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/761bafc993db541af8ee39f1a1cad1ff84fd9290/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java |
JButton cdb = null; if (nextButton.isEnabled()) cdb = nextButton; else if (quitButton.isEnabled()) cdb = quitButton; getRootPane().setDefaultButton(cdb); } | JButton cdb = null; if (nextButton.isEnabled()) { cdb = nextButton; quitButton.setDefaultCapable(false); prevButton.setDefaultCapable(false); nextButton.setDefaultCapable(true); } else if (quitButton.isEnabled()) { cdb = quitButton; quitButton.setDefaultCapable(true); prevButton.setDefaultCapable(false); nextButton.setDefaultCapable(false); } getRootPane().setDefaultButton(cdb); } | public void run() { JButton cdb = null; if (nextButton.isEnabled()) cdb = nextButton; else if (quitButton.isEnabled()) cdb = quitButton; getRootPane().setDefaultButton(cdb); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/761bafc993db541af8ee39f1a1cad1ff84fd9290/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java |
if (client.getFieldContents(0).equals("")) { return false; } | if ("".equals(client.getFieldContents(0))) { return false; } | public boolean validate(ProcessingClient client) { int port = 0; if (client.getFieldContents(0).equals("")) { return false; } try { port = Integer.parseInt(client.getFieldContents(0)); if (port > 0 && port < 32000) { return true; } } catch (Exception ex) { return false; } return false; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/IsPortValidator.java/buggy/src/lib/com/izforge/izpack/util/IsPortValidator.java |
CursorableLinkedList.Cursor objcursor = null; CursorableLinkedList.Cursor keycursor = null; Object key = null; | public void run() { CursorableLinkedList.Cursor objcursor = null; CursorableLinkedList.Cursor keycursor = null; Object key = null; while(!_cancelled) { long sleeptime = 0L; synchronized(GenericKeyedObjectPool.this) { sleeptime = _timeBetweenEvictionRunsMillis; } try { Thread.currentThread().sleep(sleeptime); } catch(Exception e) { ; // ignored } try { synchronized(GenericKeyedObjectPool.this) { for(int i=0,m=getNumTests();i<m;i++) { if(_poolMap.size() > 0) { // if we don't have a key cursor, then create one, and close any object cursor if(null == keycursor) { keycursor = _poolList.cursor(); key = null; if(null != objcursor) { objcursor.close(); objcursor = null; } } // if we don't have an object cursor if(null == objcursor) { // if the keycursor has a next value, then use it if(keycursor.hasNext()) { key = keycursor.next(); CursorableLinkedList pool = (CursorableLinkedList)(_poolMap.get(key)); objcursor = pool.cursor(pool.size()); } else { // else close the key cursor and loop back around if(null != keycursor) { keycursor.close(); keycursor = _poolList.cursor(); if(null != objcursor) { objcursor.close(); objcursor = null; } } continue; } } // if the objcursor has a previous object, then test it if(objcursor.hasPrevious()) { ObjectTimestampPair pair = (ObjectTimestampPair)(objcursor.previous()); if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { try { objcursor.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); // if that was the last object for that key, drop that pool if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } catch(Exception e) { ; // ignored } } else if(_testWhileIdle) { boolean active = false; try { _factory.activateObject(key,pair.value); active = true; } catch(Exception e) { objcursor.remove(); try { _factory.passivateObject(key,pair.value); } catch(Exception ex) { ; // ignored } _factory.destroyObject(key,pair.value); } if(active) { if(!_factory.validateObject(key,pair.value)) { try { objcursor.remove(); _totalIdle--; try { _factory.passivateObject(key,pair.value); } catch(Exception e) { ; // ignored } _factory.destroyObject(key,pair.value); if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } catch(Exception e) { ; // ignored } } else { try { _factory.passivateObject(key,pair.value); } catch(Exception e) { objcursor.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } } } } } else { // else the objcursor is done, so close it and loop around if(objcursor != null) { objcursor.close(); objcursor = null; } } } } } } catch(Exception e) { ; // ignored } } if(null != keycursor) { keycursor.close(); } if(null != objcursor) { objcursor.close(); } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/0cefd89b0666ea7619067f9e58de58bbcd23b841/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
|
synchronized(GenericKeyedObjectPool.this) { for(int i=0,m=getNumTests();i<m;i++) { if(_poolMap.size() > 0) { if(null == keycursor) { keycursor = _poolList.cursor(); key = null; if(null != objcursor) { objcursor.close(); objcursor = null; } } if(null == objcursor) { if(keycursor.hasNext()) { key = keycursor.next(); CursorableLinkedList pool = (CursorableLinkedList)(_poolMap.get(key)); objcursor = pool.cursor(pool.size()); } else { if(null != keycursor) { keycursor.close(); keycursor = _poolList.cursor(); if(null != objcursor) { objcursor.close(); objcursor = null; } } continue; } } if(objcursor.hasPrevious()) { ObjectTimestampPair pair = (ObjectTimestampPair)(objcursor.previous()); if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { try { objcursor.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } catch(Exception e) { ; } } else if(_testWhileIdle) { boolean active = false; try { _factory.activateObject(key,pair.value); active = true; } catch(Exception e) { objcursor.remove(); try { _factory.passivateObject(key,pair.value); } catch(Exception ex) { ; } _factory.destroyObject(key,pair.value); } if(active) { if(!_factory.validateObject(key,pair.value)) { try { objcursor.remove(); _totalIdle--; try { _factory.passivateObject(key,pair.value); } catch(Exception e) { ; } _factory.destroyObject(key,pair.value); if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } catch(Exception e) { ; } } else { try { _factory.passivateObject(key,pair.value); } catch(Exception e) { objcursor.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } } } } } else { if(objcursor != null) { objcursor.close(); objcursor = null; } } } } } | evict(); | public void run() { CursorableLinkedList.Cursor objcursor = null; CursorableLinkedList.Cursor keycursor = null; Object key = null; while(!_cancelled) { long sleeptime = 0L; synchronized(GenericKeyedObjectPool.this) { sleeptime = _timeBetweenEvictionRunsMillis; } try { Thread.currentThread().sleep(sleeptime); } catch(Exception e) { ; // ignored } try { synchronized(GenericKeyedObjectPool.this) { for(int i=0,m=getNumTests();i<m;i++) { if(_poolMap.size() > 0) { // if we don't have a key cursor, then create one, and close any object cursor if(null == keycursor) { keycursor = _poolList.cursor(); key = null; if(null != objcursor) { objcursor.close(); objcursor = null; } } // if we don't have an object cursor if(null == objcursor) { // if the keycursor has a next value, then use it if(keycursor.hasNext()) { key = keycursor.next(); CursorableLinkedList pool = (CursorableLinkedList)(_poolMap.get(key)); objcursor = pool.cursor(pool.size()); } else { // else close the key cursor and loop back around if(null != keycursor) { keycursor.close(); keycursor = _poolList.cursor(); if(null != objcursor) { objcursor.close(); objcursor = null; } } continue; } } // if the objcursor has a previous object, then test it if(objcursor.hasPrevious()) { ObjectTimestampPair pair = (ObjectTimestampPair)(objcursor.previous()); if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { try { objcursor.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); // if that was the last object for that key, drop that pool if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } catch(Exception e) { ; // ignored } } else if(_testWhileIdle) { boolean active = false; try { _factory.activateObject(key,pair.value); active = true; } catch(Exception e) { objcursor.remove(); try { _factory.passivateObject(key,pair.value); } catch(Exception ex) { ; // ignored } _factory.destroyObject(key,pair.value); } if(active) { if(!_factory.validateObject(key,pair.value)) { try { objcursor.remove(); _totalIdle--; try { _factory.passivateObject(key,pair.value); } catch(Exception e) { ; // ignored } _factory.destroyObject(key,pair.value); if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } catch(Exception e) { ; // ignored } } else { try { _factory.passivateObject(key,pair.value); } catch(Exception e) { objcursor.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } } } } } else { // else the objcursor is done, so close it and loop around if(objcursor != null) { objcursor.close(); objcursor = null; } } } } } } catch(Exception e) { ; // ignored } } if(null != keycursor) { keycursor.close(); } if(null != objcursor) { objcursor.close(); } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/0cefd89b0666ea7619067f9e58de58bbcd23b841/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
if(null != keycursor) { keycursor.close(); } if(null != objcursor) { objcursor.close(); | synchronized(GenericKeyedObjectPool.this) { if(null != _evictionCursor) { _evictionCursor.close(); _evictionCursor = null; } if(null != _evictionKeyCursor) { _evictionKeyCursor.close(); _evictionKeyCursor = null; } | public void run() { CursorableLinkedList.Cursor objcursor = null; CursorableLinkedList.Cursor keycursor = null; Object key = null; while(!_cancelled) { long sleeptime = 0L; synchronized(GenericKeyedObjectPool.this) { sleeptime = _timeBetweenEvictionRunsMillis; } try { Thread.currentThread().sleep(sleeptime); } catch(Exception e) { ; // ignored } try { synchronized(GenericKeyedObjectPool.this) { for(int i=0,m=getNumTests();i<m;i++) { if(_poolMap.size() > 0) { // if we don't have a key cursor, then create one, and close any object cursor if(null == keycursor) { keycursor = _poolList.cursor(); key = null; if(null != objcursor) { objcursor.close(); objcursor = null; } } // if we don't have an object cursor if(null == objcursor) { // if the keycursor has a next value, then use it if(keycursor.hasNext()) { key = keycursor.next(); CursorableLinkedList pool = (CursorableLinkedList)(_poolMap.get(key)); objcursor = pool.cursor(pool.size()); } else { // else close the key cursor and loop back around if(null != keycursor) { keycursor.close(); keycursor = _poolList.cursor(); if(null != objcursor) { objcursor.close(); objcursor = null; } } continue; } } // if the objcursor has a previous object, then test it if(objcursor.hasPrevious()) { ObjectTimestampPair pair = (ObjectTimestampPair)(objcursor.previous()); if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { try { objcursor.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); // if that was the last object for that key, drop that pool if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } catch(Exception e) { ; // ignored } } else if(_testWhileIdle) { boolean active = false; try { _factory.activateObject(key,pair.value); active = true; } catch(Exception e) { objcursor.remove(); try { _factory.passivateObject(key,pair.value); } catch(Exception ex) { ; // ignored } _factory.destroyObject(key,pair.value); } if(active) { if(!_factory.validateObject(key,pair.value)) { try { objcursor.remove(); _totalIdle--; try { _factory.passivateObject(key,pair.value); } catch(Exception e) { ; // ignored } _factory.destroyObject(key,pair.value); if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } catch(Exception e) { ; // ignored } } else { try { _factory.passivateObject(key,pair.value); } catch(Exception e) { objcursor.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); if( ((CursorableLinkedList)(_poolMap.get(key))).isEmpty() ) { _poolMap.remove(key); _poolList.remove(key); } } } } } } else { // else the objcursor is done, so close it and loop around if(objcursor != null) { objcursor.close(); objcursor = null; } } } } } } catch(Exception e) { ; // ignored } } if(null != keycursor) { keycursor.close(); } if(null != objcursor) { objcursor.close(); } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/0cefd89b0666ea7619067f9e58de58bbcd23b841/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
if(null != _evictionCursor) { _evictionCursor.close(); _evictionCursor = null; } if(null != _evictionKeyCursor) { _evictionKeyCursor.close(); _evictionKeyCursor = null; } | synchronized public void close() throws Exception { clear(); _poolList = null; _poolMap = null; _activeMap = null; if(null != _evictor) { _evictor.cancel(); _evictor = null; } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/0cefd89b0666ea7619067f9e58de58bbcd23b841/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
|
public String getString(String key) { String val = (String) get(key); if (val == null) val = key + "(???)"; return val; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/91bfeafc3265323a5f71aef073a52845e68294b0/LocaleDatabase.java/clean/src/lib/com/izforge/izpack/LocaleDatabase.java |
||
else if (os.regionMatches(true, 0, "macosx", 0, 6)) | else if (os.regionMatches(true, 0, "mac os x", 0, 8)) | public void loadDefaultDir() { BufferedReader br = null; try { String os = System.getProperty("os.name"); InputStream in = null; if (os.regionMatches(true, 0, "windows", 0, 7)) in = parent.getResource("TargetPanel.dir.windows"); else if (os.regionMatches(true, 0, "macosx", 0, 6)) in = parent.getResource("TargetPanel.dir.macosx"); else if (os.regionMatches(true, 0, "mac", 0, 3)) in = parent.getResource("TargetPanel.dir.mac"); else { // first try to look up by specific os name os.replace(' ', '_');// avoid spaces in file names os = os.toLowerCase();// for consistency among TargetPanel res files in = parent.getResource("TargetPanel.dir.".concat(os)); // if not specific os, try getting generic 'unix' resource file if (in == null) in = parent.getResource("TargetPanel.dir.unix"); // if all those failed, try to look up a generic dir file if (in == null) in = parent.getResource("TargetPanel.dir"); } // if all above tests failed, there is no resource file, // so use system default if (in == null) return; // now read the file, once we've identified which one to read InputStreamReader isr = new InputStreamReader(in); br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { line = line.trim(); // use the first non-blank line if (!line.equals("")) break; } defaultDir = line; } catch (Exception e) { defaultDir = null;// leave unset to take the system default set by Installer class } finally { try { if (br != null) br.close(); } catch (IOException ignored) {} } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/842307a85e06af9351e53caedb4e364559263fbd/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java |
this.hasParams = true; | public RuleInputField( String format, String preset, String separator, String validator, Map validatorParams, String processor, int resultFormat, Toolkit toolkit) { this( format, preset, separator, validator, processor, resultFormat, toolkit); this.validatorParams = validatorParams; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/2516ed6ee8b89bfe6755ffb10159424a0abad49e/RuleInputField.java/clean/src/lib/com/izforge/izpack/panels/RuleInputField.java |
|
family = QuantumFactory.LINEAR; curveCoefficient = 1.0; | protected QuantumStrategy(QuantumDef qd) { windowStart = globalMin = 0.0; windowEnd = globalMax = 1.0; if (qd == null) throw new NullPointerException("No quantum definition"); this.qDef = qd; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/de5b83ecccd54946c2125525e83cea40c4c4dd36/QuantumStrategy.java/clean/SRC/org/openmicroscopy/shoola/env/rnd/quantum/QuantumStrategy.java |
|
private void loadPanels() throws Exception { // Initialisation java.util.List panelsOrder = installdata.panelsOrder; int i; int size = panelsOrder.size(); String className; Class objectClass; Constructor constructor; Object object; IzPanel panel; Class[] paramsClasses = new Class[2]; paramsClasses[0] = Class.forName("com.izforge.izpack.installer.InstallerFrame"); paramsClasses[1] = Class.forName("com.izforge.izpack.installer.InstallData"); Object[] params = { this, installdata }; // We load each of them for (i = 0; i < size; i++) { // We add the panel Panel p = (Panel) panelsOrder.get(i); if (!OsConstraint.oneMatchesCurrentSystem(p.osConstraints)) continue; className = (String) p.className; objectClass = Class.forName("com.izforge.izpack.panels." + className); constructor = objectClass.getDeclaredConstructor(paramsClasses); object = constructor.newInstance(params); panel = (IzPanel) object; installdata.panels.add(panel); // We add the XML data panel root XMLElement panelRoot = new XMLElement(className); installdata.xmlData.addChild(panelRoot); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d28b4a0f8922435997696d344aa94afcad4e3475/InstallerFrame.java/clean/src/lib/com/izforge/izpack/installer/InstallerFrame.java |
||
objectClass = Class.forName("com.izforge.izpack.panels." + className); | String praefix = "com.izforge.izpack.panels."; if( className.compareTo(".") > -1 ) praefix = ""; objectClass = Class.forName(praefix + className); | private void loadPanels() throws Exception { // Initialisation java.util.List panelsOrder = installdata.panelsOrder; int i; int size = panelsOrder.size(); String className; Class objectClass; Constructor constructor; Object object; IzPanel panel; Class[] paramsClasses = new Class[2]; paramsClasses[0] = Class.forName("com.izforge.izpack.installer.InstallerFrame"); paramsClasses[1] = Class.forName("com.izforge.izpack.installer.InstallData"); Object[] params = { this, installdata }; // We load each of them for (i = 0; i < size; i++) { // We add the panel Panel p = (Panel) panelsOrder.get(i); if (!OsConstraint.oneMatchesCurrentSystem(p.osConstraints)) continue; className = (String) p.className; objectClass = Class.forName("com.izforge.izpack.panels." + className); constructor = objectClass.getDeclaredConstructor(paramsClasses); object = constructor.newInstance(params); panel = (IzPanel) object; installdata.panels.add(panel); // We add the XML data panel root XMLElement panelRoot = new XMLElement(className); installdata.xmlData.addChild(panelRoot); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d28b4a0f8922435997696d344aa94afcad4e3475/InstallerFrame.java/clean/src/lib/com/izforge/izpack/installer/InstallerFrame.java |
imagesNode.getChildrenCount() > MIN_ICON_DATASET_SIZE) { | imagesNode.getChildrenCount() > MIN_ICON_DATASET_SIZE) { | public void completeImages() { PBounds b = imagesNode.getGlobalFullBounds(); // only do this if the images have non-zero bounds and there are // more than MIN_ICON_DATSET_SIZE images if (b.getWidth() > 0 && b.getHeight() > 0 && imagesNode.getChildrenCount() > MIN_ICON_DATASET_SIZE) { // use {@link PNode.toImage} to get a snapshot of the thumbnails. thumbnailNode = new PImage(imagesNode.toImage((int)b.getWidth(), (int) b.getHeight(),null),true); addChild(thumbnailNode); moveToBack(thumbnailNode); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/148dd42583e6f2e2118b9ee4227530b5e86d9087/DatasetImagesNode.java/buggy/SRC/org/openmicroscopy/shoola/agents/zoombrowser/piccolo/DatasetImagesNode.java |
(int) b.getHeight(),null),true); | (int) b.getHeight(),null),true); | public void completeImages() { PBounds b = imagesNode.getGlobalFullBounds(); // only do this if the images have non-zero bounds and there are // more than MIN_ICON_DATSET_SIZE images if (b.getWidth() > 0 && b.getHeight() > 0 && imagesNode.getChildrenCount() > MIN_ICON_DATASET_SIZE) { // use {@link PNode.toImage} to get a snapshot of the thumbnails. thumbnailNode = new PImage(imagesNode.toImage((int)b.getWidth(), (int) b.getHeight(),null),true); addChild(thumbnailNode); moveToBack(thumbnailNode); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/148dd42583e6f2e2118b9ee4227530b5e86d9087/DatasetImagesNode.java/buggy/SRC/org/openmicroscopy/shoola/agents/zoombrowser/piccolo/DatasetImagesNode.java |
public void paint(PPaintContext aPaintContext) { if (thumbnailNode == null || selected == true || aPaintContext.getScale() > SCALE_THRESHOLD){ if (thumbnailNode != null) { thumbnailNode.setVisible(false); thumbnailNode.setPickable(false); } imagesNode.setVisible(true); setPickable(true); } else { // show images node imagesNode.setVisible(false); if (thumbnailNode != null) { thumbnailNode.setVisible(true); thumbnailNode.setPickable(true); } setPickable(false); } super.paint(aPaintContext); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/148dd42583e6f2e2118b9ee4227530b5e86d9087/DatasetImagesNode.java/buggy/SRC/org/openmicroscopy/shoola/agents/zoombrowser/piccolo/DatasetImagesNode.java |
||
aPaintContext.getScale() > SCALE_THRESHOLD){ | aPaintContext.getScale() > SCALE_THRESHOLD){ | public void paint(PPaintContext aPaintContext) { if (thumbnailNode == null || selected == true || aPaintContext.getScale() > SCALE_THRESHOLD){ if (thumbnailNode != null) { thumbnailNode.setVisible(false); thumbnailNode.setPickable(false); } imagesNode.setVisible(true); setPickable(true); } else { // show images node imagesNode.setVisible(false); if (thumbnailNode != null) { thumbnailNode.setVisible(true); thumbnailNode.setPickable(true); } setPickable(false); } super.paint(aPaintContext); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/148dd42583e6f2e2118b9ee4227530b5e86d9087/DatasetImagesNode.java/buggy/SRC/org/openmicroscopy/shoola/agents/zoombrowser/piccolo/DatasetImagesNode.java |
thumbnailNode.setVisible(false); thumbnailNode.setPickable(false); | thumbnailNode.setVisible(false); thumbnailNode.setPickable(false); | public void paint(PPaintContext aPaintContext) { if (thumbnailNode == null || selected == true || aPaintContext.getScale() > SCALE_THRESHOLD){ if (thumbnailNode != null) { thumbnailNode.setVisible(false); thumbnailNode.setPickable(false); } imagesNode.setVisible(true); setPickable(true); } else { // show images node imagesNode.setVisible(false); if (thumbnailNode != null) { thumbnailNode.setVisible(true); thumbnailNode.setPickable(true); } setPickable(false); } super.paint(aPaintContext); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/148dd42583e6f2e2118b9ee4227530b5e86d9087/DatasetImagesNode.java/buggy/SRC/org/openmicroscopy/shoola/agents/zoombrowser/piccolo/DatasetImagesNode.java |
public void paint(PPaintContext aPaintContext) { if (thumbnailNode == null || selected == true || aPaintContext.getScale() > SCALE_THRESHOLD){ if (thumbnailNode != null) { thumbnailNode.setVisible(false); thumbnailNode.setPickable(false); } imagesNode.setVisible(true); setPickable(true); } else { // show images node imagesNode.setVisible(false); if (thumbnailNode != null) { thumbnailNode.setVisible(true); thumbnailNode.setPickable(true); } setPickable(false); } super.paint(aPaintContext); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/148dd42583e6f2e2118b9ee4227530b5e86d9087/DatasetImagesNode.java/buggy/SRC/org/openmicroscopy/shoola/agents/zoombrowser/piccolo/DatasetImagesNode.java |
||
thumbnailNode.setVisible(true); thumbnailNode.setPickable(true); | thumbnailNode.setVisible(true); thumbnailNode.setPickable(true); | public void paint(PPaintContext aPaintContext) { if (thumbnailNode == null || selected == true || aPaintContext.getScale() > SCALE_THRESHOLD){ if (thumbnailNode != null) { thumbnailNode.setVisible(false); thumbnailNode.setPickable(false); } imagesNode.setVisible(true); setPickable(true); } else { // show images node imagesNode.setVisible(false); if (thumbnailNode != null) { thumbnailNode.setVisible(true); thumbnailNode.setPickable(true); } setPickable(false); } super.paint(aPaintContext); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/148dd42583e6f2e2118b9ee4227530b5e86d9087/DatasetImagesNode.java/buggy/SRC/org/openmicroscopy/shoola/agents/zoombrowser/piccolo/DatasetImagesNode.java |
setPickable(false); | setPickable(false); | public void paint(PPaintContext aPaintContext) { if (thumbnailNode == null || selected == true || aPaintContext.getScale() > SCALE_THRESHOLD){ if (thumbnailNode != null) { thumbnailNode.setVisible(false); thumbnailNode.setPickable(false); } imagesNode.setVisible(true); setPickable(true); } else { // show images node imagesNode.setVisible(false); if (thumbnailNode != null) { thumbnailNode.setVisible(true); thumbnailNode.setPickable(true); } setPickable(false); } super.paint(aPaintContext); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/148dd42583e6f2e2118b9ee4227530b5e86d9087/DatasetImagesNode.java/buggy/SRC/org/openmicroscopy/shoola/agents/zoombrowser/piccolo/DatasetImagesNode.java |
if (level == 0) return; | public void zoomOutOfHalo(Thumbnail thumb) { // get the zoom level int level = handler.getZoomLevel(); // if level is zero, do nothing - the view is already zoomed out if (level == 0) return; if (level <= 1) { // go to top level. BufferedObject b = thumb.getBufferedParentNode(); // zoom to the dataset handler.animateToBufferedObject(b); } else { // go up by two int upperLevel = level-2; int radius = getRadius(upperLevel); if (radius > 0) { // and calculate the halo for that level zoomHalo.hide(); doHighlightThumbnail(thumb,radius); // zooming into it. This has the net effect of zooming us out // by one step. handler.animateToNode(zoomHalo); } } // adjust level level--; if (level < 0) level = 0; handler.setZoomLevel(level); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/148dd42583e6f2e2118b9ee4227530b5e86d9087/DatasetImagesNode.java/buggy/SRC/org/openmicroscopy/shoola/agents/zoombrowser/piccolo/DatasetImagesNode.java |
|
private void buildUI(File groups) | private void buildUI(File groups) | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
itsProgramFolder = groups; | itsProgramFolder = groups; | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ | constraints.weighty = 1.0; | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
/*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ | /**/ | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) | if (hasDesktopShortcuts) { String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
allowDesktopShortcut = new JCheckBox(parent.langpack | allowDesktopShortcut = new JCheckBox(parent.langpack | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); | constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
listLabel = LabelFactory.create(parent.langpack.getString("ShortcutPanel.regular.list"), JLabel.LEADING); constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0.2; constraints.weighty = 0.2; constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(listLabel, constraints); add(listLabel); | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
|
addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); | addSelectionList( groups, 0, 4, 2, 1, GridBagConstraints.BOTH ); | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
constraints.gridy = 3; | constraints.gridy = 4; | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
constraints.gridy = 4; | constraints.gridy = 5; | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
constraints.gridy = 4; | constraints.gridy = 5; | private void buildUI(File groups)//, boolean currentUserList) { itsProgramFolder = groups; //listLabel.setFont( listLabel.getFont().getSize() ); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; /*constraints.insets = new Insets(5, 5, 5, 5);*/ constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; /*layout.addLayoutComponent(listLabel, constraints); add(listLabel);*/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; if (hasDesktopShortcuts) { layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 3, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/0037f02b9e191b9fd43fd4ecd516cc9745b3307d/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
if (referant == null) { | Object r = referant; while (r instanceof LenderReference) { r = ((LenderReference)r).get(); } if (r == null) { | public void run() { // Skip some synchronization if we can if (referant == null) { cancel(); return; } final PoolableObjectFactory factory = getObjectPool().getFactory(); synchronized(getObjectPool().getPool()) { if (referant == null) { cancel(); return; } try { factory.activateObject(referant); if (factory.validateObject(referant)) { factory.passivateObject(referant); } else { factory.destroyObject(referant); clear(); } } catch (Exception e) { clear(); } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/f0437b554c95b5412ea926f3af8364aa1be3a6cf/InvalidEvictorLender.java/buggy/src/java/org/apache/commons/pool/composite/InvalidEvictorLender.java |
factory.activateObject(referant); if (factory.validateObject(referant)) { factory.passivateObject(referant); | factory.activateObject(r); if (factory.validateObject(r)) { factory.passivateObject(r); | public void run() { // Skip some synchronization if we can if (referant == null) { cancel(); return; } final PoolableObjectFactory factory = getObjectPool().getFactory(); synchronized(getObjectPool().getPool()) { if (referant == null) { cancel(); return; } try { factory.activateObject(referant); if (factory.validateObject(referant)) { factory.passivateObject(referant); } else { factory.destroyObject(referant); clear(); } } catch (Exception e) { clear(); } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/f0437b554c95b5412ea926f3af8364aa1be3a6cf/InvalidEvictorLender.java/buggy/src/java/org/apache/commons/pool/composite/InvalidEvictorLender.java |
factory.destroyObject(referant); | factory.destroyObject(r); | public void run() { // Skip some synchronization if we can if (referant == null) { cancel(); return; } final PoolableObjectFactory factory = getObjectPool().getFactory(); synchronized(getObjectPool().getPool()) { if (referant == null) { cancel(); return; } try { factory.activateObject(referant); if (factory.validateObject(referant)) { factory.passivateObject(referant); } else { factory.destroyObject(referant); clear(); } } catch (Exception e) { clear(); } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/f0437b554c95b5412ea926f3af8364aa1be3a6cf/InvalidEvictorLender.java/buggy/src/java/org/apache/commons/pool/composite/InvalidEvictorLender.java |
} | } | public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException("Pool exhausted"); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); } } } _numActive++; // create new object when needed boolean newlyCreated = false; if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } finally { if (!newlyCreated) { // object cannot be created _numActive--; notifyAll(); } } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("ValidateObject failed"); } return pair.value; } catch (Throwable e) { // object cannot be activated or is invalid _numActive--; notifyAll(); try { _factory.destroyObject(pair.value); } catch (Throwable e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
} | } | public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException("Pool exhausted"); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); } } } _numActive++; // create new object when needed boolean newlyCreated = false; if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } finally { if (!newlyCreated) { // object cannot be created _numActive--; notifyAll(); } } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("ValidateObject failed"); } return pair.value; } catch (Throwable e) { // object cannot be activated or is invalid _numActive--; notifyAll(); try { _factory.destroyObject(pair.value); } catch (Throwable e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
} | } | public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException("Pool exhausted"); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); } } } _numActive++; // create new object when needed boolean newlyCreated = false; if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } finally { if (!newlyCreated) { // object cannot be created _numActive--; notifyAll(); } } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("ValidateObject failed"); } return pair.value; } catch (Throwable e) { // object cannot be activated or is invalid _numActive--; notifyAll(); try { _factory.destroyObject(pair.value); } catch (Throwable e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException("Pool exhausted"); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); } } } _numActive++; // create new object when needed boolean newlyCreated = false; if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } finally { if (!newlyCreated) { // object cannot be created _numActive--; notifyAll(); } } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("ValidateObject failed"); } return pair.value; } catch (Throwable e) { // object cannot be activated or is invalid _numActive--; notifyAll(); try { _factory.destroyObject(pair.value); } catch (Throwable e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
||
} | } | public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException("Pool exhausted"); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); } } } _numActive++; // create new object when needed boolean newlyCreated = false; if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } finally { if (!newlyCreated) { // object cannot be created _numActive--; notifyAll(); } } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("ValidateObject failed"); } return pair.value; } catch (Throwable e) { // object cannot be activated or is invalid _numActive--; notifyAll(); try { _factory.destroyObject(pair.value); } catch (Throwable e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
} else { boolean removeObject = false; ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) | } boolean removeObject = false; final ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); final long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) | public synchronized void evict() throws Exception { assertOpen(); if(!_pool.isEmpty()) { ListIterator iter; if (evictLastIndex < 0) { iter = _pool.listIterator(_pool.size()); } else { iter = _pool.listIterator(evictLastIndex); } for(int i=0,m=getNumTests();i<m;i++) { if(!iter.hasPrevious()) { iter = _pool.listIterator(_pool.size()); } else { boolean removeObject = false; ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) && (idleTimeMilis > _minEvictableIdleTimeMillis)) { removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) && (idleTimeMilis > _softMinEvictableIdleTimeMillis) && (getNumIdle() > getMinIdle())) { removeObject = true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(pair.value)) { removeObject=true; } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } } } evictLastIndex = iter.previousIndex(); // resume from here } // if !empty } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) | removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) | public synchronized void evict() throws Exception { assertOpen(); if(!_pool.isEmpty()) { ListIterator iter; if (evictLastIndex < 0) { iter = _pool.listIterator(_pool.size()); } else { iter = _pool.listIterator(evictLastIndex); } for(int i=0,m=getNumTests();i<m;i++) { if(!iter.hasPrevious()) { iter = _pool.listIterator(_pool.size()); } else { boolean removeObject = false; ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) && (idleTimeMilis > _minEvictableIdleTimeMillis)) { removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) && (idleTimeMilis > _softMinEvictableIdleTimeMillis) && (getNumIdle() > getMinIdle())) { removeObject = true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(pair.value)) { removeObject=true; } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } } } evictLastIndex = iter.previousIndex(); // resume from here } // if !empty } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
removeObject = true; | removeObject = true; } if(_testWhileIdle && !removeObject) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { removeObject=true; | public synchronized void evict() throws Exception { assertOpen(); if(!_pool.isEmpty()) { ListIterator iter; if (evictLastIndex < 0) { iter = _pool.listIterator(_pool.size()); } else { iter = _pool.listIterator(evictLastIndex); } for(int i=0,m=getNumTests();i<m;i++) { if(!iter.hasPrevious()) { iter = _pool.listIterator(_pool.size()); } else { boolean removeObject = false; ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) && (idleTimeMilis > _minEvictableIdleTimeMillis)) { removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) && (idleTimeMilis > _softMinEvictableIdleTimeMillis) && (getNumIdle() > getMinIdle())) { removeObject = true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(pair.value)) { removeObject=true; } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } } } evictLastIndex = iter.previousIndex(); // resume from here } // if !empty } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { | if(active) { if(!_factory.validateObject(pair.value)) { | public synchronized void evict() throws Exception { assertOpen(); if(!_pool.isEmpty()) { ListIterator iter; if (evictLastIndex < 0) { iter = _pool.listIterator(_pool.size()); } else { iter = _pool.listIterator(evictLastIndex); } for(int i=0,m=getNumTests();i<m;i++) { if(!iter.hasPrevious()) { iter = _pool.listIterator(_pool.size()); } else { boolean removeObject = false; ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) && (idleTimeMilis > _minEvictableIdleTimeMillis)) { removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) && (idleTimeMilis > _softMinEvictableIdleTimeMillis) && (getNumIdle() > getMinIdle())) { removeObject = true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(pair.value)) { removeObject=true; } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } } } evictLastIndex = iter.previousIndex(); // resume from here } // if !empty } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
} if(active) { if(!_factory.validateObject(pair.value)) { | } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { | public synchronized void evict() throws Exception { assertOpen(); if(!_pool.isEmpty()) { ListIterator iter; if (evictLastIndex < 0) { iter = _pool.listIterator(_pool.size()); } else { iter = _pool.listIterator(evictLastIndex); } for(int i=0,m=getNumTests();i<m;i++) { if(!iter.hasPrevious()) { iter = _pool.listIterator(_pool.size()); } else { boolean removeObject = false; ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) && (idleTimeMilis > _minEvictableIdleTimeMillis)) { removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) && (idleTimeMilis > _softMinEvictableIdleTimeMillis) && (getNumIdle() > getMinIdle())) { removeObject = true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(pair.value)) { removeObject=true; } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } } } evictLastIndex = iter.previousIndex(); // resume from here } // if !empty } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
} else { try { _factory.passivateObject(pair.value); } catch(Exception e) { removeObject=true; } | public synchronized void evict() throws Exception { assertOpen(); if(!_pool.isEmpty()) { ListIterator iter; if (evictLastIndex < 0) { iter = _pool.listIterator(_pool.size()); } else { iter = _pool.listIterator(evictLastIndex); } for(int i=0,m=getNumTests();i<m;i++) { if(!iter.hasPrevious()) { iter = _pool.listIterator(_pool.size()); } else { boolean removeObject = false; ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) && (idleTimeMilis > _minEvictableIdleTimeMillis)) { removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) && (idleTimeMilis > _softMinEvictableIdleTimeMillis) && (getNumIdle() > getMinIdle())) { removeObject = true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(pair.value)) { removeObject=true; } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } } } evictLastIndex = iter.previousIndex(); // resume from here } // if !empty } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
|
if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; } | } if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { | public synchronized void evict() throws Exception { assertOpen(); if(!_pool.isEmpty()) { ListIterator iter; if (evictLastIndex < 0) { iter = _pool.listIterator(_pool.size()); } else { iter = _pool.listIterator(evictLastIndex); } for(int i=0,m=getNumTests();i<m;i++) { if(!iter.hasPrevious()) { iter = _pool.listIterator(_pool.size()); } else { boolean removeObject = false; ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) && (idleTimeMilis > _minEvictableIdleTimeMillis)) { removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) && (idleTimeMilis > _softMinEvictableIdleTimeMillis) && (getNumIdle() > getMinIdle())) { removeObject = true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(pair.value)) { removeObject=true; } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } } } evictLastIndex = iter.previousIndex(); // resume from here } // if !empty } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
return _numTestsPerEvictionRun; | return Math.min(_numTestsPerEvictionRun, _pool.size()); | private int getNumTests() { if(_numTestsPerEvictionRun >= 0) { return _numTestsPerEvictionRun; } else { return(int)(Math.ceil((double)_pool.size()/Math.abs((double)_numTestsPerEvictionRun))); } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7832b0bab22bf3cd2f46f8fcf4cdcdd8d712d12c/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
inst.deleteOnExit(); | private void askUninstallerRemoval() throws Exception { // Initialisations InputStream in = getClass().getResourceAsStream("/jarlocation.log"); InputStreamReader inReader = new InputStreamReader(in); BufferedReader reader = new BufferedReader(inReader); // We delete File jar = new File(reader.readLine()); File path = new File(reader.readLine()); jar.deleteOnExit(); path.deleteOnExit(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/f5d284ac59e86db8dfd60282104f2d8ce8a6f3c1/Destroyer.java/buggy/src/lib/com/izforge/izpack/uninstaller/Destroyer.java |
|
catch (Exception e) { | catch (Throwable e) { | public Object borrowObject() throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; synchronized(this) { assertOpen(); // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException("Pool exhausted"); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); } } } _numActive++; } // end synchronized // create new object when needed if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } catch (Exception e) { // object cannot be created synchronized(this) { _numActive--; notifyAll(); } throw e; } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("ValidateObject failed"); } return pair.value; } catch (Exception e) { // object cannot be activated or is invalid synchronized(this) { _numActive--; notifyAll(); } try { _factory.destroyObject(pair.value); } catch (Exception e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/cddc3dac821e395530080cbb37b7ef8f3110f6f6/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
throw e; | if (e instanceof Exception) { throw (Exception) e; } else if (e instanceof Error) { throw (Error) e; } else { throw new Exception(e); } | public Object borrowObject() throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; synchronized(this) { assertOpen(); // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException("Pool exhausted"); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); } } } _numActive++; } // end synchronized // create new object when needed if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } catch (Exception e) { // object cannot be created synchronized(this) { _numActive--; notifyAll(); } throw e; } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("ValidateObject failed"); } return pair.value; } catch (Exception e) { // object cannot be activated or is invalid synchronized(this) { _numActive--; notifyAll(); } try { _factory.destroyObject(pair.value); } catch (Exception e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/cddc3dac821e395530080cbb37b7ef8f3110f6f6/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
catch (Exception e) { | catch (Throwable e) { | public Object borrowObject() throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; synchronized(this) { assertOpen(); // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException("Pool exhausted"); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); } } } _numActive++; } // end synchronized // create new object when needed if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } catch (Exception e) { // object cannot be created synchronized(this) { _numActive--; notifyAll(); } throw e; } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("ValidateObject failed"); } return pair.value; } catch (Exception e) { // object cannot be activated or is invalid synchronized(this) { _numActive--; notifyAll(); } try { _factory.destroyObject(pair.value); } catch (Exception e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/cddc3dac821e395530080cbb37b7ef8f3110f6f6/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
catch (Exception e2) { | catch (Throwable e2) { | public Object borrowObject() throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; synchronized(this) { assertOpen(); // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException("Pool exhausted"); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); } } } _numActive++; } // end synchronized // create new object when needed if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } catch (Exception e) { // object cannot be created synchronized(this) { _numActive--; notifyAll(); } throw e; } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("ValidateObject failed"); } return pair.value; } catch (Exception e) { // object cannot be activated or is invalid synchronized(this) { _numActive--; notifyAll(); } try { _factory.destroyObject(pair.value); } catch (Exception e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/cddc3dac821e395530080cbb37b7ef8f3110f6f6/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
frame.show(); frame.hide(); picker.show(); | frame.setVisible(true); frame.setVisible(false); picker.setVisible(true); | private void loadLangPack() throws Exception { // Initialisations List availableLangPacks = getAvailableLangPacks(); int npacks = availableLangPacks.size(); if (npacks == 0) throw new Exception("no language pack available"); String selectedPack; // Dummy Frame JFrame frame = new JFrame(); frame.setIconImage(new ImageIcon(this.getClass().getResource("/img/JFrameIcon.png")) .getImage()); Dimension frameSize = frame.getSize(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2 - 10); // We get the langpack name if (npacks != 1) { LanguageDialog picker = new LanguageDialog(frame, availableLangPacks.toArray()); picker.setSelection(Locale.getDefault().getISO3Country().toLowerCase()); picker.setModal(true); picker.toFront(); frame.show(); frame.hide(); picker.show(); selectedPack = (String) picker.getSelection(); if (selectedPack == null) throw new Exception("installation canceled"); } else selectedPack = (String) availableLangPacks.get(0); // We add an xml data information this.installdata.xmlData.setAttribute("langpack", selectedPack); // We load the langpack installdata.localeISO3 = selectedPack; installdata.setVariable(ScriptParser.ISO3_LANG, installdata.localeISO3); InputStream in = getClass().getResourceAsStream("/langpacks/" + selectedPack + ".xml"); this.installdata.langpack = new LocaleDatabase(in); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/65829be7fc5a410510ee8132076f9911c480d666/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java |
if (description == null) | if (description == null || key.equalsIgnoreCase(description)) | protected String getGroupDescription(String group) { String description = null; String key = "InstallationGroupPanel.description." + group; if( idata.langpack != null ) { String htmlKey = key+".html"; String html = idata.langpack.getString(htmlKey); // This will equal the key if there is no entry if( htmlKey.equalsIgnoreCase(html) ) description = idata.langpack.getString(key); else description = html; } if (description == null) description = idata.getVariable(key); if (description == null) description = group + " installation"; try { description = URLDecoder.decode(description, "UTF-8"); } catch (UnsupportedEncodingException e) { emitWarning("Failed to convert description", e.getMessage()); } return description; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/5a2fd31894b62d2adb03d11724d5d84d548ecd20/InstallationGroupPanel.java/clean/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java |
if( antActions.size() > 0 ) | if( antActions != null && antActions.size() > 0 ) | public void afterDeletion(List files, AbstractUIProgressHandler handler) throws Exception { if( antActions.size() > 0 ) { // There are actions of the order "afterdeletion". for (int i = 0; i < antActions.size(); i++) { AntAction act = (AntAction)antActions.get(i); act.performUninstallAction(); } } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/79590c83b49ec3a5e5f819a3119830a666b326a4/AntActionUninstallerListener.java/clean/src/lib/com/izforge/izpack/event/AntActionUninstallerListener.java |
throw new NoSuchElementException(); | throw new NoSuchElementException("Pool exhausted"); | public Object borrowObject() throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; synchronized(this) { assertOpen(); // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException(); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("whenExhaustedAction " + _whenExhaustedAction + " not recognized."); } } } _numActive++; } // end synchronized // create new object when needed if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } catch (Exception e) { // object cannot be created synchronized(this) { _numActive--; notifyAll(); } throw e; } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("validateObject failed"); } return pair.value; } catch (Exception e) { // object cannot be activated or is invalid synchronized(this) { _numActive--; notifyAll(); } try { _factory.destroyObject(pair.value); } catch (Exception e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/fe25a7204cce1dd65e137c8b6aa374aea969e4a6/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
throw new IllegalArgumentException("whenExhaustedAction " + _whenExhaustedAction + " not recognized."); | throw new IllegalArgumentException("WhenExhaustedAction property " + _whenExhaustedAction + " not recognized."); | public Object borrowObject() throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; synchronized(this) { assertOpen(); // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException(); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("whenExhaustedAction " + _whenExhaustedAction + " not recognized."); } } } _numActive++; } // end synchronized // create new object when needed if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } catch (Exception e) { // object cannot be created synchronized(this) { _numActive--; notifyAll(); } throw e; } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("validateObject failed"); } return pair.value; } catch (Exception e) { // object cannot be activated or is invalid synchronized(this) { _numActive--; notifyAll(); } try { _factory.destroyObject(pair.value); } catch (Exception e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/fe25a7204cce1dd65e137c8b6aa374aea969e4a6/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
throw new Exception("validateObject failed"); | throw new Exception("ValidateObject failed"); | public Object borrowObject() throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; synchronized(this) { assertOpen(); // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive < 0 || _numActive < _maxActive) { // allow new object to be created } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: // allow new object to be created break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException(); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("whenExhaustedAction " + _whenExhaustedAction + " not recognized."); } } } _numActive++; } // end synchronized // create new object when needed if(null == pair) { try { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } catch (Exception e) { // object cannot be created synchronized(this) { _numActive--; notifyAll(); } throw e; } } // activate & validate the object try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("validateObject failed"); } return pair.value; } catch (Exception e) { // object cannot be activated or is invalid synchronized(this) { _numActive--; notifyAll(); } try { _factory.destroyObject(pair.value); } catch (Exception e2) { // cannot destroy broken object } if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage()); } else { continue; // keep looping } } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/fe25a7204cce1dd65e137c8b6aa374aea969e4a6/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
System.out.println("component bounds=" + component.getBounds()); | private void positionComponent (int y, int row, int column, Container parent) { TwoColumnConstraints constraints = null; try { constraints = (TwoColumnConstraints)(components [column].elementAt (row)); } catch (Throwable exception) { return; } int x = 0; if (constraints != null) { Component component = constraints.component; int width = (int)component.getPreferredSize ().getWidth (); int height = (int)component.getPreferredSize ().getHeight (); // -------------------------------------------------- // set x to the appropriate rule. The only need to // modify this is for indent // -------------------------------------------------- if (column == LEFT) { x = leftRule; } else { x = centerRule; } if (component != null) { // -------------------------------------------------- // set the width for stretch based on BOTH, LEFT and // RIGHT positionsing // -------------------------------------------------- if ((constraints.stretch) && (constraints.position == constraints.BOTH)) { width = rightRule - leftRule; x = leftRule; } else if ((constraints.stretch) && (column == LEFT)) { width = centerRule - leftRule; } else if ((constraints.stretch) && (column == RIGHT)) { width = rightRule - centerRule; } // -------------------------------------------------- // if we straddle both columns but are not stretching // use the preferred width as long as it is less then // the width of both columns combined. Also set the x // position to left, just to be sure. // -------------------------------------------------- else if (constraints.position == constraints.BOTH) { if (width > (rightRule - leftRule)) { width = rightRule - leftRule; } x = leftRule; } // -------------------------------------------------- // correct for indent if this option is set // -------------------------------------------------- if (constraints.indent) { width = width - indent; x = x + indent; } component.setBounds (x, y, width, height); System.out.println("component bounds=" + component.getBounds()); } } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/57817af603f9dc04e8bfa5e96e78dd5b192aac8f/TwoColumnLayout.java/clean/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java |
|
} else if(_testWhileIdle) { | } if(_testWhileIdle && removeObject == false) { | public synchronized void evict() throws Exception { assertOpen(); if(!_pool.isEmpty()) { ListIterator iter; if (evictLastIndex < 0) { iter = _pool.listIterator(_pool.size()); } else { iter = _pool.listIterator(evictLastIndex); } for(int i=0,m=getNumTests();i<m;i++) { if(!iter.hasPrevious()) { iter = _pool.listIterator(_pool.size()); } else { boolean removeObject = false; ObjectTimestampPair pair = (ObjectTimestampPair)(iter.previous()); long idleTimeMilis = System.currentTimeMillis() - pair.tstamp; if ((_minEvictableIdleTimeMillis > 0) && (idleTimeMilis > _minEvictableIdleTimeMillis)) { removeObject = true; } else if ((_softMinEvictableIdleTimeMillis > 0) && (idleTimeMilis > _softMinEvictableIdleTimeMillis) && (getNumIdle() > getMinIdle())) { removeObject = true; } else if(_testWhileIdle) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(pair.value)) { removeObject=true; } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { iter.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } } } evictLastIndex = iter.previousIndex(); // resume from here } // if !empty } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/516c9aa5009c37143c3c518d5296e57c866d4d29/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
return this.worker.getResult(); | return worker.getResult(); | public boolean runAutomated(AutomatedInstallData idata, XMLElement panelRoot) { try { ProcessPanelWorker worker = new ProcessPanelWorker(idata, this); worker.run(); return this.worker.getResult(); } catch (IOException e) { e.printStackTrace(); return false; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/c876ca55d8b366f7820408ea5e8e0a6a20c2db62/ProcessPanelAutomationHelper.java/buggy/src/lib/com/izforge/izpack/panels/ProcessPanelAutomationHelper.java |
if (firstTime) firstTime = false; else return; | public void panelActivate () { analyzeShortcutSpec (); if (shortcutsToCreate) { if (shortcut.supported () && !simulteNotSupported) { parent.lockNextButton (); buildUI (shortcut.getProgramGroups (ShellLink.CURRENT_USER), true); // always start out with the current user } else { buildAlternateUI (); parent.unlockNextButton (); parent.lockPrevButton (); } } else { parent.skipPanel (); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/24ab501f4d8488467fd8b63b1057fcc96217b3bf/ShortcutPanel.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
|
private void buildGUI() { // Sets the frame icon setIconImage(icons.getImageIcon("JFrameIcon").getImage()); // Prepares the glass pane to block the gui interaction when needed JPanel glassPane = (JPanel) getGlassPane(); glassPane.addMouseListener( new MouseAdapter() { }); glassPane.addMouseMotionListener( new MouseMotionAdapter() { }); glassPane.addKeyListener( new KeyAdapter() { }); // We set the layout & prepare the constraint object contentPane = (JPanel) getContentPane(); contentPane.setLayout(new BorderLayout());//layout); // We add the panels container panelsContainer = new JPanel(); panelsContainer.setBorder(BorderFactory.createEmptyBorder(10,10,0,10)); panelsContainer.setLayout(new GridLayout(1, 1)); contentPane.add(panelsContainer,BorderLayout.CENTER); // We put the first panel installdata.curPanelNumber = 0; IzPanel panel_0 = (IzPanel) installdata.panels.get(0); panelsContainer.add(panel_0); // We add the navigation buttons & labels NavigationHandler navHandler = new NavigationHandler(); JPanel navPanel = new JPanel(); navPanel.setLayout(new BoxLayout(navPanel, BoxLayout.X_AXIS)); navPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(8,8,8,8), BorderFactory.createTitledBorder(new EtchedLineBorder(), langpack.getString("installer.madewith")+" "))); navPanel.add(Box.createHorizontalGlue()); prevButton = ButtonFactory.createButton(langpack.getString("installer.prev"), icons.getImageIcon("stepback"), installdata.buttonsHColor); navPanel.add(prevButton); prevButton.addActionListener(navHandler); navPanel.add(Box.createRigidArea(new Dimension(5, 0))); nextButton = ButtonFactory.createButton(langpack.getString("installer.next"), icons.getImageIcon("stepforward"), installdata.buttonsHColor); navPanel.add(nextButton); nextButton.addActionListener(navHandler); navPanel.add(Box.createRigidArea(new Dimension(5, 0))); quitButton = ButtonFactory.createButton(langpack.getString("installer.quit"), icons.getImageIcon("stop"), installdata.buttonsHColor); navPanel.add(quitButton); quitButton.addActionListener(navHandler); contentPane.add(navPanel,BorderLayout.SOUTH); try { ResourceManager rm = new ResourceManager(installdata); ImageIcon icon = rm.getImageIconResource("Installer.image"); if (icon != null) { JPanel imgPanel = new JPanel(); imgPanel.setLayout(new BorderLayout()); imgPanel.setBorder(BorderFactory.createEmptyBorder(10,10,0,0)); JLabel label = new JLabel(icon); label.setBorder(BorderFactory.createLoweredBevelBorder()); imgPanel.add(label,BorderLayout.CENTER); contentPane.add(imgPanel,BorderLayout.WEST); } } catch (Exception e) { //ignore } getRootPane().setDefaultButton(nextButton); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/InstallerFrame.java/clean/src/lib/com/izforge/izpack/installer/InstallerFrame.java |
||
panelsContainer.add((JPanel) panel); | panelsContainer.add(panel); | private void switchPanel(int last) { panelsContainer.setVisible(false); IzPanel panel = (IzPanel) installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = (IzPanel) installdata.panels.get(last); l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last)); panelsContainer.remove(l_panel); panelsContainer.add((JPanel) panel); if (installdata.curPanelNumber == 0) { prevButton.setVisible(false); lockPrevButton(); unlockNextButton();// if we push the button back at the license panel } else if (installdata.curPanelNumber == installdata.panels.size() - 1) { prevButton.setVisible(false); nextButton.setVisible(false); lockNextButton(); } else { prevButton.setVisible(true); nextButton.setVisible(true); unlockPrevButton(); unlockNextButton(); } l_panel.panelDeactivate(); panel.panelActivate(); panelsContainer.setVisible(true); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/InstallerFrame.java/clean/src/lib/com/izforge/izpack/installer/InstallerFrame.java |
ArrayList files = udata.getFilesList(); | List files = udata.getFilesList(); | private void writeUninstallData() { try { // We get the data UninstallData udata = UninstallData.getInstance(); ArrayList files = udata.getFilesList(); ZipOutputStream outJar = installdata.uninstallOutJar; // We write the files log outJar.putNextEntry(new ZipEntry("install.log")); BufferedWriter logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); int size = files.size(); int lim = size - 1; logWriter.write(installdata.getInstallPath()); logWriter.newLine(); Iterator iter = files.iterator(); while (iter.hasNext()) { logWriter.write((String) iter.next()); if (iter.hasNext()) logWriter.newLine(); } logWriter.flush(); outJar.closeEntry(); // We write the uninstaller jar file log outJar.putNextEntry(new ZipEntry("jarlocation.log")); logWriter.write(udata.getUninstallerJarFilename()); logWriter.newLine(); logWriter.write(udata.getUninstallerPath()); logWriter.flush(); outJar.closeEntry(); // Cleanup outJar.flush(); outJar.close(); } catch (Exception err) { err.printStackTrace(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/InstallerFrame.java/clean/src/lib/com/izforge/izpack/installer/InstallerFrame.java |
int size = files.size(); int lim = size - 1; | private void writeUninstallData() { try { // We get the data UninstallData udata = UninstallData.getInstance(); ArrayList files = udata.getFilesList(); ZipOutputStream outJar = installdata.uninstallOutJar; // We write the files log outJar.putNextEntry(new ZipEntry("install.log")); BufferedWriter logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); int size = files.size(); int lim = size - 1; logWriter.write(installdata.getInstallPath()); logWriter.newLine(); Iterator iter = files.iterator(); while (iter.hasNext()) { logWriter.write((String) iter.next()); if (iter.hasNext()) logWriter.newLine(); } logWriter.flush(); outJar.closeEntry(); // We write the uninstaller jar file log outJar.putNextEntry(new ZipEntry("jarlocation.log")); logWriter.write(udata.getUninstallerJarFilename()); logWriter.newLine(); logWriter.write(udata.getUninstallerPath()); logWriter.flush(); outJar.closeEntry(); // Cleanup outJar.flush(); outJar.close(); } catch (Exception err) { err.printStackTrace(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/InstallerFrame.java/clean/src/lib/com/izforge/izpack/installer/InstallerFrame.java |
|
outJar.closeEntry(); outJar.putNextEntry(new ZipEntry("executables")); ObjectOutputStream execStream = new ObjectOutputStream(outJar); iter = udata.getExecutablesList().iterator(); execStream.writeInt(udata.getExecutablesList().size()); while (iter.hasNext()) { ExecutableFile file = (ExecutableFile)iter.next(); execStream.writeObject(file); } execStream.flush(); | private void writeUninstallData() { try { // We get the data UninstallData udata = UninstallData.getInstance(); ArrayList files = udata.getFilesList(); ZipOutputStream outJar = installdata.uninstallOutJar; // We write the files log outJar.putNextEntry(new ZipEntry("install.log")); BufferedWriter logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); int size = files.size(); int lim = size - 1; logWriter.write(installdata.getInstallPath()); logWriter.newLine(); Iterator iter = files.iterator(); while (iter.hasNext()) { logWriter.write((String) iter.next()); if (iter.hasNext()) logWriter.newLine(); } logWriter.flush(); outJar.closeEntry(); // We write the uninstaller jar file log outJar.putNextEntry(new ZipEntry("jarlocation.log")); logWriter.write(udata.getUninstallerJarFilename()); logWriter.newLine(); logWriter.write(udata.getUninstallerPath()); logWriter.flush(); outJar.closeEntry(); // Cleanup outJar.flush(); outJar.close(); } catch (Exception err) { err.printStackTrace(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/InstallerFrame.java/clean/src/lib/com/izforge/izpack/installer/InstallerFrame.java |
|
add(this.tipLabel, NEXT_LINE); | add(this.tipLabel, IzPanelLayout.getDefaultConstraint(FULL_LINE_CONTROL_CONSTRAINT)); | public InstallPanel(InstallerFrame parent, InstallData idata) { super(parent, idata, new IzPanelLayout()); this.tipLabel = LabelFactory.create(parent.langpack.getString("InstallPanel.tip"), parent.icons.getImageIcon("information"), LEADING); add(this.tipLabel, NEXT_LINE); packOpLabel = LabelFactory.create(" ", LEADING); add(packOpLabel, NEXT_LINE); packProgressBar = new JProgressBar(); packProgressBar.setStringPainted(true); packProgressBar.setString(parent.langpack.getString("InstallPanel.begin")); packProgressBar.setValue(0); add(packProgressBar, IzPanelLayout.getDefaultConstraint(FULL_LINE_CONTROL_CONSTRAINT)); // make sure there is some space between the progress bars add(IzPanelLayout.createParagraphGap()); overallOpLabel = LabelFactory.create(parent.langpack.getString("InstallPanel.progress"), parent.icons.getImageIcon("information"), LEADING); add(this.overallOpLabel, NEXT_LINE); overallProgressBar = new JProgressBar(); overallProgressBar.setStringPainted(true); overallProgressBar.setString(""); overallProgressBar.setValue(0); add(this.overallProgressBar, IzPanelLayout.getDefaultConstraint(FULL_LINE_CONTROL_CONSTRAINT)); getLayoutHelper().completeLayout(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/70962d5e45783a05271609095130a61620295d86/InstallPanel.java/clean/src/lib/com/izforge/izpack/panels/InstallPanel.java |
add(packOpLabel, NEXT_LINE); | add(packOpLabel, IzPanelLayout.getDefaultConstraint(FULL_LINE_CONTROL_CONSTRAINT)); | public InstallPanel(InstallerFrame parent, InstallData idata) { super(parent, idata, new IzPanelLayout()); this.tipLabel = LabelFactory.create(parent.langpack.getString("InstallPanel.tip"), parent.icons.getImageIcon("information"), LEADING); add(this.tipLabel, NEXT_LINE); packOpLabel = LabelFactory.create(" ", LEADING); add(packOpLabel, NEXT_LINE); packProgressBar = new JProgressBar(); packProgressBar.setStringPainted(true); packProgressBar.setString(parent.langpack.getString("InstallPanel.begin")); packProgressBar.setValue(0); add(packProgressBar, IzPanelLayout.getDefaultConstraint(FULL_LINE_CONTROL_CONSTRAINT)); // make sure there is some space between the progress bars add(IzPanelLayout.createParagraphGap()); overallOpLabel = LabelFactory.create(parent.langpack.getString("InstallPanel.progress"), parent.icons.getImageIcon("information"), LEADING); add(this.overallOpLabel, NEXT_LINE); overallProgressBar = new JProgressBar(); overallProgressBar.setStringPainted(true); overallProgressBar.setString(""); overallProgressBar.setValue(0); add(this.overallProgressBar, IzPanelLayout.getDefaultConstraint(FULL_LINE_CONTROL_CONSTRAINT)); getLayoutHelper().completeLayout(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/70962d5e45783a05271609095130a61620295d86/InstallPanel.java/clean/src/lib/com/izforge/izpack/panels/InstallPanel.java |
add(this.overallOpLabel, NEXT_LINE); | add(this.overallOpLabel, IzPanelLayout.getDefaultConstraint(FULL_LINE_CONTROL_CONSTRAINT)); | public InstallPanel(InstallerFrame parent, InstallData idata) { super(parent, idata, new IzPanelLayout()); this.tipLabel = LabelFactory.create(parent.langpack.getString("InstallPanel.tip"), parent.icons.getImageIcon("information"), LEADING); add(this.tipLabel, NEXT_LINE); packOpLabel = LabelFactory.create(" ", LEADING); add(packOpLabel, NEXT_LINE); packProgressBar = new JProgressBar(); packProgressBar.setStringPainted(true); packProgressBar.setString(parent.langpack.getString("InstallPanel.begin")); packProgressBar.setValue(0); add(packProgressBar, IzPanelLayout.getDefaultConstraint(FULL_LINE_CONTROL_CONSTRAINT)); // make sure there is some space between the progress bars add(IzPanelLayout.createParagraphGap()); overallOpLabel = LabelFactory.create(parent.langpack.getString("InstallPanel.progress"), parent.icons.getImageIcon("information"), LEADING); add(this.overallOpLabel, NEXT_LINE); overallProgressBar = new JProgressBar(); overallProgressBar.setStringPainted(true); overallProgressBar.setString(""); overallProgressBar.setValue(0); add(this.overallProgressBar, IzPanelLayout.getDefaultConstraint(FULL_LINE_CONTROL_CONSTRAINT)); getLayoutHelper().completeLayout(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/70962d5e45783a05271609095130a61620295d86/InstallPanel.java/clean/src/lib/com/izforge/izpack/panels/InstallPanel.java |
public ShortcutPanel(InstallerFrame parent, InstallData installData) { super (parent, installData); // read the XML file try { readShortcutSpec (); } catch (Throwable exception) { System.out.println ("could not read shortcut spec!"); exception.printStackTrace (); } layout = new GridBagLayout (); constraints = new GridBagConstraints (); setLayout(layout); // Create the UI elements try { shortcut = (Shortcut)(TargetFactory.getInstance ().makeObject ("com.izforge.izpack.util.os.Shortcut")); shortcut.initialize (Shortcut.APPLICATIONS, "-"); } catch (Throwable exception) { System.out.println ("could not create shortcut instance"); exception.printStackTrace (); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
public ShortcutPanel(InstallerFrame parent, InstallData installData) { super (parent, installData); // read the XML file try { readShortcutSpec (); } catch (Throwable exception) { System.out.println ("could not read shortcut spec!"); exception.printStackTrace (); } layout = new GridBagLayout (); constraints = new GridBagConstraints (); setLayout(layout); // Create the UI elements try { shortcut = (Shortcut)(TargetFactory.getInstance ().makeObject ("com.izforge.izpack.util.os.Shortcut")); shortcut.initialize (Shortcut.APPLICATIONS, "-"); } catch (Throwable exception) { System.out.println ("could not create shortcut instance"); exception.printStackTrace (); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
public void actionPerformed (ActionEvent event) { Object eventSource = event.getSource (); // ---------------------------------------------------- // create shortcut for the current user was selected // refresh the list of program groups accordingly and // reset the program group to the default setting. // ---------------------------------------------------- if (eventSource.equals (currentUser)) { groupList.setListData (shortcut.getProgramGroups (Shortcut.CURRENT_USER)); programGroup.setText (suggestedProgramGroup); shortcut.setUserType (Shortcut.CURRENT_USER); } // ---------------------------------------------------- // create shortcut for all users was selected // refresh the list of program groups accordingly and // reset the program group to the default setting. // ---------------------------------------------------- else if (eventSource.equals (allUsers)) { groupList.setListData (shortcut.getProgramGroups (Shortcut.ALL_USERS)); programGroup.setText (suggestedProgramGroup); shortcut.setUserType (Shortcut.ALL_USERS); } // ---------------------------------------------------- // The reset button was pressed. // - clear the selection in the list box, because the // selection is no longer valid // - refill the program group edit control with the // suggested program group name // ---------------------------------------------------- else if (eventSource.equals (defaultButton)) { groupList.getSelectionModel ().clearSelection (); programGroup.setText (suggestedProgramGroup); } // ---------------------------------------------------- // the save button was pressed. This is a request to // save shortcut information to a text file. // ---------------------------------------------------- else if (eventSource.equals (saveButton)) { saveToFile (); // add the file to the uninstaller addToUninstaller (); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void addToUninstaller () { UninstallData uninstallData = UninstallData.getInstance (); for (int i = 0; i < files.size (); i++) { uninstallData.addFile ((String)files.elementAt (i)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
if (data.name == null) | if (data.name == null) | private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
if( data.target == null ) | if( data.target == null ) | private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
if (!shortcutRequiredFor (forPacks)) | if (!shortcutRequiredFor (forPacks)) | private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ); data.subgroup = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_SUBGROUP ); data.description = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_DESCRIPTION, "" ); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ENCODING, "" ); data.deskTopEntryLinux_MimeType = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_MIMETYPE, "" ); data.deskTopEntryLinux_Terminal = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL, "" ); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "" ); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TYPE, "" ); data.deskTopEntryLinux_URL = substitutor.substitute( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, "" ), null ); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, "" ); //** EndOf LINUX **// temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TARGET, "" ) ); data.target = substitutor.substitute( temp, null ); temp = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_COMMAND, "" ); data.commandLine = substitutor.substitute( temp, null ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON, "" ) ); data.iconFile = substitutor.substitute( temp, null ); data.iconIndex = Integer.parseInt( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_ICON_INDEX, "0" ) ); temp = fixSeparatorChar( shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "" ) ); data.workingDirectory = substitutor.substitute( temp, null ); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if( data.target == null ) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
||
private boolean attributeIsTrue (XMLElement element, String name) { String value = element.getAttribute (name, "").toUpperCase (); if (value.equals ("YES")) { return (true); } else if (value.equals ("TRUE")) { return (true); } else if (value.equals ("ON")) { return (true); } else if (value.equals ("1")) { return (true); } return (false); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java |
Subsets and Splits