From a5086554d5e947fe40def9d8c064afbfeb95c17b Mon Sep 17 00:00:00 2001 From: "donghyuk.yang" Date: Sat, 17 Nov 2012 18:37:15 +0900 Subject: [PATCH] [Title] Enable/disable cancel button of launch wizard --- .../pages/LaunchWizardPageUIMessages.properties | 3 +++ .../wizard/pages/PlatformLaunchSettingAppPage.java | 3 ++- .../wizard/pages/PlatformLaunchSettingBinPage.java | 19 ++++++++++++++----- .../wizard/pages/PlatformLaunchSettingProcPage.java | 21 ++++++++++++++------- .../launch/wizards/PlatformAttachLaunchWizard.java | 2 +- .../launch/wizards/PlatformLaunchUtils.java | 2 +- .../launch/wizards/PlatformLaunchWizard.java | 16 ++++++++++++---- 7 files changed, 47 insertions(+), 19 deletions(-) diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/LaunchWizardPageUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/LaunchWizardPageUIMessages.properties index 875d2b3..ad532e9 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/LaunchWizardPageUIMessages.properties +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/LaunchWizardPageUIMessages.properties @@ -11,6 +11,9 @@ BinPage.Remote.Dialog.Title = Select an Application ProcPage.Title = Select Process ProcPage.Desc = Please select a process for attach debugging +ProcPage.Label.ProcName = Process: +ProcPage.Label.ProcPath = Path: +ProcPage.Button.Browse = Browse PkgDialog.Title = Select packages to be installed PkgDialog.Desc = Checked packages will be installed to buildsystem and device diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingAppPage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingAppPage.java index 698e9d7..4495249 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingAppPage.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingAppPage.java @@ -57,6 +57,7 @@ import org.tizen.nativeplatform.build.PlatformConfigurationManager; import org.tizen.nativeplatform.build.PlatformProjectPackaging; import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages; import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils; +import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizard; import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander; import org.tizen.nativeplatform.pkgmgr.model.LocalPackage; import org.tizen.nativeplatform.rootstrap.RootstrapManager; @@ -101,7 +102,7 @@ public class PlatformLaunchSettingAppPage extends WizardPage { String targetId = PlatformConfigurationManager.getBuildTargetName(config); String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId); this.rootstrap = RootstrapManager.getRootstrap(rootId); - this.rootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString()); + this.rootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString()); setPlatformPackages(); setProjectMap(); diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingBinPage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingBinPage.java index 721866b..fcd3e7a 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingBinPage.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingBinPage.java @@ -19,6 +19,8 @@ import org.tizen.common.connection.ConnectionPlugin; import org.tizen.common.connection.ui.TizenRemoteFileDialog; import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult; import org.tizen.nativecommon.launch.TizenLaunchMessages; +import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizard; +import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizardDialog; import org.tizen.nativeplatform.views.ui.AddRootstrapDialog; import org.tizen.sdblib.IDevice; import org.tizen.sdblib.FileListingService.FileEntry; @@ -27,16 +29,18 @@ public class PlatformLaunchSettingBinPage extends WizardPage { private final String BUNDLE_NAME = PlatformLaunchSettingBinPage.class.getPackage().getName() + ".LaunchWizardPageUIMessages";//$NON-NLS-1$ private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME); + private PlatformLaunchWizard wizard; private Text text; private String filePath = ""; private static final String DEFAULT_APP_PATH = "/opt/apps/"; - public PlatformLaunchSettingBinPage(String pageName) { + public PlatformLaunchSettingBinPage(PlatformLaunchWizard wizard, String pageName) { super(pageName); + this.wizard = wizard; setTitle(resources.getString("BinPage.Title")); setDescription(resources.getString("BinPage.Desc")); - setPageComplete(true); + setPageComplete(true); } @Override @@ -45,9 +49,9 @@ public class PlatformLaunchSettingBinPage extends WizardPage { Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - text = new Text(composite, SWT.SINGLE | SWT.BORDER); + text = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); - text.setLayoutData(data); + text.setLayoutData(data); Button browseButton = new Button(composite, SWT.PUSH); browseButton.setText(resources.getString("BinPage.Button.Browse")); @@ -57,6 +61,11 @@ public class PlatformLaunchSettingBinPage extends WizardPage { String path = handleBrowseButtonSelected(); if (path != null) { text.setText(path); + wizard.setEnableFinish(true); + wizard.getContainer().updateButtons(); + } else { + wizard.setEnableFinish(false); + wizard.getContainer().updateButtons(); } } }); @@ -88,7 +97,7 @@ public class PlatformLaunchSettingBinPage extends WizardPage { resources.getString("BinPage.Remote.Dialog.Title"), device, false, DEFAULT_APP_PATH); if(dlg.open() == TizenRemoteFileDialogResult.OK) { FileEntry selectedFile = dlg.getSelectedFileEntry(); - filePath = selectedFile.getFullPath(); + filePath = selectedFile.getFullPath().trim(); } else filePath = null; } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingProcPage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingProcPage.java index 75d068c..17369d3 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingProcPage.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingProcPage.java @@ -35,6 +35,7 @@ import org.tizen.nativeplatform.build.PlatformConfigurationManager; import org.tizen.nativeplatform.build.PlatformProjectPackaging; import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages; import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils; +import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizard; import org.tizen.nativeplatform.pkgmgr.model.LocalPackage; import org.tizen.nativeplatform.rootstrap.RootstrapManager; @@ -54,6 +55,7 @@ public class PlatformLaunchSettingProcPage extends WizardPage { private Shell shell; private String rootPath = ""; private String procName = ""; + private PlatformLaunchWizard wizard; private IConfiguration config; @@ -64,13 +66,14 @@ public class PlatformLaunchSettingProcPage extends WizardPage { private ArrayList platformPackages = new ArrayList(); private ArrayList packages = new ArrayList(); - public PlatformLaunchSettingProcPage(Shell shell, String pageName, IProject project, IConfiguration config) { + public PlatformLaunchSettingProcPage(PlatformLaunchWizard wizard, Shell shell, String pageName, IProject project, IConfiguration config) { super(pageName); setTitle(resources.getString("ProcPage.Title")); - setDescription("ProcPage.Desc"); + setDescription(resources.getString("ProcPage.Desc")); setPageComplete(true); + this.wizard = wizard; this.platformProject = project; this.config = config; this.shell = shell; @@ -144,12 +147,12 @@ public class PlatformLaunchSettingProcPage extends WizardPage { composite.setLayoutData(gridData); Label procLabel = new Label(composite, SWT.NONE); - procLabel.setText("Process : "); + procLabel.setText(resources.getString("ProcPage.Label.ProcName")); processText = new Text(composite, SWT.BORDER | SWT.READ_ONLY); processText.setLayoutData(gridData); Button findBt = new Button(composite, SWT.PUSH); - findBt.setText("Find"); + findBt.setText(resources.getString("ProcPage.Button.Browse")); findBt.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent evt) { @@ -163,6 +166,11 @@ public class PlatformLaunchSettingProcPage extends WizardPage { processText.setText(value); procName = name; pathText.setText(procInfo.getName()); + wizard.setEnableFinish(true); + wizard.getContainer().updateButtons(); + } else { + wizard.setEnableFinish(false); + wizard.getContainer().updateButtons(); } } }); @@ -179,11 +187,10 @@ public class PlatformLaunchSettingProcPage extends WizardPage { composite.setLayoutData(gridData); Label procPath = new Label(composite, SWT.NONE); - procPath.setText("Path : "); + procPath.setText(resources.getString("ProcPage.Label.ProcPath")); pathText = new Text(composite, SWT.BORDER | SWT.READ_ONLY); - pathText.setLayoutData(gridData); - pathText.setEnabled(false); + pathText.setLayoutData(gridData); } public String getProgramPath() { diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformAttachLaunchWizard.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformAttachLaunchWizard.java index b50521c..fdcf8cc 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformAttachLaunchWizard.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformAttachLaunchWizard.java @@ -31,7 +31,7 @@ public class PlatformAttachLaunchWizard extends PlatformLaunchWizard { @Override public void addPages() { - addPage(new PlatformLaunchSettingProcPage(shell, SETTING_PROC_PAGE, project, config)); + addPage(new PlatformLaunchSettingProcPage(this, shell, SETTING_PROC_PAGE, project, config)); WizardDialog dialog = (WizardDialog)getContainer(); dialog.addPageChangedListener(this); diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java index 2165b6e..abe6253 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java @@ -450,7 +450,7 @@ public class PlatformLaunchUtils { }; TwoPaneElementSelector dlg = new TwoPaneElementSelector(shell, topprovider, downprovider); - dlg.setTitle("Select Process"); //$NON-NLS-1$ + dlg.setTitle(String.format("Select Process [%s]", device.getDeviceName())); //$NON-NLS-1$ String dlgMsg = ""; if (procName != null && count == 0) { dlgMsg = String.format("There is no \"%s\" process.\n", procName); diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizard.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizard.java index 7847966..68c7d38 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizard.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizard.java @@ -42,6 +42,7 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene protected String appProject = ""; protected String mode = ""; protected boolean result; + protected boolean canFinish = false; private final String SETTING_APP_PAGE = "setting_app"; private final String SETTING_BIN_PAGE = "setting_bin"; @@ -61,9 +62,16 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene @Override public boolean needsProgressMonitor() { - // TODO Auto-generated method stub - //return super.needsProgressMonitor(); return true; + } + + @Override + public boolean canFinish() { + return canFinish; + } + + public void setEnableFinish(boolean value) { + canFinish = value; } @Override @@ -105,7 +113,7 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene @Override public void addPages() { addPage(new PlatformLaunchSettingAppPage(shell, SETTING_APP_PAGE, project, config)); - addPage(new PlatformLaunchSettingBinPage(SETTING_BIN_PAGE)); + addPage(new PlatformLaunchSettingBinPage(this, SETTING_BIN_PAGE)); WizardDialog dialog = (WizardDialog)getContainer(); dialog.addPageChangedListener(this); @@ -117,7 +125,7 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene WizardPage selectedPage = (WizardPage)event.getSelectedPage(); if (selectedPage.getName().equals(SETTING_APP_PAGE)) { - + } } -- 2.7.4