/** * Gets the <code>SQLDevToolsConfiguration</code> object by the <code>DatabaseVendorDefinitionId</code> object * * @param id <code>DatabaseVendorDefinitionId</code> object represented by product name and version * @return <code>SQLDevToolsConfiguration</code> object */ public static SQLDevToolsConfiguration getConfigurationByVendorIdentifier(DatabaseVendorDefinitionId vendorId) { return getConfiguration(null, vendorId); }
/** * Get the ActionService by profile name. Clients need to check whether the profile exists before calling this method. * * @param profileName profile name * @return the UIComponentService */ public static ActionService getActionService(String profileName) { SQLDevToolsConfiguration conf = SQLToolsFacade.getConfigurationByProfileName(profileName); return conf.getActionService(); }
/** * Gets the <code>SQLDevToolsConfiguration</code> object by the database definition name. * * @param dbDefName database definition name, which is product name appended by "_" and version. * @return <code>SQLDevToolsConfiguration</code> object */ public static SQLDevToolsConfiguration getConfigurationByDBDefName(String dbDefName) { return getConfigurationByVendorIdentifier(new DatabaseVendorDefinitionId(dbDefName)); }
/** * Gets the <code>SQLDevToolsConfiguration</code> object. This is a utility method for * getConfigurationByProfileName(String profileName) and getDBFactoryByDBName(String dbName). It will try to use the * first parameter then the second. * * @param databaseIdentifier <code>DatabaseIdentifier</code> which contains connection profile name, can be null * @param id <code>DatabaseVendorDefinitionId</code> object represented by product name and version, can be null * @return <code>SQLDevToolsConfiguration</code> object */ public static SQLDevToolsConfiguration getConfiguration(DatabaseIdentifier databaseIdentifier, DatabaseVendorDefinitionId vendorId) { SQLDevToolsConfiguration f = null; if (databaseIdentifier != null) { // get DatabaseVendorDefinitionId from profile, then call getConfigurationByVendorIdentifier // this is to make sure we are using the REAL version f = getConfigurationByProfileName(databaseIdentifier.getProfileName()); } if (f == null && vendorId != null) { vendorId = getCanonicalDatabaseVendorDefinitionId(vendorId); f = getRegistry().getConfigurationByVendorIdentifier(vendorId); } if (f == null) { f = getDefaultConfiguration(); } return f; }
/** * Returns a DatabaseVendorDefinitionId matching the product and version. If no exact matches are found, the generic * DatabaseVendorDefinitionId (Genrice_JDBC_1.x) will be returned. * * @param product * @param version * @return */ public static DatabaseVendorDefinitionId recognize(String product, String version) { DatabaseVendorDefinitionId defaultId = getDefaultConfiguration().getDatabaseVendorDefinitionId(); Collection configs = getConfigurations(); for (Iterator iter = configs.iterator(); iter.hasNext();) { SQLDevToolsConfiguration conf = (SQLDevToolsConfiguration) iter.next(); if (conf.recognize(product, version) && !(conf.getDatabaseVendorDefinitionId().equals(defaultId))) { return conf.getDatabaseVendorDefinitionId(); } } return defaultId; }
private void createPortabilityCheckCombo(Composite parent) { Collection dbnames = SQLToolsFacade.getSupportedDBDefinitionNames(); String[] names = (String[])dbnames.toArray(new String[dbnames.size()]); String[] nameValues = new String[names.length + 1]; nameValues[0] = PreferenceMessages.GeneralPreferencePage_portable_target; // FOR CR:403675-1 remove the portability checks option that has no parser in preference page int j = 0; for (int i = 0; i < names.length; i++) { SQLDevToolsConfiguration config = SQLToolsFacade.getConfigurationByDBDefName(names[i]); SQLParser pp = config.getSQLService().getSQLParser(); //For CR:list all supported database definitions if (pp != null && pp.isComplete()) { nameValues[j + 1] = names[i]; j++; } } String[] portNameValues = new String[j + 1]; for (int i = 0; i < j + 1; i++) { portNameValues[i] = nameValues[i]; } _portabilityCheckLabel = new Label(parent, SWT.NONE); _portabilityCheckLabel.setText(PreferenceMessages.GeneralPreferencePage_portable_check); _portabilityCheckCombo = new Combo(parent, SWT.READ_ONLY); _portabilityCheckCombo.setItems(portNameValues); }
.getConfigurationByProfileName(databaseIdentifier .getProfileName()); ConnectionService conService = f.getConnectionService(); SQLEditorService s = SQLToolsFacade.getConfiguration( null, databaseIdentifier).getSQLEditorService(); if (s != null) {
/** * * @param databaseIdentifier * @return */ public static DBHelper getDBHelper(DatabaseIdentifier databaseIdentifier) { return getDBHelper(databaseIdentifier, null); }
_conn = SQLToolsFacade.getConnectionService(getDatabaseIdentifier()).createConnection( getDatabaseIdentifier(), true); SQLEditorService s = SQLToolsFacade.getConfiguration(null, getDatabaseIdentifier()).getSQLEditorService(); _extendedLaunchSupport = s.getExtendedLaunchSupport();
SQLDevToolsConfiguration f =SQLToolsFacade.getConfigurationByVendorIdentifier(_editor.getConnectionInfo().getDatabaseVendorDefinitionId()); SQLParser p = f.getSQLService().getSQLParser(); ISourceViewer viewer = _editor.getSV(); if (_portableTarget != null) SQLDevToolsConfiguration pf =SQLToolsFacade.getConfigurationByDBDefName(_portableTarget); pp = pf.getSQLService().getSQLParser(); if (pp != null && !(pp.getClass().equals(p.getClass())))
.getConfigurationByProfileName(_databaseIdentifier .getProfileName()); ConnectionService conService = f.getConnectionService(); _connid = SQLToolsFacade.getConnectionId(_databaseIdentifier, _connection); _closeCon = true;
Collection allIds = getAllAvailableDBDefinitionIds(); for (Iterator it = allIds.iterator(); it.hasNext();) DatabaseVendorDefinitionId defaultId = getDefaultConfiguration().getDatabaseVendorDefinitionId(); Collection configs = getConfigurations(); ArrayList ids = new ArrayList(); for (Iterator iter = configs.iterator(); iter.hasNext();)
DatabaseVendorDefinitionId defaultId = getDefaultConfiguration().getDatabaseVendorDefinitionId(); SQLDevToolsConfiguration f = getRegistry().getConfigurationByVendorIdentifier(vendorId); if (f != null) Collection configs = getConfigurations(); ArrayList ids = new ArrayList(); for (Iterator iter = configs.iterator(); iter.hasNext();)
SQLService helper = SQLToolsFacade.getSQLService(databaseIdentifier, "" //$NON-NLS-1$ + _request.getDatabaseDefinitionId().toString()); if (helper != null) IPlanService planService = SQLToolsFacade.getPlanService(databaseIdentifier); if (planService != null)
public static IConnectionInitializer getConnectionInitializer(DatabaseIdentifier databaseIdentifier) { ConnectionService service = getConnectionService(databaseIdentifier); if (service != null) { return service.getConnectionInitializer(); } return null; }
/** * Return a specific GenericSQLContextType object which identifies the context type of templates used in SQL editor. * * @param dbType * @return */ public static GenericSQLContextType getSQLContextType(String dbType) { SQLService service = getSQLService(null, dbType); if (service != null) { return service.getSQLContextType(); } return null; }
/** * Checks if the neccessary classes are obtainable * * @return <code>true</code> if the neccessary classes are obtainable */ protected boolean canBeEnabled() { DatabaseIdentifier databaseIdentifier = getDatabaseIdentifier(); if (databaseIdentifier == null) { return false; } IPlanService planService = SQLToolsFacade.getPlanService(databaseIdentifier); if (planService != null && planService.getPlanOption() != null) { return true; } return false; }
/** * Constructs a <code>SimpleSQLResultRunnable</code> to run the specified sql statement. * @param con the connection * @param sql the SQL statement to be run * @param closeCon whether should close connection * @param tracker if closeCon is true and tracker is not null, will notify it when close the connection * @param parentMonitor the parent monitor, used to cancel * @param databaseIdentifier contains connection information * @param configuration the launch configuration if this constructor is called by eclipse launch mechanism, or null. */ public SimpleSQLResultRunnable(Connection con, String sql, boolean closeCon, IConnectionTracker tracker, IProgressMonitor parentMonitor, DatabaseIdentifier databaseIdentifier, ILaunchConfiguration configuration) { super(SQLUtil.describeSQL(sql, SQL_SHORT_DESC_LENGTH), parentMonitor, databaseIdentifier); _connection = con; _sql = sql; _closeCon = closeCon; _tracker = tracker; _configuration = configuration; _connid = SQLToolsFacade.getConnectionId(databaseIdentifier, _connection); }
public static boolean showAction(String dbType, String actionId) { SQLDevToolsConfiguration f = null; f = getConfigurationByDBDefName(dbType); if (f != null) { return f.getActionService().supportsAction(actionId); } return false; }
/** * Returns this plug-in's context type registry. * * @return the context type registry for this plug-in instance */ public ContextTypeRegistry getTemplateContextTypeRegistry() { if (_registry == null) { // create an configure the contexts available in the template editor _registry = new ContributionContextTypeRegistry(); _registry.addContextType(GenericSQLContextType.SQL_CONTEXT_TYPE); Collection c = SQLToolsFacade.getConfigurations(); Collection ctxTypes = new ArrayList(); for (Iterator iter = c.iterator(); iter.hasNext();) { SQLDevToolsConfiguration config = (SQLDevToolsConfiguration) iter.next(); ctxTypes.add(config.getSQLService().getSQLContextType()); } for (Iterator i = ctxTypes.iterator(); i.hasNext();) { //getId() will return null before calling addContextType _registry.addContextType(((GenericSQLContextType) i.next()).getSQLContextId()); } } return _registry; }