# HG changeset patch # User Eugene Ostroukhov # Date 1276736167 25200 # Node ID 9bf326e3aeb94cea2d884b995cc03cc7c1f82cd8 # Parent efc34c5e085ba96ceb345fe68b3b14ef387a6eef Bug 3018 - After adding a snippet the focus should be changed to the edit view diff -r efc34c5e085b -r 9bf326e3aeb9 org.symbian.tools.wrttools/META-INF/MANIFEST.MF --- a/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Wed Jun 16 17:23:29 2010 -0700 +++ b/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Wed Jun 16 17:56:07 2010 -0700 @@ -27,7 +27,8 @@ org.eclipse.wst.xml.ui;bundle-version="1.1.2", org.eclipse.ltk.core.refactoring, org.eclipse.ui.editors, - org.eclipse.wst.common.snippets + org.eclipse.wst.common.snippets, + org.eclipse.jface.text;bundle-version="3.6.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5, JavaSE-1.6 Bundle-ActivationPolicy: lazy diff -r efc34c5e085b -r 9bf326e3aeb9 org.symbian.tools.wrttools/plugin.xml --- a/org.symbian.tools.wrttools/plugin.xml Wed Jun 16 17:23:29 2010 -0700 +++ b/org.symbian.tools.wrttools/plugin.xml Wed Jun 16 17:56:07 2010 -0700 @@ -889,6 +889,7 @@ smallicon="icons/main16.gif" contenttypes="org.eclipse.wst.jsdt.core.jsSource"> @@ -917,6 +918,7 @@ @@ -933,6 +935,7 @@ @@ -962,6 +965,7 @@ @@ -994,6 +998,7 @@ } @@ -1026,6 +1031,7 @@ label="PhoneGap" smallicon="icons/phonegap.png"> @@ -1042,6 +1048,7 @@ @@ -1061,6 +1068,7 @@ @@ -1080,6 +1088,7 @@ diff -r efc34c5e085b -r 9bf326e3aeb9 org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/SnippetInsertion.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/SnippetInsertion.java Wed Jun 16 17:56:07 2010 -0700 @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Symbian Foundation - initial contribution. + * Contributors: + * Description: + * Overview: + * Details: + * Platforms/Drives/Compatibility: + * Assumptions/Requirement/Pre-requisites: + * Failures and causes: + */ +package org.symbian.tools.wrttools.util; + +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITextSelection; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.wst.common.snippets.ui.DefaultSnippetInsertion; + +public class SnippetInsertion extends DefaultSnippetInsertion { + + @Override + protected void doInsert(final IEditorPart editorPart, ITextEditor textEditor, IDocument document, + ITextSelection textSelection) throws BadLocationException { + super.doInsert(editorPart, textEditor, document, textSelection); + editorPart.getSite().getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + editorPart.setFocus(); + } + }); + } +}