I'm new at programming and this is my first plugin...
I designed a plugin with a menu and a perspective for my *.properties files. They work just fine.
Now, I would like to trigger the perspective once I click on a menu item(one of my menu's choices) which will trigger the opening of a *.properties file. Or perhaps, I shall rather open the perspective everytime I open a *.properties file ? I'm not sure which way is more appropriate.
How can I do that and where ? Should I do it in the Activator file (in the start method) or in the PerspectiveFactory file ?
Thank you for your kind help,
V
Related
There is this feature that IDEA IntelliJ has: when a new file is opened the Project tree (view) automatically jump to the file opened (handy when you follow a function defined in some other file).
I'd like to know if qtcreator provide this option
Surprised how hard it is to find the answer, since the button isn't hugely obvious.
The button you want is at the top of the Project pane, between "filter" and "split". Tooltip says "synchronize with editor".
I'm quite confused when it comes to file templates in IntelliJ. Basically, when I right click anything and hover my mouse over to New, I can see the usual file templates like Java Class, HTML File and so on. I downloaded Scala plugin and I can see Scala templates (Scala Class, Scala Object, etc.) if I go to Edit File Templates, but I can't actually use/see them in the New menu. Is there a way to modify what I see in the New menu? I'd like to be able to create Scala classes.
Go to Settings -> Menus and Toolbars
There you will see many type of menus. You need edit the menu you want the files to be displayed. Most Probably "Project View Popup Menu".
Click on "Add After" button on right. There you choose the file form plug-ins or other category to be displayed.
I added "Show Bytecode" to meny well it does not make sense here. You can add files from scala plugin like that.
You can restore to Defaults if you mess up easily by clicking on
"Restore All Defaults" button.
Coming from a Visual Studio environment and Xcode environment, if you highlight a file on the project window (LHS), the file opens. IntelliJ doesn't open a file until you double click it.
It's kind of a different feel since it opens it up in a new tab each time vs just using the last active window or a preview window to flip between files. Is there a way to make it more like VS or Xcode that where highlighting the file actually opens the file in the current window?
There is Autoscroll to Source option in the project view settings. Unfortunately it doesn't open the focused files in the current tab, but in new tabs.
I haven't found an option to change this behavior anywhere, but there is already a feature request on IntelliJ's YouTrack asking for this, so feel free to vote for it :)
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
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.