View | Details | Raw Unified | Return to bug 300215 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java (-8 / +14 lines)
Lines 66-74 Link Here
66
66
67
	public SyncInfo getSyncInfo(IResource resource) throws TeamException {
67
	public SyncInfo getSyncInfo(IResource resource) throws TeamException {
68
		if (!isSupervised(resource)) return null;
68
		if (!isSupervised(resource)) return null;
69
		// XXX: doing this here is highly inefficient!
69
		// a little bit better than refreshing whole patch but still called too many times
70
		// getPatcher().refresh();
71
		// a little bit better but still called gazzilon times
72
		refresh(new IResource[] { resource }, IResource.DEPTH_ZERO, null);
70
		refresh(new IResource[] { resource }, IResource.DEPTH_ZERO, null);
73
		try {
71
		try {
74
			FilePatch2 diff = (FilePatch2) PatchModelProvider.getPatchObject(resource, getPatcher());
72
			FilePatch2 diff = (FilePatch2) PatchModelProvider.getPatchObject(resource, getPatcher());
Lines 91-111 Link Here
91
	}
89
	}
92
90
93
	public IResource[] members(IResource resource) throws TeamException {
91
	public IResource[] members(IResource resource) throws TeamException {
92
		//XXX: what if there is an addition in the patch that needs to add 3 subfolders?
94
		try {
93
		try {
95
			if(resource.getType() == IResource.FILE)
94
			if(resource.getType() == IResource.FILE)
96
				// file has no IResource members
95
				// file has no IResource members
97
				return new IResource[0];
96
				return new IResource[0];
98
			IContainer container = (IContainer) resource;
97
			IContainer container = (IContainer) resource;
99
98
			
100
			// workspace container members
99
			// workspace container members
101
			List existingChildren = new ArrayList(Arrays.asList(container.members()));
100
			List existingChildren = new ArrayList();
101
102
			if (container.isAccessible())
103
				existingChildren.addAll(Arrays.asList(container.members()));
102
104
103
			// patch members, subscriber location
105
			// patch members, subscriber location
104
			FilePatch2[] diffs = getPatcher().getDiffs();
106
			FilePatch2[] diffs = getPatcher().getDiffs();
105
			for (int i = 0; i < diffs.length; i++) {
107
			for (int i = 0; i < diffs.length; i++) {
106
				IResource file = PatchModelProvider.getFile(diffs[i], getPatcher());
108
				IResource file = PatchModelProvider.getFile(diffs[i], getPatcher());
107
				if (!container.exists(file.getProjectRelativePath())) {
109
				if (container.getFullPath().isPrefixOf(file.getFullPath())) {
108
					existingChildren.add(file);
110
					// XXX: check segments
111
					if (!container.exists(file.getProjectRelativePath())) {
112
						existingChildren.add(file);
113
					}
109
				}
114
				}
110
			}
115
			}
111
			return (IResource[]) existingChildren.toArray(new IResource[existingChildren.size()]);
116
			return (IResource[]) existingChildren.toArray(new IResource[existingChildren.size()]);
Lines 136-142 Link Here
136
				// return array of projects from the patch
141
				// return array of projects from the patch
137
				DiffProject diffProject = ((PatchProjectDiffNode)children[i]).getDiffProject();
142
				DiffProject diffProject = ((PatchProjectDiffNode)children[i]).getDiffProject();
138
				IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(diffProject.getName());
143
				IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(diffProject.getName());
139
				roots.add(project);
144
				if (project.isAccessible())
145
					roots.add(project);
140
			}
146
			}
141
		} else {
147
		} else {
142
			roots.add(getPatcher().getTarget());
148
			roots.add(getPatcher().getTarget());

Return to bug 300215