### Eclipse Workspace Patch 1.0 #P org.eclipse.mtj.ui Index: plugin.xml =================================================================== --- plugin.xml (revision 289) +++ plugin.xml (working copy) @@ -14,7 +14,7 @@ category="mtj.category" class="org.eclipse.mtj.ui.internal.wizards.NewJ2MEProjectWizard" project="true" - finalPerspective="org.eclipse.jdt.ui.JavaPerspective" + finalPerspective="org.eclipse.mtj.ui.MtjPerspective" id="org.eclipse.mtj.ui.wizards.NewJ2MEProjectWizard"> %wizard.newJ2MEProject.description @@ -436,4 +436,16 @@ label="MTJ Build Console"> + + + + %mtj.perspective.description + + + Index: plugin.properties =================================================================== --- plugin.properties (revision 289) +++ plugin.properties (working copy) @@ -63,7 +63,11 @@ importWizards.EclipseMEProject.label=Import EclipseME Project importWizards.EclipseMEProject.description=Select a directory to search for existing EclipseME projects. - +# +#Perspective +# +mtjPerspectiveName=Mobile Tools for Java +mtj.perspective.description=MTJ perspective is designed to support Java ME development. # # Miscellaneous # Index: src/org/eclipse/mtj/ui/MtjPerspectiveFactory.java =================================================================== --- src/org/eclipse/mtj/ui/MtjPerspectiveFactory.java (revision 0) +++ src/org/eclipse/mtj/ui/MtjPerspectiveFactory.java (revision 0) @@ -0,0 +1,109 @@ +/******************************************************************************* + * Copyright (c) 2008 Sybase Inc. 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Feng Wang (Sybase) - initial implementation + *******************************************************************************/ +package org.eclipse.mtj.ui; + +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jdt.ui.JavaUI; +import org.eclipse.ui.IFolderLayout; +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; +import org.eclipse.ui.console.IConsoleConstants; +import org.eclipse.ui.progress.IProgressConstants; + +public class MtjPerspectiveFactory implements IPerspectiveFactory { + + private IPageLayout layout; + + public void createInitialLayout(IPageLayout layout) { + this.layout = layout; + addViews(); + addActionSets(); + addNewWizardShortcuts(); + addPerspectiveShortcuts(); + addViewShortcuts(); + } + + private void addPerspectiveShortcuts() { + layout.addPerspectiveShortcut(JavaUI.ID_PERSPECTIVE); + layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE); + } + + private void addViews() { + // Add Package Explorer, Navigator and Hierarchy views to left + IFolderLayout topLeft = layout.createFolder("topLeft", //$NON-NLS-1$ + IPageLayout.LEFT, 0.25f, layout.getEditorArea()); + topLeft.addView(JavaUI.ID_PACKAGES); + topLeft.addView(IPageLayout.ID_RES_NAV); + topLeft.addView(JavaUI.ID_TYPE_HIERARCHY); + // Add Problems, Javadoc and Tasks views to bottom + IFolderLayout bottom = layout.createFolder("bottomRight", //$NON-NLS-1$ + IPageLayout.BOTTOM, 0.75f, layout.getEditorArea()); + bottom.addView(IPageLayout.ID_PROBLEM_VIEW); + bottom.addView(JavaUI.ID_JAVADOC_VIEW); + bottom.addView(IPageLayout.ID_TASK_LIST); + // Add Outline view to right + layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, 0.75f, layout + .getEditorArea()); + } + + private void addActionSets() { + layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET); + layout.addActionSet(JavaUI.ID_ACTION_SET); + layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET); + layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); + } + + private void addNewWizardShortcuts() { + layout + .addNewWizardShortcut("org.eclipse.mtj.ui.wizards.NewJ2MEProjectWizard"); //$NON-NLS-1$ + layout + .addNewWizardShortcut("org.eclipse.mtj.ui.wizards.NewMidletWizard"); //$NON-NLS-1$ + + layout + .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$ + layout + .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$ + layout + .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$ + layout + .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$ + layout + .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$ + layout + .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard"); //$NON-NLS-1$ + layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$ + layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$ + layout + .addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$ + } + + private void addViewShortcuts() { + // views - error log + layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$ + + // views - java + layout.addShowViewShortcut(JavaUI.ID_PACKAGES); + layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY); + layout.addShowViewShortcut(JavaUI.ID_SOURCE_VIEW); + layout.addShowViewShortcut(JavaUI.ID_JAVADOC_VIEW); + + // views - debugging + layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW); + + // views - standard workbench + layout.addShowViewShortcut(IPageLayout.ID_OUTLINE); + layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); + layout.addShowViewShortcut(IPageLayout.ID_RES_NAV); + layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST); + layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID); + } +} Index: src/org/eclipse/mtj/ui/internal/wizards/NewJ2MEProjectWizard.java =================================================================== --- src/org/eclipse/mtj/ui/internal/wizards/NewJ2MEProjectWizard.java (revision 289) +++ src/org/eclipse/mtj/ui/internal/wizards/NewJ2MEProjectWizard.java (working copy) @@ -14,6 +14,8 @@ * getProjectCreationRunnable method * Hugo Raniere (Motorola) - Removing Preprocessor code * Hugo Raniere (Motorola) - Wizard handle the classpath correctly according to device changes + * Feng Wang (Sybase) - Promoting a dialog to ask user switch to MTJ perspective + * after user click finish button */ package org.eclipse.mtj.ui.internal.wizards; @@ -23,6 +25,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExecutableExtension; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -54,7 +57,8 @@ * * @author Craig Setera */ -public class NewJ2MEProjectWizard extends Wizard implements INewWizard { +public class NewJ2MEProjectWizard extends Wizard implements INewWizard, + IExecutableExtension { // Instance variables private IConfigurationElement configElement; @@ -106,17 +110,6 @@ } /** - * - * @param monitor - * @throws InterruptedException - * @throws CoreException - */ - protected void finishPage(IProgressMonitor monitor) - throws InterruptedException, CoreException { - BasicNewProjectResourceWizard.updatePerspective(configElement); - } - - /** * @see IWizard#performCancel() */ public boolean performCancel() { @@ -223,7 +216,8 @@ } catch (InterruptedException e) { completed = false; } - + // Promoting a dialog to ask user switch to MTJ perspective + BasicNewProjectResourceWizard.updatePerspective(configElement); return completed; } @@ -309,4 +303,13 @@ projectDevice = device; needsClasspathUpdate = true; } + + /* + * Stores the configuration element for the wizard. The config element will + * be used in performFinish to set the result perspective. + */ + public void setInitializationData(IConfigurationElement cfig, + String propertyName, Object data) { + this.configElement = cfig; + } }