|
Added
Link Here
|
| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007, 2008 Intel Corporation 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 |
* Intel Corporation - initial API and implementation |
| 10 |
* IBM Corporation |
| 11 |
*******************************************************************************/ |
| 12 |
package org.eclipse.ptp.rdt.ui.wizards; |
| 13 |
import java.net.URI; |
| 14 |
import java.util.ArrayList; |
| 15 |
import java.util.Iterator; |
| 16 |
import java.util.LinkedList; |
| 17 |
import java.util.List; |
| 18 |
|
| 19 |
import org.eclipse.cdt.internal.ui.CPluginImages; |
| 20 |
import org.eclipse.cdt.ui.CUIPlugin; |
| 21 |
import org.eclipse.cdt.ui.newui.CDTPrefUtil; |
| 22 |
import org.eclipse.cdt.ui.newui.PageLayout; |
| 23 |
import org.eclipse.cdt.ui.newui.UIMessages; |
| 24 |
import org.eclipse.cdt.ui.wizards.CNewWizard; |
| 25 |
import org.eclipse.cdt.ui.wizards.CWizardHandler; |
| 26 |
import org.eclipse.cdt.ui.wizards.EntryDescriptor; |
| 27 |
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener; |
| 28 |
import org.eclipse.cdt.ui.wizards.IWizardWithMemory; |
| 29 |
import org.eclipse.core.filesystem.EFS; |
| 30 |
import org.eclipse.core.filesystem.IFileInfo; |
| 31 |
import org.eclipse.core.filesystem.IFileStore; |
| 32 |
import org.eclipse.core.resources.IProject; |
| 33 |
import org.eclipse.core.resources.ResourcesPlugin; |
| 34 |
import org.eclipse.core.runtime.CoreException; |
| 35 |
import org.eclipse.core.runtime.IConfigurationElement; |
| 36 |
import org.eclipse.core.runtime.IExtension; |
| 37 |
import org.eclipse.core.runtime.IExtensionPoint; |
| 38 |
import org.eclipse.core.runtime.IStatus; |
| 39 |
import org.eclipse.core.runtime.Platform; |
| 40 |
import org.eclipse.jface.wizard.IWizard; |
| 41 |
import org.eclipse.jface.wizard.IWizardPage; |
| 42 |
import org.eclipse.osgi.util.TextProcessor; |
| 43 |
import org.eclipse.ptp.internal.rdt.ui.RDTHelpContextIds; |
| 44 |
import org.eclipse.ptp.services.core.IServiceConfiguration; |
| 45 |
import org.eclipse.swt.SWT; |
| 46 |
import org.eclipse.swt.accessibility.AccessibleAdapter; |
| 47 |
import org.eclipse.swt.accessibility.AccessibleEvent; |
| 48 |
import org.eclipse.swt.events.SelectionAdapter; |
| 49 |
import org.eclipse.swt.events.SelectionEvent; |
| 50 |
import org.eclipse.swt.graphics.Image; |
| 51 |
import org.eclipse.swt.layout.GridData; |
| 52 |
import org.eclipse.swt.layout.GridLayout; |
| 53 |
import org.eclipse.swt.widgets.Button; |
| 54 |
import org.eclipse.swt.widgets.Composite; |
| 55 |
import org.eclipse.swt.widgets.Label; |
| 56 |
import org.eclipse.swt.widgets.Shell; |
| 57 |
import org.eclipse.swt.widgets.Tree; |
| 58 |
import org.eclipse.swt.widgets.TreeItem; |
| 59 |
import org.eclipse.ui.PlatformUI; |
| 60 |
|
| 61 |
public class RemoteMainWizardPage extends NewRemoteProjectCreationPage implements IWizardItemsListListener { |
| 62 |
private static final Image IMG_CATEGORY = CPluginImages.get(CPluginImages.IMG_OBJS_SEARCHFOLDER); |
| 63 |
private static final Image IMG_ITEM = CPluginImages.get(CPluginImages.IMG_OBJS_VARIABLE); |
| 64 |
|
| 65 |
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.NewModelProjectWizardPage"; //$NON-NLS-1$ |
| 66 |
|
| 67 |
private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.CDTWizard"; //$NON-NLS-1$ |
| 68 |
private static final String ELEMENT_NAME = "wizard"; //$NON-NLS-1$ |
| 69 |
private static final String CLASS_NAME = "class"; //$NON-NLS-1$ |
| 70 |
public static final String DESC = "EntryDescriptor"; //$NON-NLS-1$ |
| 71 |
|
| 72 |
// widgets |
| 73 |
private Tree tree; |
| 74 |
private Composite right; |
| 75 |
private Button show_sup; |
| 76 |
private Label right_label; |
| 77 |
|
| 78 |
public CWizardHandler h_selected = null; |
| 79 |
private Label categorySelectedLabel; |
| 80 |
|
| 81 |
private IServiceConfiguration defaultConfig = null; |
| 82 |
|
| 83 |
/** |
| 84 |
* Creates a new project creation wizard page. |
| 85 |
* |
| 86 |
* @param pageName the name of this page |
| 87 |
*/ |
| 88 |
public RemoteMainWizardPage(String pageName) { |
| 89 |
super(pageName); |
| 90 |
setPageComplete(false); |
| 91 |
// default to view all toolchains |
| 92 |
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSUPP, true); |
| 93 |
} |
| 94 |
|
| 95 |
/** (non-Javadoc) |
| 96 |
* Method declared on IDialogPage. |
| 97 |
*/ |
| 98 |
@Override |
| 99 |
public void createControl(Composite parent) { |
| 100 |
super.createControl(parent); |
| 101 |
|
| 102 |
createDynamicGroup((Composite)getControl()); |
| 103 |
switchTo(updateData(tree, right, show_sup, RemoteMainWizardPage.this, getWizard()), |
| 104 |
getDescriptor(tree)); |
| 105 |
|
| 106 |
setPageComplete(validatePage()); |
| 107 |
setErrorMessage(null); |
| 108 |
setMessage(null); |
| 109 |
|
| 110 |
Shell shell = getContainer().getShell(); //if not created on the shell, will not display properly |
| 111 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, RDTHelpContextIds.CREATING_A_REMOTE_PROJECT); |
| 112 |
} |
| 113 |
|
| 114 |
private void createDynamicGroup(Composite parent) { |
| 115 |
Composite c = new Composite(parent, SWT.NONE); |
| 116 |
c.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 117 |
c.setLayout(new GridLayout(2, true)); |
| 118 |
|
| 119 |
Label l1 = new Label(c, SWT.NONE); |
| 120 |
l1.setText(UIMessages.getString("CMainWizardPage.0")); //$NON-NLS-1$ |
| 121 |
l1.setFont(parent.getFont()); |
| 122 |
l1.setLayoutData(new GridData(GridData.BEGINNING)); |
| 123 |
|
| 124 |
right_label = new Label(c, SWT.NONE); |
| 125 |
right_label.setFont(parent.getFont()); |
| 126 |
right_label.setLayoutData(new GridData(GridData.BEGINNING)); |
| 127 |
|
| 128 |
tree = new Tree(c, SWT.SINGLE | SWT.BORDER); |
| 129 |
tree.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 130 |
tree.addSelectionListener(new SelectionAdapter() { |
| 131 |
@Override |
| 132 |
public void widgetSelected(SelectionEvent e) { |
| 133 |
TreeItem[] tis = tree.getSelection(); |
| 134 |
if (tis == null || tis.length == 0) return; |
| 135 |
switchTo((CWizardHandler)tis[0].getData(), (EntryDescriptor)tis[0].getData(DESC)); |
| 136 |
setPageComplete(validatePage()); |
| 137 |
}}); |
| 138 |
tree.getAccessible().addAccessibleListener( |
| 139 |
new AccessibleAdapter() { |
| 140 |
@Override |
| 141 |
public void getName(AccessibleEvent e) { |
| 142 |
for (int i = 0; i < tree.getItemCount(); i++) { |
| 143 |
if (tree.getItem(i).getText().compareTo(e.result) == 0) |
| 144 |
return; |
| 145 |
} |
| 146 |
e.result = UIMessages.getString("CMainWizardPage.0"); //$NON-NLS-1$ |
| 147 |
} |
| 148 |
} |
| 149 |
); |
| 150 |
right = new Composite(c, SWT.NONE); |
| 151 |
right.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 152 |
right.setLayout(new PageLayout()); |
| 153 |
|
| 154 |
show_sup = new Button(c, SWT.CHECK); |
| 155 |
show_sup.setText(UIMessages.getString("CMainWizardPage.1")); //$NON-NLS-1$ |
| 156 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL); |
| 157 |
gd.horizontalSpan = 2; |
| 158 |
show_sup.setLayoutData(gd); |
| 159 |
show_sup.addSelectionListener(new SelectionAdapter() { |
| 160 |
@Override |
| 161 |
public void widgetSelected(SelectionEvent e) { |
| 162 |
if (h_selected != null) |
| 163 |
h_selected.setSupportedOnly(show_sup.getSelection()); |
| 164 |
switchTo(updateData(tree, right, show_sup, RemoteMainWizardPage.this, getWizard()), |
| 165 |
getDescriptor(tree)); |
| 166 |
}} ); |
| 167 |
|
| 168 |
// restore settings from preferences |
| 169 |
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP)); |
| 170 |
} |
| 171 |
|
| 172 |
@Override |
| 173 |
public IWizardPage getNextPage() { |
| 174 |
return (h_selected == null) ? null : h_selected.getSpecificPage(); |
| 175 |
} |
| 176 |
|
| 177 |
public URI getProjectLocation() { |
| 178 |
return useDefaults() ? null : getLocationURI(); |
| 179 |
} |
| 180 |
|
| 181 |
/** |
| 182 |
* Returns whether this page's controls currently all contain valid |
| 183 |
* values. |
| 184 |
* |
| 185 |
* @return <code>true</code> if all controls are valid, and |
| 186 |
* <code>false</code> if at least one is invalid |
| 187 |
*/ |
| 188 |
@Override |
| 189 |
protected boolean validatePage() { |
| 190 |
setMessage(null); |
| 191 |
if (!super.validatePage()) |
| 192 |
return false; |
| 193 |
|
| 194 |
if (getProjectName().indexOf('#') >= 0) { |
| 195 |
setErrorMessage(UIMessages.getString("RemoteMainWizardPage.0")); //$NON-NLS-1$ |
| 196 |
return false; |
| 197 |
} |
| 198 |
|
| 199 |
boolean bad = true; // should we treat existing project as error |
| 200 |
|
| 201 |
IProject handle = getProjectHandle(); |
| 202 |
if (handle.exists()) { |
| 203 |
if (getWizard() instanceof IWizardWithMemory) { |
| 204 |
IWizardWithMemory w = (IWizardWithMemory)getWizard(); |
| 205 |
if (w.getLastProjectName() != null && w.getLastProjectName().equals(getProjectName())) |
| 206 |
bad = false; |
| 207 |
} |
| 208 |
if (bad) { |
| 209 |
setErrorMessage(UIMessages.getString("CMainWizardPage.10")); //$NON-NLS-1$ |
| 210 |
return false; |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
if (bad) { // skip this check if project already created |
| 215 |
try { |
| 216 |
IFileStore fs; |
| 217 |
URI p = getProjectLocation(); |
| 218 |
if (p == null) { |
| 219 |
fs = EFS.getStore(ResourcesPlugin.getWorkspace().getRoot().getLocationURI()); |
| 220 |
fs = fs.getChild(getProjectName()); |
| 221 |
} else |
| 222 |
fs = EFS.getStore(p); |
| 223 |
IFileInfo f = fs.fetchInfo(); |
| 224 |
if (f.exists() && f.isDirectory()) { |
| 225 |
if (fs.getChild(".project").fetchInfo().exists()) { //$NON-NLS-1$ |
| 226 |
setMessage("Existing project settings will be overridden"); //$NON-NLS-1$ |
| 227 |
return true; |
| 228 |
} |
| 229 |
} |
| 230 |
} catch (CoreException e) { |
| 231 |
CUIPlugin.log(e.getStatus()); |
| 232 |
} |
| 233 |
} |
| 234 |
|
| 235 |
if (!useDefaults()) { |
| 236 |
IStatus locationStatus = ResourcesPlugin.getWorkspace().validateProjectLocationURI(handle, |
| 237 |
getLocationURI()); |
| 238 |
if (!locationStatus.isOK()) { |
| 239 |
setErrorMessage(locationStatus.getMessage()); |
| 240 |
return false; |
| 241 |
} |
| 242 |
} |
| 243 |
|
| 244 |
if (tree.getItemCount() == 0) { |
| 245 |
setErrorMessage(UIMessages.getString("CMainWizardPage.3")); //$NON-NLS-1$ |
| 246 |
return false; |
| 247 |
} |
| 248 |
|
| 249 |
// it is not an error, but we cannot continue |
| 250 |
if (h_selected == null) { |
| 251 |
setErrorMessage(null); |
| 252 |
return false; |
| 253 |
} |
| 254 |
|
| 255 |
String s = h_selected.getErrorMessage(); |
| 256 |
if (s != null) { |
| 257 |
setErrorMessage(s); |
| 258 |
return false; |
| 259 |
} |
| 260 |
|
| 261 |
setErrorMessage(null); |
| 262 |
return true; |
| 263 |
} |
| 264 |
|
| 265 |
/** |
| 266 |
* |
| 267 |
* @param tree |
| 268 |
* @param right |
| 269 |
* @param show_sup |
| 270 |
* @param ls |
| 271 |
* @param wizard |
| 272 |
* @return : selected Wizard Handler. |
| 273 |
*/ |
| 274 |
public static CWizardHandler updateData(Tree tree, Composite right, Button show_sup, IWizardItemsListListener ls, IWizard wizard) { |
| 275 |
// remember selected item |
| 276 |
TreeItem[] sel = tree.getSelection(); |
| 277 |
String savedStr = (sel.length > 0) ? sel[0].getText() : null; |
| 278 |
|
| 279 |
tree.removeAll(); |
| 280 |
IExtensionPoint extensionPoint = |
| 281 |
Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); |
| 282 |
if (extensionPoint == null) return null; |
| 283 |
IExtension[] extensions = extensionPoint.getExtensions(); |
| 284 |
if (extensions == null) return null; |
| 285 |
|
| 286 |
List<EntryDescriptor> items = new ArrayList<EntryDescriptor>(); |
| 287 |
for (int i = 0; i < extensions.length; ++i) { |
| 288 |
IConfigurationElement[] elements = extensions[i].getConfigurationElements(); |
| 289 |
for (IConfigurationElement element : elements) { |
| 290 |
if (element.getName().equals(ELEMENT_NAME)) { |
| 291 |
CNewWizard w = null; |
| 292 |
try { |
| 293 |
w = (CNewWizard) element.createExecutableExtension(CLASS_NAME); |
| 294 |
} catch (CoreException e) { |
| 295 |
System.out.println(UIMessages.getString("CMainWizardPage.5") + e.getLocalizedMessage()); //$NON-NLS-1$ |
| 296 |
return null; |
| 297 |
} |
| 298 |
if (w == null) return null; |
| 299 |
w.setDependentControl(right, ls); |
| 300 |
for (EntryDescriptor ed : w.createItems(show_sup.getSelection(), wizard)) |
| 301 |
items.add(ed); |
| 302 |
} |
| 303 |
} |
| 304 |
} |
| 305 |
// If there is a EntryDescriptor which is default for category, make sure it |
| 306 |
// is in the front of the list. |
| 307 |
for (int i = 0; i < items.size(); ++i) |
| 308 |
{ |
| 309 |
EntryDescriptor ed = items.get(i); |
| 310 |
if (ed.isDefaultForCategory()) |
| 311 |
{ |
| 312 |
items.remove(i); |
| 313 |
items.add(0, ed); |
| 314 |
break; |
| 315 |
} |
| 316 |
} |
| 317 |
|
| 318 |
// bug # 211935 : allow items filtering. |
| 319 |
if (ls != null) // NULL means call from prefs |
| 320 |
items = ls.filterItems(items); |
| 321 |
addItemsToTree(tree, items); |
| 322 |
|
| 323 |
if (tree.getItemCount() > 0) { |
| 324 |
TreeItem target = null; |
| 325 |
// try to search item which was selected before |
| 326 |
if (savedStr != null) { |
| 327 |
TreeItem[] all = tree.getItems(); |
| 328 |
for (TreeItem element : all) { |
| 329 |
if (savedStr.equals(element.getText())) { |
| 330 |
target = element; |
| 331 |
break; |
| 332 |
} |
| 333 |
} |
| 334 |
} |
| 335 |
if (target == null) |
| 336 |
{ |
| 337 |
target = tree.getItem(0); |
| 338 |
if (target.getItemCount() != 0) |
| 339 |
target = target.getItem(0); |
| 340 |
} |
| 341 |
tree.setSelection(target); |
| 342 |
return (CWizardHandler)target.getData(); |
| 343 |
} |
| 344 |
return null; |
| 345 |
} |
| 346 |
|
| 347 |
private static void addItemsToTree(Tree tree, List<EntryDescriptor> items) { |
| 348 |
// Sorting is disabled because of users requests |
| 349 |
// Collections.sort(items, CDTListComparator.getInstance()); |
| 350 |
|
| 351 |
ArrayList<TreeItem> placedTreeItemsList = new ArrayList<TreeItem>(items.size()); |
| 352 |
ArrayList<EntryDescriptor> placedEntryDescriptorsList = new ArrayList<EntryDescriptor>(items.size()); |
| 353 |
for (EntryDescriptor wd : items) { |
| 354 |
if (wd.getParentId() == null) { |
| 355 |
wd.setPath(wd.getId()); |
| 356 |
TreeItem ti = new TreeItem(tree, SWT.NONE); |
| 357 |
ti.setText(TextProcessor.process(wd.getName())); |
| 358 |
ti.setData(wd.getHandler()); |
| 359 |
ti.setData(DESC, wd); |
| 360 |
ti.setImage(calcImage(wd)); |
| 361 |
placedTreeItemsList.add(ti); |
| 362 |
placedEntryDescriptorsList.add(wd); |
| 363 |
} |
| 364 |
} |
| 365 |
while(true) { |
| 366 |
boolean found = false; |
| 367 |
Iterator<EntryDescriptor> it2 = items.iterator(); |
| 368 |
while (it2.hasNext()) { |
| 369 |
EntryDescriptor wd1 = it2.next(); |
| 370 |
if (wd1.getParentId() == null) continue; |
| 371 |
for (int i = 0; i< placedEntryDescriptorsList.size(); i++) { |
| 372 |
EntryDescriptor wd2 = placedEntryDescriptorsList.get(i); |
| 373 |
if (wd2.getId().equals(wd1.getParentId())) { |
| 374 |
found = true; |
| 375 |
wd1.setParentId(null); |
| 376 |
CWizardHandler h = wd2.getHandler(); |
| 377 |
/* If neither wd1 itself, nor its parent (wd2) have a handler |
| 378 |
* associated with them, and the item is not a category, |
| 379 |
* then skip it. If it's category, then it's possible that |
| 380 |
* children will have a handler associated with them. |
| 381 |
*/ |
| 382 |
if (h == null && wd1.getHandler() == null && !wd1.isCategory()) |
| 383 |
break; |
| 384 |
|
| 385 |
wd1.setPath(wd2.getPath() + "/" + wd1.getId()); //$NON-NLS-1$ |
| 386 |
wd1.setParent(wd2); |
| 387 |
if (h != null) { |
| 388 |
if (wd1.getHandler() == null && !wd1.isCategory()) |
| 389 |
wd1.setHandler((CWizardHandler)h.clone()); |
| 390 |
if (!h.isApplicable(wd1)) |
| 391 |
break; |
| 392 |
} |
| 393 |
|
| 394 |
TreeItem p = placedTreeItemsList.get(i); |
| 395 |
TreeItem ti = new TreeItem(p, SWT.NONE); |
| 396 |
ti.setText(wd1.getName()); |
| 397 |
ti.setData(wd1.getHandler()); |
| 398 |
ti.setData(DESC, wd1); |
| 399 |
ti.setImage(calcImage(wd1)); |
| 400 |
placedTreeItemsList.add(ti); |
| 401 |
placedEntryDescriptorsList.add(wd1); |
| 402 |
break; |
| 403 |
} |
| 404 |
} |
| 405 |
} |
| 406 |
// repeat iterations until all items are placed. |
| 407 |
if (!found) break; |
| 408 |
} |
| 409 |
// orphan elements (with not-existing parentId) are ignored |
| 410 |
} |
| 411 |
|
| 412 |
private void switchTo(CWizardHandler h, EntryDescriptor ed) { |
| 413 |
if (h == null) |
| 414 |
h = ed.getHandler(); |
| 415 |
if (ed.isCategory()) |
| 416 |
h = null; |
| 417 |
try { |
| 418 |
if (h != null) |
| 419 |
h.initialize(ed); |
| 420 |
} catch (CoreException e) { |
| 421 |
h = null; |
| 422 |
} |
| 423 |
if (h_selected != null) |
| 424 |
h_selected.handleUnSelection(); |
| 425 |
h_selected = h; |
| 426 |
if (h == null) { |
| 427 |
if (ed.isCategory()) { |
| 428 |
if (categorySelectedLabel == null) { |
| 429 |
categorySelectedLabel = new Label(right, SWT.WRAP); |
| 430 |
categorySelectedLabel.setText( |
| 431 |
UIMessages.getString("RemoteMainWizardPage.1")); //$NON-NLS-1$ |
| 432 |
right.layout(); |
| 433 |
} |
| 434 |
categorySelectedLabel.setVisible(true); |
| 435 |
} |
| 436 |
return; |
| 437 |
} |
| 438 |
right_label.setText(h_selected.getHeader()); |
| 439 |
if (categorySelectedLabel != null) |
| 440 |
categorySelectedLabel.setVisible(false); |
| 441 |
h_selected.handleSelection(); |
| 442 |
h_selected.setSupportedOnly(show_sup.getSelection()); |
| 443 |
} |
| 444 |
|
| 445 |
|
| 446 |
public static EntryDescriptor getDescriptor(Tree _tree) { |
| 447 |
TreeItem[] sel = _tree.getSelection(); |
| 448 |
if (sel == null || sel.length == 0) |
| 449 |
return null; |
| 450 |
return (EntryDescriptor)sel[0].getData(DESC); |
| 451 |
} |
| 452 |
|
| 453 |
public void toolChainListChanged(int count) { |
| 454 |
setPageComplete(validatePage()); |
| 455 |
getWizard().getContainer().updateButtons(); |
| 456 |
} |
| 457 |
|
| 458 |
public boolean isCurrent() { return isCurrentPage(); } |
| 459 |
|
| 460 |
private static Image calcImage(EntryDescriptor ed) { |
| 461 |
if (ed.getImage() != null) return ed.getImage(); |
| 462 |
if (ed.isCategory()) return IMG_CATEGORY; |
| 463 |
return IMG_ITEM; |
| 464 |
} |
| 465 |
|
| 466 |
@SuppressWarnings("unchecked") |
| 467 |
public List filterItems(List items) { |
| 468 |
/// iterate through the list, removing entry descriptors we don't care about |
| 469 |
Iterator iterator = items.iterator(); |
| 470 |
|
| 471 |
List<EntryDescriptor> filteredList = new LinkedList<EntryDescriptor>(); |
| 472 |
|
| 473 |
while(iterator.hasNext()) { |
| 474 |
EntryDescriptor ed = (EntryDescriptor) iterator.next(); |
| 475 |
if(ed.getId().startsWith("org.eclipse.ptp.rdt")) { // both the category and the template start with this //$NON-NLS-1$ |
| 476 |
filteredList.add(ed); |
| 477 |
} |
| 478 |
} |
| 479 |
|
| 480 |
return filteredList; |
| 481 |
} |
| 482 |
|
| 483 |
// public void pageChanged(PageChangedEvent event) { |
| 484 |
// if (event.getSelectedPage().equals(this)) { |
| 485 |
// if (defaultConfig == null) { |
| 486 |
// ServiceModelManager manager = ServiceModelManager.getInstance(); |
| 487 |
// |
| 488 |
// /* |
| 489 |
// * Create a new service configuration |
| 490 |
// * |
| 491 |
// * XXX: this should check if a service configuration has already |
| 492 |
// * been selected, in which case it should use that one. |
| 493 |
// */ |
| 494 |
// IServiceConfiguration config = manager.newServiceConfiguration(handle.getName()); |
| 495 |
// |
| 496 |
// /* |
| 497 |
// * Make this configuration active for this project. |
| 498 |
// */ |
| 499 |
// manager.setConfiguration(handle, config); |
| 500 |
// |
| 501 |
// /* |
| 502 |
// * Set default service providers based on location of project |
| 503 |
// */ |
| 504 |
// URI location = getLocationURI(); |
| 505 |
// IRemoteServices remServ = PTPRemoteCorePlugin.getDefault().getRemoteServices(location); |
| 506 |
// IRemoteConnection remConn = PTPRemoteCorePlugin.getDefault().getConnection(location); |
| 507 |
// |
| 508 |
// /* |
| 509 |
// * Project location |
| 510 |
// */ |
| 511 |
// IRemoteServiceProvider projectProvider = new RemoteProjectServiceProvider(); |
| 512 |
// projectProvider.setRemoteServicesID(remServ.getId()); |
| 513 |
// projectProvider.setRemoteConnectionName(remConn.getName()); |
| 514 |
// config.setServiceProvider(manager.getService(RemoteProjectServiceProvider.ID), projectProvider); |
| 515 |
// |
| 516 |
// /* |
| 517 |
// * Build service |
| 518 |
// */ |
| 519 |
// IRemoteServiceProvider buildProvider = new RemoteBuildServiceProvider(); |
| 520 |
// buildProvider.setRemoteServicesID(remServ.getId()); |
| 521 |
// buildProvider.setRemoteConnectionName(remConn.getName()); |
| 522 |
// config.setServiceProvider(manager.getService(RemoteBuildServiceProvider.ID), buildProvider); |
| 523 |
// |
| 524 |
// /* |
| 525 |
// * Index service |
| 526 |
// */ |
| 527 |
// IRemoteServiceProvider indexProvider = new RemoteCIndexServiceProvider(); |
| 528 |
// indexProvider.setRemoteServicesID(remServ.getId()); |
| 529 |
// indexProvider.setRemoteConnectionName(remConn.getName()); |
| 530 |
// config.setServiceProvider(manager.getService(RemoteCIndexServiceProvider.ID), indexProvider); |
| 531 |
// |
| 532 |
// defaultConfig = config; |
| 533 |
// |
| 534 |
// /* |
| 535 |
// * Pass configuration to ServiceModelWizardPage |
| 536 |
// */ |
| 537 |
// MBSCustomPageManager.addPageProperty(ServiceModelWizardPage.SERVICE_MODEL_WIZARD_PAGE_ID, |
| 538 |
// ServiceModelWizardPage.SERVICE_CONFIGURATION_PROPERTY, config); |
| 539 |
// } |
| 540 |
// } |
| 541 |
// } |
| 542 |
} |
| 543 |
|