Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

chnage code structure

  • Loading branch information...
commit 4a31553bd0ee0e863f9b5df37b7161f1a172cb29 1 parent e6678c4
@antonv antonv authored
View
22 rhogen-wizard/src/rhogenwizard/wizards/rhoconnect/SourceAdapterWizard.java
@@ -2,7 +2,6 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IProject;
@@ -24,7 +23,6 @@
import rhogenwizard.constants.UiConstants;
import rhogenwizard.project.ProjectFactory;
import rhogenwizard.project.RhoconnectProject;
-import rhogenwizard.sdk.facade.RhoTaskHolder;
import rhogenwizard.sdk.helper.TaskResultConverter;
import rhogenwizard.sdk.task.GenerateRhoconnectAdapterTask;
import rhogenwizard.sdk.task.RakeTask;
@@ -32,8 +30,6 @@
public class SourceAdapterWizard extends Wizard implements INewWizard
{
- private static final String okRhodesVersionFlag = "1";
-
private SourceAdapterWizardPage m_pageApp = null;
private ISelection m_selection = null;
private IProject m_currentProject = null;
@@ -64,9 +60,7 @@ public void addPages()
{
if (!RhoconnectProject.checkNature(m_currentProject))
{
- ZeroPage zeroPage =
- new ZeroPage("Project " + m_currentProject.getName()
- + " is not rhoconnect application.");
+ ZeroPage zeroPage = new ZeroPage("Project " + m_currentProject.getName() + " is not rhoconnect application.");
addPage(zeroPage);
}
else
@@ -77,8 +71,7 @@ public void addPages()
}
else
{
- ZeroPage zeroPage =
- new ZeroPage("Select rhoconnect project for create source adapter.");
+ ZeroPage zeroPage = new ZeroPage("Select rhoconnect project for create source adapter.");
addPage(zeroPage);
}
}
@@ -138,8 +131,6 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException
*/
private void doFinish(String adapterName, IProgressMonitor monitor) throws CoreException
{
- IProject newProject = null;
-
try
{
if (m_currentProject.isOpen())
@@ -148,8 +139,7 @@ private void doFinish(String adapterName, IProgressMonitor monitor) throws CoreE
monitor.worked(1);
monitor.setTaskName("Opening file for editing...");
- RakeTask task =
- new GenerateRhoconnectAdapterTask(m_projectLocation, adapterName);
+ RakeTask task = new GenerateRhoconnectAdapterTask(m_projectLocation, adapterName);
Map<String, ?> results = task.run(monitor);
if (TaskResultConverter.getResultIntCode(results) != 0)
@@ -159,9 +149,9 @@ private void doFinish(String adapterName, IProgressMonitor monitor) throws CoreE
m_currentProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- ShowPerspectiveJob job =
- new ShowPerspectiveJob("show rhomobile perspective",
- UiConstants.rhodesPerspectiveId);
+ ShowPerspectiveJob job = new ShowPerspectiveJob(
+ "show rhomobile perspective", UiConstants.rhodesPerspectiveId);
+
job.schedule();
}
View
24 rhogen-wizard/src/rhogenwizard/wizards/rhoconnect/SourceAdapterWizardPage.java
@@ -1,37 +1,20 @@
package rhogenwizard.wizards.rhoconnect;
-import java.io.File;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-
-import rhogenwizard.BuildInfoHolder;
public class SourceAdapterWizardPage extends WizardPage
{
private Text m_modelName = null;
private Text m_modelParams = null;
- private ISelection m_selection = null;
-
/**
* Constructor for SampleNewWizardPage.
*
@@ -42,7 +25,6 @@ public SourceAdapterWizardPage(ISelection selection)
super("wizardPage");
setTitle("Source adapter information");
setDescription("Source adapter create");
- this.m_selection = selection;
}
public void createControl(Composite parent)
@@ -97,11 +79,13 @@ private void updateStatus(String message)
setPageComplete(message == null);
}
- public String getAdapterName() {
+ public String getAdapterName()
+ {
return m_modelName.getText();
}
- public String getModelParams() {
+ public String getModelParams()
+ {
return m_modelParams.getText();
}
}
View
26 rhogen-wizard/src/rhogenwizard/wizards/rhodes/AppWizard.java
@@ -105,8 +105,7 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException
return true;
}
- private void createProjectFiles(BuildInfoHolder infoHolder, IProgressMonitor monitor)
- throws Exception
+ private void createProjectFiles(BuildInfoHolder infoHolder, IProgressMonitor monitor) throws Exception
{
monitor.setTaskName("Generate application...");
@@ -115,13 +114,13 @@ private void createProjectFiles(BuildInfoHolder infoHolder, IProgressMonitor mon
RakeTask task;
if (infoHolder.isRhoelementsApp)
{
- task = new GenerateRhoelementsAppTask(infoHolder.getProjectLocationPath()
- .toOSString(), infoHolder.appName);
+ task = new GenerateRhoelementsAppTask(
+ infoHolder.getProjectLocationPath().toOSString(), infoHolder.appName);
}
else
{
- task = new GenerateRhodesAppTask(infoHolder.getProjectLocationPath().toOSString(),
- infoHolder.appName);
+ task = new GenerateRhodesAppTask(
+ infoHolder.getProjectLocationPath().toOSString(), infoHolder.appName);
}
results = task.run(monitor);
@@ -141,8 +140,6 @@ private void createProjectFiles(BuildInfoHolder infoHolder, IProgressMonitor mon
*/
private void doFinish(BuildInfoHolder infoHolder, IProgressMonitor monitor) throws CoreException, ProjectNotFoundException
{
- IRhomobileProject newProject = null;
-
try
{
monitor.beginTask("Creating " + infoHolder.appName, 2);
@@ -161,10 +158,7 @@ private void doFinish(BuildInfoHolder infoHolder, IProgressMonitor monitor) thro
}
catch (IOException e)
{
- newProject.deleteProjectFiles();
-
- String msg =
- "Installed Rhodes have old version, need rhodes version equal or greater "
+ String msg = "Installed Rhodes have old version, need rhodes version equal or greater "
+ CommonConstants.rhodesVersion
+ " Please reinstall it (See 'http://docs.rhomobile.com/rhodes/install' for more information)";
DialogUtils.error("Error", msg);
@@ -178,7 +172,7 @@ private void doFinish(BuildInfoHolder infoHolder, IProgressMonitor monitor) thro
}
monitor.setTaskName("Create project...");
- newProject = ProjectFactory.getInstance().createProject(RhodesProject.class, infoHolder);
+ IRhomobileProject newProject = ProjectFactory.getInstance().createProject(RhodesProject.class, infoHolder);
newProject.refreshProject();
ShowPerspectiveJob job = new ShowPerspectiveJob("show rhodes perspective", UiConstants.rhodesPerspectiveId);
@@ -188,11 +182,9 @@ private void doFinish(BuildInfoHolder infoHolder, IProgressMonitor monitor) thro
}
catch (IOException e)
{
- newProject.deleteProjectFiles();
-
String msg = "Cannot find Rhodes, need rhodes version equal or greater "
- + CommonConstants.rhodesVersion
- + " (See 'http://docs.rhomobile.com/rhodes/install' for more information)";
+ + CommonConstants.rhodesVersion
+ + " (See 'http://docs.rhomobile.com/rhodes/install' for more information)";
DialogUtils.error("Error", msg);
}
catch (AlredyCreatedException e)
View
31 rhogen-wizard/src/rhogenwizard/wizards/rhodes/ModelWizard.java
@@ -52,12 +52,11 @@ public void addPages()
{
if (m_currentProject != null)
{
- if (!RhodesProject.checkNature(m_currentProject)
- && !RhoelementsProject.checkNature(m_currentProject))
+ if (!RhodesProject.checkNature(m_currentProject) && !RhoelementsProject.checkNature(m_currentProject))
{
- ZeroPage zeroPage =
- new ZeroPage("Project " + m_currentProject.getName()
- + " is not RhoMobile application");
+ ZeroPage zeroPage = new ZeroPage(
+ "Project " + m_currentProject.getName() + " is not RhoMobile application");
+
addPage(zeroPage);
}
else
@@ -79,8 +78,7 @@ public void addPages()
*/
public boolean performFinish()
{
- if (!RhodesProject.checkNature(m_currentProject)
- && !RhoelementsProject.checkNature(m_currentProject))
+ if (!RhodesProject.checkNature(m_currentProject) && !RhoelementsProject.checkNature(m_currentProject))
return true;
final String modelName = m_pageModel.getModelName();
@@ -127,9 +125,8 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException
* The worker method. It will find the container, create the file if missing
* or just replace its contents, and open the editor on the newly created
* file.
- */
- private void doFinish(String modelName, String modelParams, IProgressMonitor monitor)
- throws CoreException
+ */
+ private void doFinish(String modelName, String modelParams, IProgressMonitor monitor) throws CoreException
{
try
{
@@ -137,9 +134,7 @@ private void doFinish(String modelName, String modelParams, IProgressMonitor mon
monitor.worked(1);
monitor.setTaskName("Creating model...");
- String projectLocation =
- (m_currentProject == null) ? null : m_currentProject.getLocation()
- .toOSString();
+ String projectLocation = (m_currentProject == null) ? null : m_currentProject.getLocation().toOSString();
if (null != projectLocation)
{
@@ -176,20 +171,20 @@ private static void createModel(IProgressMonitor monitor, String projectLocation
if (modelFolder.exists())
{
- boolean ok =
- DialogUtils.confirm("Model create", "Model with name " + modelName
- + " was already created. Delete old model?");
+ boolean ok = DialogUtils.confirm(
+ "Model create", "Model with name " + modelName + " was already created. Delete old model?");
+
if (!ok)
{
return;
}
+
OSHelper.deleteFolder(modelFolder);
}
try
{
- RakeTask task =
- new GenerateRhodesModelTask(projectLocation, modelName, modelParams);
+ RakeTask task = new GenerateRhodesModelTask(projectLocation, modelName, modelParams);
Map<String, ?> results = task.run(monitor);
View
3  rhogen-wizard/src/rhogenwizard/wizards/rhodes/ModelWizardPage.java
@@ -15,8 +15,6 @@
{
private Text m_modelName = null;
private Text m_modelParams = null;
- private ISelection m_selection = null;
-
/**
* Constructor for SampleNewWizardPage.
*
@@ -27,7 +25,6 @@ public ModelWizardPage(ISelection selection)
super("wizardPage");
setTitle("Model information");
setDescription("Model create");
- this.m_selection = selection;
}
public void createControl(Composite parent)
Please sign in to comment.
Something went wrong with that request. Please try again.