package org.tizen.nativeplatform.build.ui;
-
import java.util.ArrayList;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
@SuppressWarnings("restriction")
public class GBSBuildConfigurationTab extends AbstractCBuildPropertyTab {
- protected boolean checked;
- private Button option_clean;
- private Button option_ccache;
- private Button option_overwrite;
- private Button option_includeall;
- private Button option_skipRepos;
- private Button option_noConfigure;
- private Button option_commit;
- private Button option_extraPacks;
- private Button option_threads;
- private Button option_exclude;
- private Button option_keepPacks;
- private Button option_noinit;
- private Button option_incremental;
- private Text text_extraPacks;
- private Text text_exclude;
- private Text text_threads;
- private Text text_commit;
-
- private final String EMPTY_STRING = "";
- private final String PREFIX_DESC = ": ";
- private final String ERROR_LABEL = "Check if GBS(>= %s) is installed.";
-
- private String[] avaiableOptions = {
- "--clean",
- "--ccache",
- "--overwrite",
- "--include-all",
- "--skip-conf-repos",
- "--no-configure",
- "--threads",
- "--commit",
- "--exclude",
- "--extra-packs",
- "--keep-packs",
- "--noinit",
- "--incremental"
- };
-
- private boolean[] checkOptions = {
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false
- };
-
- private Button[] buttons = {
- option_clean,
- option_ccache,
- option_overwrite,
- option_includeall,
- option_skipRepos,
- option_noConfigure,
- option_threads,
- option_commit,
- option_exclude,
- option_extraPacks,
- option_keepPacks,
- option_noinit,
- option_incremental
-
- };
-
- private Text[] texts = {
- null,
- null,
- null,
- null,
- null,
- null,
- text_threads,
- text_commit,
- text_exclude,
- text_extraPacks,
- null,
- null,
- null
- };
-
- public void createControls(Composite _parent, ICPropertyProvider _provider) {
- page = _provider;
- if (canBeVisible()) {
- createControls(_parent);
- }
- }
-
- @Override
- protected void createControls(Composite parent) {
- super.createControls(parent);
- usercomp.setLayout(new GridLayout(1, false));
-
- if (!GBSOptionManager.isInitialized()) {
- GBSOptionManager.initOptions();
- }
-
- if (GBSOptionManager.getOptions().isEmpty()) {
- createErrorComposite(usercomp);
- return;
- }
-
- Composite composite = new Composite(usercomp, SWT.NONE);
- GridLayout gridLayout = new GridLayout(2,false);
- gridLayout.marginBottom = 0;
- gridLayout.marginTop = 0;
- gridLayout.marginLeft = 0;
- gridLayout.marginRight = 0;
- GridData gd = new GridData(GridData.BEGINNING, GridData.FILL, false, false);
- gd.widthHint = 800;
- composite.setLayout(gridLayout);
- composite.setLayoutData(gd);
-
- createCleanOption(composite, 0);
- createCcacheOption(composite, 1);
- createOverwriteOption(composite, 2);
- createIncludeAllOption(composite, 3);
- createSkipReposOption(composite, 4);
- createNoConfigureOption(composite, 5);
- createThreadsOption(composite, 6);
- createCommitOption(composite, 7);
- createExcludeOption(composite, 8);
- createExtraPacksOption(composite, 9);
- createKeepPacksOption(composite, 10);
- createNoInitOption(composite, 11);
- createIncrementalOption(composite, 12);
- }
-
- private void createErrorComposite(Composite parent) {
- Composite composite = new Composite(usercomp, SWT.NONE);
- GridLayout gridLayout = new GridLayout(1,false);
- gridLayout.marginBottom = 0;
- gridLayout.marginTop = 0;
- gridLayout.marginLeft = 0;
- gridLayout.marginRight = 0;
- GridData gd = new GridData(GridData.BEGINNING, GridData.FILL, false, false);
- gd.widthHint = 800;
- composite.setLayout(gridLayout);
- composite.setLayoutData(gd);
-
- Label errorLabel = new Label(composite, SWT.NONE);
- errorLabel.setText(String.format(ERROR_LABEL, Double.toString(GBSOptionManager.MIN_GBS_VERSION)));
- }
-
- private void createCcacheOption(Composite parent, int index) {
- createOption(parent, index);
- }
-
- private void createCleanOption(Composite parent, int index) {
- createOption(parent, index);
- }
-
- private void createOverwriteOption(Composite parent, int index) {
- createOption(parent, index);
- }
-
- private void createIncludeAllOption(Composite parent, int index) {
- createOption(parent, index);
- }
-
- private void createSkipReposOption(Composite parent, int index) {
- createOption(parent, index);
- }
-
- private void createNoConfigureOption(Composite parent, int index) {
- createOption(parent, index);
- }
-
- private void createExtraPacksOption(Composite parent, int index) {
- createOptionWithText(parent, index);
- }
-
- private void createExcludeOption(Composite parent, int index) {
- createOptionWithText(parent, index);
- }
-
- private void createCommitOption(Composite parent, int index) {
- createOptionWithText(parent, index);
- }
-
- private void createThreadsOption(Composite parent, final int index) {
- createOptionWithText(parent, index);
- }
-
- private void createKeepPacksOption(Composite parent, int index) {
- createOption(parent, index);
- }
-
- private void createNoInitOption(Composite parent, int index) {
- createOption(parent, index);
- }
-
- private void createIncrementalOption(Composite parent, int index) {
- createOption(parent, index);
- }
-
- private void createOptionWithText(Composite parent, final int index) {
-
- GBSOption op = GBSOptionManager.getOption(avaiableOptions[index]);
- if (op == null) {
- return;
- }
-
- buttons[index] = new Button(parent, SWT.CHECK);
- buttons[index].setText(op.getOption());
- buttons[index].setSelection(checkOptions[index]);
-
- buttons[index].addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- Button button = (Button) event.widget;
- if (button.getSelection()) {
- texts[index].setEnabled(true);
- checkOptions[index] = true;
- if (!isMultiConfiguration()) {
- String value = texts[index].getText();
- String option = String.format("%s=%s", avaiableOptions[index], value);
- PlatformConfigurationManager.addGBSOptions(getCfg(), option);
- }
- } else {
- texts[index].setEnabled(false);
- checkOptions[index] = false;
- if (!isMultiConfiguration()) {
- PlatformConfigurationManager.removeGBSOptions(getCfg(), avaiableOptions[index]);
- }
- }
- }
- });
-
- Label desc = new Label(parent, SWT.NONE);
- desc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- desc.setText(getDesc(op));
-
- texts[index] = new Text(parent, SWT.BORDER);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = 2;
- texts[index].setLayoutData(gd);
- texts[index].setEnabled(checkOptions[index]);
- texts[index].addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- Text text = (Text)event.widget;
- String value = text.getText();
- if (value.isEmpty()) {
- return;
- }
- if (!isMultiConfiguration()) {
- String option = String.format("%s=%s", avaiableOptions[index], value);
- PlatformConfigurationManager.replaceGBSOptions(getCfg(), option);
- }
- }
- });
-
- }
-
- private void createOption(Composite parent, final int index) {
-
- GBSOption op = GBSOptionManager.getOption(avaiableOptions[index]);
- if (op == null) {
- return;
- }
- buttons[index] = new Button(parent, SWT.CHECK);
- buttons[index].setText(op.getOption());
- buttons[index].setSelection(checkOptions[index]);
- buttons[index].addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- Button button = (Button) event.widget;
- if (button.getSelection()) {
- if (!isMultiConfiguration()) {
- PlatformConfigurationManager.addGBSOptions(getCfg(), avaiableOptions[index]);
- }
- checkOptions[index] = true;
- } else {
- if (!isMultiConfiguration()) {
- PlatformConfigurationManager.removeGBSOptions(getCfg(), avaiableOptions[index]);
- }
- checkOptions[index] = false;
- }
- }
- });
-
- GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- buttons[index].setLayoutData(gd);
-
- Label desc = new Label(parent, SWT.NONE);
- desc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- desc.setText(getDesc(op));
- }
-
- @Override
- protected void performOK() {
- // if multi configuration, set new gbs options.
- if (isMultiConfiguration()) {
- ArrayList<String> newOptions = new ArrayList<String>();
- for (int i = 0 ; i < avaiableOptions.length ; i++) {
- boolean checked = checkOptions[i];
- if (checked) {
- String option = EMPTY_STRING;
- if (texts[i] != null) {
- String value = texts[i].getText();
- option = String.format("%s=%s", avaiableOptions[i], value);
- } else {
- option = avaiableOptions[i];
- }
- newOptions.add(option);
- }
- }
- PlatformConfigurationManager.setGBSOptions(getCfg(), newOptions);
- }
- }
-
- @Override
- public boolean canBeVisible() {
- IManagedProject managedProject = getCfg().getManagedProject();
- String projectArtifactType = managedProject.getProjectType() != null ?
- managedProject.getProjectType().getBuildArtefactType().getId() : null;
- if ( projectArtifactType != null &&
- projectArtifactType.equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE)) {
- return true;
- }
-
- return false;
- }
-
- @Override
- protected void performApply(ICResourceDescription src,
- ICResourceDescription dst) {
- }
-
- @Override
- protected void performDefaults() {
- }
-
- @Override
- protected void updateData(ICResourceDescription cfg) {
-
- // if multi configuration, just do initialize.
- if (isMultiConfiguration()) {
- for (int i = 0 ; i < avaiableOptions.length ; i++) {
- initControl(i);
- }
- } else {
- IConfiguration conf = getCfg();
- ArrayList<String> options = PlatformConfigurationManager.getGBSOptions(conf);
- for (int i = 0 ; i < avaiableOptions.length ; i++) {
- initControl(i);
- String op = avaiableOptions[i];
- for (String s : options) {
- String[] strs = s.split("=");
- s = strs[0].trim();
- if (s.equals(op)) {
- checkOptions[i] = true;
- buttons[i].setSelection(true);
- if (texts[i] != null) {
- texts[i].setEnabled(true);
- if (strs.length == 2) {
- texts[i].setText(strs[1]);
- }
- }
- }
- }
- }
- }
- }
-
- private void initControl(int index) {
- checkOptions[index] = false;
- buttons[index].setSelection(false);
- if (texts[index] != null) {
- texts[index].setEnabled(false);
- texts[index].setText(EMPTY_STRING);
- }
- }
-
- private boolean isMultiConfiguration() {
- IConfiguration config = getCfg();
- return (config instanceof MultiConfiguration);
- }
-
- private String getDesc(GBSOption op) {
- return PREFIX_DESC + filterDesc(op.getDesc());
- }
-
-
- @Override
- protected void updateButtons() {
- }
-
- private String filterDesc(String desc) {
- if (desc.length() > 85) {
- int index = desc.indexOf(" ", 85);
- if (index < 85) {
- return desc;
- }
- String desc1 = desc.substring(0, index);
- String desc2 = desc.substring(index).trim();
- return desc1 + "\n " + filterDesc(desc2);
- }
- return desc;
- }
+ protected boolean checked;
+ private Button option_clean;
+ private Button option_ccache;
+ private Button option_overwrite;
+ private Button option_includeall;
+ private Button option_skipRepos;
+ private Button option_noConfigure;
+ private Button option_commit;
+ private Button option_extraPacks;
+ private Button option_threads;
+ private Button option_exclude;
+ private Button option_keepPacks;
+ private Button option_noinit;
+ private Button option_incremental;
+ private Text text_extraPacks;
+ private Text text_exclude;
+ private Text text_threads;
+ private Text text_commit;
+
+ private final String EMPTY_STRING = "";
+ private final String PREFIX_DESC = ": ";
+ private final String ERROR_LABEL = "Check if GBS(>= %s) is installed.";
+
+ private String[] avaiableOptions = { "--clean", "--ccache", "--overwrite", "--include-all",
+ "--skip-conf-repos", "--no-configure", "--threads", "--commit", "--exclude",
+ "--extra-packs", "--keep-packs", "--noinit", "--incremental" };
+
+ private boolean[] checkOptions = { false, false, false, false, false, false, false, false,
+ false, false, false, false, false };
+
+ private Button[] buttons = { option_clean, option_ccache, option_overwrite, option_includeall,
+ option_skipRepos, option_noConfigure, option_threads, option_commit, option_exclude,
+ option_extraPacks, option_keepPacks, option_noinit, option_incremental
+
+ };
+
+ private Text[] texts = { null, null, null, null, null, null, text_threads, text_commit,
+ text_exclude, text_extraPacks, null, null, null };
+
+ public void createControls(Composite _parent, ICPropertyProvider _provider) {
+ page = _provider;
+ if (canBeVisible()) {
+ createControls(_parent);
+ }
+ }
+
+ @Override
+ protected void createControls(Composite parent) {
+ super.createControls(parent);
+ usercomp.setLayout(new GridLayout(1, false));
+
+ if (!GBSOptionManager.isInitialized()) {
+ GBSOptionManager.initOptions();
+ }
+
+ if (GBSOptionManager.getOptions().isEmpty()) {
+ createErrorComposite(usercomp);
+ return;
+ }
+
+ Composite composite = new Composite(usercomp, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(2, false);
+ gridLayout.marginBottom = 0;
+ gridLayout.marginTop = 0;
+ gridLayout.marginLeft = 0;
+ gridLayout.marginRight = 0;
+ GridData gd = new GridData(GridData.BEGINNING, GridData.FILL, false, false);
+ gd.widthHint = 800;
+ composite.setLayout(gridLayout);
+ composite.setLayoutData(gd);
+
+ createCleanOption(composite, 0);
+ createCcacheOption(composite, 1);
+ createOverwriteOption(composite, 2);
+ createIncludeAllOption(composite, 3);
+ createSkipReposOption(composite, 4);
+ createNoConfigureOption(composite, 5);
+ createThreadsOption(composite, 6);
+ createCommitOption(composite, 7);
+ createExcludeOption(composite, 8);
+ createExtraPacksOption(composite, 9);
+ createKeepPacksOption(composite, 10);
+ createNoInitOption(composite, 11);
+ createIncrementalOption(composite, 12);
+ }
+
+ private void createErrorComposite(Composite parent) {
+ Composite composite = new Composite(usercomp, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(1, false);
+ gridLayout.marginBottom = 0;
+ gridLayout.marginTop = 0;
+ gridLayout.marginLeft = 0;
+ gridLayout.marginRight = 0;
+ GridData gd = new GridData(GridData.BEGINNING, GridData.FILL, false, false);
+ gd.widthHint = 800;
+ composite.setLayout(gridLayout);
+ composite.setLayoutData(gd);
+
+ Label errorLabel = new Label(composite, SWT.NONE);
+ errorLabel.setText(String.format(ERROR_LABEL,
+ Double.toString(GBSOptionManager.MIN_GBS_VERSION)));
+ }
+
+ private void createCcacheOption(Composite parent, int index) {
+ createOption(parent, index);
+ }
+
+ private void createCleanOption(Composite parent, int index) {
+ createOption(parent, index);
+ }
+
+ private void createOverwriteOption(Composite parent, int index) {
+ createOption(parent, index);
+ }
+
+ private void createIncludeAllOption(Composite parent, int index) {
+ createOption(parent, index);
+ }
+
+ private void createSkipReposOption(Composite parent, int index) {
+ createOption(parent, index);
+ }
+
+ private void createNoConfigureOption(Composite parent, int index) {
+ createOption(parent, index);
+ }
+
+ private void createExtraPacksOption(Composite parent, int index) {
+ createOptionWithText(parent, index);
+ }
+
+ private void createExcludeOption(Composite parent, int index) {
+ createOptionWithText(parent, index);
+ }
+
+ private void createCommitOption(Composite parent, int index) {
+ createOptionWithText(parent, index);
+ }
+
+ private void createThreadsOption(Composite parent, final int index) {
+ createOptionWithText(parent, index);
+ }
+
+ private void createKeepPacksOption(Composite parent, int index) {
+ createOption(parent, index);
+ }
+
+ private void createNoInitOption(Composite parent, int index) {
+ createOption(parent, index);
+ }
+
+ private void createIncrementalOption(Composite parent, int index) {
+ createOption(parent, index);
+ }
+
+ private void createOptionWithText(Composite parent, final int index) {
+
+ GBSOption op = GBSOptionManager.getOption(avaiableOptions[index]);
+ if (op == null) {
+ return;
+ }
+
+ buttons[index] = new Button(parent, SWT.CHECK);
+ buttons[index].setText(op.getOption());
+ buttons[index].setSelection(checkOptions[index]);
+
+ buttons[index].addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ Button button = (Button) event.widget;
+ if (button.getSelection()) {
+ texts[index].setEnabled(true);
+ checkOptions[index] = true;
+ if (!isMultiConfiguration()) {
+ String value = texts[index].getText();
+ String option = String.format("%s=%s", avaiableOptions[index], value);
+ PlatformConfigurationManager.addGBSOptions(getCfg(), option);
+ }
+ } else {
+ texts[index].setEnabled(false);
+ checkOptions[index] = false;
+ if (!isMultiConfiguration()) {
+ PlatformConfigurationManager.removeGBSOptions(getCfg(),
+ avaiableOptions[index]);
+ }
+ }
+ }
+ });
+
+ Label desc = new Label(parent, SWT.NONE);
+ desc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ desc.setText(getDesc(op));
+
+ texts[index] = new Text(parent, SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 2;
+ texts[index].setLayoutData(gd);
+ texts[index].setEnabled(checkOptions[index]);
+ texts[index].addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ Text text = (Text) event.widget;
+ String value = text.getText();
+ if (value.isEmpty()) {
+ return;
+ }
+ if (!isMultiConfiguration()) {
+ String option = String.format("%s=%s", avaiableOptions[index], value);
+ PlatformConfigurationManager.replaceGBSOptions(getCfg(), option);
+ }
+ }
+ });
+
+ }
+
+ private void createOption(Composite parent, final int index) {
+
+ GBSOption op = GBSOptionManager.getOption(avaiableOptions[index]);
+ if (op == null) {
+ return;
+ }
+ buttons[index] = new Button(parent, SWT.CHECK);
+ buttons[index].setText(op.getOption());
+ buttons[index].setSelection(checkOptions[index]);
+ buttons[index].addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ Button button = (Button) event.widget;
+ if (button.getSelection()) {
+ if (!isMultiConfiguration()) {
+ PlatformConfigurationManager
+ .addGBSOptions(getCfg(), avaiableOptions[index]);
+ }
+ checkOptions[index] = true;
+ } else {
+ if (!isMultiConfiguration()) {
+ PlatformConfigurationManager.removeGBSOptions(getCfg(),
+ avaiableOptions[index]);
+ }
+ checkOptions[index] = false;
+ }
+ }
+ });
+
+ GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
+ buttons[index].setLayoutData(gd);
+
+ Label desc = new Label(parent, SWT.NONE);
+ desc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ desc.setText(getDesc(op));
+ }
+
+ @Override
+ protected void performOK() {
+ // if multi configuration, set new gbs options.
+ if (isMultiConfiguration()) {
+ ArrayList<String> newOptions = new ArrayList<String>();
+ for (int i = 0; i < avaiableOptions.length; i++) {
+ boolean checked = checkOptions[i];
+ if (checked) {
+ String option = EMPTY_STRING;
+ if (texts[i] != null) {
+ String value = texts[i].getText();
+ option = String.format("%s=%s", avaiableOptions[i], value);
+ } else {
+ option = avaiableOptions[i];
+ }
+ newOptions.add(option);
+ }
+ }
+ PlatformConfigurationManager.setGBSOptions(getCfg(), newOptions);
+ }
+ }
+
+ @Override
+ public boolean canBeVisible() {
+ IManagedProject managedProject = getCfg().getManagedProject();
+ String projectArtifactType = managedProject.getProjectType() != null ? managedProject
+ .getProjectType().getBuildArtefactType().getId() : null;
+ if (projectArtifactType != null
+ && projectArtifactType
+ .equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
+ }
+
+ @Override
+ protected void performDefaults() {
+ }
+
+ @Override
+ protected void updateData(ICResourceDescription cfg) {
+
+ // if multi configuration, just do initialize.
+ if (isMultiConfiguration()) {
+ for (int i = 0; i < avaiableOptions.length; i++) {
+ initControl(i);
+ }
+ } else {
+ IConfiguration conf = getCfg();
+ ArrayList<String> options = PlatformConfigurationManager.getGBSOptions(conf);
+ for (int i = 0; i < avaiableOptions.length; i++) {
+ initControl(i);
+ String op = avaiableOptions[i];
+ for (String s : options) {
+ String[] strs = s.split("=");
+ s = strs[0].trim();
+ if (s.equals(op)) {
+ checkOptions[i] = true;
+ buttons[i].setSelection(true);
+ if (texts[i] != null) {
+ texts[i].setEnabled(true);
+ if (strs.length == 2) {
+ texts[i].setText(strs[1]);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void initControl(int index) {
+ checkOptions[index] = false;
+ buttons[index].setSelection(false);
+ if (texts[index] != null) {
+ texts[index].setEnabled(false);
+ texts[index].setText(EMPTY_STRING);
+ }
+ }
+
+ private boolean isMultiConfiguration() {
+ IConfiguration config = getCfg();
+ return (config instanceof MultiConfiguration);
+ }
+
+ private String getDesc(GBSOption op) {
+ return PREFIX_DESC + filterDesc(op.getDesc());
+ }
+
+ @Override
+ protected void updateButtons() {
+ }
+
+ private String filterDesc(String desc) {
+ if (desc.length() > 85) {
+ int index = desc.indexOf(" ", 85);
+ if (index < 85) {
+ return desc;
+ }
+ String desc1 = desc.substring(0, index);
+ String desc2 = desc.substring(index).trim();
+ return desc1 + "\n " + filterDesc(desc2);
+ }
+ return desc;
+ }
}
tizenCommand = new TizenLaunchCommand(currentDevice, null);
activateProgressView();
-
verifyDeviceReachability();
setRootstrap(config);
setPkgCommandTarget();
protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ setAttributes(wc);
+ }
+
+ protected void setAttributes(ILaunchConfigurationWorkingCopy wc) throws CoreException {
wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST,
TizenPlatformConstants.LOCALHOST);
}
protected boolean needsSetConfiguration(ILaunchConfiguration config) throws CoreException {
- // If the project is EFL app or launching is not from shorcut, need set
+ // If the project is EFL app or launching is not from shortcut, need set
// configurations.
IProject project = getProject(config);
boolean isEflApp = PlatformProjectUtil.isEFLApplication(project);
package org.tizen.nativeplatform.launch;
import java.io.File;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.IProcessInfo;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
-import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.utils.PathUtil;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.tizen.common.TizenPlatformConstants;
-import org.tizen.common.util.StringUtil;
import org.tizen.nativecommon.ProjectUtil;
import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
import org.tizen.nativeplatform.pkg.commander.factory.PkgLauncherFactory;
import org.tizen.nativeplatform.pkg.model.IPackage;
import org.tizen.nativeplatform.types.LaunchTypes;
-import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.ProcessSelector;
-import org.tizen.sdblib.exception.SdbCommandRejectedException;
-import org.tizen.sdblib.exception.TimeoutException;
public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
@Override
protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
-
setSharedlibrarySearchPath(config);
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
-
pid = wc.getAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSID_OPTION, -1);
- wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
- wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST,
- TizenPlatformConstants.LOCALHOST);
- String gdbserverPort = wc.getAttribute(
- TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT,
- TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
- ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
- try {
- int localDebugPort = getDebugPort();
- if (localDebugPort < 0) {
- newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, null);
- }
- currentDevice.createForward(localDebugPort, Integer.parseInt(gdbserverPort));
- String localPort = Integer.valueOf(localDebugPort).toString();
- wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort);
- wc.doSave();
- } catch (TimeoutException e) {
- newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
- } catch (SdbCommandRejectedException e) {
- newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
- } catch (CoreException e) {
- newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
- } catch (IOException e) {
- newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
- }
+ setAttributes(wc);
}
private void setSharedlibrarySearchPath(ILaunchConfiguration config) throws CoreException {
installPackages(config, mode, monitor);
}
- @Override
- protected void launchApplicationWithGDBServer(ILaunch launch, ILaunchConfiguration config,
- IProgressMonitor monitor) throws CoreException {
-
- try {
- monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER, 1);
- monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);
-
- IPath path = getHostPath(TizenPlatformConstants.HOST_GDBSERVER_PATH, config);
- PlatformLaunchUtil.readyGdbServer(currentDevice, tizenCommand, path);
-
- if (pid.equals(Integer.valueOf(-1)) || pid.equals(Integer.valueOf(0))) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER
- + ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID, null);
- }
-
- String gdbserverRunCommand = getGdbserverRunCommand(config);
- String resultCommand = null;
-
- // is gdbserver running now ? then
- resultCommand = String.format(TizenPlatformConstants.PROCESS_GET_PROCESS_ID_COMMAND,
- gdbserverRunCommand.trim());
- tizenCommand.run(resultCommand, null);
- if (tizenCommand.getEndLine() != null) {
- if (StringUtil.isInteger(tizenCommand.getEndLine().trim())) {
- resultCommand = String.format(TizenPlatformConstants.PROCESS_SIGKILL_COMMAND,
- tizenCommand.getEndLine() + TizenPlatformConstants.CMD_RESULT_CHECK);
- try {
- tizenCommand.run(resultCommand, "0");
- } catch (CoreException e) {
- newCoreException(TizenLaunchMessages.GDBSERVER_ALREADY_RUNNING, null);
- } catch (Exception e) {
- newCoreException(TizenLaunchMessages.GDBSERVER_ALREADY_RUNNING, null);
- }
- }
- }
- // Run gdbserver as blocking mode!
- tizenCommand.run(gdbserverRunCommand, null, true);
- } catch (CoreException e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
- } catch (Exception e) {
- newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
- } finally {
- monitor.done();
- }
- }
-
protected String getGdbserverRunCommand(ILaunchConfiguration config) throws CoreException,
Exception {
+ if (pid.equals(Integer.valueOf(-1)) || pid.equals(Integer.valueOf(0))) {
+ newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER
+ + ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID, null);
+ }
+
String gdbserverPort = config.getAttribute(
TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT,
TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-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.ITizenLaunchConfigurationConstants;
-import org.tizen.sdblib.IDevice;
-import org.tizen.sdblib.service.FileEntry;
+import org.tizen.nativeplatform.util.PlatformLaunchUtil;
@SuppressWarnings({ "restriction" })
public class PlatformCommonTab extends CMainTab {
});
}
- protected void handleRemoteBrowseButtonSelected() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
- window = windows[0];
- }
-
- final Shell shell = window.getShell();
- if (shell != null) {
- IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
- if (device == null) {
- MessageBox msgBox = new MessageBox(shell, SWT.ICON_INFORMATION);
- msgBox.setMessage(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
- msgBox.open();
- return;
- }
+ protected String handleRemoteBrowseButtonSelected() {
+ final Shell shell = getAvailableShell();
+ String path = PlatformLaunchUtil.selectRemoteFile(shell,
+ resources.getString("Remote.Dialog.Title"));
+ return path;
+ }
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
- TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, resources
- .getString("Remote.Dialog.Title"), device, false, device
- .getAppInstallPath() + "/");
- if (dlg.open() == TizenRemoteFileDialogResult.OK) {
- FileEntry selectedFile = dlg.getSelectedFileEntry();
- filePath = selectedFile.getFullPath();
- fBinPathText.setText(filePath);
- } else {
- filePath = null;
- }
- }
- });
+ protected Shell getAvailableShell() {
+ Shell shell = getShell();
+ if (shell == null) {
+ shell = PlatformLaunchUtil.getAvaiableShell();
}
- return;
+ return shell;
}
@Override
fBrowseForBinaryButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
- handleRemoteBrowseButtonSelected();
+ String path = handleRemoteBrowseButtonSelected();
+ if (path != null) {
+ fBinPathText.setText(path);
+ }
updateLaunchConfigurationDialog();
}
});
package org.tizen.nativeplatform.launch.ui.shortcut;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
-import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
-import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
import org.tizen.nativeplatform.build.PlatformConfigurationManager;
import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
import org.tizen.nativeplatform.launch.wizards.PlatformAttachLaunchWizard;
return null;
}
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programPath);
- wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, reinstallOp);
- wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, selectPkgOp);
+ setAttributes(wc, project);
wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSNAME_OPTION, procName);
wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSID_OPTION, pid);
- wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_FROM_SHORTCUT, true);
-
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
- wc.setMappedResources(new IResource[] { project });
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID,
- TizenLaunchConfigurationConstants.DEBUGGER_ID);
- wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY,
- ITizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
- wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true);
- wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS,
- false);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
- ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
-
- ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
- if (projDes != null) {
- String buildConfigID = projDes.getActiveConfiguration().getId();
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID,
- buildConfigID);
- }
-
// Load up the debugger page to set the defaults. There should
// probably be a separate extension point for this.
ICDebuggerPage page = CDebugUIPlugin.getDefault().getDebuggerPage(debugConfig.getID());
private boolean setLaunchConfiguration(IProject project, String mode) {
IConfiguration config = PlatformConfigurationManager.getDefaultConfiguration(project);
final Shell shell = getAvaiableShell();
- PlatformAttachLaunchWizard wizard = new PlatformAttachLaunchWizard(shell, project,
- config, target, mode);
+ PlatformAttachLaunchWizard wizard = new PlatformAttachLaunchWizard(shell, project, config,
+ target, mode);
PlatformLaunchWizardDialog dlg = new PlatformLaunchWizardDialog(shell, wizard);
dlg.create();
if (Window.OK == dlg.open()) {
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
import org.eclipse.cdt.debug.internal.ui.launch.CApplicationLaunchShortcut;
+import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.util.DialogUtil;
import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
import org.tizen.nativecommon.launch.TizenLaunchMessages;
import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.pkg.model.IPackage;
}
}
+ protected void setAttributes(ILaunchConfigurationWorkingCopy wc, IProject project) {
+ if (programPath != null) {
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programPath);
+ }
+ setOptionsAttr(wc);
+ setProjectAttr(wc, project);
+ setWorkingDirAttr(wc);
+ setDebuggerAttr(wc);
+ setBuildAttr(wc, project);
+ }
+
+ protected void setProjectAttr(ILaunchConfigurationWorkingCopy wc, IProject project) {
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
+ wc.setMappedResources(new IResource[] { project });
+ }
+
+ protected void setWorkingDirAttr(ILaunchConfigurationWorkingCopy wc) {
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
+ }
+
+ protected void setOptionsAttr(ILaunchConfigurationWorkingCopy wc) {
+ wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, reinstallOp);
+ wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, selectPkgOp);
+ wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_FROM_SHORTCUT, true);
+ }
+
+ protected void setDebuggerAttr(ILaunchConfigurationWorkingCopy wc) {
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID,
+ TizenLaunchConfigurationConstants.DEBUGGER_ID);
+ wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY,
+ ITizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
+ wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true);
+ wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
+ }
+
+ protected void setBuildAttr(ILaunchConfigurationWorkingCopy wc, IProject project) {
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
+ ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
+ ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
+ if (projDes != null) {
+ String buildConfigID = projDes.getActiveConfiguration().getId();
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID,
+ buildConfigID);
+ }
+ }
+
protected boolean checkPackaging(IProject project) {
IConfiguration config = PlatformConfigurationManager.getDefaultConfiguration(project);
List<IPackage> pkgs = pkgUtil.getPackages(project, config);
protected Shell getAvaiableShell() {
Shell shell = getShell();
if (shell == null) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
- window = windows[0];
- }
- shell = window.getShell();
+ shell = PlatformLaunchUtil.getAvaiableShell();
}
return shell;
}
package org.tizen.nativeplatform.launch.ui.shortcut;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
-import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
import org.tizen.nativeplatform.Activator;
-import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
@SuppressWarnings("restriction")
if (programName != null) {
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName);
}
-
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
- wc.setMappedResources(new IResource[] { project });
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
+ setProjectAttr(wc, project);
+ setWorkingDirAttr(wc);
+ setDebuggerAttr(wc);
+ setBuildAttr(wc, project);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID,
- TizenLaunchConfigurationConstants.DEBUGGER_ID);
- wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY,
- ITizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
- wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true);
- wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS,
- false);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
- ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
-
- ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
- if (projDes != null) {
- String buildConfigID = projDes.getActiveConfiguration().getId();
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID,
- buildConfigID);
- }
// Load up the debugger page to set the defaults. There should
// probably be a separate extension point for this.
}
private String getProgramName() throws CoreException {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
- window = windows[0];
- }
- final Shell shell = window.getShell();
-
+ final Shell shell = getAvaiableShell();
TizenPathInputDialog dlg = new TizenPathInputDialog(shell,
APPLICATION_PATH_INPUT_DIALOG_TITLE, APPLICATION_PATH_INPUT_DIALOG_TEXT, null);
if (Window.OK == dlg.open()) {
} else {
newCoreException(PlatformLaunchMessages.OPERATION_CANCELED, null);
}
-
return null;
}
package org.tizen.nativeplatform.launch.ui.shortcut;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
-import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchWindow;
-import org.tizen.common.util.DialogUtil;
-import org.tizen.nativecommon.build.CommonBuildMessages;
-import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
import org.tizen.nativeplatform.build.PlatformConfigurationManager;
import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
-import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizard;
import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizardDialog;
import org.tizen.nativeplatform.launch.wizards.SelectItemDialog;
import org.tizen.nativeplatform.pkg.model.IPackage;
-import org.tizen.nativeplatform.util.PackageUtil;
import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
if (!setLaunchConfiguration(project, mode)) {
return null;
}
-
- if (programPath != null) {
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programPath);
- }
+ setAttributes(wc, project);
if (appProjectName != null && !APP_PROJ_DEFAULT_SELECTION.equals(appProjectName)) {
wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_APP_PROJECT_NAME,
}
wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_EXTRA_PACKAGE_LIST, strs);
}
-
- wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, reinstallOp);
- wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, selectPkgOp);
- wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_FROM_SHORTCUT, true);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
- wc.setMappedResources(new IResource[] { project });
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID,
- TizenLaunchConfigurationConstants.DEBUGGER_ID);
- wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY,
- ITizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
- wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true);
- wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS,
- false);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
- ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
-
- ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
- if (projDes != null) {
- String buildConfigID = projDes.getActiveConfiguration().getId();
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID,
- buildConfigID);
- }
-
// Load up the debugger page to set the defaults. There should
- // probably be a separate
- // extension point for this.
+ // probably be a separate extension point for this.
ICDebuggerPage page = CDebugUIPlugin.getDefault().getDebuggerPage(debugConfig.getID());
setSourceContainer(project, wc);
page.setDefaults(wc);
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-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.sdblib.IDevice;
-import org.tizen.sdblib.service.FileEntry;
+import org.tizen.nativeplatform.util.PlatformLaunchUtil;
public class TizenPathInputDialog extends Dialog {
/**
* Input text widget.
*/
private Text text;
+ private static final String REMOTE_BROWSE = "Remote Browse...";
+ private static final String SELECT_AN_APPLICATION = "Select an Application";
- private String filePath = "";
-
- private static final String REMOTE_BROWSE = "Remote Browse...";
- private static final String SELECT_AN_APPLICATION = "Select an Application";
- private static final String SELECT_A_FILE = "Select a file";
- private static final String SELECT_A_FILE_TO_RUN = "Select a file";
-
- public TizenPathInputDialog(Shell parentShell, String dialogTitle,
- String dialogMessage, String initialValue) {
+ public TizenPathInputDialog(Shell parentShell, String dialogTitle, String dialogMessage,
+ String initialValue) {
super(parentShell);
this.title = dialogTitle;
message = dialogMessage;
if (initialValue == null) {
- value = "";//$NON-NLS-1$
- } else {
- value = initialValue;
- }
- }
-
+ value = "";//$NON-NLS-1$
+ } else {
+ value = initialValue;
+ }
+ }
+
/*
* (non-Javadoc) Method declared on Dialog.
*/
/*
* (non-Javadoc)
*
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ * @see
+ * org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
+ * .Shell)
*/
protected void configureShell(Shell shell) {
super.configureShell(shell);
if (title != null) {
- shell.setText(title);
- }
+ shell.setText(title);
+ }
}
/*
* (non-Javadoc)
*
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ * @see
+ * org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
+ * .swt.widgets.Composite)
*/
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
- okButton = createButton(parent, IDialogConstants.OK_ID,
- IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false);
- //do this here because setting the text will set enablement on the ok
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ // do this here because setting the text will set enablement on the ok
// button
text.setFocus();
if (value != null) {
if (message != null) {
Label label = new Label(composite, SWT.WRAP);
label.setText(message);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL
- | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
+ | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label.setLayoutData(data);
label.setFont(parent.getFont());
}
-
+
Composite pathComp = new Composite(composite, SWT.NONE);
GridLayout pathLayout = new GridLayout();
pathLayout.numColumns = 2;
GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
text.setLayoutData(data);
-
- Button browseButton;
- browseButton = createPushButton(pathComp, REMOTE_BROWSE, null);
- browseButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent evt) {
- String path = handleBrowseButtonSelected();
- if (path != null) {
- text.setText(path);
- }
- }
- });
+
+ Button browseButton;
+ browseButton = createPushButton(pathComp, REMOTE_BROWSE, null);
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent evt) {
+ String path = handleBrowseButtonSelected();
+ if (path != null) {
+ text.setText(path);
+ }
+ }
+ });
applyDialogFont(composite);
return composite;
}
return value;
}
- /**
- * Returns the style bits that should be used for the input text field.
- * Defaults to a single line entry. Subclasses may override.
- *
- * @return the integer style bits that should be used when creating the
- * input text
- *
- * @since 3.4
- */
- protected int getInputTextStyle() {
- return SWT.SINGLE | SWT.BORDER;
- }
-
- public static Button createPushButton(Composite parent, String label, Image image) {
- Button button = new Button(parent, SWT.PUSH);
- button.setFont(parent.getFont());
- if (image != null) {
- button.setImage(image);
- }
- if (label != null) {
- button.setText(label);
- }
- GridData gd = new GridData();
- button.setLayoutData(gd);
- return button;
- }
-
- protected String handleBrowseButtonSelected() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
- window = windows[0];
- }
+ /**
+ * Returns the style bits that should be used for the input text field.
+ * Defaults to a single line entry. Subclasses may override.
+ *
+ * @return the integer style bits that should be used when creating the
+ * input text
+ *
+ * @since 3.4
+ */
+ protected int getInputTextStyle() {
+ return SWT.SINGLE | SWT.BORDER;
+ }
+
+ public static Button createPushButton(Composite parent, String label, Image image) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setFont(parent.getFont());
+ if (image != null) {
+ button.setImage(image);
+ }
+ if (label != null) {
+ button.setText(label);
+ }
+ GridData gd = new GridData();
+ button.setLayoutData(gd);
+ return button;
+ }
- final Shell shell = window.getShell();
- if (shell != null) {
- IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
- if (device == null) {
- MessageBox msgBox = new MessageBox(shell, SWT.ICON_INFORMATION);
- msgBox.setMessage(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
- msgBox.open();
- return null;
- }
+ protected String handleBrowseButtonSelected() {
+ final Shell shell = getAvailableShell();
+ String path = PlatformLaunchUtil.selectRemoteFile(shell, SELECT_AN_APPLICATION);
+ return path;
+ }
- shell.getDisplay().syncExec( new Runnable() {
- public void run() {
- IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
- TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, SELECT_AN_APPLICATION, device, false, device.getAppInstallPath() + "/");
- if(dlg.open() == TizenRemoteFileDialogResult.OK) {
- FileEntry selectedFile = dlg.getSelectedFileEntry();
- filePath = selectedFile.getFullPath();
- } else {
- filePath = null;
- }
- }
- });
- }
- return filePath;
- }
+ protected Shell getAvailableShell() {
+ Shell shell = getShell();
+ if (shell == null) {
+ shell = PlatformLaunchUtil.getAvaiableShell();
+ }
+ return shell;
+ }
}
\ No newline at end of file
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.pkg.model.IPackage;
import org.tizen.nativeplatform.util.PackageUtil;
+import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
import org.tizen.nativeplatform.views.model.PlatformRootstrap;
protected Button reinstallOp;
protected Button selectPkgOp;
-
+
protected IProject platformProject;
protected IConfiguration config;
protected List<IPackage> platformPackages = new ArrayList<IPackage>();
protected String rootPath = "";
protected Shell shell;
protected PackageUtil pkgUtil = new PackageUtil(PlatformProjectUtil.getPkgType());
-
+
protected PlatformLaunchCommonPage(String pageName) {
super(pageName);
}
public void createControl(Composite parent) {
}
-
+
protected List<IPackage> getPackages(IProject project, IConfiguration config) {
return pkgUtil.getPackages(project, config);
}
-
+
protected void setPlatformPackages() {
platformPackages.clear();
platformPackages = getPackages(platformProject, config);
packages.addAll(platformPackages);
}
}
-
+
public List<IPackage> getPackages() {
return packages;
}
-
+
public boolean getReinstallOp() {
return reinstallOp.getSelection();
}
public boolean getSelectPkgOp() {
return selectPkgOp.getSelection();
}
-
+
public String getRootstrapPath() {
return rootPath;
}
+
+ protected Shell getAvailableShell() {
+ Shell shell = getShell();
+ if (shell == null) {
+ shell = PlatformLaunchUtil.getAvaiableShell();
+ }
+ return shell;
+ }
}
import java.util.ResourceBundle;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-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.sdblib.IDevice;
-import org.tizen.sdblib.service.FileEntry;
+import org.tizen.nativeplatform.util.PlatformLaunchUtil;
public class PlatformLaunchSettingBinPage extends PlatformLaunchCommonPage {
private PlatformLaunchWizard wizard;
private Text text;
- private String filePath = "";
public PlatformLaunchSettingBinPage(PlatformLaunchWizard wizard, String pageName) {
super(pageName);
-
+
this.wizard = wizard;
setTitle(resources.getString("BinPage.Title"));
setDescription(resources.getString("BinPage.Desc"));
}
protected String handleBrowseButtonSelected() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
- window = windows[0];
- }
-
- final Shell shell = window.getShell();
- if (shell != null) {
- IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
- if (device == null) {
- MessageBox msgBox = new MessageBox(shell, SWT.ICON_INFORMATION);
- msgBox.setMessage(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
- msgBox.open();
- return null;
- }
-
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
- TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, resources
- .getString("BinPage.Remote.Dialog.Title"), device, false, device
- .getAppInstallPath() + "/");
- if (dlg.open() == TizenRemoteFileDialogResult.OK) {
- FileEntry selectedFile = dlg.getSelectedFileEntry();
- filePath = selectedFile.getFullPath().trim();
- } else {
- filePath = null;
- }
- }
- });
- }
- return filePath;
+ final Shell shell = getAvailableShell();
+ String path = PlatformLaunchUtil.selectRemoteFile(shell,
+ resources.getString("BinPage.Remote.Dialog.Title"));
+ return path;
}
public String getPath() {
package org.tizen.nativeplatform.pkgmgr.ui;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
public AddRepoDialog(Shell parentShell, String tab, boolean supportLocalRepo) {
super(parentShell);
this.supportLocalRepo = supportLocalRepo;
- Rectangle bounds = parentShell.getBounds();
- x = bounds.x + (bounds.width - width) / 2;
- y = bounds.y + (bounds.height - height) / 2;
}
@Override
private void createPackageTable(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- // composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
composite.setLayout(new FillLayout());
- // composite.setLayout(new GridLayout(1,false));
-
pkgViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.CHECK);
createPackageTableColumns(composite);
Table packageTable = pkgViewer.getTable();
- /*
- * packageTable.addListener(SWT.Selection, new Listener() {
- *
- * @Override public void handleEvent(Event event) { if (event.detail ==
- * SWT.CHECK) { PkgStatus pkg = (PkgStatus) event.item.getData();
- * pkg.setChecked(!pkg.isChecked()); }
- *
- * } });
- */
-
packageTable.setHeaderVisible(true);
packageTable.setLinesVisible(true);
pkgViewer.setContentProvider(new ArrayContentProvider());
pkgViewer.setCheckStateProvider(new ICheckStateProvider() {
-
@Override
public boolean isChecked(Object element) {
PkgStatus pkg = (PkgStatus) element;
protected void handleRemovePackageButton() {
final List<PkgStatus> selectedList = getSelectedPkgList(true);
-
if (selectedList.isEmpty()) {
DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package"));
return;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.swt.widgets.Shell;
super(parentShell);
}
- public ModifyRepoDialog(Shell parentShell, String tab) {
- super(parentShell);
- Rectangle bounds = parentShell.getBounds();
- x = bounds.x + (bounds.width - width) / 2;
- y = bounds.y + (bounds.height - height) / 2;
- }
-
public ModifyRepoDialog(Shell parentShell, String tab, String name, String url,
boolean supportLocalRepo) {
super(parentShell);
this.name = name;
this.type = RepoManager.getURLType(url);
this.supportLocalRepo = supportLocalRepo;
- Rectangle bounds = parentShell.getBounds();
- x = bounds.x + (bounds.width - width) / 2;
- y = bounds.y + (bounds.height - height) / 2;
}
-
+
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell, resources.getString("ModifyRepo.Title"));
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
protected RepoCommonDialog(Shell parentShell) {
super(parentShell);
+ Rectangle bounds = parentShell.getBounds();
+ x = bounds.x + (bounds.width - width) / 2;
+ y = bounds.y + (bounds.height - height) / 2;
}
protected abstract void initControls();
newShell.setSize(width, height);
}
- @Override
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(resources.getString("ModifyRepo.Title"));
- newShell.setLocation(x, y);
- newShell.setSize(width, height);
- }
-
protected void createRepoComposite(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.tizen.common.TizenPlatformConstants;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.connection.ui.TizenRemoteFileDialog;
+import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult;
import org.tizen.common.util.DialogUtil;
import org.tizen.nativecommon.TizenNativeException;
import org.tizen.nativecommon.launch.LaunchUtils;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.exception.SdbCommandRejectedException;
import org.tizen.sdblib.exception.TimeoutException;
+import org.tizen.sdblib.service.FileEntry;
import org.tizen.sdblib.service.SyncResult;
public class PlatformLaunchUtil {
+ public static Shell getAvaiableShell() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null) {
+ IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
+ if (windows.length > 0) {
+ window = windows[0];
+ } else {
+ return null;
+ }
+ }
+ return window.getShell();
+ }
+
public static String[] getProjectInfo(IProject project) {
String[] infos = new String[2];
String name = null;
return null;
}
}
-
+
public static boolean questionPackaging(IProject project) {
String msg = String.format(PlatformLaunchMessages.QUESTION_PACKAGING, project.getName());
if (64 == DialogUtil.openQuestionDialog(msg)) {
return false;
}
}
-
+
public static boolean questionContinue() {
if (64 == DialogUtil.openQuestionDialog(PlatformLaunchMessages.QUESTION_CONTINUE)) {
return true;
return false;
}
}
+
+ public static String selectRemoteFile(Shell shell, String title) {
+ String filePath = null;
+ if (shell != null) {
+ IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+ if (device == null) {
+ MessageBox msgBox = new MessageBox(shell, SWT.ICON_INFORMATION);
+ msgBox.setMessage(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
+ msgBox.open();
+ return null;
+ }
+
+ device = ConnectionPlugin.getDefault().getCurrentDevice();
+ TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, title, device, false,
+ device.getAppInstallPath() + "/");
+ if (dlg.open() == TizenRemoteFileDialogResult.OK) {
+ FileEntry selectedFile = dlg.getSelectedFileEntry();
+ filePath = selectedFile.getFullPath();
+ }
+ }
+ return filePath;
+ }
}