diff --git a/releng/org.eclipse.rse.updatesite/site.xml b/releng/org.eclipse.rse.updatesite/site.xml index 7cd31ec9656..ea2d914cfd1 100644 --- a/releng/org.eclipse.rse.updatesite/site.xml +++ b/releng/org.eclipse.rse.updatesite/site.xml @@ -319,7 +319,7 @@ - + diff --git a/rse/examples/org.eclipse.rse.examples-feature/feature.xml b/rse/examples/org.eclipse.rse.examples-feature/feature.xml index 4b82a7542cf..1dce553cc8e 100644 --- a/rse/examples/org.eclipse.rse.examples-feature/feature.xml +++ b/rse/examples/org.eclipse.rse.examples-feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/META-INF/MANIFEST.MF b/rse/examples/org.eclipse.rse.examples.tutorial/META-INF/MANIFEST.MF index d504d270fb2..acd79223043 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/META-INF/MANIFEST.MF +++ b/rse/examples/org.eclipse.rse.examples.tutorial/META-INF/MANIFEST.MF @@ -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 diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/RSESamplesPlugin.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/RSESamplesPlugin.java index b36ef4e1765..c9250205b44 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/RSESamplesPlugin.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/RSESamplesPlugin.java @@ -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 null 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) diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/RSESamplesResources.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/RSESamplesResources.java new file mode 100644 index 00000000000..afaffeba2a8 --- /dev/null +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/RSESamplesResources.java @@ -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); + } + + +} diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/model/DeveloperResourceAdapter.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/model/DeveloperResourceAdapter.java index 4ce5c1928e0..020eb9276e9 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/model/DeveloperResourceAdapter.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/model/DeveloperResourceAdapter.java @@ -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) diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/model/TeamResourceAdapter.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/model/TeamResourceAdapter.java index 85f84abb88d..46514d36b5d 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/model/TeamResourceAdapter.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/model/TeamResourceAdapter.java @@ -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; idx0) && (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; + } } diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperSubSystemConfiguration.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperSubSystemConfiguration.java index 2332b447ad9..1304b0d6ca5 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperSubSystemConfiguration.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperSubSystemConfiguration.java @@ -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; } } diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperSubSystemConfigurationAdapter.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperSubSystemConfigurationAdapter.java index 7eb44072622..ac8bff4bd3c 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperSubSystemConfigurationAdapter.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperSubSystemConfigurationAdapter.java @@ -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. diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java index f56cd147963..e3eefc326c8 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java @@ -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