diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2009-07-29 11:25:40 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2009-07-29 11:25:40 +0200 |
commit | 9b175d51c2f6c844c6f51869bc4e0b375cdc984c (patch) | |
tree | 36cd73a94a78557f555c14123dc6a04f6de3688e /java | |
parent | 73577b8de7d2f3a5ff149b2a3ca8c1c21289a828 (diff) |
Description.xml editor UI.
The description.xml file editor is integrated with the
package.properties one. The corresponding FormPages have been added to
the editor. The UI is now working, except the missing license UI.
Externalized some strings too, not completely clean thought.
Diffstat (limited to 'java')
14 files changed, 100 insertions, 39 deletions
diff --git a/java/.classpath b/java/.classpath index a26a9a5..d154f35 100644 --- a/java/.classpath +++ b/java/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="source"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="source"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/java/.settings/org.eclipse.jdt.core.prefs b/java/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..17bb986 --- /dev/null +++ b/java/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +#Mon Jul 27 15:39:49 CEST 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/java/META-INF/MANIFEST.MF b/java/META-INF/MANIFEST.MF index 35d1107..c3bb516 100644 --- a/java/META-INF/MANIFEST.MF +++ b/java/META-INF/MANIFEST.MF @@ -5,7 +5,6 @@ Bundle-SymbolicName: org.openoffice.ide.eclipse.java; singleton:=true Bundle-Version: 1.0.0 Bundle-Activator: org.openoffice.ide.eclipse.java.OOoJavaPlugin Bundle-Vendor: OpenOffice.org -Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.openoffice.ide.eclipse.core, @@ -15,4 +14,5 @@ Require-Bundle: org.eclipse.ui, org.eclipse.jdt, org.eclipse.jdt.ui, org.eclipse.jface.text -Eclipse-LazyStart: true +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaMainProvider.java b/java/source/org/openoffice/ide/eclipse/java/JavaMainProvider.java index 59a2d01..6ac1269 100644 --- a/java/source/org/openoffice/ide/eclipse/java/JavaMainProvider.java +++ b/java/source/org/openoffice/ide/eclipse/java/JavaMainProvider.java @@ -137,7 +137,7 @@ public class JavaMainProvider implements IMainProvider { int i = 0; while (!isMainImplementation && i < superInterfaces.length) { - if (superInterfaces[i].getFullyQualifiedName().equals("com.sun.star.lang.XMain")) { + if (superInterfaces[i].getFullyQualifiedName().equals("com.sun.star.lang.XMain")) { //$NON-NLS-1$ isMainImplementation = true; } else { i++; diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaResourceDeltaVisitor.java b/java/source/org/openoffice/ide/eclipse/java/JavaResourceDeltaVisitor.java index 3a8e1a5..2fecda8 100644 --- a/java/source/org/openoffice/ide/eclipse/java/JavaResourceDeltaVisitor.java +++ b/java/source/org/openoffice/ide/eclipse/java/JavaResourceDeltaVisitor.java @@ -108,10 +108,10 @@ public class JavaResourceDeltaVisitor implements IResourceDeltaVisitor { private void removeImplementation(IResourceDelta pDelta, IUnoidlProject pUnoprj) { IResource res = pDelta.getResource(); - if (res.getName().endsWith(".java")) { + if (res.getName().endsWith(".java")) { //$NON-NLS-1$ String prjPath = pDelta.getProjectRelativePath().toString(); - prjPath = prjPath.replace(".java", ""); - prjPath = prjPath.replace("/", "."); + prjPath = prjPath.replace(".java", ""); //$NON-NLS-1$ //$NON-NLS-2$ + prjPath = prjPath.replace("/", "."); //$NON-NLS-1$ //$NON-NLS-2$ Vector<String> classes = RegistrationHelper.readClassesList(pUnoprj); for (String implName : classes) { @@ -145,7 +145,7 @@ public class JavaResourceDeltaVisitor implements IResourceDeltaVisitor { private String isJavaServiceImpl(IResource pResource) { String className = null; - if (pResource.getType() == IResource.FILE && pResource.getName().endsWith(".java")) { + if (pResource.getType() == IResource.FILE && pResource.getName().endsWith(".java")) { //$NON-NLS-1$ /* * For sure the resource is a Java class file. * Now the file has to be read to find out if it contains the two @@ -163,33 +163,34 @@ public class JavaResourceDeltaVisitor implements IResourceDeltaVisitor { // Read the file into a string without line delimiters String line = reader.readLine(); - String fileContent = ""; + String fileContent = ""; //$NON-NLS-1$ while (line != null) { fileContent = fileContent + line; line = reader.readLine(); } - String getFactoryRegex = "public\\s+static\\s+XSingleComponentFactory\\s+__getComponentFactory"; + String getFactoryRegex = "public\\s+static\\s+XSingleComponentFactory" + //$NON-NLS-1$ + "\\s+__getComponentFactory"; //$NON-NLS-1$ boolean containsGetFactory = fileContent.split(getFactoryRegex).length > 1; - String writeServiceRegex = "public\\s+static\\s+boolean\\s+__writeRegistryServiceInfo"; + String writeServiceRegex = "public\\s+static\\s+boolean\\s+__writeRegistryServiceInfo"; //$NON-NLS-1$ boolean containsWriteService = fileContent.split(writeServiceRegex).length > 1; // Do not consider the RegistrationHandler class as a service implementation if (containsGetFactory && containsWriteService && - !pResource.getName().equals("RegistrationHandler.java")) { + !pResource.getName().equals("RegistrationHandler.java")) { //$NON-NLS-1$ /* * Computes the class name */ - Matcher m3 = Pattern.compile("[^;]*package\\s+([^;]+);.*").matcher(fileContent); + Matcher m3 = Pattern.compile("[^;]*package\\s+([^;]+);.*").matcher(fileContent); //$NON-NLS-1$ if (m3.matches()) { String packageName = m3.group(1); String fileName = pResource.getName(); - className = fileName.substring(0, fileName.length() - ".java".length()); + className = fileName.substring(0, fileName.length() - ".java".length()); //$NON-NLS-1$ - className = packageName + "." + className; + className = packageName + "." + className; //$NON-NLS-1$ } } diff --git a/java/source/org/openoffice/ide/eclipse/java/build/Messages.java b/java/source/org/openoffice/ide/eclipse/java/build/Messages.java new file mode 100644 index 0000000..1bcd12d --- /dev/null +++ b/java/source/org/openoffice/ide/eclipse/java/build/Messages.java @@ -0,0 +1,22 @@ +package org.openoffice.ide.eclipse.java.build; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "org.openoffice.ide.eclipse.java.build.messages"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/java/source/org/openoffice/ide/eclipse/java/build/OOoClasspathContainer.java b/java/source/org/openoffice/ide/eclipse/java/build/OOoClasspathContainer.java index 9f57f3f..09e629a 100644 --- a/java/source/org/openoffice/ide/eclipse/java/build/OOoClasspathContainer.java +++ b/java/source/org/openoffice/ide/eclipse/java/build/OOoClasspathContainer.java @@ -62,7 +62,7 @@ import org.openoffice.ide.eclipse.java.JavaProjectHandler; */ public class OOoClasspathContainer implements IClasspathContainer { - public static final String ID = "org.openoffice.ide.eclipse.java.OOO_CONTAINER"; + public static final String ID = "org.openoffice.ide.eclipse.java.OOO_CONTAINER"; //$NON-NLS-1$ private IOOo mOOo; @@ -96,7 +96,7 @@ public class OOoClasspathContainer implements IClasspathContainer { * {@inheritDoc} */ public String getDescription() { - String pattern = "{0} libraries"; + String pattern = Messages.getString("OOoClasspathContainer.LibrariesName"); //$NON-NLS-1$ String descr = MessageFormat.format(pattern, mOOo.getName()); return descr; } diff --git a/java/source/org/openoffice/ide/eclipse/java/build/OOoContainerPage.java b/java/source/org/openoffice/ide/eclipse/java/build/OOoContainerPage.java index 4143be5..c3924cb 100644 --- a/java/source/org/openoffice/ide/eclipse/java/build/OOoContainerPage.java +++ b/java/source/org/openoffice/ide/eclipse/java/build/OOoContainerPage.java @@ -78,7 +78,7 @@ public class OOoContainerPage extends WizardPage implements private static final int LAYOUT_COLUMNS = 3; - private static final String OOO = "ooo"; + private static final String OOO = "ooo"; //$NON-NLS-1$ private IClasspathEntry mContainer; private IJavaProject mProject; @@ -89,11 +89,12 @@ public class OOoContainerPage extends WizardPage implements * Needed default constructor. */ public OOoContainerPage() { - super("oocontainer"); + super("oocontainer"); //$NON-NLS-1$ - setTitle("OpenOffice.org Libraries"); - setDescription("OpenOffice.org Library edition page"); - ImageDescriptor image = OOoJavaPlugin.getImageDescriptor("/icons/library_wiz.png"); + setTitle(Messages.getString("OOoContainerPage.DialogTitle")); //$NON-NLS-1$ + setDescription(Messages.getString("OOoContainerPage.DialogDescription")); //$NON-NLS-1$ + ImageDescriptor image = OOoJavaPlugin.getImageDescriptor( + Messages.getString("OOoContainerPage.DialogImage")); //$NON-NLS-1$ setImageDescriptor(image); mContainer = getDefaultEntry(); diff --git a/java/source/org/openoffice/ide/eclipse/java/build/messages.properties b/java/source/org/openoffice/ide/eclipse/java/build/messages.properties new file mode 100644 index 0000000..9002160 --- /dev/null +++ b/java/source/org/openoffice/ide/eclipse/java/build/messages.properties @@ -0,0 +1 @@ +OOoClasspathContainer.LibrariesName={0} libraries diff --git a/java/source/org/openoffice/ide/eclipse/java/messages.properties b/java/source/org/openoffice/ide/eclipse/java/messages.properties index d187ea9..5f6590f 100644 --- a/java/source/org/openoffice/ide/eclipse/java/messages.properties +++ b/java/source/org/openoffice/ide/eclipse/java/messages.properties @@ -13,3 +13,6 @@ JavaWizardPage.PageTitle=Java implementation configuration JavaWizardPage.PageDescription=This page helps you to configure the java implementation skeleton creation. JavaWizardPage.Java4=Java 1.4 JavaWizardPage.Java5=Java 1.5 +OOoContainerPage.DialogDescription=OpenOffice.org Library edition page +OOoContainerPage.DialogImage=/icons/library_wiz.png +OOoContainerPage.DialogTitle=OpenOffice.org Libraries diff --git a/java/source/org/openoffice/ide/eclipse/java/registration/FileRefreshJob.java b/java/source/org/openoffice/ide/eclipse/java/registration/FileRefreshJob.java index 7f83dea..dfe1ce4 100644 --- a/java/source/org/openoffice/ide/eclipse/java/registration/FileRefreshJob.java +++ b/java/source/org/openoffice/ide/eclipse/java/registration/FileRefreshJob.java @@ -68,7 +68,7 @@ public class FileRefreshJob extends Job { * @param pToRefresh the file to refresh */ public FileRefreshJob(IFile pToRefresh) { - super("Registration Handler class refresh job"); + super("Registration Handler class refresh job"); //$NON-NLS-1$ mToRefresh = pToRefresh; } @@ -84,7 +84,7 @@ public class FileRefreshJob extends Job { Status.WARNING, OOEclipsePlugin.getDefault().getBundle().getSymbolicName(), Status.WARNING, - "Can't refresh the registration classes file", + Messages.getString("FileRefreshJob.Error"), //$NON-NLS-1$ e); } return status; diff --git a/java/source/org/openoffice/ide/eclipse/java/registration/Messages.java b/java/source/org/openoffice/ide/eclipse/java/registration/Messages.java new file mode 100644 index 0000000..d290c3b --- /dev/null +++ b/java/source/org/openoffice/ide/eclipse/java/registration/Messages.java @@ -0,0 +1,22 @@ +package org.openoffice.ide.eclipse.java.registration; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "org.openoffice.ide.eclipse.java.registration.messages"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/java/source/org/openoffice/ide/eclipse/java/registration/RegistrationHelper.java b/java/source/org/openoffice/ide/eclipse/java/registration/RegistrationHelper.java index 7ba006f..842ea0f 100644 --- a/java/source/org/openoffice/ide/eclipse/java/registration/RegistrationHelper.java +++ b/java/source/org/openoffice/ide/eclipse/java/registration/RegistrationHelper.java @@ -69,7 +69,7 @@ import org.openoffice.ide.eclipse.core.model.IUnoidlProject; */ public abstract class RegistrationHelper { - public static final String CLASS_FILENAME = "RegistrationHandler"; + public static final String CLASS_FILENAME = "RegistrationHandler"; //$NON-NLS-1$ /** * Creates all the necessary files for the java registration of UNO services @@ -84,7 +84,7 @@ public abstract class RegistrationHelper { IFolder dest = pProject.getFolder(relPath); // Compute the name of the main implementation class - String implPkg = pProject.getCompanyPrefix() + "." + pProject.getOutputExtension(); + String implPkg = pProject.getCompanyPrefix() + "." + pProject.getOutputExtension(); //$NON-NLS-1$ // Create the RegistrationHandler.java file @@ -93,16 +93,16 @@ public abstract class RegistrationHelper { BufferedReader patternReader = null; InputStream in = null; try { - in = RegistrationHelper.class.getResourceAsStream("RegistrationHandler.java.tpl"); + in = RegistrationHelper.class.getResourceAsStream("RegistrationHandler.java.tpl"); //$NON-NLS-1$ patternReader = new BufferedReader(new InputStreamReader(in)); String line = patternReader.readLine(); while (line != null) { - pattern.append(line + "\n"); + pattern.append(line + "\n"); //$NON-NLS-1$ line = patternReader.readLine(); } } catch (IOException e) { // log the error - PluginLogger.error("Error during registration class creation [reading template]", e); + PluginLogger.error(Messages.getString("RegistrationHelper.ReadTemplateError"), e); //$NON-NLS-1$ } finally { try { patternReader.close(); @@ -116,7 +116,7 @@ public abstract class RegistrationHelper { FileWriter writer = null; try { - IFile classIFile = dest.getFile(CLASS_FILENAME + ".java"); + IFile classIFile = dest.getFile(CLASS_FILENAME + ".java"); //$NON-NLS-1$ File classFile = classIFile.getLocation().toFile(); if (!classFile.exists()) { @@ -131,7 +131,7 @@ public abstract class RegistrationHelper { } catch (IOException e) { - PluginLogger.error("Error during registration class creation [writing class]", e); + PluginLogger.error(Messages.getString("RegistrationHelper.WriteClassError"), e); //$NON-NLS-1$ } finally { try { writer.close(); @@ -146,7 +146,7 @@ public abstract class RegistrationHelper { File listFile = getClassesListFile(pProject).getLocation().toFile(); listFile.createNewFile(); } catch (IOException e) { - PluginLogger.error("Error during registration classes list", e); + PluginLogger.error(Messages.getString("RegistrationHelper.WriteClassesListError"), e); //$NON-NLS-1$ } finally { try { empty.close(); @@ -194,8 +194,8 @@ public abstract class RegistrationHelper { */ public static String getRegistrationClassName(IUnoidlProject pProject) { // Compute the name of the main implementation class - String implPkg = pProject.getCompanyPrefix() + "." + pProject.getOutputExtension(); - return implPkg + "." + CLASS_FILENAME; + String implPkg = pProject.getCompanyPrefix() + "." + pProject.getOutputExtension(); //$NON-NLS-1$ + return implPkg + "." + CLASS_FILENAME; //$NON-NLS-1$ } /** @@ -215,7 +215,7 @@ public abstract class RegistrationHelper { try { file.createNewFile(); } catch (IOException e) { - PluginLogger.error("Error during registration classes list", e); + PluginLogger.error(Messages.getString("RegistrationHelper.WriteClassesListError"), e); //$NON-NLS-1$ } } @@ -259,10 +259,10 @@ public abstract class RegistrationHelper { try { writer = new FileWriter(file); for (String implClass : pClasses) { - writer.append(implClass + "\n"); + writer.append(implClass + "\n"); //$NON-NLS-1$ } } catch (IOException e) { - PluginLogger.error("Error during classes list writing", e); + PluginLogger.error(Messages.getString("RegistrationHelper.WriteClassesListError"), e); //$NON-NLS-1$ } finally { try { writer.close(); @@ -285,6 +285,6 @@ public abstract class RegistrationHelper { IPath relPath = pProject.getImplementationPath(); IFolder dest = pProject.getFolder(relPath); - return dest.getFile("RegistrationHandler.classes"); + return dest.getFile("RegistrationHandler.classes"); //$NON-NLS-1$ } } diff --git a/java/source/org/openoffice/ide/eclipse/java/registration/messages.properties b/java/source/org/openoffice/ide/eclipse/java/registration/messages.properties new file mode 100644 index 0000000..5baee50 --- /dev/null +++ b/java/source/org/openoffice/ide/eclipse/java/registration/messages.properties @@ -0,0 +1,4 @@ +FileRefreshJob.Error=Can't refresh the registration classes file +RegistrationHelper.ReadTemplateError=Error during registration class creation [reading template] +RegistrationHelper.WriteClassError=Error during registration class creation [writing class] +RegistrationHelper.WriteClassesListError=Error during classes list writing |