author | Eugene Ostroukhov <eugeneo@symbian.org> |
Thu, 19 Aug 2010 17:48:04 -0700 | |
changeset 470 | d4809db37847 |
parent 467 | org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationFacetsWizardPage.java@5a2901872fcf |
child 484 | f5df819c1852 |
permissions | -rw-r--r-- |
465
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
package org.symbian.tools.tmw.internal.ui.wizard; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
3 |
import java.util.Set; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
4 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
5 |
import org.eclipse.jface.wizard.WizardPage; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
6 |
import org.eclipse.swt.events.DisposeEvent; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
7 |
import org.eclipse.swt.events.DisposeListener; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
8 |
import org.eclipse.swt.widgets.Composite; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
9 |
import org.eclipse.ui.PlatformUI; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
10 |
import org.eclipse.ui.help.IWorkbenchHelpSystem; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
11 |
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
12 |
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
13 |
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
14 |
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
15 |
import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
16 |
import org.eclipse.wst.common.project.facet.core.runtime.events.IRuntimeLifecycleEvent; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
17 |
import org.eclipse.wst.common.project.facet.core.runtime.events.IRuntimeLifecycleListener; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
18 |
import org.eclipse.wst.common.project.facet.ui.FacetUiHelpContextIds; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
19 |
import org.eclipse.wst.common.project.facet.ui.internal.FacetedProjectFrameworkImages; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
20 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
21 |
/** |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
22 |
* @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
23 |
*/ |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
24 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
25 |
@SuppressWarnings("restriction") |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
26 |
public final class NewApplicationFacetsWizardPage extends WizardPage { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
27 |
public FacetsSelectionPanel panel; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
28 |
private final IFacetedProjectWorkingCopy fpjwc; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
29 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
30 |
public NewApplicationFacetsWizardPage(final Set<IProjectFacetVersion> base, final IFacetedProjectWorkingCopy fpjwc) { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
31 |
super("facets.selection.page"); //$NON-NLS-1$ |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
32 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
33 |
setTitle("Project Facets"); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
34 |
setDescription("Select the facets that should be enabled for this project."); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
35 |
setImageDescriptor(FacetedProjectFrameworkImages.BANNER_IMAGE.getImageDescriptor()); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
36 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
37 |
this.fpjwc = fpjwc; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
38 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
39 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
40 |
public void createControl(final Composite parent) { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
41 |
this.panel = new FacetsSelectionPanel(parent, this.fpjwc); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
42 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
43 |
updatePageState(); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
44 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
45 |
this.fpjwc.addListener(new IFacetedProjectListener() { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
46 |
public void handleEvent(final IFacetedProjectEvent event) { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
47 |
updatePageState(); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
48 |
} |
467
5a2901872fcf
WRTKit facet was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
465
diff
changeset
|
49 |
}, IFacetedProjectEvent.Type.PROJECT_MODIFIED, IFacetedProjectEvent.Type.PROJECT_NAME_CHANGED); |
465
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
50 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
51 |
final IRuntimeLifecycleListener runtimeLifecycleListener = new IRuntimeLifecycleListener() { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
52 |
public void handleEvent(final IRuntimeLifecycleEvent event) { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
53 |
updatePageState(); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
54 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
55 |
}; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
56 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
57 |
RuntimeManager.addListener(runtimeLifecycleListener, IRuntimeLifecycleEvent.Type.VALIDATION_STATUS_CHANGED); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
58 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
59 |
this.panel.addDisposeListener(new DisposeListener() { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
60 |
public void widgetDisposed(final DisposeEvent e) { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
61 |
RuntimeManager.removeListener(runtimeLifecycleListener); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
62 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
63 |
}); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
64 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
65 |
final IWorkbenchHelpSystem h = PlatformUI.getWorkbench().getHelpSystem(); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
66 |
h.setHelp(this.panel, FacetUiHelpContextIds.FACETS_SELECTION_PAGE); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
67 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
68 |
setControl(this.panel); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
69 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
70 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
71 |
private void updatePageState() { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
72 |
if (!Thread.currentThread().equals(this.panel.getDisplay().getThread())) { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
73 |
final Runnable uiRunnable = new Runnable() { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
74 |
public void run() { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
75 |
updatePageState(); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
76 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
77 |
}; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
78 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
79 |
this.panel.getDisplay().asyncExec(uiRunnable); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
80 |
return; |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
81 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
82 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
83 |
setPageComplete(this.panel.isSelectionValid()); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
84 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
85 |
if (getContainer().getCurrentPage() != null) { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
86 |
getContainer().updateButtons(); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
87 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
88 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
89 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
90 |
public void setVisible(final boolean visible) { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
91 |
super.setVisible(visible); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
92 |
|
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
93 |
if (visible) { |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
94 |
this.panel.setFocus(); |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
95 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
96 |
} |
87920e15f8eb
Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
97 |
} |