1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

[216596] dstore preferences (timeout, and others)

This commit is contained in:
David McKnight 2008-01-29 15:25:21 +00:00
parent bb87b76359
commit c86b807ab0
9 changed files with 310 additions and 6 deletions

View file

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.rse.connectorservice.dstore
Bundle-SymbolicName: org.eclipse.rse.connectorservice.dstore;singleton:=true
Bundle-Version: 3.0.0.qualifier
Bundle-Activator: org.eclipse.rse.internal.connectorservice.dstore.Activator
Bundle-Localization: plugin

View file

@ -11,7 +11,8 @@
bin.includes = .,\
META-INF/,\
about.html,\
plugin.properties
plugin.properties,\
plugin.xml
source.. = src/
output.. = bin/
src.includes = about.html

View file

@ -14,3 +14,5 @@
pluginName = RSE DStore Connector Service
providerName = Eclipse.org
PreferencePage.Datastore = Datastore

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2008 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
Initial Contributors:
The following IBM employees contributed to the Remote System Explorer component
that contains this file: David McKnight
Contributors:
-->
<?eclipse version="3.0"?>
<plugin>
<extension
point="org.eclipse.ui.preferencePages">
<page
name="%PreferencePage.Datastore"
category="org.eclipse.rse.ui.preferences.RemoteSystemsPreferencePage"
class="org.eclipse.rse.internal.connectorservice.dstore.ui.propertypages.DStorePreferencePage"
id="org.eclipse.rse.connectorservice.DStorePreferences">
</page>
</extension>
</plugin>

View file

@ -20,6 +20,7 @@
* David McKnight (IBM) - [205986] attempt SSL before non-SSL for daemon connect
* David McKnight (IBM) - [186363] get rid of obsolete calls to SubSystem.connect()
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
* David McKnight (IBM) - [216596] dstore preferences (timeout, and others)
********************************************************************************/
package org.eclipse.rse.connectorservice.dstore;
@ -908,8 +909,11 @@ public class DStoreConnectorService extends StandardConnectorService implements
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_SERVER_OLDER_WARNING);
msg.makeSubstitution(getHostName());
}
ShowConnectMessage msgAction = new ShowConnectMessage(msg);
Display.getDefault().asyncExec(msgAction);
if (store.getBoolean(IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER)){
DisplayHidableSystemMessageAction msgAction = new DisplayHidableSystemMessageAction(msg, store, IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER, false);
Display.getDefault().syncExec(msgAction);
}
}
// register the classloader for this plugin with the datastore
@ -919,7 +923,6 @@ public class DStoreConnectorService extends StandardConnectorService implements
if (serverVersion >= 8 || (serverVersion == 7 && getServerMinor() >= 1))
{
// register the preference for remote class caching with the datastore
store.setDefault(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES, IUniversalDStoreConstants.DEFAULT_PREF_CACHE_REMOTE_CLASSES);
boolean cacheRemoteClasses = store.getBoolean(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES);
dataStore.setPreference(RemoteClassLoader.CACHING_PREFERENCE, cacheRemoteClasses ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
@ -938,7 +941,7 @@ public class DStoreConnectorService extends StandardConnectorService implements
monitor.subTask(imsg.getLevelOneText());
}
DataElement initStatus = dataStore.initMiners();
statusMonitor.waitForUpdate(schemaStatus);
//statusMonitor.waitForUpdate(schemaStatus);
statusMonitor.waitForUpdate(initStatus);
}
//long t2 = System.currentTimeMillis();

View file

@ -13,6 +13,7 @@
*
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [216596] dstore preferences (timeout, and others)
*******************************************************************************/
package org.eclipse.rse.connectorservice.dstore;
@ -64,4 +65,7 @@ public interface IUniversalDStoreConstants
public static final String RESID_PREF_DO_KEEPALIVE = RESID_PREF_PREFIX + "dokeepalive"; //$NON-NLS-1$
public static final boolean DEFAULT_PREF_DO_KEEPALIVE = true;
public static final String ALERT_MISMATCHED_SERVER = RESID_PREFIX + "alert.mismatched.server"; //$NON-NLS-1$
public static final boolean DEFAULT_ALERT_MISMATCHED_SERVER = true;
}

View file

@ -0,0 +1,40 @@
/********************************************************************************
* Copyright (c) 2008 IBM Corporation. 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
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight.
*
* Contributors:
* David McKnight (IBM) - [216596] dstore preferences (timeout, and others)
********************************************************************************/
package org.eclipse.rse.internal.connectorservice.dstore;
import org.eclipse.osgi.util.NLS;
public class DStoreResources extends NLS {
private static String BUNDLE_NAME = "org.eclipse.rse.internal.connectorservice.dstore.DStoreResources"; //$NON-NLS-1$
public static String RESID_PREFERENCE_CONNECTION_TIMEOUT_LABEL;
public static String RESID_PREFERENCE_CONNECTION_TIMEOUT_TOOLTIP;
public static String RESID_PREFERENCE_DO_KEEPALIVE_LABEL;
public static String RESID_PREFERENCE_DO_KEEPALIVE_TOOLTIP;
public static String RESID_PREFERENCE_CACHE_REMOTE_CLASSES_LABEL;
public static String RESID_PREFERENCE_CACHE_REMOTE_CLASSES_TOOLTIP;
public static String RESID_PREFERENCE_SHOW_MISMATCHED_SERVER_LABEL;
public static String RESID_PREFERENCE_SHOW_MISMATCHED_SERVER_TOOLTIP;
static
{
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, DStoreResources.class);
}
}

View file

@ -0,0 +1,29 @@
################################################################################
# Copyright (c) 2008 IBM Corporation. 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
#
# Initial Contributors:
# The following IBM employees contributed to the Remote System Explorer
# component that contains this file: David McKnight
# Contributors:
# David McKnight (IBM) - [216596] dstore preferences (timeout, and others)
#################################################################################
# NLS_MESSAGEFORMAT_VAR
# NLS_ENCODING=UTF-8
RESID_PREFERENCE_CONNECTION_TIMEOUT_LABEL=Connection Timeout (ms)
RESID_PREFERENCE_CONNECTION_TIMEOUT_TOOLTIP=Time to wait for establishing a Datastore connection.
RESID_PREFERENCE_DO_KEEPALIVE_LABEL=Enable Keepalive
RESID_PREFERENCE_DO_KEEPALIVE_TOOLTIP=Keep Datastore connections alive when idle.
RESID_PREFERENCE_CACHE_REMOTE_CLASSES_LABEL=Cache Remote Classes
RESID_PREFERENCE_CACHE_REMOTE_CLASSES_TOOLTIP=Cache remote server classes. This is only useful when all required classes are unavailable on the server side.
RESID_PREFERENCE_SHOW_MISMATCHED_SERVER_LABEL=Show Mismatched Server Warning
RESID_PREFERENCE_SHOW_MISMATCHED_SERVER_TOOLTIP=Show a warning when the DataStore server is compatible but older or newer then the current client.

View file

@ -0,0 +1,200 @@
/********************************************************************************
* Copyright (c) 2008 IBM Corporation. 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
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight.
*
* Contributors:
* David McKnight (IBM) - [216596] dstore preferences (timeout, and others)
********************************************************************************/
package org.eclipse.rse.internal.connectorservice.dstore.ui.propertypages;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.rse.connectorservice.dstore.IUniversalDStoreConstants;
import org.eclipse.rse.internal.connectorservice.dstore.DStoreResources;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
public class DStorePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener
{
private Text _connectionTimeout;
private Button _doKeepaliveButton;
private Button _cacheRemoteClassesButton;
private Button _showMismatchedServerWarningButton;
protected Control createContents(Composite gparent) {
Composite parent = SystemWidgetHelpers.createComposite(gparent, 2);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
parent.setLayout(layout);
parent.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
SystemWidgetHelpers.createLabel(parent, DStoreResources.RESID_PREFERENCE_CONNECTION_TIMEOUT_LABEL);
_connectionTimeout = new Text(parent, SWT.BORDER);
GridData gd = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
gd.widthHint = 75;
_connectionTimeout.setLayoutData(gd);
_connectionTimeout.setTextLimit(5);
_connectionTimeout.setToolTipText(DStoreResources.RESID_PREFERENCE_CONNECTION_TIMEOUT_TOOLTIP);
_connectionTimeout.addVerifyListener(new VerifyListener()
{
public void verifyText(VerifyEvent e)
{
e.doit = true;
for (int loop = 0; loop < e.text.length(); loop++)
{
if (!Character.isDigit(e.text.charAt(loop)))
e.doit = false;
}
}
});
_doKeepaliveButton = SystemWidgetHelpers.createCheckBox(parent, DStoreResources.RESID_PREFERENCE_DO_KEEPALIVE_LABEL, this);
_doKeepaliveButton.setToolTipText(DStoreResources.RESID_PREFERENCE_DO_KEEPALIVE_TOOLTIP);
_doKeepaliveButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false));
((GridData)_doKeepaliveButton.getLayoutData()).horizontalSpan = 2;
_cacheRemoteClassesButton = SystemWidgetHelpers.createCheckBox(parent, DStoreResources.RESID_PREFERENCE_CACHE_REMOTE_CLASSES_LABEL, this);
_cacheRemoteClassesButton.setToolTipText(DStoreResources.RESID_PREFERENCE_CACHE_REMOTE_CLASSES_TOOLTIP);
_cacheRemoteClassesButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false));
((GridData)_cacheRemoteClassesButton.getLayoutData()).horizontalSpan = 2;
_showMismatchedServerWarningButton = SystemWidgetHelpers.createCheckBox(parent, DStoreResources.RESID_PREFERENCE_SHOW_MISMATCHED_SERVER_LABEL, this);
_showMismatchedServerWarningButton.setToolTipText(DStoreResources.RESID_PREFERENCE_SHOW_MISMATCHED_SERVER_TOOLTIP);
_showMismatchedServerWarningButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false));
((GridData)_showMismatchedServerWarningButton.getLayoutData()).horizontalSpan = 2;
initControls();
return parent;
}
private void initControls()
{
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
// timeout
int timeout = 0;
if (store.contains(IUniversalDStoreConstants.RESID_PREF_SOCKET_TIMEOUT)){
timeout = store.getInt(IUniversalDStoreConstants.RESID_PREF_SOCKET_TIMEOUT);
}
else {
timeout = IUniversalDStoreConstants.DEFAULT_PREF_SOCKET_TIMEOUT;
store.setDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_TIMEOUT, timeout);
}
_connectionTimeout.setText(""+timeout); //$NON-NLS-1$
// cache remote classes
boolean cacheRemoteClasses = false;
if (store.contains(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES)) {
cacheRemoteClasses = store.getBoolean(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES);
}
else {
cacheRemoteClasses = IUniversalDStoreConstants.DEFAULT_PREF_CACHE_REMOTE_CLASSES;
store.setDefault(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES, cacheRemoteClasses);
}
_cacheRemoteClassesButton.setSelection(cacheRemoteClasses);
// do keepalive
boolean doKeepalive = false;
if (store.contains(IUniversalDStoreConstants.RESID_PREF_DO_KEEPALIVE)){
doKeepalive = store.getBoolean(IUniversalDStoreConstants.RESID_PREF_DO_KEEPALIVE);
}
else {
doKeepalive = IUniversalDStoreConstants.DEFAULT_PREF_DO_KEEPALIVE;
store.setDefault(IUniversalDStoreConstants.RESID_PREF_DO_KEEPALIVE, doKeepalive);
}
_doKeepaliveButton.setSelection(doKeepalive);
// show mismatched server warning
boolean showMismatchedWarning = false;
if (store.contains(IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER)){
showMismatchedWarning = store.getBoolean(IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER);
}
else {
showMismatchedWarning = IUniversalDStoreConstants.DEFAULT_ALERT_MISMATCHED_SERVER;
store.setDefault(IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER, showMismatchedWarning);
}
_showMismatchedServerWarningButton.setSelection(showMismatchedWarning);
}
protected void performApply() {
super.performApply();
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
// timeout
String timeoutStr = _connectionTimeout.getText();
int timeout = Integer.parseInt(timeoutStr);
store.setValue(IUniversalDStoreConstants.RESID_PREF_SOCKET_TIMEOUT, timeout);
// do keepalive
boolean doKeepalive = _doKeepaliveButton.getSelection();
store.setValue(IUniversalDStoreConstants.RESID_PREF_DO_KEEPALIVE, doKeepalive);
// cache remote classes
boolean cacheRemoteClasses = _cacheRemoteClassesButton.getSelection();
store.setValue(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES, cacheRemoteClasses);
// show mismatched server warning
boolean showMismatchedWarning = _showMismatchedServerWarningButton.getSelection();
store.setValue(IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER, showMismatchedWarning);
}
protected void performDefaults() {
super.performDefaults();
int timeout = IUniversalDStoreConstants.DEFAULT_PREF_SOCKET_TIMEOUT;
_connectionTimeout.setText(""+timeout); //$NON-NLS-1$
// do keepalive
boolean doKeepalive = IUniversalDStoreConstants.DEFAULT_PREF_DO_KEEPALIVE;
_doKeepaliveButton.setSelection(doKeepalive);
// show mismatched server warning
boolean showMismatchedWarning = IUniversalDStoreConstants.DEFAULT_ALERT_MISMATCHED_SERVER;
_showMismatchedServerWarningButton.setSelection(showMismatchedWarning);
// cache remote classes
boolean cacheRemoteClasses = IUniversalDStoreConstants.DEFAULT_PREF_CACHE_REMOTE_CLASSES;
_cacheRemoteClassesButton.setSelection(cacheRemoteClasses);
}
public void init(IWorkbench workbench) {
}
public void handleEvent(Event event) {
// TODO Auto-generated method stub
}
}