/** * This hook method is called from <code>getChildren</code> once for every * member of a container resource. This implementation * creates a new <code>ResourceNode</code> for the given child resource. * Clients may override this method to create a different type of * <code>IStructureComparator</code> or to filter children by returning <code>null</code>. * * @param child the child resource for which a <code>IStructureComparator</code> must be returned * @return a <code>ResourceNode</code> for the given child or <code>null</code> */ protected IStructureComparator createChild(IResource child) { return new ResourceNode(child); }
@Override public void setContent(byte[] contents) { fDirty = true; super.setContent(contents); }
protected void fireContentChanged() { super.fireContentChanged(); }
/** * Returns the hash code of the name. * @return a hash code value for this object. */ @Override public int hashCode() { return getName().hashCode(); }
public InputStream getContents() throws CoreException { if (exists) return super.getContents(); return null; }
protected InputStream createStream() throws CoreException { InputStream inputStream = super.createStream(); updateTimestamp(); return inputStream; }
@Override public IStatus validateEdit(Shell shell) { if (isReadOnly()) return ResourcesPlugin.getWorkspace().validateEdit(new IFile[] { (IFile)fResource}, shell); return Status.OK_STATUS; } }
/** * Discard of any buffered contents. This must be called * when the local element is no longer needed but is dirty since a * the element will connect to a shared document when a merge viewer * flushes its contents to the element and it must be disconnected or the * buffer will remain. * #see {@link #isDirty()} */ public void discardBuffer() { if (sharedDocumentAdapter != null) sharedDocumentAdapter.releaseBuffer(); super.discardBuffer(); }
public Object[] getChildren() { if (fChildren == null) { fChildren= new ArrayList(); if (fResource instanceof IContainer) { try { IResource members[]= ((IContainer)fResource).members(); for (int i= 0; i < members.length; i++) { IStructureComparator child= createChild(members[i]); if (child != null) fChildren.add(child); } } catch (CoreException ex) { // NeedWork } } } return fChildren.toArray(); }
private static boolean matches(IEditorReference editorRef, IEditorInput input) { if (input instanceof FileEditorInput) { IFile file = ((FileEditorInput) input).getFile(); CompareEditorInput cei = (CompareEditorInput) ((EditorPart) editorRef .getPart(false)).getEditorInput(); Object compareResult = cei.getCompareResult(); if (compareResult instanceof IAdaptable) { IResource r = ((IAdaptable) compareResult).getAdapter(IResource.class); if (r != null) return file.equals(r); } if (compareResult instanceof ICompareInput) { ICompareInput compareInput = (ICompareInput) compareResult; ITypedElement left = compareInput.getLeft(); if (left instanceof ResourceNode) if (file.equals(((ResourceNode) left).getResource())) return true; ITypedElement right = compareInput.getRight(); if (right instanceof ResourceNode) if (file.equals(((ResourceNode) right).getResource())) return true; } } return false; }
/** * Returns the hash code of the name. * @return a hash code value for this object. */ public int hashCode() { return getName().hashCode(); }
@Override public InputStream getContents() throws CoreException { if (exists) return super.getContents(); return null; }
@Override protected InputStream createStream() throws CoreException { InputStream inputStream = super.createStream(); updateTimestamp(); return inputStream; }
public IStatus validateEdit(Shell shell) { if (isReadOnly()) return ResourcesPlugin.getWorkspace().validateEdit(new IFile[] { (IFile)fResource}, shell); return Status.OK_STATUS; } }
/** * Discard of any buffered contents. This must be called * when the local element is no longer needed but is dirty since a * the element will connect to a shared document when a merge viewer * flushes its contents to the element and it must be disconnected or the * buffer will remain. * #see {@link #isDirty()} */ @Override public void discardBuffer() { if (sharedDocumentAdapter != null) sharedDocumentAdapter.releaseBuffer(); super.discardBuffer(); }
@Override public Object[] getChildren() { if (fChildren == null) { fChildren= new ArrayList<>(); if (fResource instanceof IContainer) { try { IResource members[]= ((IContainer)fResource).members(); for (int i= 0; i < members.length; i++) { IStructureComparator child= createChild(members[i]); if (child != null) fChildren.add(child); } } catch (CoreException ex) { // NeedWork } } } return fChildren.toArray(); }
.getResource(); final Subscriber subscriber = ((SubscriberMergeContext)ctx).getSubscriber();
/** * This hook method is called from <code>getChildren</code> once for every * member of a container resource. This implementation * creates a new <code>ResourceNode</code> for the given child resource. * Clients may override this method to create a different type of * <code>IStructureComparator</code> or to filter children by returning <code>null</code>. * * @param child the child resource for which a <code>IStructureComparator</code> must be returned * @return a <code>ResourceNode</code> for the given child or <code>null</code> */ protected IStructureComparator createChild(IResource child) { return new ResourceNode(child); }
@Override public void setContent(byte[] contents) { fDirty= true; super.setContent(contents); }
@Override public boolean equals(Object other) { if (other instanceof ITypedElement) { String otherName= ((ITypedElement)other).getName(); return getName().equals(otherName); } return super.equals(other); }