find conflicts with subversive API - eclipse

I am writing an eclipse plug-in to update some projects in my workspace. After the update, there may be conflicts. I want to show a dialog to the user if there are some conflicts in the updated project(s).
To update, I use the UpdateOperation, then I do a IResource.refreshLocal() on the updated project. To look for conflicts I use FileUtility.checkForResourcesPresenceRecursive(resources, IStateFilter.SF_CONFLICTING). Also tryed with IStateFilter.SF_CONTENT_CONFLICTING and IStateFilter.SF_TREE_CONFLICTING. Normally they return false.
When I run in debug mode, the first two return true. That brings me to think that there is some event that gets fired after the refresh and with the loss of time in debug mode, Subversive gets to know about it. Am I right ? What event is this ? It is not IResourceChangeEvent. Tryed to listen for POST_CHANGED with no luck.
Do you have a hint for me ? Thank you.

It was easier than I expected. The UpdateOperation (and also the CommitOperation and the MergeOperation) class extends AbstractConflictDetectionOperation that offers the hasUnresolvedConflicts() method. That does the trick ;)

Related

Scout eclipse execStore not markSaved

I Would like to know how to set inside execStore function that "dirty" flag is still on.
I see that in scout function for saving markSaved() is called after execStore(). But what if I have some logic in execStore(), that can prevent save. In this case I would like not to be marked as saved.
Is there a way to avoid setting form as markSaved() ?
Is there aright scout way for handling this?
You can:
throw an exception (ProcessingException or VetoException) during execStore()
call setFormStored(false); [it works with Eclipse Mars]
See also in the Scout Forum: execStore() and Confirmation
PS: I did not test it with Eclipse Neon. Please report if this behavour has changed with Neon. I am interested in your findings.

Eclipse dot does not auto suggest

I am using Eclipse 3.7.1 classic.
When I type a class, it does not show the auto suggest. I dont know why, before it can pop up the function.
I have not changed any configuration of the eclipse.
For example, when I type System, it does not pop up the auto suggest, like out.println.
Go to Preferences->Java->Editor->Content Assist.
Make sure you have "Enable Auto activation" Checked
If it doesn't work, go to Advanced section: Java->Editor->Content Assist->Advanced
In the "Select the proposal kinds contained in the 'default' content assist list",
have "Java Proposals" Checked
OR
Restore Defaults, Apply and it should work.
Start eclipse with the -clean parameter to delete old stored values.
If you installed new plugins you should disabled them in the prefrences-> workspace and see if one is blocking the GUI.
This can happen if you have a syntax error that you have not noticed higher up in the class, such as forgetting to close a method with a } or missing a terminating ";".
Try the same in a new project. If you still have the problem I'd try the suggestion by "Udo Fholl".

Method listings when typing '.' after an object

Normally when you put the '.' after an object and wait you get a list of methods/fields/classes that one can access. My eclipse no longer does this for me. I spent 10-15 minutes searching for a way to turn it back on and I came up empty. How can I turn this back on?
You can try mucking around in
Preferences > Java > Editor > Content Assist
and see what you get. I've had this once before; eclipse got into a bad state and wouldn't code complete for a given project. Reverting changes in the project got rid of some errors and it started working again.
Assuming you're using Java you need to look at setting Java -> Editor -> Content Assist. You want to make sure that "Enable auto activation" is checked and the other options are set to your taste. The auto activation trigger should be the period.
It may not work if you have an error in your code.

Can we set a timeout for the Eclipse function hint list?

is it possible to set a timeout for the Eclipse function hint list?
Waiting for the full function list to load simply pisses me off...:(
First, you can trigger the content assist immediately by hitting Ctrl-Space.
Second, you can set the delay under Window->Preferences->Java->Editor->Content Assist->Auto-Activation. Non-Java editors may have separate settings. You can type search terms on top of the prefence window to see all related settings.
I would like to add on this by pointing out that I was facing the same kind of issue in Eclipse Mars Version 4.5.0 M1.
I got this error :
I managed to solve it by disabling the following setting "Code Recommenders proposals" from Window\preferences\Java\Editor\Content Assist\Advanced
Disable it from both Default proposal kind and Content cycling . Restart eclipse , and the error is gone.
I don't know why this happens, or what the addon does. Maybe someone can elaborate on it.

Avoiding "resource is out of sync with the filesystem"

I develop Java code with Eclipse and regularly get this message:
resource is out of sync with the filesystem.
Right-click > Refresh will always clear this.
But why can't Eclipse refresh automatically when it finds this condition? Are there cases where you want the resource to be out of sync?.
If there are such conditions and they don't apply to my work, is there a way of getting Eclipse to refresh automatically when it encounters this state?. (I appreciate that it should refresh as little as it needs to in normal development to increase performance for human developers.)
UPDATE (2012-06-25):
My latest update (Version: Indigo Release Build id: 20110615-0604)
no longer shows
Preferences - General - Workspace - Refresh Automatically
There is an option "Refresh on access" - should I use this?
You can enable this in Window - Preferences - General - Workspace - Refresh Automatically (called Refresh using native hooks or polling in newer builds)
The only reason I can think why this isn't enabled by default is performance related.
For example, refreshing source folders automatically might trigger a build of the workspace. Perhaps some people want more control over this.
There is also an article on the Eclipse site regarding auto refresh.
Basically, there is no external trigger that notifies Eclipse of files changed outside the workspace. Rather a background thread is used by Eclipse to monitor file changes that can possibly lead to performance issues with large workspaces.
Just right click on the file or on the project and click Refresh. The error will vanish. I also faced the same issue and it worked for me.
Window -> Preferences -> General -> Workspace
For the new Indigo version, the Preferences change to "Refresh on access", and with a detail explanation : Automatically refresh external workspace changes on access via the workspace.
As “resource is out of sync with the filesystem” this problem happens when I use external workspace, so after I select this option, problem solved.
This happens to me all the time.
Go to the error log, find the exception, and open a few levels until you can see something more like a root cause. Does it says "Resource is out of sync with the file system" ?
When renaming packages, of course, Eclipse has to move files around in the file system. Apparently what happens is that it later discovers that something it thinks it needs to clean up has been renamed, can't find it, throws an exception.
There are a couple of things you might try. First, go to Window: Preferences, Workspace, and enable "Refresh Automatically". In theory this should fix the problem, but for me, it didn't.
Second, if you are doing a large refactoring with subpackages, do the subpackages one at a time, from the bottom up, and explicitly refresh with the file system after each subpackage is renamed.
Third, just ignore the error: when the error dialog comes up, click Abort to preserve the partial change, instead of rolling it back. Try it again, and again, and you may find you can get through the entire operation using multiple retries.
If this occurs trying to delete a folder (on *nix) and Refresh does not help, open a terminal and look for a symlink below the folder you are trying to delete and remove this manually. This solved my issues.
When you open an Eclipse workspace from within a clearcase view and try to rename the project, you will often get the pop-up warning ... “Resource ‘project’ is out of sync with the file system”. If refreshing the project does not fix the problem, then do the following workaround: a. Open workspace WITHOUT being in a view b. Select the project in Project Explorer c. ClearCase -> Associate Project (project should now look like project [] ) d. Right click project -> Refresh (vob sub-folders should now be empty) e. Right click project -> Rename ... f. Enter New name
Now you can close the workspace, reopen it in a view and refresh the project. You may also dissociate the project if you prefer the project not to be associated with the vob.
A little hint. The message often appears during rename operation. The quick workaround for me is pressing Ctrl-Y (redo shortcut) after message confirmation. It works only if the renaming affects a single file.
If you are a regular Eclipse user than you might have got this error many times. The error simply says, “you’ve made changes in files in your workspace from outside eclipse”. The simplest solution would be to select the project and press F5 (Right click -> Refresh).
if you need more explanation you can read from this web site
I was not able to resolve this error by either refresh or by turning on "native polling" workspace feature. Turned out my project was also opened in two instances of eclipse. Once I closed the other instance, the error went away. So make sure your project is only opened at one place if you are seeing this error.