PDT Eclipse 在保存时自动上传

发布于 2024-07-14 15:33:55 字数 437 浏览 10 评论 0原文

我正在从 Dreamweaver 强制工作环境迁移到自由选择的工作环境。 尽管如此,我必须说我对使用 Dreamweaver PDT 非常感兴趣。 然而,我已经非常依赖“保存时自动上传”功能的使用。

我正在开发 LAMP,但面向 Windows 基础大多数,所以我确实必须运行 Windows 本机并针对 IE 进行大量测试,所有项目都可以在 FF 和 Safari 上顺利运行,IE 确实是瓶颈。 另一方面,我喜欢让我的项目由服务器的克隆提供服务,因此我在 Windows 上有一个运行 Linux 的虚拟机作为我的开发服务器。

正如您所知,保存时的自动更新非常有用。

我已经挖掘了一些文档,并且还用 Google 搜索了很多,但没有找到任何东西(除了 Aptana 之外)来满足我的需求。 我看错了方向,或者 Eclipse 真的没有类似的东西吗?

先感谢您!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

你在看孤独的风景 2024-07-21 15:33:55

经过几个月使用不同的设置后,我开始使用一种非常适合我的需求的组合,尽管我应该分享。

Eclipse 将 Aptana 作为插件运行。

Eclipse 的所有强大功能和 Dreamweaver 的所有可用性以及一些不错的 Aptana 好东西。 也就是说,将 Aptana 安装为插件后,只需在 /scripts 目录下创建一个新文件(或将该文件放入您永远不会关闭的项目中)并在其中添加以下代码:

/* 
 * 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) {}

因此,如果您正在处理的项目有每次保存时都会激活同步连接,您会将文件上传到服务器。

希望它能为您节省一些时间!

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!

攒眉千度 2024-07-21 15:33:55

这些解决方案都不适合我使用 PHP 文件。 第一个解决方案适用于除 PHP 之外的所有其他文件类型,而第二个解决方案似乎对我没有任何作用。 我正在使用 Eclipse Helios 3.6.1 和 Aptana Studio 2 - 为什么 Aptana Studio 不支持宇宙中最常见的服务器端脚本文件类型,这就像大白鲨上的山雀一样有意义。

对于那些在互联网上广泛搜索但没有找到解决这个恼人问题的 PHP 开发人员来说,我有我认为是下一个最好的东西。

安装这些密钥

该键盘映射集是 Eclipse Helios 3.6.1 附带的默认键盘映射,并添加了上传快捷方式。

这与文件视图窗口一起用作主要文件列表查看器。 首先,确保您已启用“与编辑器链接”(文件视图窗口顶部的图标,有两个金色水平箭头)。 现在,当您编辑任何文件类型的文件(上下文:在结构化文本编辑器中编辑)并且想要保存和保存时, 上传当前文件,可以使用以下按键:

CTRL+S(保存文件)

CTRL+SHIFT+U(将切换到文件视图窗口,并且由于您启用了“与编辑器链接”,因此当前文件将已突出显示)

CTRL+SHIFT+U(将上传文件)

阅读这些说明可能看起来很麻烦,但实际过程非常简单,您可以闭着眼睛完成大约 5 分钟后,甚至没有思考。

我选择了 CTRL+SHIFT+U 因为这是我在 Dreamweaver 中用来将文件“放入”远程服务器的关键命令。 显然你可以设置你喜欢的任何键。

无论如何,请珍惜它的价值。 这比每次要上传 PHP 文件时使用鼠标在上下文菜单中导航要好得多。

单词。
杰伊

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

看海 2024-07-21 15:33:55

您可以通过 Windows 资源管理器创建 ftp 连接,也可以将 ftp 位置安装为驱动器,然后像平常一样通过 eclipse 访问它。 这就是我在过去的工作中做得足够好的。

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.

深海夜未眠 2024-07-21 15:33:55

Eclipse(至少是 Helios)中有一些东西可以做到这一点。 它称为远程服务器资源管理器(RSE)。 您可能需要使用“安装新软件”=>来安装运行时包 通用工具。

然后,您应该能够创建一个新项目(常规),但您可以自定义位置并选择 RSE 文件系统,而不是保留默认位置。 定义一个新的连接或使用现有的连接到您的 ftp 服务器。

这不适用于 PHP 项目类型 (Eclipse PDT),因为由于某种原因,您无法选择其他文件系统。 在这些项目中,您可以采用类似的方法,将每个文件定义在远程服务器上(新建 => 常规 => 文件),然后使用“链接到文件系统中的文件”设置。 但这是皮塔饼; 您需要浏览到添加的每个文件的位置。

我花了几个小时寻找合适的替代品。 我发现 aptana 插件有点问题。 当然,您可以使用脚本等等……我想大多数 Eclipse 开发人员并不真正需要此功能。

我最终决定使用 Netbeans。 它很不错、免费、轻量级,并且具有 PHP 开发和调试的一切功能。 顺便说一句,其他语言也有,但我没有尝试过。 它阻止了我浪费时间。

干杯

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

所有深爱都是秘密 2024-07-21 15:33:55

这与 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();
}

它更干净,并且适用于所有文件类型(包括 php)。 我将其安装在当前项目的脚本目录中。 我在某个地方读到,您可以创建项目,例如“Nice Scripts”,您可以在其中保存您想要在所有项目中使用的所有脚本。 并且比在其他项目中引用该项目,没有尝试过,但也许有人会需要它。

而且我发现这非常有用:docs.aptana.com/docs/index.php/Assigning_a_keyboard_shortcut_to_a_snippet

请注意,M1 是控制/命令,M2 是
Shift,M3 是 Alt/Option

随意将其应用到包含“Key:M1+M2+S”的注释的第一行,我将其更改为 M1+R,因为它不与任何现有快捷键冲突。

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.

假面具 2024-07-21 15:33:55

我使用 FileSync 它是一个椭圆插件。 在 zend studio 9 中它已经安装了,你只需要启用它。

启用它后,

右键单击项目 --> 属性--> 文件同步

然后只需添加项目文件夹即可。 默认目标路径找到您的目标文件夹

(我的目标文件夹是我的开发服务器,我只是将其映射到我的本地驱动器)

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)

笙痞 2024-07-21 15:33:55

正如我在这个问题中的回答:

这是我的建议,这不是快速的方法,但非常有效
可定制。 在 Eclipse 中你可以设置外部工具。这意味着,你
可以将 php/java 脚本文件设置为外部程序并发送一些
eclipse 给你的参数(${resource_loc} ${project_name}
${资源路径})。 因此,使用脚本文件您可以登录 SSH 或 FTP
或者您想要的任何内容并与远程同步您的文件或项目
系统。 只需在 eclipse 中的外部工具配置窗口中即可
必须将位置设置为 /usr/bin/php 并且在参数中,您可以设置脚本
以 Eclipse 变量作为脚本参数的路径。 最后你应该
如果可能的话,为外部程序分配一些快捷键。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文