Eclipse Monkey и редакторы Flex Builder

April 16, 2009 – 5:39 am

Работа с mxml и css редактором отличается от работы с обычным редактором который нам предоставляет Eclipse Monkey. Чтобы получить доступ к любому редактору я использую такой метод

loadBundle("com.adobe.flexbuilder.editors.common");
/**
 * @return current text editor or null
 * @see org.eclipse.ui.editors.text.TextEditor  
 */
this.getCurrentTextEditor = function()
{
	var editor = window.getActivePage().getActiveEditor();
	if (editor)
	{ 
		if (editor.getClass().getName() == "com.adobe.flexbuilder.editors.mxml.MXMLEditor"
			|| editor.getClass().getName() == "com.adobe.flexbuilder.editors.css.CSSEditor")
		{
			editor = editor.getCodeEditor();
		}
		/*
		//TODO add others editors that 
		else if (){}
 
		*/
	}
	return editor;
}

Данный метод отдает ссылку на инстанс класса наследованого от org.eclipse.ui.editors.text.TextEditor, вернее даже на инстанс, который реализует
org.eclipse.ui.editors.ITextEditor

дальше работаем обычными для эклипса методами:

this.TextSelection = Packages.org.eclipse.jface.text.TextSelection;
 
this.insertToCursor = function(editor, text, moveCursor)
{
	if (editor)
	{
		var documentProvider = editor.getDocumentProvider();
		var doc = documentProvider.getDocument(editor.getEditorInput());
		var offset = editor.getSelectionProvider().getSelection().getOffset();
 
		doc.replace(offset, 0,  text);
 
		if (moveCursor)
		{
			var selection = new TextSelection(doc, offset+text.length, 0);
			editor.getSelectionProvider().setSelection(selection);	
		}
	}
}

Метод вставляет текст в позицию курсора и если выставлен флаг, перемещает курсор в конец вставленного текста.


Вышел Silverlight 3 Beta

March 19, 2009 – 6:16 am

Потихоньку, между делом, вышел Silverlight 3 Beta. Список появившихся фич просто впечатляет. Краткий перечень.

  • Support for Higher Quality Video & Audio. New and enhanced media features in Silverlight 3 include:
    • Live and on-demand true HD (720p+) Smooth Streaming.
    • More format choice.
    • True HD playback in full-screen.
    • Extensible media format support.
    • Industry leading content protection.
  • Empowering Richer Experiences.  Additional features include:
    • Perspective 3D Graphics.
    • Pixel Shader effects.
    • Bitmap Caching.
    • New Bitmap API.
    • Themed application support.
    • Animation Effects. .
    • Enhanced control skinning.
    • Improved text rendering & font support.
  • Improving Rich Internet Application Productivity. New features include:
    • 60+ controls with source code
    • Deep Linking.
    • Search Engine Optimization (SEO).
    • Enhanced Data Support Silverlight 3 delivers:
      • Element to Element binding
      • Data Forms.
      • New features for data validation
      • Support for business objects.
    • Improved performance, through:
      • Application library caching.
      • Enhanced Deep Zoom.
      • Binary XML .
      • Local Connection .
  • Advanced Accessibility Features. .
    • Life outside the browser.
    • Desktop shortcuts and start menu support.
    • Safe and secure..
    • Smooth installation. .
    • Auto-update. .
    • Internet connectivity detection. .
  • Out of Browser Capabilities.

Также обновился Expression Blend 3:

New Features in Expression Blend 3: The designer-developer workflow took another major step forward today with major innovations in Expression Blend 3 including: SketchFlow, a rapid prototyping capability that makes it easy to communicate design intent to stakeholders; design time sample data that enables the design and testing of applications without access to live data; direct import of Adobe Photoshop and Illustrator files; behaviors, extensible and reusable components that add interactivity to applications without writing code; a full code editor supporting C#, VB and XAML; and many more features that support an improved design and development experience. Features include:

  • SketchFlow. SketchFlow introduces a new set of features designed to make it easier for you to experiment with dynamic user experiences and create compelling prototypes. SketchFlow also helps communicate design ideas to other stakeholders, and makes it easier to collect in-context annotated feedback. SketchFlow enables the navigation and composition of an application to be modeled in a very visual manner from a simple prototype that uses a series of sketches, to something much more evolved. A prototype can be made as real and interactive as it needs to be to communicate design intent and SketchFlow can leverage all the existing features of Expression Blend.
  • Adobe Photoshop and Illustrator import. The powerful importers for both Adobe Photoshop and Adobe Illustrator enable smooth integration with workflows the designer already has in place. The designer has freedom to view and import Photoshop files layer by layer. Layers can be easily regrouped and elements retain their original formats; layers, layer positions, editable text and vectors remain available for editing within Expression Blend.
  • Behaviors. Add interactivity to your application, without having to write code. Behaviors can encapsulate complex design interactions into reusable components which can be directly applied to a user interface element in the application. Developers have access to a rich API that they can use to write their own triggers, actions, and behaviors for use in their Silverlight and WPF projects.
  • Sample data. Design time sample data makes it easy to build data-connected applications without access to live data. You can generate sample data or import sample data from an XML file and is available to controls on the artboard at design-time. You can extensively customize your sample data details, and you can easily switch between using sample data and using live data at run-time.
  • Improved design and development experience. Expression Blend 3 includes many features that improve the overall design experience including a brand new design surface making Blend more accessible to visual designers. Team Foundation Server support allows easier integration of the Blend user into Team System. Improved animation and easing functions, 3D transforms, visual effects and an improved visual state manager enable a great tooling experience.

Я это все к чему, ребята из макрософт очень постарались и если они будут двигаться такими темпами то Flex потеряет свою популярность и мы останемся без штанов :). Придет армия дотнетчиков и захватит мир. И придется переквалифицироваться обратно во флешеров или учить Silverlight. Лично я не сильно хочу иметь дело с продуктами MS, но кто знает.


Закрываем И запускаем AIR-debugger с помощью Eclipse Monkey

February 23, 2009 – 3:06 pm

Про апгрейченый скрипт запуска AIR дебагера:

 
/*
 * Menu: Kill adl an run debug
 * Key: M3+d
 * Kudos: Ilja Panin http://the33cows.com
 * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
 */
 
var workspace = Packages.org.eclipse.core.resources.ResourcesPlugin.getWorkspace(); 
var configToRunName = "[YOU_DEBUG_CONFIGURATION_NAME]";
 
function main() 
{
	Packages.java.lang.Runtime.getRuntime().exec("tskill.exe adl");
 
	loadBundle("org.eclipse.debug.ui");
 
	var ProgressMonitorDialog = Packages.org.eclipse.jface.dialogs.ProgressMonitorDialog;
	var IRunnableWithProgress = Packages.org.eclipse.jface.operation.IRunnableWithProgress;
 
	var runnableWithProgress = new IRunnableWithProgress({run: runfun});
	var monitorDialog = new ProgressMonitorDialog(window.getShell()).run(true, true, runnableWithProgress);;
}
 
 
function runfun(monitorDialog)
{
	monitorDialog.beginTask("Run debbuger ...", 1);
	var plugin =  Packages.org.eclipse.debug.core.DebugPlugin;
	var launchManager = plugin.getDefault().getLaunchManager();
	configurations = launchManager.getLaunchConfigurations();
 
	var conf;
 
	for (var i in configurations)
	{
		if (configurations[i].getName() == configToRunName )
		{
			conf = configurations[i];
		}	
	}
 
	if (conf)
	{
		var launch = Packages.org.eclipse.debug.ui.DebugUITools.buildAndLaunch(conf, "debug", monitorDialog);
	}
	else
	{
		debug("project not found!");
	}
 
	monitorDialog.done()
}
 
function debug(s) 
{
  	out.println(s);
}

Правила применения:
1.заменяем строку [YOU_DEBUG_CONFIGURATION_NAME] на имя конфигурации запуска приложения. Это имя можно найти в меню “Run -> Open Debug Dialog…”
2. заменяем сочетание M3+d на свое (M3 это alt). Для меня alt+d ближе чем F11 🙂

При выполнении скрипт, убивается процесс AIR дебагера и запускает процесс сборки и новый дебагер.


Закрываем AIR-debugger с помощью Eclipse Monkey

February 22, 2009 – 2:21 pm

Flex Builder не умеет закрывать дебагер AIR приложений.

Лично я все время забываю закрывать приложение и каждый раз при запуске получаю сообщение об ошибке. После чего приходится “искать” приложение и закрывать его. Отнимает время и иногда нервирует.

Чтобы облегчить себе работу в закрытии приложения я написал небольшой Eclipse Monkey script:


/*
 * Menu: kill adl
 * Key: M3+d
 * Kudos: Ilja Panin http://the33cows.com
 * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
 */

function main()
{
	Packages.java.lang.Runtime.getRuntime().exec("tskill.exe adl");
}

он убивает запущенный процесс adl.exe(отладчик AIR) легким движением руки ) и экономит время.

В идеале я хотел написать скрипт, который слушает событие эклипса о запуске дебагера, и автоматом дебагер, но не нашел как “достучатся” до дебагера.

upd: чтобы запустить скрипт нужно создать в папке со скриптами(по умолчанию проект monkey папка scripts) js файл, например kill-adl.js в него вставить код. Запускаеться скрипт нажатием alt+d или выбором пункта из меню


Код форматер для Flex Builder

February 2, 2009 – 12:39 pm

Ура!

свершилось чудо, появился бесплатный кодоформатер для as3|mxml в Flex Builder

http://www.riaspace.net/2009/01/ctrlshiftf-for-flex-builder/

В отличаи от ранее предлагаемого в поставке InterpriseIDE имеет настройки форматирования и работает лучше (ну или мне так показалось).

Спасибо Косте за ссылку



]]> rss о RIA от 33 Коровы
Забадать RSS!
]]>
~~~~~~