diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java b/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java deleted file mode 100644 index 9a2b81e5cc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2008 Oracle. 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: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.db.ui.internal; - -import org.eclipse.datatools.connectivity.IConnectionProfile; -import org.eclipse.datatools.connectivity.IProfileListener; -import org.eclipse.datatools.connectivity.ProfileManager; -import org.eclipse.datatools.connectivity.db.generic.ui.wizard.NewJDBCFilteredCPWizard; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Display; - -/** - * DTP UI tools - */ -public class DTPUiTools { - - /** - * Launch the DTP New Connection Profile wizard to create a new database connection profile. - * - * Returns the name of the added profile, or null if the wizard was cancelled. - * The name can be used to build a Dali connection profile from - * JptDbPlugin.getConnectionProfileFactory().buildConnectionProfile(String). - */ - public static String createNewConnectionProfile() { - // Filter datasource category - NewJDBCFilteredCPWizard wizard = new NewJDBCFilteredCPWizard(); - WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard); - wizardDialog.setBlockOnOpen(true); - - LocalProfileListener listener = new LocalProfileListener(); - ProfileManager.getInstance().addProfileListener(listener); - - String newCPName = null; - if (wizardDialog.open() == Window.OK) { - // assume the last added profile is the one we want - newCPName = listener.addedProfile.getName(); - } - ProfileManager.getInstance().removeProfileListener(listener); - - return newCPName; - } - - - // ********** DTP profile listener ********** - - /** - * This listener simply holds on to the most recently added connection - * profile. - */ - static class LocalProfileListener implements IProfileListener { - IConnectionProfile addedProfile; - - public void profileAdded(IConnectionProfile profile) { - this.addedProfile = profile; - } - - public void profileChanged(IConnectionProfile profile) { - // do nothing - } - - public void profileDeleted(IConnectionProfile profile) { - // do nothing - } - } - - -// // ********** viewer filter ********** -// -// static class LocalViewerFilter extends ViewerFilter { -// -// private static final String DATABASE_CATEGORY_ID = "org.eclipse.datatools.connectivity.db.category"; //$NON-NLS-1$ -// -// LocalViewerFilter() { -// super(); -// } -// -// @Override -// public boolean select(Viewer viewer, Object parentElement, Object element) { -// CPWizardNode wizardNode = (CPWizardNode) element; -// IProfileWizardProvider wizardProvider = wizardNode.getProvider(); -// if (wizardProvider instanceof IWizardCategoryProvider) { -// return false; -// } -// ICategory category = ConnectionProfileManager.getInstance().getProvider( -// ((ProfileWizardProvider) wizardProvider).getProfile()).getCategory(); -// -// // Only display wizards belong to database category -// while (category != null) { -// if (category.getId().equals(DATABASE_CATEGORY_ID)) { -// return true; -// } -// category = category.getParent(); -// } -// return false; -// } -// } - -} |