mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
[235626] Convert examples to MessageBundle format
This commit is contained in:
parent
19fdbcabac
commit
e97b62b224
13 changed files with 280 additions and 253 deletions
|
@ -319,7 +319,7 @@
|
|||
<feature url="features/org.eclipse.rse.telnet_2.1.0.qualifier.jar" id="org.eclipse.rse.telnet" version="2.1.0.qualifier">
|
||||
<category name="TM and RSE 3.0"/>
|
||||
</feature>
|
||||
<feature url="features/org.eclipse.rse.examples_2.1.0.qualifier.jar" id="org.eclipse.rse.examples" version="2.1.0.qualifier">
|
||||
<feature url="features/org.eclipse.rse.examples_3.0.0.qualifier.jar" id="org.eclipse.rse.examples" version="3.0.0.qualifier">
|
||||
<category name="TM and RSE 3.0"/>
|
||||
</feature>
|
||||
<feature url="features/org.eclipse.rse.remotecdt_2.1.0.qualifier.jar" id="org.eclipse.rse.remotecdt" version="2.1.0.qualifier">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<feature
|
||||
id="org.eclipse.rse.examples"
|
||||
label="%featureName"
|
||||
version="2.1.0.qualifier"
|
||||
version="3.0.0.qualifier"
|
||||
provider-name="%providerName"
|
||||
plugin="org.eclipse.rse.examples.tutorial"
|
||||
image="eclipse_update_120.jpg">
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.rse.examples.tutorial;singleton:=true
|
||||
Bundle-Version: 2.0.100.qualifier
|
||||
Bundle-Version: 3.0.0.qualifier
|
||||
Bundle-Activator: samples.RSESamplesPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
|
||||
* Copyright (c) 2006, 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
|
||||
* 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, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert examples to MessageBundle format
|
||||
********************************************************************************/
|
||||
|
||||
package samples;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IAdapterManager;
|
||||
|
@ -37,9 +35,8 @@ public class RSESamplesPlugin extends SystemBasePlugin {
|
|||
//The shared instance.
|
||||
private static RSESamplesPlugin plugin;
|
||||
//Resource bundle.
|
||||
private ResourceBundle resourceBundle;
|
||||
private static SystemMessageFile messageFile = null;
|
||||
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*/
|
||||
|
@ -63,7 +60,6 @@ public class RSESamplesPlugin extends SystemBasePlugin {
|
|||
|
||||
DeveloperSubSystemConfigurationAdapterFactory sscaf = new DeveloperSubSystemConfigurationAdapterFactory();
|
||||
sscaf.registerWithManager(manager);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -73,12 +69,11 @@ public class RSESamplesPlugin extends SystemBasePlugin {
|
|||
public void stop(BundleContext context) throws Exception {
|
||||
super.stop(context);
|
||||
plugin = null;
|
||||
resourceBundle = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance.
|
||||
* @return the shared instance
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static RSESamplesPlugin getDefault() {
|
||||
return plugin;
|
||||
|
@ -92,46 +87,6 @@ public class RSESamplesPlugin extends SystemBasePlugin {
|
|||
return ResourcesPlugin.getWorkspace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string from the plugin's resource bundle,
|
||||
* or 'key' if not found.
|
||||
* @see java.util.ResourceBundle#getString(String)
|
||||
*
|
||||
* @param key the key for the desired string
|
||||
* @return the string for the given key
|
||||
*/
|
||||
public static String getResourceString(String key) {
|
||||
ResourceBundle bundle= RSESamplesPlugin.getDefault().getResourceBundle();
|
||||
try {
|
||||
return (bundle != null) ? bundle.getString(key) : key;
|
||||
} catch (MissingResourceException e) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin's Resource bundle.
|
||||
* @return the Resource bundle
|
||||
*/
|
||||
public ResourceBundle getResourceBundle() {
|
||||
try {
|
||||
if (resourceBundle == null)
|
||||
resourceBundle = ResourceBundle.getBundle("samples.rseSamplesResources"); //$NON-NLS-1$
|
||||
} catch (MissingResourceException x) {
|
||||
resourceBundle = null;
|
||||
}
|
||||
return resourceBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractUIPlugin#initializeDefaultPreferences
|
||||
*/
|
||||
//protected void initializeDefaultPreferences(IPreferenceStore store)
|
||||
//{
|
||||
// super.initializeDefaultPreferences(store);
|
||||
// //RSESamplesPreferencePage.initDefaults(store);
|
||||
//}
|
||||
|
||||
/**
|
||||
* Initialize the image registry by declaring all of the required graphics.
|
||||
*/
|
||||
|
@ -151,25 +106,25 @@ public class RSESamplesPlugin extends SystemBasePlugin {
|
|||
*/
|
||||
public SystemMessageFile getMessageFile(String messageFileName)
|
||||
{
|
||||
return loadMessageFile(getBundle(), messageFileName);
|
||||
}
|
||||
return loadMessageFile(getBundle(), messageFileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return our message file.
|
||||
*
|
||||
*
|
||||
* @return the RSE message file
|
||||
*/
|
||||
public static SystemMessageFile getPluginMessageFile()
|
||||
{
|
||||
return messageFile;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a message from this plugin's message file,
|
||||
* or <code>null</code> if the message cannot be found.
|
||||
* @see SystemMessageFile#getMessage(String)
|
||||
*
|
||||
* @param msgId message id
|
||||
*
|
||||
* @param msgId message id
|
||||
* @return the message object referenced by the given id
|
||||
*/
|
||||
public static SystemMessage getPluginMessage(String msgId)
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. 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:
|
||||
* Martin Oberhuber (Wind River) - [235626] initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package samples;
|
||||
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
public class RSESamplesResources extends NLS {
|
||||
private static String BUNDLE_NAME = "samples.rseSamplesResources"; //$NON-NLS-1$
|
||||
|
||||
public static String pp_size_label;
|
||||
public static String pp_size_tooltip;
|
||||
public static String pp_files_label;
|
||||
public static String pp_files_tooltip;
|
||||
public static String pp_folders_label;
|
||||
public static String pp_folders_tooltip;
|
||||
public static String pp_stopButton_label;
|
||||
public static String pp_stopButton_tooltip;
|
||||
|
||||
// Tutorial #3: Creating a Subsystem Configuration
|
||||
public static String connectorservice_devr_name;
|
||||
public static String connectorservice_devr_desc;
|
||||
|
||||
public static String property_devr_resource_type;
|
||||
public static String property_devr_id_name;
|
||||
public static String property_devr_id_desc;
|
||||
public static String property_devr_dept_name;
|
||||
public static String property_devr_dept_desc;
|
||||
public static String property_team_resource_type;
|
||||
public static String filter_default_name;
|
||||
|
||||
// Tutorial #3a: Adding a Custom Filter
|
||||
public static String property_type_teamfilter;
|
||||
public static String property_type_devrfilter;
|
||||
|
||||
public static String filter_team_dlgtitle;
|
||||
public static String filter_team_pagetitle;
|
||||
public static String filter_team_pagetext;
|
||||
|
||||
public static String filter_devr_dlgtitle;
|
||||
public static String filter_devr_pagetitle;
|
||||
public static String filter_devr_pagetext;
|
||||
public static String filter_devr_teamprompt_label;
|
||||
public static String filter_devr_teamprompt_tooltip;
|
||||
public static String filter_devr_devrprompt_label;
|
||||
public static String filter_devr_devrprompt_tooltip;
|
||||
|
||||
static {
|
||||
NLS.initializeMessages(BUNDLE_NAME, RSESamplesResources.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -7,13 +7,14 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
* Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert examples to MessageBundle format
|
||||
*******************************************************************************/
|
||||
|
||||
package samples.model;
|
||||
|
@ -30,6 +31,7 @@ import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
|||
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
import samples.RSESamplesResources;
|
||||
|
||||
/**
|
||||
* This is the adapter which enables us to work with our remote developer resources.
|
||||
|
@ -39,7 +41,7 @@ public class DeveloperResourceAdapter extends AbstractSystemViewAdapter
|
|||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor
|
||||
*/
|
||||
public DeveloperResourceAdapter() {
|
||||
super();
|
||||
|
@ -84,7 +86,7 @@ public class DeveloperResourceAdapter extends AbstractSystemViewAdapter
|
|||
*/
|
||||
public String getType(Object element)
|
||||
{
|
||||
return RSESamplesPlugin.getResourceString("property.devr_resource.type"); //$NON-NLS-1$
|
||||
return RSESamplesResources.property_devr_resource_type;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,32 +116,32 @@ public class DeveloperResourceAdapter extends AbstractSystemViewAdapter
|
|||
*/
|
||||
protected IPropertyDescriptor[] internalGetPropertyDescriptors()
|
||||
{
|
||||
// the following array should be made static to it isn't created every time
|
||||
// the following array should be made static to it isn't created every time
|
||||
PropertyDescriptor[] ourPDs = new PropertyDescriptor[2];
|
||||
ourPDs[0] = new PropertyDescriptor("devr_id", //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("property.devr_id.name")); //$NON-NLS-1$
|
||||
RSESamplesResources.property_devr_id_name);
|
||||
ourPDs[0].setDescription(
|
||||
RSESamplesPlugin.getResourceString("property.devr_id.desc")); //$NON-NLS-1$
|
||||
RSESamplesResources.property_devr_id_desc);
|
||||
ourPDs[1] = new PropertyDescriptor("devr_dept", //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("property.devr_dept.name")); //$NON-NLS-1$
|
||||
RSESamplesResources.property_devr_dept_name);
|
||||
ourPDs[1].setDescription(
|
||||
RSESamplesPlugin.getResourceString("property.devr_dept.desc")); //$NON-NLS-1$
|
||||
RSESamplesResources.property_devr_dept_desc);
|
||||
return ourPDs;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
|
||||
*/
|
||||
protected Object internalGetPropertyValue(Object key)
|
||||
{
|
||||
// propertySourceInput holds the currently selected object
|
||||
DeveloperResource devr = (DeveloperResource)propertySourceInput;
|
||||
DeveloperResource devr = (DeveloperResource)propertySourceInput;
|
||||
if (key.equals("devr_id")) //$NON-NLS-1$
|
||||
return devr.getId();
|
||||
else if (key.equals("devr_dept")) //$NON-NLS-1$
|
||||
return devr.getDeptNbr();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// --------------------------------------
|
||||
// ISystemRemoteElementAdapter methods...
|
||||
// --------------------------------------
|
||||
|
@ -157,7 +159,7 @@ public class DeveloperResourceAdapter extends AbstractSystemViewAdapter
|
|||
*/
|
||||
public String getSubSystemConfigurationId(Object element)
|
||||
{
|
||||
return "samples.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
|
||||
return "samples.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -7,14 +7,15 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
* Xuan Chen (IBM) - [160775] [api] [breaking] [nl] rename (at least within a zip) blocks UI thread
|
||||
* Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert examples to MessageBundle format
|
||||
*******************************************************************************/
|
||||
|
||||
package samples.model;
|
||||
|
@ -30,6 +31,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
import samples.RSESamplesResources;
|
||||
import samples.subsystems.DeveloperSubSystem;
|
||||
|
||||
/**
|
||||
|
@ -84,7 +86,7 @@ public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
*/
|
||||
public String getType(Object element)
|
||||
{
|
||||
return RSESamplesPlugin.getResourceString("property.team_resource.type"); //$NON-NLS-1$
|
||||
return RSESamplesResources.property_team_resource_type;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -94,7 +96,7 @@ public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
{
|
||||
return null; // not really used, which is good because it is ambiguous
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(java.lang.Object)
|
||||
*/
|
||||
|
@ -126,22 +128,22 @@ public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Intercept of parent method to indicate these objects
|
||||
* can be renamed using the RSE-supplied rename action.
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#canRename(java.lang.Object)
|
||||
*/
|
||||
public boolean canRename(Object element)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Intercept of parent method to actually do the rename. RSE supplies the rename GUI, but
|
||||
* Intercept of parent method to actually do the rename. RSE supplies the rename GUI, but
|
||||
* defers the action work of renaming to this adapter method.
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#doRename(Shell, Object, String, IProgressMonitor)
|
||||
*/
|
||||
public boolean doRename(Shell shell, Object element, String newName, IProgressMonitor monitor)
|
||||
|
@ -149,7 +151,7 @@ public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
((TeamResource)element).setName(newName);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------
|
||||
// ISystemRemoteElementAdapter methods...
|
||||
// --------------------------------------
|
||||
|
@ -167,7 +169,7 @@ public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
*/
|
||||
public String getSubSystemConfigurationId(Object element)
|
||||
{
|
||||
return "samples.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
|
||||
return "samples.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -210,7 +212,7 @@ public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
*/
|
||||
public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception
|
||||
{
|
||||
return null; // maybe this would be a Project or Roster object, or leave as null if this is the root
|
||||
return null; // maybe this would be a Project or Roster object, or leave as null if this is the root
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -224,6 +226,6 @@ public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
String[] allNames = new String[allTeams.length];
|
||||
for (int idx=0; idx<allTeams.length; idx++)
|
||||
allNames[idx] = allTeams[idx].getName();
|
||||
return allNames; // Return list of all team names
|
||||
return allNames; // Return list of all team names
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||
# Copyright (c) 2006, 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
|
||||
|
@ -13,45 +13,46 @@
|
|||
#
|
||||
# Contributors:
|
||||
# Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
# Martin Oberhuber (Wind River) - [235626] Convert examples to MessageBundle format
|
||||
###############################################################################
|
||||
|
||||
# NLS_MESSAGEFORMAT_VAR
|
||||
# NLS_ENCODING=UTF-8
|
||||
|
||||
# Tutorial #2: Creating a Remote Resource Property Page
|
||||
pp.size.label=Size
|
||||
pp.size.tooltip=Cumulative size, in bytes
|
||||
pp.files.label=Files
|
||||
pp.files.tooltip=Cumulative number of files
|
||||
pp.folders.label=Folders
|
||||
pp.folders.tooltip=Cumulative number of folders
|
||||
pp.stopButton.label=Stop
|
||||
pp.stopButton.tooltip=Cancel the thread
|
||||
pp_size_label=Size
|
||||
pp_size_tooltip=Cumulative size, in bytes
|
||||
pp_files_label=Files
|
||||
pp_files_tooltip=Cumulative number of files
|
||||
pp_folders_label=Folders
|
||||
pp_folders_tooltip=Cumulative number of folders
|
||||
pp_stopButton_label=Stop
|
||||
pp_stopButton_tooltip=Cancel the thread
|
||||
|
||||
# Tutorial #3: Creating a Subsystem Configuration
|
||||
connectorservice.devr.name=DeveloperConnectorService
|
||||
connectorservice.devr.desc=Manages connections to faked remote developer resources.
|
||||
connectorservice_devr_name=DeveloperConnectorService
|
||||
connectorservice_devr_desc=Manages connections to faked remote developer resources.
|
||||
|
||||
property.devr_resource.type=Developer resource
|
||||
property.devr_id.name=Id
|
||||
property.devr_id.desc=ID number
|
||||
property.devr_dept.name=Department
|
||||
property.devr_dept.desc=Department number
|
||||
property.team_resource.type=Team resource
|
||||
filter.default.name=All Teams
|
||||
property_devr_resource_type=Developer resource
|
||||
property_devr_id_name=Id
|
||||
property_devr_id_desc=ID number
|
||||
property_devr_dept_name=Department
|
||||
property_devr_dept_desc=Department number
|
||||
property_team_resource_type=Team resource
|
||||
filter_default_name=All Teams
|
||||
|
||||
# Tutorial #3a: Adding a Custom Filter
|
||||
property.type.teamfilter=Team filter
|
||||
property.type.devrfilter=Developer filter
|
||||
property_type_teamfilter=Team filter
|
||||
property_type_devrfilter=Developer filter
|
||||
|
||||
filter.team.dlgtitle=Change Team Filter
|
||||
filter.team.pagetitle=Team Filter
|
||||
filter.team.pagetext=Create a new filter to list teams
|
||||
filter_team_dlgtitle=Change Team Filter
|
||||
filter_team_pagetitle=Team Filter
|
||||
filter_team_pagetext=Create a new filter to list teams
|
||||
|
||||
filter.devr.dlgtitle=Change Developer Filter
|
||||
filter.devr.pagetitle=Developer Filter
|
||||
filter.devr.pagetext=Create a new filter to list developers
|
||||
filter.devr.teamprompt.label=Parent team
|
||||
filter.devr.teamprompt.tooltip=Specify the team within which to list developers
|
||||
filter.devr.devrprompt.label=Developers
|
||||
filter.devr.devrprompt.tooltip=Specify a simple or generic developer name pattern
|
||||
filter_devr_dlgtitle=Change Developer Filter
|
||||
filter_devr_pagetitle=Developer Filter
|
||||
filter_devr_pagetext=Create a new filter to list developers
|
||||
filter_devr_teamprompt_label=Parent team
|
||||
filter_devr_teamprompt_tooltip=Specify the team within which to list developers
|
||||
filter_devr_devrprompt_label=Developers
|
||||
filter_devr_devrprompt_tooltip=Specify a simple or generic developer name pattern
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
|
||||
* Copyright (c) 2006, 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
|
||||
* 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, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert examples to MessageBundle format
|
||||
********************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
@ -21,7 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.subsystems.BasicConnectorService;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
import samples.RSESamplesResources;
|
||||
|
||||
/**
|
||||
* Our system class that manages connecting to, and disconnecting from,
|
||||
|
@ -38,8 +39,7 @@ public class DeveloperConnectorService extends BasicConnectorService {
|
|||
public DeveloperConnectorService(IHost host)
|
||||
{
|
||||
super(
|
||||
RSESamplesPlugin.getResourceString("connectorservice.devr.name"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("connectorservice.devr.desc"), //$NON-NLS-1$
|
||||
RSESamplesResources.connectorservice_devr_name, RSESamplesResources.connectorservice_devr_desc,
|
||||
host,
|
||||
0
|
||||
);
|
||||
|
@ -52,7 +52,7 @@ public class DeveloperConnectorService extends BasicConnectorService {
|
|||
{
|
||||
return connected;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalConnect(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2006, 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
|
||||
|
@ -7,12 +7,13 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert examples to MessageBundle format
|
||||
*******************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
@ -28,7 +29,7 @@ import org.eclipse.swt.widgets.Control;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
import samples.RSESamplesResources;
|
||||
|
||||
/**
|
||||
* Our specialized filter string edit pane for developer filters.
|
||||
|
@ -52,75 +53,75 @@ public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
|
|||
* This is where we populate the client area.
|
||||
* @param parent - the composite that will be the parent of the returned client area composite
|
||||
* @return Control - a client-area composite populated with widgets.
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.rse.ui.SystemWidgetHelpers
|
||||
*/
|
||||
public Control createContents(Composite parent)
|
||||
{
|
||||
public Control createContents(Composite parent)
|
||||
{
|
||||
// Inner composite
|
||||
int nbrColumns = 1;
|
||||
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||
((GridLayout)composite_prompts.getLayout()).marginWidth = 0;
|
||||
|
||||
|
||||
// CREATE TEAM-PARENT PROMPT
|
||||
textTeam = SystemWidgetHelpers.createLabeledTextField(
|
||||
composite_prompts,
|
||||
null,
|
||||
RSESamplesPlugin.getResourceString("filter.devr.teamprompt.label"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("filter.devr.teamprompt.tooltip") //$NON-NLS-1$
|
||||
);
|
||||
RSESamplesResources.filter_devr_teamprompt_label,
|
||||
RSESamplesResources.filter_devr_teamprompt_tooltip
|
||||
);
|
||||
|
||||
// CREATE DEVELOPER PROMPT
|
||||
textDevr = SystemWidgetHelpers.createLabeledTextField(
|
||||
composite_prompts,
|
||||
null,
|
||||
RSESamplesPlugin.getResourceString("filter.devr.devrprompt.label"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("filter.devr.devrprompt.tooltip") //$NON-NLS-1$
|
||||
);
|
||||
|
||||
RSESamplesResources.filter_devr_devrprompt_label,
|
||||
RSESamplesResources.filter_devr_devrprompt_tooltip
|
||||
);
|
||||
|
||||
resetFields();
|
||||
doInitializeFields();
|
||||
|
||||
|
||||
// add keystroke listeners...
|
||||
textTeam.addModifyListener(
|
||||
new ModifyListener()
|
||||
new ModifyListener()
|
||||
{
|
||||
public void modifyText(ModifyEvent e)
|
||||
public void modifyText(ModifyEvent e)
|
||||
{
|
||||
validateStringInput();
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
textDevr.addModifyListener(
|
||||
new ModifyListener()
|
||||
new ModifyListener()
|
||||
{
|
||||
public void modifyText(ModifyEvent e)
|
||||
public void modifyText(ModifyEvent e)
|
||||
{
|
||||
validateStringInput();
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
setEditable(editable);
|
||||
return composite_prompts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Return the control to recieve initial focus.
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane#getInitialFocusControl()
|
||||
*/
|
||||
public Control getInitialFocusControl()
|
||||
{
|
||||
return textTeam;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Initialize the input fields based on the inputFilterString, and perhaps refProvider.
|
||||
* This can be called before createContents, so test for null widgets first!
|
||||
* Prior to this being called, resetFields is called to set the initial default state prior to input
|
||||
*/
|
||||
*/
|
||||
protected void doInitializeFields()
|
||||
{
|
||||
if (textTeam == null)
|
||||
|
@ -137,7 +138,7 @@ public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane#setEditable(boolean)
|
||||
*/
|
||||
|
@ -146,19 +147,19 @@ public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
|
|||
enable(textDevr, editable);
|
||||
enable(textTeam, editable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override of parent method.
|
||||
* This is called in the change filter dialog when the user selects "new", or selects another string.
|
||||
*/
|
||||
protected void resetFields()
|
||||
{
|
||||
textTeam.setText(""); //$NON-NLS-1$
|
||||
textTeam.setText(""); //$NON-NLS-1$
|
||||
textDevr.setText("*"); //$NON-NLS-1$
|
||||
}
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Called by parent to decide if information is complete enough to enable finish.
|
||||
* Called by parent to decide if information is complete enough to enable finish.
|
||||
*/
|
||||
protected boolean areFieldsComplete()
|
||||
{
|
||||
|
@ -167,13 +168,13 @@ public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
|
|||
else
|
||||
return (textTeam.getText().trim().length()>0) && (textDevr.getText().trim().length()>0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Get the filter string in its current form.
|
||||
* Get the filter string in its current form.
|
||||
* Functional opposite of doInitializeFields, which tears apart the input string in update mode,
|
||||
* to populate the GUIs. This method creates the filter string from the information in the GUI.
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane#getFilterString()
|
||||
*/
|
||||
public String getFilterString()
|
||||
|
@ -186,19 +187,19 @@ public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
|
|||
String devrName = textDevr.getText().trim();
|
||||
return teamName + "/" + devrName; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method.
|
||||
* Does complete verification of input fields. If this
|
||||
* Does complete verification of input fields. If this
|
||||
* method returns null, there are no errors and the dialog or wizard can close.
|
||||
*
|
||||
* @return error message if there is one, else null if ok
|
||||
*/
|
||||
public SystemMessage verify()
|
||||
public SystemMessage verify()
|
||||
{
|
||||
errorMessage = null;
|
||||
|
||||
|
||||
/*
|
||||
Control controlInError = null;
|
||||
errorMessage = validateTeamInput(); // todo: implement if we want to syntax check input
|
||||
|
@ -210,14 +211,14 @@ public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane {
|
|||
if (errorMessage != null)
|
||||
controlInError = textDevr;
|
||||
}
|
||||
|
||||
|
||||
if (errorMessage != null)
|
||||
{
|
||||
if (controlInError != null)
|
||||
controlInError.setFocus();
|
||||
}
|
||||
*/
|
||||
return errorMessage;
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert examples to MessageBundle format
|
||||
*******************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
@ -25,7 +26,7 @@ import org.eclipse.rse.core.subsystems.IConnectorService;
|
|||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
import samples.RSESamplesResources;
|
||||
|
||||
/**
|
||||
* This is our subsystem factory, which creates instances of our subsystems,
|
||||
|
@ -71,33 +72,37 @@ public class DeveloperSubSystemConfiguration extends SubSystemConfiguration {
|
|||
//--tutorial part 1
|
||||
//mgr.createSystemFilter(defaultPool, "All teams", strings);
|
||||
//--tutorial part 2
|
||||
ISystemFilter filter = mgr.createSystemFilter(defaultPool,
|
||||
RSESamplesPlugin.getResourceString("filter.default.name"), //$NON-NLS-1$
|
||||
ISystemFilter filter = mgr.createSystemFilter(defaultPool,
|
||||
RSESamplesResources.filter_default_name,
|
||||
strings );
|
||||
filter.setType("team"); //$NON-NLS-1$
|
||||
} catch (Exception exc) {}
|
||||
return defaultPool;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Intercept of parent method so we can supply our own value shown in the property
|
||||
* sheet for the "type" property when a filter is selected within our subsystem.
|
||||
* Intercept of parent method so we can supply our own value shown in the
|
||||
* property sheet for the "type" property when a filter is selected within
|
||||
* our subsystem.
|
||||
*
|
||||
* Requires this line in rseSamplesResources.properties:
|
||||
* property_type_teamfilter=Team filter
|
||||
*
|
||||
* Requires this line in rseSamplesResources.properties: property.type.teamfilter=Team filter
|
||||
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getTranslatedFilterTypeProperty(org.eclipse.rse.core.filters.ISystemFilter)
|
||||
*/
|
||||
public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter)
|
||||
{
|
||||
//--tutorial part 1
|
||||
//return RSESamplesPlugin.getResourceString("property.type.teamfilter"); //$NON-NLS-1$
|
||||
//return RSESamplesResources.property_type_teamfilter;
|
||||
//--tutorial part 2
|
||||
String type = selectedFilter.getType();
|
||||
if (type == null)
|
||||
type = "team"; //$NON-NLS-1$
|
||||
if (type.equals("team")) //$NON-NLS-1$
|
||||
return RSESamplesPlugin.getResourceString("property.type.teamfilter"); //$NON-NLS-1$
|
||||
return RSESamplesResources.property_type_teamfilter;
|
||||
else
|
||||
return RSESamplesPlugin.getResourceString("property.type.devrfilter"); //$NON-NLS-1$
|
||||
return RSESamplesResources.property_type_devrfilter;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2006, 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
|
||||
|
@ -7,12 +7,13 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert examples to MessageBundle format
|
||||
*******************************************************************************/
|
||||
|
||||
package samples.subsystems;
|
||||
|
@ -28,6 +29,7 @@ import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
import samples.RSESamplesResources;
|
||||
|
||||
/**
|
||||
* Adds functionality to the basic SubSystemConfiguration.
|
||||
|
@ -52,24 +54,24 @@ public class DeveloperSubSystemConfigurationAdapter extends
|
|||
protected IAction[] getNewFilterPoolFilterActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
|
||||
{
|
||||
SystemNewFilterAction teamAction = (SystemNewFilterAction)super.getNewFilterPoolFilterAction(factory, selectedPool, shell);
|
||||
teamAction.setWizardPageTitle(RSESamplesPlugin.getResourceString("filter.team.pagetitle")); //$NON-NLS-1$
|
||||
teamAction.setPage1Description(RSESamplesPlugin.getResourceString("filter.team.pagetext")); //$NON-NLS-1$
|
||||
teamAction.setWizardPageTitle(RSESamplesResources.filter_team_pagetitle);
|
||||
teamAction.setPage1Description(RSESamplesResources.filter_team_pagetext);
|
||||
teamAction.setType("team"); //$NON-NLS-1$
|
||||
teamAction.setText(RSESamplesPlugin.getResourceString("filter.team.pagetitle") + "..."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
SystemNewFilterAction devrAction = (SystemNewFilterAction)super.getNewFilterPoolFilterAction(factory, selectedPool, shell);
|
||||
devrAction.setWizardPageTitle(RSESamplesPlugin.getResourceString("filter.devr.pagetitle")); //$NON-NLS-1$
|
||||
devrAction.setPage1Description(RSESamplesPlugin.getResourceString("filter.devr.pagetext")); //$NON-NLS-1$
|
||||
teamAction.setText(RSESamplesResources.filter_team_pagetitle + "..."); //$NON-NLS-1$
|
||||
|
||||
SystemNewFilterAction devrAction = (SystemNewFilterAction)super.getNewFilterPoolFilterAction(factory, selectedPool, shell);
|
||||
devrAction.setWizardPageTitle(RSESamplesResources.filter_devr_pagetitle);
|
||||
devrAction.setPage1Description(RSESamplesResources.filter_devr_pagetext);
|
||||
devrAction.setType("devr"); //$NON-NLS-1$
|
||||
devrAction.setText(RSESamplesPlugin.getResourceString("filter.devr.pagetitle") + "..."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
devrAction.setFilterStringEditPane(new DeveloperFilterStringEditPane(shell));
|
||||
|
||||
devrAction.setText(RSESamplesResources.filter_devr_pagetitle + "..."); //$NON-NLS-1$
|
||||
devrAction.setFilterStringEditPane(new DeveloperFilterStringEditPane(shell));
|
||||
|
||||
IAction[] actions = new IAction[2];
|
||||
actions[0] = teamAction;
|
||||
actions[1] = devrAction;
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override of parent method for returning the change-filter action, so we can affect it.
|
||||
*/
|
||||
|
@ -78,18 +80,18 @@ public class DeveloperSubSystemConfigurationAdapter extends
|
|||
SystemChangeFilterAction action = (SystemChangeFilterAction)super.getChangeFilterAction(factory, selectedFilter, shell);
|
||||
String type = selectedFilter.getType();
|
||||
if (type == null)
|
||||
type = "team"; //$NON-NLS-1$
|
||||
type = "team"; //$NON-NLS-1$
|
||||
if (type.equals("team")) //$NON-NLS-1$
|
||||
{
|
||||
action.setDialogTitle(RSESamplesPlugin.getResourceString("filter.team.dlgtitle")); //$NON-NLS-1$
|
||||
action.setDialogTitle(RSESamplesResources.filter_team_dlgtitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
action.setDialogTitle(RSESamplesPlugin.getResourceString("filter.devr.dlgtitle")); //$NON-NLS-1$
|
||||
action.setDialogTitle(RSESamplesResources.filter_devr_dlgtitle);
|
||||
action.setFilterStringEditPane(new DeveloperFilterStringEditPane(shell));
|
||||
}
|
||||
}
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method for returning the image for filters in our subsystem.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2006, 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
|
||||
|
@ -7,14 +7,15 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||
* Kevin Doyle (IBM) - [150492] FolderInfoPropertyPage doesn't work reliably
|
||||
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert examples to MessageBundle format
|
||||
*******************************************************************************/
|
||||
|
||||
package samples.ui.propertypages;
|
||||
|
@ -32,6 +33,7 @@ import org.eclipse.swt.widgets.Display;
|
|||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
import samples.RSESamplesPlugin;
|
||||
import samples.RSESamplesResources;
|
||||
|
||||
/**
|
||||
* A sample property page for a remote object, which in this case is scoped via the
|
||||
|
@ -63,7 +65,7 @@ public class FolderInfoPropertyPage
|
|||
// --------------------------
|
||||
// Parent method overrides...
|
||||
// --------------------------
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction#createContentArea(org.eclipse.swt.widgets.Composite)
|
||||
|
@ -71,53 +73,49 @@ public class FolderInfoPropertyPage
|
|||
protected Control createContentArea(Composite parent)
|
||||
{
|
||||
Composite composite = SystemWidgetHelpers.createComposite(parent, 2);
|
||||
// draw the gui
|
||||
sizeLabel = SystemWidgetHelpers.createLabeledLabel(composite,
|
||||
RSESamplesPlugin.getResourceString("pp.size.label"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("pp.size.tooltip"), //$NON-NLS-1$
|
||||
// draw the gui
|
||||
sizeLabel = SystemWidgetHelpers.createLabeledLabel(composite,
|
||||
RSESamplesResources.pp_size_label, RSESamplesResources.pp_size_tooltip,
|
||||
false);
|
||||
filesLabel = SystemWidgetHelpers.createLabeledLabel(composite,
|
||||
RSESamplesPlugin.getResourceString("pp.files.label"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("pp.files.tooltip"), //$NON-NLS-1$
|
||||
filesLabel = SystemWidgetHelpers.createLabeledLabel(composite,
|
||||
RSESamplesResources.pp_files_label, RSESamplesResources.pp_files_tooltip,
|
||||
false);
|
||||
foldersLabel = SystemWidgetHelpers.createLabeledLabel(composite,
|
||||
RSESamplesPlugin.getResourceString("pp.folders.label"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("pp.folders.tooltip"), //$NON-NLS-1$
|
||||
foldersLabel = SystemWidgetHelpers.createLabeledLabel(composite,
|
||||
RSESamplesResources.pp_folders_label, RSESamplesResources.pp_folders_tooltip,
|
||||
false);
|
||||
stopButton = SystemWidgetHelpers.createPushButton(composite, null,
|
||||
RSESamplesPlugin.getResourceString("pp.stopButton.label"), //$NON-NLS-1$
|
||||
RSESamplesPlugin.getResourceString("pp.stopButton.tooltip") //$NON-NLS-1$
|
||||
stopButton = SystemWidgetHelpers.createPushButton(composite, null,
|
||||
RSESamplesResources.pp_stopButton_label, RSESamplesResources.pp_stopButton_tooltip
|
||||
);
|
||||
stopButton.addSelectionListener(this);
|
||||
|
||||
|
||||
setValid(false); // Disable OK button until thread is done
|
||||
|
||||
|
||||
// show "Processing..." message
|
||||
setMessage(RSESamplesPlugin.getPluginMessage("RSSG1002")); //$NON-NLS-1$
|
||||
|
||||
// create instance of Runnable to allow asynchronous GUI updates from background thread
|
||||
|
||||
// create instance of Runnable to allow asynchronous GUI updates from background thread
|
||||
guiUpdater = new RunnableGUIClass();
|
||||
// spawn a thread to calculate the information
|
||||
workerThread = new RunnableClass(getRemoteFile());
|
||||
workerThread.start();
|
||||
|
||||
|
||||
return composite;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Intercept from PreferencePage. Called when user presses Cancel button.
|
||||
* We stop the background thread.
|
||||
* @see org.eclipse.jface.preference.PreferencePage#performCancel()
|
||||
*/
|
||||
public boolean performCancel()
|
||||
public boolean performCancel()
|
||||
{
|
||||
killThread();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercept from DialogPage. Called when dialog going away.
|
||||
* If the user presses the X to close this dialog, we
|
||||
* If the user presses the X to close this dialog, we
|
||||
* need to stop that background thread.
|
||||
*/
|
||||
public void dispose()
|
||||
|
@ -125,7 +123,7 @@ public class FolderInfoPropertyPage
|
|||
killThread();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Private method to kill our background thread.
|
||||
* Control doesn't return until it ends.
|
||||
|
@ -138,18 +136,18 @@ public class FolderInfoPropertyPage
|
|||
try {
|
||||
workerThread.join(); // wait for thread to end
|
||||
} catch (InterruptedException exc) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------
|
||||
// Methods from SelectionListener interface...
|
||||
// -------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* From SelectionListener
|
||||
* @see SelectionListener#widgetSelected(SelectionEvent)
|
||||
*/
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
if (event.getSource() == stopButton)
|
||||
{
|
||||
|
@ -175,26 +173,26 @@ public class FolderInfoPropertyPage
|
|||
private class RunnableClass extends Thread
|
||||
{
|
||||
IRemoteFile inputFolder;
|
||||
|
||||
|
||||
RunnableClass(IRemoteFile inputFolder)
|
||||
{
|
||||
this.inputFolder = inputFolder;
|
||||
}
|
||||
|
||||
|
||||
public void run()
|
||||
{
|
||||
if (stopped) {
|
||||
return;
|
||||
}
|
||||
walkFolder(inputFolder);
|
||||
walkFolder(inputFolder);
|
||||
if (!stopped) {
|
||||
stopped = true;
|
||||
}
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recursively walk a folder, updating the running tallies.
|
||||
* Recursively walk a folder, updating the running tallies.
|
||||
* Update the GUI after processing each subfolder.
|
||||
*/
|
||||
private void walkFolder(IRemoteFile currFolder)
|
||||
|
@ -206,7 +204,7 @@ public class FolderInfoPropertyPage
|
|||
{
|
||||
for (int idx=0; !stopped && (idx<folders.length); idx++)
|
||||
{
|
||||
// is this a folder?
|
||||
// is this a folder?
|
||||
if (folders[idx].isDirectory())
|
||||
{
|
||||
++totalFolders;
|
||||
|
@ -224,12 +222,12 @@ public class FolderInfoPropertyPage
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
} // end of walkFolder method
|
||||
|
||||
} // end of inner class
|
||||
|
||||
|
||||
/**
|
||||
* Inner class encapsulating the GUI work to be done from the
|
||||
* background thread.
|
||||
|
@ -239,20 +237,20 @@ public class FolderInfoPropertyPage
|
|||
public void run()
|
||||
{
|
||||
if (stopButton.isDisposed())
|
||||
return;
|
||||
return;
|
||||
if (stopped)
|
||||
{
|
||||
setValid(true); // re-enable OK button
|
||||
stopButton.setEnabled(false); // disable Stop button
|
||||
{
|
||||
setValid(true); // re-enable OK button
|
||||
stopButton.setEnabled(false); // disable Stop button
|
||||
clearMessage(); // clear "Processing..." message
|
||||
}
|
||||
sizeLabel.setText(Integer.toString(totalSize));
|
||||
sizeLabel.setText(Integer.toString(totalSize));
|
||||
filesLabel.setText(Integer.toString(totalFiles));
|
||||
foldersLabel.setText(Integer.toString(totalFolders));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update the GUI with the current status
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue