Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 398068 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.rap.tools.templates/plugin.properties (-10 lines)
Lines 22-37 helloRAP.description = \ Link Here
22
<li>org.eclipse.ui.perspectives</li>\
22
<li>org.eclipse.ui.perspectives</li>\
23
<p>This code will need the <b>RAP target</b> to compile.</p>
23
<p>This code will need the <b>RAP target</b> to compile.</p>
24
24
25
viewRAP.name = RAP Application with a view
26
viewRAP.description = \
27
<p>This wizard creates a RAP application that consists of an application window with a single view.</p>\
28
<p><b>Extensions Used</b></p>\
29
<li>org.eclipse.core.runtime.applications</li>\
30
<li>org.eclipse.ui.perspectives</li>\
31
<li>org.eclipse.ui.views</li>\
32
<li>org.eclipse.rap.ui.branding</li>\
33
<p>This code will need the <b>RAP target</b> to compile.</p>
34
35
mailRAP.name = RAP Mail Template
25
mailRAP.name = RAP Mail Template
36
mailRAP.description = \
26
mailRAP.description = \
37
<p>This wizard creates a RAP application that shows how to:</p>\
27
<p>This wizard creates a RAP application that shows how to:</p>\
(-)a/bundles/org.eclipse.rap.tools.templates/plugin.xml (-12 lines)
Lines 17-34 Link Here
17
         </description>
17
         </description>
18
      </wizard>
18
      </wizard>
19
      <wizard
19
      <wizard
20
            class="org.eclipse.rap.internal.ui.templates.rap.ViewRAPWizard"
21
            icon="$nl$/icons/etool16/newexprj_wiz.gif"
22
            id="org.eclipse.rap.internal.ui.templates.rap.ViewRAPWizard"
23
            java="true"
24
            rcp="false"
25
            name="%viewRAP.name"
26
            ui-content="true">
27
         <description>
28
            %viewRAP.description
29
         </description>
30
      </wizard>
31
      <wizard
32
            class="org.eclipse.rap.internal.ui.templates.rap.MailRAPWizard"
20
            class="org.eclipse.rap.internal.ui.templates.rap.MailRAPWizard"
33
            icon="$nl$/icons/etool16/newexprj_wiz.gif"
21
            icon="$nl$/icons/etool16/newexprj_wiz.gif"
34
            id="org.eclipse.rap.internal.ui.templates.rap.MailRAPWizard"
22
            id="org.eclipse.rap.internal.ui.templates.rap.MailRAPWizard"
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/Messages.java (-10 lines)
Lines 43-58 public class Messages extends NLS { Link Here
43
  public static String mailRAPTemplate_windowTitle;
43
  public static String mailRAPTemplate_windowTitle;
44
  public static String mailRAPWizard_windowTitle;
44
  public static String mailRAPWizard_windowTitle;
45
45
46
  public static String viewRAPTemplate_appClass;
47
  public static String viewRAPTemplate_appWindowTitle;
48
  public static String viewRAPTemplate_packageName;
49
  public static String viewRAPTemplate_pageDescr;
50
  public static String viewRAPTemplate_pageTitle;
51
  public static String viewRAPTemplate_perspectiveName;
52
  public static String viewRAPTemplate_viewName;
53
  public static String viewRAPTemplate_windowTitle;
54
  public static String viewRAPWizard_windowTitle;
55
56
  private static final String BUNDLE_NAME 
46
  private static final String BUNDLE_NAME 
57
    = "org.eclipse.rap.internal.ui.templates.rap.messages"; //$NON-NLS-1$
47
    = "org.eclipse.rap.internal.ui.templates.rap.messages"; //$NON-NLS-1$
58
48
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/ViewRAPTemplate.java (-138 lines)
Lines 1-138 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2012 EclipseSource and others
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Innoopract Informationssysteme GmbH - initial API and implementation
10
 *    EclipseSource - ongoing development
11
 ******************************************************************************/
12
package org.eclipse.rap.internal.ui.templates.rap;
13
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.jface.wizard.Wizard;
17
import org.eclipse.jface.wizard.WizardPage;
18
import org.eclipse.pde.core.plugin.IPluginElement;
19
import org.eclipse.pde.core.plugin.IPluginExtension;
20
import org.eclipse.rap.internal.ui.templates.TemplateUtil;
21
import org.eclipse.rap.internal.ui.templates.XmlNames;
22
23
class ViewRAPTemplate extends AbstractRAPTemplate {
24
25
  ViewRAPTemplate() {
26
    setPageCount( 1 );
27
    createTemplateOptions();
28
  }
29
30
  public void addPages( Wizard wizard ) {
31
    WizardPage page = createPage( 0 );
32
    page.setTitle( Messages.viewRAPTemplate_pageTitle );
33
    page.setDescription( Messages.viewRAPTemplate_pageDescr );
34
    wizard.addPage( page );
35
    markPagesAdded();
36
  }
37
38
  public String getSectionId() {
39
    return "viewRAP"; //$NON-NLS-1$
40
  }
41
42
  public String getApplicationId() {
43
    return "viewapp";
44
  }
45
46
  public String getServletPath() {
47
    return "/view";
48
  }
49
50
  protected void updateModel( IProgressMonitor monitor ) throws CoreException {
51
    createEntryPointExtension();
52
    createApplicationExtension();
53
    createPerspectivesExtension();
54
    createViewsExtension();
55
    createBrandingExtension();
56
  }
57
58
  //////////////////
59
  // helping methods
60
61
  private void createEntryPointExtension() throws CoreException {
62
    IPluginExtension extension = createExtension( XmlNames.XID_ENTRYPOINT, true );
63
    extension.setId( getApplicationId() + ".entrypoints" );
64
    IPluginElement entryPointElement = createElement( extension );
65
    entryPointElement.setName( XmlNames.ELEM_ENTRYPOINT );
66
    entryPointElement.setAttribute( XmlNames.ATT_ID, getApplicationId() + ".entrypoint" );
67
    entryPointElement.setAttribute( XmlNames.ATT_SERVLET_PATH, getServletPath() );
68
    entryPointElement.setAttribute( XmlNames.ATT_APPLICATION_ID, getFullApplicationId() );
69
    entryPointElement.setAttribute( XmlNames.ATT_BRANDING_ID, getPackageName() + ".branding" );
70
    extension.add( entryPointElement );
71
    addExtensionToPlugin( extension );
72
  }
73
74
  private void createApplicationExtension() throws CoreException {
75
    IPluginExtension extension = createExtension( XmlNames.XID_APPLICATION, true );
76
    extension.setId( getFullApplicationId() );
77
    IPluginElement applicationElement = createElement( extension );
78
    applicationElement.setName( XmlNames.ELEM_APPLICATION );
79
    applicationElement.setAttribute( XmlNames.ATT_VISIBLE, "true" ); //$NON-NLS-1$
80
    applicationElement.setAttribute( XmlNames.ATT_CARDINALITY, "singleton-global" ); //$NON-NLS-1$
81
    applicationElement.setAttribute( XmlNames.ATT_THREAD, "main" ); //$NON-NLS-1$
82
    extension.add( applicationElement );
83
    IPluginElement runElement = createElement( extension );
84
    runElement.setName( XmlNames.ELEM_RUN );
85
    runElement.setAttribute( XmlNames.ATT_CLASS, getApplicationClass() );
86
    applicationElement.add( runElement );
87
    addExtensionToPlugin( extension );
88
  }
89
90
  private void createPerspectivesExtension() throws CoreException {
91
    IPluginExtension extension = createExtension( XmlNames.XID_PERSPECTIVES, true );
92
    IPluginElement element = createElement( extension );
93
    element.setName( XmlNames.ELEM_PERSPECTIVE );
94
    element.setAttribute( XmlNames.ATT_CLASS, getPackageName() + ".Perspective" ); //$NON-NLS-1$
95
    element.setAttribute( XmlNames.ATT_NAME, Messages.viewRAPTemplate_perspectiveName );
96
    element.setAttribute( XmlNames.ATT_ID, getPluginId() + ".perspective" ); //$NON-NLS-1$
97
    extension.add( element );
98
    addExtensionToPlugin( extension );
99
  }
100
101
  private void createViewsExtension() throws CoreException {
102
    IPluginExtension extension = createExtension( XmlNames.XID_VIEWS, true );
103
    IPluginElement element = createElement( extension );
104
    element.setName( XmlNames.ELEM_VIEW );
105
    element.setAttribute( XmlNames.ATT_CLASS, getPackageName() + ".View" ); //$NON-NLS-1$
106
    element.setAttribute( XmlNames.ATT_NAME, Messages.viewRAPTemplate_viewName );
107
    element.setAttribute( XmlNames.ATT_ID, getPluginId() + ".view" ); //$NON-NLS-1$
108
    extension.add( element );
109
    addExtensionToPlugin( extension );
110
  }
111
112
  private void createBrandingExtension() throws CoreException {
113
    IPluginExtension extension = createExtension( XmlNames.XID_BRANDING, true );
114
    IPluginElement brandingElement = createElement( extension );
115
    // create branding
116
    brandingElement.setName( XmlNames.ELEM_BRANDING );
117
    String brandingId = getPackageName() + ".branding"; //$NON-NLS-1$
118
    brandingElement.setAttribute( XmlNames.ATT_ID, brandingId );
119
    brandingElement.setAttribute( XmlNames.ATT_THEME_ID, TemplateUtil.FANCY_THEME_ID );
120
    brandingElement.setAttribute( XmlNames.ATT_TITLE, "RAP Single View" );
121
    // write extension
122
    extension.add( brandingElement );
123
    addExtensionToPlugin( extension );
124
  }
125
126
  private void createTemplateOptions() {
127
    addOption( KEY_WINDOW_TITLE,
128
               Messages.viewRAPTemplate_windowTitle,
129
               Messages.viewRAPTemplate_appWindowTitle,
130
               0 );
131
    addOption( KEY_PACKAGE_NAME, Messages.viewRAPTemplate_packageName, null, 0 );
132
    addOption( KEY_APPLICATION_CLASS,
133
               Messages.viewRAPTemplate_appClass,
134
               "Application",  //$NON-NLS-1$
135
               0 );
136
  }
137
138
}
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/ViewRAPWizard.java (-41 lines)
Lines 1-41 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2011 EclipseSource
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
10
 *     EclipseSource - ongoing development
11
 ******************************************************************************/
12
package org.eclipse.rap.internal.ui.templates.rap;
13
14
import org.eclipse.pde.ui.IFieldData;
15
import org.eclipse.pde.ui.templates.ITemplateSection;
16
17
public class ViewRAPWizard extends AbstractRAPWizard {
18
19
  private AbstractRAPTemplate template;
20
21
  public void init( final IFieldData data ) {
22
    super.init( data );
23
    setWindowTitle( Messages.viewRAPWizard_windowTitle );
24
  }
25
26
  public ITemplateSection[] createTemplateSections() {
27
    template = new ViewRAPTemplate();
28
    return new ITemplateSection[] {
29
      template
30
    };
31
  }
32
33
  protected String getEntryPointName() {
34
    return template.getFullApplicationId();
35
  }
36
37
  protected String getServletPath() {
38
    return template.getServletPath();
39
  }
40
41
}
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/messages.properties (-11 / +1 lines)
Lines 11-27 Link Here
11
11
12
AbstractRAPWizard_targetQuestionDialogTitle=Install RAP Target Platform
12
AbstractRAPWizard_targetQuestionDialogTitle=Install RAP Target Platform
13
AbstractRAPWizard_targetQuestionDialogMessage=RAP projects need to be compiled against a RAP target platform. Do you want to install a RAP target platform now?
13
AbstractRAPWizard_targetQuestionDialogMessage=RAP projects need to be compiled against a RAP target platform. Do you want to install a RAP target platform now?
14
AbstractRAPWizard_Modifying=Modifing {0}
14
AbstractRAPWizard_Modifying=Modifying {0}
15
16
viewRAPTemplate_pageTitle=Single View RAP Application
17
viewRAPTemplate_pageDescr=This wizard creates a RAP application that consists of an application window with a single view.
18
viewRAPWizard_windowTitle=New RAP Project with a view
19
viewRAPTemplate_perspectiveName=RAP Perspective
20
viewRAPTemplate_viewName=View
21
viewRAPTemplate_windowTitle=Application window &title\:
22
viewRAPTemplate_appWindowTitle=RAP with a View
23
viewRAPTemplate_packageName=Pa&ckage name\:
24
viewRAPTemplate_appClass=App&lication class\:
25
15
26
mailRAPWizard_windowTitle=New Project with a RAP Mail Template
16
mailRAPWizard_windowTitle=New Project with a RAP Mail Template
27
17
(-)a/bundles/org.eclipse.rap.tools.templates/templates/viewRAP/java/$applicationClass$.java (-24 lines)
Lines 1-24 Link Here
1
package $packageName$;
2
3
import org.eclipse.equinox.app.IApplication;
4
import org.eclipse.equinox.app.IApplicationContext;
5
import org.eclipse.swt.widgets.Display;
6
import org.eclipse.ui.PlatformUI;
7
import org.eclipse.ui.application.WorkbenchAdvisor;
8
9
/**
10
 * This class controls all aspects of the application's execution
11
 * and is contributed through the plugin.xml.
12
 */
13
public class $applicationClass$ implements IApplication {
14
15
	public Object start(IApplicationContext context) throws Exception {
16
		Display display = PlatformUI.createDisplay();
17
		WorkbenchAdvisor advisor = new ApplicationWorkbenchAdvisor();
18
		return PlatformUI.createAndRunWorkbench(display, advisor);
19
	}
20
21
	public void stop() {
22
		// Do nothing
23
	}
24
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/viewRAP/java/ApplicationActionBarAdvisor.java (-41 lines)
Lines 1-41 Link Here
1
package $packageName$;
2
3
import org.eclipse.jface.action.IMenuManager;
4
import org.eclipse.jface.action.MenuManager;
5
import org.eclipse.ui.IWorkbenchActionConstants;
6
import org.eclipse.ui.IWorkbenchWindow;
7
import org.eclipse.ui.actions.ActionFactory;
8
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
9
import org.eclipse.ui.application.ActionBarAdvisor;
10
import org.eclipse.ui.application.IActionBarConfigurer;
11
12
/**
13
 * Creates, adds and disposes actions for the menus and action bars of
14
 * each workbench window.
15
 */
16
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
17
18
	public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
19
		super(configurer);
20
	}
21
22
	// Actions - important to allocate these only in makeActions, and then use
23
	// them in the fill methods. This ensures that the actions aren't recreated
24
	// in the fill methods. 
25
	private IWorkbenchAction exitAction;
26
27
	protected void makeActions(IWorkbenchWindow window) {
28
		// Creates the actions and registers them. Registering also 
29
		// provides automatic disposal of the actions when the window is closed.
30
		exitAction = ActionFactory.QUIT.create(window);
31
		register(exitAction);
32
	}
33
34
	protected void fillMenuBar(IMenuManager menuBar) {
35
		MenuManager fileMenu 
36
		= new MenuManager("&File",IWorkbenchActionConstants.M_FILE);
37
		menuBar.add(fileMenu);
38
		fileMenu.add(exitAction);
39
	}
40
41
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/viewRAP/java/ApplicationWorkbenchAdvisor.java (-22 lines)
Lines 1-22 Link Here
1
package $packageName$;
2
3
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
4
import org.eclipse.ui.application.WorkbenchAdvisor;
5
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
6
7
/**
8
 * This workbench advisor creates the window advisor, and specifies
9
 * the perspective id for the initial window.
10
 */
11
public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
12
13
	private static final String PERSPECTIVE_ID = "$pluginId$.perspective";
14
15
	public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
16
		return new ApplicationWorkbenchWindowAdvisor(configurer);
17
	}
18
19
	public String getInitialWindowPerspectiveId() {
20
		return PERSPECTIVE_ID;
21
	}
22
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/viewRAP/java/ApplicationWorkbenchWindowAdvisor.java (-31 lines)
Lines 1-31 Link Here
1
package $packageName$;
2
3
import org.eclipse.swt.SWT;
4
import org.eclipse.swt.graphics.Point;
5
import org.eclipse.ui.application.ActionBarAdvisor;
6
import org.eclipse.ui.application.IActionBarConfigurer;
7
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
8
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
9
10
/**
11
 * Configures the initial size and appearance of a workbench window.
12
 */
13
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
14
15
	public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
16
		super(configurer);
17
	}
18
19
	public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
20
		return new ApplicationActionBarAdvisor(configurer);
21
	}
22
23
	public void preWindowOpen() {
24
		IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
25
		configurer.setInitialSize(new Point(400, 300));
26
		configurer.setShowCoolBar(false);
27
		configurer.setShowStatusLine(false);
28
		configurer.setTitle("$windowTitle$");
29
		configurer.setShellStyle(SWT.TITLE | SWT.RESIZE);
30
	}
31
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/viewRAP/java/Perspective.java (-20 lines)
Lines 1-20 Link Here
1
package $packageName$;
2
3
import org.eclipse.ui.IPageLayout;
4
import org.eclipse.ui.IPerspectiveFactory;
5
6
/**
7
 * Configures the perspective layout. This class is contributed through the
8
 * plugin.xml.
9
 */
10
public class Perspective implements IPerspectiveFactory {
11
12
	public void createInitialLayout(IPageLayout layout) {
13
		String editorArea = layout.getEditorArea();
14
		layout.setEditorAreaVisible(false);
15
		layout.setFixed(true);
16
17
		layout.addStandaloneView(View.ID, false, IPageLayout.LEFT, 1.0f,
18
				editorArea);
19
	}
20
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/viewRAP/java/View.java (-75 lines)
Lines 1-73 Link Here
1
package $packageName$;
2
3
import org.eclipse.jface.viewers.IStructuredContentProvider;
4
import org.eclipse.jface.viewers.ITableLabelProvider;
5
import org.eclipse.jface.viewers.LabelProvider;
6
import org.eclipse.jface.viewers.TableViewer;
7
import org.eclipse.jface.viewers.Viewer;
8
import org.eclipse.swt.SWT;
9
import org.eclipse.swt.graphics.Image;
10
import org.eclipse.swt.widgets.Composite;
11
import org.eclipse.ui.ISharedImages;
12
import org.eclipse.ui.PlatformUI;
13
import org.eclipse.ui.part.ViewPart;
14
15
public class View extends ViewPart {
16
	public static final String ID = "$pluginId$.view";
17
18
	private TableViewer viewer;
19
20
	/**
21
	 * The content provider class is responsible for providing objects to the
22
	 * view. It can wrap existing objects in adapters or simply return objects
23
	 * as-is. These objects may be sensitive to the current input of the view,
24
	 * or ignore it and always show the same content (like Task List, for
25
	 * example).
26
	 */
27
	class ViewContentProvider implements IStructuredContentProvider {
28
		public void inputChanged(Viewer v, Object oldInput, Object newInput) {
29
		}
30
31
		public void dispose() {
32
		}
33
34
		public Object[] getElements(Object parent) {
35
			return new String[] { "One", "Two", "Three" };
36
		}
37
	}
38
39
	class ViewLabelProvider extends LabelProvider implements
40
			ITableLabelProvider {
41
		public String getColumnText(Object obj, int index) {
42
			return getText(obj);
43
		}
44
45
		public Image getColumnImage(Object obj, int index) {
46
			return getImage(obj);
47
		}
48
49
		public Image getImage(Object obj) {
50
			return PlatformUI.getWorkbench().getSharedImages().getImage(
51
					ISharedImages.IMG_OBJ_ELEMENT);
52
		}
53
	}
54
55
	/**
56
	 * This is a callback that will allow us to create the viewer and initialize
57
	 * it.
58
	 */
59
	public void createPartControl(Composite parent) {
60
		int style = SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL;
61
		viewer = new TableViewer(parent, style);
62
		viewer.setContentProvider(new ViewContentProvider());
63
		viewer.setLabelProvider(new ViewLabelProvider());
64
		viewer.setInput(getViewSite());
65
	}
66
67
	/**
68
	 * Passing the focus request to the viewer's control.
69
	 */
70
	public void setFocus() {
71
		viewer.getControl().setFocus();
72
	}
73
}
74
- 
75
https://bugs.eclipse.org/bugs/show_bug.cgi?id=398068
0
https://bugs.eclipse.org/bugs/show_bug.cgi?id=398068
76
--
77
.../plugin.properties                              |   12 ++--
1
.../plugin.properties                              |   12 ++--
78
.../ui/templates/rap/AbstractRAPWizard.java        |   45 +++++++++++++-----
2
.../ui/templates/rap/AbstractRAPWizard.java        |   45 +++++++++++++-----
79
.../ui/templates/rap/HelloRAPTemplate.java         |   51 +-------------------
3
.../ui/templates/rap/HelloRAPTemplate.java         |   51 +-------------------
80
.../internal/ui/templates/rap/HelloRAPWizard.java  |    4 ++
4
.../internal/ui/templates/rap/HelloRAPWizard.java  |    4 ++
81
.../internal/ui/templates/rap/MailRAPWizard.java   |    6 +-
5
.../internal/ui/templates/rap/MailRAPWizard.java   |    6 +-
82
.../rap/internal/ui/templates/rap/Messages.java    |    3 +-
6
.../rap/internal/ui/templates/rap/Messages.java    |    3 +-
83
.../internal/ui/templates/rap/messages.properties  |   11 ++---
7
.../internal/ui/templates/rap/messages.properties  |   11 ++---
84
.../helloRAP/java/$applicationClass$.java          |   24 ---------
8
.../helloRAP/java/$applicationClass$.java          |   24 ---------
85
.../templates/helloRAP/java/AppComposite.java      |   38 +++++++++++++++
9
.../templates/helloRAP/java/AppComposite.java      |   38 +++++++++++++++
86
.../templates/helloRAP/java/AppConfig.java         |   13 +++++
10
.../templates/helloRAP/java/AppConfig.java         |   13 +++++
87
.../templates/helloRAP/java/AppEntryPoint.java     |   24 +++++++++
11
.../templates/helloRAP/java/AppEntryPoint.java     |   24 +++++++++
88
.../helloRAP/java/ApplicationActionBarAdvisor.java |   23 ---------
12
.../helloRAP/java/ApplicationActionBarAdvisor.java |   23 ---------
89
.../helloRAP/java/ApplicationWorkbenchAdvisor.java |   22 --------
13
.../helloRAP/java/ApplicationWorkbenchAdvisor.java |   22 --------
90
.../java/ApplicationWorkbenchWindowAdvisor.java    |   31 ------------
14
.../java/ApplicationWorkbenchWindowAdvisor.java    |   31 ------------
91
.../templates/helloRAP/java/Perspective.java       |   14 -----
15
.../templates/helloRAP/java/Perspective.java       |   14 -----
92
15 files changed, 127 insertions(+), 194 deletions(-)
16
15 files changed, 127 insertions(+), 194 deletions(-)
93
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/$applicationClass$.java
17
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/$applicationClass$.java
94
create mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/AppComposite.java
18
create mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/AppComposite.java
95
create mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/AppConfig.java
19
create mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/AppConfig.java
96
create mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/AppEntryPoint.java
20
create mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/AppEntryPoint.java
97
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/ApplicationActionBarAdvisor.java
21
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/ApplicationActionBarAdvisor.java
98
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/ApplicationWorkbenchAdvisor.java
22
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/ApplicationWorkbenchAdvisor.java
99
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/ApplicationWorkbenchWindowAdvisor.java
23
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/ApplicationWorkbenchWindowAdvisor.java
100
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/Perspective.java
24
delete mode 100644 bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/Perspective.java
(-)a/bundles/org.eclipse.rap.tools.templates/plugin.properties (-6 / +6 lines)
Lines 16-34 bundleProvider = Eclipse.org - RAP Link Here
16
# plugin.xml
16
# plugin.xml
17
helloRAP.name = RAP Hello World
17
helloRAP.name = RAP Hello World
18
helloRAP.description = \
18
helloRAP.description = \
19
<p>This wizard creates a minimal RAP application that consists of an application window with a title.</p>\
19
<p>This example creates a basic RAP application using a few widgets (Shell, Label, Text, Button).</p>\
20
<p><b>Extensions Used</b></p>\
20
<p>The template is most appropriate for web or mobile applications that don't need an Eclipse-like user interface.</p>\
21
<li>org.eclipse.core.runtime.applications</li>\
22
<li>org.eclipse.ui.perspectives</li>\
23
<p>This code will need the <b>RAP target</b> to compile.</p>
21
<p>This code will need the <b>RAP target</b> to compile.</p>
24
22
25
mailRAP.name = RAP Mail Template
23
mailRAP.name = RAP Mail Template
26
mailRAP.description = \
24
mailRAP.description = \
27
<p>This wizard creates a RAP application that shows how to:</p>\
25
<p>This example creates a RAP application that shows how to:</p>\
28
<li>add top-level menu and toolbar with actions</li>\
26
<li>add a top-level menu and toolbar</li>\
29
<li>create views that can't be closed and multiple instances of the same view</li>\
27
<li>create views that can't be closed and multiple instances of the same view</li>\
30
<li>create perspectives with placeholders for new views</li>\
28
<li>create perspectives with placeholders for new views</li>\
31
<li>open modal dialogs</li>\
29
<li>open modal dialogs</li>\
30
<p>The template is appropriate for web applications that need an Eclipse-like \
31
user interface, or are also run as RCP applications.</p>\
32
<p><b>Extensions Used</b></p>\
32
<p><b>Extensions Used</b></p>\
33
<li>org.eclipse.core.runtime.applications</li>\
33
<li>org.eclipse.core.runtime.applications</li>\
34
<li>org.eclipse.ui.perspectives</li>\
34
<li>org.eclipse.ui.perspectives</li>\
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/AbstractRAPWizard.java (-12 / +33 lines)
Lines 40-46 import org.eclipse.ui.handlers.IHandlerService; Link Here
40
 * {@link #createTemplateSections()}.
40
 * {@link #createTemplateSections()}.
41
 * </p>
41
 * </p>
42
 * <p>
42
 * <p>
43
 * This class is responsible for modying the MANIFEST.MF after it has been
43
 * This class is responsible for modifying the MANIFEST.MF after it has been
44
 * created, in order to make it work for RAP.
44
 * created, in order to make it work for RAP.
45
 * </p>
45
 * </p>
46
 */
46
 */
Lines 50-65 abstract class AbstractRAPWizard extends NewPluginTemplateWizard { Link Here
50
  private static final String CHARSET = "ISO-8859-1"; //$NON-NLS-1$
50
  private static final String CHARSET = "ISO-8859-1"; //$NON-NLS-1$
51
  private static final String PREFERENCE_INSTALL_TARGET = "installTarget"; //$NON-NLS-1$
51
  private static final String PREFERENCE_INSTALL_TARGET = "installTarget"; //$NON-NLS-1$
52
52
53
  private static final String TAG_PACKAGE_NAME = "${packageName}"; //$NON-NLS-1$
53
  private static final String TAG_SERVLET_PATH = "${servletPath}"; //$NON-NLS-1$
54
  private static final String TAG_SERVLET_PATH = "${servletPath}"; //$NON-NLS-1$
54
  private static final String TAG_PLUGIN_ID = "${pluginId}"; //$NON-NLS-1$
55
  private static final String TAG_PLUGIN_ID = "${pluginId}"; //$NON-NLS-1$
55
  private static final String TAG_PROJECT_NAME = "${projectName}"; //$NON-NLS-1$
56
  private static final String TAG_PROJECT_NAME = "${projectName}"; //$NON-NLS-1$
56
57
  
57
  public boolean performFinish( final IProject project,
58
  public boolean performFinish( final IProject project,
58
                                final IPluginModelBase model,
59
                                final IPluginModelBase model,
59
                                final IProgressMonitor monitor )
60
                                final IProgressMonitor monitor )
60
  {
61
  {
61
    boolean result = super.performFinish( project, model, monitor );
62
    boolean result = super.performFinish( project, model, monitor );
62
    if( result ) {
63
    if( result ) {
64
      copyAppConfig( project, model );
63
      copyLaunchConfig( project, model );
65
      copyLaunchConfig( project, model );
64
      IResourceChangeListener listener = new ManifestListener();
66
      IResourceChangeListener listener = new ManifestListener();
65
      ResourcesPlugin.getWorkspace().addResourceChangeListener( listener );
67
      ResourcesPlugin.getWorkspace().addResourceChangeListener( listener );
Lines 67-72 abstract class AbstractRAPWizard extends NewPluginTemplateWizard { Link Here
67
    }
69
    }
68
    return result;
70
    return result;
69
  }
71
  }
72
  
73
  private void copyAppConfig( final IProject project,
74
                              final IPluginModelBase model ) {
75
    IFile appConfig = project.getFile( "META-INF/appconfig.xml" );
76
    if ( appConfig.exists() ) {
77
      try {
78
        String pluginId = model.getPluginBase().getId();
79
        InputStream stream = readFile( appConfig.getContents(), project.getName(), pluginId );
80
        appConfig.setContents( stream, true, false, null );
81
      } catch( final CoreException ce ) {
82
        TemplateUtil.log( ce.getStatus() );
83
      }
84
    }
85
  }
70
86
71
  private void copyLaunchConfig( final IProject project,
87
  private void copyLaunchConfig( final IProject project,
72
                                 final IPluginModelBase model )
88
                                 final IPluginModelBase model )
Lines 75-81 abstract class AbstractRAPWizard extends NewPluginTemplateWizard { Link Here
75
    IFile launchConfig = project.getFile( name );
91
    IFile launchConfig = project.getFile( name );
76
    if( !launchConfig.exists() ) {
92
    if( !launchConfig.exists() ) {
77
      try {
93
      try {
78
        InputStream stream = readLaunchConfig( project, model );
94
        InputStream template
95
          = AbstractRAPWizard.class.getResourceAsStream( LAUNCH_TEMPLATE );
96
        String pluginId = model.getPluginBase().getId();
97
        InputStream stream = readFile( template, project.getName(), pluginId );
79
        launchConfig.create( stream, true, new NullProgressMonitor() );
98
        launchConfig.create( stream, true, new NullProgressMonitor() );
80
      } catch( final CoreException ce ) {
99
      } catch( final CoreException ce ) {
81
        TemplateUtil.log( ce.getStatus() );
100
        TemplateUtil.log( ce.getStatus() );
Lines 83-97 abstract class AbstractRAPWizard extends NewPluginTemplateWizard { Link Here
83
    }
102
    }
84
  }
103
  }
85
104
86
  private InputStream readLaunchConfig( final IProject project,
105
  private InputStream readFile( final InputStream iStream, String projectName, String pluginId ) 
87
                                        final IPluginModelBase model )
88
    throws CoreException
106
    throws CoreException
89
  {
107
  {
90
    InputStream template
91
      = AbstractRAPWizard.class.getResourceAsStream( LAUNCH_TEMPLATE );
92
    StringBuffer buffer = new StringBuffer();
108
    StringBuffer buffer = new StringBuffer();
93
    try {
109
    try {
94
      InputStreamReader reader = new InputStreamReader( template, CHARSET );
110
      InputStreamReader reader = new InputStreamReader( iStream, CHARSET );
95
      BufferedReader br = new BufferedReader( reader );
111
      BufferedReader br = new BufferedReader( reader );
96
      try {
112
      try {
97
        int character = br.read();
113
        int character = br.read();
Lines 103-120 abstract class AbstractRAPWizard extends NewPluginTemplateWizard { Link Here
103
        br.close();
119
        br.close();
104
      }
120
      }
105
    } catch( final Exception ex ) {
121
    } catch( final Exception ex ) {
106
      String pluginId = TemplateUtil.PLUGIN_ID;
107
      String msg = "Could not read launch template"; //$NON-NLS-1$
122
      String msg = "Could not read launch template"; //$NON-NLS-1$
108
      throw new CoreException( new Status( IStatus.ERROR, pluginId, msg, ex ) );
123
      throw new CoreException( new Status( IStatus.ERROR, TemplateUtil.PLUGIN_ID, msg, ex ) );
109
    }
124
    }
110
    // Replace $-placeholder with actual values
125
    // Replace $-placeholder with actual values
111
    replacePlaceholder( buffer, TAG_PROJECT_NAME, project.getName() );
126
    replacePlaceholder( buffer, TAG_PACKAGE_NAME, getPackageName() );
112
    String pluginId = model.getPluginBase().getId();
127
    replacePlaceholder( buffer, TAG_PROJECT_NAME, projectName );
113
    replacePlaceholder( buffer, TAG_PLUGIN_ID, pluginId );
128
    replacePlaceholder( buffer, TAG_PLUGIN_ID, pluginId );
114
    replacePlaceholder( buffer, TAG_SERVLET_PATH, getServletPath() );
129
    replacePlaceholder( buffer, TAG_SERVLET_PATH, getServletPath() );
115
    return new ByteArrayInputStream( buffer.toString().getBytes() );
130
    return new ByteArrayInputStream( buffer.toString().getBytes() );
116
  }
131
  }
117
132
133
  protected abstract String getPackageName();
134
  
118
  protected abstract String getServletPath();
135
  protected abstract String getServletPath();
119
136
120
  private static void replacePlaceholder( final StringBuffer buffer,
137
  private static void replacePlaceholder( final StringBuffer buffer,
Lines 263-268 abstract class AbstractRAPWizard extends NewPluginTemplateWizard { Link Here
263
            }
280
            }
264
            writer.write( "Import-Package: javax.servlet;version=\"2.4.0\"," + NL ); //$NON-NLS-1$
281
            writer.write( "Import-Package: javax.servlet;version=\"2.4.0\"," + NL ); //$NON-NLS-1$
265
            writer.write( " javax.servlet.http;version=\"2.4.0\"" + NL ); //$NON-NLS-1$
282
            writer.write( " javax.servlet.http;version=\"2.4.0\"" + NL ); //$NON-NLS-1$
283
            IFile appconfigXml = file.getParent().getFile( new Path( "appconfig.xml" ) );
284
            if ( appconfigXml.exists() ) {
285
              writer.write( "Service-Component: META-INF/appconfig.xml" + NL );
286
            }
266
          } finally {
287
          } finally {
267
            writer.close();
288
            writer.close();
268
          }
289
          }
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/HelloRAPTemplate.java (-50 / +1 lines)
Lines 15-23 import org.eclipse.core.runtime.CoreException; Link Here
15
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.jface.wizard.Wizard;
16
import org.eclipse.jface.wizard.Wizard;
17
import org.eclipse.jface.wizard.WizardPage;
17
import org.eclipse.jface.wizard.WizardPage;
18
import org.eclipse.pde.core.plugin.IPluginElement;
19
import org.eclipse.pde.core.plugin.IPluginExtension;
20
import org.eclipse.rap.internal.ui.templates.XmlNames;
21
18
22
class HelloRAPTemplate extends AbstractRAPTemplate {
19
class HelloRAPTemplate extends AbstractRAPTemplate {
23
20
Lines 47-109 class HelloRAPTemplate extends AbstractRAPTemplate { Link Here
47
  }
44
  }
48
45
49
  protected void updateModel( IProgressMonitor monitor ) throws CoreException {
46
  protected void updateModel( IProgressMonitor monitor ) throws CoreException {
50
    createEntryPointExtension();
51
    createApplicationExtension();
52
    createPerspectivesExtension();
53
  }
47
  }
54
48
55
  //////////////////
49
  //////////////////
56
  // helping methods
50
  // helping methods
57
51
58
  private void createEntryPointExtension() throws CoreException {
59
    IPluginExtension extension = createExtension( XmlNames.XID_ENTRYPOINT, true );
60
    extension.setId( getApplicationId() + ".entrypoints" );
61
    IPluginElement entryPointElement = createElement( extension );
62
    entryPointElement.setName( XmlNames.ELEM_ENTRYPOINT );
63
    entryPointElement.setAttribute( XmlNames.ATT_ID, getApplicationId() + ".entrypoint" );
64
    entryPointElement.setAttribute( XmlNames.ATT_SERVLET_PATH, getServletPath() );
65
    entryPointElement.setAttribute( XmlNames.ATT_APPLICATION_ID, getFullApplicationId() );
66
    extension.add( entryPointElement );
67
    addExtensionToPlugin( extension );
68
  }
69
70
  private void createApplicationExtension() throws CoreException {
71
    IPluginExtension extension = createExtension( XmlNames.XID_APPLICATION, true );
72
    extension.setId( getFullApplicationId() );
73
    IPluginElement applicationElement = createElement( extension );
74
    applicationElement.setName( XmlNames.ELEM_APPLICATION );
75
    applicationElement.setAttribute( XmlNames.ATT_VISIBLE, "true" ); //$NON-NLS-1$
76
    applicationElement.setAttribute( XmlNames.ATT_CARDINALITY, "singleton-global" ); //$NON-NLS-1$
77
    applicationElement.setAttribute( XmlNames.ATT_THREAD, "main" ); //$NON-NLS-1$
78
    extension.add( applicationElement );
79
    IPluginElement runElement = createElement( extension );
80
    runElement.setName( XmlNames.ELEM_RUN ); //$NON-NLS-1$
81
    runElement.setAttribute( XmlNames.ATT_CLASS, getApplicationClass() );
82
    applicationElement.add( runElement );
83
    addExtensionToPlugin( extension );
84
  }
85
86
  private void createPerspectivesExtension() throws CoreException {
87
    IPluginExtension extension = createExtension( XmlNames.XID_PERSPECTIVES, true );
88
    IPluginElement element = createElement( extension );
89
    element.setName( XmlNames.ELEM_PERSPECTIVE );
90
    element.setAttribute( XmlNames.ATT_CLASS, getPackageName() + ".Perspective" ); //$NON-NLS-1$
91
    element.setAttribute( XmlNames.ATT_NAME, Messages.helloRAPTemplate_perspectiveName );
92
    element.setAttribute( XmlNames.ATT_ID, getPluginId() + ".perspective" ); //$NON-NLS-1$
93
    extension.add( element );
94
    addExtensionToPlugin( extension );
95
  }
96
97
  private void createTemplateOptions() {
52
  private void createTemplateOptions() {
98
    addOption( KEY_WINDOW_TITLE,
53
    addOption( KEY_WINDOW_TITLE,
99
               Messages.helloRAPTemplate_windowTitle,
54
               Messages.helloRAPTemplate_windowTitle,
100
               Messages.helloRAPTemplate_appWindowTitle,
55
               Messages.helloRAPTemplate_appWindowTitle,
101
               0 );
56
               0 );
102
    addOption( KEY_PACKAGE_NAME, Messages.helloRAPTemplate_packageNmae, null, 0 );
57
    addOption( KEY_PACKAGE_NAME, Messages.helloRAPTemplate_packageName, null, 0 );
103
    addOption( KEY_APPLICATION_CLASS,
104
               Messages.helloRAPTemplate_appClass,
105
               "Application", //$NON-NLS-1$
106
               0 );
107
  }
58
  }
108
59
109
}
60
}
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/HelloRAPWizard.java (+4 lines)
Lines 29-34 public class HelloRAPWizard extends AbstractRAPWizard { Link Here
29
      template
29
      template
30
    };
30
    };
31
  }
31
  }
32
  
33
  protected String getPackageName() {
34
    return template.getPackageName();
35
  }
32
36
33
  protected String getServletPath() {
37
  protected String getServletPath() {
34
    return template.getServletPath();
38
    return template.getServletPath();
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/MailRAPWizard.java (-3 / +3 lines)
Lines 29-37 public class MailRAPWizard extends AbstractRAPWizard { Link Here
29
      template
29
      template
30
    };
30
    };
31
  }
31
  }
32
32
  
33
  protected String getEntryPointName() {
33
  protected String getPackageName() {
34
    return template.getFullApplicationId();
34
    return template.getPackageName();
35
  }
35
  }
36
36
37
  protected String getServletPath() {
37
  protected String getServletPath() {
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/Messages.java (-2 / +1 lines)
Lines 19-27 public class Messages extends NLS { Link Here
19
  public static String AbstractRAPWizard_targetQuestionDialogTitle;
19
  public static String AbstractRAPWizard_targetQuestionDialogTitle;
20
  public static String AbstractRAPWizard_Modifying;
20
  public static String AbstractRAPWizard_Modifying;
21
21
22
  public static String helloRAPTemplate_appClass;
23
  public static String helloRAPTemplate_appWindowTitle;
22
  public static String helloRAPTemplate_appWindowTitle;
24
  public static String helloRAPTemplate_packageNmae;
23
  public static String helloRAPTemplate_packageName;
25
  public static String helloRAPTemplate_pageDescr;
24
  public static String helloRAPTemplate_pageDescr;
26
  public static String helloRAPTemplate_pageTitle;
25
  public static String helloRAPTemplate_pageTitle;
27
  public static String helloRAPTemplate_perspectiveName;
26
  public static String helloRAPTemplate_perspectiveName;
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/messages.properties (-7 / +4 lines)
Lines 14-22 AbstractRAPWizard_targetQuestionDialogMessage=RAP projects need to be compiled a Link Here
14
AbstractRAPWizard_Modifying=Modifying {0}
14
AbstractRAPWizard_Modifying=Modifying {0}
15
15
16
mailRAPWizard_windowTitle=New Project with a RAP Mail Template
16
mailRAPWizard_windowTitle=New Project with a RAP Mail Template
17
18
mailRAPTemplate_pageTitle=RAP Mail Template
17
mailRAPTemplate_pageTitle=RAP Mail Template
19
mailRAPTemplate_pageDescr=This template generates a RAP application with views, menu and toolbar actions and a perspective.
18
mailRAPTemplate_pageDescr=Creates a RAP workbench application with views, menu and toolbar actions and a perspective.
20
mailRAPTemplate_categoryName=Mail
19
mailRAPTemplate_categoryName=Mail
21
mailRAPTemplate_mailboxCmdDescr=Opens a mailbox
20
mailRAPTemplate_mailboxCmdDescr=Opens a mailbox
22
mailRAPTemplate_mailboxCmdName=Open Mailbox
21
mailRAPTemplate_mailboxCmdName=Open Mailbox
Lines 29-39 mailRAPTemplate_appWindowTitle=RAP Mail Template Link Here
29
mailRAPTemplate_packageName=Pa&ckage name:
28
mailRAPTemplate_packageName=Pa&ckage name:
30
mailRAPTemplate_appClass=App&lication class:
29
mailRAPTemplate_appClass=App&lication class:
31
30
32
helloRAPWizard_windowTitle=New Hello RAP Project
31
helloRAPWizard_windowTitle=New Basic RAP Project
33
helloRAPTemplate_pageTitle=Basic RAP Application
32
helloRAPTemplate_pageTitle=Basic RAP Application
34
helloRAPTemplate_pageDescr=This wizard creates a minimal RAP application that consists of an application window with a title.
33
helloRAPTemplate_pageDescr=Creates a basic RAP application using a few RWT widgets (Shell, Label, Text, Button).
35
helloRAPTemplate_perspectiveName=RAP Perspective
36
helloRAPTemplate_windowTitle=Application window &title:
34
helloRAPTemplate_windowTitle=Application window &title:
37
helloRAPTemplate_appWindowTitle=Hello RAP
35
helloRAPTemplate_appWindowTitle=Hello RAP
38
helloRAPTemplate_packageNmae=Pa&ckage name:
36
helloRAPTemplate_packageName=Pa&ckage name:
39
helloRAPTemplate_appClass=App&lication class:
(-)a/bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/$applicationClass$.java (-24 lines)
Lines 1-24 Link Here
1
package $packageName$;
2
3
import org.eclipse.equinox.app.IApplication;
4
import org.eclipse.equinox.app.IApplicationContext;
5
import org.eclipse.swt.widgets.Display;
6
import org.eclipse.ui.PlatformUI;
7
import org.eclipse.ui.application.WorkbenchAdvisor;
8
9
/**
10
 * This class controls all aspects of the application's execution
11
 * and is contributed through the plugin.xml.
12
 */
13
public class $applicationClass$ implements IApplication {
14
15
	public Object start(IApplicationContext context) throws Exception {
16
		Display display = PlatformUI.createDisplay();
17
		WorkbenchAdvisor advisor = new ApplicationWorkbenchAdvisor();
18
		return PlatformUI.createAndRunWorkbench(display, advisor);
19
	}
20
21
	public void stop() {
22
		// Do nothing
23
	}
24
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/AppComposite.java (+38 lines)
Added Link Here
1
package $packageName$;
2
3
import org.eclipse.swt.SWT;
4
import org.eclipse.swt.events.SelectionAdapter;
5
import org.eclipse.swt.events.SelectionEvent;
6
import org.eclipse.swt.layout.GridData;
7
import org.eclipse.swt.layout.GridLayout;
8
import org.eclipse.swt.widgets.Button;
9
import org.eclipse.swt.widgets.Composite;
10
import org.eclipse.swt.widgets.Label;
11
import org.eclipse.swt.widgets.Text;
12
13
@SuppressWarnings("serial")
14
public class AppComposite extends Composite {
15
16
	public AppComposite(Composite parent) {
17
		super(parent, SWT.NONE);
18
		setLayout(new GridLayout(1, false));
19
20
		Label lblName = new Label(this, SWT.NONE);
21
		lblName.setText("Name:");
22
23
		final Text txtName = new Text(this, SWT.BORDER);
24
		txtName.setText("M. Max");
25
		txtName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
26
27
		final Button btnGreet = new Button(this, SWT.PUSH);
28
		btnGreet.setText("Greet");
29
		btnGreet.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
30
31
		btnGreet.addSelectionListener(new SelectionAdapter() {
32
			@Override
33
			public void widgetSelected(SelectionEvent e) {
34
				btnGreet.setText(String.format("Hello, %s!", txtName.getText()));
35
			}
36
		});
37
	}
38
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/AppConfig.java (+13 lines)
Added Link Here
1
package $packageName$;
2
3
import org.eclipse.rap.rwt.application.Application;
4
import org.eclipse.rap.rwt.application.ApplicationConfiguration;
5
6
public class AppConfig implements ApplicationConfiguration {
7
8
	@Override
9
	public void configure(Application application) {
10
		application.addEntryPoint("/hello", AppEntryPoint.class, null);
11
	}
12
13
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/AppEntryPoint.java (+24 lines)
Added Link Here
1
package $packageName$;
2
3
import org.eclipse.rap.rwt.application.EntryPoint;
4
import org.eclipse.swt.SWT;
5
import org.eclipse.swt.layout.FillLayout;
6
import org.eclipse.swt.widgets.Shell;
7
8
public class AppEntryPoint implements EntryPoint {
9
10
	@Override
11
	public int createUI() {
12
		Shell shell = new Shell(SWT.TITLE);
13
		shell.setText("$windowTitle$");
14
		shell.setMaximized(true);
15
		shell.setLayout(new FillLayout());
16
		
17
		new AppComposite(shell);
18
		
19
		shell.open();
20
21
		return 0;
22
	}
23
24
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/ApplicationActionBarAdvisor.java (-23 lines)
Lines 1-23 Link Here
1
package $packageName$;
2
3
import org.eclipse.jface.action.IMenuManager;
4
import org.eclipse.ui.IWorkbenchWindow;
5
import org.eclipse.ui.application.ActionBarAdvisor;
6
import org.eclipse.ui.application.IActionBarConfigurer;
7
8
/**
9
 * Creates, adds and disposes actions for the menus and action bars of
10
 * each workbench window.
11
 */
12
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
13
14
	public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
15
		super(configurer);
16
	}
17
18
	protected void makeActions(IWorkbenchWindow window) {
19
	}
20
21
	protected void fillMenuBar(IMenuManager menuBar) {
22
	}
23
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/ApplicationWorkbenchAdvisor.java (-22 lines)
Lines 1-22 Link Here
1
package $packageName$;
2
3
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
4
import org.eclipse.ui.application.WorkbenchAdvisor;
5
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
6
7
/**
8
 * This workbench advisor creates the window advisor, and specifies
9
 * the perspective id for the initial window.
10
 */
11
public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
12
13
	private static final String PERSPECTIVE_ID = "$pluginId$.perspective";
14
15
	public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
16
		return new ApplicationWorkbenchWindowAdvisor(configurer);
17
	}
18
19
	public String getInitialWindowPerspectiveId() {
20
		return PERSPECTIVE_ID;
21
	}
22
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/ApplicationWorkbenchWindowAdvisor.java (-31 lines)
Lines 1-31 Link Here
1
package $packageName$;
2
3
import org.eclipse.swt.SWT;
4
import org.eclipse.swt.graphics.Point;
5
import org.eclipse.ui.application.ActionBarAdvisor;
6
import org.eclipse.ui.application.IActionBarConfigurer;
7
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
8
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
9
10
/**
11
 * Configures the initial size and appearance of a workbench window.
12
 */
13
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
14
15
	public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
16
		super(configurer);
17
	}
18
19
	public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
20
		return new ApplicationActionBarAdvisor(configurer);
21
	}
22
23
	public void preWindowOpen() {
24
		IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
25
		configurer.setInitialSize(new Point(400, 300));
26
		configurer.setShowCoolBar(false);
27
		configurer.setShowStatusLine(false);
28
		configurer.setTitle("$windowTitle$");
29
		configurer.setShellStyle(SWT.TITLE | SWT.RESIZE);
30
	}
31
}
(-)a/bundles/org.eclipse.rap.tools.templates/templates/helloRAP/java/Perspective.java (-16 lines)
Lines 1-14 Link Here
1
package $packageName$;
2
3
import org.eclipse.ui.IPageLayout;
4
import org.eclipse.ui.IPerspectiveFactory;
5
6
/**
7
 * Configures the perspective layout. This class is contributed 
8
 * through the plugin.xml.
9
 */
10
public class Perspective implements IPerspectiveFactory {
11
12
	public void createInitialLayout(IPageLayout layout) {
13
	}
14
}
15
- 
16
launch configuration template to include equinox.ds
0
launch configuration template to include equinox.ds
17
--
18
.../rap/internal/ui/templates/rap/launch.template  |    2 +-
1
.../rap/internal/ui/templates/rap/launch.template  |    2 +-
19
1 files changed, 1 insertions(+), 1 deletions(-)
2
1 files changed, 1 insertions(+), 1 deletions(-)
(-)a/bundles/org.eclipse.rap.tools.templates/src/org/eclipse/rap/internal/ui/templates/rap/launch.template (-2 / +1 lines)
Lines 22-28 Link Here
22
<booleanAttribute key="org.eclipse.rap.launch.terminatePrevious" value="true"/>
22
<booleanAttribute key="org.eclipse.rap.launch.terminatePrevious" value="true"/>
23
<booleanAttribute key="org.eclipse.rap.launch.useManualPort" value="false"/>
23
<booleanAttribute key="org.eclipse.rap.launch.useManualPort" value="false"/>
24
<stringAttribute key="pde.version" value="3.3"/>
24
<stringAttribute key="pde.version" value="3.3"/>
25
<stringAttribute key="target_bundles" value="com.ibm.icu.base@default:default,javax.servlet@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.help@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.rap.design.example@default:default,org.eclipse.rap.jface.databinding@default:default,org.eclipse.rap.jface@default:default,org.eclipse.rap.rwt.osgi@default:default,org.eclipse.rap.rwt@default:default,org.eclipse.rap.ui.forms@default:default,org.eclipse.rap.ui.views@default:default,org.eclipse.rap.ui.workbench@default:default,org.eclipse.rap.ui@default:default"/>
25
<stringAttribute key="target_bundles" value="com.ibm.icu.base@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.rap.design.example@default:default,org.eclipse.rap.jface.databinding@default:default,org.eclipse.rap.jface@default:default,org.eclipse.rap.rwt.osgi@default:default,org.eclipse.rap.rwt@default:default,org.eclipse.rap.ui.forms@default:default,org.eclipse.rap.ui.views@default:default,org.eclipse.rap.ui.workbench@default:default,org.eclipse.rap.ui@default:default"/>
26
<booleanAttribute key="tracing" value="false"/>
26
<booleanAttribute key="tracing" value="false"/>
27
<booleanAttribute key="useDefaultConfigArea" value="true"/>
27
<booleanAttribute key="useDefaultConfigArea" value="true"/>
28
<stringAttribute key="workspace_bundles" value="${pluginId}@default:default"/>
28
<stringAttribute key="workspace_bundles" value="${pluginId}@default:default"/>
29
- 

Return to bug 398068