可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I am migrating from a Dreamweaver forced working environment to a free-of-choice one. That said I must say I was rather enthusiastic about being able to use Dreamweaver PDT. However I have come to rely very heavily on the use of the "auto upload on save" function.
I am developing LAMP but oriented to a Windows base majority so I really must run Windows native and test heavy for IE, all projects work smooth on FF and Safari, IE's really the bottleneck. On the other hand I like to have my project served by a clone of the server so I have a Virtual machine on windows running Linux that works as my Dev Server.
As you can tell the auto-update on save works like a charm.
I've dug up some of the documentation and I've also Google quite a bit and found nothing (besides Aptana) to suit my needs. I am looking in the wrong direction or isn't there really something like this for Eclipse?
Thank you in advance!
回答1:
You can either create the ftp connection through windows explorer or mount the ftp location as a drive and then just access it through eclipse as you normally would. That's what I've done in the past work well enough.
回答2:
After some months of using different set ups I've come to use a combination that's perfect for my needs and though I should share.
Eclipse running Aptana as plug-in.
All the power of Eclipse and all the usability of Dreamweaver plus some nice Aptana goodies. That said, after installing Aptana as a plug-in just create a new file under the /scripts directory (or put that file into a project you'll never close) and the following code inside:
/*
* Menu: gMan > Upload On Save
* Kudos: Ingo Muschenetz
* License: EPL 1.0
* Listener: commandService().addExecutionListener(this);
* DOM: http://localhost/com.aptana.ide.syncing.doms
* DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
*/
function commandService()
{
var commandServiceClass = Packages.org.eclipse.ui.commands.ICommandService;
var commandService = Packages.org.eclipse.ui.PlatformUI.getWorkbench().getAdapter(commandServiceClass);
return commandService;
}
function preExecute(commandId, event) {}
function postExecuteSuccess(commandId, returnValue)
{
if (commandId == "org.eclipse.ui.file.save")
{
sync.uploadCurrentEditor();
}
}
function notHandled(commandId, exception) {}
function postExecuteFailure(commandId, exception) {}
So, if the project your working on has a syncronize connection active on each and every save you'll have the file uploaded to the server.
Hope it saves you some time!
回答3:
Neither of these solutions work with PHP files for me. The first solution works great for every other file-type EXCEPT PHP, and the second one doesn't seem to do anything for me. I am using Eclipse Helios 3.6.1 with Aptana Studio 2 - Why on earth the most common server-side scripting file-type in the universe is not supported by Aptana Studio makes about as much sense as tits on a great white shark.
For those of you PHP devs out there who have searched the internet far and wide with no luck finding a solution to this annoying issue, I have what I consider to be the next best thing.
Install these keys.
This keymap set is the default keymap that comes with Eclipse Helios 3.6.1 with the addition of an upload shortcut.
This works with the File view window as your main file-list viewer. First, make sure you have enabled "Link with Editor" (the icon at the top of the File view window that has two gold horizontal arrows). Now when your editing a file of any file-type (context: Editing in Structured Text Editors) and you want to save & upload the current file, you can use the following key strokes:
CTRL+S (saves the file)
CTRL+SHIFT+U (will switch to the File view window, and since you have "Link with Editor" enabled, your current file will already be highlighted)
CTRL+SHIFT+U (will upload the file)
It may seem like a pain in the ass to read these instructions but the actual process is super simple and you can do it with your eyes closed and without even thinking after about 5 minutes.
I chose CTRL+SHIFT+U because that was the key command I usedto use in Dreamweaver to "Put" a file onto a remote server. Obviously you can set whatever keys you like.
Anyways, take it for what it's worth. It's a shitload better than using a mouse to navigate through context menus every time you want to upload your PHP files.
Word.
Jay
回答4:
There is something in Eclipse (at least Helios) for that. It's called Remote Server Explorer(RSE). You may need to install the run-time package using 'Install New Software' => General Purpose Tools.
You should then be able to create a new project (General), but instead of leaving the default location, you can customize the location and select the RSE file system. Define a new connection or use an existing one to your (s)ftp server.
This does not work with the PHP Project type (Eclipse PDT), because for some reason, you don't get the option to choose another file system. In these projects, you can do a similar approach, defining each file to be on a remote server (New => General => File) and then use 'link to file in the file system' setting. But it's a pita; you need to browse to the location for each file you add.
I've looked for hours for decent alternatives. The aptana plugin is a little buggy I found. Sure you can use scripts and all ... I guess most Eclipse devs don't really need this feature.
I finally decided to use Netbeans. It's decent, free, lightweight and it has about everything for PHP developing and debugging. Other languages too by the way, but I did not try them. It stopped me from losing time.
cheers
回答5:
This works perfectly with Aptana 2.0:
http://juergen-schwind.de/Save-and-Upload-Current-File-fuer-Aptana-Studio-1-5_9.html
/*
* Key: M1+M2+S
* Menu: Synchronize > Save and Upload Current File
* Kudos: Juergen Schwind
* License: EPL 1.0
* DOM: http://localhost/com.aptana.ide.syncing.doms
* DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
*/
function main(){
editors.activeEditor.save();
sync.uploadCurrentEditor();
}
It is much cleaner, and is functioning with all file types(including php). I installed it in scripts directory of current project. Somewhere I read that you could make project e.g. “Nice Scripts” where you could save all your scripts that you want to work in all projects. And than reference that project in other projects, did not tried it but maybe someone will need it.
And also I find this very useful: docs.aptana.com/docs/index.php/Assigning_a_keyboard_shortcut_to_a_snippet
Note that M1 is Control/Command, M2 is
Shift, and M3 is Alt/Option
Apply it at will to first line in comment that contains "Key: M1+M2+S", I changed it to M1+R since it does not conflict with any existing shortcut.
回答6:
I use FileSync its an ellipse plugin. In zend studio 9 its already installed you just need to enable it.
Once you have enable it do the following
right-click on project --> Properties --> File synchronization
then just add the project folder. and the default target path locate your target folder
(my target folder is my dev server i just map it to my local drive)
回答7:
As my answer in THIS question :
This is my suggestion and it is not quick way to do this, but very
customizable. In eclipse you can set external tools.That means, you
can set a php/java script file as external program and send some
params that eclipse gives you(${resource_loc} ${project_name}
${resource_path}). So with script file you can login to SSH or FTP
or what ever you want and sync your file or project with remote
system. Just in External Tools Configuration window in eclipse you
must set Location to /usr/bin/php and in Arguments, you can set script
path with eclipse variables as script args. At last you should
assign some short key to external program IF Possible.