[ooo-build-commit] ooeclipse: Branch 'ooo-launcher'

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Wed Jun 16 03:39:40 PDT 2010


 core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java                 |    1 
 core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java  |    4 
 core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java            |   63 +-
 core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java          |   20 
 core/source/org/openoffice/ide/eclipse/core/launch/office/IOfficeLaunchConstants.java  |    4 
 core/source/org/openoffice/ide/eclipse/core/launch/office/LaunchConfigurationTabs.java |   19 
 core/source/org/openoffice/ide/eclipse/core/launch/office/Messages.java                |   38 -
 core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java    |  118 ++--
 core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeTab.java               |  258 +++++-----
 core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java                  |   26 -
 core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java                     |    4 
 core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java    |    3 
 12 files changed, 281 insertions(+), 277 deletions(-)

New commits:
commit aefcf86e9709b0d7b4729548f4a83f4938af1d64
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Wed Jun 16 12:39:10 2010 +0200

    Fixed some style problems

diff --git a/core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java b/core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java
index f1c7c7f..d1036c2 100644
--- a/core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java
+++ b/core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java
@@ -106,6 +106,7 @@ public class TypesBuilder extends IncrementalProjectBuilder {
     /**
      * {@inheritDoc}
      */
+    @SuppressWarnings("unchecked")
     protected IProject[] build(int pKind, Map pArgs, IProgressMonitor pMonitor) throws CoreException {
         
         mChangedIdl = false;
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java
index 17012ef..f9690fa 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java
@@ -103,9 +103,9 @@ public class UnoidlProjectHelper {
      */
     public static final String IDL_BASIS = "/idl"; //$NON-NLS-1$
 
-	public static final String DIST_BASIS = "dist";
+    public static final String DIST_BASIS = "dist"; //$NON-NLS-1$
 
-	public static final String OO_PROFILE_BASIS = ".ooo-debug";
+    public static final String OO_PROFILE_BASIS = ".ooo-debug"; //$NON-NLS-1$
     
     /**
      * Create a default configuration file for UNO-IDL projects.
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java
index 678d06e..a8d8a26 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java
@@ -365,40 +365,41 @@ public abstract class AbstractOOo implements IOOo, ITableElement {
     }
     
     public void runOpenOffice(IUnoidlProject pPrj, 
-    		ILaunch pLaunch, IPath userInstallation, IProgressMonitor pMonitor) {
-		try {
-			IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(
-					pPrj.getName());
-			String[] env = pPrj.getLanguage().getLanguageBuidler().getBuildEnv(
-					pPrj);
+            ILaunch pLaunch, IPath pUserInstallation, IProgressMonitor pMonitor) {
+        try {
+            IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(
+                    pPrj.getName());
+            String[] env = pPrj.getLanguage().getLanguageBuidler().getBuildEnv(
+                    pPrj);
 
-			String pathSeparator = System.getProperty("path.separator");
-			String[] sPaths = pPrj.getOOo().getBinPath();
-			StringBuilder sPathValue = new StringBuilder();
-			for (String sPath : sPaths) {
-				sPathValue.append(sPath);
-				sPathValue.append(pathSeparator);
-			}
+            String pathSeparator = System.getProperty("path.separator"); //$NON-NLS-1$
+            String[] sPaths = pPrj.getOOo().getBinPath();
+            StringBuilder sPathValue = new StringBuilder();
+            for (String sPath : sPaths) {
+                sPathValue.append(sPath);
+                sPathValue.append(pathSeparator);
+            }
 
-			String command = "soffice.bin";
-			
-			env = SystemHelper.addEnv(env, "PATH", sPathValue.toString(), pathSeparator);
-			if (null != userInstallation) {
-				// We have to turn the path to a URI something like file:///foo/bar/.ooo-debug
-				//TODO find a better way to get the proper URI.
-				URI userInstallationURI = new URI("file", "", userInstallation.toFile().toURI().getPath(), null);
-				env = SystemHelper.addEnv(env, "UserInstallation", userInstallationURI.toString(), null);
-				command += " -nofirststartwiozard ";
-			}
+            String command = "soffice.bin"; //$NON-NLS-1$
+            
+            env = SystemHelper.addEnv(env, "PATH", sPathValue.toString(), pathSeparator); //$NON-NLS-1$
+            if (null != pUserInstallation) {
+                // We have to turn the path to a URI something like file:///foo/bar/.ooo-debug
+                //TODO find a better way to get the proper URI.
+                URI userInstallationURI = new URI("file", new String(), //$NON-NLS-1$
+                        pUserInstallation.toFile().toURI().getPath(), null);
+                env = SystemHelper.addEnv(env, "UserInstallation", userInstallationURI.toString(), null); //$NON-NLS-1$
+                command += " -nofirststartwiozard "; //$NON-NLS-1$
+            }
 
-			PluginLogger.debug("Launching OpenOffice from commandline: " + command);
-			Process p = pPrj.getSdk().runToolWithEnv(prj, pPrj.getOOo(),
-					command, env, pMonitor);
-			DebugPlugin.newProcess(pLaunch, p, Messages
-					.getString("AbstractOOo.OpenOfficeProcessName")); //$NON-NLS-1$
-		} catch (Exception e) {
-			PluginLogger.error("Error running OpenOffice", e);
-		}
+            PluginLogger.debug("Launching OpenOffice from commandline: " + command); //$NON-NLS-1$
+            Process p = pPrj.getSdk().runToolWithEnv(prj, pPrj.getOOo(),
+                    command, env, pMonitor);
+            DebugPlugin.newProcess(pLaunch, p, Messages
+                    .getString("AbstractOOo.OpenOfficeProcessName")); //$NON-NLS-1$
+        } catch (Exception e) {
+            PluginLogger.error("Error running OpenOffice", e);
+        }
     }
     
     /**
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 ababe90..eb1c39b 100755
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java
@@ -471,16 +471,16 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
         return getFolder(getBuildPath().append(UnoidlProjectHelper.URD_BASIS)).getProjectRelativePath();
     }
     
-	public IPath getDistPath() {
-		return getFolder(getBuildPath().append(UnoidlProjectHelper.DIST_BASIS))
-				.getProjectRelativePath();
-	}
-	
-	public IPath getOpenOfficeUserProfilePath() {
-		return getFolder(
-				getDistPath().append(UnoidlProjectHelper.OO_PROFILE_BASIS))
-				.getProjectRelativePath();
-	}
+    public IPath getDistPath() {
+        return getFolder(getBuildPath().append(UnoidlProjectHelper.DIST_BASIS))
+                .getProjectRelativePath();
+    }
+    
+    public IPath getOpenOfficeUserProfilePath() {
+        return getFolder(
+                getDistPath().append(UnoidlProjectHelper.OO_PROFILE_BASIS))
+                .getProjectRelativePath();
+    }
 
     /**
      * {@inheritDoc}
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/IOfficeLaunchConstants.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/IOfficeLaunchConstants.java
index 153c548..05aa460 100644
--- a/core/source/org/openoffice/ide/eclipse/core/launch/office/IOfficeLaunchConstants.java
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/IOfficeLaunchConstants.java
@@ -2,7 +2,7 @@ package org.openoffice.ide.eclipse.core.launch.office;
 
 public interface IOfficeLaunchConstants {
 
-	String PROJECT_NAME = "project_name";
-	String CLEAN_USER_INSTALLATION = "useCleanUserInstallation";
+    String PROJECT_NAME = "project_name"; //$NON-NLS-1$
+    String CLEAN_USER_INSTALLATION = "useCleanUserInstallation"; //$NON-NLS-1$
 
 }
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/LaunchConfigurationTabs.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/LaunchConfigurationTabs.java
index c6789b2..6921e21 100644
--- a/core/source/org/openoffice/ide/eclipse/core/launch/office/LaunchConfigurationTabs.java
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/LaunchConfigurationTabs.java
@@ -6,17 +6,16 @@ import org.eclipse.debug.ui.ILaunchConfigurationDialog;
 import org.eclipse.debug.ui.ILaunchConfigurationTab;
 
 public class LaunchConfigurationTabs extends
-		AbstractLaunchConfigurationTabGroup {
+        AbstractLaunchConfigurationTabGroup {
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public void createTabs(ILaunchConfigurationDialog pDialog, String pMode) {
-		ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
-				new OfficeTab(), new CommonTab() };
+    /**
+     * {@inheritDoc}
+     */
+    public void createTabs(ILaunchConfigurationDialog pDialog, String pMode) {
+        ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+            new OfficeTab(), new CommonTab() };
 
-		setTabs(tabs);
-
-	}
+        setTabs(tabs);
 
+    }
 }
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/Messages.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/Messages.java
index 3d1871a..b653dde 100644
--- a/core/source/org/openoffice/ide/eclipse/core/launch/office/Messages.java
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/Messages.java
@@ -3,21 +3,27 @@ package org.openoffice.ide.eclipse.core.launch.office;
 import org.eclipse.osgi.util.NLS;
 
 public class Messages extends NLS {
-	private static final String BUNDLE_NAME = "org.openoffice.ide.eclipse.core.launch.office.messages"; //$NON-NLS-1$
-	public static String OfficeLaunchDelegate_LaunchError;
-	public static String OfficeLaunchDelegate_LaunchErrorTitle;
-	public static String OfficeTab_Options;
-	public static String OfficeTab_Configurationerror;
-	public static String OfficeTab_ProjectNameLabel;
-	public static String OfficeTab_Title;
-	public static String OfficeTab_UnoProject;
-	public static String OfficeTab_ChkUseCleanUserInstallation;
-	public static String OfficeTab_ChkUseCleanUserInstallation_ToolTip;
-	static {
-		// initialize resource bundle
-		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-	}
+    
+    public static String OfficeLaunchDelegate_LaunchError;
+    public static String OfficeLaunchDelegate_LaunchErrorTitle;
+    public static String OfficeTab_Options;
+    public static String OfficeTab_Configurationerror;
+    public static String OfficeTab_ProjectNameLabel;
+    public static String OfficeTab_Title;
+    public static String OfficeTab_UnoProject;
+    public static String OfficeTab_ChkUseCleanUserInstallation;
+    public static String OfficeTab_ChkUseCleanUserInstallation_ToolTip;
+    
+    private static final String BUNDLE_NAME = "org.openoffice.ide.eclipse.core.launch.office.messages"; //$NON-NLS-1$
+    
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
 
-	private Messages() {
-	}
+    /**
+     * Private constructor.
+     */
+    private Messages() {
+    }
 }
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 2e42086..5bddc5c 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
@@ -18,70 +18,70 @@ import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
 
 public class OfficeLaunchDelegate extends LaunchConfigurationDelegate {
 
-	/**
-	 * Export the .oxt file, deploy it in openoffice, run openoffice.
-	 */
-	private static final int TASK_UNITS = 3;
+    /**
+     * Export the .oxt file, deploy it in openoffice, run openoffice.
+     */
+    private static final int TASK_UNITS = 3;
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public void launch(ILaunchConfiguration pConfiguration, String pMode,
-			ILaunch pLaunch, IProgressMonitor pMonitor) throws CoreException {
-		if (pMonitor == null) {
-			pMonitor = new NullProgressMonitor();
-		}
+    /**
+     * {@inheritDoc}
+     */
+    public void launch(ILaunchConfiguration pConfiguration, String pMode,
+            ILaunch pLaunch, IProgressMonitor pMonitor) throws CoreException {
+        if (pMonitor == null) {
+            pMonitor = new NullProgressMonitor();
+        }
 
-		try {
-			pMonitor.beginTask(MessageFormat.format("{0}...", //$NON-NLS-1$
-					new Object[] { pConfiguration.getName() }), TASK_UNITS);
-			// check for cancellation
-			if (pMonitor.isCanceled()) {
-				return;
-			}
+        try {
+            pMonitor.beginTask(MessageFormat.format("{0}...", //$NON-NLS-1$
+                    new Object[] { pConfiguration.getName() }), TASK_UNITS);
+            // check for cancellation
+            if (pMonitor.isCanceled()) {
+                return;
+            }
 
-			String prjName = pConfiguration.getAttribute(
-					IOfficeLaunchConstants.PROJECT_NAME, ""); //$NON-NLS-1$
-			boolean useCleanUserInstalation = pConfiguration.getAttribute(
-					IOfficeLaunchConstants.CLEAN_USER_INSTALLATION, false);
-			
-			IUnoidlProject prj = ProjectsManager.getProject(prjName);
+            String prjName = pConfiguration.getAttribute(
+                    IOfficeLaunchConstants.PROJECT_NAME, ""); //$NON-NLS-1$
+            boolean useCleanUserInstalation = pConfiguration.getAttribute(
+                    IOfficeLaunchConstants.CLEAN_USER_INSTALLATION, false);
+            
+            IUnoidlProject prj = ProjectsManager.getProject(prjName);
 
-			if (null != prj) {
-				try {
-					ILanguageBuilder langBuilder = prj.getLanguage()
-							.getLanguageBuidler();
-					langBuilder.createLibrary(prj);
+            if (null != prj) {
+                try {
+                    ILanguageBuilder langBuilder = prj.getLanguage()
+                            .getLanguageBuidler();
+                    langBuilder.createLibrary(prj);
 
-					// Run an OpenOffice instance
-					IPath userInstallation = null;
-					if (useCleanUserInstalation) {
-						IFolder userInstallationFolder = prj.getFolder(prj
-								.getOpenOfficeUserProfilePath());
-						//TODO find  better way to make sure the folder exists.
-						if (!userInstallationFolder.exists()) {
-							((IFolder)userInstallationFolder.getParent()).create(true, true, null);
-							userInstallationFolder.create(true, true, null);
-						}
-						userInstallation = userInstallationFolder.getLocation();
-					}
-							
-					prj.getOOo().runOpenOffice(prj, pLaunch, userInstallation,
-							pMonitor);
-				} catch (Exception e) {
-					Display.getDefault().asyncExec(new Runnable() {
+                    // Run an OpenOffice instance
+                    IPath userInstallation = null;
+                    if (useCleanUserInstalation) {
+                        IFolder userInstallationFolder = prj.getFolder(prj
+                                .getOpenOfficeUserProfilePath());
+                        //TODO find  better way to make sure the folder exists.
+                        if (!userInstallationFolder.exists()) {
+                            ((IFolder)userInstallationFolder.getParent()).create(true, true, null);
+                            userInstallationFolder.create(true, true, null);
+                        }
+                        userInstallation = userInstallationFolder.getLocation();
+                    }
+                            
+                    prj.getOOo().runOpenOffice(prj, pLaunch, userInstallation,
+                            pMonitor);
+                } catch (Exception e) {
+                    Display.getDefault().asyncExec(new Runnable() {
 
-						public void run() {
-							MessageDialog.openError(Display.getDefault()
-									.getActiveShell(), Messages.OfficeLaunchDelegate_LaunchErrorTitle, 
-									Messages.OfficeLaunchDelegate_LaunchError);     
-						}
-					});
-				}
-			}
-		} finally {
-			pMonitor.done();
-		}
-	}
+                        public void run() {
+                            MessageDialog.openError(Display.getDefault()
+                                    .getActiveShell(), Messages.OfficeLaunchDelegate_LaunchErrorTitle, 
+                                    Messages.OfficeLaunchDelegate_LaunchError);     
+                        }
+                    });
+                }
+            }
+        } finally {
+            pMonitor.done();
+        }
+    }
 
 }
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeTab.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeTab.java
index 2b96822..1b0b5b9 100644
--- a/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeTab.java
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeTab.java
@@ -25,133 +25,133 @@ import org.openoffice.ide.eclipse.core.model.ProjectsManager;
 
 public class OfficeTab extends AbstractLaunchConfigurationTab {
 
-	private static final int LAYOUT_COLUMNS = 3;
-	private Text mProjectTxt;
-	private Button mProjectBtn;
-	private Button useCleanUserInstallation;
-	private SelectionListener mListener = new ChangeListener();
-
-	public void createControl(Composite pParent) {
-		Composite comp = new Composite(pParent, SWT.NONE);
-		comp.setLayoutData(new GridData(GridData.FILL_BOTH));
-		comp.setLayout(new GridLayout());
-
-		createProjectGroup(comp);
-
-		createOptionsGroup(comp);
-
-		setControl(comp);
-	}
-
-	private void createOptionsGroup(Composite parent) {
-		Group group = new Group(parent, SWT.NONE);
-		group.setText(Messages.OfficeTab_Options);
-		group.setLayout(new GridLayout());
-		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-		useCleanUserInstallation = new Button(group, SWT.CHECK);
-		useCleanUserInstallation
-				.setText(Messages.OfficeTab_ChkUseCleanUserInstallation);
-		useCleanUserInstallation.addSelectionListener(mListener);
-		useCleanUserInstallation.setToolTipText(Messages.OfficeTab_ChkUseCleanUserInstallation_ToolTip);
-	}
-
-	private void createProjectGroup(Composite parent) {
-		Group group = new Group(parent, SWT.NONE);
-		group.setText(Messages.OfficeTab_UnoProject);
-		group.setLayout(new GridLayout());
-		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-		Composite field = new Composite(group, SWT.NONE);
-		field.setLayout(new GridLayout(LAYOUT_COLUMNS, false));
-		field.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-		Label lbl = new Label(field, SWT.NONE);
-		lbl.setText(Messages.OfficeTab_ProjectNameLabel);
-		lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
-		mProjectTxt = new Text(field, SWT.SINGLE | SWT.BORDER);
-		mProjectTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
-				| GridData.GRAB_HORIZONTAL));
-		// mProjectTxt.addModifyListener(mListener);
-
-		mProjectBtn = new Button(field, SWT.PUSH);
-		mProjectBtn.setText("...");
-		mProjectBtn.addSelectionListener(mListener);
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	public String getName() {
-		return Messages.OfficeTab_Title;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	public void initializeFrom(ILaunchConfiguration pConfiguration) {
-		try {
-			mProjectTxt.setText(pConfiguration.getAttribute(
-					IOfficeLaunchConstants.PROJECT_NAME, ""));
-			useCleanUserInstallation.setSelection(pConfiguration.getAttribute(
-					IOfficeLaunchConstants.CLEAN_USER_INSTALLATION, false));
-		} catch (CoreException e) {
-			PluginLogger.error(Messages.OfficeTab_Configurationerror, e);
-		}
-	}
-
-	public void performApply(ILaunchConfigurationWorkingCopy pConfiguration) {
-		pConfiguration.setAttribute(IOfficeLaunchConstants.PROJECT_NAME,
-				mProjectTxt.getText().trim());
-		pConfiguration.setAttribute(
-				IOfficeLaunchConstants.CLEAN_USER_INSTALLATION,
-				useCleanUserInstallation.getSelection());
-	}
-
-	public void setDefaults(ILaunchConfigurationWorkingCopy pConfiguration) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public boolean isValid(ILaunchConfiguration pLaunchConfig) {
-		boolean valid = false;
-
-		try {
-
-			boolean projectSet = !pLaunchConfig.getAttribute(
-					IOfficeLaunchConstants.PROJECT_NAME, "").equals("");//$NON-NLS-1$ //$NON-NLS-2$
-			if (projectSet) {
-				String name = pLaunchConfig.getAttribute(
-						IOfficeLaunchConstants.PROJECT_NAME, ""); //$NON-NLS-1$
-				valid = ProjectsManager.getProject(name) != null;
-			}
-		} catch (CoreException e) {
-			PluginLogger.error(Messages.OfficeTab_Configurationerror, e);
-		}
-
-		return valid;
-	}
-
-	private class ChangeListener extends SelectionAdapter {
-		public void widgetSelected(SelectionEvent event) {
-			if (event.getSource().equals(mProjectBtn)) {
-				ILabelProvider labelProvider = new UnoProjectLabelProvider();
-				ElementListSelectionDialog dialog = new ElementListSelectionDialog(
-						getShell(), labelProvider);
-				dialog.setTitle("ProjectChooserTitle"); //$NON-NLS-1$
-				dialog.setMessage("ProjectChooserMessage"); //$NON-NLS-1$
-				dialog.setElements(ProjectsManager.getProjects());
-
-				if (dialog.open() == Window.OK) {
-					IUnoidlProject mProject = (IUnoidlProject) dialog
-							.getFirstResult();
-					mProjectTxt.setText(mProject.getName());
-				}
-			}
-			setDirty(true);
-			getLaunchConfigurationDialog().updateButtons();
-		}
-	}
+    private static final int LAYOUT_COLUMNS = 3;
+    private Text mProjectTxt;
+    private Button mProjectBtn;
+    private Button mUseCleanUserInstallation;
+    private SelectionListener mListener = new ChangeListener();
+
+    public void createControl(Composite pParent) {
+        Composite comp = new Composite(pParent, SWT.NONE);
+        comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+        comp.setLayout(new GridLayout());
+
+        createProjectGroup(comp);
+
+        createOptionsGroup(comp);
+
+        setControl(comp);
+    }
+
+    private void createOptionsGroup(Composite pParent) {
+        Group group = new Group(pParent, SWT.NONE);
+        group.setText(Messages.OfficeTab_Options);
+        group.setLayout(new GridLayout());
+        group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        mUseCleanUserInstallation = new Button(group, SWT.CHECK);
+        mUseCleanUserInstallation
+                .setText(Messages.OfficeTab_ChkUseCleanUserInstallation);
+        mUseCleanUserInstallation.addSelectionListener(mListener);
+        mUseCleanUserInstallation.setToolTipText(Messages.OfficeTab_ChkUseCleanUserInstallation_ToolTip);
+    }
+
+    private void createProjectGroup(Composite pParent) {
+        Group group = new Group(pParent, SWT.NONE);
+        group.setText(Messages.OfficeTab_UnoProject);
+        group.setLayout(new GridLayout());
+        group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        Composite field = new Composite(group, SWT.NONE);
+        field.setLayout(new GridLayout(LAYOUT_COLUMNS, false));
+        field.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        Label lbl = new Label(field, SWT.NONE);
+        lbl.setText(Messages.OfficeTab_ProjectNameLabel);
+        lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+        mProjectTxt = new Text(field, SWT.SINGLE | SWT.BORDER);
+        mProjectTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+                | GridData.GRAB_HORIZONTAL));
+        // mProjectTxt.addModifyListener(mListener);
+
+        mProjectBtn = new Button(field, SWT.PUSH);
+        mProjectBtn.setText("..."); //$NON-NLS-1$
+        mProjectBtn.addSelectionListener(mListener);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return Messages.OfficeTab_Title;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void initializeFrom(ILaunchConfiguration pConfiguration) {
+        try {
+            mProjectTxt.setText(pConfiguration.getAttribute(
+                    IOfficeLaunchConstants.PROJECT_NAME, new String()));
+            mUseCleanUserInstallation.setSelection(pConfiguration.getAttribute(
+                    IOfficeLaunchConstants.CLEAN_USER_INSTALLATION, false));
+        } catch (CoreException e) {
+            PluginLogger.error(Messages.OfficeTab_Configurationerror, e);
+        }
+    }
+
+    public void performApply(ILaunchConfigurationWorkingCopy pConfiguration) {
+        pConfiguration.setAttribute(IOfficeLaunchConstants.PROJECT_NAME,
+                mProjectTxt.getText().trim());
+        pConfiguration.setAttribute(
+                IOfficeLaunchConstants.CLEAN_USER_INSTALLATION,
+                mUseCleanUserInstallation.getSelection());
+    }
+
+    public void setDefaults(ILaunchConfigurationWorkingCopy pConfiguration) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean isValid(ILaunchConfiguration pLaunchConfig) {
+        boolean valid = false;
+
+        try {
+
+            boolean projectSet = !pLaunchConfig.getAttribute(
+                    IOfficeLaunchConstants.PROJECT_NAME, "").equals("");//$NON-NLS-1$ //$NON-NLS-2$
+            if (projectSet) {
+                String name = pLaunchConfig.getAttribute(
+                        IOfficeLaunchConstants.PROJECT_NAME, ""); //$NON-NLS-1$
+                valid = ProjectsManager.getProject(name) != null;
+            }
+        } catch (CoreException e) {
+            PluginLogger.error(Messages.OfficeTab_Configurationerror, e);
+        }
+
+        return valid;
+    }
+
+    private class ChangeListener extends SelectionAdapter {
+        public void widgetSelected(SelectionEvent pEvent) {
+            if (pEvent.getSource().equals(mProjectBtn)) {
+                ILabelProvider labelProvider = new UnoProjectLabelProvider();
+                ElementListSelectionDialog dialog = new ElementListSelectionDialog(
+                        getShell(), labelProvider);
+                dialog.setTitle("ProjectChooserTitle"); //$NON-NLS-1$
+                dialog.setMessage("ProjectChooserMessage"); //$NON-NLS-1$
+                dialog.setElements(ProjectsManager.getProjects());
+
+                if (dialog.open() == Window.OK) {
+                    IUnoidlProject mProject = (IUnoidlProject) dialog
+                            .getFirstResult();
+                    mProjectTxt.setText(mProject.getName());
+                }
+            }
+            setDirty(true);
+            getLaunchConfigurationDialog().updateButtons();
+        }
+    }
 }
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 97615a0..93e760f 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
@@ -244,19 +244,19 @@ 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 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 path to the project's folder containing the distribution .oxf
+     *         file.
+     */
+    public IPath getDistPath();
+    
+    /**
+     * @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();
     
     //----------------------------------------------- Project resources getters
     
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java b/core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java
index a9db057..2d1c055 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java
@@ -168,11 +168,11 @@ public interface IOOo {
      * 
      * @param pPrj the project to run
      * @param pLaunch the launcher to which we'll add our processes
-     * @param userInstallation the userInstallation folder to use. If null we'll go with the default system one.
+     * @param pUserInstallation the userInstallation folder to use. If null we'll go with the default system one.
      * @param pMonitor a monitor to follow the progress
      */
     public void runOpenOffice(IUnoidlProject pPrj,  
-            ILaunch pLaunch, IPath userInstallation, IProgressMonitor pMonitor);
+            ILaunch pLaunch, IPath pUserInstallation, IProgressMonitor pMonitor);
     
     /**
      * @return <code>true</code> if the OOo instance has a package manager.
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
index a5071c7..11734e0 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
@@ -33,7 +33,6 @@ package org.openoffice.ide.eclipse.core.wizards.pages;
 import java.io.File;
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 import org.eclipse.core.resources.IContainer;
@@ -46,8 +45,6 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;


More information about the ooo-build-commit mailing list