/** * @param local indicates that the candidate destination object (the window or view over which the dragged * image is currently poised) is in the same application as the source, while a NO value indicates that * the destination object is in a different application * @return A mask, created by combining the dragging operations listed in the NSDragOperation section of * NSDraggingInfo protocol reference using the C bitwise OR operator.If the source does not permit * any dragging operations, it should return NSDragOperationNone. * @see NSDraggingSource */ @Override public NSUInteger draggingSourceOperationMaskForLocal(final boolean local) { if(local) { return new NSUInteger(NSDraggingInfo.NSDragOperationMove.intValue() | NSDraggingInfo.NSDragOperationCopy.intValue()); } return new NSUInteger(NSDraggingInfo.NSDragOperationCopy.intValue() | NSDraggingInfo.NSDragOperationDelete.intValue()); }
public void shutdown() { SecurityManager sm = System.getSecurityManager(); if ( sm != null ) { sm.checkPermission(shutdownPerm); } try { shutdownLock.lock(); state = State.SHUTDOWN; terminateIfDone(queue.operationCount().intValue() == 0); } finally { shutdownLock.unlock(); } }
public void shutdown() { SecurityManager sm = System.getSecurityManager(); if(sm != null) { sm.checkPermission(shutdownPerm); } try { shutdownLock.lock(); state = State.SHUTDOWN; terminateIfDone(queue.operationCount().intValue() == 0); } finally { shutdownLock.unlock(); } }
@Override public void run() { try { super.run(); } finally { tasks.remove(invocation.id()); if(state == State.SHUTDOWN) { //i.e. this is the last item on the queue terminateIfDone(queue.operationCount().intValue() <= 1); } } } }
@Override public void run() { try { super.run(); } finally { tasks.remove(invocation.id()); if ( state == State.SHUTDOWN ) { //i.e. this is the last item on the queue terminateIfDone(queue.operationCount().intValue() <= 1); } } } }
/** * See http://www.cocoabuilder.com/archive/message/2005/10/5/118857 */ @Override public void draggedImage_endedAt_operation(final NSImage image, final NSPoint point, final NSUInteger operation) { if(log.isTraceEnabled()) { log.trace("draggedImage_endedAt_operation:" + operation); } final PathPasteboard pasteboard = controller.getPasteboard(); if(NSDraggingInfo.NSDragOperationDelete.intValue() == operation.intValue()) { new DeleteController(controller).delete(pasteboard); } pasteboard.clear(); }
/** * @see NSDraggingSource * @see "http://www.cocoabuilder.com/archive/message/2005/10/5/118857" */ @Override public void draggedImage_endedAt_operation(final NSImage image, final NSPoint point, final NSUInteger operation) { if(log.isDebugEnabled()) { log.debug(String.format("Drop finished with operation %s", operation)); } if(NSDraggingInfo.NSDragOperationDelete.intValue() == operation.intValue()) { controller.deleteBookmarkButtonClicked(null); } NSPasteboard.pasteboardWithName(NSPasteboard.DragPboard).declareTypes_owner(null, null); pasteboard.clear(); }
@Action public void aclRemoveButtonClicked(ID sender) { List<Acl.UserAndRole> updated = new ArrayList<Acl.UserAndRole>(acl); NSIndexSet iterator = aclTable.selectedRowIndexes(); List<Acl.UserAndRole> remove = new ArrayList<Acl.UserAndRole>(); for(NSUInteger index = iterator.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = iterator.indexGreaterThanIndex(index)) { remove.add(updated.get(index.intValue())); } updated.removeAll(remove); this.setAcl(updated); this.aclInputDidEndEditing(); }
@Action public void metadataRemoveButtonClicked(ID sender) { List<Header> updated = new ArrayList<Header>(metadata); NSIndexSet iterator = metadataTable.selectedRowIndexes(); List<Header> remove = new ArrayList<Header>(); for(NSUInteger index = iterator.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = iterator.indexGreaterThanIndex(index)) { remove.add(updated.get(index.intValue())); } updated.removeAll(remove); this.setMetadata(updated); this.metadataInputDidEndEditing(); }
@Override public boolean outlineView_writeItems_toPasteboard(final NSOutlineView outlineView, final NSArray items, final NSPasteboard pboard) { final List<Path> selected = new ArrayList<Path>(); for(int i = 0; i < items.count().intValue(); i++) { selected.add(cache.lookup(new NSObjectPathReference(items.objectAtIndex(new NSUInteger(i))))); } return super.writeItemsToPasteBoard(outlineView, selected, pboard); } }
protected void _updateBrowserAttributes(NSTableView tableView) { tableView.setUsesAlternatingRowBackgroundColors(preferences.getBoolean("browser.alternatingRows")); if(preferences.getBoolean("browser.horizontalLines") && preferences.getBoolean("browser.verticalLines")) { tableView.setGridStyleMask(new NSUInteger(NSTableView.NSTableViewSolidHorizontalGridLineMask.intValue() | NSTableView.NSTableViewSolidVerticalGridLineMask.intValue())); } else if(preferences.getBoolean("browser.verticalLines")) { tableView.setGridStyleMask(NSTableView.NSTableViewSolidVerticalGridLineMask); } else if(preferences.getBoolean("browser.horizontalLines")) { tableView.setGridStyleMask(NSTableView.NSTableViewSolidHorizontalGridLineMask); } else { tableView.setGridStyleMask(NSTableView.NSTableViewGridNone); } }
@Action public void deleteButtonClicked(final ID sender) { final NSIndexSet selected = transferTable.selectedRowIndexes(); final Collection<Transfer> transfers = transferTableModel.getSource(); int i = 0; final List<Transfer> remove = new ArrayList<Transfer>(); for(NSUInteger index = selected.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = selected.indexGreaterThanIndex(index)) { final Transfer t = transfers.get(index.intValue() - i); if(!t.isRunning()) { remove.add(t); } } collection.removeAll(remove); collection.save(); }
/** * */ private void reload() { while(table.subviews().count().intValue() > 0) { (Rococoa.cast(table.subviews().lastObject(), NSView.class)).removeFromSuperviewWithoutNeedingDisplay(); } table.reloadData(); }
private void reload() { while(transferTable.subviews().count().intValue() > 0) { (Rococoa.cast(transferTable.subviews().lastObject(), NSView.class)).removeFromSuperviewWithoutNeedingDisplay(); } transferTable.reloadData(); this.updateHighlight(); this.updateSelection(); }
@Action public void stopButtonClicked(final ID sender) { final NSIndexSet selected = transferTable.selectedRowIndexes(); for(NSUInteger index = selected.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = selected.indexGreaterThanIndex(index)) { final Transfer transfer = transferTableModel.getSource().get(index.intValue()); if(transfer.isRunning()) { // Find matching background task for(BackgroundAction action : registry.toArray(new BackgroundAction[registry.size()])) { if(action instanceof TransferBackgroundAction) { final TransferBackgroundAction t = (TransferBackgroundAction) action; if(t.getTransfer().equals(transfer)) { t.cancel(); } } } } } }
@Action public void revealButtonClicked(final ID sender) { final NSIndexSet selected = transferTable.selectedRowIndexes(); final Collection<Transfer> transfers = transferTableModel.getSource(); final RevealService reveal = RevealServiceFactory.get(); for(NSUInteger index = selected.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = selected.indexGreaterThanIndex(index)) { final Transfer transfer = transfers.get(index.intValue()); for(TransferItem l : transfer.getRoots()) { reveal.reveal(l.local); } } }
@Action public void resumeButtonClicked(final ID sender) { final NSIndexSet selected = transferTable.selectedRowIndexes(); for(NSUInteger index = selected.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = selected.indexGreaterThanIndex(index)) { final Collection<Transfer> transfers = transferTableModel.getSource(); final Transfer transfer = transfers.get(index.intValue()); if(!transfer.isRunning()) { final TransferOptions options = new TransferOptions(); options.resumeRequested = true; options.reloadRequested = false; this.start(transfer, options); } } }
@Action public void reloadButtonClicked(final ID sender) { final NSIndexSet selected = transferTable.selectedRowIndexes(); for(NSUInteger index = selected.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = selected.indexGreaterThanIndex(index)) { final Collection<Transfer> transfers = transferTableModel.getSource(); final Transfer transfer = transfers.get(index.intValue()); if(!transfer.isRunning()) { final TransferOptions options = new TransferOptions(); options.resumeRequested = false; options.reloadRequested = true; this.start(transfer, options); } } }