Eclipse - Change problems view action - eclipse

I am currently working on eclipse plugin development. I am working with the builders and markers and I have implemented a rename participant where it checks for a valid file name (does not contain any special characters, lets assume a valid file name to be a alpha numeric regular expression). Its working fine when the user is working within the workbench. Say, when a user directly goes into the file system and changes the file name. I have implemented the markers for this case too. It will show problem marker for the respective file in the project stating, "Invalid file entered - {filename}"
Is there any possibility to change the action on clicking the respective problem marker in the problems view. Say, if such a rename problem marker comes I want to open the rename resource dialog instead of opening the respective file on clicking the problem in the view. Any help upon that.

Although this does not change the double-click behaviour of the marker, you could provide a Quick Fix for the user as described in the Eclipse marker resolution help, and display the rename resource dialog from within the IMarkerResolutionGenerator you provide.

Related

How do I adjust the position attributes of custom Eclipse markers when a file is edited by typing?

Does Eclipse adjust the position attributes of custom markers when a file is edited?
I have many Eclipse plugins in which I successfully create and delete markers, create quick fixes, and apply edits to the active editor programmatically. When text is inserted or deleted from the buffer all the text in the editor shifts, of course, and Eclipse's markers and my custom markers stay in synch with the text.
The problem is that when the file is edited, whether by regular typing or programmatically by changing the IBuffer, the attributes (e.g. CHAR_START) are not modified - they report the values when the marker was created and first made visible. So when one goes to do a QuickFix on the marker, for example, the reported position is incorrect. (This is an info marker, in CDT, if that matters.)
How are these marker positions supposed to be updated when edits happen?
Is there an Eclipse way to do this, but I need to implement some setting or notification or listener?
One possibility is to implement a ResourceChangeReporter - but it is not triggered for me when text edits happen, just when, for example, a save is invoked. And, if it were, I don't see information about how the file is actually altered.
I suppose I could require that a dirty file be saved before the quick fix is applied, but I still don't see where to obtain information about the file's edits. If I apply the edit programmatically, I know this information, but it does not help when the edit happens by typing.
Marker positions can be updated during editing using an updater declared using the org.eclipse.ui.editors.markerUpdaters extension point and implementing the IMarkerUpdater interface.
However there is a default updater org.eclipse.ui.texteditor.BasicMarkerUpdater which is already active for all markers which should be doing basic position updating for you.

Netbeans platforme : How can I hide or remove the number displayed in front of the name?

When ran, the netbeans platform application has [the name of the projet]+[A sequence number] as name for the window. Is there a way, I can remove the number and keep the project name ?
I reckon that It's a simple question, but I can't seem to find how.
It seems like you want to use branding. Right click on your application module and choose Branding... There you go to Resource Bundles and scroll down to org/netbeans/core/startup/Bundle.properties. There should be a property inside named currentVersion, set to your application title (which you can choose in the Basic tab) and an appended {0}. This is replaced with the current date.
Remove that {0} and you should have what you wanted.

how to remove google sign in button in eclipse

I'm facing a wierd problem. My eclipse, has a google signin button which is occupying some of the space which I do not want to happen. Initially it had "Sign-in to Google" text along with it. I've followed some blog post and set accordingly to show just the icon (I don't remember that blog post link).
But now, the icon is getting replicating .. it is being shown 12 times. It is actually creating childs :P
I've gone through all the options present in Customize Perspective menu, none of them had this button listed. Can someone help me in removing that google sign button from my perspective? One possible suspect is- my eclipse crashes when I suspend and wakeup my machine.
You can use the Window > Reset Perspective... menu command to reset the perspective to its default state, which might eliminate that toolbar and buttons. If that fails, I would create a new workspace and import the projects into it using File > Import > Existing Projects into Workspace.
If you want to try to salvage your existing workspace, it's possible to do so my manually editing Eclipse's internal file that stores your Workbench layout, but it's a bit tricky. Here are the steps I've followed to eliminate a similar repeated toolbar item:
Exit Eclipse.
Find the Workbench layout file, it's path is <workbench>\.metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi. Make a backup of this file before you touch it - this is essential because it's easy to corrupt the file if you change the wrong things.
Open the file in your favorite XML-aware editor - most packages of Eclipse include the XML editor that works just fine1, but be aware that if you use Eclipse to edit the file you can't have Eclipse open on the workspace that contains the workbench.xmi you want to edit.
Find the section of <trimBars> nodes in the XML; from there you have to determine which <trimBars> node you need to edit. In your case it looks like a vertical one, probably with a side="Right" attribute.
Under the correct <trimBars> node you'll find multiple <chlidren> nodes, each with an elementId attribute that should help you identify it; you're looking for <children> nodes that are identified as something related to the Google plugin.
Delete the <children> nodes that seem related to the unwanted toolbar buttons. In your case, it appears that there is an entire toolbar that you might want to eliminate, so you might want to delete the entire containing <trimBars> node.
Save the file and start Eclipse on that workspace.
1Some packages of Eclipse include EMF tools that will open it in a special XMI editor that does not provide a view of the source, only a structural tree view. Depending on how you like to work with XML, this might be easier than editing raw XML.
This is not a perspective but a view. You can hover over that bar with the buttons and click Alt+Shift+F1 to check where this View comes from. Then you can either disable/uninstall the contributing feature (Help -> Installation Details) or check where the feature came from.
If it comes from the IDE, you can open a bug for it. If it is contributed from a third party plugin, contact the developers of that plugin.
There is an eclipse bug concerning duplicate view toolbar buttons in Luna that has recently closed as well. Maybe this solves your problem as well.
Edit: Taken from this bug:
root cause is that in Luna 4.4M5 WorkbenchWindowControlContribution.createControl is called twice, the
first time with a null value for
WorkbenchWindowControlContribution.getWorkbenchWindow() while it is
still being created. This is related to what has been reported here
https://bugs.eclipse.org/bugs/show_bug.cgi?id=427452
second cause is that my createControl(Composite parent) method was calling PlatformUI.getWorkbench().getActiveWorkbenchWindow() instead
of WorkbenchWindowControlContribution.getWorkbenchWindow(). This
resulted in an attempt to create a new Workbench Window, which
recursively calls createControl() again. This has already been
reported here https://bugs.eclipse.org/bugs/show_bug.cgi?id=366708

How to change open with options in navigator depending upon name of the resource?

I am working on eclipse RCP application which implements CommonNavigator view to display navigator. I have few LinkedResources in navigator that link to files on the file system with custom extension. These custom extension files are opened in custom editor as well as in TextEditor.
One of the file named default.ext will be common to all the projects and I want to keep it read only. Is it possible to open file in custom editor only? For ex. Default.ext should be opened in only custom editor, however Test.ext should be opened in custom editor as well as text editor.
This way I could handle save action in my editor depending upon file name and keep the file read only.
Is there any other way to keep files read only?
Short answer: not possible in the way you describe.
Long answer: if somebody really wants to modify a file then there's no way or need to stop this. What you can do is either (1) hide the file from user or (2) set Read-only flag to discourage users from modifying the file.

Two questions about Netbeans

I'm migrating from Eclipse to Netbeans, and two problems are happening:
I created my own file template, but how can I set a default for the "Created file name" field?
I always name my files as Class_Name.class.php and Netbeans doesn't allow me to edit the field to add the ".class".
Sometimes, the mouse cursor change from the default text pointer to arrow pointer and I have to close and re-open Netbeans to go back to normal. Anyone had the same problem?
I'm running a Mac OS X 10.6.5 and Netbeans 6.9.1
Go to Tools|Templates, and in the template manager find the template in question. (Unintuitively) Right-Click on the template and select Properties. You can change the File Name property here, but in NB 6.9.1 it seems a bit quirky to me. For example, I changed the File Name for the PHP Class template from PHPClass to PHPCLass.class. It certainly put the .class on to the filename, but gave me PHPCLass.class in the File Name field on the New PHP Class dialog (File|New File...|etc., or any of the number of other ways to get to a new file dialog). I had to deselect the .class part manually to give the file a name that still included the .class. More annoying, however, was that if the value of the File Name property contains an extension-looking piece, then the automatic generation of the .php was surpressed! I had to go back and change the File Name property to "PHPClass.class.php" and deal with retaining both the .class and the .php.
I tried going a different route, by attempting to add a new extension in Tools|Options|Miscellaneous|Files, but that would not let me create an extension that contained a period.
I have not found a property, yet, that controls the created name directly.
I've never seen that, ever. I'm not on a Mac, so that might be something quirky/localized to the Mac look and feel (try a different one--Napkin is always entertaining for about 90 seconds, :-) until you realize not all controls are accounted for), or maybe (and more scary) a quirk/bug in the native-end of Mac's implementation of Swing components.