blob: de89d8a4e4f04c108eac35bf59eae176e3713f2c [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 2006 IBM Corporation and others.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// IBM Corporation - initial implementation
//------------------------------------------------------------------------------
package org.eclipse.epf.rcp.wizards;
import org.eclipse.core.runtime.Path;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.dialogs.ExportWizard;
import org.eclipse.ui.internal.dialogs.WizardCollectionElement;
import org.eclipse.ui.internal.dialogs.WorkbenchWizardElement;
import org.eclipse.ui.internal.registry.WizardsRegistryReader;
import org.eclipse.ui.model.AdaptableList;
import org.eclipse.ui.wizards.IWizardCategory;
public class TNGExportWizard extends ExportWizard {
String[] allowed_export_wizards = {
"org.eclipse.epf.export.wizards.ExportConfigurationWizard", //$NON-NLS-1$
"org.eclipse.epf.export.wizards.ExportPluginWizard", //$NON-NLS-1$
"org.eclipse.efp.export.msp.wizards.ExportToMSProjectWizard", //$NON-NLS-1$
"org.eclipse.epf.export.xml.wizards.ExportXmlWizard" //$NON-NLS-1$
};
protected AdaptableList getAvailableExportWizards() {
// System.out.println("$$$ INFO: entered TNGExportWizard.");
// TODO: exports are still flat - we need to get at the flat list. All
// wizards will be in the "other" category.
IWizardCategory root = WorkbenchPlugin.getDefault()
.getExportWizardRegistry().getRootCategory();
WizardCollectionElement otherCategory = (WizardCollectionElement) root
.findCategory(new Path(
WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY));
// if (otherCategory == null)
// return new AdaptableList();
// return otherCategory.getWizardAdaptableList();
AdaptableList result;
if (otherCategory == null)
result = new AdaptableList();
else
result = otherCategory.getWizardAdaptableList();
AdaptableList filteredResult = new AdaptableList();
Object[] objs = result.getChildren();
for (int i = 0; i < objs.length; i++) {
WorkbenchWizardElement obj = (WorkbenchWizardElement) objs[i];
// System.out.println("$$$ INFO: WorkbenchWizardElement = " +
// obj.getId());
if (isAllowedExportWizard(obj.getId())) {
filteredResult.add(obj);
// System.out.println("$$$ INFO: WorkbenchWizardElement allowed
// = " + obj.getId());
}
}
return filteredResult;
}
private boolean isAllowedExportWizard(String id) {
for (int i = 0; i < allowed_export_wizards.length; i++) {
if (id.equals(allowed_export_wizards[i]))
return true;
}
return false;
}
}