rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
setDisplay(jobDisplay);
public UIJob(Display jobDisplay, String name) { super(name); setDisplay(jobDisplay); }
if (items.length == 0) return null; int lastItem = getLastItem(); lastItem = Math.min(items.length - 1, lastItem + 1); for (int i = topTabIndex; i <= lastItem; i++) { Rectangle bounds = items[i].getBounds(); if (bounds.contains(pt)) return items[i]; } return null;
if (index < 0 || index >= items.length) { SWT.error(SWT.ERROR_INVALID_RANGE); } return items[index];
public CTabItem getItem(Point pt) { //checkWidget(); if (items.length == 0) return null; int lastItem = getLastItem(); lastItem = Math.min(items.length - 1, lastItem + 1); for (int i = topTabIndex; i <= lastItem; i++) { Rectangle bounds = items[i].getBounds(); if (bounds.contains(pt)) return items[i]; } return null; }
public SearchPattern(String pattern, int allowedRules) { initializePatternAndMatchRule(pattern); matchRule = matchRule & allowedRules; if (matchRule == RULE_PATTERN_MATCH) { stringMatcher = new StringMatcher(stringPattern, true, false); }
public SearchPattern() { this(RULE_EXACT_MATCH | RULE_PREFIX_MATCH | RULE_PATTERN_MATCH | RULE_CAMELCASE_MATCH);
public SearchPattern(String pattern, int allowedRules) { initializePatternAndMatchRule(pattern); matchRule = matchRule & allowedRules; if (matchRule == RULE_PATTERN_MATCH) { stringMatcher = new StringMatcher(stringPattern, true, false); } }
public static RubyObject convertJavaToRuby(Ruby ruby, Object object, Class javaClass) {
public static RubyObject convertJavaToRuby(Ruby ruby, Object object) {
public static RubyObject convertJavaToRuby(Ruby ruby, Object object, Class javaClass) { if (object == null) { return ruby.getNil(); } if (javaClass == null) { javaClass = object.getClass(); } if (javaClass.isPrimitive()) { String cName = javaClass.getName(); if (cName == "boolean") { return RubyBoolean.newBoolean(ruby, ((Boolean) object).booleanValue()); } else if (cName == "float" || cName == "double") { return RubyFloat.newFloat(ruby, ((Number) object).doubleValue()); } else if (cName == "char") { return RubyFixnum.newFixnum(ruby, ((Character) object).charValue()); } else { // else it's one of the integral types return RubyFixnum.newFixnum(ruby, ((Number) object).longValue()); } } else if (javaClass == String.class) { return RubyString.newString(ruby, object.toString()); } else if (javaClass.isArray()) { Class arrayClass = javaClass.getComponentType(); int len = Array.getLength(object); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, Array.get(object, i), arrayClass); } return RubyArray.create(ruby, null, items); } else if (List.class.isAssignableFrom(javaClass)) { int len = ((List) object).size(); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, ((List) object).get(i), null); } return RubyArray.create(ruby, null, items); } else if (Map.class.isAssignableFrom(javaClass)) { int len = ((Map) object).size(); RubyObject[] items = new RubyObject[len * 2]; Iterator iter = ((Map) object).entrySet().iterator(); for (int i = 0; i < len; i++) { Map.Entry entry = (Map.Entry) iter.next(); items[2 * i] = convertJavaToRuby(ruby, entry.getKey(), null); items[2 * i + 1] = convertJavaToRuby(ruby, entry.getValue(), null); } return RubyHash.create(ruby, null, items); } else { return new RubyJavaObject(ruby, (RubyClass)ruby.getJavaSupport().loadClass(javaClass, null), object); } }
if (javaClass == null) { javaClass = object.getClass(); }
Class javaClass = object.getClass();
public static RubyObject convertJavaToRuby(Ruby ruby, Object object, Class javaClass) { if (object == null) { return ruby.getNil(); } if (javaClass == null) { javaClass = object.getClass(); } if (javaClass.isPrimitive()) { String cName = javaClass.getName(); if (cName == "boolean") { return RubyBoolean.newBoolean(ruby, ((Boolean) object).booleanValue()); } else if (cName == "float" || cName == "double") { return RubyFloat.newFloat(ruby, ((Number) object).doubleValue()); } else if (cName == "char") { return RubyFixnum.newFixnum(ruby, ((Character) object).charValue()); } else { // else it's one of the integral types return RubyFixnum.newFixnum(ruby, ((Number) object).longValue()); } } else if (javaClass == String.class) { return RubyString.newString(ruby, object.toString()); } else if (javaClass.isArray()) { Class arrayClass = javaClass.getComponentType(); int len = Array.getLength(object); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, Array.get(object, i), arrayClass); } return RubyArray.create(ruby, null, items); } else if (List.class.isAssignableFrom(javaClass)) { int len = ((List) object).size(); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, ((List) object).get(i), null); } return RubyArray.create(ruby, null, items); } else if (Map.class.isAssignableFrom(javaClass)) { int len = ((Map) object).size(); RubyObject[] items = new RubyObject[len * 2]; Iterator iter = ((Map) object).entrySet().iterator(); for (int i = 0; i < len; i++) { Map.Entry entry = (Map.Entry) iter.next(); items[2 * i] = convertJavaToRuby(ruby, entry.getKey(), null); items[2 * i + 1] = convertJavaToRuby(ruby, entry.getValue(), null); } return RubyHash.create(ruby, null, items); } else { return new RubyJavaObject(ruby, (RubyClass)ruby.getJavaSupport().loadClass(javaClass, null), object); } }
items[i] = convertJavaToRuby(ruby, Array.get(object, i), arrayClass);
items[i] = convertJavaToRuby(ruby, Array.get(object, i));
public static RubyObject convertJavaToRuby(Ruby ruby, Object object, Class javaClass) { if (object == null) { return ruby.getNil(); } if (javaClass == null) { javaClass = object.getClass(); } if (javaClass.isPrimitive()) { String cName = javaClass.getName(); if (cName == "boolean") { return RubyBoolean.newBoolean(ruby, ((Boolean) object).booleanValue()); } else if (cName == "float" || cName == "double") { return RubyFloat.newFloat(ruby, ((Number) object).doubleValue()); } else if (cName == "char") { return RubyFixnum.newFixnum(ruby, ((Character) object).charValue()); } else { // else it's one of the integral types return RubyFixnum.newFixnum(ruby, ((Number) object).longValue()); } } else if (javaClass == String.class) { return RubyString.newString(ruby, object.toString()); } else if (javaClass.isArray()) { Class arrayClass = javaClass.getComponentType(); int len = Array.getLength(object); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, Array.get(object, i), arrayClass); } return RubyArray.create(ruby, null, items); } else if (List.class.isAssignableFrom(javaClass)) { int len = ((List) object).size(); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, ((List) object).get(i), null); } return RubyArray.create(ruby, null, items); } else if (Map.class.isAssignableFrom(javaClass)) { int len = ((Map) object).size(); RubyObject[] items = new RubyObject[len * 2]; Iterator iter = ((Map) object).entrySet().iterator(); for (int i = 0; i < len; i++) { Map.Entry entry = (Map.Entry) iter.next(); items[2 * i] = convertJavaToRuby(ruby, entry.getKey(), null); items[2 * i + 1] = convertJavaToRuby(ruby, entry.getValue(), null); } return RubyHash.create(ruby, null, items); } else { return new RubyJavaObject(ruby, (RubyClass)ruby.getJavaSupport().loadClass(javaClass, null), object); } }
items[i] = convertJavaToRuby(ruby, ((List) object).get(i), null);
items[i] = convertJavaToRuby(ruby, ((List) object).get(i));
public static RubyObject convertJavaToRuby(Ruby ruby, Object object, Class javaClass) { if (object == null) { return ruby.getNil(); } if (javaClass == null) { javaClass = object.getClass(); } if (javaClass.isPrimitive()) { String cName = javaClass.getName(); if (cName == "boolean") { return RubyBoolean.newBoolean(ruby, ((Boolean) object).booleanValue()); } else if (cName == "float" || cName == "double") { return RubyFloat.newFloat(ruby, ((Number) object).doubleValue()); } else if (cName == "char") { return RubyFixnum.newFixnum(ruby, ((Character) object).charValue()); } else { // else it's one of the integral types return RubyFixnum.newFixnum(ruby, ((Number) object).longValue()); } } else if (javaClass == String.class) { return RubyString.newString(ruby, object.toString()); } else if (javaClass.isArray()) { Class arrayClass = javaClass.getComponentType(); int len = Array.getLength(object); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, Array.get(object, i), arrayClass); } return RubyArray.create(ruby, null, items); } else if (List.class.isAssignableFrom(javaClass)) { int len = ((List) object).size(); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, ((List) object).get(i), null); } return RubyArray.create(ruby, null, items); } else if (Map.class.isAssignableFrom(javaClass)) { int len = ((Map) object).size(); RubyObject[] items = new RubyObject[len * 2]; Iterator iter = ((Map) object).entrySet().iterator(); for (int i = 0; i < len; i++) { Map.Entry entry = (Map.Entry) iter.next(); items[2 * i] = convertJavaToRuby(ruby, entry.getKey(), null); items[2 * i + 1] = convertJavaToRuby(ruby, entry.getValue(), null); } return RubyHash.create(ruby, null, items); } else { return new RubyJavaObject(ruby, (RubyClass)ruby.getJavaSupport().loadClass(javaClass, null), object); } }
items[2 * i] = convertJavaToRuby(ruby, entry.getKey(), null); items[2 * i + 1] = convertJavaToRuby(ruby, entry.getValue(), null);
items[2 * i] = convertJavaToRuby(ruby, entry.getKey()); items[2 * i + 1] = convertJavaToRuby(ruby, entry.getValue());
public static RubyObject convertJavaToRuby(Ruby ruby, Object object, Class javaClass) { if (object == null) { return ruby.getNil(); } if (javaClass == null) { javaClass = object.getClass(); } if (javaClass.isPrimitive()) { String cName = javaClass.getName(); if (cName == "boolean") { return RubyBoolean.newBoolean(ruby, ((Boolean) object).booleanValue()); } else if (cName == "float" || cName == "double") { return RubyFloat.newFloat(ruby, ((Number) object).doubleValue()); } else if (cName == "char") { return RubyFixnum.newFixnum(ruby, ((Character) object).charValue()); } else { // else it's one of the integral types return RubyFixnum.newFixnum(ruby, ((Number) object).longValue()); } } else if (javaClass == String.class) { return RubyString.newString(ruby, object.toString()); } else if (javaClass.isArray()) { Class arrayClass = javaClass.getComponentType(); int len = Array.getLength(object); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, Array.get(object, i), arrayClass); } return RubyArray.create(ruby, null, items); } else if (List.class.isAssignableFrom(javaClass)) { int len = ((List) object).size(); RubyObject[] items = new RubyObject[len]; for (int i = 0; i < len; i++) { items[i] = convertJavaToRuby(ruby, ((List) object).get(i), null); } return RubyArray.create(ruby, null, items); } else if (Map.class.isAssignableFrom(javaClass)) { int len = ((Map) object).size(); RubyObject[] items = new RubyObject[len * 2]; Iterator iter = ((Map) object).entrySet().iterator(); for (int i = 0; i < len; i++) { Map.Entry entry = (Map.Entry) iter.next(); items[2 * i] = convertJavaToRuby(ruby, entry.getKey(), null); items[2 * i + 1] = convertJavaToRuby(ruby, entry.getValue(), null); } return RubyHash.create(ruby, null, items); } else { return new RubyJavaObject(ruby, (RubyClass)ruby.getJavaSupport().loadClass(javaClass, null), object); } }
public static String getCompanyId(ActionRequest req) { ActionRequestImpl reqImpl = (ActionRequestImpl)req;
public static String getCompanyId(HttpServletRequest req) { String companyId = (String)req.getSession().getAttribute(WebKeys.COMPANY_ID);
public static String getCompanyId(ActionRequest req) { ActionRequestImpl reqImpl = (ActionRequestImpl)req; return getCompanyId(reqImpl.getHttpServletRequest()); }
return getCompanyId(reqImpl.getHttpServletRequest());
if (companyId == null) { companyId = (String)req.getAttribute(WebKeys.COMPANY_ID); } return companyId;
public static String getCompanyId(ActionRequest req) { ActionRequestImpl reqImpl = (ActionRequestImpl)req; return getCompanyId(reqImpl.getHttpServletRequest()); }
if (totalPlannedSizeUploadingTo <= 5 * 1024 * 1024) {
if (noUploadYet || totalPlannedSizeUploadingTo <= 500 * 1024) {
private void checkQueuedUploads() { // Check uploads to start List<Upload> uploadsToStart = new LinkedList<Upload>(); Map<Member, Long> uploadSizeToStartNodes = new HashMap<Member, Long>(); List<Upload> uploadsToBreak = new ArrayList<Upload>(); if (logVerbose) { log().verbose( "Checking " + queuedUploads.size() + " queued uploads"); } synchronized (queuedUploads) { for (Iterator it = queuedUploads.iterator(); it.hasNext();) { Upload upload = (Upload) it.next(); if (upload.isBroken()) { // add to break dls uploadsToBreak.add(upload); } else if (hasFreeUploadSlots() || upload.getPartner().isOnLAN()) { // The total size planned+current uploading to that node. long totalPlannedSizeUploadingTo = uploadingToSize(upload .getPartner()); if (totalPlannedSizeUploadingTo < 0) { totalPlannedSizeUploadingTo = 0; } Long plannedSizeUploadingTo = uploadSizeToStartNodes .get(upload.getPartner()); if (plannedSizeUploadingTo != null) { totalPlannedSizeUploadingTo += plannedSizeUploadingTo .longValue(); } totalPlannedSizeUploadingTo += upload.getFile().getSize(); if (totalPlannedSizeUploadingTo <= 5 * 1024 * 1024) { if (totalPlannedSizeUploadingTo >= 0) { log() .warn( "Starting another upload to " + upload.getPartner().getNick() + ". Total size to upload to: " + Format .formatBytesShort(totalPlannedSizeUploadingTo)); } // start the upload if we have free slots // and not uploading to member currently // or user is on local network // TODO should check if this file is not sended (or is // being send) to other user in the last minute or so to // allow for disitributtion of that file by user that // just received that file from us // Enqueue upload to friends and lan members first int uploadIndex = upload.getPartner().isFriend() ? 0 : uploadsToStart.size(); log() .verbose( "Starting upload at queue position: " + uploadIndex); uploadsToStart.add(uploadIndex, upload); uploadSizeToStartNodes.put(upload.getPartner(), Long .valueOf(upload.getFile().getSize())); } } } } if (logVerbose) { log().verbose( "Starting " + uploadsToStart.size() + " Uploads, " + uploadsToBreak.size() + " are getting broken"); } // Start uploads for (Iterator it = uploadsToStart.iterator(); it.hasNext();) { Upload upload = (Upload) it.next(); upload.start(); } for (Iterator it = uploadsToBreak.iterator(); it.hasNext();) { Upload upload = (Upload) it.next(); // Set broken setBroken(upload); } }
public static void addListener(Object listenerSupport, Object listener) {
public static void addListener(ListenerInterface listenerSupport, ListenerInterface listener) {
public static void addListener(Object listenerSupport, Object listener) { if (listenerSupport == null) { throw new NullPointerException("Listener support is null"); } if (!Proxy.isProxyClass(listenerSupport.getClass())) { throw new IllegalArgumentException( "Listener support is not valid. Seems not to be created with createListenerSupport."); } InvocationHandler invHandler = Proxy .getInvocationHandler(listenerSupport); if (invHandler instanceof ListenerSupportInvocationHandler) { ListenerSupportInvocationHandler lsInvHandler = (ListenerSupportInvocationHandler) invHandler; // Now add listener lsInvHandler.addListener(listener); } else { throw new IllegalArgumentException( "Listener support is not valid. Seems not to be created with createListenerSupport."); } }
log().verbose( "Wrote " + chunk.data.length + " bytes to tempfile " + tempFile.getAbsolutePath());
public synchronized void addChunk(FileChunk chunk) { Reject.ifNull(chunk, "Chunk is null"); if (isBroken()) { return; } if (!isStarted()) { // donwload begins to start setStarted(); } lastTouch.setTime(System.currentTimeMillis()); // check tempfile File tempFile = getTempFile(); // create subdirs File subdirs = tempFile.getParentFile(); if (!subdirs.exists()) { // TODO check if works else give warning because of invalid // directory name // and move to blacklist subdirs.mkdirs(); log().verbose("Subdirectory created: " + subdirs); } if (tempFile.exists() && chunk.offset == 0) { // download started from offset 0 new, remove file, // "erase and rewind" ;) if (!tempFile.delete()) { log().error( "Unable to removed broken tempfile for download: " + tempFile.getAbsolutePath()); tempFileError = true; abort(); return; } } if (!tempFile.exists()) { try { // TODO check if works else give warning because of invalid // filename or diskfull? // and move to blacklist tempFile.createNewFile(); } catch (IOException e) { log().error( "Unable to create/open tempfile for donwload: " + tempFile.getAbsolutePath() + ". " + e.getMessage()); tempFileError = true; abort(); return; } } // log().warn("Tempfile exists ? " + tempFile.exists() + ", " + // tempFile.getAbsolutePath()); if (!tempFile.canWrite()) { log().error( "Unable to write to tempfile for donwload: " + tempFile.getAbsolutePath()); tempFileError = true; abort(); return; } try { if (raf == null) { raf = new RandomAccessFile(tempFile, "rw"); } // check chunk validity if (chunk.offset < 0 || chunk.offset > getFile().getSize() || chunk.data == null || (chunk.data.length + chunk.offset > getFile().getSize()) || chunk.offset != raf.length()) { String reason = "unknown"; if (chunk.offset < 0 || chunk.offset > getFile().getSize()) { reason = "Illegal offset " + chunk.offset; } if (chunk.data == null) { reason = "Chunk data null"; } else { if (chunk.data.length + chunk.offset > getFile().getSize()) { reason = "Chunk exceeds filesize"; } if (chunk.offset != raf.length()) { reason = "Offset does not matches the current tempfile size. offset: " + chunk.offset + ", filesize: " + tempFile.length(); } } log().error( "Received illegal chunk. " + chunk + ". Reason: " + reason); // Abort dl abort(); return; } // add bytes to transferred status getCounter().chunkTransferred(chunk); FolderStatistic stat = getFile().getFolder(getController().getFolderRepository()) .getStatistic(); if (stat != null) { stat.getDownloadCounter().chunkTransferred(chunk); } // FIXME: Parse offset/not expect linar download // FIXME: Don't use a BufferedOutputStream // FIXME: Don't open the file over and over again /* Old code: OutputStream fOut = new BufferedOutputStream(new FileOutputStream( tempFile, true)); fOut.write(chunk.data); fOut.close(); */ // Testing code: raf.seek(chunk.offset); raf.write(chunk.data); // Set lastmodified date of file info /* * log().warn( "Setting lastmodified of tempfile for: " + * getFile().toDetailString()); */ // FIXME: This generates alot of head-jumps on the harddisc! tempFile.setLastModified(getFile().getModifiedDate().getTime()); log().verbose( "Wrote " + chunk.data.length + " bytes to tempfile " + tempFile.getAbsolutePath()); } catch (IOException e) { // TODO: Disk full warning ? log().error( "Error while writing to tempfile for donwload: " + tempFile.getAbsolutePath() + ". " + e.getMessage()); log().verbose(e); tempFileError = true; abort(); return; } // FIXME: currently the trigger to stop dl is // the arrival of a chunk which matches exactly to // the last chunk of the file if (!completed) { completed = chunk.data.length + chunk.offset == getFile().getSize(); if (completed) { // Finish download log().debug("Download completed: " + this); // Inform transfer manager getTransferManager().setCompleted(this); } } }
Download(TransferManager tm, FileInfo file, boolean automatic) { super(tm, file, null); this.lastTouch = new Date(); this.automatic = automatic; this.queued = false; this.completed = false; this.tempFileError = false; File tempFile = getTempFile(); if (tempFile != null && tempFile.exists()) { String reason = ""; if (file.getSize() > tempFile.length() && Convert.convertToGlobalPrecision(file.getModifiedDate() .getTime()) == Convert.convertToGlobalPrecision(tempFile .lastModified())) { setStartOffset(tempFile.length()); } else { if (file.getModifiedDate().getTime() != tempFile.lastModified()) { reason = ": Modified date of tempfile (" + new Date(Convert.convertToGlobalPrecision(tempFile .lastModified())) + ") does not match with file (" + new Date(Convert.convertToGlobalPrecision(file .getModifiedDate().getTime())) + ")"; } tempFile.delete(); setStartOffset(0); } log().verbose( "Tempfile exists for " + file + ", tempFile: " + tempFile + ", " + (tempFile.exists() ? "using it" : "removed") + " " + reason); }
public Download() {
Download(TransferManager tm, FileInfo file, boolean automatic) { super(tm, file, null); // from can be null this.lastTouch = new Date(); this.automatic = automatic; this.queued = false; this.completed = false; this.tempFileError = false; File tempFile = getTempFile(); if (tempFile != null && tempFile.exists()) { String reason = ""; // Compare with global file date precision, because of // different precisions on different filesystems (e.g. FAT32 only // supports second near values) if (file.getSize() > tempFile.length() && Convert.convertToGlobalPrecision(file.getModifiedDate() .getTime()) == Convert.convertToGlobalPrecision(tempFile .lastModified())) { // Set offset only if file matches exactly setStartOffset(tempFile.length()); } else { if (file.getModifiedDate().getTime() != tempFile.lastModified()) { reason = ": Modified date of tempfile (" + new Date(Convert.convertToGlobalPrecision(tempFile .lastModified())) + ") does not match with file (" + new Date(Convert.convertToGlobalPrecision(file .getModifiedDate().getTime())) + ")"; } // Otherwise delete tempfile an start at 0 tempFile.delete(); setStartOffset(0); } log().verbose( "Tempfile exists for " + file + ", tempFile: " + tempFile + ", " + (tempFile.exists() ? "using it" : "removed") + " " + reason); } }
if (myThread != null) { myThread.interrupt(); }
void shutdown() { super.shutdown(); if (myThread != null) { myThread.interrupt(); } }
public static void removeListener(Object listenerSupport, Object listener) {
public static void removeListener(Object listenerSupport, ListenerInterface listener) {
public static void removeListener(Object listenerSupport, Object listener) { if (listenerSupport == null) { throw new NullPointerException("Listener support is null"); } if (!Proxy.isProxyClass(listenerSupport.getClass())) { throw new IllegalArgumentException( "Listener support is not valid. Seems not to be created with createListenerSupport."); } InvocationHandler invHandler = Proxy .getInvocationHandler(listenerSupport); if (invHandler instanceof ListenerSupportInvocationHandler) { ListenerSupportInvocationHandler lsInvHandler = (ListenerSupportInvocationHandler) invHandler; // Now remove the listener lsInvHandler.removeListener(listener); } else { throw new IllegalArgumentException( "Listener support is not valid. Seems not to be created with createListenerSupport."); } }
public String toDetailString() { String modifiedNick;
public final void toDetailString(StringBuilder str) { if (deleted) { str.append("(del) "); } str.append(toString()); str.append(", size: "); str.append(size); str.append(" bytes, version: "); str.append(getVersion()); str.append(", modified: "); str.append(lastModifiedDate); str.append(" ("); str.append(lastModifiedDate.getTime()); str.append(") by '");
public String toDetailString() { String modifiedNick; if (modifiedBy == null) { modifiedNick = "-unknown-"; } else { modifiedNick = modifiedBy.nick; } return (deleted ? "(del) " : "") + toString() + ", size: " + size + " bytes, version: " + getVersion() + ", modified: " + lastModifiedDate + " (" + lastModifiedDate.getTime() + ") by '" + modifiedNick + "'"; }
modifiedNick = "-unknown-";
str.append("-unknown-");
public String toDetailString() { String modifiedNick; if (modifiedBy == null) { modifiedNick = "-unknown-"; } else { modifiedNick = modifiedBy.nick; } return (deleted ? "(del) " : "") + toString() + ", size: " + size + " bytes, version: " + getVersion() + ", modified: " + lastModifiedDate + " (" + lastModifiedDate.getTime() + ") by '" + modifiedNick + "'"; }
modifiedNick = modifiedBy.nick;
str.append(modifiedBy.nick);
public String toDetailString() { String modifiedNick; if (modifiedBy == null) { modifiedNick = "-unknown-"; } else { modifiedNick = modifiedBy.nick; } return (deleted ? "(del) " : "") + toString() + ", size: " + size + " bytes, version: " + getVersion() + ", modified: " + lastModifiedDate + " (" + lastModifiedDate.getTime() + ") by '" + modifiedNick + "'"; }
return (deleted ? "(del) " : "") + toString() + ", size: " + size + " bytes, version: " + getVersion() + ", modified: " + lastModifiedDate + " (" + lastModifiedDate.getTime() + ") by '" + modifiedNick + "'";
str.append("'");
public String toDetailString() { String modifiedNick; if (modifiedBy == null) { modifiedNick = "-unknown-"; } else { modifiedNick = modifiedBy.nick; } return (deleted ? "(del) " : "") + toString() + ", size: " + size + " bytes, version: " + getVersion() + ", modified: " + lastModifiedDate + " (" + lastModifiedDate.getTime() + ") by '" + modifiedNick + "'"; }
"****************** " + fileNameProblemEvent.getFolder() + " "
fileNameProblemEvent.getFolder() + " "
public void fileNameProblemsDetected( FileNameProblemEvent fileNameProblemEvent) { log().debug( "****************** " + fileNameProblemEvent.getFolder() + " " + fileNameProblemEvent.getScanResult().getProblemFiles()); final FilenameProblemDialog dialog = new FilenameProblemDialog( getController(), fileNameProblemEvent.getScanResult()); Runnable runner = new Runnable() { public void run() { dialog.open(); } }; UIUtil.invokeLaterInEDT(runner); }
final FilenameProblemDialog dialog = new FilenameProblemDialog(
FilenameProblemDialog dialog = new FilenameProblemDialog(
public void fileNameProblemsDetected( FileNameProblemEvent fileNameProblemEvent) { log().debug( "****************** " + fileNameProblemEvent.getFolder() + " " + fileNameProblemEvent.getScanResult().getProblemFiles()); final FilenameProblemDialog dialog = new FilenameProblemDialog( getController(), fileNameProblemEvent.getScanResult()); Runnable runner = new Runnable() { public void run() { dialog.open(); } }; UIUtil.invokeLaterInEDT(runner); }
Runnable runner = new Runnable() { public void run() { dialog.open(); } }; UIUtil.invokeLaterInEDT(runner);
dialog.open();
public void fileNameProblemsDetected( FileNameProblemEvent fileNameProblemEvent) { log().debug( "****************** " + fileNameProblemEvent.getFolder() + " " + fileNameProblemEvent.getScanResult().getProblemFiles()); final FilenameProblemDialog dialog = new FilenameProblemDialog( getController(), fileNameProblemEvent.getScanResult()); Runnable runner = new Runnable() { public void run() { dialog.open(); } }; UIUtil.invokeLaterInEDT(runner); }
this.queuedUploads = Collections.synchronizedList(new LinkedList()); this.activeUploads = Collections.synchronizedList(new LinkedList());
this.queuedUploads = Collections .synchronizedList(new LinkedList<Upload>()); this.activeUploads = Collections .synchronizedList(new LinkedList<Upload>());
public TransferManager(Controller controller) { super(controller); this.started = false; this.queuedUploads = Collections.synchronizedList(new LinkedList()); this.activeUploads = Collections.synchronizedList(new LinkedList()); this.downloads = new ConcurrentHashMap<FileInfo, Download>(); this.pendingDownloads = Collections .synchronizedList(new LinkedList<Download>()); this.completedDownloads = Collections .synchronizedList(new LinkedList<Download>()); this.uploadCounter = new TransferCounter(); this.downloadCounter = new TransferCounter(); // Create listener support this.listenerSupport = (TransferManagerListener) ListenerSupportFactory .createListenerSupport(TransferManagerListener.class); // maximum concurrent uploads allowedUploads = ConfigurationEntry.UPLOADS_MAX_CONCURRENT.getValueInt( getController()).intValue(); if (allowedUploads <= 0) { throw new NumberFormatException("Illegal value for max uploads: " + allowedUploads); } // parse max upload cps String cps = ConfigurationEntry.UPLOADLIMIT_WAN .getValue(getController()); long maxCps = 0; if (cps != null) { try { maxCps = (long) Double.parseDouble(cps) * 1024; if (maxCps < 0) { throw new NumberFormatException(); } } catch (NumberFormatException e) { log().warn( "Illegal value for KByte upload limit. '" + cps + "'"); } } bandwidthProvider = new BandwidthProvider(); sharedWANOutputHandler = new BandwidthLimiter(); bandwidthProvider.setLimitBPS(sharedWANOutputHandler, maxCps); sharedInputHandler = new BandwidthLimiter(); // set ul limit setAllowedUploadCPSForWAN(maxCps); // parse max upload cps cps = ConfigurationEntry.UPLOADLIMIT_LAN.getValue(getController()); maxCps = 0; if (cps != null) { try { maxCps = (long) Double.parseDouble(cps) * 1024; if (maxCps < 0) { throw new NumberFormatException(); } } catch (NumberFormatException e) { log().warn( "Illegal value for KByte upload limit. '" + cps + "'"); } } sharedLANOutputHandler = new BandwidthLimiter(); bandwidthProvider.setLimitBPS(sharedLANOutputHandler, maxCps); // set ul limit setAllowedUploadCPSForLAN(maxCps); }
Upload upload; boolean isNew;
Upload oldUpload = null; Upload upload = new Upload(this, from, dl); if (upload.isBroken()) { return null; } synchronized (activeUploads) { synchronized (queuedUploads) { int oldUploadIndex = activeUploads.indexOf(upload); if (oldUploadIndex >= 0) { oldUpload = activeUploads.get(oldUploadIndex); activeUploads.remove(oldUploadIndex); } oldUploadIndex = queuedUploads.indexOf(upload); if (oldUploadIndex >= 0) { if (oldUpload != null) { throw new IllegalStateException("Found illegal upload. is in list of queued AND active uploads: " + oldUpload); } oldUpload = queuedUploads.get(oldUploadIndex); queuedUploads.remove(oldUploadIndex); } } } if (oldUpload != null) { log().warn( "Received already known download request for " + dl.file + " from " + from.getNick() + ", overwriting old request"); oldUpload.abort(); oldUpload.shutdown(); setBroken(oldUpload); }
public Upload queueUpload(Member from, RequestDownload dl) { if (dl == null || dl.file == null) { throw new NullPointerException("Downloadrequest/File is null"); } // Never upload db files !! if (Folder.DB_FILENAME.equalsIgnoreCase(dl.file.getName()) || Folder.DB_BACKUP_FILENAME.equalsIgnoreCase(dl.file.getName())) { log() .error( from.getNick() + " has illegally requested to download a folder database file"); return null; } Upload upload; boolean isNew; synchronized (queuedUploads) { upload = new Upload(this, from, dl); if (upload.isBroken()) { // Check if this download is broken return null; } if (!queuedUploads.contains(upload)) { log().verbose( "Upload enqueud: " + dl.file + ", startOffset: " + dl.startOffset + ", member: " + from); queuedUploads.add(upload); isNew = true; } else { isNew = false; log().warn( "Received already known download request for " + dl.file + " from " + from.getNick()); } } // If upload is not started, tell peer if (!upload.isStarted()) { from.sendMessageAsynchron(new DownloadQueued(upload.getFile()), null); } if (isNew && !upload.isBroken()) { fireUploadRequested(new TransferManagerEvent(this, upload)); } // Trigger working thread triggerTransfersCheck(); return upload; }
upload = new Upload(this, from, dl); if (upload.isBroken()) { return null; } if (!queuedUploads.contains(upload)) { log().verbose( "Upload enqueud: " + dl.file + ", startOffset: " + dl.startOffset + ", member: " + from); queuedUploads.add(upload); isNew = true; } else { isNew = false; log().warn( "Received already known download request for " + dl.file + " from " + from.getNick()); }
log().verbose( "Upload enqueud: " + dl.file + ", startOffset: " + dl.startOffset + ", to: " + from); queuedUploads.add(upload);
public Upload queueUpload(Member from, RequestDownload dl) { if (dl == null || dl.file == null) { throw new NullPointerException("Downloadrequest/File is null"); } // Never upload db files !! if (Folder.DB_FILENAME.equalsIgnoreCase(dl.file.getName()) || Folder.DB_BACKUP_FILENAME.equalsIgnoreCase(dl.file.getName())) { log() .error( from.getNick() + " has illegally requested to download a folder database file"); return null; } Upload upload; boolean isNew; synchronized (queuedUploads) { upload = new Upload(this, from, dl); if (upload.isBroken()) { // Check if this download is broken return null; } if (!queuedUploads.contains(upload)) { log().verbose( "Upload enqueud: " + dl.file + ", startOffset: " + dl.startOffset + ", member: " + from); queuedUploads.add(upload); isNew = true; } else { isNew = false; log().warn( "Received already known download request for " + dl.file + " from " + from.getNick()); } } // If upload is not started, tell peer if (!upload.isStarted()) { from.sendMessageAsynchron(new DownloadQueued(upload.getFile()), null); } if (isNew && !upload.isBroken()) { fireUploadRequested(new TransferManagerEvent(this, upload)); } // Trigger working thread triggerTransfersCheck(); return upload; }
if (isNew && !upload.isBroken()) {
if (!upload.isBroken()) {
public Upload queueUpload(Member from, RequestDownload dl) { if (dl == null || dl.file == null) { throw new NullPointerException("Downloadrequest/File is null"); } // Never upload db files !! if (Folder.DB_FILENAME.equalsIgnoreCase(dl.file.getName()) || Folder.DB_BACKUP_FILENAME.equalsIgnoreCase(dl.file.getName())) { log() .error( from.getNick() + " has illegally requested to download a folder database file"); return null; } Upload upload; boolean isNew; synchronized (queuedUploads) { upload = new Upload(this, from, dl); if (upload.isBroken()) { // Check if this download is broken return null; } if (!queuedUploads.contains(upload)) { log().verbose( "Upload enqueud: " + dl.file + ", startOffset: " + dl.startOffset + ", member: " + from); queuedUploads.add(upload); isNew = true; } else { isNew = false; log().warn( "Received already known download request for " + dl.file + " from " + from.getNick()); } } // If upload is not started, tell peer if (!upload.isStarted()) { from.sendMessageAsynchron(new DownloadQueued(upload.getFile()), null); } if (isNew && !upload.isBroken()) { fireUploadRequested(new TransferManagerEvent(this, upload)); } // Trigger working thread triggerTransfersCheck(); return upload; }
activeUploads.add(transfer);
activeUploads.add((Upload) transfer);
void setStarted(Transfer transfer) { if (transfer instanceof Upload) { synchronized (queuedUploads) { synchronized (activeUploads) { queuedUploads.remove(transfer); activeUploads.add(transfer); } } // Fire event fireUploadStarted(new TransferManagerEvent(this, (Upload) transfer)); } else if (transfer instanceof Download) { // Fire event fireDownloadStarted(new TransferManagerEvent(this, (Download) transfer)); } log().debug("Transfer started: " + transfer); }
parseAndFireCommandEvent(theInputString, CommandEvent.Destination.BROKER);
command = commandParser.parseCommand(theInputString);
protected void handleKeyReleased(KeyEvent e) { Text theText = (Text) e.widget; String theInputString = theText.getText(); try { if ('\r' == e.character) { theText.setText(""); parseAndFireCommandEvent(theInputString, CommandEvent.Destination.BROKER); } else if (e.keyCode == 't' && ((e.stateMask & SWT.CONTROL) != 0)) { theText.setText(""); parseAndFireCommandEvent(theInputString, CommandEvent.Destination.EDITOR); } } catch (NoMoreIDsException e1) { Application.getMainConsoleLogger().error("Ran out of ID's parsing command '"+theInputString +"'"); } catch (ParserException e1) { Application.getMainConsoleLogger().error(theInputString+": "+e1.getMessage() ); } }
parseAndFireCommandEvent(theInputString, CommandEvent.Destination.EDITOR);
command = commandParser.parseCommand(theInputString); command = new ShowOrderInTicketCommand(((MessageCommand)command).getMessage());
protected void handleKeyReleased(KeyEvent e) { Text theText = (Text) e.widget; String theInputString = theText.getText(); try { if ('\r' == e.character) { theText.setText(""); parseAndFireCommandEvent(theInputString, CommandEvent.Destination.BROKER); } else if (e.keyCode == 't' && ((e.stateMask & SWT.CONTROL) != 0)) { theText.setText(""); parseAndFireCommandEvent(theInputString, CommandEvent.Destination.EDITOR); } } catch (NoMoreIDsException e1) { Application.getMainConsoleLogger().error("Ran out of ID's parsing command '"+theInputString +"'"); } catch (ParserException e1) { Application.getMainConsoleLogger().error(theInputString+": "+e1.getMessage() ); } }
} catch (NoMoreIDsException e1) { Application.getMainConsoleLogger().error("Ran out of ID's parsing command '"+theInputString +"'");
if (command != null){ command.execute(); }
protected void handleKeyReleased(KeyEvent e) { Text theText = (Text) e.widget; String theInputString = theText.getText(); try { if ('\r' == e.character) { theText.setText(""); parseAndFireCommandEvent(theInputString, CommandEvent.Destination.BROKER); } else if (e.keyCode == 't' && ((e.stateMask & SWT.CONTROL) != 0)) { theText.setText(""); parseAndFireCommandEvent(theInputString, CommandEvent.Destination.EDITOR); } } catch (NoMoreIDsException e1) { Application.getMainConsoleLogger().error("Ran out of ID's parsing command '"+theInputString +"'"); } catch (ParserException e1) { Application.getMainConsoleLogger().error(theInputString+": "+e1.getMessage() ); } }
commandParser.init(factory);
commandParser.setIDFactory(factory);
public void setIDFactory(IDFactory factory) { commandParser.init(factory); }
public abstract Callback getMethod(String method, Class arg1);
public abstract Callback getMethod(String method);
public abstract Callback getMethod(String method, Class arg1);
LoggerAdapter.initializeLogger("unitTest"); return (new TestSuite(JCycloneStagesTest.class));
return (new MarketceteraTestSuite(JCycloneStagesTest.class, OrderManagementSystem.OMS_MESSAGE_BUNDLE_INFO));
public static Test suite() { LoggerAdapter.initializeLogger("unitTest"); return (new TestSuite(JCycloneStagesTest.class)); }
System.out.println("Initialized top-level Logger: "+name);
System.out.println(MessageKey.LOGGER_INIT.getLocalizedMessage(name));
public static LoggerAdapter initializeLogger(String name) { if(sLogger != null) { return sLogger; } sLogger = new LoggerAdapter(name); PropertyConfigurator.configureAndWatch(LOGGER_CONF_FILE, LOGGER_WATCH_DELAY); sLogger.setLevel(Level.ERROR); System.out.println("Initialized top-level Logger: "+name); return sLogger; }
public RubyObject funcall(String name) { return funcall(name, (RubyPointer) null);
public RubyObject funcall(String name, RubyObject[] args) { return funcall(name, new RubyPointer(args));
public RubyObject funcall(String name) { return funcall(name, (RubyPointer) null); }
public static void general( Level level, String msg, Throwable th ) { log( GENERAL, level, msg, th ); }
public static void general(String msg) { general(Level.INFO, msg); }
public static void general( Level level, String msg, Throwable th ) { log( GENERAL, level, msg, th ); }
LogFactory logFactory = new ScreenLogFactory(settings);
LogFactory logFactory = null; if (useJDBC) { logFactory = new CompositeLogFactory(new LogFactory[] {new JdbcLogFactory(settings), new ScreenLogFactory(settings)}); } else { logFactory = new ScreenLogFactory(settings); }
public void init(ConfigData config) throws Exception { mCurFixVersion = config.get(ConnectionConstants.FIX_VERSION_KEY, FIX_VERSION_DEFAULT); FIXDataDictionaryManager.setFIXVersion(mCurFixVersion); String senderCompID = config.get(ConnectionConstants.FIX_SENDER_COMP_ID, ""); String targetCompID = config.get(ConnectionConstants.FIX_TARGET_COMP_ID, ""); mFixServerAddress = config.get(ConnectionConstants.FIX_SERVER_ADDRESS, ""); String dataDictionary = config.get(Session.SETTING_DATA_DICTIONARY, ""); String useDataDictionary = config.get(Session.SETTING_USE_DATA_DICTIONARY, "N"); long fixServerPort = config.getLong(ConnectionConstants.FIX_SERVER_PORT, 0); String resetOnLogout = config.get(Session.SETTING_RESET_ON_LOGOUT, "Y"); String resetOnDisconnect = config.get(Session.SETTING_RESET_ON_DISCONNECT, "Y"); String sendResetSeqNumFlag = config.get(Session.SETTING_RESET_WHEN_INITIATING_LOGON, "Y"); QuickFIXDescriptor descriptor = sFIXVersionMap.get(mCurFixVersion); if (descriptor == null) { throw new ClassNotFoundException( "Could not find class for fix version " + mCurFixVersion); } mMessageFactory = descriptor.getMessageFactory(); // populate the default FIX session settings Map<String, Object> defaults = new HashMap<String, Object>(); defaults.put("ConnectionType","initiator"); defaults.put("HeartBtInt",Long.toString(30)); defaults.put("FileStorePath","store"); defaults.put("StartTime","00:00:00"); defaults.put("EndTime","00:00:00"); defaults.put(Session.SETTING_DATA_DICTIONARY, dataDictionary); defaults.put("UseDataDictionary",useDataDictionary); defaults.put("ReconnectInterval",Long.toString(15)); defaults.put(Session.SETTING_RESET_ON_LOGOUT, resetOnLogout); defaults.put(Session.SETTING_RESET_ON_DISCONNECT, resetOnDisconnect); defaults.put(Session.SETTING_RESET_WHEN_INITIATING_LOGON, sendResetSeqNumFlag); defaults.put(SOCKET_CONNECT_HOST,mFixServerAddress); defaults.put(SOCKET_CONNECT_PORT,Long.toString(fixServerPort)); String [] keys = config.keys(); for (String key : keys) { if (key.startsWith(ConnectionConstants.FIX_SERVER_ADDRESS) && key.length() > ConnectionConstants.FIX_SERVER_ADDRESS.length() + 1) { String suffix = key.substring(ConnectionConstants.FIX_SERVER_ADDRESS.length() + 1); String newKey = SOCKET_CONNECT_HOST + suffix; defaults.put(newKey, config.get(key, "")); } } for (String key : keys) { if (key.startsWith(ConnectionConstants.FIX_SERVER_PORT) && key.length() > ConnectionConstants.FIX_SERVER_PORT.length()) { String suffix = key.substring(ConnectionConstants.FIX_SERVER_PORT.length() + 1); String newKey = SOCKET_CONNECT_PORT + suffix; defaults.put(newKey, config.get(key, "")); } } SessionSettings settings = new SessionSettings(); // this poorly named set method sets the defaults for the session settings settings.set(defaults); SessionID id = new SessionID(mCurFixVersion, senderCompID, targetCompID, ""); settings.setString(id, "BeginString", mCurFixVersion); settings.setString(id, "SenderCompID", senderCompID); settings.setString(id, "TargetCompID", targetCompID); settings.setString(id, "SessionQualifier", ""); MessageStoreFactory storeFactory = new FileStoreFactory(settings); LogFactory logFactory = new ScreenLogFactory(settings); mSocketInitiator = new SocketInitiator(this, storeFactory, settings, logFactory, getMessageFactory()); mDefaultSessionID = new SessionID(mCurFixVersion, senderCompID, targetCompID, null); mSessionMap.put(mDefaultSessionID, sessionAdapter); startSocketInitiator(mSocketInitiator); }
throw new ClassNotFoundException("Could not find class: " + className);
public final MessageFactory getMessageFactory() throws ClassNotFoundException { String className = "quickfix." + mQuickFIXPackage + ".MessageFactory"; try { Class messageFactoryClass = Class.forName(className); return (MessageFactory) messageFactoryClass.newInstance(); } catch (Exception ex) { throw new ClassNotFoundException("Could not find class: " + className); } }
throw new ClassNotFoundException(MessageKey.CLASS_DNE.getLocalizedMessage(className));
public final MessageFactory getMessageFactory() throws ClassNotFoundException { String className = "quickfix." + mQuickFIXPackage + ".MessageFactory"; try { Class messageFactoryClass = Class.forName(className); return (MessageFactory) messageFactoryClass.newInstance(); } catch (Exception ex) { throw new ClassNotFoundException("Could not find class: " + className); } }
public static void debug(String msg, Object inCat)
public void debug(String inMsg)
public static void debug(String msg, Object inCat) { getMyLogger(inCat).log(WRAPPER_FQCN, Level.DEBUG, msg, null); }
getMyLogger(inCat).log(WRAPPER_FQCN, Level.DEBUG, msg, null);
throw new IllegalArgumentException(MessageKey.LOGGER_MISSING_CAT.getLocalizedMessage());
public static void debug(String msg, Object inCat) { getMyLogger(inCat).log(WRAPPER_FQCN, Level.DEBUG, msg, null); }
public IOMetaClass(String name, Class clazz, RubyClass superClass, RubyModule parentModule) { super(name, clazz, superClass, parentModule);
public IOMetaClass(Ruby runtime) { this("IO", RubyIO.class, runtime.getClasses().getObjectClass());
public IOMetaClass(String name, Class clazz, RubyClass superClass, RubyModule parentModule) { super(name, clazz, superClass, parentModule); }
if (directory.alreadyHasFileOnDisk(file)) { return false; }
private boolean drop(File file, Directory directory) { // test if a dir is dropped if (file.isDirectory()) { Directory subDirectory = directory.getCreateSubDirectory(file .getName()); File[] files = file.listFiles(); total += files.length; // Dropper dropper = new Dropper(subDirectory, files.length); for (File subFile : files) { // drop all files in this dir using a new dropper if (subFile.exists() && subFile.canRead()) { if (!drop(subFile, subDirectory)) { return false; } // if dialog was shown we take over the choice if (cancel) { break; } if (skipAll) { break; } } } return true; } // normal file: count++; if (directory.alreadyHasFileOnDisk(file)) { return false; } if (directory.contains(file)) { if (skipAll) { // skip all duplicates // continueDropping = true; return true; } if (!overwriteAll) { if (count < total) {// dialog for more items Object[] options = { Translation.getTranslation("general.overwrite"), Translation.getTranslation("general.overwrite_all"), Translation.getTranslation("general.skip"), Translation .getTranslation("directorypanel.dropfile_duplicate_dialog.skipall"), Translation.getTranslation("general.cancel")}; int option = JOptionPane .showOptionDialog( getUIController().getMainFrame() .getUIComponent(), Translation .getTranslation( "directorypanel.dropfile_duplicate_dialog.text", file.getName()), Translation .getTranslation("directorypanel.dropfile_duplicate_dialog.title"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]); switch (option) { case 0 : { // overwrite break; } case 1 : { // overwrite all overwriteAll = true; break; } case 2 : { // skip return true; } case 3 : { // skip all dupes skipAll = true; return true; } case 4 : { // cancel cancel = true; break; } } } else {// dialog for just one item Object[] options = { Translation.getTranslation("general.overwrite"), Translation.getTranslation("general.skip"), Translation.getTranslation("general.cancel")}; int option = JOptionPane .showOptionDialog( getUIController().getMainFrame() .getUIComponent(), Translation .getTranslation( "directorypanel.dropfile_duplicate_dialog.text", file.getName()), Translation .getTranslation("directorypanel.dropfile_duplicate_dialog.title"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]); switch (option) { case 0 : { // overwrite break; } case 1 : { // skip return true; } case 2 : { // cancel cancel = true; break; } } } } } if (cancel) { return true; } DirectoryPanel.this.directoryTable.getParent().setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (!directory.copyFileFrom(file, getFileCopier())) { DirectoryPanel.this.directoryTable.getParent().setCursor( Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); // something failed return false; } DirectoryPanel.this.directoryTable.getParent().setCursor( Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); return true; }
public FileListTransferable(Object[] files) { fileList = new ArrayList(Arrays.asList(files));
public FileListTransferable(Directory directory, Object[] files) { this.directory = directory; this.fileList = new ArrayList(Arrays.asList(files));
public FileListTransferable(Object[] files) { fileList = new ArrayList(Arrays.asList(files)); }
} else if (flavor.equals(Directory.getDataFlavour())) { return directory;
public synchronized Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { if (flavor.equals(DataFlavor.javaFileListFlavor)) { return fileList; } else if (flavor.equals(DataFlavor.stringFlavor)) { return fileList.toString(); } else { throw new UnsupportedFlavorException(flavor); } }
draggedValues.toArray());
directoryTable.getDirectory(), draggedValues.toArray());
public void dragGestureRecognized(DragGestureEvent event) { Object[] selectedValues = getSelectionModel().getSelections(); if (event.getDragAction() == DnDConstants.ACTION_COPY && selectedValues != null) { List<File> draggedValues = getSelectedFiles(); if (draggedValues != null) { Transferable transferable = new FileListTransferable( draggedValues.toArray()); event.startDrag(null, transferable); } } }
List<File> fileList = (List<File>) trans .getTransferData(DataFlavor.javaFileListFlavor); List<File> selectedFiles = getSelectedFiles(); if (selectedFiles != null && fileList.size() == selectedFiles.size()) { if (selectedFiles.containsAll(fileList)) { return true; } } for (File file : fileList) { if (directoryTable.getDirectory().alreadyHasFileOnDisk(file)) { return true; }
if (trans.isDataFlavorSupported(Directory.getDataFlavour())) { Directory directory = (Directory) trans .getTransferData(Directory.getDataFlavour()); return directoryTable.getDirectory() == directory;
public boolean amIDragSource(DropTargetDragEvent dtde) { Transferable trans = dtde.getTransferable(); try { List<File> fileList = (List<File>) trans .getTransferData(DataFlavor.javaFileListFlavor); List<File> selectedFiles = getSelectedFiles(); if (selectedFiles != null && fileList.size() == selectedFiles.size()) { // if the filelist is the same as the currently selected // one we assume we are the source of this drag and drop // and we will reject this. if (selectedFiles.containsAll(fileList)) { return true; } } // check all files against the Directory // if the exact same files already exists we are the drag source for (File file : fileList) { if (directoryTable.getDirectory().alreadyHasFileOnDisk(file)) { return true; } } return false; } catch (UnsupportedFlavorException ufe) { throw new IllegalStateException(ufe); } catch (IOException e) { throw new IllegalStateException(e); } }
Preferences pref = getController().getPreferences();
private JComponent createFileDetailsPanel() { FileDetailsPanel fileDetailsPanel = new FileDetailsPanel( getController(), selectionModel); Preferences pref = getController().getPreferences(); // check property to enable preview // preview of images is memory hungry // may cause OutOfMemoryErrors if (PreferencesEntry.CONFIG_SHOW_PREVIEW_PANEL.getValueBoolean(getController())) { PreviewPanel previewPanel = new PreviewPanel(getController(), selectionModel, this); FormLayout layout = new FormLayout("pref, fill:pref:grow", "3dlu, pref, fill:pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.addSeparator(null, cc.xy(1, 2)); builder.add(fileDetailsPanel.getEmbeddedPanel(), cc.xy(1, 3)); builder.add(previewPanel.getUIComponent(), cc.xy(2, 3)); builder.addSeparator(null, cc.xy(1, 4)); return builder.getPanel(); } FormLayout layout = new FormLayout("fill:pref:grow", "3dlu, pref, fill:pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.addSeparator(null, cc.xy(1, 2)); builder.add(fileDetailsPanel.getEmbeddedPanel(), cc.xy(1, 3)); builder.addSeparator(null, cc.xy(1, 4)); return builder.getPanel(); }
List<FileInfo> filesToRemove = new ArrayList();
List<FileInfo> filesToRemove = new ArrayList<FileInfo>();
public void actionPerformed(ActionEvent e) { Object target = getUIController().getInformationQuarter() .getDisplayTarget(); final Folder folder; if (target instanceof Directory) { folder = ((Directory) target).getRootFolder(); } else if (target instanceof Folder) { folder = (Folder) target; } else { log().warn("Unable to remove files on target: " + target); return; } Object[] selections = getSelectionModel().getSelections(); if (selections != null && selections.length > 0) { final List toRemove = new ArrayList(selections.length); for (int i = 0; i < selections.length; i++) { if (selections[i] instanceof FileInfo) { toRemove.add(selections[i]); } else if (selections[i] instanceof Directory) { toRemove.add(selections[i]); } else { log().debug( "cannot remove: " + selections[i].getClass().getName()); return; } } boolean containsDirectory = false; String fileListText = ""; for (int i = 0; i < toRemove.size(); i++) { Object object = toRemove.get(i); if (object instanceof FileInfo) { FileInfo fileInfo = (FileInfo) object; fileListText += fileInfo.getFilenameOnly() + "\n"; } else if (object instanceof Directory) { containsDirectory = true; Directory directory = (Directory) object; fileListText += directory.getName() + " " + Translation .getTranslation("delete_confimation.text_movetorecyclebin_DIR") + "\n"; } } String warningText; if (containsDirectory) { warningText = Translation .getTranslation("delete_confimation.text_movetorecyclebin_directory"); } else { warningText = Translation .getTranslation("delete_confimation.text_movetorecyclebin"); } int choice = DialogFactory.showScrollableOkCancelDialog( getController(), true, // modal true, // border Translation.getTranslation("delete_confimation.title"), warningText, fileListText, Icons.DELETE); if (choice == JOptionPane.OK_OPTION) { // TODO Use activiy visualizationworker SwingWorker worker = new SwingWorker() { @Override public Object construct() { boolean dirRemoved = false; List<FileInfo> filesToRemove = new ArrayList(); for (Object object : toRemove) { if (object instanceof FileInfo) { filesToRemove.add((FileInfo) object); } else if (object instanceof Directory) { Directory directoryToRemove = (Directory) object; if (!moveToRecycleBin(directoryToRemove)) { log().error( "move to recyclebin failed for:" + directoryToRemove); } dirRemoved = true; } } FileInfo[] filesToRemoveArray = new FileInfo[filesToRemove .size()]; filesToRemoveArray = filesToRemove .toArray(filesToRemoveArray); if (filesToRemoveArray.length > 0) { folder.removeFilesLocal(filesToRemoveArray); } if (dirRemoved) { // TODO Schaatser please check this folder.maintain(); } return null; } }; // Use swingworker to execute deletion in background worker.start(); } } }
return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true);
return sortBy(FileInfoComparator.BY_FILETYPE, true);
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true);
return sortBy(FileInfoComparator.BY_NAME, true);
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true);
return sortBy(FileInfoComparator.BY_SIZE, true);
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true);
return sortBy(FileInfoComparator.BY_MEMBER, true);
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true);
return sortBy(FileInfoComparator.BY_MODIFIED_DATE, true);
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true);
return sortBy(FileInfoComparator.BY_AVAILABILITY, true);
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
public ISelection getSelection() { Control control = getControl(); if (control == null || control.isDisposed()) { return TreeSelection.EMPTY; } Widget[] items = getSelection(getControl()); ArrayList list = new ArrayList(items.length); for (int i = 0; i < items.length; i++) { Widget item = items[i]; if (item.getData() != null) { list.add(getTreePathFromItem((Item) item)); } } return new TreeSelection((TreePath[]) list.toArray(new TreePath[list .size()])); }
protected abstract Item[] getSelection(Control control);
public ISelection getSelection() { Control control = getControl(); if (control == null || control.isDisposed()) { return TreeSelection.EMPTY; } Widget[] items = getSelection(getControl()); ArrayList list = new ArrayList(items.length); for (int i = 0; i < items.length; i++) { Widget item = items[i]; if (item.getData() != null) { list.add(getTreePathFromItem((Item) item)); } } return new TreeSelection((TreePath[]) list.toArray(new TreePath[list .size()])); }
public WorkbenchPreferenceExtensionNode(String id, IPreferencePage preferencePage) { super(id, preferencePage);
public WorkbenchPreferenceExtensionNode(String id, IConfigurationElement configurationElement) { super(id); this.configurationElement = configurationElement;
public WorkbenchPreferenceExtensionNode(String id, IPreferencePage preferencePage) { super(id, preferencePage); }
protected void connect(Controller cont1, Controller cont2)
private void connect(Controller cont1, Controller cont2)
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
boolean connected = false;
Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); boolean connected = member2atCon1 != null && member1atCon2 != null && member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected(); if (connected) { return; }
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
Member member2atCon1 = cont1.getNodeManager().getNode(
member2atCon1 = cont1.getNodeManager().getNode(
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
Member member1atCon2 = cont2.getNodeManager().getNode(
member1atCon2 = cont2.getNodeManager().getNode(
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } }
connected = member2atCon1 != null && member1atCon2 != null && member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected();
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
public Member getNode(String id) { if (id == null) {
public Member getNode(MemberInfo mInfo) { if (mInfo == null) {
public Member getNode(String id) { if (id == null) { return null; } if (mySelf.getId().equals(id)) { return mySelf; } return (Member) knownNodes.get(id); }
if (mySelf.getId().equals(id)) { return mySelf; } return (Member) knownNodes.get(id);
return getNode(mInfo.id);
public Member getNode(String id) { if (id == null) { return null; } if (mySelf.getId().equals(id)) { return mySelf; } return (Member) knownNodes.get(id); }
System.out.println("Cleaning test dir (" + files.length
System.out.println("Cleaning test dir ("+ testDir + ") (" + files.length
public static void cleanTestDir() { File testDir = getTestDir(); File[] files = testDir.listFiles(); if (files == null) { return; } System.out.println("Cleaning test dir (" + files.length + " files/dirs)"); for (File file : files) { try { if (file.isDirectory()) { FileUtils.deleteDirectory(file); } else if (file.isFile()) { FileUtils.forceDelete(file); } } catch (IOException e) { // log().error(e); } } }
if (0 != testDir.listFiles().length) { throw new IllegalStateException("cleaning test dir not succeded"); }
public static void cleanTestDir() { File testDir = getTestDir(); File[] files = testDir.listFiles(); if (files == null) { return; } System.out.println("Cleaning test dir (" + files.length + " files/dirs)"); for (File file : files) { try { if (file.isDirectory()) { FileUtils.deleteDirectory(file); } else if (file.isFile()) { FileUtils.forceDelete(file); } } catch (IOException e) { // log().error(e); } } }
public static int len(Context c, InlineTextBox box) { return (int) Math.ceil(c.getTextRenderer().getLogicalBounds(c.getGraphics(), c.getCurrentFont(), box.getSubstring()).getWidth());
public static int len(Context c, String str, Font font) { return (int) Math.ceil(c.getTextRenderer().getLogicalBounds(c.getGraphics(), font, str).getWidth());
public static int len(Context c, InlineTextBox box) { return (int) Math.ceil(c.getTextRenderer().getLogicalBounds(c.getGraphics(), c.getCurrentFont(), box.getSubstring()).getWidth()); }
jmsOperations.convertAndSend(fixMessage);
if (jmsOperations != null){ jmsOperations.convertAndSend(fixMessage); } else { internalMainLogger.error("Could not send message, not connected"); }
private void convertAndSend(Message fixMessage) { jmsOperations.convertAndSend(fixMessage); }
for (int fieldInt = 1; fieldInt < 2000; fieldInt++){
for (int fieldInt = 1; fieldInt < MAX_FIX_FIELDS; fieldInt++){
public static void fillFieldsFromExistingMessage(Message outgoingMessage, Message existingMessage) { try { String msgType = outgoingMessage.getHeader().getString(MsgType.FIELD); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); for (int fieldInt = 1; fieldInt < 2000; fieldInt++){ if (dict.isRequiredField(msgType, fieldInt) && existingMessage.isSetField(fieldInt) && !outgoingMessage.isSetField(fieldInt)){ try { outgoingMessage.setField(existingMessage.getField(new StringField(fieldInt))); } catch (FieldNotFound e) { // do nothing and ignore } } } } catch (FieldNotFound ex) { LoggerAdapter.error("Outgoing message did not have valid MsgType ", ex, LOGGER_NAME); } }
LoggerAdapter.error("Outgoing message did not have valid MsgType ", ex, LOGGER_NAME);
LoggerAdapter.error(MessageKey.FIX_OUTGOING_NO_MSGTYPE.getLocalizedMessage(), ex, LOGGER_NAME);
public static void fillFieldsFromExistingMessage(Message outgoingMessage, Message existingMessage) { try { String msgType = outgoingMessage.getHeader().getString(MsgType.FIELD); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); for (int fieldInt = 1; fieldInt < 2000; fieldInt++){ if (dict.isRequiredField(msgType, fieldInt) && existingMessage.isSetField(fieldInt) && !outgoingMessage.isSetField(fieldInt)){ try { outgoingMessage.setField(existingMessage.getField(new StringField(fieldInt))); } catch (FieldNotFound e) { // do nothing and ignore } } } } catch (FieldNotFound ex) { LoggerAdapter.error("Outgoing message did not have valid MsgType ", ex, LOGGER_NAME); } }
return "ConnectionHander " + remoteInfo;
return "ConnectionHandler " + remoteInfo;
public String getLoggerName() { String remoteInfo; if (socket != null) { InetSocketAddress addr = (InetSocketAddress) socket .getRemoteSocketAddress(); remoteInfo = addr.getAddress().getHostAddress() + "^" + addr.getPort(); } else { remoteInfo = "<unknown>"; } return "ConnectionHander " + remoteInfo; }
LOG.warn("Recived buffer exceeds 128KB! " + Format.formatBytes(byteIn.length));
bufferExceeded = true;
public Object deserialize(InputStream in, int expectedSize, boolean expectCompression) throws IOException, ClassNotFoundException { byte[] byteIn = null; if (inBufferRef != null && inBufferRef.get() != null) { // Re-use old buffer byteIn = (byte[]) inBufferRef.get(); } if (expectedSize > MAX_BUFFER_SIZE) { LOG.error("Max buffersize overflow while reading. expected size " + expectedSize); return null; } // Check buffer if (byteIn == null || byteIn.length < expectedSize) { if (LOG.isVerbose()) LOG.verbose("Extending receive buffer (" + Format.formatBytes(expectedSize) + ")"); byteIn = new byte[expectedSize]; if (byteIn.length >= 128 * 1024) { LOG.warn("Recived buffer exceeds 128KB! " + Format.formatBytes(byteIn.length)); } // Chache buffer inBufferRef = new SoftReference(byteIn); } // Read into receivebuffer read(in, byteIn, expectedSize); // Deserialize return deserializeStatic(byteIn, expectCompression); }
return deserializeStatic(byteIn, expectCompression);
Object obj = deserializeStatic(byteIn, expectCompression); if (bufferExceeded) { LOG.warn("Recived buffer exceeds 128KB! " + Format.formatBytes(byteIn.length) + ". Message: " + obj); } return obj;
public Object deserialize(InputStream in, int expectedSize, boolean expectCompression) throws IOException, ClassNotFoundException { byte[] byteIn = null; if (inBufferRef != null && inBufferRef.get() != null) { // Re-use old buffer byteIn = (byte[]) inBufferRef.get(); } if (expectedSize > MAX_BUFFER_SIZE) { LOG.error("Max buffersize overflow while reading. expected size " + expectedSize); return null; } // Check buffer if (byteIn == null || byteIn.length < expectedSize) { if (LOG.isVerbose()) LOG.verbose("Extending receive buffer (" + Format.formatBytes(expectedSize) + ")"); byteIn = new byte[expectedSize]; if (byteIn.length >= 128 * 1024) { LOG.warn("Recived buffer exceeds 128KB! " + Format.formatBytes(byteIn.length)); } // Chache buffer inBufferRef = new SoftReference(byteIn); } // Read into receivebuffer read(in, byteIn, expectedSize); // Deserialize return deserializeStatic(byteIn, expectCompression); }
return addr.isLoopbackAddress() || addr.isSiteLocalAddress();
try { return addr.isLoopbackAddress() || addr.isSiteLocalAddress() || getAllLocalNetworkAddresses().containsKey(addr); } catch (SocketException e) { return false; }
public static boolean isOnLanOrLoopback(InetAddress addr) { Reject.ifNull(addr, "Address is null"); return addr.isLoopbackAddress() || addr.isSiteLocalAddress(); }
protected void clear(){ Control[] children = form.getBody().getChildren(); for (Control control : children) { if (control instanceof FIXComposite) { FIXComposite composite = (FIXComposite) control; composite.clear(); }
private void clear() { for (AbstractFIXExtractor extractor : extractors) { extractor.clearUI();
protected void clear(){ Control[] children = form.getBody().getChildren(); for (Control control : children) { if (control instanceof FIXComposite) { FIXComposite composite = (FIXComposite) control; composite.clear(); } } }
toolkit = new FormToolkit(parent.getDisplay()); form = toolkit.createForm(parent); GridLayout layout = new GridLayout(); form.getBody().setLayout(layout); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); buySellControl = new FIXEnumeratedComposite(form.getBody(), SWT.NONE, toolkit, Side.FIELD, new String[] { "" + Side.BUY, "" + Side.SELL, "" + Side.SELL_SHORT, "" + Side.SELL_SHORT_EXEMPT }); orderQtyControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, OrderQty.FIELD); toolkit.paintBordersFor(orderQtyControl); symbolControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Symbol.FIELD); toolkit.paintBordersFor(symbolControl); priceControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Price.FIELD); toolkit.paintBordersFor(priceControl); timeInForceControl = new FIXEnumeratedComposite(form.getBody(), SWT.NONE, toolkit, TimeInForce.FIELD, new String[] { "" + TimeInForce.DAY, "" + TimeInForce.GOOD_TILL_CANCEL, "" + TimeInForce.FILL_OR_KILL, "" + TimeInForce.IMMEDIATE_OR_CANCEL }); timeInForceControl.setSelection("" + TimeInForce.DAY, true); accountControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Account.FIELD); toolkit.paintBordersFor(accountControl); Composite okCancelComposite = toolkit.createComposite(form.getBody()); okCancelComposite.setLayout(new RowLayout(SWT.HORIZONTAL)); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END); okCancelComposite.setLayoutData(gd); sendButton = toolkit.createButton(okCancelComposite, "Send", SWT.PUSH); cancelButton = toolkit.createButton(okCancelComposite, "Cancel", SWT.PUSH); cancelButton.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { handleCancel(); } }); sendButton.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { handleSend(); } }); Listener formValidationListener = new Listener() { public void handleEvent(Event event) { validateForm(); } }; buySellControl.addSelectionListener(formValidationListener); orderQtyControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); symbolControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); priceControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); timeInForceControl.addSelectionListener(formValidationListener); validateForm();
GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.verticalAlignment = GridData.END; top = new Composite(parent, SWT.NONE); top.setLayout(new GridLayout()); createForm(); errorMessageLabel = getFormToolkit().createLabel(top, ""); errorMessageLabel.setLayoutData(gridData); top.setBackground(errorMessageLabel.getBackground());
public void createPartControl(Composite parent) { toolkit = new FormToolkit(parent.getDisplay()); form = toolkit.createForm(parent); // form.setText("Stock Order Ticket"); GridLayout layout = new GridLayout(); form.getBody().setLayout(layout); // FIXDataDictionaryManager.loadDictionary(FIXDataDictionaryManager.FIX_4_2_BEGIN_STRING); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); buySellControl = new FIXEnumeratedComposite(form.getBody(), SWT.NONE, toolkit, Side.FIELD, new String[] { "" + Side.BUY, "" + Side.SELL, "" + Side.SELL_SHORT, "" + Side.SELL_SHORT_EXEMPT }); orderQtyControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, OrderQty.FIELD); toolkit.paintBordersFor(orderQtyControl); symbolControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Symbol.FIELD); toolkit.paintBordersFor(symbolControl); priceControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Price.FIELD); toolkit.paintBordersFor(priceControl); timeInForceControl = new FIXEnumeratedComposite(form.getBody(), SWT.NONE, toolkit, TimeInForce.FIELD, new String[] { "" + TimeInForce.DAY, "" + TimeInForce.GOOD_TILL_CANCEL, "" + TimeInForce.FILL_OR_KILL, "" + TimeInForce.IMMEDIATE_OR_CANCEL }); timeInForceControl.setSelection("" + TimeInForce.DAY, true); accountControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Account.FIELD); toolkit.paintBordersFor(accountControl); Composite okCancelComposite = toolkit.createComposite(form.getBody()); okCancelComposite.setLayout(new RowLayout(SWT.HORIZONTAL)); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END); okCancelComposite.setLayoutData(gd); sendButton = toolkit.createButton(okCancelComposite, "Send", SWT.PUSH); cancelButton = toolkit.createButton(okCancelComposite, "Cancel", SWT.PUSH); cancelButton.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { handleCancel(); } }); sendButton.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { handleSend(); } }); Listener formValidationListener = new Listener() { public void handleEvent(Event event) { validateForm(); } }; buySellControl.addSelectionListener(formValidationListener); orderQtyControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); symbolControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); priceControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); timeInForceControl.addSelectionListener(formValidationListener); validateForm(); }
handleCancel();
handleSend();
public void mouseUp(MouseEvent e) { handleCancel(); }
validateForm();
protected void handleCancel() { clear(); validateForm(); }
try {
try { validator.validateAll();
protected void handleSend() { try { String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order", e); } }
Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage);
Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID( orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); for (AbstractFIXExtractor extractor : extractors) { extractor.modifyOrder(aMessage); }
protected void handleSend() { try { String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order", e); } }
clear();
protected void handleSend() { try { String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order", e); } }
Application.getMainConsoleLogger().error("Error sending order", e);
Application.getMainConsoleLogger().error("Error sending order: "+e.getMessage(), e);
protected void handleSend() { try { String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order", e); } }
label = toolkit.createLabel(this, dict.getFieldName(fixFieldNumber)
toolkit.createLabel(this, dict.getFieldName(fixFieldNumber)
public FIXEnumeratedComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber, DataDictionary dict, String[] valuesToDisplay) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); label = toolkit.createLabel(this, dict.getFieldName(fixFieldNumber) + ": "); buttons = new Button[valuesToDisplay.length]; Composite buttonComposite = toolkit.createComposite(this); buttonComposite.setLayout(new RowLayout(SWT.VERTICAL)); int i = 0; for (String string : valuesToDisplay) { buttons[i] = toolkit.createButton(buttonComposite, dict .getValueName(fixFieldNumber, valuesToDisplay[i]), SWT.RADIO); buttons[i].setData(new StringField(fixFieldNumber, valuesToDisplay[i])); i++; } }
int i = 0; for (String string : valuesToDisplay) {
for (int i = 0; i < valuesToDisplay.length; i++) {
public FIXEnumeratedComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber, DataDictionary dict, String[] valuesToDisplay) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); label = toolkit.createLabel(this, dict.getFieldName(fixFieldNumber) + ": "); buttons = new Button[valuesToDisplay.length]; Composite buttonComposite = toolkit.createComposite(this); buttonComposite.setLayout(new RowLayout(SWT.VERTICAL)); int i = 0; for (String string : valuesToDisplay) { buttons[i] = toolkit.createButton(buttonComposite, dict .getValueName(fixFieldNumber, valuesToDisplay[i]), SWT.RADIO); buttons[i].setData(new StringField(fixFieldNumber, valuesToDisplay[i])); i++; } }
i++;
public FIXEnumeratedComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber, DataDictionary dict, String[] valuesToDisplay) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); label = toolkit.createLabel(this, dict.getFieldName(fixFieldNumber) + ": "); buttons = new Button[valuesToDisplay.length]; Composite buttonComposite = toolkit.createComposite(this); buttonComposite.setLayout(new RowLayout(SWT.VERTICAL)); int i = 0; for (String string : valuesToDisplay) { buttons[i] = toolkit.createButton(buttonComposite, dict .getValueName(fixFieldNumber, valuesToDisplay[i]), SWT.RADIO); buttons[i].setData(new StringField(fixFieldNumber, valuesToDisplay[i])); i++; } }
toolkit.createLabel(this, FIXDataDictionaryManager.getHumanFieldName(fixFieldNumber)+": ");
label = toolkit.createLabel(this, FIXDataDictionaryManager.getHumanFieldName(fixFieldNumber)+": ");
public FIXStringComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); toolkit.createLabel(this, FIXDataDictionaryManager.getHumanFieldName(fixFieldNumber)+": "); textField = toolkit.createText(this, ""); }
if (internalID == null) throw new IllegalArgumentException("ID must not be null");
if (internalID == null) throw new IllegalArgumentException(MessageKey.ERROR_NULL_ID.getLocalizedMessage());
public InternalID(String internalID) { if (internalID == null) throw new IllegalArgumentException("ID must not be null"); mID = internalID; }
} else if (FIXMessageUtil.isCancelRequest(aMessage)) { cancelOneOrder(aMessage);
public void handleInternalMessage(Message aMessage) throws FieldNotFound, MarketceteraException, JMSException { fireOrderActionOccurred(aMessage); if (FIXMessageUtil.isOrderSingle(aMessage)) { addNewOrder(aMessage); } else if (FIXMessageUtil.isCancelRequest(aMessage)) { cancelOneOrder(aMessage); } else if (FIXMessageUtil.isCancelReplaceRequest(aMessage)) { cancelReplaceOneOrder(aMessage); } else if (FIXMessageUtil.isCancelRequest(aMessage)) { cancelOneOrder(aMessage); } }
public ActionDescriptor(IConfigurationElement actionElement, int targetType, Object target) { id = actionElement.getAttribute(ATT_ID); pluginId = actionElement.getDeclaringExtension().getNamespace(); String label = actionElement.getAttribute(ATT_LABEL); String tooltip = actionElement.getAttribute(ATT_TOOLTIP); String helpContextId = actionElement.getAttribute(ATT_HELP_CONTEXT_ID); String mpath = actionElement.getAttribute(ATT_MENUBAR_PATH); String tpath = actionElement.getAttribute(ATT_TOOLBAR_PATH); String style = actionElement.getAttribute(ATT_STYLE); String icon = actionElement.getAttribute(ATT_ICON); String hoverIcon = actionElement.getAttribute(ATT_HOVERICON); String disabledIcon = actionElement.getAttribute(ATT_DISABLEDICON); String description = actionElement.getAttribute(ATT_DESCRIPTION); String accelerator = actionElement.getAttribute(ATT_ACCELERATOR); if (label == null) { WorkbenchPlugin .log("Invalid action declaration (label == null): " + id); label = WorkbenchMessages.ActionDescriptor_invalidLabel; } String mgroup = null; String tgroup = null; if (mpath != null) { int loc = mpath.lastIndexOf('/'); if (loc != -1) { mgroup = mpath.substring(loc + 1); mpath = mpath.substring(0, loc); } else { mgroup = mpath; mpath = null; } } if (targetType == T_POPUP && mgroup == null) mgroup = IWorkbenchActionConstants.MB_ADDITIONS; if (tpath != null) { int loc = tpath.lastIndexOf('/'); if (loc != -1) { tgroup = tpath.substring(loc + 1); tpath = tpath.substring(0, loc); } else { tgroup = tpath; tpath = null; } } menuPath = mpath; menuGroup = mgroup; if ((tpath != null) && tpath.equals("Normal")) tpath = ""; toolbarId = tpath; toolbarGroupId = tgroup; action = createAction(targetType, actionElement, target, style); if (action.getText() == null) action.setText(label); if (action.getToolTipText() == null && tooltip != null) action.setToolTipText(tooltip); if (helpContextId != null) { String fullID = helpContextId; if (helpContextId.indexOf(".") == -1) fullID = actionElement.getDeclaringExtension().getNamespace() + "." + helpContextId; PlatformUI.getWorkbench().getHelpSystem().setHelp(action, fullID); } if (description != null) action.setDescription(description); if (style != null) { String state = actionElement.getAttribute(ATT_STATE); if (state != null) { if (style.equals(STYLE_RADIO) || style.equals(STYLE_TOGGLE)) action.setChecked(state.equals("true")); } } else { String state = actionElement.getAttribute(ATT_STATE); if (state != null) { action.setChecked(state.equals("true")); } } String extendingPluginId = actionElement.getDeclaringExtension() .getNamespace(); if (icon != null) { action.setImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, icon)); } if (hoverIcon != null) { action.setHoverImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, hoverIcon)); } if (disabledIcon != null) { action .setDisabledImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, disabledIcon)); } if (accelerator != null) processAccelerator(action, accelerator);
public ActionDescriptor(IConfigurationElement actionElement, int targetType) { this(actionElement, targetType, null);
public ActionDescriptor(IConfigurationElement actionElement, int targetType, Object target) { // Load attributes. id = actionElement.getAttribute(ATT_ID); pluginId = actionElement.getDeclaringExtension().getNamespace(); String label = actionElement.getAttribute(ATT_LABEL); String tooltip = actionElement.getAttribute(ATT_TOOLTIP); String helpContextId = actionElement.getAttribute(ATT_HELP_CONTEXT_ID); String mpath = actionElement.getAttribute(ATT_MENUBAR_PATH); String tpath = actionElement.getAttribute(ATT_TOOLBAR_PATH); String style = actionElement.getAttribute(ATT_STYLE); String icon = actionElement.getAttribute(ATT_ICON); String hoverIcon = actionElement.getAttribute(ATT_HOVERICON); String disabledIcon = actionElement.getAttribute(ATT_DISABLEDICON); String description = actionElement.getAttribute(ATT_DESCRIPTION); String accelerator = actionElement.getAttribute(ATT_ACCELERATOR); // Verify input. if (label == null) { WorkbenchPlugin .log("Invalid action declaration (label == null): " + id); //$NON-NLS-1$ label = WorkbenchMessages.ActionDescriptor_invalidLabel; } // Calculate menu and toolbar paths. String mgroup = null; String tgroup = null; if (mpath != null) { int loc = mpath.lastIndexOf('/'); if (loc != -1) { mgroup = mpath.substring(loc + 1); mpath = mpath.substring(0, loc); } else { mgroup = mpath; mpath = null; } } if (targetType == T_POPUP && mgroup == null) mgroup = IWorkbenchActionConstants.MB_ADDITIONS; if (tpath != null) { int loc = tpath.lastIndexOf('/'); if (loc != -1) { tgroup = tpath.substring(loc + 1); tpath = tpath.substring(0, loc); } else { tgroup = tpath; tpath = null; } } menuPath = mpath; menuGroup = mgroup; if ((tpath != null) && tpath.equals("Normal")) //$NON-NLS-1$ tpath = ""; //$NON-NLS-1$ toolbarId = tpath; toolbarGroupId = tgroup; // Create action. action = createAction(targetType, actionElement, target, style); if (action.getText() == null) // may have been set by delegate action.setText(label); if (action.getToolTipText() == null && tooltip != null) // may have been set by delegate action.setToolTipText(tooltip); if (helpContextId != null) { String fullID = helpContextId; if (helpContextId.indexOf(".") == -1) //$NON-NLS-1$ // For backward compatibility we auto qualify the id if it is not // qualified) fullID = actionElement.getDeclaringExtension().getNamespace() + "." + helpContextId;//$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(action, fullID); } if (description != null) action.setDescription(description); if (style != null) { // Since 2.1, the "state" and "pulldown" attributes means something different // when the new "style" attribute has been set. See doc for more info. String state = actionElement.getAttribute(ATT_STATE); if (state != null) { if (style.equals(STYLE_RADIO) || style.equals(STYLE_TOGGLE)) action.setChecked(state.equals("true"));//$NON-NLS-1$ } } else { // Keep for backward compatibility for actions not using the // new style attribute. String state = actionElement.getAttribute(ATT_STATE); if (state != null) { action.setChecked(state.equals("true"));//$NON-NLS-1$ } } String extendingPluginId = actionElement.getDeclaringExtension() .getNamespace(); if (icon != null) { action.setImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, icon)); } if (hoverIcon != null) { action.setHoverImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, hoverIcon)); } if (disabledIcon != null) { action .setDisabledImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, disabledIcon)); } if (accelerator != null) processAccelerator(action, accelerator); }
throw new NotImplementedException();
return scriptWorkspacePath;
public String getID() { throw new NotImplementedException(); }
throw new NotImplementedException();
return scriptContent;
public String getScript() { throw new NotImplementedException(); }
public RubyIO(Ruby ruby, RubyClass type) {
protected RubyIO(Ruby ruby, RubyClass type) {
public RubyIO(Ruby ruby, RubyClass type) { super(ruby, type); }
public static RubyArray newArray(Ruby runtime, IRubyObject obj) { ArrayList list = new ArrayList(1); list.add(obj); return new RubyArray(runtime, list);
public static final RubyArray newArray(final Ruby runtime, final long len) { return new RubyArray(runtime, new ArrayList((int) len));
public static RubyArray newArray(Ruby runtime, IRubyObject obj) { ArrayList list = new ArrayList(1); list.add(obj); return new RubyArray(runtime, list); }
public RegistryPageContributor(String pageId, IConfigurationElement element, Collection keywordIds) { this(pageId,element); keywordReferences = keywordIds; }
public RegistryPageContributor(String pageId, IConfigurationElement element) { this.pageId = pageId; this.pageElement = element; adaptable = Boolean.valueOf(pageElement.getAttribute(PropertyPagesRegistryReader.ATT_ADAPTABLE)).booleanValue(); }
public RegistryPageContributor(String pageId, IConfigurationElement element, Collection keywordIds) { this(pageId,element); keywordReferences = keywordIds; }
TestSuite suite = new MarketceteraTestSuite(OrderManagementSystemIT.class);
TestSuite suite = new MarketceteraTestSuite(OrderManagementSystemIT.class, OrderManagementSystem.OMS_MESSAGE_BUNDLE_INFO);
public static Test suite() { try { sOMS = new MyOMS(CONFIG_FILE); sOMS.init(); sOMS.run(); } catch (Exception e) { LoggerAdapter.error("Unable to initialize OMS", e, OrderManagementSystemIT.class.getName()); fail("Unable to init OMS"); } TestSuite suite = new MarketceteraTestSuite(OrderManagementSystemIT.class); suite.addTest(new RepeatedTest(new OrderManagementSystemIT("testEndToEndOrderFilling"), 5)); return suite; }
public static void error(String msg, Throwable ex, Object inCat)
public static void error(String msg, Object inCat)
public static void error(String msg, Throwable ex, Object inCat) { getMyLogger(inCat).log(WRAPPER_FQCN, Level.ERROR, msg, ex); }
getMyLogger(inCat).log(WRAPPER_FQCN, Level.ERROR, msg, ex);
getMyLogger(inCat).log(WRAPPER_FQCN, Level.ERROR, msg, null);
public static void error(String msg, Throwable ex, Object inCat) { getMyLogger(inCat).log(WRAPPER_FQCN, Level.ERROR, msg, ex); }
public MarketceteraTestSuite(Class aClass, String string) { super(aClass, string); init();
public MarketceteraTestSuite() { super(); init(new MessageBundleInfo[]{CORE_BUNDLE});
public MarketceteraTestSuite(Class aClass, String string) { super(aClass, string); init(); }
String connectionFactoryName, boolean explicitDestinationCreation) { mOutgoingQueueSessions = new HashMap<String, QueueSession>(); mOutgoingQueues = new HashMap<String, Queue>(); mOutgoingQueueSenders = new HashMap<String, QueueSender>(); mIncomingQueueSessions = new HashMap<String, QueueSession>(); mIncomingQueues = new HashMap<String, Queue>(); mIncomingQueueReceivers = new HashMap<String, QueueReceiver>(); mOutgoingTopicSessions = new HashMap<String, TopicSession>(); mOutgoingTopics = new HashMap<String, Topic>(); mOutgoingTopicPublishers = new HashMap<String, TopicPublisher>(); mIncomingTopicSessions = new HashMap<String, TopicSession>(); mIncomingTopics = new HashMap<String, Topic>(); mIncomingTopicSubscribers = new HashMap<String, TopicSubscriber>(); mInitialContextFactoryName = initialContextFactoryName; mProviderURL = providerURL; mConnectionFactoryName = connectionFactoryName; mExplicitlyCreateDestinations = explicitDestinationCreation; LoggerAdapter.debug("creating a JMSAdapter for url " + mProviderURL, this);
String connectionFactoryName) { this(initialContextFactoryName, providerURL, connectionFactoryName, false);
public JMSAdapter(String initialContextFactoryName, String providerURL, String connectionFactoryName, boolean explicitDestinationCreation) { mOutgoingQueueSessions = new HashMap<String, QueueSession>(); mOutgoingQueues = new HashMap<String, Queue>(); mOutgoingQueueSenders = new HashMap<String, QueueSender>(); mIncomingQueueSessions = new HashMap<String, QueueSession>(); mIncomingQueues = new HashMap<String, Queue>(); mIncomingQueueReceivers = new HashMap<String, QueueReceiver>(); mOutgoingTopicSessions = new HashMap<String, TopicSession>(); mOutgoingTopics = new HashMap<String, Topic>(); mOutgoingTopicPublishers = new HashMap<String, TopicPublisher>(); mIncomingTopicSessions = new HashMap<String, TopicSession>(); mIncomingTopics = new HashMap<String, Topic>(); mIncomingTopicSubscribers = new HashMap<String, TopicSubscriber>(); mInitialContextFactoryName = initialContextFactoryName; mProviderURL = providerURL; mConnectionFactoryName = connectionFactoryName; mExplicitlyCreateDestinations = explicitDestinationCreation; LoggerAdapter.debug("creating a JMSAdapter for url " + mProviderURL, this); }