summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2010-11-30 23:47:35 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2010-11-30 23:47:35 +0100
commitabfbe04571fe4fad1e9d24e3cbb74828faa8a0d4 (patch)
tree8001cd2cb0c1c21d36d0481d44a0321753eb29e7
parente4b13b0bc6619a0596cbde854c4ac36e10361e4d (diff)
[core] code cleanup
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java10
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java2
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java14
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java5
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java46
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java5
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java45
7 files changed, 70 insertions, 57 deletions
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java
index b217e05..ad3c499 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java
@@ -403,7 +403,7 @@ public class OOo extends AbstractOOo {
/**
* Add a Uno package to the OOo user packages.
*
- * FIXME This method has to handle license ap proval
+ * FIXME This method has to handle license approval
*
* @param pPackageFile
* the package file to add
@@ -452,19 +452,19 @@ public class OOo extends AbstractOOo {
*
* @param pName
* the name of the package to remove
- * @param pUuserInstallation
- * TODO
+ * @param pUserInstallation
+ * the path to the office user installation to use
* @throws Exception
* if anything wrong happens
*/
- private void removePackage(String pName, IPath pUuserInstallation) throws Exception {
+ private void removePackage(String pName, IPath pUserInstallation) throws Exception {
String shellCommand = "unopkg remove " + pName; //$NON-NLS-1$
String[] env = SystemHelper.getSystemEnvironement();
String filesep = System.getProperty("file.separator"); //$NON-NLS-1$
String pathsep = System.getProperty("path.separator"); //$NON-NLS-1$
env = SystemHelper.addEnv(env, "PATH", getHome() + filesep + "program", pathsep); //$NON-NLS-1$ //$NON-NLS-2$
- env = addUserProfile(pUuserInstallation, env);
+ env = addUserProfile(pUserInstallation, env);
SystemHelper.runTool(shellCommand, env, null);
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java
index db993b3..c8ec6eb 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java
@@ -259,6 +259,6 @@ public class URE extends AbstractOOo {
/**
* {@inheritDoc}
*/
- public void updatePackage(File pPackageFile, IPath userInstallation) {
+ public void updatePackage(File pPackageFile, IPath pUserInstallation) {
}
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java
index 27de55b..2457b90 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java
@@ -464,26 +464,36 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
return getFolder(getBuildPath().append(UnoidlProjectHelper.URD_BASIS)).getProjectRelativePath();
}
+ /**
+ * {@inheritDoc}
+ */
public IPath getDistPath() {
return getFolder(UnoidlProjectHelper.DIST_BASIS).getProjectRelativePath();
}
+ /**
+ * {@inheritDoc}
+ */
public IFolder getDistFolder() throws CoreException {
IFolder folder = getFolder(getDistPath());
- // TODO find better way to make sure the folder exists.
if (!folder.exists()) {
folder.getLocation().toFile().mkdirs();
}
return folder;
}
+ /**
+ * {@inheritDoc}
+ */
public IPath getOpenOfficeUserProfilePath() {
return getFolder(getDistPath().append(UnoidlProjectHelper.OO_PROFILE_BASIS)).getProjectRelativePath();
}
+ /**
+ * {@inheritDoc}
+ */
public IFolder getOpenOfficeUserProfileFolder() throws CoreException {
IFolder folder = getFolder(getOpenOfficeUserProfilePath());
- // TODO find better way to make sure the folder exists.
if (!folder.exists()) {
folder.getLocation().toFile().mkdirs();
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java
index bde505f..bf48a92 100644
--- a/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java
@@ -31,9 +31,7 @@
package org.openoffice.ide.eclipse.core.launch.office;
import java.io.File;
-import java.io.IOException;
import java.text.MessageFormat;
-import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IFolder;
@@ -42,20 +40,17 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
-import org.openoffice.ide.eclipse.core.PluginLogger;
import org.openoffice.ide.eclipse.core.gui.PackageContentSelector;
import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
import org.openoffice.ide.eclipse.core.model.ProjectsManager;
import org.openoffice.ide.eclipse.core.model.config.IOOo;
import org.openoffice.ide.eclipse.core.model.config.NullExtraOptionsProvider;
-import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
import org.openoffice.plugin.core.model.UnoPackage;
/**
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java b/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
index 67fd77c..76b200f 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
@@ -249,35 +249,35 @@ public interface IUnoidlProject {
*/
public IPath getUrdPath();
- /**
- * @return the path to the project's folder containing the distribution .oxf
- * file.
- */
- public IPath getDistPath();
+ /**
+ * @return the path to the project's folder containing the distribution .oxf
+ * file.
+ */
+ public IPath getDistPath();
/**
* @return the folder folder containing the distribution .oxf file. If the folder does not exist then it is created.
* @throws CoreException
* if we were unable to create the folder.
*/
- public IFolder getDistFolder() throws CoreException;
-
- /**
- * @return the path to the project's folder used to store the user profile
- * when running/debugging OpenOffice in a clean environment. This
- * way we do not mangle with the system wide installed, OpenOffice
- * settings.
- */
- public IPath getOpenOfficeUserProfilePath();
-
- /**
- * @return the folder used to store the user profile
- * when running/debugging OpenOffice in a clean environment. This
- * way we do not mangle with the system wide installed, OpenOffice
- * settings. If the folder does not exist then it is created.
- * @throws CoreException if we were unable to create the folder.
- */
- public IFolder getOpenOfficeUserProfileFolder() throws CoreException;
+ public IFolder getDistFolder() throws CoreException;
+
+ /**
+ * @return the path to the project's folder used to store the user profile
+ * when running/debugging OpenOffice in a clean environment. This
+ * way we do not mangle with the system wide installed, OpenOffice
+ * settings.
+ */
+ public IPath getOpenOfficeUserProfilePath();
+
+ /**
+ * @return the folder used to store the user profile
+ * when running/debugging OpenOffice in a clean environment. This
+ * way we do not mangle with the system wide installed, OpenOffice
+ * settings. If the folder does not exist then it is created.
+ * @throws CoreException if we were unable to create the folder.
+ */
+ public IFolder getOpenOfficeUserProfileFolder() throws CoreException;
//----------------------------------------------- Project resources getters
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java b/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java
index 7445ad6..f32698e 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java
@@ -132,7 +132,10 @@ public class SystemHelper {
*/
public static String[] addEnv(String[] pEnv, String pName, String pValue,
String pSeparator) {
- //TODO cdan should add a test for this method (test that the case is preserved even on windows, but compare with ignoring case on windows)
+ /*
+ * TODO cdan should add a test for this method
+ * (test that the case is preserved even on windows, but compare with ignoring case on windows)
+ */
String[] result = new String[1];
if (pEnv != null) {
diff --git a/core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java b/core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java
index e543478..6993819 100644
--- a/core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java
+++ b/core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java
@@ -20,7 +20,7 @@ public class FilesFinder implements IResourceVisitor {
private String[] mExtensions;
private ArrayList<IFile> mFiles;
- private Set<IPath> excludedPaths = new HashSet<IPath>();
+ private Set<IPath> mExcludedPaths = new HashSet<IPath>();
/**
* Constructor.
@@ -44,30 +44,35 @@ public class FilesFinder implements IResourceVisitor {
*/
public boolean visit(IResource pResource) throws CoreException {
- IPath resourcePath = pResource.getFullPath();
- if(this.excludedPaths.contains(resourcePath)) {
- return false;
- }
-
- if ( pResource.getType() == IResource.FILE ) {
- boolean matches = false;
- String name = pResource.getName();
+ boolean result = false;
+ IPath resourcePath = pResource.getFullPath();
+ if (!this.mExcludedPaths.contains(resourcePath)) {
+ if ( pResource.getType() == IResource.FILE ) {
+ boolean matches = false;
+ String name = pResource.getName();
- int i = 0;
- while ( i < mExtensions.length && !matches ) {
- matches = name.toLowerCase().endsWith( mExtensions[i].toLowerCase() );
- i++;
- }
+ int i = 0;
+ while ( i < mExtensions.length && !matches ) {
+ matches = name.toLowerCase().endsWith( mExtensions[i].toLowerCase() );
+ i++;
+ }
- if ( matches ) {
- mFiles.add( ( IFile )pResource );
+ if ( matches ) {
+ mFiles.add( ( IFile )pResource );
+ }
}
+ result = true;
}
- return true;
+ return result;
}
- public void addExclude(IPath pDistPath) {
- this.excludedPaths.add(pDistPath);
- }
+ /**
+ * Add a path to exclude in the search.
+ *
+ * @param pDistPath the path to exclude
+ */
+ public void addExclude(IPath pDistPath) {
+ this.mExcludedPaths.add(pDistPath);
+ }
}