Author: snjeza
Date: 2008-11-14 17:10:34 -0500 (Fri, 14 Nov 2008)
New Revision: 11806
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/plugin.properties
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF
trunk/examples/plugins/org.jboss.tools.project.examples/build.properties
trunk/examples/plugins/org.jboss.tools.project.examples/plugin.xml
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerLabelProvider.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/filetransfer/ECFExamplesTransport.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
Log:
JBIDE-3002 Internationalize project-examples component
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF 2008-11-14
22:10:34 UTC (rev 11806)
@@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Project Examples
+Bundle-Name: %BundleName
Bundle-SymbolicName: org.jboss.tools.project.examples;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.jboss.tools.project.examples.ProjectExamplesActivator
-Bundle-Vendor: JBoss, a division of Red Hat
+Bundle-Vendor: %BunldeVendor
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
@@ -21,3 +21,4 @@
org.eclipse.wst.validation,
org.eclipse.ui.views
Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/build.properties
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/build.properties 2008-11-14
21:25:10 UTC (rev 11805)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/build.properties 2008-11-14
22:10:34 UTC (rev 11806)
@@ -4,4 +4,10 @@
.,\
plugin.xml,\
icons/,\
- projectExamples.xml
+ projectExamples.xml,\
+ plugin.properties,\
+ about.html,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ rhds_wiz.png
Added: trunk/examples/plugins/org.jboss.tools.project.examples/plugin.properties
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/plugin.properties
(rev 0)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/plugin.properties 2008-11-14
22:10:34 UTC (rev 11806)
@@ -0,0 +1,6 @@
+#Properties file for org.jboss.tools.project.examples
+BunldeVendor = JBoss, a division of Red Hat
+BundleName = Project Examples
+JBoss_Tools_category = JBoss Tools
+Project_Examples_wizard = Project Examples
+Project_Examples_command = Project Examples
\ No newline at end of file
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/plugin.xml
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/plugin.xml 2008-11-14 21:25:10
UTC (rev 11805)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/plugin.xml 2008-11-14 22:10:34
UTC (rev 11806)
@@ -4,12 +4,12 @@
<extension point="org.eclipse.ui.newWizards">
<category
- name="JBoss Tools"
+ name="%JBoss_Tools_category"
id="org.jboss.ide.eclipse.ui.wizards">
</category>
<wizard
id="org.jboss.tools.project.examples.wizard.NewProjectExamplesWizard"
- name="Project Examples"
+ name="%Project_Examples_wizard"
class="org.jboss.tools.project.examples.wizard.NewProjectExamplesWizard"
category="org.jboss.ide.eclipse.ui.wizards"
icon="icons/examples_wiz.gif">
@@ -18,7 +18,7 @@
<extension
point="org.eclipse.ui.commands">
<command
- name="Project Examples"
+ name="%Project_Examples_command"
id="org.jboss.tools.project.examples">
</command>
</extension>
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java
(rev 0)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -0,0 +1,56 @@
+/*************************************************************************************
+ * Copyright (c) 2008 JBoss, a division of Red Hat 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:
+ * JBoss, a division of Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.project.examples;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME =
"org.jboss.tools.project.examples.messages"; //$NON-NLS-1$
+ public static String Category_Other;
+ public static String ECFExamplesTransport_Downloading;
+ public static String ECFExamplesTransport_Internal_error;
+ public static String ECFExamplesTransport_Internal_Error;
+ public static String ECFExamplesTransport_IO_error;
+ public static String ECFExamplesTransport_Loading;
+ public static String ECFExamplesTransport_of;
+ public static String ECFExamplesTransport_Server_redirected_too_many_times;
+ public static String
ECFExamplesTransport_Unexpected_interrupt_while_waiting_on_ECF_transfer;
+ public static String MarkerDialog_Description;
+ public static String MarkerDialog_Finish;
+ public static String MarkerDialog_Markers;
+ public static String MarkerDialog_Quick_Fix;
+ public static String MarkerDialog_Resource;
+ public static String MarkerDialog_Select_a_marker_and_click_the_Quick_Fix_button;
+ public static String MarkerDialog_Type;
+ public static String NewProjectExamplesWizard_Detail;
+ public static String NewProjectExamplesWizard_Downloading;
+ public static String NewProjectExamplesWizard_Error;
+ public static String NewProjectExamplesWizard_Importing;
+ public static String NewProjectExamplesWizard_New_Project_Example;
+ public static String NewProjectExamplesWizard_OverwriteProject;
+ public static String NewProjectExamplesWizard_Question;
+ public static String NewProjectExamplesWizardPage_Description;
+ public static String NewProjectExamplesWizardPage_Import_Project_Example;
+ public static String NewProjectExamplesWizardPage_Project_Example;
+ public static String NewProjectExamplesWizardPage_Project_name;
+ public static String NewProjectExamplesWizardPage_Project_size;
+ public static String NewProjectExamplesWizardPage_Projects;
+ public static String NewProjectExamplesWizardPage_Show_the_Quick_Fix_dialog;
+ public static String NewProjectExamplesWizardPage_URL;
+ public static String ProjectExamplesActivator_Waiting;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -34,14 +34,14 @@
public class ProjectExamplesActivator extends AbstractUIPlugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.project.examples";
+ public static final String PLUGIN_ID = "org.jboss.tools.project.examples";
//$NON-NLS-1$
// The shared instance
private static ProjectExamplesActivator plugin;
private static BundleContext context;
- public static Job waitForBuildAndValidation = new Job("Waiting...") {
+ public static Job waitForBuildAndValidation = new
Job(Messages.ProjectExamplesActivator_Waiting) {
@Override
protected IStatus run(IProgressMonitor monitor) {
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -66,6 +66,7 @@
import org.eclipse.ui.statushandlers.StatusManager;
import org.eclipse.ui.views.markers.WorkbenchMarkerResolution;
import org.eclipse.ui.views.markers.internal.MarkerMessages;
+import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.dialog.xpl.QuickFixWizard;
import org.jboss.tools.project.examples.model.Project;
@@ -76,7 +77,7 @@
*/
public class MarkerDialog extends TitleAreaDialog {
- private static final String QUICK_FIX = "Quick Fix";
+ private static final String QUICK_FIX = Messages.MarkerDialog_Quick_Fix;
private static final IMarkerResolution[] EMPTY_ARRAY = new IMarkerResolution[0];
private List<Project> projects;
private Image _dlgTitleImage;
@@ -119,13 +120,13 @@
contents.setLayoutData(gd);
contents.setLayout(new GridLayout());
setTitle(QUICK_FIX);
- setMessage("Select a marker and click the Quick Fix button.");
+ setMessage(Messages.MarkerDialog_Select_a_marker_and_click_the_Quick_Fix_button);
getShell().setText(QUICK_FIX);
applyDialogFont(contents);
initializeDialogUnits(area);
Label markersLabel = new Label(contents, SWT.NULL);
- markersLabel.setText("Markers:");
+ markersLabel.setText(Messages.MarkerDialog_Markers);
tableViewer = new TableViewer(contents, SWT.H_SCROLL | SWT.V_SCROLL
| SWT.BORDER | SWT.SINGLE);
Table table = tableViewer.getTable();
@@ -134,7 +135,7 @@
table.setHeaderVisible(true);
table.setLinesVisible(true);
- String[] columnNames = new String[] { "Description", "Resource",
"Type" };
+ String[] columnNames = new String[] { Messages.MarkerDialog_Description,
Messages.MarkerDialog_Resource, Messages.MarkerDialog_Type };
int[] columnWidths = new int[] { 200, 150, 150 };
for (int i = 0; i < columnNames.length; i++) {
@@ -198,9 +199,9 @@
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
quickFixButton = getButton(IDialogConstants.OK_ID);
- quickFixButton.setText("Quick Fix");
+ quickFixButton.setText(Messages.MarkerDialog_Quick_Fix);
finishButton = getButton(IDialogConstants.CANCEL_ID);
- finishButton.setText("Finish");
+ finishButton.setText(Messages.MarkerDialog_Finish);
quickFixButton.setEnabled(false);
}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerLabelProvider.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerLabelProvider.java 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerLabelProvider.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -37,14 +37,14 @@
IMarker marker = (IMarker) element;
switch (columnIndex) {
case 0:
- return marker.getAttribute(IMarker.MESSAGE, "");
+ return marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
case 1:
return marker.getResource().getName();
case 2:
try {
IExtensionPoint extensionPoint = Platform
.getExtensionRegistry().getExtensionPoint(
- "org.eclipse.core.resources.markers");
+ "org.eclipse.core.resources.markers"); //$NON-NLS-1$
IExtension[] extensions = extensionPoint.getExtensions();
for (int i = 0; i < extensions.length; i++) {
IExtension extension = extensions[i];
@@ -58,7 +58,7 @@
}
return marker.getType();
} catch (CoreException e) {
- return "";
+ return ""; //$NON-NLS-1$
}
}
return null;
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/filetransfer/ECFExamplesTransport.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/filetransfer/ECFExamplesTransport.java 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/filetransfer/ECFExamplesTransport.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -47,6 +47,7 @@
import org.eclipse.equinox.security.storage.ISecurePreferences;
import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
import org.eclipse.equinox.security.storage.StorageException;
+import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.osgi.util.tracker.ServiceTracker;
@@ -62,7 +63,7 @@
*/
private static final int LOGIN_RETRIES = 3;
private static final ProtocolException ERROR_401 = new ProtocolException();
- private static final String SERVER_REDIRECT = "Server redirected too many
times";
+ private static final String SERVER_REDIRECT =
Messages.ECFExamplesTransport_Server_redirected_too_many_times;
private static ECFExamplesTransport INSTANCE;
private ServiceTracker retrievalFactoryTracker;
@@ -79,7 +80,7 @@
* @param barrier The job will wait until the first entry in the barrier is non-null
*/
WaitJob(String location, Object[] barrier) {
- super("Loading");
+ super(Messages.ECFExamplesTransport_Loading);
this.barrier = barrier;
setSystem(true);
}
@@ -143,7 +144,7 @@
throw new OperationCanceledException();
}
//too many retries, so report as failure
- throw new CoreException(new Status(IStatus.ERROR, ProjectExamplesActivator.PLUGIN_ID,
"IO error", null));
+ throw new CoreException(new Status(IStatus.ERROR, ProjectExamplesActivator.PLUGIN_ID,
Messages.ECFExamplesTransport_IO_error, null));
}
/**
@@ -196,13 +197,13 @@
}
}
//reached maximum number of retries without success
- return new Status(IStatus.ERROR, ProjectExamplesActivator.PLUGIN_ID, "IO
error", null);
+ return new Status(IStatus.ERROR, ProjectExamplesActivator.PLUGIN_ID,
Messages.ECFExamplesTransport_IO_error, null);
}
public IStatus performDownload(String name,String toDownload, OutputStream target,
IConnectContext context, IProgressMonitor monitor) throws ProtocolException {
IRetrieveFileTransferFactory factory = (IRetrieveFileTransferFactory)
retrievalFactoryTracker.getService();
if (factory == null)
- return new Status(IStatus.ERROR, ProjectExamplesActivator.PLUGIN_ID, "IO
error");
+ return new Status(IStatus.ERROR, ProjectExamplesActivator.PLUGIN_ID,
Messages.ECFExamplesTransport_IO_error);
return transfer(name,factory.newInstance(), toDownload, target, context, monitor);
}
@@ -225,7 +226,7 @@
long fileLength = rse.getSource().getFileLength();
final long totalWork = ((fileLength == -1) ? 100 : fileLength);
int work = (totalWork > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int)
totalWork;
- monitor.beginTask("Downloading " + name,work);
+ monitor.beginTask(Messages.ECFExamplesTransport_Downloading + name,work);
oldWorked=0;
}
} catch (IOException e) {
@@ -250,10 +251,10 @@
int worked = (int) Math.round(factor * received);
double downloadRateBytesPerSecond = (received / ((System.currentTimeMillis() + 1 -
transferStartTime) / 1000.0));
- String rates = String.format(" (at %s/s)",
AbstractRetrieveFileTransfer.toHumanReadableBytes(downloadRateBytesPerSecond));
+ String rates = String.format(" (at %s/s)",
AbstractRetrieveFileTransfer.toHumanReadableBytes(downloadRateBytesPerSecond));
//$NON-NLS-1$
String receivedString =
AbstractRetrieveFileTransfer.toHumanReadableBytes(received);
String fileLengthString =
AbstractRetrieveFileTransfer.toHumanReadableBytes(fileLength);
- monitor.subTask(receivedString + " of " + fileLengthString + rates);
+ monitor.subTask(receivedString + Messages.ECFExamplesTransport_of +
fileLengthString + rates);
monitor.worked(worked-oldWorked);
oldWorked=worked;
}
@@ -375,7 +376,7 @@
return null;
return ConnectContextFactory.createUsernamePasswordConnectContext(username,
password);
} catch (StorageException e) {
- String msg = "Internal Error";
+ String msg = Messages.ECFExamplesTransport_Internal_Error;
throw new CoreException(new Status(IStatus.ERROR, ProjectExamplesActivator.PLUGIN_ID,
msg, e));
}
}
@@ -398,10 +399,10 @@
prefNode.put(IRepository.PROP_PASSWORD, loginDetails.getPassword(), true);
prefNode.flush();
} catch (StorageException e1) {
- String msg = "Internal error";
+ String msg = Messages.ECFExamplesTransport_Internal_error;
throw new CoreException(new Status(IStatus.ERROR, ProjectExamplesActivator.PLUGIN_ID,
msg, e1));
} catch (IOException e) {
- String msg = "Internal error";
+ String msg = Messages.ECFExamplesTransport_Internal_error;
throw new CoreException(new Status(IStatus.ERROR, ProjectExamplesActivator.PLUGIN_ID,
msg, e));
}
}
@@ -428,7 +429,7 @@
wait.join();
} catch (InterruptedException e) {
if (!logged)
- LogHelper.log(new Status(IStatus.WARNING, ProjectExamplesActivator.PLUGIN_ID,
"Unexpected interrupt while waiting on ECF transfer", e));
+ LogHelper.log(new Status(IStatus.WARNING, ProjectExamplesActivator.PLUGIN_ID,
Messages.ECFExamplesTransport_Unexpected_interrupt_while_waiting_on_ECF_transfer, e));
}
}
}
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties
(rev 0)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties 2008-11-14
22:10:34 UTC (rev 11806)
@@ -0,0 +1,32 @@
+Category_Other=Other
+ECFExamplesTransport_Downloading=Downloading
+ECFExamplesTransport_Internal_error=Internal error
+ECFExamplesTransport_Internal_Error=Internal Error
+ECFExamplesTransport_IO_error=IO error
+ECFExamplesTransport_Loading=Loading
+ECFExamplesTransport_of=\ of
+ECFExamplesTransport_Server_redirected_too_many_times=Server redirected too many times
+ECFExamplesTransport_Unexpected_interrupt_while_waiting_on_ECF_transfer=Unexpected
interrupt while waiting on ECF transfer
+MarkerDialog_Description=Description
+MarkerDialog_Finish=Finish
+MarkerDialog_Markers=Markers:
+MarkerDialog_Quick_Fix=Quick Fix
+MarkerDialog_Resource=Resource
+MarkerDialog_Select_a_marker_and_click_the_Quick_Fix_button=Select a marker and click the
Quick Fix button.
+MarkerDialog_Type=Type
+NewProjectExamplesWizard_Detail=Detail
+NewProjectExamplesWizard_Downloading=Downloading...
+NewProjectExamplesWizard_Error=Error
+NewProjectExamplesWizard_Importing=Importing...
+NewProjectExamplesWizard_New_Project_Example=New Project Example
+NewProjectExamplesWizard_OverwriteProject=Overwrite project ''{0}''
+NewProjectExamplesWizard_Question=Question
+NewProjectExamplesWizardPage_Description=Description:
+NewProjectExamplesWizardPage_Import_Project_Example=Import Project Example
+NewProjectExamplesWizardPage_Project_Example=Project Example
+NewProjectExamplesWizardPage_Project_name=Project name:
+NewProjectExamplesWizardPage_Project_size=Project size:
+NewProjectExamplesWizardPage_Projects=Projects:
+NewProjectExamplesWizardPage_Show_the_Quick_Fix_dialog=Show the Quick Fix dialog
+NewProjectExamplesWizardPage_URL=URL:
+ProjectExamplesActivator_Waiting=Waiting...
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -13,6 +13,8 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.tools.project.examples.Messages;
+
/**
* @author snjeza
*
@@ -21,7 +23,7 @@
private String name;
private List<Project> projects = new ArrayList<Project>();
- public static Category OTHER = new Category("Other");
+ public static Category OTHER = new Category(Messages.Category_Other);
public Category(String name) {
super();
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -13,6 +13,8 @@
import java.math.BigDecimal;
import java.util.List;
+import org.jboss.tools.project.examples.Messages;
+
/**
* @author snjeza
*
@@ -28,10 +30,10 @@
private List<String> includedProjects;
public Project() {
- name="";
- shortDescription="";
- description="";
- url="";
+ name=""; //$NON-NLS-1$
+ shortDescription=""; //$NON-NLS-1$
+ description=""; //$NON-NLS-1$
+ url=""; //$NON-NLS-1$
setCategory(Category.OTHER);
}
@@ -84,16 +86,16 @@
}
public String getSizeAsText() {
- String sizeString = "";
+ String sizeString = ""; //$NON-NLS-1$
BigDecimal sizeDecimal = new BigDecimal(size);
BigDecimal MB = new BigDecimal(1024*1024);
BigDecimal KB = new BigDecimal(1024);
if (sizeDecimal.compareTo(MB) > 0) {
- sizeString = String.format("%5.2fM", sizeDecimal.divide(MB));
+ sizeString = String.format("%5.2fM", sizeDecimal.divide(MB)); //$NON-NLS-1$
} else if (sizeDecimal.compareTo(KB) > 0) {
- sizeString = String.format("%5.2fK", sizeDecimal.divide(KB));
+ sizeString = String.format("%5.2fK", sizeDecimal.divide(KB)); //$NON-NLS-1$
} else {
- sizeString = String.format("%d", size);
+ sizeString = String.format("%d", size); //$NON-NLS-1$
}
return sizeString;
}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -29,6 +29,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.filetransfer.ECFExamplesTransport;
import org.osgi.framework.Bundle;
@@ -43,83 +44,25 @@
*/
public class ProjectUtil {
- private final static String PROJECT_EXAMPLES_XML =
"http://anonsvn.jboss.org/repos/jbosstools/workspace/examples/projectExamples.xml";
- private static final String PROTOCOL_FILE = "file";
+ private final static String PROJECT_EXAMPLES_XML =
"http://anonsvn.jboss.org/repos/jbosstools/workspace/examples/projectExamples.xml";
//$NON-NLS-1$
+ private static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$
private ProjectUtil() {
}
- public static List<Category> getTestProjects() {
- Category seamCategory = new Category("Seam");
- Project project = new Project();
- project.setName("dvdstore");
- project.setShortDescription("Seam DVD Store Example");
- project
- .setDescription("This example demonstrates the use of Seam with jBPM pageflow
and business process management. It runs on JBoss AS and Tomcat.");
- project.setSize(10000);
- project
- .setUrl("http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/portlet-examples/dvdstore.zip");
- project.setCategory(seamCategory);
- seamCategory.getProjects().add(project);
-
- Category portletCategory = new Category("Portlet");
-
- project = new Project();
- project.setName("TestJavaPortlet");
- project.setShortDescription("JBoss Java Portlet Example");
- project
- .setDescription("This example demonstrates the use of JBoss Java Portlet. It
runs on JBoss Portal 2.7.0");
- project.setSize(10000);
- project
- .setUrl("http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/portlet-examples/TestJavaPortlet.zip");
- project.setCategory(portletCategory);
- portletCategory.getProjects().add(project);
-
- project = new Project();
- project.setName("TestJSFPortlet");
- project.setShortDescription("JBoss JSF Portlet Example");
- project
- .setDescription("This example demonstrates the use of JBoss JSF Portlet. It runs
on JBoss Portal 2.7.0");
- project.setSize(4000000);
- project
- .setUrl("http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/portlet-examples/TestJSFPortlet.zip");
- project.setCategory(portletCategory);
- portletCategory.getProjects().add(project);
-
- project = new Project();
- project.setName("TestSeamPortlet");
- project.setShortDescription("JBoss Seam Portlet Example");
- project
- .setDescription("This example demonstrates the use of JBoss Seam Portlet. It
runs on JBoss Portal 2.7.0");
- project.setSize(10000000);
- project
- .setUrl("http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/portlet-examples/TestSeamPortlet.zip");
- project.setCategory(portletCategory);
- portletCategory.getProjects().add(project);
-
- Category otherCategory = new Category("Other");
-
- List<Category> list = new ArrayList<Category>();
- list.add(seamCategory);
- list.add(portletCategory);
- list.add(otherCategory);
-
- return list;
- }
-
public static List<Category> getProjects() {
List<Category> list = new ArrayList<Category>();
Category other = Category.OTHER;
try {
// TODO add a progress monitor
- File file =
getProjectExamplesFile(getProjectExamplesXml(),"projectExamples",
".xml",null);
+ File file =
getProjectExamplesFile(getProjectExamplesXml(),"projectExamples",
".xml",null); //$NON-NLS-1$ //$NON-NLS-2$
if (file.exists() && file.isFile()) {
DocumentBuilderFactory dbf = DocumentBuilderFactory
.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
- NodeList projects = doc.getElementsByTagName("project");
+ NodeList projects = doc.getElementsByTagName("project"); //$NON-NLS-1$
int len = projects.getLength();
for (int i = 0; i < len; i++) {
Node node = projects.item(i);
@@ -134,7 +77,7 @@
if (cNode.getNodeType() == Node.ELEMENT_NODE) {
Element child = (Element) cNode;
String nodeName = child.getNodeName();
- if (nodeName.equals("category")) {
+ if (nodeName.equals("category")) { //$NON-NLS-1$
String value = getContent(child);
boolean found = false;
for (Category cat:list) {
@@ -150,19 +93,19 @@
}
project.setCategory(category);
}
- if (nodeName.equals("name")) {
+ if (nodeName.equals("name")) { //$NON-NLS-1$
project.setName(getContent(child));
}
- if (nodeName.equals("shortDescription")) {
+ if (nodeName.equals("shortDescription")) { //$NON-NLS-1$
project.setShortDescription(getContent(child));
}
- if (nodeName.equals("description")) {
+ if (nodeName.equals("description")) { //$NON-NLS-1$
project.setDescription(getContent(child));
}
- if (nodeName.equals("url")) {
+ if (nodeName.equals("url")) { //$NON-NLS-1$
project.setUrl(getContent(child));
}
- if (nodeName.equals("size")) {
+ if (nodeName.equals("size")) { //$NON-NLS-1$
long size = 0;
try {
size = new Long(getContent(child));
@@ -170,11 +113,11 @@
}
project.setSize(size);
}
- if (nodeName.equals("included-projects")) {
+ if (nodeName.equals("included-projects")) { //$NON-NLS-1$
String includedProjects = getContent(child);
if (includedProjects != null) {
includedProjects = includedProjects.trim();
- StringTokenizer tokenizer = new
StringTokenizer(includedProjects,",");
+ StringTokenizer tokenizer = new
StringTokenizer(includedProjects,","); //$NON-NLS-1$
List<String> projectList = new ArrayList<String>();
while (tokenizer.hasMoreTokens()) {
projectList.add(tokenizer.nextToken());
@@ -196,7 +139,7 @@
}
private static String getProjectExamplesXml() {
- String projectXML =
System.getProperty("org.jboss.tools.project.examples.xml");
+ String projectXML =
System.getProperty("org.jboss.tools.project.examples.xml"); //$NON-NLS-1$
if (projectXML != null && projectXML.length() > 0) {
return projectXML;
}
@@ -206,18 +149,10 @@
private static String getContent(Element child) {
String value = child.getTextContent();
if (value == null) {
- value="";
+ value=""; //$NON-NLS-1$
}
return value.trim();
}
-
- private static File getProjectExamplesXmlTest() throws Exception {
- Bundle bundle = Platform.getBundle(ProjectExamplesActivator.PLUGIN_ID);
- URL examplesURL = bundle.getEntry("/projectExamples.xml");
- URL url = FileLocator.resolve(examplesURL);
- File file = new File(FileLocator.toFileURL(url).getFile());
- return file;
- }
public static File getProjectExamplesFile(String urlString,String prefix, String suffix,
IProgressMonitor monitor) {
URL url;
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -42,6 +42,7 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.INewWizard;
@@ -52,6 +53,7 @@
import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
+import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.dialog.MarkerDialog;
import org.jboss.tools.project.examples.model.Project;
@@ -84,7 +86,7 @@
public NewProjectExamplesWizard() {
super();
- setWindowTitle("New Project Example");
+ setWindowTitle(Messages.NewProjectExamplesWizard_New_Project_Example);
}
@@ -98,7 +100,7 @@
if (page.getSelection() == null || page.getSelection().size() <= 0) {
return false;
}
- workspaceJob = new WorkspaceJob("Downloading...") {
+ workspaceJob = new WorkspaceJob(Messages.NewProjectExamplesWizard_Downloading) {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor)
@@ -114,7 +116,7 @@
String url = project.getUrl();
String name = project.getName();
final File file = ProjectUtil.getProjectExamplesFile(
- url, name, ".zip", monitor);
+ url, name, ".zip", monitor); //$NON-NLS-1$
if (file == null) {
return Status.CANCEL_STATUS;
}
@@ -124,7 +126,7 @@
}
try {
int i = 0;
- setName("Importing...");
+ setName(Messages.NewProjectExamplesWizard_Importing);
for (Project project : projects) {
importProject(project, files.get(i++), monitor);
}
@@ -133,10 +135,10 @@
public void run() {
MessageDialogWithToggle.openError(getShell(),
- "Error", e.getMessage(), "Detail", false,
+ Messages.NewProjectExamplesWizard_Error, e.getMessage(),
Messages.NewProjectExamplesWizard_Detail, false,
ProjectExamplesActivator.getDefault()
.getPreferenceStore(),
- "errorDialog");
+ "errorDialog"); //$NON-NLS-1$
}
});
@@ -226,8 +228,8 @@
public void run() {
overwrite = MessageDialog.openQuestion(getShell(),
- "Question", "Overwrite project '"
- + projectName + "'");
+ Messages.NewProjectExamplesWizard_Question,
NLS.bind(Messages.NewProjectExamplesWizard_OverwriteProject,
+ projectName));
}
});
@@ -245,7 +247,7 @@
Enumeration<? extends ZipEntry> entries = sourceFile.entries();
ZipEntry entry = null;
List<ZipEntry> filesToImport = new ArrayList<ZipEntry>();
- String prefix = projectName + "/";
+ String prefix = projectName + "/"; //$NON-NLS-1$
while (entries.hasMoreElements()) {
entry = entries.nextElement();
if (entry.getName().startsWith(prefix)) {
@@ -276,8 +278,8 @@
public void run() {
overwrite = MessageDialog.openQuestion(getShell(),
- "Question", "Overwrite project '" + projectName
- + "'");
+ Messages.NewProjectExamplesWizard_Question,
NLS.bind(Messages.NewProjectExamplesWizard_OverwriteProject,
+ projectName));
}
});
@@ -308,7 +310,7 @@
protected void initializeDefaultPageImageDescriptor() {
ImageDescriptor desc = ProjectExamplesActivator
.imageDescriptorFromPlugin(ProjectExamplesActivator.PLUGIN_ID,
- "icons/new_wiz.gif");
+ "icons/new_wiz.gif"); //$NON-NLS-1$
setDefaultPageImageDescriptor(desc);
}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2008-11-14
21:25:10 UTC (rev 11805)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2008-11-14
22:10:34 UTC (rev 11806)
@@ -31,6 +31,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
+import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.model.Category;
import org.jboss.tools.project.examples.model.Project;
@@ -46,10 +47,10 @@
private Button showQuickFixButton;
public NewProjectExamplesWizardPage() {
- super("org.jboss.tools.project.examples");
- setTitle( "Project Example" );
- setDescription( "Import Project Example" );
- setImageDescriptor(
ProjectExamplesActivator.imageDescriptorFromPlugin(ProjectExamplesActivator.PLUGIN_ID,
"icons/new_wiz.gif"));
+ super("org.jboss.tools.project.examples"); //$NON-NLS-1$
+ setTitle( Messages.NewProjectExamplesWizardPage_Project_Example );
+ setDescription( Messages.NewProjectExamplesWizardPage_Import_Project_Example );
+ setImageDescriptor(
ProjectExamplesActivator.imageDescriptorFromPlugin(ProjectExamplesActivator.PLUGIN_ID,
"icons/new_wiz.gif")); //$NON-NLS-1$
}
@@ -61,7 +62,7 @@
gd.widthHint= 225;
composite.setLayoutData(gd);
- new Label(composite,SWT.NONE).setText("Projects:");
+ new Label(composite,SWT.NONE).setText(Messages.NewProjectExamplesWizardPage_Projects);
TreeViewer viewer = new TreeViewer(composite,SWT.MULTI);
Tree tree = viewer.getTree();
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -72,7 +73,7 @@
viewer.setInput(ProjectUtil.getProjects());
Label descriptionLabel = new Label(composite,SWT.NULL);
- descriptionLabel.setText("Description:");
+ descriptionLabel.setText(Messages.NewProjectExamplesWizardPage_Description);
final Text text = new Text(composite,SWT.BORDER | SWT.MULTI | SWT.WRAP |
SWT.READ_ONLY);
gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL |
GridData.GRAB_VERTICAL);
gd.heightHint=75;
@@ -84,17 +85,17 @@
internal.setLayoutData(gd);
Label projectNameLabel = new Label(internal,SWT.NULL);
- projectNameLabel.setText("Project name:");
+ projectNameLabel.setText(Messages.NewProjectExamplesWizardPage_Project_name);
final Text projectName = new Text(internal,SWT.BORDER | SWT.READ_ONLY);
projectName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label projectSizeLabel = new Label(internal,SWT.NULL);
- projectSizeLabel.setText("Project size:");
+ projectSizeLabel.setText(Messages.NewProjectExamplesWizardPage_Project_size);
final Text projectSize = new Text(internal,SWT.BORDER | SWT.READ_ONLY);
projectSize.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label projectURLLabel = new Label(internal,SWT.NULL);
- projectURLLabel.setText("URL:");
+ projectURLLabel.setText(Messages.NewProjectExamplesWizardPage_URL);
final Text projectURL = new Text(internal,SWT.BORDER | SWT.READ_ONLY);
projectURL.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -111,10 +112,10 @@
projectSize.setText(selectedProject.getSizeAsText());
} else {
//Project selectedProject=null;
- text.setText("");
- projectName.setText("");
- projectURL.setText("");
- projectSize.setText("");
+ text.setText(""); //$NON-NLS-1$
+ projectName.setText(""); //$NON-NLS-1$
+ projectURL.setText(""); //$NON-NLS-1$
+ projectSize.setText(""); //$NON-NLS-1$
}
boolean canFinish = false;
Iterator iterator = selection.iterator();
@@ -133,7 +134,7 @@
});
showQuickFixButton = new Button(internal,SWT.CHECK);
- showQuickFixButton.setText("Show the Quick Fix dialog");
+ showQuickFixButton.setText(Messages.NewProjectExamplesWizardPage_Show_the_Quick_Fix_dialog);
showQuickFixButton.setSelection(true);
gd=new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan=2;