Skip to contentSkip to conversation

Merging windows-build with master

RFC New Ioana Grigoropol 1 participant 6 messages Jun 6, 2013

lore
Share & tools
lore
#0 lore raw

cover Merging windows-build with master

- last batch of patches for merging windows-build with master (from the functionality point of view, from the refactoring pov, some import, whitespaces and annotations may be in order)
- this batch should apply on top of the last batch(21 patches)

Ioana Grigoropol (5):
Remove unused ConsoleWriter
Add implicit constructror for OEFileSystemContributor Refactor and clean-up of OptionsPage fields Refactor OptionsPage to use Remote Location box & validation Validate project name to check for invalid characters

 plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF       |    4 +-
 .../bc/ui/filesystem/OEFileSystemContributor.java  |    3 +
 .../yocto/bc/ui/wizards/install/InstallWizard.java |   33 ---
 .../yocto/bc/ui/wizards/install/OptionsPage.java   |  295 ++++++++++++--------
 4 files changed, 192 insertions(+), 143 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

RFC 1/5 Remove unused ConsoleWriter

- remove unused inner class ConsoleWriter from InstallWizard

---
 .../yocto/bc/ui/wizards/install/InstallWizard.java |   33 --------------------
 1 file changed, 33 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java +0 -33
index f4bc99b..1fc90a4 100644
@@ -198,37 +198,4 @@ public class InstallWizard extends FiniteStateWizard implements
 	public void init(IWorkbench workbench, IStructuredSelection selection) {
 	}
 
-	private class ConsoleWriter extends Writer {
-
-		private StringBuffer sb;
-
-		public ConsoleWriter() {
-			sb = new StringBuffer();
-		}
-
-		@Override
-		public void close() throws IOException {
-		}
-
-		public String getContents() {
-			return sb.toString();
-		}
-
-		@Override
-		public void flush() throws IOException {
-		}
-
-		@Override
-		public void write(char[] cbuf, int off, int len) throws IOException {
-			// txtConsole.getText().concat(new String(cbuf));
-			sb.append(cbuf);
-		}
-
-		@Override
-		public void write(String str) throws IOException {
-			sb.append(str);
-		}
-
-	}
-
 }
Signature · 1 line
1.7.9.5
#2 lore raw

RFC 2/5 Add implicit constructror for OEFileSystemContributor

In reply to Ioana Grigoropol

- this is needed in order to skip calling the default calling of the super constructor

---
 .../bc/ui/filesystem/OEFileSystemContributor.java  |    3 +++
 1 file changed, 3 insertions(+)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java +3 -0
index 4ac2998..338ba1f 100644
@@ -17,6 +17,9 @@ import org.eclipse.ui.ide.fileSystem.FileSystemContributor;
 
 public class OEFileSystemContributor extends FileSystemContributor  {
 
+	public OEFileSystemContributor() {
+	}
+
 	@Override
 	public URI browseFileSystem(String initialPath, Shell shell) {
 		return null;
Signature · 1 line
1.7.9.5
#3 lore raw

RFC 3/5 Refactor and clean-up of OptionsPage fields

In reply to Ioana Grigoropol

- clean-up all unused fields
- rename fields to have consistent names

---
 .../yocto/bc/ui/wizards/install/OptionsPage.java   |   38 ++++----------------
 1 file changed, 7 insertions(+), 31 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +7 -31
index 2844fda..f5e6e0e 100644
@@ -45,19 +45,13 @@ import org.yocto.bc.ui.wizards.FiniteStateWizardPage.ValidationListener;
  */
 public class OptionsPage extends FiniteStateWizardPage {
 
-	private Map vars;
-	private Composite c1;
 	private Composite top;
 	
-	private List controlList;
-	private boolean controlsCreated = false;
-	
 	private Text txtProjectLocation;
 
-	private Text txtInit;
 	private ValidationListener validationListener;
 	private Text txtProjectName;
-	private Button gitButton;
+	private Button btnGit;
 
 	protected OptionsPage(Map model) {
 		super("Options", model);
@@ -125,10 +119,10 @@ public class OptionsPage extends FiniteStateWizardPage {
 		gl.marginWidth = 0;
 		gitComposite.setLayout(gl);
 
-		gitButton = new Button(gitComposite, SWT.CHECK);
-		gitButton.setText("Clone from Yocto Project &Git Repository");
-		gitButton.setEnabled(true);
-		gitButton.addSelectionListener(validationListener);
+		btnGit = new Button(gitComposite, SWT.CHECK);
+		btnGit.setText("Clone from Yocto Project &Git Repository");
+		btnGit.setEnabled(true);
+		btnGit.addSelectionListener(validationListener);
 
 		setControl(top);
 	}
@@ -155,7 +149,7 @@ public class OptionsPage extends FiniteStateWizardPage {
 	protected void updateModel() {
 		model.put(InstallWizard.INSTALL_DIRECTORY, txtProjectLocation.getText()+File.separator+txtProjectName.getText());
 		model.put(InstallWizard.PROJECT_NAME, txtProjectName.getText());
-		model.put(InstallWizard.GIT_CLONE, new Boolean(gitButton.getSelection()));
+		model.put(InstallWizard.GIT_CLONE, new Boolean(btnGit.getSelection()));
 	}
 
 	private boolean isValidProjectName(String projectName) {
@@ -192,7 +186,7 @@ public class OptionsPage extends FiniteStateWizardPage {
 		
 		String projectPath = projectLoc + File.separator+txtProjectName.getText();
 		File git_dir=new File(projectPath);
-		if(!gitButton.getSelection()) {
+		if(!btnGit.getSelection()) {
 			if(!git_dir.isDirectory() || !git_dir.exists()) {
 				setErrorMessage("Directory " + txtProjectLocation.getText()+File.separator+txtProjectName.getText() + " does not exist, please select git clone.");
 				return false;
@@ -226,22 +220,4 @@ public class OptionsPage extends FiniteStateWizardPage {
 		return true;
 	}
 	
-	private class FileOpenSelectionAdapter extends SelectionAdapter {
-		@Override
-		public void widgetSelected(SelectionEvent e) {
-			FileDialog fd = new FileDialog(PlatformUI.getWorkbench()
-					.getDisplay().getActiveShell(), SWT.OPEN);
-
-			fd.setText("Open Configuration Script");
-			fd.setFilterPath(txtProjectLocation.getText());
-
-			String selected = fd.open();
-
-			if (selected != null) {
-				txtInit.setText(selected);
-				updateModel();
-			}
-		}
-	}
-
 }
Signature · 1 line
1.7.9.5
#4 lore raw

RFC 4/5 Refactor OptionsPage to use Remote Location box & validation

In reply to Ioana Grigoropol

- replace text box & browse button with PTP implementation RemoteProjectContentsLocationArea
- this implementation contains:
- two combo boxes: one for the connections, and one for the remote services
- a new button that allows creation of new connections
- a text box & browse button for the location of the project
- any errors that occur within the contents location area will be reported
to the ErrorReporter that was registered at creation time
- in our particular case, on error reporting we:
- set the message of the wizard according
- try and validate the page & update the underlying model
- rearrange items in wizard in order to have a more consistent look (use grid data layout)
- fix page validation
- separate tasks in page validation in:
- project name validation
- project location validation
- project name validation verifies that:
- project name is not empty
- project name is not invalid(contains invalid characters)
- a project with the same name does not exist in the workspace
- project location validation:
- retrieves the remote IHostFile for the project
- case we did select 'git clone'
- make sure that the remote file either does not exists or is a empty directory
- check that in the remote directory, we do not already have a .git file indicating that this directory contains git repo
- case we did not select 'git clone'
- make sure that the directory exists, and it contains oe-init-build-env file

---
 plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF       |    4 +-
 .../yocto/bc/ui/wizards/install/OptionsPage.java   |  253 +++++++++++++-------
 2 files changed, 176 insertions(+), 81 deletions(-)
plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF +3 -1
index 84946ad..58174b9 100644
@@ -18,8 +18,10 @@ Require-Bundle: org.eclipse.ui,
  org.yocto.remote.utils;bundle-version="1.0.0"
 Eclipse-LazyStart: true
 Bundle-ClassPath: .
-Import-Package: org.eclipse.ptp.remote.core,
+Import-Package: org.eclipse.ptp.rdt.ui.wizards,
+ org.eclipse.ptp.remote.core,
  org.eclipse.ptp.remote.core.exception,
+ org.eclipse.ptp.remote.rse.core,
  org.eclipse.rse.core.model,
  org.eclipse.rse.services.clientserver.messages,
  org.eclipse.rse.services.files,
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +173 -80

344 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#5 lore raw

RFC 5/5 Validate project name to check for invalid characters

In reply to Ioana Grigoropol

- project names should not allow spaces, or any illegal characters

---
 .../yocto/bc/ui/wizards/install/OptionsPage.java   |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +10 -2
index 24fd94b..d9ba0ee 100644
@@ -179,10 +179,18 @@ public class OptionsPage extends FiniteStateWizardPage {
 	}
 
 	private boolean isValidProjectName(String projectName) {
-		if (projectName.indexOf('$') > -1) {
+		if (projectName.contains("\\s+"))
+			return false;
+
+		if (projectName.indexOf('$') != -1)
 			return false;
-		}
 
+		char[] chars = projectName.toCharArray();
+		if (!Character.isJavaIdentifierStart(chars[0]))
+			return false;
+		for (int i = 1; i < chars.length; i++)
+			if (!Character.isJavaIdentifierPart(chars[i]) && chars[i] != '-')
+				return false;
 		return true;
 	}
 
Signature · 1 line
1.7.9.5