--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
--- /dev/null
+Copyright (c) 2013 Intel Corporation. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
install-size="0"
version="0.0.0"/>
- <plugin
- id="org.tizen.web.simulator.help"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
</feature>
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.core.resources;bundle-version="3.7.100",
org.tizen.common,
- org.tizen.web.project
+ org.tizen.web.project,
+ org.tizen.web.browser,
+ org.tizen.web.common
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6,
OSGi/Minimum-1.0
Import-Package: org.eclipse.debug.core,
org.eclipse.debug.core.model,
org.eclipse.debug.ui,
- org.tizen.web.common
+ org.tizen.web.common,
+ org.tizen.common.gom.launch,
+ org.tizen.common.gom.smartlaunch
package org.tizen.web.simulator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+import org.tizen.common.util.StringUtil;
+import org.tizen.web.common.ChromeLauncher;
+import org.tizen.web.simulator.preferences.Settings;
+import org.tizen.web.simulator.preferences.WorkbenchPreferencePage;
/**
* The activator class controls the plug-in life cycle
super.stop(context);
}
- public static String getUniqueIdentifier() {
+ public static String[] getChromeOptions() {
+ IPreferenceStore store = getDefault().getPreferenceStore();
+
+ String[] extraParams = store.getString(Settings.EXTRA_PARAM).split(WorkbenchPreferencePage.REGEX_SPACES);
+ String profilePath = store.getString(Settings.PROFILE_PATH);
+ if (!StringUtil.isEmpty(profilePath)) {
+ profilePath = ChromeLauncher.CHROME_PARAM_USERDATADIR + profilePath;
+ }
+
+ List<String> options = new ArrayList<String>();
+ options.addAll(Arrays.asList(extraParams));
+ options.add(profilePath);
+
+ return options.toArray(new String[options.size()]);
+ }
+
+ public static String getUniqueIdentifier() {
return PLUGIN_ID;
}
private static final String BUNDLE_NAME = "org.tizen.web.simulator.messages"; //$NON-NLS-1$
public static String Chrome_excutable;
public static String Chrome_Settings;
+ public static String Override_chrome_settings;
public static String EightSpacesIndent;
public static String Extra_parameters;
+ public static String Profile_data_location;
public static String Internal;
public static String Launch_in_app_mode;
public static String msgErrConfigurationFile;
public static String msgErrProfileLengthExceeded;
public static String msgErrURLConversion;
public static String msgPreferencePageDescription;
- public static String Profile_data_location;
public static String Simulator_Settings;
public static String Simulator_to_use;
public static String User_specified;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IFile;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
-
-import org.tizen.web.project.core.WidgetConfigurator;
-import org.tizen.web.simulator.preferences.Settings;
import org.tizen.common.util.DialogUtil;
+import org.tizen.web.common.ChromeLauncher;
+import org.tizen.web.common.ChromeLauncher.TYPE;
+import org.tizen.web.common.WebCommonActivator;
+import org.tizen.web.project.configuration.WidgetConfigurator;
+import org.tizen.web.simulator.preferences.Settings;
public class Simulator {
//plug-in ID
- public static final String pluginID = "org.tizen.web.simulator"; //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String pluginID = "org.tizen.web.simulator"; //$NON-NLS-1$
- public static final String CHROME_PARAM_DEFAULT = "--allow-file-access-from-files --disable-web-security "; //$NON-NLS-1$ //$NON-NLS-2$
- private static final String CHROME_PARAM_USERDATADIR = "--user-data-dir="; //$NON-NLS-1$ //$NON-NLS-2$
- public static final String CHROME_PARAM_URL = "?url="; //$NON-NLS-1$ //$NON-NLS-2$
- public static final String CHROME_PARAM_APP = "--app="; //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String CHROME_PARAM_URL = "?url="; //$NON-NLS-1$
- public static final String INTERNAL_SIMULATOR_PATH = "/pkg/web/index.html"; //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String INTERNAL_SIMULATOR_PATH = "/pkg/web/index.html"; //$NON-NLS-1$
public static final String[] DEFAULT_INDEXHTML_NAMES = {
- "index.html", "index.htm", //$NON-NLS-1$ //$NON-NLS-2$
- "index.xhtml", "index.xht" //$NON-NLS-1$ //$NON-NLS-2$
+ "index.html", "index.htm", //$NON-NLS-1$
+ "index.xhtml", "index.xht" //$NON-NLS-1$
};
public static final String[] TIZEN_NATURE_IDS = {
- "org.tizen.web.project.builder.WebNature" //$NON-NLS-1$ //$NON-NLS-2$
+ "org.tizen.web.project.builder.WebNature" //$NON-NLS-1$
};
- public static final String REGEX_SPACES = "\\s+"; //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String REGEX_SPACES = "\\s+"; //$NON-NLS-1$
public static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
/**
}
public static Process launch(URL url) {
+ ChromeLauncher launcher = new ChromeLauncher();
+
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
String chromeExecutable = store.getString(Settings.CHROME_EXECUTABLE);
- String chromeParam = CHROME_PARAM_DEFAULT + store.getString(Settings.EXTRA_PARAM);
+ boolean overrideChromeSettings = store.getBoolean(Settings.OVERRIDE_CHROME_SETTINGS);
+
+ String[] options = null;
+ if (!overrideChromeSettings) {
+ options = WebCommonActivator.getChromeOptions();
+ } else {
+ options = Activator.getChromeOptions();
+ }
+
+ launcher.setOptions(options);
+
+ File f = new File(store.getString(Settings.SIMULATOR_PATH));
+ if (!f.exists()) {
+ DialogUtil.openErrorDialog(getShell(), "Error", String.format(Messages.msgErrSimulatorFailed, store.getString(Settings.SIMULATOR_PATH)));
+ return null;
+ }
+
+ try {
+ TYPE type = store.getBoolean(Settings.APP_MODE) ? TYPE.APP : TYPE.URL;
+ return launcher.launch(getAppUrl(url, store), type);
+ } catch (Exception e) {
+ DialogUtil.openErrorDialog(getShell(), "Error", String.format(Messages.msgErrLaunchFailed, chromeExecutable)); //$NON-NLS-1$
+ return null;
+ }
+ }
+
+ private static String getAppUrl(URL url, IPreferenceStore store) {
StringBuffer simulatorURL = new StringBuffer();
- if (store.getBoolean(Settings.APP_MODE))
- simulatorURL.append(CHROME_PARAM_APP);
if (Settings.TRUE.equals(store.getString(Settings.USE_INTERNAL_SIMULATOR))) {
try {
simulatorURL.append(URLtoString(getPluginFileURL(INTERNAL_SIMULATOR_PATH)));
return null;
}
}
-
simulatorURL.append(CHROME_PARAM_URL);
String fileURL;
fileURL = URLtoString(url);
simulatorURL.append(fileURL);
-
-
- StringBuffer userdataDir = new StringBuffer();
- userdataDir.append(CHROME_PARAM_USERDATADIR);
- String profilePath = store.getString(Settings.PROFILE_PATH);
-/*
- if (!isWritableDirectory(profilePath) || isProfilePathTooLong(profilePath)) {
- DialogUtil.openErrorDialog(getShell(), "Error", Messages.MsgErrProfileInvalid); //$NON-NLS-1$
- return null;
- }
-*/
- userdataDir.append(profilePath);
-
- List<String> commandArgs = new ArrayList<String> ();
- commandArgs.add(chromeExecutable);
- commandArgs.addAll(Arrays.asList(chromeParam.split(REGEX_SPACES)));
- commandArgs.add(simulatorURL.toString());
- commandArgs.add(userdataDir.toString());
-
- File f = new File(store.getString(Settings.SIMULATOR_PATH));
- if (!f.exists()) {
- DialogUtil.openErrorDialog(getShell(), "Error", String.format(Messages.msgErrSimulatorFailed, store.getString(Settings.SIMULATOR_PATH)));
- return null;
- }
-
- try {
- return Runtime.getRuntime().exec(commandArgs.toArray(new String[commandArgs.size()]));
- } catch (Exception e) {
- DialogUtil.openErrorDialog(getShell(), "Error", String.format(Messages.msgErrLaunchFailed, chromeExecutable)); //$NON-NLS-1$
- return null;
- }
+ return simulatorURL.toString();
}
public static Process launchProject(IProject prj){
if (url == null) return null;
String s = url.toExternalForm();
//toExternalForm returns file:/ while simulator needs file:///
- if (s.startsWith("file:/") && !s.startsWith("file://")) { //$NON-NLS-1$ //$NON-NLS-2$
- s = s.replaceFirst("file:/", "file:///"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (s.startsWith("file:/") && !s.startsWith("file://")) { //$NON-NLS-1$
+ s = s.replaceFirst("file:/", "file:///"); //$NON-NLS-1$$
}
return s;
}
}
public static boolean isProfilePathTooLong(String fileName){
- final int MAX_PROFILE_DIR_LENGTH = 108 - "/SingletonSocket".length(); //$NON-NLS-1$
+ final int MAX_PROFILE_DIR_LENGTH = 256 - "/SingletonSocket".length(); //$NON-NLS-1$
if (Platform.OS_WIN32.equals(Platform.getOS())) return false;
if (fileName.length()>=MAX_PROFILE_DIR_LENGTH) {
return true;
package org.tizen.web.simulator.launch;
-import org.tizen.web.simulator.Activator;
+import org.tizen.web.common.WebConstant;
public class Constants {
public static final String EMPTY_STRING = ""; //$NON-NLS-1$
- public static final String ATTR_PROJECT_NAME = Activator.getUniqueIdentifier() + ".PROJECT_NAME";//$NON-NLS-1$
+ public static final String ATTR_PROJECT_NAME = WebConstant.ATTR_PROJECT_NAME;
+ public static final String ATTR_LIVE_EDITING = "liveediting";
}
*/
public class LaunchMessages extends NLS {
- public static String MAINTAB;
+ public static String ENABLE_LIVE_EDITING;
+ public static String MAINTAB;
public static String PROJECT_NAME;
public static String SimulatorMainTab_TITLE;
public static String SimulatorMainTab_MESSAGE;
SimulatorMainTab_TITLE = Project Selection
SimulatorMainTab_MESSAGE = Select a project to launch.
PROJECT_NOT_SPECIFIED = Project not specified
-PROJECT_MUST_BE_OPENED = Project must be opened
\ No newline at end of file
+PROJECT_MUST_BE_OPENED = Project must be opened
+ENABLE_LIVE_EDITING = Enable live editing
\ No newline at end of file
package org.tizen.web.simulator.launch;
+import static org.tizen.web.browser.Activator.PREF_LAUNCH;
+import static org.tizen.web.simulator.launch.Constants.ATTR_LIVE_EDITING;
+import static org.tizen.web.simulator.launch.Constants.ATTR_PROJECT_NAME;
+import static org.tizen.web.simulator.launch.Constants.EMPTY_STRING;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.tizen.common.daemon.ServerException;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.SWTUtil;
+import org.tizen.web.browser.Activator;
+import org.tizen.web.browser.view.preview.PreviewServer;
+import org.tizen.web.browser.view.preview.PreviewServerManager;
+import org.tizen.web.simulator.Messages;
import org.tizen.web.simulator.Simulator;
-//import org.eclipse.debug.core.DebugPlugin;
-//import org.eclipse.debug.core.model.IProcess;
-
-import static org.tizen.web.simulator.launch.Constants.*;
public class SimulatorApplicationDelegate extends
LaunchConfigurationDelegate {
@Override
public void launch(ILaunchConfiguration configuration, String mode,
ILaunch launch, IProgressMonitor monitor) throws CoreException {
- IProject prj = getProject(configuration);
- Simulator.launchProject(prj);
-/*
- Process p = Simulator.launchProject(prj);
- if (p!=null){
- IProcess iprocess=DebugPlugin.newProcess(launch, p, prj.getName());
- launch.addProcess(iprocess);
- }
-*/
+ final IProject prj = getProject( configuration );
+ if (!Simulator.checkTizenNature(prj)) return ;
+
+ final IFile file = Simulator.getContentFile( prj );
+
+
+ if ( null == file )
+ {
+ DialogUtil.openErrorDialog( SWTUtil.getActiveShell(), "Error", Messages.msgErrConfigurationFile); //$NON-NLS-1$
+ return ;
+ }
+ final IPreferenceStore preference = Activator.getDefault().getPreferenceStore();
+
+ final boolean bLiveEditing = configuration.getAttribute( ATTR_LIVE_EDITING, preference.getBoolean( PREF_LAUNCH ) );
+ try {
+ URL url = null;
+ if ( bLiveEditing )
+ {
+ // try open HTML/CSS Preview
+ final PreviewServerManager serverManager = Activator.getDefault().getServerManager();
+ final PreviewServer server = serverManager.getServer( file.getProject() );
+
+ url = new URL( server.getURL( file ) );
+ }
+ else
+ {
+ url = file.getLocationURI().toURL();
+ }
+ Simulator.launch( url );
+ }
+ catch ( final MalformedURLException e )
+ {
+ DialogUtil.openErrorDialog( SWTUtil.getActiveShell(), "Error", Messages.msgErrURLConversion); //$NON-NLS-1$
+ }
+ catch ( final ServerException e )
+ {
+ try
+ {
+ Simulator.launch( file.getLocationURI().toURL() );
+ }
+ catch ( final MalformedURLException e1 )
+ {
+ DialogUtil.openErrorDialog( SWTUtil.getActiveShell(), "Error", Messages.msgErrURLConversion); //$NON-NLS-1$
+ }
+ }
+
}
private IProject getProject(ILaunchConfiguration config) throws CoreException {
package org.tizen.web.simulator.launch;
+import static org.tizen.web.simulator.launch.Constants.ATTR_PROJECT_NAME;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.ILaunchShortcut;
+import org.tizen.common.gom.launch.GomLaunchData;
+import org.tizen.common.gom.launch.IGomSmartLaunchShortcut;
+import org.tizen.common.util.SWTUtil;
-import static org.tizen.web.simulator.launch.Constants.*;
-
-public class SimulatorApplicationLaunchShortcut extends LaunchShortcut implements ILaunchShortcut {
+public class SimulatorApplicationLaunchShortcut extends LaunchShortcut implements ILaunchShortcut, IGomSmartLaunchShortcut {
private static final String CONFIGURATION_TYPE = "org.tizen.web.simulator.launch.simulatorApplication"; //$NON-NLS-1$
protected ILaunchConfiguration createConfiguration(IProject project) {
+ String launchConfigName = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(project.getName());
+ return createConfiguration(project, launchConfigName);
+ }
+
+ private ILaunchConfiguration createConfiguration(IProject project, String configName) {
ILaunchConfiguration config = null;
try {
ILaunchConfigurationType configType = getConfigurationType();
- String launchConfigName = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(project.getName());
- ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, launchConfigName);
+ ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, configName);
wc.setAttribute(ATTR_PROJECT_NAME, project.getName());
ILaunchConfigurationType configType = lm.getLaunchConfigurationType(CONFIGURATION_TYPE);
return configType;
}
+
+ @Override
+ public void smartLaunch(final GomLaunchData data) {
+ final ILaunchConfiguration configuration = createConfiguration(data.getProject());
+ SWTUtil.syncExec(new Runnable()
+ {
+ @Override
+ public void run() {
+ DebugUITools.launch(configuration, data.getMode());
+ }
+ });
+ }
}
\r
package org.tizen.web.simulator.launch;\r
\r
+import static org.tizen.web.simulator.launch.Constants.ATTR_LIVE_EDITING;\r
+import static org.tizen.web.simulator.launch.Constants.ATTR_PROJECT_NAME;\r
+import static org.tizen.web.simulator.launch.Constants.EMPTY_STRING;\r
+\r
import org.eclipse.core.resources.IProject;\r
import org.eclipse.core.resources.IResource;\r
import org.eclipse.core.resources.ResourcesPlugin;\r
import org.eclipse.swt.widgets.Button;\r
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Slider;\r
import org.eclipse.swt.widgets.Text;\r
import org.eclipse.ui.PlatformUI;\r
import org.eclipse.ui.dialogs.ElementListSelectionDialog;\r
import org.eclipse.ui.model.WorkbenchLabelProvider;\r
-\r
import org.tizen.common.util.ImageUtil;\r
import org.tizen.web.common.CommonMessages;\r
import org.tizen.web.simulator.Activator;\r
\r
-import static org.tizen.web.simulator.launch.Constants.*;\r
-\r
public class SimulatorMainTab extends AbstractLaunchConfigurationTab {\r
public static final String PROJECT_NAME = "project_name"; //$NON-NLS-1$\r
\r
protected Label fProjLabel;\r
protected Text fProjText;\r
protected Button fProjButton;\r
- protected Slider fslider;\r
- protected Label fsliderLabel;\r
+ \r
+ protected Button fEnableLiveEditing;\r
+// protected Slider fslider;\r
+// protected Label fsliderLabel;\r
\r
@Override\r
public void createControl(Composite parent) {\r
updateLaunchConfigurationDialog();\r
}\r
});\r
+ \r
+ fEnableLiveEditing = createCheckButton(parent, LaunchMessages.ENABLE_LIVE_EDITING );\r
+ fEnableLiveEditing.addSelectionListener( new SelectionAdapter()\r
+ {\r
+ public\r
+ void\r
+ widgetSelected(\r
+ final SelectionEvent e\r
+ )\r
+ {\r
+ updateLaunchConfigurationDialog();\r
+ };\r
+ } );\r
}\r
\r
protected void handleProjectButtonSelected() {\r
\r
protected void updateProjectFromConfig(ILaunchConfiguration config) {\r
String projectName = EMPTY_STRING;\r
+ boolean enableLiveEditing = false;\r
try {\r
projectName = config.getAttribute(ATTR_PROJECT_NAME, EMPTY_STRING);\r
if(projectName.equals(EMPTY_STRING)) {\r
}\r
}\r
}\r
+ enableLiveEditing = config.getAttribute( ATTR_LIVE_EDITING, false );\r
} catch (CoreException ce) {\r
\r
}\r
fProjText.setText(projectName);\r
+ fEnableLiveEditing.setSelection( enableLiveEditing );\r
}\r
\r
@Override\r
@Override\r
public void performApply(ILaunchConfigurationWorkingCopy configuration) {\r
configuration.setAttribute(ATTR_PROJECT_NAME, fProjText.getText());\r
+ configuration.setAttribute(ATTR_LIVE_EDITING, fEnableLiveEditing.getSelection() );\r
}\r
\r
@Override\r
msgPreferencePageDescription=General settings for the Tizen Web Simulator:
Chrome_excutable=&Google Chrome location:
-Chrome_Settings=Google Chrome Settings
Extra_parameters=&Extra parameters:
+Profile_data_location=&Profile data location:
+Chrome_Settings=Google Chrome Settings
Internal=&Internal: Use the simulator included with the Tizen SDK.
Launch_in_app_mode=&Launch the simulator in Google Chrome application mode
MsgErrProfileInvalid=The Google Chrome profile location is not valid. Please specify it in Window->Preferences under "Tizen SDK/Web/Simulator".
-Profile_data_location=&Profile data location:
Simulator_Settings=Simulator Settings
Simulator_to_use=Simulator location:
User_specified=E&xternal: Use a custom simulator. Enter the location below.
msgErrStartMaximized=Warning: --start-maximized doesn't work in application mode.
+
+Override_chrome_settings=Override Chrome Settings
\ No newline at end of file
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.web.simulator.Activator;
import org.tizen.web.simulator.Simulator;
-import org.tizen.common.core.application.InstallPathConfig;
public class PreferenceInitializer extends AbstractPreferenceInitializer {
- private static final String ENV_USERPROFILE = "USERPROFILE";
- private static final String ENV_LOCALAPPDATA = "LOCALAPPDATA";
- private static final String WIN_VER_6 = "6";
- private static final String OS_VERSION = "os.version";
- private static final String CHROME_LINUX = "/opt/google/chrome/google-chrome";
- private static final String CHROME_WIN = "\\Google\\Chrome\\Application\\chrome.exe";
- private static final String CHROME_MACOS = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
+ private static final String ENV_USERPROFILE = "USERPROFILE";
+ private static final String ENV_LOCALAPPDATA = "LOCALAPPDATA";
+ //private static final String WIN_VER_6 = "6";
+ //private static final String OS_VERSION = "os.version";
+ private static final String CHROME_LINUX = "/opt/google/chrome/google-chrome";
+ private static final String CHROME_WIN = "\\Google\\Chrome\\Application\\chrome.exe";
+ private static final String CHROME_MACOS = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
+
private static final String PROFILE_PATH_DEFAULT = "/profile/";
-
+ public static final String[] EXTRA_PARAM_DEFAULT = {"--allow-file-access-from-files"
+ , "--disable-web-security"
+ , "--proxy-auto-detect"};
public PreferenceInitializer() {
}
public static void reinitializeDefaultPreferences(){
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- //the process of finding Chrome is according to the start script of WebSimulatorAIO
- String os = Platform.getOS();
- String chrome;
- if (os.equals(Platform.OS_MACOSX)) {
- chrome = CHROME_MACOS;
- } else if (os.equals(Platform.OS_WIN32)) {
- String chromeDir;
- if (System.getProperty(OS_VERSION).startsWith(WIN_VER_6))
- chromeDir = System.getenv(ENV_LOCALAPPDATA);
- else
- // XP does not have LOCALAPPDATA environment variable
- chromeDir = System.getenv(ENV_USERPROFILE) + File.separator + "Local Settings" + File.separator + "Application Data";
- chrome = chromeDir + CHROME_WIN;
- } else {
- chrome = CHROME_LINUX;
- }
+
+ //the process of finding Chrome is according to the start script of WebSimulatorAIO
+ String os = Platform.getOS();
+ String chrome;
+ if (os.equals(Platform.OS_MACOSX)) {
+ chrome = CHROME_MACOS;
+ } else if (os.equals(Platform.OS_WIN32)) {
+ // Default Chrome installed location on Windows OS :
+ // 1. Chrome version > 24.0.1312.56 (64 bit) : %ProgramFiles(X86)%\\Google\\Chrome\\Application\\chrome.exe
+ // 2. Chrome version > 24.0.1312.56 (32 bit) : %ProgramFiles%\\Google\\Chrome\\Application\\chrome.exe
+ // 3. Chrome version < 24.0.1312.56 (all windows except XP) : System.getenv(ENV_LOCALAPPDATA)\\Google\\Chrome\\Application\\chrome.exe
+ // 4. Chrome version < 24.0.1312.56 (XP) :System.getenv(ENV_USERPROFILE) + File.separator + "Local Settings" + File.separator + "Application Data"\\Google\\Chrome\\Application\\chrome.exe
+ //String chromeDir;
+ File f;
+ int i;
+ String[] chromeDirArray = {System.getenv("ProgramFiles(X86)"),
+ System.getenv("ProgramFiles"),
+ System.getenv(ENV_LOCALAPPDATA),
+ System.getenv(ENV_USERPROFILE) + File.separator + "Local Settings" + File.separator + "Application Data"};
+ for(i=0; i< chromeDirArray.length; i++) {
+ f = new File(chromeDirArray[i] + CHROME_WIN);
+ if (f.exists()) {
+ break;
+ }
+ }
+ if (i < chromeDirArray.length) {
+ chrome = chromeDirArray[i] + CHROME_WIN;
+ } else {
+ if (System.getenv("ProgramFiles(X86)").length() > 0 ) {
+ chrome = chromeDirArray[0] + CHROME_WIN;
+ } else {
+ chrome = chromeDirArray[1] + CHROME_WIN;
+ }
+ }
+ /*
+ if (System.getProperty(OS_VERSION).startsWith(WIN_VER_6))
+ chromeDir = System.getenv(ENV_LOCALAPPDATA);
+ else
+ // XP does not have LOCALAPPDATA environment variable
+ chromeDir = System.getenv(ENV_USERPROFILE) + File.separator + "Local Settings" + File.separator + "Application Data";
+ chrome = chromeDir + CHROME_WIN;
+ */
+ } else {
+ chrome = CHROME_LINUX;
+ }
+
StringBuffer simulatorPath = new StringBuffer();
simulatorPath.append(InstallPathConfig.getSDKPath());
simulatorPath.append("/tools/websimulator/web/index.html");
+
+ StringBuffer extraParams = new StringBuffer();
+
+ for (String param : EXTRA_PARAM_DEFAULT) {
+ extraParams.append(param);
+ extraParams.append(" ");
+ }
- store.setDefault(Settings.CHROME_EXECUTABLE, chrome);
- store.setDefault(Settings.EXTRA_PARAM, "");
+ store.setDefault(Settings.CHROME_EXECUTABLE, chrome);
+ store.setDefault(Settings.OVERRIDE_CHROME_SETTINGS, true);
+ store.setDefault(Settings.EXTRA_PARAM, extraParams.toString());
store.setDefault(Settings.USE_INTERNAL_SIMULATOR, Settings.FALSE);
store.setDefault(Settings.SIMULATOR_PATH, simulatorPath.toString());
store.setDefault(Settings.APP_MODE, true);
package org.tizen.web.simulator.preferences;
public class Settings {
- public static final String CHROME_EXECUTABLE = "CHROME_EXECUTABLE"; //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String CHROME_EXECUTABLE = "CHROME_EXECUTABLE"; //$NON-NLS-1$
public static final String EXTRA_PARAM = "EXTRA_PARAM"; //$NON-NLS-1$ //$NON-NLS-2$
public static final String USE_INTERNAL_SIMULATOR = "USE_INTERNAL_SIMULATOR"; //$NON-NLS-1$ //$NON-NLS-2$
public static final String SIMULATOR_PATH = "SIMULATOR_PATH"; //$NON-NLS-1$ //$NON-NLS-2$
public static final String TRUE = "TRUE"; //$NON-NLS-1$ //$NON-NLS-2$
public static final String FALSE = "FALSE"; //$NON-NLS-1$ //$NON-NLS-2$
public static final String PROFILE_PATH = "PROFILE_PATH"; //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String OVERRIDE_CHROME_SETTINGS = "OVERRIDE_CHROME_SETTINGS"; //$NON-NLS-1$ //$NON-NLS-2$
private Settings (){
}
package org.tizen.web.simulator.preferences;
+
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.tizen.web.simulator.Activator;
public class WorkbenchPreferencePage extends FieldEditorPreferencePage implements
IWorkbenchPreferencePage {
- public WorkbenchPreferencePage () {
+ public static final String REGEX_SPACES = "\\s+"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ public WorkbenchPreferencePage () {
super(FLAT);
}
protected Control createContents(Composite parent) {
Composite page = new Composite(parent, SWT.NONE);
page.setLayout(new GridLayout());
-
- Group grpChrome = new Group(page, SWT.NONE);
- grpChrome.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- grpChrome.setLayout(new GridLayout());
- grpChrome.setText(Messages.Chrome_Settings);
- addField(new FileFieldEditor(Settings.CHROME_EXECUTABLE, Messages.Chrome_excutable, new FieldEditorComposite(grpChrome)){
- @Override
- //The executable may be in the path, so we don't check it's existence.
- protected boolean checkState() {
- clearErrorMessage();
- return true;
- }
- });
- addField(new StringFieldEditor(Settings.EXTRA_PARAM,Messages.Extra_parameters, new FieldEditorComposite(grpChrome)));
- addField(new DirectoryFieldEditor(Settings.PROFILE_PATH, Messages.Profile_data_location, new FieldEditorComposite(grpChrome)){
- @Override
- //Add checks for the dir length. Fix for bug of unix sockect addr length limit when launching chrome.
- protected boolean doCheckState() {
- final int MAX_PROFILE_DIR_LENGTH = 108 - "/SingletonSocket".length(); //$NON-NLS-1$
- String fileName = getTextControl().getText();
- if (!Simulator.isWritableDirectory(fileName)){
- setErrorMessage(String.format(Messages.msgErrProfileWritableDirectory));
- return false;
- }
-
- if (Platform.OS_WIN32.equals(Platform.getOS())) return true;
- if (Simulator.isProfilePathTooLong(fileName)) {
- setErrorMessage(String.format(Messages.msgErrProfileLengthExceeded, MAX_PROFILE_DIR_LENGTH));
- return false;
- }
-
- return true;
- }
- public boolean isEmptyStringAllowed(){
- return false;
- }
- });
-
+
Group grpSimulator = new Group(page, SWT.NONE);
grpSimulator.setLayoutData( new GridData(GridData.FILL_HORIZONTAL));
grpSimulator.setLayout(new GridLayout());
addField(feSimulatorDir);
addField(new BooleanFieldEditor(Settings.APP_MODE,Messages.Launch_in_app_mode, new FieldEditorComposite(grpSimulator)));
+ createChromeSettingsContents(page);
+
initialize();
feSimulatorDir.setEnabled(Settings.FALSE.equals(getPreferenceStore().getString(Settings.USE_INTERNAL_SIMULATOR)), cpSimulatorDir);
return page;
}
- @Override
+ private void createChromeSettingsContents(Composite parent) {
+ Group grpChrome = new Group(parent, SWT.NONE);
+ grpChrome.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ grpChrome.setLayout(new GridLayout());
+ grpChrome.setText(Messages.Chrome_Settings);
+ addField(new FileFieldEditor(Settings.CHROME_EXECUTABLE, Messages.Chrome_excutable, new FieldEditorComposite(grpChrome)){
+ @Override
+ //The executable may be in the path, so we don't check it's existence.
+ protected boolean checkState() {
+ clearErrorMessage();
+ return true;
+ }
+ });
+ addField(new StringFieldEditor(Settings.EXTRA_PARAM,Messages.Extra_parameters, new FieldEditorComposite(grpChrome)));
+ addField(new DirectoryFieldEditor(Settings.PROFILE_PATH, Messages.Profile_data_location, new FieldEditorComposite(grpChrome)){
+ @Override
+ //Add checks for the dir length. Fix for bug of unix sockect addr length limit when launching chrome.
+ protected boolean doCheckState() {
+ final int MAX_PROFILE_DIR_LENGTH = 256 - "/SingletonSocket".length(); //$NON-NLS-1$
+ String fileName = getTextControl().getText();
+ if (!Simulator.isWritableDirectory(fileName)){
+ setErrorMessage(String.format(Messages.msgErrProfileWritableDirectory));
+ return false;
+ }
+
+ if (Platform.OS_WIN32.equals(Platform.getOS())) return true;
+ if (Simulator.isProfilePathTooLong(fileName)) {
+ setErrorMessage(String.format(Messages.msgErrProfileLengthExceeded, MAX_PROFILE_DIR_LENGTH));
+ return false;
+ }
+
+ return true;
+ }
+ public boolean isEmptyStringAllowed(){
+ return false;
+ }
+ });
+ }
+
+ @Override
protected void performDefaults () {
PreferenceInitializer.reinitializeDefaultPreferences();
super.performDefaults();
class FieldEditorComposite extends Composite{
FieldEditorComposite (Composite parent) {
super(parent, SWT.NONE);
- this.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ this.setLayoutData(gd);
}
}
--- /dev/null
+* 2.0.3
+- Added live-editing in web simulator
+- Line up chrome options
+- Changed SimulatorApplicationLaunchShortcut to implement IGomSmartLaunchShortcut
+== kh5325.kim <kh5325.kim@samsung.com> 2013-06-26
+* 2.0.2
+- Fixed launch fail issue.
+== changhyun1.lee <changhyun1.lee@samsung.com> 2013-06-21 17:27
+* 2.0.1
+- remove help document directory
+== ziv.chang <ziv.chang@intel.com> 2013-02-21 11:00
+* 1.9.1
+- update for 2.0 release
+== jia-cheng.hu <jia-cheng.hu@intel.com> 2012-12-19 14:38
+* 1.0.14
+- package upload
+== taeyoung2.son <taeyoung2.son@samsung.com> 2012-11-05 17:42
-Version:1.0.13
+Version:2.0.3
Maintainer:hyeongseok heo <hyeong-seok.heo@samsung.com>, gyeongseok seo <gyeongseok.seo@samsung.com>, jihoon song <jihoon80.song@samsung.com>, changhyun lee <changhyun1.lee@samsung.com>, bonyong lee <bonyong.lee@samsung.com>
Package:websimulator-eplugin