How to Force Eclipse to not Change Readonly File Flag? - eclipse

I'm using Eclipse with Perforce version control. In P4V I check out the files I want to modify, making them readonly, but when I open a file I didn't check out in Eclipse it prompts me if I'd like to make it writable and defaults the anser to 'Yes.' If I'm not paying attention and just typing I unintentionally make files writable and then have to reconcile with P4V.
Is there any way to force Eclipse to just disallow changing the read-only flag on files?

I do not know the answer to your actual question, but you may be able to work around this issue by using Perforce's Eclipse plugin. That way, if you unintentionally modify a file, it will be in your pending CL where you can review the change and revert if it necessary.
http://www.perforce.com/perforce/products/p4eclipse.html

In Eclipse , click on Window-> preferences->Team->{selct ur source, in your case it should be P4V } . In there you have some default settings done. You can apply them as per your need. I had the same issue with MKS and me going there resolved the issue.
MAKE SURE YOU REFRESH AND RESTART ECLIPSE TO SEE THE CHANGES. SOMETIMES ECLIPSE DOES NOT RECOGNIZE THE CHANGES MADE IN PREFERENCES.
I hope this helps you too.

Setting perforce_auto_checkout property to false in Eclipse will give you the desired behaviour.

Related

Can I use the same Eclipse workspace simultaneously on two computers?

My friend and I need to use the same Eclipse workspace. I've put it on an AFP server, so we can both mount the volume and use the workspace there. But will that work without problems as long as we are not editing the same file at once? For example, if there are classes Starter and View, could I be editing Starter.java and saving the project while he edits and saves View.java?
I know that Eclipse cannot normally use workspaces on AFP due to a bug. I had to add "-Dosgi.locking=java.io" to the eclipse.ini file to make it work.
Yes. But you will need to change its configurations to not lock the workspace. This is the default behaviour.
This is the option:
-Dosgi.locking="none"
Use it in your vmargs or in ini file. I do not need to mention you and your friend need some discipline to not be caught by side effects of this solution.
For example, if both are working in file A, when the first save eclipse will ask if you wish update with system file changes. If you click yes your changes will be lost.

Subclipse Lock Automatically

I'm currently using subclipse with eclipse to connect my project to SVN. Due to management decisions we must use the lock-modify-unlock model instead of the standard SVN model. We are accomplishing this by adding the auto prop need-lock. Subclipse recognizes this and asks us to lock whenever we edit a file, which works but it rather annoying. Is there any configuration settings we can use to make it automatically take the lock for the file as long as it is not already locked (at that point it can pop up and bother us)?
No, there is no setting to bypass the dialog.

NetBeans: should nbactions.xml, nb-configuration.xml and catalog.xml go into source control?

This thread is very useful for finding out which files in Netbeans should go into source countrol, but it doesn't cover all files.
In particular I'm wondering whether the following files should go into source control. Here are my assumptions/guesses:
nb-configuration.xml - easiest - the file itself in the comment says it should go into source control.
nbactions.xml - from what I see this file stores information typical to running the application. I.e. JVM arguments etc. So I suppose it is a question of taste - if you want other developers to have a "suggested" Run configuration - include it. Otherwise - don't. Correct?
catalog.xml - not sure what this does (I GUESS it's used by the editor to find out xml schemas and such to enable syntax coloring, but it's just a guess). Anyway - I see that this file has system-specific information (path) - so it shouldn't go into source control.
Can anyone confirm the above?
Thanks,
Piotr
I never put my IDE configuration files in the repository, for several reasons:
other colleagues may want to use theirs;
other colleagues may want to use other IDEs (such as Eclipse) and seeing those files (or even have to exclude them from the checkout) could be annoying for them;
some of these files are generally not related to a single project, others automatically generated, so no need to store them in the source code of every project.
In order to exclude them, our first solution was the .svnignore, but it was still logically wrong to modify some shared content for the specific needs of a single user, so we decided to be more strict:
in my ~/.subversion/config I have:
[miscellany]
global-ignores = nbactions.xml nbproject
Hope this helps,
Marcello
In my Maven based projects I put nbactions.xml into source control. Just make sure to change absolute paths to relative ones.
I put nbactions.xml into source control BUT there is a caveat: it's internal format can change so if your developers, for any reason, use different versions of NetBeans you could have to remove it because sharing it becomes nasty.
Recently I upgraded from NetBeans 7.3.1 to 7.4 and the "Run" action was giving a strange error message. I solved the problem by deleting and regenerating nbactions.xml: the old one had a custom Maven goal for the "Run" and "Debug" actions; it was org.codehaus.mevenide:netbeans-deploy-plugin:1.2.4:deploy it was not visible in the IDE v7.3.1 (perhaps it has been generated by an even older version for internal usage) and was generating a class not found for org.openide.util.Lookup in v7.4. I'm documenting the problem here because I found the solution by myself after an unsuccessful search on the Net. I hope this can help someone else.

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".

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.