Say I have defined my own TextEditorX extends TextEditor. In the typical Eclipse-RCP scenario (standard plugins, workbench with Project Explorer/ Navigator) the behaviour when someone tries to rename (via Project Explorer or Navigator) a file that some editor has opened is:
If the editor is not dirty, the renaming is allowed. Afterwards editor.setInput() will be called, with the new filename as argument.
If it's dirty, an error is thrown ("Rename resource" : "A fatal error occurred while performing the refactoring" "Found problems: doc.txt is unsaved").
My questions:
At which level is this behaviour defined? I guess that the package org.eclipse.ltk.ui.refactoring.resource is involved... But, suppose for example that I want to disallow the rename even when the editor is not dirty: could this behaviour be determined by some method in the editor (or the document provider), or should I code/extend some RenameParticipant ?
How does the renamer knows that the resource doc.txt is opened by that editor instance? Does it just check all opened editors and ask each one for its editorInput, or are documentProviders involved? Specifically, suppose I have a particular editor that, besides the "main" file, depends on other resources (a multi-file input), and it want the renamer to ask him before renaming any of his inputs. How would you approach this scenario?
There's no theoretical reason for Eclipse to prevent a rename of a modified file. For one, the editor could register a ResourceChangeListener with the workspace, and simply update its IEditorInput in response to a MOVE notification. Not sure if that is a good answer but maybe a good approach to go.
Related
I am trying to determine a package for an data element, or domain, or whatever via Eclipse ADT, but have no luck. I'm doing usual object search via project search (Ctrl-Shift-A), and both Global search (Ctrl-H), the result is the same.
I see domain properties window
and it has no clue about what package it is.
What I've tried so far:
Using filters in project search bar, callable via Ctrl-Space
Package filter does not help, it lists all packages, not the relevant ones, where this domain was found. Picking each and every package will take infinity amount of time, because the hierarchy is huge.
Pressing "Link with editor" button
For some reason it doesn't work, should it with DDIC objects? When I press it with domain opened right-side, just nothing happens. In the help and e.g. here they describe it should open the object in the left within hierarchy.
Is it something broken with my ADT or this button doesn't work with DDIC objects?
P.S. It is ABAP Cloud trial system, if that matters.
Package can be seen in Properties tool (see the bottom part of the screenshot below)
How can I set PhpStorm file structure view to show inherited members by default (or change key binding from Ctrl+F12 to show)?
The question pretty much says it all.
I configured file structure to show up with Ctrl+Alt+S, but cannot change the default setting for show inherited and can't change the keys either.
Is there a file, where default non editable configurations are in?
For example there is an xml file under PHPStormRoot\config\keymaps
What would the action be for that?
Is there a plugin for more configurations?
Should I consider writing a plugin myself (would I be able to change such things)?
I found that if you remove the other configurations(ctrl+F12) for opening file structure, show inherited members becomes your keybinding(ctrl+alt+S).
However it can be buggy, won't open until you re open the IDE.
Also you will be delighted to know that if the method you are looking for doesn't exist it will automatically search from inherited members too.
I also removed f12 from my keymap at PHPStormRoot\config\keymaps\$YOURCONFIGFILE.xml
EDIT: Show extra info
It is "de rigeuer" here to move the key.snk file generated when a new project is created from its default location at the bottom of the Solution up into the Properties folder.
This is not just a local "superstition"; it seems to be the "accepted method", as seen here
But why? That book does not seem to explain the raison d'etre for this action...
It makes no difference where the key file is located as long as the assembly is signed.
The author explains why she/he does that:
"As projects become more complex, a lack of vertical space in the Solution Explorer makes projects more difficult to work with"
So the reason seems to be to hide the key file inside the properties folder to save some space on the visual studio Solution Explorer display.
My personal opinion is to ignore that as that will confuse another developer which is expecting to see it in the default location: in the project root.
I'm having an issue with IntelliJ, that I cannot seem to find a solution for myself. I have not changed any settings, yet when I started my IDE this morning, all Inspections and other highlighting has disappeared.
By highlighting, I mean stuff like variable names becoming purple, static finals shown with italic text, etc.
Inheritance seems to be broken as well, in that an implementing method links to the implemented interface method, but interface methods do not link to the implementing method.
My search for this tells me that there is an icon for this in the bottom right. That's set to "Inspections", and under configuration, it seems like everything is set to default.
Is there some way to un-break my IDE?
Another solution:
File -> Power Save mode
It needs to be disabled.
The (or at least one) answer to this is:
File -> Invalidate Caches
Make sure the folder the code is in is marked as the sources root. If it's not marked as the sources root, syntax highlighting will be very limited.
To mark a directory as the sources root, right click the directory, then navigate down to "Mark directory as" and select "Sources root."
I have a noob Perforce question. I got my perforce plug-in on Eclipse working(for both Java and C).
I have no problems "opening" my perforce stored projects on Eclipse.
Scenario 1:
Whenever I want to change code, I open the project on Eclipse and right-click on it and go to "team" and check out, make changes and then submit. Works fine. But even after that I see a tick mark(indicating check-out) on my perforce screen.
Scenario 2:
I just open perforce code as Eclipse project and make changes(If read only, it prompts and asks if i have to allow write and I say yes). I make changes and save. It doesnt ask for submit. Also if I now open the code on Perforce screen, I already see the new changes made.
Scenario 3:
Just on a Perforce screen, if I check a file out and don't make any changes, I obviously dont want to submit as there are no changes. In this case, how can i "disable" check-out so that my fellow programmers dont think i'm working on it??
Scenario3:
So here are 2 ways i consider a good usage of the plugin:
Use Revert Unchanged Files:
Before you begin development of a feature, checkout the entire tree/branch that your changes will be concentrated around in future. You can do this by right-click the relevant package in package explorer. Once you want to submit, Project->Right-click->Team->Revert Unchanged Files. Now, you can submit your changelist.
This approach stands very useful if you know you will be editing a lot of files or replacing files.
Ofcourse, others can see that you have checked out the files.
Enable Auto checkout:
Incase you are going to make few changes, you should enable autocheckout. This will checkout the file when you begin to make edits. Eclipse->Preferences->Team->Perforce->Enable support for workbench edit..
detailed explainations here. Its a good idea to have this enabled always as it checks out on demand.
However, this does not monitor the filesystem so and code/libs you replace outside of eclipse are not checked out.
For Scenario 3, you can change a workspace option to prevent submitting unchanged files:
SubmitOptions: reverttunchanged
If you have a file checked out (open for edit), others will be able to see that. I guess I'm not clear on why you check a file out if you don't intend to modify it?
If you are going to setup this way and are also using the desktop client, I recommend the following steps in the desktop client:
1.) Open your desktop Perforce client
2.) Click “Connection” on the global menu
3.) Select “Edit Current Workspace…”
4.) Under the “Advanced” tab select “allwrite”
5.) Click Apply, then OK