| author | Marc Aubry | 2012-07-13 06:19:22 (EDT) |
|---|---|---|
| committer | sbernard | 2012-07-13 06:25:03 (EDT) |
| commit | cb5e3385081c303815d672f6075d685fb202e045 (patch) (side-by-side diff) | |
| tree | f069239bc8a77e155e02677217ec95ab794a102c | |
| parent | a4b892dd3d655d6327e98adcb3bfd89e5948fe92 (diff) | |
| download | org.eclipse.koneki.ldt-cb5e3385081c303815d672f6075d685fb202e045.zip org.eclipse.koneki.ldt-cb5e3385081c303815d672f6075d685fb202e045.tar.gz org.eclipse.koneki.ldt-cb5e3385081c303815d672f6075d685fb202e045.tar.bz2 | |
Bug 371535 - [wizards] New Lua project wizard should open main.lua when
one is generated
| -rw-r--r-- | plugins/org.eclipse.koneki.ldt.ui/src/org/eclipse/koneki/ldt/ui/wizards/LuaProjectWizard.java | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/plugins/org.eclipse.koneki.ldt.ui/src/org/eclipse/koneki/ldt/ui/wizards/LuaProjectWizard.java b/plugins/org.eclipse.koneki.ldt.ui/src/org/eclipse/koneki/ldt/ui/wizards/LuaProjectWizard.java index 328d012..9bc143f 100644 --- a/plugins/org.eclipse.koneki.ldt.ui/src/org/eclipse/koneki/ldt/ui/wizards/LuaProjectWizard.java +++ b/plugins/org.eclipse.koneki.ldt.ui/src/org/eclipse/koneki/ldt/ui/wizards/LuaProjectWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Sierra Wireless and others. + * Copyright (c) 2012 Sierra Wireless and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,18 +10,27 @@ *******************************************************************************/ package org.eclipse.koneki.ldt.ui.wizards; +import java.text.MessageFormat; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; import org.eclipse.dltk.core.IBuildpathEntry; import org.eclipse.dltk.ui.wizards.GenericDLTKProjectWizard; import org.eclipse.dltk.ui.wizards.ProjectCreator; import org.eclipse.dltk.ui.wizards.ProjectWizardSecondPage; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.koneki.ldt.core.LuaConstants; import org.eclipse.koneki.ldt.core.LuaNature; import org.eclipse.koneki.ldt.ui.internal.Activator; import org.eclipse.koneki.ldt.ui.internal.ImageConstants; import org.eclipse.koneki.ldt.ui.wizards.pages.LuaProjectSettingsPage; import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; /** * A wizard tailored only for available functionalities. @@ -81,4 +90,25 @@ public class LuaProjectWizard extends GenericDLTKProjectWizard { super.init(workbench, currentSelection); setDefaultPageImageDescriptor(Activator.getDefault().getImageRegistry().getDescriptor(ImageConstants.LUA_WIZARD_BAN)); } + + /** + * @see org.eclipse.dltk.ui.wizards.ProjectWizard#performFinish() + */ + @Override + public boolean performFinish() { + boolean superResult = super.performFinish(); + + // Open main file of the created project in a editor + IPath mainFilePath = new Path(LuaConstants.SOURCE_FOLDER).append(LuaConstants.DEFAULT_MAIN_FILE); + IFile mainFile = getProject().getFile(mainFilePath); + if (mainFile.exists()) { + try { + IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), mainFile, true); + } catch (PartInitException e) { + final String message = MessageFormat.format("Unable to open lua editor for %s", mainFile.getFullPath()); //$NON-NLS-1$ + Activator.logError(message, e); + } + } + return superResult; + } } |

