Opening a temporary buffer / scratchpad in Netbeans? - netbeans

I often have to open a secondary editor outside of Netbeans in order to work on temporary bits of text outside of my project files. Is there a way to create temporary files in Netbeans without adding them to a project?
File -> New expects every file to be part of a project.

I know this has already been answered successfully, but there is now a proper Netbeans plugin for this requirement: http://code.google.com/p/netbeans-scratchpad-plugin/ It works nicely for me and allows multiple scratchpads which can be handy.
Also note that the Copy/Paste History plugin which is available by default (with NB7 at least) is handy for this too.
HTH,
JD

By default, there is no such feature yet (I'm using 6.5).
You could include a folder in the Favorites window, and right click > New > Empty File from the folder, it won't be part of the project.

Related

Eclipse: Is it Possible to Open Files that are in a Workspace But Not in a Project?

I have a folder hierarchy that looks like this:
- workspace
- some_folder
+ eclipse_project
Is it possible to open and view the hierarchy in the project explorer of Eclipse beginning at "some_folder," instead of at "eclipse_project?" If so, how is this accomplished? When I try importing, Eclipse obviously refuses to because the files in the outer folder are already in the workspace.
Or does this contradict the principle behind Eclipse and projects?
Thanks.
Or does this contradict the principle behind Eclipse and projects?
Yes, it does. The File menu does offer to let you Open File..., but whether it's supported by an editor and how much functionality is retained is entirely up to that editor. Some will flat-out fail.
As a workaround, you can create a New General->File, expand the Advanced section of the wizard, and set the new in-workspace file to link to the real file's physical on-disk location, as long as that location is not in some way under the workspace's location. Note that even this may not always be supported by extremely old editors.

Eclipse refactor renaming without saving all files

I'm currently using Eclipse to work on a PHP project. I commonly need to rename files but have others open that have changed that i'm not quite ready to save. I go to rename a file and a refactoring window pops up to save all documents. Is there a way around this?
Simple renaming is available on 'Navigator'(Window->Show View->Navigator) or 'Project Explorer'(Window->Show View->Other->General/Project Explorer).
(it seems that there is no workaround on PHP Explorer)

Sublime Text: quickly access files outside the current project

To facilitate code reuse across projects, I set up this (quick and dirty) method to access recent projects.
In the current project, I add a link (z-themes) to a folder that contains links to recent projects. This enabled me to access those files without having to open the whole project (this worked in Espresso).
In Sublime Text, links are not followed and symlinks mess with the file search (files in the linked folders appear in the Go to file panel, so I might open the wrong file)
The question is: how do easily I access files in predefined folders outside the current project?
Plugins and alternative workflows are welcome.
Perhaps something like FuzzyFileNav? That plugin allows you to set up bookmarks to a particular folder. You can then navigate through folders as you would normally in the file system.
I found Goto Folder: it's very simplistic and doesn't allow for any file management like FuzzyFileNav does (which could be nice) but it allows for simple bookmarks and it behaves well.
Edit: I also found FileBinder
This is what I use now: I created a previous projects "project" just for the older files.
simple to add projects (drag their folder to the sidebar)
use Sublime's file search across all the files
old projects' files are separated from the current project
no plugins to update/figure out
Only thing is that I'll have to keep a separate window open just for this, but it's not a big deal.

creating a new file in eclipse

Is it possible to create, a new file in eclipse without it being part of a project?
It's possible. If you create new file, select General and Untitled Text File.
For convenience, you can also create shortcut for that. I use Ctrl + N, Ctrl + N for that.
Doesn't look like it. This is a huge oversight by the Eclipse people :) What you can do is create a project in the New Project wizard, and then specify the same name as the folder (don't think it matters though). After that, you can create files in that directory using the project.
Another thing you can do is create an empty workspace project and then link to files outside of the workspace (New File Wizard > Advanced.. > Link to file in the file system).
Edit: as hollsk says, it's possible to drag the file in. In the newer versions of Eclipse, this will ask you if you want to make a link or a copy of the file, AFAIK. You can combine this with an empty project as mentioned.

Eclipse syntax highlighting preferences save and restore

I spend some time customizing the colors for syntax highlighting in Eclipse (Java, JSP, HTML, CSS, etc.) but whenever I try to export these settings via File|Export|General|Preferences and reimport them, the settings never completely get imported back. Some colors are restored and others are left unchanged, leaving me in an 'in between' state - very frustrating.
I'm using Eclipse 3.4 Ganymede, by the way.
Has anyone found a reliable way to save and restore Eclipse syntax highlighting settings?
I finally figured out how to do this.
I just wanted to mention beforehand that I did try to start with a fresh Eclipse install, export the preferences to a .epf file, change just one single setting, export again, and compare the files. To my surprise, trying to import settings from a minimal .epf file did not work reliably either.
The solution that worked for me was to copy these files: {Eclipse workspace directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings/*.prefs
I tried a fresh Eclipse install on another machine and after copying those files over, all my settings were restored perfectly.
The solution was to copy SOME - not all - of the files from {workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings/*.prefs into my other workspace.
In particular (per the https://stackoverflow.com/questions/96981/color-themes-for-eclipse thread):
org.eclipse.jdt.ui.prefs = Syntax Coloring
org.eclipse.ui.editors.prefs = Text Editors
Copying other files caused things to break.
There are a couple of notes to add:
I had to copy the aforementioned pair of files several times before I got the correct syntax coloring.
Be sure to close the workspace, if it's open in Eclipse, before copying the files.
This worked with Eclipse Helios.
If you want to be a little more fine grained on what you migrate, the syntax highlighting rules are the lines starting with semanticHighlighting on workspace-indigo/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs
Doing this, I was able to migrate my syntax highlighting from Helios to Indigo
I'm using JBoss Developer Studio 10 with the Eclipse Neon 4.6 engine.
All .prefs files are inside this path:
/workspace/.metadata/.plugins/org.eclipse.core.runtime/.sett‌​ings
Update: I found a similar structure on this path too:
\RedHat\JBossDev\studio\configuration\.settings
It's my IDE folder plus \configuration\.settings
I recommend search for org.eclipse.*ui*.prefs instead *.prefs to refine your result.
The principal config files are:
org.eclipse.jdt.ui.prefs
Java Syntax Color Settings
org.eclipse.ui.editors.prefs
Text Editor Settings
org.eclipse.cdt.ui.prefs
Formatter Settings
org.eclipse.wst.jsdt.ui.prefs
JavaScript Syntax Color Settings
org.eclipse.jst.jsp.ui.prefs
org.eclipse.wst.css.ui.prefs
org.eclipse.wst.html.ui.prefs
org.eclipse.wst.json.ui.prefs
org.eclipse.wst.dtd.ui.prefs
org.eclipse.wst.xml.ui.prefs
org.eclipse.wst.xsl.ui.prefs
If have a problematic workspace:
Copy the files above
Create a new workspace
Copy and Replace that files in your new workspace
This will recover perfectly your custom editors color settings. For me worked very well.
Eclipse CDT stores 'Syntax coloring' in the file org.eclipse.cdt.ui.prefs
This is located for example here: C:\eclipse\workspace.metadata.plugins\org.eclipse.core.runtime.settings\
Copy and paste over the top of the one in your new eclipse instance. This worked for me when moving from 3.4 to 3.5
I would export the preference before modifying the color, and then after.
That way, you would be able to isolate the specific rules of an eclipse preference file into one smaller file and:
check if some colors not restored are indeed represented by a rule
the import of a smaller preference has any effect on the previously unchanged settings.
That kind of strategy can be further refined into several small settings files (one for Java, one for JSP, HTML, CSS, ...), in order to better analyzing the potential side-effects when re-importing those settings.
I have had success in importing Eclipse Helios's syntax highlighting rules by copying the file:
.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs
from the source workspace to the target workspace. It seems this file also contains Eclipse's code formatter profiles and code templates.
Environment:
Version: Helios Release
Build id: 20100617-1415
(on linux)
Once Michael Bosworth's answer helped me to some extend and I voted up. But now I see some obligation to answer it myself, because copying these two files are not enough. Let me explain why.
First, these files contains lines irrevelente to syntax coloring.
Second, syntax coloring for other editors are located elsewhere, for example, those of XML files are in
org.eclipse.wst.xml.ui.prefs
and those of HTML files:
org.eclipse.wst.html.ui.prefs
JSP pages?
org.eclipse.jst.jsp.ui.prefs
, etc.
Third, when we change font colors, usually we change background colors, line highlighting colors, etc. to get a clearer view of codes. This involves more files.
If we search *.pref files in path
/workspace/.metadata/.plugins
we can find all preferences files where we can locate all lines of coloring settings. But by copy-pasting all these files to another workspace can also trigger problems, for they are not exclusively syntax-coloring-related. Moreover, when we are switching between two versions of Eclipse, unexpected problems may arise.
So, the safest way is:
Create a new workspace if you don't have one.
Open all *.pref files we find in the workspace one by one,
Copy those lines containing color codes,
Find the same file in your new workspace,
Replace the color part by existing one. Or, set the colors in Eclipse, by assuming the corresponding options according to properties' name. All color codes are RGB based.
EDIT: (2017.02.24)
Eclipse Mars has a plugin Oomph, which can record your preference settings to provide seamless transmission of your preferences. When you activate it, every time you change a value, it prompts to ask you if you want to record it in Oomph, providing you the exact line in the corresponding file where your new value is stored. So, when you install Oomph, you can:
Change the settings of your font face, font size, background color, etc.
In the prompt windows of Oomph, take note of the location of your new settings. (Because if you tell Oomph to remember your settings, it will not prompt never again, so you may only see this windows once.)
I have deleted recently changed *.prefs file from the following dreictory \myworkspace.metadata.plugins\org.eclipse.core.runtime.settings\ and imported existing exported preference.
I am the first person, who answer for this question as per my knowledge :), Cause even I struggled lot.
Thanks
I faced the same problem few days ago.
The easiest way to restore the defaults is to import the default theme again, which you can find under:
http://eclipsecolorthemes.org/?view=theme&id=790