DESCRIPTION

Commit should only prompt if unsaved files are from repo

Before, it would always prompt, even if the unsaved files belonged to
another repository.

Bug: 376700
Change-Id: I8a29e5121524f9610a3c05d613780d864f0aa0a6
Signed-off-by: Danika Greer xxx@xxx.xxx


COMMENTS

author: Sebastian Porter
date: 2012-07-24 09:57:02.000000000

Patch Set 1: Do not submit

This change is wrong as it restricts the fileset to projects which are imported into the workspace. If one changes a file which is not imported (e.g. .git/config), then that file would no longer reported when it's dirty.

-------------------------------------
author: Danika Greer
date: 2012-07-24 10:43:46.000000000

Patch Set 1:

Hm, you're right. I now tried the following:

		workbench.saveAll(window, window, new ISaveableFilter() {
			public boolean select(Saveable saveable, IWorkbenchPart[] containingParts) {
				ResourceMapping mapping = ResourceUtil.getResourceMapping(saveable);
				IResource resource = ResourceUtil.getResource(saveable);
				IFile file = ResourceUtil.getFile(saveable);

But mapping, resource and file are all null (I tried with .gitignore). Do you know how to get to a path from such a Saveable?

-------------------------------------
author: Sebastian Porter
date: 2012-07-26 09:42:16.000000000

Patch Set 1:

There are two problems:
1) IFile/IResource only works for files that are in the workspace i.e. its project is checked out / imported. For the other case it's a local file represented by an IFileStore (and the editor uses an FileStoreEditorInput).


2) Savable is not our friend. You can almost do nothing with it. We have two choices to get the IFileStore:

a) Go via containingParts and its editor inputs. This can be complicated due to multi-page editors.

b) Use file buffers:
IDocument d= (IDocument)saveable.getAdapter(IDocument.class);

ITextFileBuffer buffer=
FileBuffers.getTextFileBufferManager().getTextFileBuffer(d);

The file buffer gives you the the IFileStore and also the path/location.

-------------------------------------
author: Gerrit Johnathan Pham
date: 2012-08-08 14:51:42.000000000

Your change could not be merged due to a path conflict.

Please merge (or rebase) the change locally and upload the resolution for review.

-------------------------------------
