--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/ITMWConstants.java Thu Sep 02 10:50:38 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/**
- * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-package org.symbian.tools.tmw.core;
-
-public interface ITMWConstants {
- String CORE_FACET = "tmw.core";
-
-}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/TMWCore.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/TMWCore.java Thu Sep 02 15:18:58 2010 -0700
@@ -29,6 +29,8 @@
private ProjectsSupportManager projectsSupport;
private RuntimeClasspathManager classpathManager;
+ public static final String CORE_FACET = "tmw.core";
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/facets/FProjSupportImpl.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/facets/FProjSupportImpl.java Thu Sep 02 15:18:58 2010 -0700
@@ -57,7 +57,11 @@
return null;
}
try {
- return version != null ? projectFacet.getVersion(version) : projectFacet.getLatestVersion();
+ if (version != null) {
+ return projectFacet.getVersion(version);
+ } else {
+ return projectFacet.getLatestVersion();
+ }
} catch (VersionFormatException e) {
throw new RuntimeException(e);
} catch (CoreException e) {
@@ -66,7 +70,11 @@
}
public String getRuntimeId(IMobileWebRuntime runtime) {
- return runtime != null ? runtime.getId() + ":" + runtime.getVersion() : null;
+ if (runtime != null) {
+ return runtime.getId() + ":" + runtime.getVersion();
+ } else {
+ return null;
+ }
}
public Set<IProjectFacetVersion> getFixedFacetsVersions(IMobileWebRuntime runtime) {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/facets/InstallCoreFacetAction.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/facets/InstallCoreFacetAction.java Thu Sep 02 15:18:58 2010 -0700
@@ -57,4 +57,4 @@
monitor.done();
}
-}
\ No newline at end of file
+}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/LazyIncludePathProvider.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/LazyIncludePathProvider.java Thu Sep 02 15:18:58 2010 -0700
@@ -29,8 +29,8 @@
private final IConfigurationElement element;
private LazyIncludePathProvider provider;
- public LazyIncludePathProvider(IConfigurationElement element) {
- this.element = element;
+ public LazyIncludePathProvider(IConfigurationElement configurationElement) {
+ this.element = configurationElement;
}
public IIncludePathEntry[] getEntries(ITMWProject project) {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/MTWFacetedProjectProvider.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/MTWFacetedProjectProvider.java Thu Sep 02 15:18:58 2010 -0700
@@ -24,7 +24,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-import org.symbian.tools.tmw.core.ITMWConstants;
import org.symbian.tools.tmw.core.TMWCore;
import org.symbian.tools.tmw.core.projects.ITMWProject;
import org.symbian.tools.tmw.core.projects.ITMWProjectProvider;
@@ -41,7 +40,7 @@
public boolean isSupportedProject(IProject project) {
try {
- return FacetedProjectFramework.hasProjectFacet(project, ITMWConstants.CORE_FACET);
+ return FacetedProjectFramework.hasProjectFacet(project, TMWCore.CORE_FACET);
} catch (CoreException e) {
TMWCore.log(null, e);
return false;
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/ProjectProvider.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/ProjectProvider.java Thu Sep 02 15:18:58 2010 -0700
@@ -34,17 +34,16 @@
private final Expression expression;
private ITMWProjectProvider provider;
- public ProjectProvider(IConfigurationElement element) throws CoreException {
- this.element = element;
- IConfigurationElement[] children = element.getChildren("enablement");
+ public ProjectProvider(IConfigurationElement configurationElement) throws CoreException {
+ this.element = configurationElement;
+ IConfigurationElement[] children = configurationElement.getChildren("enablement");
if (children.length == 1) {
expression = ExpressionConverter.getDefault().perform(children[0]);
} else {
expression = null;
if (children.length > 1) {
- TMWCore.log(
- "Project extension in plugin %s has several <enablement> elements. All expressions will be ignored.",
- element.getNamespaceIdentifier());
+ TMWCore.log("Project extension in plugin %s has several <enablement> elements. "
+ + "All expressions will be ignored.", configurationElement.getNamespaceIdentifier());
}
}
}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/StaticIncludePathProvider.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/StaticIncludePathProvider.java Thu Sep 02 15:18:58 2010 -0700
@@ -38,8 +38,8 @@
private final IConfigurationElement element;
private IIncludePathEntry[] entries;
- public StaticIncludePathProvider(IConfigurationElement element) {
- this.element = element;
+ public StaticIncludePathProvider(IConfigurationElement configurationElement) {
+ this.element = configurationElement;
}
public IIncludePathEntry[] getEntries(ITMWProject project) {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWFacetedProject.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWFacetedProject.java Thu Sep 02 15:18:58 2010 -0700
@@ -34,8 +34,8 @@
public class TMWFacetedProject implements ITMWProject {
private final IProject project;
- public TMWFacetedProject(IProject project) {
- this.project = project;
+ public TMWFacetedProject(IProject rawProject) {
+ this.project = rawProject;
}
public String getName() {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/LazyPackager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/LazyPackager.java Thu Sep 02 15:18:58 2010 -0700
@@ -35,8 +35,8 @@
private final IConfigurationElement element;
private IPackagerDelegate packager;
- public LazyPackager(IConfigurationElement element) {
- this.element = element;
+ public LazyPackager(IConfigurationElement configurationElement) {
+ this.element = configurationElement;
}
public File packageApplication(ITMWProject project, IProgressMonitor monitor) throws CoreException {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimeLibraryContainer.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimeLibraryContainer.java Thu Sep 02 15:18:58 2010 -0700
@@ -34,9 +34,9 @@
private final IPath containerPath;
private final IJavaScriptProject project;
- public MobileRuntimeLibraryContainer(IJavaScriptProject project, IPath containerPath) {
- this.project = project;
- this.containerPath = containerPath;
+ public MobileRuntimeLibraryContainer(IJavaScriptProject jsProject, IPath runtimeContainerPath) {
+ this.project = jsProject;
+ this.containerPath = runtimeContainerPath;
}
public IIncludePathEntry[] getIncludepathEntries() {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimeStub.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileRuntimeStub.java Thu Sep 02 15:18:58 2010 -0700
@@ -34,7 +34,7 @@
/**
* Integrates mobile web runtime with the faceted project runtime framework.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
@SuppressWarnings("unchecked")
@@ -42,9 +42,9 @@
private final IMobileWebRuntime runtime;
private final Map<String, String> properties = new TreeMap<String, String>();
- public MobileRuntimeStub(IMobileWebRuntime runtime) {
- this.runtime = runtime;
- properties.put("localized-name", runtime.getName());
+ public MobileRuntimeStub(IMobileWebRuntime mobileRuntime) {
+ this.runtime = mobileRuntime;
+ properties.put("localized-name", mobileRuntime.getName());
}
private IRuntimeComponent getComponent(String string, String version) {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileWebRuntime.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/MobileWebRuntime.java Thu Sep 02 15:18:58 2010 -0700
@@ -33,8 +33,8 @@
private final IConfigurationElement element;
private IApplicationLayoutProvider layout;
- public MobileWebRuntime(IConfigurationElement element) {
- this.element = element;
+ public MobileWebRuntime(IConfigurationElement configurationElement) {
+ this.element = configurationElement;
checkRegistry();
}
@@ -42,11 +42,11 @@
if (layout == null) {
final IConfigurationElement[] configuration = Platform.getExtensionRegistry().getConfigurationElementsFor(
TMWCore.PLUGIN_ID, "runtimeAppLayout");
- for (IConfigurationElement element : configuration) {
- final String runtimeId = element.getAttribute("runtime-id");
- final String version = element.getAttribute("runtime-version");
+ for (IConfigurationElement configurationElement : configuration) {
+ final String runtimeId = configurationElement.getAttribute("runtime-id");
+ final String version = configurationElement.getAttribute("runtime-version");
if (getId().endsWith(runtimeId) && getVersion().endsWith(version)) {
- layout = new LazyProvider(element);
+ layout = new LazyProvider(configurationElement);
break;
}
}
@@ -64,8 +64,9 @@
public Map<String, String> getFixedFacets() {
final Map<String, String> facets = new TreeMap<String, String>();
final IConfigurationElement[] children = element.getChildren("fixed-facet");
- for (IConfigurationElement element : children) {
- facets.put(CoreUtil.notNull(element.getAttribute("id")), element.getAttribute("version"));
+ for (IConfigurationElement configurationElement : children) {
+ facets.put(CoreUtil.notNull(configurationElement.getAttribute("id")),
+ configurationElement.getAttribute("version"));
}
return facets;
}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimeClasspathManager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimeClasspathManager.java Thu Sep 02 15:18:58 2010 -0700
@@ -49,8 +49,8 @@
private static final class Version implements IVersion {
private final String version;
- public Version(String version) {
- this.version = version;
+ public Version(String versionString) {
+ this.version = versionString;
}
public int compareTo(Object o) {
@@ -81,8 +81,7 @@
@Override
public int hashCode() {
final int prime = 31;
- int result = 1;
- result = prime * result + ((version == null) ? 0 : version.hashCode());
+ int result = prime + ((version == null) ? 0 : version.hashCode());
return result;
}
}
@@ -100,23 +99,23 @@
}
private static final class VersionedEntry<T> {
- protected final T entry;
- protected final IVersionExpr versionExpression;
+ private final T entry;
+ private final IVersionExpr versionExpression;
- public VersionedEntry(String versionExpression, T entry) {
- if (versionExpression == null) {
+ public VersionedEntry(String expression, T ent) {
+ if (expression == null) {
this.versionExpression = null;
} else {
IVersionExpr expr;
try {
- expr = new VersionExpr<Version>(new VersionableObject(), versionExpression, null);
+ expr = new VersionExpr<Version>(new VersionableObject(), expression, null);
} catch (CoreException e) {
expr = null;
TMWCore.log(null, e);
}
this.versionExpression = expr;
}
- this.entry = entry;
+ this.entry = ent;
}
public boolean matches(String version) {
@@ -186,15 +185,15 @@
}
private IFacetIncludePathProvider[] collectProviders(IConfigurationElement[] children) {
- final Collection<IFacetIncludePathProvider> providers = new LinkedList<IFacetIncludePathProvider>();
+ final Collection<IFacetIncludePathProvider> providerCollection = new LinkedList<IFacetIncludePathProvider>();
for (IConfigurationElement element : children) {
if ("include-path-entry".equals(element.getName())) {
- providers.add(new StaticIncludePathProvider(element));
+ providerCollection.add(new StaticIncludePathProvider(element));
} else if ("include-path-provider".equals(element.getName())) {
- providers.add(new LazyIncludePathProvider(element));
+ providerCollection.add(new LazyIncludePathProvider(element));
}
}
- return providers.toArray(new IFacetIncludePathProvider[providers.size()]);
+ return providerCollection.toArray(new IFacetIncludePathProvider[providerCollection.size()]);
}
private <T> Collection<T> getMatchingEntries(String id, String version,
@@ -237,8 +236,8 @@
facetToEntry));
}
final Collection<IIncludePathEntry> pathEntries = new HashSet<IIncludePathEntry>();
- for (IFacetIncludePathProvider[] providers : entries) {
- for (IFacetIncludePathProvider provider : providers) {
+ for (IFacetIncludePathProvider[] providerArray : entries) {
+ for (IFacetIncludePathProvider provider : providerArray) {
pathEntries.addAll(Arrays.asList(provider.getEntries(p)));
}
}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimesManagerImpl.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/runtimes/RuntimesManagerImpl.java Thu Sep 02 15:18:58 2010 -0700
@@ -112,8 +112,8 @@
private final IConfigurationElement element;
private IApplicationLayoutProvider instance;
- public LazyProvider(IConfigurationElement element) {
- this.element = element;
+ public LazyProvider(IConfigurationElement configurationElement) {
+ this.element = configurationElement;
}
public IPath getResourcePath(IFile file) {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/IFProjSupport.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/IFProjSupport.java Thu Sep 02 15:18:58 2010 -0700
@@ -27,7 +27,7 @@
/**
* This is a bridge between Faceted Project framework and TMW project frameworks.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IFProjSupport {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/IProjectSetupConfig.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/IProjectSetupConfig.java Thu Sep 02 15:18:58 2010 -0700
@@ -28,21 +28,21 @@
/**
* This object can be set as facet install config for the core TMW facet
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IProjectSetupConfig {
/**
- * Performs project setup. Project will already be configured with
+ * Performs project setup. Project will already be configured with
* validation support and JSDT support.
*/
void initialize(IProject project, IProgressMonitor monitor);
/**
- * Allows the framework to reduce dependence on exact project layout. I.e.
- * some IDEs may want to introduce separation of the web resources and
+ * Allows the framework to reduce dependence on exact project layout. I.e.
+ * some IDEs may want to introduce separation of the web resources and
* JavaScript source files.
- *
+ *
* @param project project to add file to
* @param name file path relative to application root
* @param contents stream with file contents
@@ -52,9 +52,9 @@
IFile addFile(IProject project, IPath name, InputStream contents, IProgressMonitor monitor) throws CoreException;
/**
- * Adds specified file to the list of the JS files that will be included in
+ * Adds specified file to the list of the JS files that will be included in
* the application page
- * @param file workspace file. Framework is responsible to create proper
+ * @param file workspace file. Framework is responsible to create proper
* application root-relative path
*/
void addIncludedJsFile(IProject project, IFile file);
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/ITMWProject.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/ITMWProject.java Thu Sep 02 15:18:58 2010 -0700
@@ -40,7 +40,7 @@
/**
* Validate project configuration and contents.
- *
+ *
* @return <code>true</code> if the project has no errors. Warnings do not count.
*/
boolean validate(IProgressMonitor monitor);
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/ITMWProjectProvider.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/projects/ITMWProjectProvider.java Thu Sep 02 15:18:58 2010 -0700
@@ -22,7 +22,7 @@
/**
* Bridges between project models.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface ITMWProjectProvider {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IApplicationLayoutProvider.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IApplicationLayoutProvider.java Thu Sep 02 15:18:58 2010 -0700
@@ -26,10 +26,10 @@
import org.eclipse.core.runtime.IPath;
/**
- * This interface provides application structure as it will be used in web
+ * This interface provides application structure as it will be used in web
* runtime. Note that project layout may not directly correspond to application
* layout.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IApplicationLayoutProvider {
@@ -42,12 +42,12 @@
/**
* @param path path relative to application root
* @return workspace resource
- * @throws CoreException if cannot access resource contents
+ * @throws CoreException if cannot access resource contents
*/
InputStream getResourceFromPath(IProject project, IPath path) throws CoreException;
/**
- * @return workspace file that corresponds to applicationPath or
+ * @return workspace file that corresponds to applicationPath or
* <code>null</code> if none
*/
IFile getWorkspaceFile(IProject project, IPath applicationPath) throws CoreException;
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntime.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntime.java Thu Sep 02 15:18:58 2010 -0700
@@ -22,7 +22,7 @@
/**
* Represents mobile web runtimes supported by the IDE
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IMobileWebRuntime {
@@ -47,7 +47,7 @@
Map<String, String> getFixedFacets();
/**
- * @return layout provider that bridges application runtime structure and
+ * @return layout provider that bridges application runtime structure and
* workspace project structure
*/
IApplicationLayoutProvider getLayoutProvider();
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntimeManager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IMobileWebRuntimeManager.java Thu Sep 02 15:18:58 2010 -0700
@@ -22,7 +22,7 @@
/**
* Manages mobile web runtimes.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IMobileWebRuntimeManager {
@@ -32,19 +32,19 @@
IPackager getPackager(ITMWProject project);
/**
- * Returns packager that can create a packaged application for provided
+ * Returns packager that can create a packaged application for provided
* runtime from the given project.
- *
- * @return <code>null</null> if the project cannot be packaged for
+ *
+ * @return <code>null</code> if the project cannot be packaged for
* specified runtime
*/
IPackager getPackager(ITMWProject project, IMobileWebRuntime runtime);
/**
* Returns runtimes for the given ID. Runtime will not be null.
- *
- * @throws IllegalArgumentException if there is no runtime with the
- * provided ID. It is assumed that this can only be caused by a broken
+ *
+ * @throws IllegalArgumentException if there is no runtime with the
+ * provided ID. It is assumed that this can only be caused by a broken
* install or coding error on IDE provider side.
*/
IMobileWebRuntime getRuntime(String id, String version);
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IPackager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IPackager.java Thu Sep 02 15:18:58 2010 -0700
@@ -27,22 +27,23 @@
import org.symbian.tools.tmw.core.projects.ITMWProject;
/**
- * Packager creates a runtime-specific application package that can be
+ * Packager creates a runtime-specific application package that can be
* deployed to compatible targets.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IPackager {
/**
* Synchronously packages application for the specified runtime.
- *
+ *
* @return {@link File} denoting location of the application package that can be deployed to targets
*/
File packageApplication(ITMWProject project, IProgressMonitor monitor)
throws CoreException;
/**
- * @return application package root-relative path where the workspace resource will be packaged. Can be <code>null</code>.
+ * @return application package root-relative path where the workspace resource will be packaged.
+ * Can be <code>null</code>.
*/
IPath getPathInPackage(IResource resource);
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IPackagerDelegate.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/IPackagerDelegate.java Thu Sep 02 15:18:58 2010 -0700
@@ -28,19 +28,20 @@
/**
* Delegate performs application packaging.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IPackagerDelegate {
/**
* Synchronously packages application for the specified runtime.
- *
+ *
* @return URI of the application package that can be deployed to targets
*/
File packageApplication(ITMWProject project, IProgressMonitor monitor) throws CoreException;
/**
- * @return application package root-relative path where the workspace resource will be packaged. Can be <code>null</code>.
+ * @return application package root-relative path where the workspace resource will be packaged.
+ * Can be <code>null</code>.
*/
IPath getPathInPackage(IResource resource);
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/utilities/CoreUtil.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/utilities/CoreUtil.java Thu Sep 02 15:18:58 2010 -0700
@@ -26,9 +26,9 @@
import org.eclipse.wst.jsdt.core.JavaScriptModelException;
/**
- * Utilities used all over the TMW code base. Users can rely on this methods
+ * Utilities used all over the TMW code base. Users can rely on this methods
* even though they are not specific to mobile development.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public final class CoreUtil {
@@ -46,10 +46,14 @@
}
public static String notNull(final String string) {
- return string == null ? "" : string.trim();
+ if (string == null) {
+ return "";
+ } else {
+ return string.trim();
+ }
}
- public final static boolean hasTypes(IProject p, String... typeNames) throws JavaScriptModelException {
+ public static boolean hasTypes(IProject p, String... typeNames) throws JavaScriptModelException {
final IJavaScriptProject project = JavaScriptCore.create(p);
if (project != null && project.exists()) {
for (String typeName : typeNames) {
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/utilities/NonClosingStream.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/utilities/NonClosingStream.java Thu Sep 02 15:18:58 2010 -0700
@@ -31,4 +31,4 @@
public void close() throws IOException {
// Avoid closing ZIP file
}
-}
\ No newline at end of file
+}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/utilities/ZipApplicationVisitor.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/utilities/ZipApplicationVisitor.java Thu Sep 02 15:18:58 2010 -0700
@@ -37,7 +37,7 @@
/**
* Use this visitor to zip application if the web runtime uses zip archive as application
* distribution format.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public class ZipApplicationVisitor implements IResourceVisitor {
@@ -45,9 +45,9 @@
private final ZipOutputStream zipStream;
private final IPackagerDelegate packager;
- public ZipApplicationVisitor(ZipOutputStream zipStream, IPackagerDelegate packager) {
- this.zipStream = zipStream;
- this.packager = packager;
+ public ZipApplicationVisitor(ZipOutputStream zip, IPackagerDelegate delegate) {
+ this.zipStream = zip;
+ this.packager = delegate;
}
public boolean visit(IResource resource) throws CoreException {
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/Activator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/Activator.java Thu Sep 02 15:18:58 2010 -0700
@@ -34,74 +34,76 @@
*/
public class Activator extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.symbian.tools.wrttools.debug.core";
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.symbian.tools.wrttools.debug.core";
- public static final boolean DEBUG = Platform.inDebugMode() && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debug"));
- public static final boolean DEBUG_CONNECTION = DEBUG && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugConnection"));
- public static final boolean DEBUG_RESOURCES = DEBUG && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugResources"));
- public static final boolean DEBUG_BREAKPOINTS = DEBUG
- && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID
- + "/debugBreakpoints"));
-
- // The shared instance
- private static Activator plugin;
+ public static final boolean DEBUG = Platform.inDebugMode()
+ && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debug"));
+ public static final boolean DEBUG_CONNECTION = DEBUG
+ && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugConnection"));
+ public static final boolean DEBUG_RESOURCES = DEBUG
+ && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugResources"));
+ public static final boolean DEBUG_BREAKPOINTS = DEBUG
+ && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugBreakpoints"));
+
+ // The shared instance
+ private static Activator plugin;
- private final ChromeInstancesManager chromes = new ChromeInstancesManager();
-
- /**
- * The constructor
- */
- public Activator() {
- }
+ private final ChromeInstancesManager chromes = new ChromeInstancesManager();
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
Logger.getLogger("org.chromium.sdk").setLevel(Level.WARNING);
- plugin = this;
- }
+ plugin = this;
+ }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- chromes.shutdown();
- super.stop(context);
- }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ chromes.shutdown();
+ super.stop(context);
+ }
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
- public ChromeInstancesManager getChromeInstancesManager() {
- return chromes;
- }
+ public ChromeInstancesManager getChromeInstancesManager() {
+ return chromes;
+ }
- public static void log(Throwable e) {
- log(e.getLocalizedMessage(), e);
- }
+ public static void log(Throwable e) {
+ log(e.getLocalizedMessage(), e);
+ }
- private static void log(String message, Throwable exception) {
- getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
- }
+ private static void log(String message, Throwable exception) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
+ }
- @Override
- protected void initializeImageRegistry(ImageRegistry reg) {
- Images.initImageRegistry(reg);
- }
+ @Override
+ protected void initializeImageRegistry(ImageRegistry reg) {
+ Images.initImageRegistry(reg);
+ }
- public static void log(String message) {
- log(message, null);
- }
+ public static void log(String message) {
+ log(message, null);
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/BreakpointAdapterFactory.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/BreakpointAdapterFactory.java Thu Sep 02 15:18:58 2010 -0700
@@ -26,19 +26,19 @@
@SuppressWarnings("rawtypes")
public class BreakpointAdapterFactory implements IAdapterFactory {
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof IEditorPart) {
- IResource resource = (IResource) ((IEditorPart) adaptableObject)
- .getEditorInput().getAdapter(IResource.class);
- if (resource != null) {
- return new WorkspaceLineBreakpointAdapter();
- }
- }
- return null;
- }
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IEditorPart) {
+ IResource resource = (IResource) ((IEditorPart) adaptableObject).getEditorInput().getAdapter(
+ IResource.class);
+ if (resource != null) {
+ return new WorkspaceLineBreakpointAdapter();
+ }
+ }
+ return null;
+ }
public Class[] getAdapterList() {
- return new Class[] { IToggleBreakpointsTarget.class };
- }
+ return new Class[] { IToggleBreakpointsTarget.class };
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/ChromeDebugUtils.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/ChromeDebugUtils.java Thu Sep 02 15:18:58 2010 -0700
@@ -23,40 +23,41 @@
import org.symbian.tools.tmw.core.utilities.CoreUtil;
public final class ChromeDebugUtils {
- public static String getExecutablePath(String folder) {
- File file = new File(folder);
- if (file.isDirectory()) {
- File chromeExecutable = new File(file, getExecutable());
- if (chromeExecutable.isFile()) {
- return chromeExecutable.getAbsolutePath();
+ public static String getExecutablePath(String folder) {
+ File file = new File(folder);
+ if (file.isDirectory()) {
+ File chromeExecutable = new File(file, getExecutable());
+ if (chromeExecutable.isFile()) {
+ return chromeExecutable.getAbsolutePath();
} else if (CoreUtil.isMac() && file.getName().equals("Google Chrome.app")) {
return getExecutablePath(file.getParent());
- }
+ }
} else if (file.isFile()) {
if (file.getName().equalsIgnoreCase(getExecutable())) {
return file.getAbsolutePath();
}
- }
- return null;
- }
+ }
+ return null;
+ }
- private static String getExecutable() {
- // Add more ifs as we add support for new platforms
- if (CoreUtil.isMac()) {
- return "Google Chrome.app/Contents/MacOS/Google Chrome";
- } else if (CoreUtil.isLinux()) {
- return "chrome";
- } else {
- return "chrome.exe";
- }
- }
-
- private ChromeDebugUtils() {
- // No instantiating
- }
+ private static String getExecutable() {
+ // Add more ifs as we add support for new platforms
+ if (CoreUtil.isMac()) {
+ return "Google Chrome.app/Contents/MacOS/Google Chrome";
+ } else if (CoreUtil.isLinux()) {
+ return "chrome";
+ } else {
+ return "chrome.exe";
+ }
+ }
- public static String getChromeExecutible() {
- return getExecutablePath(Activator.getDefault().getPreferenceStore().getString(IConstants.PREF_NAME_CHROME_LOCATION));
- }
+ private ChromeDebugUtils() {
+ // No instantiating
+ }
+
+ public static String getChromeExecutible() {
+ return getExecutablePath(Activator.getDefault().getPreferenceStore()
+ .getString(IConstants.PREF_NAME_CHROME_LOCATION));
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/HtmlBreakpointProvider.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/HtmlBreakpointProvider.java Thu Sep 02 15:18:58 2010 -0700
@@ -19,46 +19,44 @@
@SuppressWarnings("restriction")
public class HtmlBreakpointProvider implements IBreakpointProvider {
- public IStatus addBreakpoint(IDocument document, IEditorInput input,
- int lineNumber, int offset) throws CoreException {
- boolean hasScript = hasJavaScript(document, lineNumber);
+ public IStatus addBreakpoint(IDocument document, IEditorInput input, int lineNumber, int offset)
+ throws CoreException {
+ boolean hasScript = hasJavaScript(document, lineNumber);
- if (hasScript) {
+ if (hasScript) {
ChromiumLineBreakpoint breakpoint = new ChromiumLineBreakpoint(getResource(input), lineNumber,
WRTProjectWorkspaceBridge.DEBUG_MODEL_ID);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(breakpoint);
- }
- return Status.OK_STATUS;
- }
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(breakpoint);
+ }
+ return Status.OK_STATUS;
+ }
- private boolean hasJavaScript(IDocument document, int lineNumber) {
- try {
- if (document instanceof IStructuredDocument) {
- IStructuredDocument doc = (IStructuredDocument) document;
- int lineOffset = doc.getLineOffset(lineNumber - 1);
- int lineLength = doc.getLineLength(lineNumber - 1);
- ITypedRegion[] computePartitioning = doc.computePartitioning(
- lineOffset, lineLength);
- for (ITypedRegion region : computePartitioning) {
- if (IHTMLPartitions.SCRIPT.equals(region.getType())
- || IHTMLPartitions.SCRIPT_EVENTHANDLER
- .equals(region.getType())) {
- return true;
- }
- }
- }
- } catch (BadLocationException e) {
- Activator.log(e);
- }
- return false;
- }
+ private boolean hasJavaScript(IDocument document, int lineNumber) {
+ try {
+ if (document instanceof IStructuredDocument) {
+ IStructuredDocument doc = (IStructuredDocument) document;
+ int lineOffset = doc.getLineOffset(lineNumber - 1);
+ int lineLength = doc.getLineLength(lineNumber - 1);
+ ITypedRegion[] computePartitioning = doc.computePartitioning(lineOffset, lineLength);
+ for (ITypedRegion region : computePartitioning) {
+ if (IHTMLPartitions.SCRIPT.equals(region.getType())
+ || IHTMLPartitions.SCRIPT_EVENTHANDLER.equals(region.getType())) {
+ return true;
+ }
+ }
+ }
+ } catch (BadLocationException e) {
+ Activator.log(e);
+ }
+ return false;
+ }
- public IResource getResource(IEditorInput input) {
- return (IResource) input.getAdapter(IResource.class);
- }
+ public IResource getResource(IEditorInput input) {
+ return (IResource) input.getAdapter(IResource.class);
+ }
- public void setSourceEditingTextTools(ISourceEditingTextTools tools) {
- // Do nothing
- }
+ public void setSourceEditingTextTools(ISourceEditingTextTools tools) {
+ // Do nothing
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/IConstants.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/IConstants.java Thu Sep 02 15:18:58 2010 -0700
@@ -19,7 +19,7 @@
package org.symbian.tools.tmw.debug.internal;
public interface IConstants {
- String PREF_NAME_CHROME_LOCATION="chrome.location";
- String PROP_PROJECT_NAME = "projectName";
+ String PREF_NAME_CHROME_LOCATION = "chrome.location";
+ String PROP_PROJECT_NAME = "projectName";
String PREF_SHOW_RESOURCE_CHANGE_ERROR = "show.resourceChange.warning";
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/Images.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/Images.java Thu Sep 02 15:18:58 2010 -0700
@@ -22,31 +22,35 @@
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
-public class Images {
- private static final String WRT16 = "main16.gif";
-
- public static void initImageRegistry(ImageRegistry registry) {
- setImage(registry, WRT16);
- }
+public final class Images {
+ private static final String WRT16 = "main16.gif";
+
+ public static void initImageRegistry(ImageRegistry registry) {
+ setImage(registry, WRT16);
+ }
+
+ private static void setImage(ImageRegistry registry, String image) {
+ ImageDescriptor img = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/" + image);
+ registry.put(image, img);
+ }
+
+ public static ImageDescriptor getWrtIcon() {
+ return getImageDescriptor(WRT16);
+ }
- private static void setImage(ImageRegistry registry, String image) {
- ImageDescriptor img = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/" + image);
- registry.put(image, img);
- }
-
- public static ImageDescriptor getWrtIcon() {
- return getImageDescriptor(WRT16);
- }
+ private static ImageDescriptor getImageDescriptor(String image) {
+ return Activator.getDefault().getImageRegistry().getDescriptor(image);
+ }
+
+ public static Image getWrtIconImage() {
+ return getImage(WRT16);
+ }
- private static ImageDescriptor getImageDescriptor(String image) {
- return Activator.getDefault().getImageRegistry().getDescriptor(image);
- }
+ private static Image getImage(String image) {
+ return Activator.getDefault().getImageRegistry().get(image);
+ }
- public static Image getWrtIconImage() {
- return getImage(WRT16);
- }
-
- private static Image getImage(String image) {
- return Activator.getDefault().getImageRegistry().get(image);
- }
+ private Images() {
+ // No instantiation
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/PreferenceInitializer.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/PreferenceInitializer.java Thu Sep 02 15:18:58 2010 -0700
@@ -28,7 +28,7 @@
private static final String DEFAULT_CHROME_PATH_WINXP = "C:/Program Files/Google/Chrome/Application/";
private static final String DEFAULT_CHROME_PATH_LINUX = "/opt/google/chrome";
private static final String DEFAULT_CHROME_PATH_MAC = "/Applications";
- private final static String DEFAULT_CHROME_PATH_VISTA = "Local Settings/Application Data/Google/Chrome/Application";
+ private static final String DEFAULT_CHROME_PATH_VISTA = "Local Settings/Application Data/Google/Chrome/Application";
@Override
public void initializeDefaultPreferences() {
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/WorkspaceLineBreakpointAdapter.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/WorkspaceLineBreakpointAdapter.java Thu Sep 02 15:18:58 2010 -0700
@@ -26,17 +26,17 @@
@SuppressWarnings("restriction")
public class WorkspaceLineBreakpointAdapter extends LineBreakpointAdapter {
- @Override
- protected ITextEditor getEditor(IWorkbenchPart part) {
- if (part instanceof JavaEditor) {
- return (ITextEditor) part;
- } else {
- return null;
- }
- }
+ @Override
+ protected ITextEditor getEditor(IWorkbenchPart part) {
+ if (part instanceof JavaEditor) {
+ return (ITextEditor) part;
+ } else {
+ return null;
+ }
+ }
@Override
protected String getDebugModelId() {
- return VProjectWorkspaceBridge.DEBUG_MODEL_ID;
+ return VProjectWorkspaceBridge.DEBUG_MODEL_ID;
}
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/ChromeInstancesManager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/ChromeInstancesManager.java Thu Sep 02 15:18:58 2010 -0700
@@ -43,9 +43,9 @@
"--disable-web-security", // Widgets can use network now
"--disable-extenions", // Use standard UI, should also improve speed and stability
"--activate-on-launch", // Bring to front on Mac
- "--disable-geolocation", // Use our own Geolocation (needed to emulate Geolocation in phonegap)
- "--disable-local-storage", // Disable local storage (needed to emulate Geolocation in phonegap)
- "--disable-session-storage", // Disable local storage (needed to emulate Geolocation in phonegap)
+ "--disable-geolocation", // Use our own Geolocation (needed to emulate Geolocation in phonegap)
+ "--disable-local-storage", // Disable local storage (needed to emulate Geolocation in phonegap)
+ "--disable-session-storage", // Disable local storage (needed to emulate Geolocation in phonegap)
"--no-default-browser-check", // Our users don't need this nagging
"--disable-hang-monitor", // Fix for Bug 2682 - The debugger should disable "unresponsive" error message from chrome
"--no-first-run", // We don't care
@@ -74,7 +74,7 @@
commandline[USER_DATA_INDEX] = String.format(CHROME_ARGS[USER_DATA_INDEX], getChromeProfilePath());
commandline[CACHE_INDEX] = String.format(CHROME_ARGS[CACHE_INDEX], getChromeCachePath());
commandline[URL_INDEX] = String.format(CHROME_ARGS[URL_INDEX], url);
-
+
// 2. Start Chrome
try {
Process process = Runtime.getRuntime().exec(commandline);
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/DebugConnectionJob.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/DebugConnectionJob.java Thu Sep 02 15:18:58 2010 -0700
@@ -39,99 +39,92 @@
import org.symbian.tools.tmw.previewer.http.IPreviewStartupListener;
public class DebugConnectionJob implements IPreviewStartupListener {
- static final NamedConnectionLoggerFactory NO_CONNECTION_LOGGER_FACTORY = new NamedConnectionLoggerFactory() {
- public ConnectionLogger createLogger(String title) {
- return null;
- }
- };
- private final int port;
- private final ILaunch launch;
- private final IProject project;
+ static final NamedConnectionLoggerFactory NO_CONNECTION_LOGGER_FACTORY = new NamedConnectionLoggerFactory() {
+ public ConnectionLogger createLogger(String title) {
+ return null;
+ }
+ };
+ private final int port;
+ private final ILaunch launch;
+ private final IProject project;
- public DebugConnectionJob(IProject project, final int port,
- final ILaunch launch) {
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Debugging " + project.getName() + " on port "
- + port + ", launch: " + launch.getLaunchConfiguration());
- }
- this.project = project;
- this.port = port;
- this.launch = launch;
- }
+ public DebugConnectionJob(IProject project, final int port, final ILaunch launch) {
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Debugging " + project.getName() + " on port " + port + ", launch: "
+ + launch.getLaunchConfiguration());
+ }
+ this.project = project;
+ this.port = port;
+ this.launch = launch;
+ }
- protected ConnectionToRemote createConnectionToRemote(int port,
- ILaunch launch, URI uri) throws CoreException {
- return JavascriptVmEmbedderFactory.connectToChromeDevTools(port,
- NO_CONNECTION_LOGGER_FACTORY, new WidgetTabSelector(uri));
- }
+ protected ConnectionToRemote createConnectionToRemote(int port, ILaunch launch, URI uri) throws CoreException {
+ return JavascriptVmEmbedderFactory.connectToChromeDevTools(port, NO_CONNECTION_LOGGER_FACTORY,
+ new WidgetTabSelector(uri));
+ }
- private static void terminateTarget(DebugTargetImpl target) {
- target.setDisconnected(true);
- target.fireTerminateEvent();
- }
+ private static void terminateTarget(DebugTargetImpl target) {
+ target.setDisconnected(true);
+ target.fireTerminateEvent();
+ }
public boolean browserRunning(URI uri, String sId) throws CoreException {
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Browser running, connecting @" + hashCode());
- }
- DestructingGuard destructingGuard = new DestructingGuard();
- try {
- JavascriptVmEmbedder.ConnectionToRemote remoteServer = createConnectionToRemote(
- port, launch, uri);
- Destructable lauchDestructor = new Destructable() {
- public void destruct() {
- if (!launch.hasChildren()) {
- DebugPlugin.getDefault().getLaunchManager()
- .removeLaunch(launch);
- }
- }
- };
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Setting up 1@" + hashCode());
- }
- destructingGuard.addValue(lauchDestructor);
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Browser running, connecting @" + hashCode());
+ }
+ DestructingGuard destructingGuard = new DestructingGuard();
+ try {
+ JavascriptVmEmbedder.ConnectionToRemote remoteServer = createConnectionToRemote(port, launch, uri);
+ Destructable lauchDestructor = new Destructable() {
+ public void destruct() {
+ if (!launch.hasChildren()) {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
+ }
+ }
+ };
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Setting up 1@" + hashCode());
+ }
+ destructingGuard.addValue(lauchDestructor);
- WorkspaceBridge.Factory bridgeFactory = new WRTProjectWorkspaceBridge.Factory(
- project);
- final DebugTargetImpl target = new DebugTargetImpl(launch,
- bridgeFactory);
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Setting up 2@" + hashCode());
- }
+ WorkspaceBridge.Factory bridgeFactory = new WRTProjectWorkspaceBridge.Factory(project);
+ final DebugTargetImpl target = new DebugTargetImpl(launch, bridgeFactory);
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Setting up 2@" + hashCode());
+ }
- Destructable targetDestructor = new Destructable() {
- public void destruct() {
- terminateTarget(target);
- }
- };
- destructingGuard.addValue(targetDestructor);
+ Destructable targetDestructor = new Destructable() {
+ public void destruct() {
+ terminateTarget(target);
+ }
+ };
+ destructingGuard.addValue(targetDestructor);
- if (Activator.DEBUG_CONNECTION) {
- System.out.println("Setting up 3@" + hashCode());
- }
- boolean attached = target.attach(remoteServer, destructingGuard,
- null, new NullProgressMonitor());
- if (Activator.DEBUG_CONNECTION) {
- System.out.printf("Is attached: %b, @%d\n", attached, hashCode());
- }
- if (!attached) {
- // Error
- return false;
- }
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.println("Setting up 3@" + hashCode());
+ }
+ boolean attached = target.attach(remoteServer, destructingGuard, null, new NullProgressMonitor());
+ if (Activator.DEBUG_CONNECTION) {
+ System.out.printf("Is attached: %b, @%d\n", attached, hashCode());
+ }
+ if (!attached) {
+ // Error
+ return false;
+ }
- launch.addDebugTarget(target);
+ launch.addDebugTarget(target);
launch.setAttribute("http.service.id", sId);
- // All OK
- destructingGuard.discharge();
+ // All OK
+ destructingGuard.discharge();
addResourceListenerIfNotInstalled();
- } catch (CoreException e) {
- DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
- throw e;
- } finally {
- destructingGuard.doFinally();
- }
- return true;
- }
+ } catch (CoreException e) {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
+ throw e;
+ } finally {
+ destructingGuard.doFinally();
+ }
+ return true;
+ }
private static boolean listenerAdded = false;
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/DebugUtil.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/DebugUtil.java Thu Sep 02 15:18:58 2010 -0700
@@ -31,7 +31,7 @@
import org.symbian.tools.tmw.debug.internal.Activator;
import org.symbian.tools.tmw.debug.internal.IConstants;
-public class DebugUtil {
+public final class DebugUtil {
public static CoreException createCoreException(String message, Throwable exeption) {
return new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, exeption));
}
@@ -86,4 +86,7 @@
return false;
}
+ private DebugUtil() {
+ // Can't be instantiated
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/PortPolicy.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/PortPolicy.java Thu Sep 02 15:18:58 2010 -0700
@@ -24,49 +24,33 @@
import org.symbian.tools.tmw.debug.internal.Activator;
public abstract class PortPolicy {
- // private static class ReuseSamePort extends PortPolicy {
- // private int port = -1;
- //
- // @Override
- // protected int getPort() {
- // if (port < 0) {
- // port = getOpenPort();
- // }
- // return port;
- // }
- // }
+ private static class NewPortEachTime extends PortPolicy {
+ @Override
+ protected int getPort() {
+ return getOpenPort();
+ }
+ }
- private static class NewPortEachTime extends PortPolicy {
- @Override
- protected int getPort() {
- return getOpenPort();
- }
- }
+ public static final PortPolicy INSTANCE;
+ static {
+ INSTANCE = new NewPortEachTime();
+ }
- public static final PortPolicy INSTANCE;
- static {
- // if (CoreUtil.isMac()) {
- INSTANCE = new NewPortEachTime();
- // } else {
- // INSTANCE = new ReuseSamePort();
- // }
- }
-
- public static synchronized int getPortNumber() {
- return INSTANCE.getPort();
- }
+ public static synchronized int getPortNumber() {
+ return INSTANCE.getPort();
+ }
- public int getOpenPort() {
- try {
- final ServerSocket socket = new ServerSocket(0);
- int port = socket.getLocalPort();
- socket.close();
- return port;
- } catch (IOException e) {
- Activator.log(e);
- return 7222;
- }
- }
+ public int getOpenPort() {
+ try {
+ final ServerSocket socket = new ServerSocket(0);
+ int port = socket.getLocalPort();
+ socket.close();
+ return port;
+ } catch (IOException e) {
+ Activator.log(e);
+ return 7222;
+ }
+ }
- protected abstract int getPort();
+ protected abstract int getPort();
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WRTProjectWorkspaceBridge.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WRTProjectWorkspaceBridge.java Thu Sep 02 15:18:58 2010 -0700
@@ -33,8 +33,8 @@
public static final class Factory implements WorkspaceBridge.Factory {
private final IProject project;
- public Factory(IProject project) {
- this.project = project;
+ public Factory(IProject workspaceProject) {
+ this.project = workspaceProject;
}
public WorkspaceBridge attachedToVm(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm) {
@@ -50,23 +50,24 @@
}
}
- public final static String DEBUG_MODEL_ID = "org.symbian.debug";
+ public static final String DEBUG_MODEL_ID = "org.symbian.debug";
private final BreakpointHandler breakpointHandler;
private final JavascriptVm javascriptVm;
private final IProject project;
private final ResourceManager resourceManager;
- public WRTProjectWorkspaceBridge(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm, IProject project) {
- this.javascriptVm = javascriptVm;
- this.project = project;
+ public WRTProjectWorkspaceBridge(DebugTargetImpl debugTargetImpl, JavascriptVm vm, IProject workspaceProject) {
+ this.javascriptVm = vm;
+ this.project = workspaceProject;
this.resourceManager = new ResourceManager();
this.sourceLocator = new WebApplicationSourceLocator(resourceManager);
breakpointHandler = new WorkspaceBreakpointHandler(debugTargetImpl);
ILaunch launch = debugTargetImpl.getLaunch();
try {
sourceLocator.initializeDefaults(launch.getLaunchConfiguration());
- sourceLocator.setSourceContainers(new ISourceContainer[] { new ProjectSourceContainer(project, false),
+ sourceLocator.setSourceContainers(new ISourceContainer[] {
+ new ProjectSourceContainer(workspaceProject, false),
new DirectorySourceContainer(Activator.getDefault().getStateLocation(), true) });
} catch (CoreException e) {
throw new RuntimeException(e);
@@ -149,11 +150,11 @@
private final Script script;
private final VmResourceId id;
- public VmResourceImpl(VmResourceId id, Script script, String name) {
+ public VmResourceImpl(VmResourceId resourceId, Script browserScript, String resourceName) {
super();
- this.id = id;
- this.script = script;
- this.name = name;
+ this.id = resourceId;
+ this.script = browserScript;
+ this.name = resourceName;
}
public VmResourceId getId() {
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WebApplicationSourceLocator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WebApplicationSourceLocator.java Thu Sep 02 15:18:58 2010 -0700
@@ -51,10 +51,10 @@
private final ResourceManager resourceManager;
private final WebApplicationSourceLocator locator;
- public WebApplicationSourceLookupParticipant(WebApplicationSourceLocator locator,
- ResourceManager resourceManager) {
- this.locator = locator;
- this.resourceManager = resourceManager;
+ public WebApplicationSourceLookupParticipant(WebApplicationSourceLocator sourceLocator,
+ ResourceManager resourcesManager) {
+ this.locator = sourceLocator;
+ this.resourceManager = resourcesManager;
}
public String getSourceName(Object object) throws CoreException {
@@ -80,8 +80,8 @@
private final ResourceManager resourceManager;
- public WebApplicationSourceLocator(ResourceManager resourceManager) {
- this.resourceManager = resourceManager;
+ public WebApplicationSourceLocator(ResourceManager resourcesManager) {
+ this.resourceManager = resourcesManager;
}
public String fileUrl(Script script) throws CoreException {
@@ -114,34 +114,34 @@
}
public Object getSourceElement(IStackFrame stackFrame) {
- if (stackFrame instanceof StackFrame == false) {
- return null;
- }
- StackFrame jsStackFrame = (StackFrame) stackFrame;
+ if (!(stackFrame instanceof StackFrame)) {
+ return null;
+ }
+ StackFrame jsStackFrame = (StackFrame) stackFrame;
- Script script = jsStackFrame.getCallFrame().getScript();
- if (script == null) {
- return null;
- }
+ Script script = jsStackFrame.getCallFrame().getScript();
+ if (script == null) {
+ return null;
+ }
- IFile resource = resourceManager.getResource(script);
- if (resource != null) {
- return resource;
- } else {
- File file = PreviewerPlugin.getDefault().getHttpPreviewer().getLocalFile(script.getName());
+ IFile resource = resourceManager.getResource(script);
+ if (resource != null) {
+ return resource;
+ } else {
+ File file = PreviewerPlugin.getDefault().getHttpPreviewer().getLocalFile(script.getName());
if (file != null) {
- try {
- return EFS.getStore(file.toURI());
- } catch (CoreException e) {
- Activator.log(e);
- }
- }
- }
- return null;
- }
+ try {
+ return EFS.getStore(file.toURI());
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+ }
+ return null;
+ }
public void initializeParticipants() {
addParticipants(new ISourceLookupParticipant[] { new WebApplicationSourceLookupParticipant(this,
resourceManager) });
}
-}
\ No newline at end of file
+}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WidgetLaunchDelegate.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WidgetLaunchDelegate.java Thu Sep 02 15:18:58 2010 -0700
@@ -36,12 +36,12 @@
import org.symbian.tools.tmw.previewer.PreviewerPlugin;
public class WidgetLaunchDelegate implements ILaunchConfigurationDelegate {
- public static final String ID = "org.symbian.tools.wrttools.debug.widget";
+ public static final String ID = "org.symbian.tools.wrttools.debug.widget";
- public void launch(ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor)
- throws CoreException {
- monitor.beginTask("Preparing Mobile Web Debugger", IProgressMonitor.UNKNOWN);
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ public void launch(ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("Preparing Mobile Web Debugger", IProgressMonitor.UNKNOWN);
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
final IWorkbench workbench = PlatformUI.getWorkbench();
final IWorkbenchWindow window = workbench.getWorkbenchWindows()[0];
final boolean[] retvalue = new boolean[1];
@@ -54,34 +54,34 @@
launchManager.removeLaunch(launch);
return;
}
- boolean debug = mode.equals(ILaunchManager.DEBUG_MODE);
- try {
- // 1. Load all parameters
- IProject project = DebugUtil.getProject(configuration);
+ boolean debug = mode.equals(ILaunchManager.DEBUG_MODE);
+ try {
+ // 1. Load all parameters
+ IProject project = DebugUtil.getProject(configuration);
if (DebugUtil.isProjectDebugged(project, launchManager, launch)) {
- throw DebugUtil.createCoreException(MessageFormat.format("Project {0} is already running.", project.getName()),
- null);
+ throw DebugUtil.createCoreException(
+ MessageFormat.format("Project {0} is already running.", project.getName()), null);
}
- int port = PortPolicy.getPortNumber();
- final URI uri = prepareDebugger(project, debug, launch, port);
+ int port = PortPolicy.getPortNumber();
+ final URI uri = prepareDebugger(project, debug, launch, port);
- Activator.getDefault().getChromeInstancesManager().startChrome(launch, port, uri.toASCIIString());
- } catch (CoreException e) {
- launchManager.removeLaunch(launch);
- throw e;
- }
- if (!debug) {
- launchManager.removeLaunch(launch);
- }
- monitor.done();
- }
+ Activator.getDefault().getChromeInstancesManager().startChrome(launch, port, uri.toASCIIString());
+ } catch (CoreException e) {
+ launchManager.removeLaunch(launch);
+ throw e;
+ }
+ if (!debug) {
+ launchManager.removeLaunch(launch);
+ }
+ monitor.done();
+ }
private URI prepareDebugger(IProject project, boolean debug, final ILaunch launch, final int port) {
DebugConnectionJob job = null;
- if (debug) {
+ if (debug) {
job = new DebugConnectionJob(project, port, launch);
- }
+ }
return PreviewerPlugin.getDefault().getHttpPreviewer().previewProject(project, job);
- }
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WidgetTabSelector.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WidgetTabSelector.java Thu Sep 02 15:18:58 2010 -0700
@@ -29,33 +29,33 @@
import org.chromium.sdk.Browser.TabFetcher;
public class WidgetTabSelector implements TabSelector {
- private final URI uri;
- private TabConnector connector;
+ private final URI uri;
+ private TabConnector connector;
+
+ public WidgetTabSelector(URI tabUri) {
+ this.uri = tabUri;
+ }
- public WidgetTabSelector(URI uri) {
- this.uri = uri;
- }
-
- public TabConnector selectTab(TabFetcher tabFetcher) throws IOException {
- // Give it time to start the process/tab. 5 retries, 500 ms inbetween.
- for (int i = 0; i < 5; i++) {
- List<? extends TabConnector> tabs = tabFetcher.getTabs();
- for (TabConnector tabConnector : tabs) {
- String url = tabConnector.getUrl();
- try {
+ public TabConnector selectTab(TabFetcher tabFetcher) throws IOException {
+ // Give it time to start the process/tab. 5 retries, 500 ms inbetween.
+ for (int i = 0; i < 5; i++) {
+ List<? extends TabConnector> tabs = tabFetcher.getTabs();
+ for (TabConnector tabConnector : tabs) {
+ String url = tabConnector.getUrl();
+ try {
if (uri.toURL().toExternalForm().equals(new URL(url).toExternalForm())) {
- connector = tabConnector;
- return tabConnector;
- }
- } catch (MalformedURLException e) {
- // Ignore - fails because of "chrome" protocol, we should ignore these tabs anyways
- }
- }
- }
- return null;
- }
-
- public TabConnector getConnector() {
- return connector;
- }
+ connector = tabConnector;
+ return tabConnector;
+ }
+ } catch (MalformedURLException e) {
+ // Ignore - fails because of "chrome" protocol, we should ignore these tabs anyways
+ }
+ }
+ }
+ return null;
+ }
+
+ public TabConnector getConnector() {
+ return connector;
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/JsWatchExpressionDelegate.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/JsWatchExpressionDelegate.java Thu Sep 02 15:18:58 2010 -0700
@@ -23,148 +23,143 @@
*/
public class JsWatchExpressionDelegate implements IWatchExpressionDelegate {
- private static final String[] EMPTY_STRINGS = new String[0];
+ private static final String[] EMPTY_STRINGS = new String[0];
- private static final class GoodWatchExpressionResult implements IWatchExpressionResult {
+ private static final class GoodWatchExpressionResult implements IWatchExpressionResult {
+
+ private final Variable variable;
- private final Variable variable;
+ private final String expression;
- private final String expression;
+ private IValue value;
+
+ private DebugException exception;
- private IValue value;
-
- private DebugException exception;
+ private GoodWatchExpressionResult(Variable variable, String expression) {
+ this.variable = variable;
+ this.expression = expression;
+ }
- private GoodWatchExpressionResult(Variable variable, String expression) {
- this.variable = variable;
- this.expression = expression;
- }
+ public String[] getErrorMessages() {
+ if (exception == null) {
+ return EMPTY_STRINGS;
+ } else {
+ return new String[] { exception.getStatus().getMessage() };
+ }
+ }
- public String[] getErrorMessages() {
- return exception == null
- ? EMPTY_STRINGS
- : new String[] { exception.getStatus().getMessage() };
- }
+ public DebugException getException() {
+ getValue();
+ return exception;
+ }
- public DebugException getException() {
- getValue();
- return exception;
- }
+ public String getExpressionText() {
+ return expression;
+ }
- public String getExpressionText() {
- return expression;
- }
+ public synchronized IValue getValue() {
+ if (value == null && exception == null) {
+ try {
+ value = variable.getValue();
+ } catch (DebugException e) {
+ this.exception = e;
+ }
+ }
+ return value;
+ }
- public synchronized IValue getValue() {
- if (value == null && exception == null) {
- try {
- value = variable.getValue();
- } catch (DebugException e) {
- this.exception = e;
+ public boolean hasErrors() {
+ getValue();
+ return exception != null;
}
- }
- return value;
}
- public boolean hasErrors() {
- getValue();
- return exception != null;
- }
- }
-
- private static final class BadWatchExpressionResult implements IWatchExpressionResult {
-
- private final DebugException exception;
+ private static final class BadWatchExpressionResult implements IWatchExpressionResult {
- private final String expressionText;
-
- private BadWatchExpressionResult(DebugException exception, String expressionText) {
- this.exception = exception;
- this.expressionText = expressionText;
- }
-
- public String[] getErrorMessages() {
- return new String[] { exception.getStatus().getMessage() };
- }
+ private final DebugException exception;
- public DebugException getException() {
- return exception;
- }
-
- public String getExpressionText() {
- return expressionText;
- }
-
- public IValue getValue() {
- return null;
- }
+ private final String expressionText;
- public boolean hasErrors() {
- return true;
- }
- }
-
- public void evaluateExpression(final String expression, final IDebugElement context,
- final IWatchExpressionListener listener) {
- final DebugElementImpl contextImpl = (DebugElementImpl) context;
- if (!contextImpl.getDebugTarget().isSuspended()) {
- // can only evaluate while suspended. Notify empty result.
- listener.watchEvaluationFinished(new IWatchExpressionResult() {
+ private BadWatchExpressionResult(DebugException exception, String expressionText) {
+ this.exception = exception;
+ this.expressionText = expressionText;
+ }
public String[] getErrorMessages() {
- return EMPTY_STRINGS;
+ return new String[] { exception.getStatus().getMessage() };
}
public DebugException getException() {
- return null;
+ return exception;
}
public String getExpressionText() {
- return expression;
+ return expressionText;
}
public IValue getValue() {
- return null;
+ return null;
}
public boolean hasErrors() {
- return false;
+ return true;
}
- });
- return;
- }
-
- final EvaluateContext evaluateContext =
- (EvaluateContext) contextImpl.getAdapter(EvaluateContext.class);
- if (evaluateContext == null) {
- listener.watchEvaluationFinished(new BadWatchExpressionResult(
- new DebugException(
- new Status(Status.ERROR, Activator.PLUGIN_ID, "Bad debug context")), //$NON-NLS-1$
- expression));
- return;
}
- evaluateContext.getJsEvaluateContext().evaluateAsync(
- expression,
- new JsEvaluateContext.EvaluateCallback() {
- public void success(JsVariable variable) {
- final Variable var = new Variable(contextImpl.getDebugTarget(), variable, false);
- listener.watchEvaluationFinished(new GoodWatchExpressionResult(var, expression));
- }
+ public void evaluateExpression(final String expression, final IDebugElement context,
+ final IWatchExpressionListener listener) {
+ final DebugElementImpl contextImpl = (DebugElementImpl) context;
+ if (!contextImpl.getDebugTarget().isSuspended()) {
+ // can only evaluate while suspended. Notify empty result.
+ listener.watchEvaluationFinished(new IWatchExpressionResult() {
+
+ public String[] getErrorMessages() {
+ return EMPTY_STRINGS;
+ }
+
+ public DebugException getException() {
+ return null;
+ }
+
+ public String getExpressionText() {
+ return expression;
+ }
+
+ public IValue getValue() {
+ return null;
+ }
- public void failure(String message) {
- listener.watchEvaluationFinished(new BadWatchExpressionResult(new DebugException(
- createErrorStatus(message == null
- ? "Error evaluating expression"
- : message, null)), expression));
+ public boolean hasErrors() {
+ return false;
+ }
+ });
+ return;
+ }
+
+ final EvaluateContext evaluateContext = (EvaluateContext) contextImpl.getAdapter(EvaluateContext.class);
+ if (evaluateContext == null) {
+ listener.watchEvaluationFinished(new BadWatchExpressionResult(new DebugException(new Status(Status.ERROR,
+ Activator.PLUGIN_ID, "Bad debug context")), //$NON-NLS-1$
+ expression));
return;
- }
- },
- null);
- }
+ }
+
+ evaluateContext.getJsEvaluateContext().evaluateAsync(expression, new JsEvaluateContext.EvaluateCallback() {
+ public void success(JsVariable variable) {
+ final Variable var = new Variable(contextImpl.getDebugTarget(), variable, false);
+ listener.watchEvaluationFinished(new GoodWatchExpressionResult(var, expression));
+ }
- private static Status createErrorStatus(String message, Exception e) {
- return new Status(Status.ERROR, Activator.PLUGIN_ID, message, e);
- }
+ public void failure(String message) {
+ listener.watchEvaluationFinished(new BadWatchExpressionResult(new DebugException(createErrorStatus(
+ message == null ? "Error evaluating expression" : message, null)), expression));
+ return;
+ }
+ }, null);
+ }
+
+ private static Status createErrorStatus(String message, Exception e) {
+ return new Status(Status.ERROR, Activator.PLUGIN_ID, message, e);
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/ResourceManager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/ResourceManager.java Thu Sep 02 15:18:58 2010 -0700
@@ -1,7 +1,6 @@
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
package org.symbian.tools.tmw.debug.internal.model;
import java.util.HashMap;
@@ -17,52 +16,56 @@
* corresponding resources inside Eclipse.
*/
public class ResourceManager {
- private final Map<IFile, Script> resourceToScript = new HashMap<IFile, Script>();
+ private final Map<IFile, Script> resourceToScript = new HashMap<IFile, Script>();
private final Map<VmResourceId, IFile> scriptIdToResource = new HashMap<VmResourceId, IFile>();
public synchronized void addScript(Script script) {
- IFile scriptFile = getResource(script);
- if (scriptFile == null) {
- scriptFile = getFile(script.getName());
- if (scriptFile != null) {
+ IFile scriptFile = getResource(script);
+ if (scriptFile == null) {
+ scriptFile = getFile(script.getName());
+ if (scriptFile != null) {
VmResourceId scriptId = VmResourceId.forScript(script);
resourceToScript.put(scriptFile, script);
scriptIdToResource.put(scriptId, scriptFile);
- }
- }
- }
+ }
+ }
+ }
- public synchronized void clear() {
- resourceToScript.clear();
- scriptIdToResource.clear();
- }
+ public synchronized void clear() {
+ resourceToScript.clear();
+ scriptIdToResource.clear();
+ }
- private IFile getFile(String name) {
- if (name == null) {
- return null;
- }
- IFile file = PreviewerPlugin.getDefault().getHttpPreviewer().getFileFromUrl(name);
- if (file != null && !file.isAccessible()) {
- file = null;
- }
- return file;
- }
+ private IFile getFile(String name) {
+ if (name == null) {
+ return null;
+ }
+ IFile file = PreviewerPlugin.getDefault().getHttpPreviewer().getFileFromUrl(name);
+ if (file != null && !file.isAccessible()) {
+ file = null;
+ }
+ return file;
+ }
public synchronized IFile getResource(Script script) {
return scriptIdToResource.get(VmResourceId.forScript(script));
- }
+ }
public synchronized boolean scriptHasResource(Script script) {
- return getResource(script) != null;
- }
+ return getResource(script) != null;
+ }
public String translateResourceToScript(IFile resource) {
- return PreviewerPlugin.getDefault().getHttpPreviewer().getHttpUrl(resource);
- }
+ return PreviewerPlugin.getDefault().getHttpPreviewer().getHttpUrl(resource);
+ }
public VmResourceId findVmResource(IFile resource) {
- Script script = resourceToScript.get(resource);
- return script != null ? VmResourceId.forScript(script) : null;
+ final Script script = resourceToScript.get(resource);
+ if (script != null) {
+ return VmResourceId.forScript(script);
+ } else {
+ return null;
+ }
}
public Script getScript(IFile file) {
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/SymbianDebugModelPresentation.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/SymbianDebugModelPresentation.java Thu Sep 02 15:18:58 2010 -0700
@@ -27,24 +27,23 @@
import org.eclipse.wst.jsdt.ui.JavaScriptUI;
@SuppressWarnings("restriction")
-public class SymbianDebugModelPresentation extends LabelProvider implements
- IDebugModelPresentation {
+public class SymbianDebugModelPresentation extends LabelProvider implements IDebugModelPresentation {
private static final int DETAILS_DEPTH = 2;
- public void setAttribute(String attribute, Object value) {
- }
+ public void setAttribute(String attribute, Object value) {
+ }
- @Override
- public Image getImage(Object element) {
- // use default image
- return null;
- }
+ @Override
+ public Image getImage(Object element) {
+ // use default image
+ return null;
+ }
- @Override
- public String getText(Object element) {
- // use default label text
- return null;
- }
+ @Override
+ public String getText(Object element) {
+ // use default label text
+ return null;
+ }
public void computeDetail(IValue value, IValueDetailListener listener) {
String detail = ""; //$NON-NLS-1$
@@ -108,65 +107,64 @@
}
public IEditorInput getEditorInput(Object element) {
- return toEditorInput(element);
- }
+ return toEditorInput(element);
+ }
public static IEditorInput toEditorInput(Object element) {
- if (element instanceof IFile) {
- return new FileEditorInput((IFile) element);
- }
- if (element instanceof IFileStore) {
- return new FileStoreEditorInput((IFileStore) element);
- }
+ if (element instanceof IFile) {
+ return new FileEditorInput((IFile) element);
+ }
+ if (element instanceof IFileStore) {
+ return new FileStoreEditorInput((IFileStore) element);
+ }
if (element instanceof IStorage) {
return new JarEntryEditorInput((IStorage) element);
}
- if (element instanceof ILineBreakpoint) {
- return new FileEditorInput((IFile) ((ILineBreakpoint) element)
- .getMarker().getResource());
- }
+ if (element instanceof ILineBreakpoint) {
+ return new FileEditorInput((IFile) ((ILineBreakpoint) element).getMarker().getResource());
+ }
- return null;
- }
+ return null;
+ }
- public String getEditorId(IEditorInput input, Object element) {
- if (input instanceof IFileEditorInput) {
- IFile file;
- if (element instanceof IFile) {
- file = (IFile) element;
- } else if (element instanceof IBreakpoint) {
- IBreakpoint breakpoint = (IBreakpoint) element;
- IResource resource = breakpoint.getMarker().getResource();
- // Can the breakpoint resource be folder or project? Better
- // check for it.
- if (resource instanceof IFile == false) {
- return null;
- }
- file = (IFile) resource;
- } else {
- return null;
- }
+ public String getEditorId(IEditorInput input, Object element) {
+ if (input instanceof IFileEditorInput) {
+ IFile file;
+ if (element instanceof IFile) {
+ file = (IFile) element;
+ } else if (element instanceof IBreakpoint) {
+ IBreakpoint breakpoint = (IBreakpoint) element;
+ IResource resource = breakpoint.getMarker().getResource();
+ // Can the breakpoint resource be folder or project? Better
+ // check for it.
+ if (!(resource instanceof IFile)) {
+ return null;
+ }
+ file = (IFile) resource;
+ } else {
+ return null;
+ }
- // Pick the editor based on the file extension, taking user
- // preferences into account.
- try {
- return IDE.getEditorDescriptor(file).getId();
- } catch (PartInitException e) {
- // TODO(peter.rybin): should it really be the default case?
- // There might be no virtual project.
- return null;
- }
- } else {
+ // Pick the editor based on the file extension, taking user
+ // preferences into account.
+ try {
+ return IDE.getEditorDescriptor(file).getId();
+ } catch (PartInitException e) {
+ // TODO(peter.rybin): should it really be the default case?
+ // There might be no virtual project.
+ return null;
+ }
+ } else {
if (element instanceof IStorage) {
IStorage store = (IStorage) element;
if (JavaScriptCore.isJavaScriptLikeFileName(store.getName())) {
return JavaScriptUI.ID_CU_EDITOR;
- } else {
- return "org.eclipse.wst.html.core.htmlsource.source";
- }
- }
- }
- return null;
- }
+ } else {
+ return "org.eclipse.wst.html.core.htmlsource.source";
+ }
+ }
+ }
+ return null;
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/WorkspaceBreakpointHandler.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/model/WorkspaceBreakpointHandler.java Thu Sep 02 15:18:58 2010 -0700
@@ -1,6 +1,3 @@
-/**
- *
- */
package org.symbian.tools.tmw.debug.internal.model;
import java.util.Collection;
@@ -24,12 +21,12 @@
import org.symbian.tools.tmw.previewer.PreviewerPlugin;
public final class WorkspaceBreakpointHandler implements BreakpointHandler {
- private final BreakpointMap.InTargetMap breakpointInTargetMap = new BreakpointMap.InTargetMap();
- private final DebugTargetImpl debugTarget;
-
+ private final BreakpointMap.InTargetMap breakpointInTargetMap = new BreakpointMap.InTargetMap();
+ private final DebugTargetImpl debugTarget;
+
public WorkspaceBreakpointHandler(DebugTargetImpl debugTarget) {
- this.debugTarget = debugTarget;
- }
+ this.debugTarget = debugTarget;
+ }
public void breakpointAdded(IBreakpoint breakpoint) {
ChromiumLineBreakpoint lineBreakpoint = tryCastBreakpoint(breakpoint);
@@ -95,7 +92,7 @@
try {
if (!breakpoint.isEnabled()) {
- return;
+ return;
}
} catch (CoreException e) {
ChromiumDebugPlugin.log(e);
@@ -168,25 +165,22 @@
try {
return debugTarget.getLaunch().getLaunchConfiguration().getName();
} catch (RuntimeException e) {
- return "<unknown>"; //$NON-NLS-1$
+ return "<unknown>"; //$NON-NLS-1$
}
}
public boolean supportsBreakpoint(IBreakpoint breakpoint) {
- return (WRTProjectWorkspaceBridge.DEBUG_MODEL_ID.equals(breakpoint
- .getModelIdentifier()) || VProjectWorkspaceBridge.DEBUG_MODEL_ID
- .equals(breakpoint.getModelIdentifier()))
- && !debugTarget.isDisconnected();
- }
+ return (WRTProjectWorkspaceBridge.DEBUG_MODEL_ID.equals(breakpoint.getModelIdentifier()) || VProjectWorkspaceBridge.DEBUG_MODEL_ID
+ .equals(breakpoint.getModelIdentifier())) && !debugTarget.isDisconnected();
+ }
public ChromiumLineBreakpoint tryCastBreakpoint(IBreakpoint breakpoint) {
if (!supportsBreakpoint(breakpoint)) {
return null;
}
- if (breakpoint instanceof ChromiumLineBreakpoint == false) {
+ if (!(breakpoint instanceof ChromiumLineBreakpoint)) {
return null;
}
return (ChromiumLineBreakpoint) breakpoint;
}
-
-}
\ No newline at end of file
+}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/property/LaunchableFactory.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/property/LaunchableFactory.java Thu Sep 02 15:18:58 2010 -0700
@@ -6,14 +6,14 @@
@SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
- // It is only needed to exist
- return null;
- }
+ // It is only needed to exist
+ return null;
+ }
@SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
- // It is only needed to exist
- return null;
- }
+ // It is only needed to exist
+ return null;
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/DebugPreferencePage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/DebugPreferencePage.java Thu Sep 02 15:18:58 2010 -0700
@@ -33,22 +33,20 @@
import org.symbian.tools.tmw.debug.internal.ChromeDebugUtils;
import org.symbian.tools.tmw.debug.internal.IConstants;
-public class DebugPreferencePage extends FieldEditorPreferencePage implements
- IWorkbenchPreferencePage {
+public class DebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
private Button check;
public DebugPreferencePage() {
- super(GRID);
- setPreferenceStore(Activator.getDefault().getPreferenceStore());
- setDescription("Mobile Web debugger settings");
- }
+ super(GRID);
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("Mobile Web debugger settings");
+ }
- @Override
- protected void createFieldEditors() {
+ @Override
+ protected void createFieldEditors() {
DirectoryFieldEditor editor = new DirectoryFieldEditor(IConstants.PREF_NAME_CHROME_LOCATION,
- "Chrome Install Location:",
- getFieldEditorParent()) {
+ "Chrome Install Location:", getFieldEditorParent()) {
@Override
protected boolean doCheckState() {
if (super.doCheckState()) {
@@ -62,7 +60,7 @@
};
editor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
editor.setEmptyStringAllowed(false);
- addField(editor);
+ addField(editor);
check = new Button(getFieldEditorParent(), SWT.CHECK);
check.setText("Show warning dialog when resources in the debugged project were changed");
@@ -70,8 +68,7 @@
check.setSelection(!MessageDialogWithToggle.ALWAYS.equals(getPreferenceStore().getString(
IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR)));
- }
-
+ }
protected String validate(String newValue) {
String error = null;
@@ -101,7 +98,7 @@
return super.performOk();
}
- public void init(IWorkbench workbench) {
- // Do nothing
- }
+ public void init(IWorkbench workbench) {
+ // Do nothing
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerAction.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerAction.java Thu Sep 02 15:18:58 2010 -0700
@@ -16,12 +16,12 @@
* Assumptions/Requirement/Pre-requisites:
* Failures and causes:
*******************************************************************************/
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.symbian.tools.tmw.debug.ui.actions;
-
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.symbian.tools.tmw.debug.ui.actions;
+
import org.chromium.debug.core.model.ChromiumLineBreakpoint;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.ui.actions.RulerBreakpointAction;
@@ -33,52 +33,47 @@
import org.eclipse.ui.dialogs.PropertyDialogAction;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Action to bring up the breakpoint properties dialog.
- */
-public class JsBreakpointPropertiesRulerAction extends RulerBreakpointAction
- implements IUpdate {
- private IBreakpoint breakpoint;
-
- public JsBreakpointPropertiesRulerAction(ITextEditor editor,
- IVerticalRulerInfo rulerInfo) {
- super(editor, rulerInfo);
- setText("Breakpoint Properties...");
- }
-
- @Override
- public void run() {
- if (getBreakpoint() != null) {
- PropertyDialogAction action = new PropertyDialogAction(getEditor()
- .getEditorSite(), new ISelectionProvider() {
- public void addSelectionChangedListener(
- ISelectionChangedListener listener) {
- }
-
- public ISelection getSelection() {
- return new StructuredSelection(getBreakpoint());
- }
-
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
- }
-
- public void setSelection(ISelection selection) {
- }
- });
- action.run();
- }
- }
-
- public void update() {
- breakpoint = null;
- IBreakpoint activeBreakpoint = getBreakpoint();
- if (activeBreakpoint != null
- && activeBreakpoint instanceof ChromiumLineBreakpoint) {
- breakpoint = activeBreakpoint;
- }
- setEnabled(breakpoint != null);
- }
-
-}
+
+/**
+ * Action to bring up the breakpoint properties dialog.
+ */
+public class JsBreakpointPropertiesRulerAction extends RulerBreakpointAction implements IUpdate {
+ private IBreakpoint breakpoint;
+
+ public JsBreakpointPropertiesRulerAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
+ super(editor, rulerInfo);
+ setText("Breakpoint Properties...");
+ }
+
+ @Override
+ public void run() {
+ if (getBreakpoint() != null) {
+ PropertyDialogAction action = new PropertyDialogAction(getEditor().getEditorSite(),
+ new ISelectionProvider() {
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ }
+
+ public ISelection getSelection() {
+ return new StructuredSelection(getBreakpoint());
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ }
+
+ public void setSelection(ISelection selection) {
+ }
+ });
+ action.run();
+ }
+ }
+
+ public void update() {
+ breakpoint = null;
+ IBreakpoint activeBreakpoint = getBreakpoint();
+ if (activeBreakpoint != null && activeBreakpoint instanceof ChromiumLineBreakpoint) {
+ breakpoint = activeBreakpoint;
+ }
+ setEnabled(breakpoint != null);
+ }
+
+}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerActionDelegate.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerActionDelegate.java Thu Sep 02 15:18:58 2010 -0700
@@ -16,25 +16,25 @@
* Assumptions/Requirement/Pre-requisites:
* Failures and causes:
*******************************************************************************/
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.symbian.tools.tmw.debug.ui.actions;
-
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.symbian.tools.tmw.debug.ui.actions;
+
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Delegate for JsBreakpointPropertiesRulerAction.
- */
-public class JsBreakpointPropertiesRulerActionDelegate extends AbstractRulerActionDelegate {
-
- @Override
- protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
- return new JsBreakpointPropertiesRulerAction(editor, rulerInfo);
- }
-
-}
+
+/**
+ * Delegate for JsBreakpointPropertiesRulerAction.
+ */
+public class JsBreakpointPropertiesRulerActionDelegate extends AbstractRulerActionDelegate {
+
+ @Override
+ protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
+ return new JsBreakpointPropertiesRulerAction(editor, rulerInfo);
+ }
+
+}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/launch/WidgetBasicTab.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/launch/WidgetBasicTab.java Thu Sep 02 15:18:58 2010 -0700
@@ -49,122 +49,117 @@
import org.symbian.tools.tmw.debug.internal.Images;
public class WidgetBasicTab extends AbstractLaunchConfigurationTab {
- private ComboViewer project;
- private boolean canSave;
+ private ComboViewer project;
+ private boolean canSave;
- @Override
- public Image getImage() {
- return Images.getWrtIconImage();
- }
+ @Override
+ public Image getImage() {
+ return Images.getWrtIconImage();
+ }
- public void createControl(Composite parent) {
- Composite root = new Composite(parent, SWT.NONE);
- FormLayout layout = new FormLayout();
- layout.marginWidth = 5;
- layout.marginHeight = 5;
- layout.spacing = 5;
- root.setLayout(layout);
+ public void createControl(Composite parent) {
+ Composite root = new Composite(parent, SWT.NONE);
+ FormLayout layout = new FormLayout();
+ layout.marginWidth = 5;
+ layout.marginHeight = 5;
+ layout.spacing = 5;
+ root.setLayout(layout);
- Label label = new Label(root, SWT.NONE);
- label.setText("WRT Widget Project:");
+ Label label = new Label(root, SWT.NONE);
+ label.setText("WRT Widget Project:");
- project = new ComboViewer(root, SWT.READ_ONLY);
- project.setContentProvider(new ArrayContentProvider());
- project.setLabelProvider(new WorkbenchLabelProvider());
-
- FormData formData = new FormData();
- formData.left = new FormAttachment(label);
- formData.right = new FormAttachment(100, 0);
- project.getControl().setLayoutData(formData);
+ project = new ComboViewer(root, SWT.READ_ONLY);
+ project.setContentProvider(new ArrayContentProvider());
+ project.setLabelProvider(new WorkbenchLabelProvider());
- project.setInput(getWidgetProjects());
- project.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- setDirty(true);
- validate();
- }
- });
- setControl(root);
- }
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(label);
+ formData.right = new FormAttachment(100, 0);
+ project.getControl().setLayoutData(formData);
- private IProject[] getWidgetProjects() {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
- .getProjects();
- LinkedList<IProject> filtered = new LinkedList<IProject>();
- for (IProject p : projects) {
+ project.setInput(getWidgetProjects());
+ project.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ setDirty(true);
+ validate();
+ }
+ });
+ setControl(root);
+ }
+
+ private IProject[] getWidgetProjects() {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ LinkedList<IProject> filtered = new LinkedList<IProject>();
+ for (IProject p : projects) {
if (TMWCore.create(p) != null) {
- filtered.add(p);
- }
- }
- return filtered.toArray(new IProject[filtered.size()]);
- }
+ filtered.add(p);
+ }
+ }
+ return filtered.toArray(new IProject[filtered.size()]);
+ }
- public String getName() {
- return "WRT Widget";
- }
-
- public void initializeFrom(ILaunchConfiguration configuration) {
- project.setSelection(getSelectedProject(configuration), true);
- validate();
- setErrorMessage(null);
- }
+ public String getName() {
+ return "WRT Widget";
+ }
- private ISelection getSelectedProject(ILaunchConfiguration configuration) {
- ISelection selected = StructuredSelection.EMPTY;
- try {
- String projectName = configuration.getAttribute(
- IConstants.PROP_PROJECT_NAME, (String) null);
- if (projectName != null) {
- IProject p = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(projectName);
- if (p.isAccessible()) {
- selected = new StructuredSelection(p);
- }
- }
- } catch (CoreException e) {
- Activator.log(e);
- }
- return selected;
- }
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ project.setSelection(getSelectedProject(configuration), true);
+ validate();
+ setErrorMessage(null);
+ }
- @Override
- public boolean canSave() {
- return canSave;
- }
+ private ISelection getSelectedProject(ILaunchConfiguration configuration) {
+ ISelection selected = StructuredSelection.EMPTY;
+ try {
+ String projectName = configuration.getAttribute(IConstants.PROP_PROJECT_NAME, (String) null);
+ if (projectName != null) {
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (p.isAccessible()) {
+ selected = new StructuredSelection(p);
+ }
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ return selected;
+ }
+
+ @Override
+ public boolean canSave() {
+ return canSave;
+ }
- private void validate() {
- String error = null;
- if (getWidgetProjects().length == 0) {
- error = "No WRT widget projects found in the workspace";
- } else if (project.getSelection().isEmpty()) {
- error = "Select WRT widget project to debug";
- } else if (ChromeDebugUtils.getChromeExecutible() == null) {
- error = "No Chrome browser configured in the preferences";
- }
- canSave = error == null;
- setErrorMessage(error);
- getLaunchConfigurationDialog().updateButtons();
- }
+ private void validate() {
+ String error = null;
+ if (getWidgetProjects().length == 0) {
+ error = "No WRT widget projects found in the workspace";
+ } else if (project.getSelection().isEmpty()) {
+ error = "Select WRT widget project to debug";
+ } else if (ChromeDebugUtils.getChromeExecutible() == null) {
+ error = "No Chrome browser configured in the preferences";
+ }
+ canSave = error == null;
+ setErrorMessage(error);
+ getLaunchConfigurationDialog().updateButtons();
+ }
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- ISelection selection = project.getSelection();
- if (selection.isEmpty()) {
- setDefaults(configuration);
- } else {
- IProject p = (IProject) ((IStructuredSelection) selection)
- .getFirstElement();
- configuration.setAttribute(IConstants.PROP_PROJECT_NAME, p
- .getName());
- configuration.setMappedResources(new IResource[] { p });
- }
- }
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ ISelection selection = project.getSelection();
+ if (selection.isEmpty()) {
+ setDefaults(configuration);
+ } else {
+ IProject p = (IProject) ((IStructuredSelection) selection).getFirstElement();
+ configuration.setAttribute(IConstants.PROP_PROJECT_NAME, p.getName());
+ configuration.setMappedResources(new IResource[] { p });
+ }
+ }
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- configuration.removeAttribute(IConstants.PROP_PROJECT_NAME);
- }
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.removeAttribute(IConstants.PROP_PROJECT_NAME);
+ }
- @Override
- public boolean isValid(ILaunchConfiguration launchConfig) {
- return !getSelectedProject(launchConfig).isEmpty();
- }
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ return !getSelectedProject(launchConfig).isEmpty();
+ }
}
--- a/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/launch/WidgetLaunchConfigurationTabGroup.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/launch/WidgetLaunchConfigurationTabGroup.java Thu Sep 02 15:18:58 2010 -0700
@@ -23,11 +23,10 @@
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
-public class WidgetLaunchConfigurationTabGroup extends
- AbstractLaunchConfigurationTabGroup {
+public class WidgetLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
- public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- setTabs(new ILaunchConfigurationTab[] {new WidgetBasicTab(), new CommonTab()});
- }
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ setTabs(new ILaunchConfigurationTab[] { new WidgetBasicTab(), new CommonTab() });
+ }
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/IWrtEditingPreferences.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/IWrtEditingPreferences.java Thu Sep 02 15:18:58 2010 -0700
@@ -1,5 +1,5 @@
package org.symbian.tools.tmw.previewer;
public interface IWrtEditingPreferences {
- String PREF_AUTO_REFRESH = "preview.autorefresh";
+ String PREF_AUTO_REFRESH = "preview.autorefresh";
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/Images.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/Images.java Thu Sep 02 15:18:58 2010 -0700
@@ -1,8 +1,8 @@
package org.symbian.tools.tmw.previewer;
public interface Images {
- String RED_SYNC = "/icons/obj16/refresh_red.gif";
- String YELLOW_SYNC = "/icons/obj16/refresh.gif";
- String GREEN_SYNC = "/icons/obj16/refresh_green.gif";
+ String RED_SYNC = "/icons/obj16/refresh_red.gif";
+ String YELLOW_SYNC = "/icons/obj16/refresh.gif";
+ String GREEN_SYNC = "/icons/obj16/refresh_green.gif";
String CLEAR_PREFS = "/icons/obj16/clearpreferences.gif";
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerException.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerException.java Thu Sep 02 15:18:58 2010 -0700
@@ -28,7 +28,7 @@
public PreviewerException(String message) {
this(message, null);
}
-
+
public PreviewerException(String message, Exception exception) {
super(new Status(IStatus.ERROR, PreviewerPlugin.PLUGIN_ID, message, exception));
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java Thu Sep 02 15:18:58 2010 -0700
@@ -39,94 +39,91 @@
*/
public class PreviewerPlugin extends AbstractUIPlugin {
- // The plug-in ID
+ // The plug-in ID
public static final String PLUGIN_ID = "org.symbian.tools.tmw.previewer";
public static final String PREVIEW_VIEW = "org.symbian.tools.tmw.preview";
- public static final boolean DEBUG = Platform.inDebugMode()
- && Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID + "/debug"));
- public static final boolean TRACE_SERVLET = DEBUG
- && Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID
- + "/servlet"));
+ public static final boolean DEBUG = Platform.inDebugMode()
+ && Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID + "/debug"));
+ public static final boolean TRACE_SERVLET = DEBUG
+ && Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID + "/servlet"));
public static final boolean DONT_CACHE_SCRIPT = DEBUG
&& Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID + "/dontScriptCaching"));
- public static final boolean TRACE_MAPPING = DEBUG
- && Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID
- + "/mapping"));
- public static final boolean TRACE_WEBAPP = DEBUG
- && Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID
- + "/webapp"));
-
- // The shared instance
- private static PreviewerPlugin plugin;
+ public static final boolean TRACE_MAPPING = DEBUG
+ && Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID + "/mapping"));
+ public static final boolean TRACE_WEBAPP = DEBUG
+ && Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID + "/webapp"));
+
+ // The shared instance
+ private static PreviewerPlugin plugin;
private final CommandHandlerManager handlerManager = new CommandHandlerManager();
- private final HttpPreviewer previewer = new HttpPreviewer();
+ private final HttpPreviewer previewer = new HttpPreviewer();
private MessageConsole console;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
- @Override
- protected void initializeImageRegistry(ImageRegistry reg) {
- addImage(reg, Images.GREEN_SYNC);
- addImage(reg, Images.RED_SYNC);
- addImage(reg, Images.YELLOW_SYNC);
+ @Override
+ protected void initializeImageRegistry(ImageRegistry reg) {
+ addImage(reg, Images.GREEN_SYNC);
+ addImage(reg, Images.RED_SYNC);
+ addImage(reg, Images.YELLOW_SYNC);
addImage(reg, Images.CLEAR_PREFS);
- }
-
- private void addImage(ImageRegistry reg, String path) {
- ImageDescriptor imageDescriptor = imageDescriptorFromPlugin(PLUGIN_ID, path);
- reg.put(path, imageDescriptor);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static PreviewerPlugin getDefault() {
- return plugin;
- }
-
- public static void log(Exception e) {
- log(null, e);
- }
+ }
+
+ private void addImage(ImageRegistry reg, String path) {
+ ImageDescriptor imageDescriptor = imageDescriptorFromPlugin(PLUGIN_ID, path);
+ reg.put(path, imageDescriptor);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static PreviewerPlugin getDefault() {
+ return plugin;
+ }
+
+ public static void log(Exception e) {
+ log(null, e);
+ }
- public static void log(String message, Exception e) {
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
- getDefault().getLog().log(status);
- }
+ public static void log(String message, Exception e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ getDefault().getLog().log(status);
+ }
- public static ImageDescriptor getImageDescriptor(String key) {
- return getDefault().getImageRegistry().getDescriptor(key);
- }
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return getDefault().getImageRegistry().getDescriptor(key);
+ }
- public IProxyService getProxyService() {
+ public IProxyService getProxyService() {
BundleContext bundleContext = getDefault().getBundle().getBundleContext();
- ServiceReference serviceReference = bundleContext.getServiceReference(IProxyService.class.getName());
- IProxyService service = (IProxyService) bundleContext.getService(serviceReference);
- return service;
- }
-
- public HttpPreviewer getHttpPreviewer() {
- return previewer;
- }
+ ServiceReference serviceReference = bundleContext.getServiceReference(IProxyService.class.getName());
+ IProxyService service = (IProxyService) bundleContext.getService(serviceReference);
+ return service;
+ }
+
+ public HttpPreviewer getHttpPreviewer() {
+ return previewer;
+ }
public CommandHandlerManager getCommandHandlerManager() {
return handlerManager;
@@ -143,7 +140,6 @@
public static void print(String message) throws IOException {
MessageConsole console = getDefault().getConsole();
console.activate();
- console.newMessageStream().write(
- message);
+ console.newMessageStream().write(message);
}
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/BrowserConnectionJob.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/BrowserConnectionJob.java Thu Sep 02 15:18:58 2010 -0700
@@ -10,47 +10,47 @@
import org.symbian.tools.tmw.previewer.PreviewerPlugin;
public class BrowserConnectionJob extends Job {
- private final IPreviewStartupListener listener;
- private final URI uri;
-
- private boolean ready = false;
- private boolean success = false;
+ private final IPreviewStartupListener listener;
+ private final URI uri;
+
+ private boolean ready = false;
+ private boolean success = false;
private String sId = null;
- public BrowserConnectionJob(IPreviewStartupListener listener, URI uri) {
- super("Connecting to Mobile Web debugger browser");
- this.listener = listener;
- this.uri = uri;
- setUser(false);
- }
+ public BrowserConnectionJob(IPreviewStartupListener listener, URI uri) {
+ super("Connecting to Mobile Web debugger browser");
+ this.listener = listener;
+ this.uri = uri;
+ setUser(false);
+ }
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
listener.browserRunning(uri, sId);
- synchronized (this) {
- success = true;
- }
- } catch (CoreException e) {
- synchronized (this) {
- success = false;
- }
- return e.getStatus();
- } finally {
- synchronized (this) {
- ready = true;
- }
- }
- return new Status(IStatus.OK, PreviewerPlugin.PLUGIN_ID, "");
- }
+ synchronized (this) {
+ success = true;
+ }
+ } catch (CoreException e) {
+ synchronized (this) {
+ success = false;
+ }
+ return e.getStatus();
+ } finally {
+ synchronized (this) {
+ ready = true;
+ }
+ }
+ return new Status(IStatus.OK, PreviewerPlugin.PLUGIN_ID, "");
+ }
- public synchronized boolean isReady() {
- return ready;
- }
-
- public synchronized boolean isSuccess() {
- return success;
- }
+ public synchronized boolean isReady() {
+ return ready;
+ }
+
+ public synchronized boolean isSuccess() {
+ return success;
+ }
public void setSessionId(String sId) {
this.sId = sId;
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/WebAppInterface.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/WebAppInterface.java Thu Sep 02 15:18:58 2010 -0700
@@ -29,8 +29,8 @@
import org.eclipse.core.resources.IProject;
import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-public class WebAppInterface {
- private static WebAppInterface INSTANCE;
+public final class WebAppInterface {
+ private static WebAppInterface instance;
public static void connectDebugger(String widget, String id, String sId) {
if (PreviewerPlugin.TRACE_WEBAPP) {
@@ -62,11 +62,11 @@
return getInstance().createAjaxUri(widget, id).toASCIIString();
}
- public synchronized static WebAppInterface getInstance() {
- if (INSTANCE == null) {
- INSTANCE = new WebAppInterface();
+ public static synchronized WebAppInterface getInstance() {
+ if (instance == null) {
+ instance = new WebAppInterface();
}
- return INSTANCE;
+ return instance;
}
public static String getUrl(String widget, String id) {
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/WebappManager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/WebappManager.java Thu Sep 02 15:18:58 2010 -0700
@@ -36,94 +36,94 @@
/**
* Copy from the WS Explorer
- *
+ *
* @author Eugene Ostroukhov
*
*/
-public class WebappManager {
- public static final String WORKSPACE_RESOURCES_CONTEXT = "/preview";
- public static final String STATIC_RESOURCES_CONTEXT = "/wrtdebugger";
- public static final String WEB_CONTENT_ROOT = "/http-content";
-
- private static String host;
- private static int port = -1;
- private static final int AUTO_SELECT_JETTY_PORT = 0;
-
+public final class WebappManager {
+ public static final String WORKSPACE_RESOURCES_CONTEXT = "/preview";
+ public static final String STATIC_RESOURCES_CONTEXT = "/wrtdebugger";
+ public static final String WEB_CONTENT_ROOT = "/http-content";
+
+ private static String host;
+ private static int port = -1;
+ private static final int AUTO_SELECT_JETTY_PORT = 0;
+
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void start(String webappName) throws Exception {
- Dictionary d = new Hashtable();
-
+ Dictionary d = new Hashtable();
+
d.put("http.port", Integer.valueOf(getPortParameter())); //$NON-NLS-1$
- // set the base URL
- d.put("other.info", "org.symbian.wst.debugger"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // suppress Jetty INFO/DEBUG messages to stderr
- Logger.getLogger("org.mortbay").setLevel(Level.WARNING); //$NON-NLS-1$
+ // set the base URL
+ d.put("other.info", "org.symbian.wst.debugger"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // suppress Jetty INFO/DEBUG messages to stderr
+ Logger.getLogger("org.mortbay").setLevel(Level.WARNING); //$NON-NLS-1$
+
+ JettyConfigurator.startServer(webappName, d);
+ checkBundle();
+ Bundle bundle = PreviewerPlugin.getDefault().getBundle();
+ HttpService service = (HttpService) bundle.getBundleContext().getService(getServiceReference());
+ HttpContext httpContext = service.createDefaultHttpContext();
+ service.registerServlet(WORKSPACE_RESOURCES_CONTEXT, new WorkspaceResourcesServlet(), new Hashtable(),
+ httpContext);
+ }
- JettyConfigurator.startServer(webappName, d);
- checkBundle();
- Bundle bundle = PreviewerPlugin.getDefault().getBundle();
- HttpService service = (HttpService) bundle.getBundleContext().getService(getServiceReference());
- HttpContext httpContext = service.createDefaultHttpContext();
- service.registerServlet(WORKSPACE_RESOURCES_CONTEXT, new WorkspaceResourcesServlet(), new Hashtable(), httpContext);
- }
-
- /*
- * Ensures that the bundle with the specified name and the highest available
- * version is started and reads the port number
- */
- private static void checkBundle() throws InvalidSyntaxException, BundleException {
- Bundle bundle = Platform.getBundle("org.eclipse.equinox.http.registry"); //$NON-NLS-1$if (bundle != null) {
- if (bundle.getState() == Bundle.RESOLVED) {
- bundle.start(Bundle.START_TRANSIENT);
- }
- if (port == -1) {
- ServiceReference reference = getServiceReference();
- Object assignedPort = reference.getProperty("http.port"); //$NON-NLS-1$
- port = Integer.parseInt((String)assignedPort);
- }
- }
+ /*
+ * Ensures that the bundle with the specified name and the highest available
+ * version is started and reads the port number
+ */
+ private static void checkBundle() throws InvalidSyntaxException, BundleException {
+ Bundle bundle = Platform.getBundle("org.eclipse.equinox.http.registry"); //$NON-NLS-1$if (bundle != null) {
+ if (bundle.getState() == Bundle.RESOLVED) {
+ bundle.start(Bundle.START_TRANSIENT);
+ }
+ if (port == -1) {
+ ServiceReference reference = getServiceReference();
+ Object assignedPort = reference.getProperty("http.port"); //$NON-NLS-1$
+ port = Integer.parseInt((String) assignedPort);
+ }
+ }
- private static ServiceReference getServiceReference()
- throws InvalidSyntaxException {
- Bundle bundle = PreviewerPlugin.getDefault().getBundle();
- // Jetty selected a port number for us
- ServiceReference[] reference = bundle.getBundleContext().getServiceReferences("org.osgi.service.http.HttpService", "(other.info=org.symbian.wst.debugger)"); //$NON-NLS-1$ //$NON-NLS-2$
- return reference[0];
- }
+ private static ServiceReference getServiceReference() throws InvalidSyntaxException {
+ Bundle bundle = PreviewerPlugin.getDefault().getBundle();
+ // Jetty selected a port number for us
+ ServiceReference[] reference = bundle.getBundleContext().getServiceReferences(
+ "org.osgi.service.http.HttpService", "(other.info=org.symbian.wst.debugger)"); //$NON-NLS-1$ //$NON-NLS-2$
+ return reference[0];
+ }
- public static void stop(String webappName) throws CoreException {
- try {
- JettyConfigurator.stopServer(webappName);
- }
- catch (Exception e) {
- //HelpBasePlugin.logError("An error occured while stopping the help server", e); //$NON-NLS-1$
- }
- }
+ public static void stop(String webappName) throws CoreException {
+ try {
+ JettyConfigurator.stopServer(webappName);
+ } catch (Exception e) {
+ PreviewerPlugin.log(e);
+ }
+ }
- public static int getPort() {
- return port;
- }
+ public static int getPort() {
+ return port;
+ }
- /*
- * Get the port number which will be passed to Jetty
- */
- private static int getPortParameter() {
- if (port == -1) {
- return AUTO_SELECT_JETTY_PORT;
- }
- return port;
- }
+ /*
+ * Get the port number which will be passed to Jetty
+ */
+ private static int getPortParameter() {
+ if (port == -1) {
+ return AUTO_SELECT_JETTY_PORT;
+ }
+ return port;
+ }
- public static String getHost() {
- if (host == null) {
- host = "127.0.0.1";
- }
- return host;
- }
-
- private WebappManager() {
- }
-
+ public static String getHost() {
+ if (host == null) {
+ host = "127.0.0.1";
+ }
+ return host;
+ }
+
+ private WebappManager() {
+ }
+
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/WorkspaceResourcesServlet.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/WorkspaceResourcesServlet.java Thu Sep 02 15:18:58 2010 -0700
@@ -217,10 +217,10 @@
return null;
}
- private transient final Providers providers = new Providers();
+ private final transient Providers providers = new Providers();
private void copyData(InputStream contents, OutputStream ouput) throws IOException {
- byte[] buf = new byte[4048];
+ byte[] buf = new byte[4096];
int i;
while ((i = contents.read(buf)) >= 0) {
ouput.write(buf, 0, i);
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/handlers/Providers.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/http/handlers/Providers.java Thu Sep 02 15:18:58 2010 -0700
@@ -33,18 +33,18 @@
/**
* Path is usually in the form /preview/{project name}/{path}
- *
+ *
* There are following spacial cases:
* - Static previewer resource from plugin is returned when {path} begins with
* "preview" or is "preview-frame.html"
* - Preferences resource is "preview/preferences.js"
* - Index page (main HTML page of the WRT application) is always wrt_preview_main.html
* - Debugger commands are submitted to URL __sym_command
- *
+ *
* All other URLs return workspace resources.
*/
public class Providers {
- private final Map<String, IResourceProvider> HANDLERS = new TreeMap<String, IResourceProvider>();
+ private final Map<String, IResourceProvider> handlers = new TreeMap<String, IResourceProvider>();
private final IResourceProvider defaultHandler = new WorkspaceResourceProvider();
public Providers() {
@@ -57,7 +57,7 @@
private void addPaths(IResourceProvider handler) {
for (String path : handler.getPaths()) {
- HANDLERS.put(path, handler);
+ handlers.put(path, handler);
}
}
@@ -78,7 +78,7 @@
IResourceProvider provider = null;
IPath mapping = resource;
while (mapping.segmentCount() > 0) {
- provider = HANDLERS.get(mapping.toString());
+ provider = handlers.get(mapping.toString());
if (provider != null) {
break;
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preferences/WrtEditingPreferencePage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preferences/WrtEditingPreferencePage.java Thu Sep 02 15:18:58 2010 -0700
@@ -13,10 +13,10 @@
/**
* This class represents a preference page that
- * is contributed to the Preferences dialog. By
+ * is contributed to the Preferences dialog. By
* subclassing <samp>FieldEditorPreferencePage</samp>, we
* can use the field support built into JFace that allows
- * us to create a page that is small and knows how to
+ * us to create a page that is small and knows how to
* save, restore and apply itself.
* <p>
* This page is used to modify preferences only. They
@@ -25,57 +25,40 @@
* be accessed directly via the preference store.
*/
-public class WrtEditingPreferencePage
- extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
+public class WrtEditingPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
- private RadioGroupFieldEditor enableAutorefresh;
+ private RadioGroupFieldEditor enableAutorefresh;
- public WrtEditingPreferencePage() {
- super(GRID);
- setPreferenceStore(PreviewerPlugin.getDefault().getPreferenceStore());
- }
-
- /**
- * Creates the field editors. Field editors are abstractions of
- * the common GUI blocks needed to manipulate various types
- * of preferences. Each field editor knows how to save and
- * restore itself.
- */
- public void createFieldEditors() {
+ public WrtEditingPreferencePage() {
+ super(GRID);
+ setPreferenceStore(PreviewerPlugin.getDefault().getPreferenceStore());
+ }
+
+ /**
+ * Creates the field editors. Field editors are abstractions of
+ * the common GUI blocks needed to manipulate various types
+ * of preferences. Each field editor knows how to save and
+ * restore itself.
+ */
+ public void createFieldEditors() {
Composite projectComposite = new Composite(getFieldEditorParent(), SWT.NONE);
projectComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
projectComposite.setFont(getFieldEditorParent().getFont());
- String[][] namesAndValues = {
- { "Enabled", MessageDialogWithToggle.ALWAYS },
- { "Disabled", MessageDialogWithToggle.NEVER },
- { "Prompt", MessageDialogWithToggle.PROMPT } };
- enableAutorefresh = new RadioGroupFieldEditor(
- IWrtEditingPreferences.PREF_AUTO_REFRESH,
- "Initial auto-refresh setting for Mobile Web Preview window",
- namesAndValues.length, namesAndValues, projectComposite, true);
- enableAutorefresh.setPreferenceStore(getPreferenceStore());
- enableAutorefresh.setPage(this);
- enableAutorefresh.load();
+ String[][] namesAndValues = { { "Enabled", MessageDialogWithToggle.ALWAYS },
+ { "Disabled", MessageDialogWithToggle.NEVER }, { "Prompt", MessageDialogWithToggle.PROMPT } };
+ enableAutorefresh = new RadioGroupFieldEditor(IWrtEditingPreferences.PREF_AUTO_REFRESH,
+ "Initial auto-refresh setting for Mobile Web Preview window", namesAndValues.length, namesAndValues,
+ projectComposite, true);
+ enableAutorefresh.setPreferenceStore(getPreferenceStore());
+ enableAutorefresh.setPage(this);
+ enableAutorefresh.load();
addField(enableAutorefresh);
- }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
-// @Override
-// protected void performDefaults() {
-// enableAutorefresh.loadDefault();
-// super.performDefaults();
-// }
-//
-// @Override
-// public boolean performOk() {
-// enableAutorefresh.store();
-// return super.performOk();
-// }
-}
\ No newline at end of file
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/AbstractPreviewPage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/AbstractPreviewPage.java Thu Sep 02 15:18:58 2010 -0700
@@ -36,8 +36,7 @@
toggleRefresh();
};
};
-
- protected IProject project;
+ private IProject project;
private Browser browser;
private boolean toggleState = true;
private final PreviewView previewView;
@@ -169,7 +168,11 @@
}
private String getToggleActionTooltip() {
- return toggleState ? "Disable preview autorefresh" : "Enable preview autorefresh";
+ if (toggleState) {
+ return "Disable preview autorefresh";
+ } else {
+ return "Enable preview autorefresh";
+ }
}
public void addSelectionChangedListener(ISelectionChangedListener listener) {
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/IPreviewPage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/IPreviewPage.java Thu Sep 02 15:18:58 2010 -0700
@@ -8,8 +8,8 @@
import org.eclipse.ui.part.IPageBookViewPage;
public interface IPreviewPage extends IPageBookViewPage {
- void process(Collection<IFile> files);
- boolean isDisposed();
+ void process(Collection<IFile> files);
+ boolean isDisposed();
void projectRenamed(IPath newPath);
IProject getProject();
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/MozillaPreviewPage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/MozillaPreviewPage.java Thu Sep 02 15:18:58 2010 -0700
@@ -76,12 +76,12 @@
}
} catch (Exception x) {
PreviewerPlugin.log(x);
- // known to throw NullPointException on Mac OS when you're not using
+ // known to throw NullPointException on Mac OS when you're not using
// Mozilla. We don't want to pollute the error log with this
return;
}
try {
- Properties properties = ProjectPreferencesManager.getProjectProperties(project);
+ Properties properties = ProjectPreferencesManager.getProjectProperties(getProject());
for (Iterator<Map.Entry<Object, Object>> i = properties.entrySet().iterator(); i.hasNext();) {
Map.Entry<Object, Object> entry = i.next();
if (entry.getKey() == null || !entry.getKey().toString().startsWith("__SYM_")) {
@@ -90,7 +90,7 @@
}
}
if (needsRefresh) {
- ProjectPreferencesManager.setProjectProperties(project, properties);
+ ProjectPreferencesManager.setProjectProperties(getProject(), properties);
}
} catch (IOException e) {
PreviewerPlugin.log(e);
@@ -164,7 +164,7 @@
}
} catch (Exception x) {
PreviewerPlugin.log(x);
- // known to throw NullPointException on Mac OS when you're not using
+ // known to throw NullPointException on Mac OS when you're not using
// Mozilla. We don't want to pollute the error log with this
return;
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/ProjectPreferencesManager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/ProjectPreferencesManager.java Thu Sep 02 15:18:58 2010 -0700
@@ -32,7 +32,7 @@
import org.eclipse.core.runtime.Path;
import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-public class ProjectPreferencesManager {
+public final class ProjectPreferencesManager {
private static IFile getPreferencesXml(IProject project) {
return project.getFile(new Path(".settings").append(PreviewerPlugin.PLUGIN_ID).addFileExtension("xml"));
}
@@ -71,4 +71,8 @@
}
inputStream.close();
}
+
+ private ProjectPreferencesManager() {
+ // No instantiation
+ }
}
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/SwtBrowserPreviewPage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/SwtBrowserPreviewPage.java Thu Sep 02 15:18:58 2010 -0700
@@ -5,16 +5,14 @@
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Composite;
-public class SwtBrowserPreviewPage extends AbstractPreviewPage implements
- IPreviewPage {
+public class SwtBrowserPreviewPage extends AbstractPreviewPage implements IPreviewPage {
- public SwtBrowserPreviewPage(IProject project, PreviewView previewView) {
- super(project, previewView);
- }
+ public SwtBrowserPreviewPage(IProject project, PreviewView previewView) {
+ super(project, previewView);
+ }
- @Override
- protected Browser createBrowser(Composite parent) {
- return new Browser(parent, SWT.NONE);
- }
-
+ @Override
+ protected Browser createBrowser(Composite parent) {
+ return new Browser(parent, SWT.NONE);
+ }
}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeploymentTargetTypeDescriptor.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeploymentTargetTypeDescriptor.java Thu Sep 02 15:18:58 2010 -0700
@@ -71,7 +71,11 @@
public DeploymentTargetWrapper[] getTargets(ITMWProject project) {
final DeploymentTargetWrapper[] targets = wrap(getProvider().getTargets(project));
- return targets != null ? targets : NO_TARGETS;
+ if (targets != null) {
+ return targets;
+ } else {
+ return NO_TARGETS;
+ }
}
private DeploymentTargetWrapper[] wrap(IDeploymentTarget[] targets) {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeploymentTargetWrapper.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/DeploymentTargetWrapper.java Thu Sep 02 15:18:58 2010 -0700
@@ -122,9 +122,17 @@
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
Object a = target.getAdapter(adapter);
if (IWorkbenchAdapter.class.isAssignableFrom(adapter)) {
- return a == null ? new TargetWorkbenchAdapter(this) : new WorkbenchAdapterWrapper((IWorkbenchAdapter) a);
+ if (a == null) {
+ return new TargetWorkbenchAdapter(this);
+ } else {
+ return new WorkbenchAdapterWrapper((IWorkbenchAdapter) a);
+ }
} else if (IWorkbenchAdapter2.class.isAssignableFrom(adapter)) {
- return a == null ? new TargetWorkbenchAdapter(this) : new WorkbenchAdapter2Wrapper((IWorkbenchAdapter2) a);
+ if (a == null) {
+ return new TargetWorkbenchAdapter(this);
+ } else {
+ return new WorkbenchAdapter2Wrapper((IWorkbenchAdapter2) a);
+ }
} else {
return a;
}
@@ -149,9 +157,7 @@
@Override
public int hashCode() {
final int prime = 31;
- int result = 1;
- result = prime * result + ((target == null) ? 0 : target.hashCode());
- return result;
+ return prime + ((target != null) ? target.hashCode() : 0);
}
public DeploymentTargetTypeDescriptor getType() {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/TargetWorkbenchAdapter.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/deployment/TargetWorkbenchAdapter.java Thu Sep 02 15:18:58 2010 -0700
@@ -26,7 +26,7 @@
public class TargetWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2 {
/**
- *
+ *
*/
private final DeploymentTargetWrapper deploymentTargetWrapper;
@@ -69,4 +69,4 @@
// TODO Auto-generated method stub
return null;
}
-}
\ No newline at end of file
+}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/importwizard/ApplicationImportWizardPage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/importwizard/ApplicationImportWizardPage.java Thu Sep 02 15:18:58 2010 -0700
@@ -153,11 +153,11 @@
/**
* Creates the project name specification controls.
- *
+ *
* @param parent
* the parent composite
*/
- private final void createProjectNameGroup(Composite parent) {
+ private void createProjectNameGroup(Composite parent) {
// project specification group
Composite projectGroup = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
@@ -244,18 +244,11 @@
/**
* Get an error reporter for the receiver.
- *
+ *
* @return IErrorMessageReporter
*/
private IErrorMessageReporter getErrorReporter() {
return new IErrorMessageReporter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea
- * .IErrorMessageReporter#reportError(java.lang.String)
- */
public void reportError(String errorMessage, boolean infoOnly) {
if (infoOnly) {
setMessage(errorMessage, IStatus.INFO);
@@ -277,7 +270,7 @@
* Returns the current project location path as entered by the user, or its
* anticipated initial value. Note that if the default has been returned the
* path in a project description used to create a project should not be set.
- *
+ *
* @return the project location path or its anticipated initial value.
*/
public IPath getLocationPath() {
@@ -287,7 +280,7 @@
/**
* /** Returns the current project location URI as entered by the user, or
* <code>null</code> if a valid project location has not been entered.
- *
+ *
* @return the project location URI, or <code>null</code>
* @since 3.2
*/
@@ -303,7 +296,7 @@
* responsibility of <code>IProject::create</code> invoked by the new
* project resource wizard.
* </p>
- *
+ *
* @return the new project resource handle
*/
public IProject getProjectHandle() {
@@ -313,7 +306,7 @@
/**
* Returns the current project name as entered by the user, or its
* anticipated initial value.
- *
+ *
* @return the project name, its anticipated initial value, or
* <code>null</code> if no project name is known
*/
@@ -328,7 +321,7 @@
/**
* Returns the value of the project name field with leading and trailing
* spaces removed.
- *
+ *
* @return the project name in the field
*/
private String getProjectNameFieldValue() {
@@ -346,12 +339,12 @@
* the name of an existing project will not necessarily cause the wizard to
* warn the user. Callers of this method should first check if the project
* name passed already exists in the workspace.
- *
+ *
* @param name
* initial project name for this page
- *
+ *
* @see IWorkspace#validateName(String, int)
- *
+ *
*/
public void setInitialProjectName(String name) {
if (name == null) {
@@ -382,7 +375,7 @@
/**
* Returns the useDefaults.
- *
+ *
* @return boolean
*/
public boolean useDefaults() {
@@ -393,7 +386,7 @@
/**
* Returns whether this page's controls currently all contain valid values.
- *
+ *
* @return <code>true</code> if all controls are valid, and
* <code>false</code> if at least one is invalid
*/
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/project/CompoundInstaller.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/project/CompoundInstaller.java Thu Sep 02 15:18:58 2010 -0700
@@ -36,10 +36,10 @@
import org.symbian.tools.tmw.ui.project.IProjectTemplateContext;
import org.symbian.tools.tmw.ui.project.ITemplateInstaller;
-public class CompoundInstaller implements ITemplateInstaller {
+public final class CompoundInstaller implements ITemplateInstaller {
private static final class InstallerFiles {
- private final ITemplateInstaller installer;
- private final Collection<IPath> paths;
+ protected final ITemplateInstaller installer;
+ protected final Collection<IPath> paths;
public InstallerFiles(Collection<IPath> paths, ITemplateInstaller installer) {
this.paths = paths;
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/project/ProjectTemplateManagerImpl.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/project/ProjectTemplateManagerImpl.java Thu Sep 02 15:18:58 2010 -0700
@@ -51,7 +51,11 @@
if (o1.getWeight() == o2.getWeight()) {
return o1.getName().compareTo(o2.getName());
} else {
- return o1.getWeight() > o2.getWeight() ? 1 : -1;
+ if (o1.getWeight() > o2.getWeight()) {
+ return 1;
+ } else {
+ return -1;
+ }
}
}
}
@@ -62,7 +66,11 @@
public IProjectTemplate getDefaultTemplate(IMobileWebRuntime runtime) {
final IProjectTemplate[] projectTemplates = getProjectTemplates(runtime);
- return projectTemplates != null && projectTemplates.length > 0 ? projectTemplates[0] : null;
+ if (projectTemplates != null && projectTemplates.length > 0) {
+ return projectTemplates[0];
+ } else {
+ return null;
+ }
}
public ITemplateInstaller getEmptyProjectTemplate(IMobileWebRuntime runtime) {
@@ -80,7 +88,11 @@
templates = readExtensions();
}
final IProjectTemplate[] runtimeTemplates = templates.get(runtime);
- return runtimeTemplates == null ? new IProjectTemplate[0] : runtimeTemplates;
+ if (runtimeTemplates == null) {
+ return new IProjectTemplate[0];
+ } else {
+ return runtimeTemplates;
+ }
}
private Map<IMobileWebRuntime, IProjectTemplate[]> readExtensions() {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/project/ZipInstaller.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/project/ZipInstaller.java Thu Sep 02 15:18:58 2010 -0700
@@ -61,7 +61,7 @@
/**
* Initializes project with zip archive contents
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public class ZipInstaller implements ITemplateInstaller {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/CompoundValidator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/CompoundValidator.java Thu Sep 02 15:18:58 2010 -0700
@@ -22,34 +22,32 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-
public class CompoundValidator implements IValidator {
- private final IValidator[] validators;
+ private final IValidator[] validators;
- public CompoundValidator(IValidator ... validators) {
- this.validators = validators;
- }
-
- public CompoundValidator(NonEmptyStringValidator validator,
- IValidator[] validators) {
- this.validators = new IValidator[validators.length + 1];
- this.validators[0] = validator;
- System.arraycopy(validators, 0, this.validators, 1, validators.length);
- }
+ public CompoundValidator(IValidator... validators) {
+ this.validators = validators;
+ }
+
+ public CompoundValidator(NonEmptyStringValidator validator, IValidator[] validators) {
+ this.validators = new IValidator[validators.length + 1];
+ this.validators[0] = validator;
+ System.arraycopy(validators, 0, this.validators, 1, validators.length);
+ }
- public IStatus validate(Object value) {
- IStatus status = Status.OK_STATUS;
-
- for (IValidator validator : validators) {
- IStatus s = validator.validate(value);
- switch (s.getSeverity()) {
- case IStatus.ERROR:
- return s;
- case IStatus.WARNING:
- status = s;
- }
- }
- return status;
- }
+ public IStatus validate(Object value) {
+ IStatus status = Status.OK_STATUS;
+
+ for (IValidator validator : validators) {
+ IStatus s = validator.validate(value);
+ switch (s.getSeverity()) {
+ case IStatus.ERROR:
+ return s;
+ case IStatus.WARNING:
+ status = s;
+ }
+ }
+ return status;
+ }
}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationDetailsWizardPage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationDetailsWizardPage.java Thu Sep 02 15:18:58 2010 -0700
@@ -157,7 +157,7 @@
* @param parent
* the parent composite
*/
- private final void createProjectNameGroup(Composite parent) {
+ private void createProjectNameGroup(Composite parent) {
// new project label
Label projectLabel = new Label(parent, SWT.NONE);
projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationFacetsWizardPage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationFacetsWizardPage.java Thu Sep 02 15:18:58 2010 -0700
@@ -24,7 +24,7 @@
@SuppressWarnings("restriction")
public final class NewApplicationFacetsWizardPage extends WizardPage {
- public FacetsSelectionPanel panel;
+ private FacetsSelectionPanel panel;
private final IFacetedProjectWorkingCopy fpjwc;
public NewApplicationFacetsWizardPage(final Set<IProjectFacetVersion> base, final IFacetedProjectWorkingCopy fpjwc) {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NonEmptyStringValidator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NonEmptyStringValidator.java Thu Sep 02 15:18:58 2010 -0700
@@ -39,4 +39,4 @@
}
return Status.OK_STATUS;
}
-}
\ No newline at end of file
+}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/util/Util.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/util/Util.java Thu Sep 02 15:18:58 2010 -0700
@@ -18,8 +18,19 @@
*/
package org.symbian.tools.tmw.internal.util;
-public class Util {
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.ITMWProject;
+public final class Util {
public static String removeSpaces(String value) {
return value != null ? value.trim().replace(" ", "") : "";
}
@@ -28,4 +39,28 @@
return string == null ? "" : string.trim();
}
+ private Util() {
+ // No instantiation
+ }
+
+ public static ITMWProject getProjectFromCommandContext(ExecutionEvent event) {
+ IResource resource = null;
+ IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
+ if (activePart instanceof IEditorPart) {
+ resource = (IResource) ((IEditorPart) activePart).getEditorInput().getAdapter(IResource.class);
+ } else {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Object[] array = ((IStructuredSelection) selection).toArray();
+ if (array.length == 1 && array[0] instanceof IAdaptable) {
+ resource = (IResource) ((IAdaptable) array[0]).getAdapter(IResource.class);
+ }
+ }
+ }
+ if (resource != null) {
+ IProject project = resource.getProject();
+ return TMWCore.create(project);
+ }
+ return null;
+ }
}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/ConsoleFactory.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/ConsoleFactory.java Thu Sep 02 15:18:58 2010 -0700
@@ -15,7 +15,7 @@
* Platforms/Drives/Compatibility:
* Assumptions/Requirement/Pre-requisites:
* Failures and causes:
- */
+ */
package org.symbian.tools.tmw.ui;
import org.eclipse.ui.console.ConsolePlugin;
@@ -26,31 +26,30 @@
import org.eclipse.ui.console.MessageConsoleStream;
public class ConsoleFactory implements IConsoleFactory {
-
- private static MessageConsole console;
+
+ private static MessageConsole console;
+
+ public void openConsole() {
+ getConsole();
+ console.activate();
+ }
+
+ public static MessageConsoleStream createStream() {
+ getConsole();
+ return console.newMessageStream();
+ }
- public void openConsole() {
- getConsole();
- console.activate();
- }
-
- public static MessageConsoleStream createStream() {
- getConsole();
- return console.newMessageStream();
- }
-
- public static void activateConsole() {
- getConsole();
- console.activate();
- }
-
- private synchronized static MessageConsole getConsole() {
- if (console == null) {
- console = new MessageConsole("Mobile Web Console", null, true);
- IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
- consoleManager.addConsoles(new IConsole[]{console});
- }
- return console;
- }
+ public static void activateConsole() {
+ getConsole();
+ console.activate();
+ }
+ private static synchronized MessageConsole getConsole() {
+ if (console == null) {
+ console = new MessageConsole("Mobile Web Console", null, true);
+ IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+ consoleManager.addConsoles(new IConsole[] { console });
+ }
+ return console;
+ }
}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/TMWCoreUI.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/TMWCoreUI.java Thu Sep 02 15:18:58 2010 -0700
@@ -84,7 +84,7 @@
private Images images;
private IApplicationImporter[] importers;
- private final Map<IProject, ProjectMemo> MEMOS = new WeakHashMap<IProject, ProjectMemo>();
+ private final Map<IProject, ProjectMemo> memos = new WeakHashMap<IProject, ProjectMemo>();
private final DeploymentTargetPresentationsManager presentations = new DeploymentTargetPresentationsManager();
private IProjectTemplateManager projectTemplateManager;
private final DeploymentTargetTypesRegistry typesRegistry = new DeploymentTargetTypesRegistry();
@@ -94,10 +94,10 @@
}
private synchronized ProjectMemo getMemoForProject(ITMWProject project) {
- ProjectMemo memo = MEMOS.get(project.getProject());
+ ProjectMemo memo = memos.get(project.getProject());
if (memo == null) {
memo = new ProjectMemo(project);
- MEMOS.put(project.getProject(), memo);
+ memos.put(project.getProject(), memo);
}
return memo;
}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/UIUtils.java Thu Sep 02 10:50:38 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/**
- * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-package org.symbian.tools.tmw.ui;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.symbian.tools.tmw.core.TMWCore;
-import org.symbian.tools.tmw.core.projects.ITMWProject;
-
-public class UIUtils {
- public static ITMWProject getProjectFromCommandContext(ExecutionEvent event) {
- IResource resource = null;
- IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
- if (activePart instanceof IEditorPart) {
- resource = (IResource) ((IEditorPart) activePart).getEditorInput().getAdapter(IResource.class);
- } else {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- Object[] array = ((IStructuredSelection) selection).toArray();
- if (array.length == 1 && array[0] instanceof IAdaptable) {
- resource = (IResource) ((IAdaptable) array[0]).getAdapter(IResource.class);
- }
- }
- }
- if (resource != null) {
- IProject project = resource.getProject();
- return TMWCore.create(project);
- }
- return null;
- }
-}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/commands/DeployHandler.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/commands/DeployHandler.java Thu Sep 02 15:18:58 2010 -0700
@@ -34,7 +34,7 @@
import org.eclipse.ui.handlers.HandlerUtil;
import org.symbian.tools.tmw.core.TMWCore;
import org.symbian.tools.tmw.core.projects.ITMWProject;
-import org.symbian.tools.tmw.ui.UIUtils;
+import org.symbian.tools.tmw.internal.util.Util;
import org.symbian.tools.tmw.ui.deployment.DeployWizard;
/**
@@ -56,7 +56,7 @@
public Object execute(ExecutionEvent event) throws ExecutionException {
final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- final ITMWProject project = UIUtils.getProjectFromCommandContext(event);
+ final ITMWProject project = Util.getProjectFromCommandContext(event);
if (project != null) {
window.getActivePage().saveAllEditors(true);
if (validate(project, window)) {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTarget.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTarget.java Thu Sep 02 15:18:58 2010 -0700
@@ -29,30 +29,30 @@
/**
* <p>This is particular deployment target instance. It can be a Bluetooth phone
* connection, installed device emulator, FTP server, etc.</p>
- *
+ *
* <p>This class methods can be called from non-SWT thread.</p>
- *
- * <p>Following adapters can be provided by either overriding getAdapter method
+ *
+ * <p>Following adapters can be provided by either overriding getAdapter method
* or by contributing to org.eclipse.core.runtime.adapters extension point:</p>
* <ul><li>{@link org.eclipse.ui.IPersistable} - to persist advanced per-
* project target configuration</li><li>
- * {@link org.eclipse.ui.model.IWorkbenchAdapter} or
- * {@link org.eclipse.ui.model.IWorkbenchAdapter2} to customize target
+ * {@link org.eclipse.ui.model.IWorkbenchAdapter} or
+ * {@link org.eclipse.ui.model.IWorkbenchAdapter2} to customize target
* presentation in IDE user interface.</li></ul>
- *
- * <p>Overwriting <code>equals</code> and <code>hashCode</code> might be desirable
+ *
+ * <p>Overwriting <code>equals</code> and <code>hashCode</code> might be desirable
* if new objects are created each time user does discovery process.</p>
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IDeploymentTarget extends IAdaptable {
/**
- * Returns unique ID. There is no restriction on ID string format. Cannot
+ * Returns unique ID. There is no restriction on ID string format. Cannot
* be <code>null</code>
*/
String getId();
/**
- * <p>Returns user-readable name. Can be null if
+ * <p>Returns user-readable name. Can be null if
* {@link org.eclipse.ui.model.IWorkbenchAdapter} is provided.<p>
* <p>Name is not used for purposes other then presentation and may change
* between invocations</p>
@@ -60,14 +60,14 @@
String getName();
/**
- * Provides more details about target. This information is only displayed
+ * Provides more details about target. This information is only displayed
* to the user and is not important for the application.
*/
String getDescription();
/**
* Deploy application to this target.
- *
+ *
* @param project project to deploy to the target
* @param runtime runtime that will be used to run packaged application
* @param monitor progress monitor to report deployment progress
@@ -75,7 +75,7 @@
IStatus deploy(ITMWProject project, IPackager packager, IProgressMonitor monitor) throws CoreException;
/**
- * Save project-specific settings to the memento. Workspace-wide settings
+ * Save project-specific settings to the memento. Workspace-wide settings
* should be managed separately.
*/
void save(IMemento memento);
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTargetType.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/IDeploymentTargetType.java Thu Sep 02 15:18:58 2010 -0700
@@ -25,12 +25,12 @@
/**
* This interface is for deployment targets providers.
- *
+ *
* @author Eugene
*/
public interface IDeploymentTargetType {
/**
- * Returns list of the targets that accept provided project. Project
+ * Returns list of the targets that accept provided project. Project
* cannot be <code>null</code>.
* @return List of the valid deployment targets. Both <code>null</code> and
* empty array are a valid return value when there are no available targets.
@@ -44,21 +44,21 @@
void discoverTargets(IProgressMonitor monitor) throws CoreException;
/**
- * Find target based on project and target ID. This method returns
+ * Find target based on project and target ID. This method returns
* <code>null</code> if target with given ID cannot be found or if
* the target does not accept project any longer.
*/
IDeploymentTarget findTarget(ITMWProject project, String id);
/**
- * Return <code>false</code> if user needs to trigger long-running
+ * Return <code>false</code> if user needs to trigger long-running
* discovery to see all potential deployment targets.
*/
boolean targetsDiscovered();
/**
* @param target that will be used by a {@link org.eclipse.core.runtime.jobs.Job}
- * @return scheduling rule that will be used to properly schedule jobs to
+ * @return scheduling rule that will be used to properly schedule jobs to
* avoid resource access conflicts. Can be <code>null</code>
*/
ISchedulingRule getSchedulingRule(IDeploymentTarget target);
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/ITargetDetailsPane.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/ITargetDetailsPane.java Thu Sep 02 15:18:58 2010 -0700
@@ -24,11 +24,11 @@
/**
* Objects of this class provide UI for the users to visualize or configure
- * their deployment targets. This object will not be reused between wizard
+ * their deployment targets. This object will not be reused between wizard
* deployment wizard restarts.
- * There will be one instance for the target type. This object will not be
+ * There will be one instance for the target type. This object will not be
* instantiated for each target.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface ITargetDetailsPane {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothRule.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothRule.java Thu Sep 02 15:18:58 2010 -0700
@@ -2,7 +2,7 @@
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-public class BluetoothRule implements ISchedulingRule {
+public final class BluetoothRule implements ISchedulingRule {
public static final ISchedulingRule INSTANCE = new BluetoothRule();
private BluetoothRule() {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTarget.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTarget.java Thu Sep 02 15:18:58 2010 -0700
@@ -61,7 +61,7 @@
public static final long BLUETOOTH_TIMEOUT = 5 * 60 * 1000; // 5 min
private String serviceURL;
private RemoteDevice device;
- protected String[] exceptionCodes = new String[] { "OBEX_HTTP_UNSUPPORTED_TYPE", "OBEX_HTTP_FORBIDDEN" };
+ private final String[] exceptionCodes = new String[] { "OBEX_HTTP_UNSUPPORTED_TYPE", "OBEX_HTTP_FORBIDDEN" };
private String message = "Deployment was successful. Please follow on-screen instructions to complete application deployment on your device.";
private final String name;
private final BluetoothTargetType provider;
@@ -154,7 +154,7 @@
hsOperation.setHeader(HeaderSet.NAME, inputWidget.getName());
hsOperation.setHeader(HeaderSet.TYPE, fileType);
int size = (int) inputWidget.length();
- byte file[] = new byte[size];
+ byte[] file = new byte[size];
hsOperation.setHeader(HeaderSet.LENGTH, Long.valueOf(file.length));
// Create PUT Operation
@@ -209,7 +209,7 @@
clientSession.close();
}
} catch (EOFException eof) {
- // EOFException is now caught
+ // EOFException is now caught
// Ignore the error since deployment has already completed
//Activator.log(IStatus.ERROR, "EOF encountered while cleaning up Bluetooth deployment", eof);
} catch (IOException x) {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTargetType.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/deployment/bluetooth/BluetoothTargetType.java Thu Sep 02 15:18:58 2010 -0700
@@ -44,18 +44,18 @@
import com.intel.bluetooth.BlueCoveImpl;
/**
- * Discovers Bluetooth-enabled devices. This code is generic and will not
- * perform any checks if the discovered device can run application being
+ * Discovers Bluetooth-enabled devices. This code is generic and will not
+ * perform any checks if the discovered device can run application being
* deployed.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public class BluetoothTargetType implements IDeploymentTargetType {
private final class TargetDiscoveryListener implements DiscoveryListener {
- final Object inquiryCompletedEvent;
- boolean isCanceled;
- final Map<String, BluetoothTarget> prevTargets;
- final IProgressMonitor progressMonitor;
+ private final Object inquiryCompletedEvent;
+ private boolean isCanceled;
+ private final Map<String, BluetoothTarget> prevTargets;
+ private final IProgressMonitor progressMonitor;
private TargetDiscoveryListener(Map<String, BluetoothTarget> previousTargets, Object inquiryCompletedEvent,
IProgressMonitor progressMonitor) {
@@ -175,7 +175,7 @@
/**
* Check whether the bluetooth is on or not.
- *
+ *
* @return whether the device is on.
*/
public boolean isBloothToothConnected() {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/navigator/RenameMoveActionProvider.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/navigator/RenameMoveActionProvider.java Thu Sep 02 15:18:58 2010 -0700
@@ -42,60 +42,62 @@
import org.eclipse.wst.jsdt.ui.actions.SelectionDispatchAction;
public class RenameMoveActionProvider extends CommonActionProvider {
- private SelectionDispatchAction fMoveAction;
- private SelectionDispatchAction fRenameAction;
-
- private final Collection<IAction> fActions = new HashSet<IAction>();
+ private SelectionDispatchAction fMoveAction;
+ private SelectionDispatchAction fRenameAction;
+
+ private final Collection<IAction> fActions = new HashSet<IAction>();
- public void fillActionBars(IActionBars actionBars) {
- if (fActions.size() > 0) {
- actionBars.setGlobalActionHandler(JdtActionConstants.RENAME, fRenameAction);
- actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), fRenameAction);
+ public void fillActionBars(IActionBars actionBars) {
+ if (fActions.size() > 0) {
+ actionBars.setGlobalActionHandler(JdtActionConstants.RENAME, fRenameAction);
+ actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), fRenameAction);
- actionBars.setGlobalActionHandler(JdtActionConstants.MOVE, fMoveAction);
- actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), fMoveAction);
- }
- }
+ actionBars.setGlobalActionHandler(JdtActionConstants.MOVE, fMoveAction);
+ actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), fMoveAction);
+ }
+ }
- public void fillContextMenu(IMenuManager menu) {
- menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, new Separator());
- for (IAction action : fActions) {
- menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, action);
- }
- }
+ public void fillContextMenu(IMenuManager menu) {
+ menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, new Separator());
+ for (IAction action : fActions) {
+ menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, action);
+ }
+ }
- public void init(ICommonActionExtensionSite site) {
- ICommonViewerWorkbenchSite workbenchSite= null;
- if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
- workbenchSite= (ICommonViewerWorkbenchSite) site.getViewSite();
+ public void init(ICommonActionExtensionSite site) {
+ ICommonViewerWorkbenchSite workbenchSite = null;
+ if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
+ workbenchSite = (ICommonViewerWorkbenchSite) site.getViewSite();
}
- // we only initialize the refactor group when in a view part
- // (required for the constructor)
- if (workbenchSite != null) {
- if (workbenchSite.getPart() != null && workbenchSite.getPart() instanceof IViewPart) {
- IViewPart viewPart= (IViewPart) workbenchSite.getPart();
- IWorkbenchPartSite s = viewPart.getSite();
+ // we only initialize the refactor group when in a view part
+ // (required for the constructor)
+ if (workbenchSite != null) {
+ if (workbenchSite.getPart() != null && workbenchSite.getPart() instanceof IViewPart) {
+ IViewPart viewPart = (IViewPart) workbenchSite.getPart();
+ IWorkbenchPartSite s = viewPart.getSite();
- fRenameAction= new RenameAction(s);
- initUpdatingAction(fRenameAction, workbenchSite.getSelectionProvider(), workbenchSite.getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
- fMoveAction= new MoveAction(s);
- initUpdatingAction(fMoveAction, workbenchSite.getSelectionProvider(), workbenchSite.getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
- }
- }
- }
+ fRenameAction = new RenameAction(s);
+ initUpdatingAction(fRenameAction, workbenchSite.getSelectionProvider(), workbenchSite
+ .getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
+ fMoveAction = new MoveAction(s);
+ initUpdatingAction(fMoveAction, workbenchSite.getSelectionProvider(), workbenchSite
+ .getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
+ }
+ }
+ }
- private void initUpdatingAction(SelectionDispatchAction action, ISelectionProvider provider, ISelection selection, String actionDefinitionId){
- action.setActionDefinitionId(actionDefinitionId);
- action.update(selection);
- if (provider != null) {
+ private void initUpdatingAction(SelectionDispatchAction action, ISelectionProvider provider, ISelection selection,
+ String actionDefinitionId) {
+ action.setActionDefinitionId(actionDefinitionId);
+ action.update(selection);
+ if (provider != null) {
provider.addSelectionChangedListener(action);
}
- fActions.add(action);
- }
+ fActions.add(action);
+ }
-
- public void setContext(ActionContext context) {
- // Do nothing
- }
+ public void setContext(ActionContext context) {
+ // Do nothing
+ }
}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/AbstractNewApplicationWizardPage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/AbstractNewApplicationWizardPage.java Thu Sep 02 15:18:58 2010 -0700
@@ -38,7 +38,7 @@
/**
* Boilerplate code to make it easier creating such wizard pages.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public abstract class AbstractNewApplicationWizardPage extends WizardPage implements INewApplicationWizardPage {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/AbstractZippedApplicationImporter.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/AbstractZippedApplicationImporter.java Thu Sep 02 15:18:58 2010 -0700
@@ -46,7 +46,7 @@
* This is base class for importers that work with zip-based application
* packages. W3C specification mandates using Zip as archive format and
* it looks like all mobile web runtime use Zip as their format.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public abstract class AbstractZippedApplicationImporter implements IApplicationImporter {
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/IApplicationImporter.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/IApplicationImporter.java Thu Sep 02 15:18:58 2010 -0700
@@ -31,22 +31,22 @@
/**
* Classes implementing this interface help create projects from application
* archives.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IApplicationImporter {
/**
- * Importer can support only one runtime (i.e. several extensions need to
- * be contributed for several runtimes).
- *
- * @param file application package
+ * Importer can support only one runtime (i.e. several extensions need to
+ * be contributed for several runtimes).
+ *
+ * @param file application package
* @return runtime that created project should target. <code>null</code> if
* this importer can't import the file.
*/
IMobileWebRuntime getApplicationRuntime(File file);
/**
- * @return filters that users can use to navigate filesystem. They are
+ * @return filters that users can use to navigate filesystem. They are
* returned as "file extension-description" pairs
* @see org.eclipse.swt.widgets.FileDialog#setFilterExtensions(String[])
* @see org.eclipse.swt.widgets.FileDialog#setFilterNames(String[])
@@ -62,7 +62,7 @@
/**
* Extracts files from application archive to workspace project
- *
+ *
* @param file mobile web application archive
* @param runtime mobile web runtime
* @param project workspace project
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/IProjectTemplate.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/IProjectTemplate.java Thu Sep 02 15:18:58 2010 -0700
@@ -29,12 +29,12 @@
/**
* This interface will allow extending new mobile web application wizard
* with "smart" templates that have complex logic.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IProjectTemplate {
/**
- * Attributes that are common for different templates for different
+ * Attributes that are common for different templates for different
* runtimes. They are included here to improve compatibility and reuse.
*/
public interface CommonKeys {
@@ -47,9 +47,9 @@
}
/**
- * @return template "weight" that determines how high the template will
+ * @return template "weight" that determines how high the template will
* be in a templates list. This is purely for visualization as IDE vendors
- * might want more basic templates higher in the list to improve the
+ * might want more basic templates higher in the list to improve the
* learning curve.
*/
int getWeight();
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/IProjectTemplateContext.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/IProjectTemplateContext.java Thu Sep 02 15:18:58 2010 -0700
@@ -24,7 +24,7 @@
/**
* Provides template values.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public interface IProjectTemplateContext extends IProjectSetupConfig {
@@ -35,7 +35,7 @@
/**
* @param parameter name of the parameter
- * @return parameter value. In most cases parameters will be string values
+ * @return parameter value. In most cases parameters will be string values
* but template developers can use any types
*/
Object getParameter(String parameter);
@@ -49,7 +49,7 @@
/**
* Allows binding to parameter value from UI.
- *
+ *
* @param name parameter value
* @return observable that may be used to bind value
*/
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/IProjectTemplateManager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/IProjectTemplateManager.java Thu Sep 02 15:18:58 2010 -0700
@@ -25,7 +25,7 @@
public interface IProjectTemplateManager {
/**
* Returns project templates that support mobile web runtime.
- *
+ *
* @return sorted array of the templates. Templates are sorted based on weight and name.
*/
IProjectTemplate[] getProjectTemplates(IMobileWebRuntime runtime);
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/ITemplateInstaller.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/ITemplateInstaller.java Thu Sep 02 15:18:58 2010 -0700
@@ -41,7 +41,7 @@
IPath[] getFiles() throws CoreException;
/**
- * Installer should only copy files specified. Keep in mind that some
+ * Installer should only copy files specified. Keep in mind that some
* files may be overridden by other installers.
*/
void copyFiles(IPath[] files, IProgressMonitor monitor) throws CoreException;
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/NewApplicationWizard.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/NewApplicationWizard.java Thu Sep 02 15:18:58 2010 -0700
@@ -52,7 +52,7 @@
/**
* This is the wizard that guides through new mobile application project creation.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public final class NewApplicationWizard extends ModifyFacetedProjectWizard implements INewWizard {
@@ -84,10 +84,7 @@
addPage(facetsPage);
final IWizardPage templatesPage = new NewApplicationTemplateWizardPage(wizardContext, databindingContext);
addPage(templatesPage);
- staticPages = new IWizardPage[3];
- staticPages[0] = firstPage;
- staticPages[1] = templatesPage;
- staticPages[2] = facetsPage;
+ staticPages = new IWizardPage[] { firstPage, templatesPage, facetsPage };
super.addPages();
}
@@ -186,9 +183,9 @@
}
final IWizardPage[] base = super.getPages();
final IWizardPage[] pages = new IWizardPage[staticPages.length + templatePages.length];
- System.arraycopy(staticPages, 0, pages, 0, 3);
+ System.arraycopy(staticPages, 0, pages, 0, staticPages.length);
if (templatePages.length > 0) {
- System.arraycopy(templatePages, 0, pages, 3, templatePages.length);
+ System.arraycopy(templatePages, 0, pages, staticPages.length, templatePages.length);
}
System.arraycopy(base, 0, pages, 2, base.length);
--- a/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/Activator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/Activator.java Thu Sep 02 15:18:58 2010 -0700
@@ -7,44 +7,43 @@
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.symbian.tools.wrttools.product";
- // The plug-in ID
- public static final String PLUGIN_ID = "org.symbian.tools.wrttools.product";
+ // The shared instance
+ private static Activator plugin;
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
}
--- a/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/ApplicationActionBarAdvisor.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/ApplicationActionBarAdvisor.java Thu Sep 02 15:18:58 2010 -0700
@@ -11,25 +11,24 @@
import org.eclipse.ui.application.IActionBarConfigurer;
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
-
+
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
- super(configurer);
- // TODO Auto-generated constructor stub
- }
- private IWorkbenchAction aboutAction;
+ super(configurer);
+ }
+
+ private IWorkbenchAction aboutAction;
+
protected void makeActions(final IWorkbenchWindow window) {
-
- aboutAction = ActionFactory.ABOUT.create(window);
- register(aboutAction);
-
+ aboutAction = ActionFactory.ABOUT.create(window);
+ register(aboutAction);
}
+
protected void fillMenuBar(IMenuManager menuBar) {
- //Help
- MenuManager helpMenu = new MenuManager("&Help",IWorkbenchActionConstants.M_HELP);
- menuBar.add(helpMenu);
- // About > Help
- helpMenu.add(new Separator());
- helpMenu.add(aboutAction);
-
+ //Help
+ MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);
+ menuBar.add(helpMenu);
+ // About > Help
+ helpMenu.add(new Separator());
+ helpMenu.add(aboutAction);
}
-}
\ No newline at end of file
+}
--- a/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewCSSFileAction.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewCSSFileAction.java Thu Sep 02 15:18:58 2010 -0700
@@ -10,31 +10,30 @@
import org.eclipse.wst.jsdt.ui.actions.AbstractOpenWizardAction;
@SuppressWarnings("restriction")
-public class NewCSSFileAction extends AbstractOpenWizardAction implements
- IWorkbenchWindowActionDelegate {
+public class NewCSSFileAction extends AbstractOpenWizardAction implements IWorkbenchWindowActionDelegate {
- @Override
- protected INewWizard createWizard() throws CoreException {
- return new NewCSSWizard();
- }
+ @Override
+ protected INewWizard createWizard() throws CoreException {
+ return new NewCSSWizard();
+ }
- public void dispose() {
- // TODO Auto-generated method stub
+ public void dispose() {
+ // TODO Auto-generated method stub
- }
+ }
- public void init(IWorkbenchWindow window) {
- // TODO Auto-generated method stub
+ public void init(IWorkbenchWindow window) {
+ // TODO Auto-generated method stub
- }
+ }
- public void run(IAction action) {
- run();
- }
+ public void run(IAction action) {
+ run();
+ }
- public void selectionChanged(IAction action, ISelection selection) {
- // TODO Auto-generated method stub
+ public void selectionChanged(IAction action, ISelection selection) {
+ // TODO Auto-generated method stub
- }
+ }
}
--- a/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewHTMLFileAction.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewHTMLFileAction.java Thu Sep 02 15:18:58 2010 -0700
@@ -10,31 +10,30 @@
import org.eclipse.wst.jsdt.ui.actions.AbstractOpenWizardAction;
@SuppressWarnings("restriction")
-public class NewHTMLFileAction extends AbstractOpenWizardAction implements
- IWorkbenchWindowActionDelegate {
+public class NewHTMLFileAction extends AbstractOpenWizardAction implements IWorkbenchWindowActionDelegate {
- @Override
- protected INewWizard createWizard() throws CoreException {
- return new NewHTMLWizard();
- }
+ @Override
+ protected INewWizard createWizard() throws CoreException {
+ return new NewHTMLWizard();
+ }
- public void dispose() {
- // TODO Auto-generated method stub
+ public void dispose() {
+ // TODO Auto-generated method stub
- }
+ }
- public void init(IWorkbenchWindow window) {
- // TODO Auto-generated method stub
+ public void init(IWorkbenchWindow window) {
+ // TODO Auto-generated method stub
- }
+ }
- public void run(IAction action) {
- run();
- }
+ public void run(IAction action) {
+ run();
+ }
- public void selectionChanged(IAction action, ISelection selection) {
- // TODO Auto-generated method stub
+ public void selectionChanged(IAction action, ISelection selection) {
+ // TODO Auto-generated method stub
- }
+ }
}
--- a/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewJSFileAction.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewJSFileAction.java Thu Sep 02 15:18:58 2010 -0700
@@ -10,31 +10,30 @@
import org.eclipse.wst.jsdt.ui.actions.AbstractOpenWizardAction;
@SuppressWarnings("restriction")
-public class NewJSFileAction extends AbstractOpenWizardAction implements
- IWorkbenchWindowActionDelegate {
+public class NewJSFileAction extends AbstractOpenWizardAction implements IWorkbenchWindowActionDelegate {
- @Override
- protected INewWizard createWizard() throws CoreException {
- return new NewJSWizard();
- }
+ @Override
+ protected INewWizard createWizard() throws CoreException {
+ return new NewJSWizard();
+ }
- public void dispose() {
- // TODO Auto-generated method stub
+ public void dispose() {
+ // TODO Auto-generated method stub
- }
+ }
- public void init(IWorkbenchWindow window) {
- // TODO Auto-generated method stub
+ public void init(IWorkbenchWindow window) {
+ // TODO Auto-generated method stub
- }
+ }
- public void run(IAction action) {
- run();
- }
+ public void run(IAction action) {
+ run();
+ }
- public void selectionChanged(IAction action, ISelection selection) {
- // TODO Auto-generated method stub
+ public void selectionChanged(IAction action, ISelection selection) {
+ // TODO Auto-generated method stub
- }
+ }
}
--- a/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewWRTProjectAction.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewWRTProjectAction.java Thu Sep 02 15:18:58 2010 -0700
@@ -10,35 +10,27 @@
import org.eclipse.wst.jsdt.ui.actions.AbstractOpenWizardAction;
import org.symbian.tools.tmw.ui.project.NewApplicationWizard;
-public class NewWRTProjectAction extends AbstractOpenWizardAction implements
- IWorkbenchWindowActionDelegate {
-
- public void init(IWorkbenchWindow window) {
- // TODO Auto-generated method stub
+public class NewWRTProjectAction extends AbstractOpenWizardAction implements IWorkbenchWindowActionDelegate {
+ public void init(IWorkbenchWindow window) {
+ }
- }
+ public void run(IAction action) {
+ run();
+ }
- public void run(IAction action) {
- run();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // TODO Auto-generated method stub
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
- }
-
- @Override
- protected INewWizard createWizard() throws CoreException {
+ @Override
+ protected INewWizard createWizard() throws CoreException {
return new NewApplicationWizard();
- }
+ }
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
+ public void dispose() {
+ }
- @Override
- protected boolean doCreateProjectFirstOnEmptyWorkspace(Shell shell) {
- return true;
- }
+ @Override
+ protected boolean doCreateProjectFirstOnEmptyWorkspace(Shell shell) {
+ return true;
+ }
}
--- a/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java Thu Sep 02 15:18:58 2010 -0700
@@ -13,61 +13,61 @@
public class WRTPerspective implements IPerspectiveFactory {
- public void createInitialLayout(IPageLayout layout) {
- String editorArea = layout.getEditorArea();
-
- IFolderLayout folder= layout.createFolder("left", IPageLayout.LEFT, (float)0.15, editorArea); //$NON-NLS-1$
+ public void createInitialLayout(IPageLayout layout) {
+ String editorArea = layout.getEditorArea();
+
+ IFolderLayout folder = layout.createFolder("left", IPageLayout.LEFT, (float) 0.15, editorArea); //$NON-NLS-1$
folder.addView(IPageLayout.ID_PROJECT_EXPLORER);
IFolderLayout snippetsFolder = layout.createFolder("snippets", IPageLayout.BOTTOM, (float) 0.5, "left"); //$NON-NLS-1$
snippetsFolder.addView("org.eclipse.wst.common.snippets.internal.ui.SnippetsView");
-
- IFolderLayout outputfolder= layout.createFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$
- outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
- outputfolder.addView(JavaScriptUI.ID_JAVADOC_VIEW);
- outputfolder.addView(JavaScriptUI.ID_SOURCE_VIEW);
- outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
- outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
- outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
- outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
-
- IFolderLayout helpersFolder = layout.createFolder("right", IPageLayout.RIGHT, (float) 0.60, editorArea);
- helpersFolder.addView(PreviewerPlugin.PREVIEW_VIEW);
- helpersFolder.addView(IPageLayout.ID_OUTLINE);
-
- layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
- layout.addActionSet(JavaScriptUI.ID_ACTION_SET);
- layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
- layout.addActionSet("org.symbian.tools.wrttools.product.creationActionSet");
-
- // views - java
- layout.addShowViewShortcut(JavaScriptUI.ID_TYPE_HIERARCHY);
+
+ IFolderLayout outputfolder = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
+ outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
+ outputfolder.addView(JavaScriptUI.ID_JAVADOC_VIEW);
+ outputfolder.addView(JavaScriptUI.ID_SOURCE_VIEW);
+ outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
+ outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
+ outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
+ outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
+
+ IFolderLayout helpersFolder = layout.createFolder("right", IPageLayout.RIGHT, (float) 0.60, editorArea);
+ helpersFolder.addView(PreviewerPlugin.PREVIEW_VIEW);
+ helpersFolder.addView(IPageLayout.ID_OUTLINE);
+
+ layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
+ layout.addActionSet(JavaScriptUI.ID_ACTION_SET);
+ layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
+ layout.addActionSet("org.symbian.tools.wrttools.product.creationActionSet");
+
+ // views - java
+ layout.addShowViewShortcut(JavaScriptUI.ID_TYPE_HIERARCHY);
layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
- layout.addShowViewShortcut(JavaScriptUI.ID_SOURCE_VIEW);
- layout.addShowViewShortcut(JavaScriptUI.ID_JAVADOC_VIEW);
+ layout.addShowViewShortcut(JavaScriptUI.ID_SOURCE_VIEW);
+ layout.addShowViewShortcut(JavaScriptUI.ID_JAVADOC_VIEW);
- layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
-
- // views - search
- layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
+ layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
+
+ // views - search
+ layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
- // views - standard workbench
- layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
- layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
- layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
- layout.addShowViewShortcut(PreviewerPlugin.PREVIEW_VIEW);
+ // views - standard workbench
+ layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+ layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+ layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
+ layout.addShowViewShortcut(PreviewerPlugin.PREVIEW_VIEW);
layout.addShowViewShortcut("org.eclipse.wst.common.snippets.internal.ui.SnippetsView");
-
- // new actions - Java project creation wizard
+
+ // new actions - Java project creation wizard
layout.addNewWizardShortcut(NewApplicationWizard.ID);
- layout.addNewWizardShortcut("org.eclipse.wst.jsdt.ui.NewJSWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.wst.html.ui.internal.wizard.NewHTMLWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.wst.css.ui.internal.wizard.NewCSSWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.wst.xml.ui.internal.wizards.NewXMLWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.wst.jsdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
- }
+ layout.addNewWizardShortcut("org.eclipse.wst.jsdt.ui.NewJSWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.wst.html.ui.internal.wizard.NewHTMLWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.wst.css.ui.internal.wizard.NewCSSWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.wst.xml.ui.internal.wizards.NewXMLWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.wst.jsdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard"); //$NON-NLS-1$
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java Thu Sep 02 15:18:58 2010 -0700
@@ -37,63 +37,59 @@
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.symbian.tools.wrttools";
- // The plug-in ID
- public static final String PLUGIN_ID = "org.symbian.tools.wrttools";
+ // The shared instance
+ private static Activator plugin;
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
JsIndexManager.getInstance();
- }
+ }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
WRTImages.init(reg);
}
-
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- public static void log(Exception e) {
- log(e.getLocalizedMessage(), e);
- }
+ public static void log(Exception e) {
+ log(e.getLocalizedMessage(), e);
+ }
- public static void log(String message, Exception e) {
- getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, e));
- }
-
+ public static void log(String message, Exception e) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, e));
+ }
+
public static IProject[] getWrtProjects() {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
Collection<IProject> prjs = new TreeSet<IProject>(new Comparator<IProject>() {
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WidgetProjectNature.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WidgetProjectNature.java Thu Sep 02 15:18:58 2010 -0700
@@ -24,22 +24,22 @@
import org.eclipse.core.runtime.CoreException;
public class WidgetProjectNature implements IProjectNature {
- public static final String ID = Activator.PLUGIN_ID + ".WidgetProjectNature";
-
- private IProject project;
+ public static final String ID = Activator.PLUGIN_ID + ".WidgetProjectNature";
- public void configure() throws CoreException {
- }
+ private IProject project;
+
+ public void configure() throws CoreException {
+ }
- public void deconfigure() throws CoreException {
- }
+ public void deconfigure() throws CoreException {
+ }
- public IProject getProject() {
- return project;
- }
+ public IProject getProject() {
+ return project;
+ }
- public void setProject(IProject project) {
- this.project = project;
- }
+ public void setProject(IProject project) {
+ this.project = project;
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/IWRTConstants.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/IWRTConstants.java Thu Sep 02 15:18:58 2010 -0700
@@ -16,32 +16,15 @@
* Assumptions/Requirement/Pre-requisites:
* Failures and causes:
*/
-
package org.symbian.tools.wrttools.core;
public interface IWRTConstants {
-
- public static final String WRT_PROJECT_FILE_NAME = "wrt.xml";
- public static final String SYSTEM_USER_HOME = System.getProperty("user.home");
- public static final String WRT = "wrt";
- public static final String PATH = "path";
- public static final String DEPLOY = "deploy";
- public static final String PACKAGE ="package";
- public static final String CONVERT = "Converter";
- public static final String DEPLOY_PATH="\\epoc32\\winscw\\c\\Data\\Others";
- public static final String DEVICES_XML_PATH = "c:/program files/common files/symbian/devices.xml";
- public static final String DEVICES_VISTA_XML_PATH = "appdata/local/virtualstore/program files/common files/symbian/devices.xml";
- public static final String DEVICES_TAG="devices";
- public static final String DEVICE_TAG="device";
- public static final String EPOC_ROOT_TAG="epocroot";
- public static final String NAME_ATTR = "name";
- public static final String ID_ATTR = "id";
- public static final String EMULATOR_NAME="com.nokia.s60";
- public static final String EMULATOR= "emulator";
- public static final String DEVICE= "device";
- public static final String DEVICE_ADDRESS= "address";
-
-
-
-
+ String DEVICES_XML_PATH = "c:/program files/common files/symbian/devices.xml";
+ String DEVICES_VISTA_XML_PATH = "appdata/local/virtualstore/program files/common files/symbian/devices.xml";
+ String DEVICES_TAG = "devices";
+ String DEVICE_TAG = "device";
+ String EPOC_ROOT_TAG = "epocroot";
+ String NAME_ATTR = "name";
+ String ID_ATTR = "id";
+ String EMULATOR_NAME = "com.nokia.s60";
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/WRTImages.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/WRTImages.java Thu Sep 02 15:18:58 2010 -0700
@@ -23,7 +23,7 @@
import org.eclipse.swt.graphics.Image;
import org.symbian.tools.wrttools.Activator;
-public class WRTImages {
+public final class WRTImages {
private static final String IMAGE_IMPORT_WIZARD_BANNER = "import_wizard_banner.png";
private static final String IMAGE_IMPORT_WGZ_BANNER = "import_w_banner.png";
private static final String IMAGE_NEW_WIZARD_BANNER = "WRT_wizard_banner.png";
@@ -77,4 +77,8 @@
public static Image getWrtKitIcon() {
return Activator.getDefault().getImageRegistry().get(IMAGE_WRTKIT);
}
+
+ private WRTImages() {
+ // No instantiation
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/Emulator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/Emulator.java Thu Sep 02 15:18:58 2010 -0700
@@ -117,18 +117,33 @@
* @param outputFile the path of the emulator where the widget will be deoplyed.
*/
private void deployWidget(File inputFile, File outputFile) throws CoreException {
+ InputStream in = null;
+ OutputStream out = null;
try {
- InputStream in = new FileInputStream(inputFile);
- OutputStream out = new FileOutputStream(outputFile);
+ in = new FileInputStream(inputFile);
+ out = new FileOutputStream(outputFile);
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
- in.close();
- out.close();
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Application deployment failed", e));
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ Activator.log(e);
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ Activator.log(e);
+ }
+ }
}
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorTargetType.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/deploy/emulator/EmulatorTargetType.java Thu Sep 02 15:18:58 2010 -0700
@@ -161,7 +161,7 @@
/**
* Adds the devices to the list to be displayed.
- * @param deviceNode the device node
+ * @param deviceNode the device node
* @param epocNode the epoc root node.
*/
private void addProject(Node epocNode, Node deviceNode) {
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/internal/validation/CssBuildValidator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/internal/validation/CssBuildValidator.java Thu Sep 02 15:18:58 2010 -0700
@@ -36,93 +36,81 @@
import org.w3c.css.util.Warning;
public class CssBuildValidator extends AbstractValidator {
-
- @Override
- public ValidationResult validate(IResource resource, int kind,
- ValidationState state, IProgressMonitor monitor) {
- return main(resource.getLocationURI().toString(), resource);
- }
+ @Override
+ public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
+ return main(resource.getLocationURI().toString(), resource);
+ }
- public ValidationResult main(String uri, IResource resource) {
- String language = "en";
- String profile = "css3"; // css2, css21 (default), css3, svg, svgbasic,
- // svgtiny, atsc-tv, mobile, tv
- String medium = ""; // (default), aural, braille, embossed,
- // handheld, print, projection, screen,
- // tty, tv, presentation
- int warningLevel = 2; // -1 (no warning), 0, 1, 2 (default, all the
- // warnings)
+ public ValidationResult main(String uri, IResource resource) {
+ String language = "en";
+ String profile = "css3"; // css2, css21 (default), css3, svg, svgbasic,
+ // svgtiny, atsc-tv, mobile, tv
+ String medium = ""; // (default), aural, braille, embossed,
+ // handheld, print, projection, screen,
+ // tty, tv, presentation
+ int warningLevel = 2; // -1 (no warning), 0, 1, 2 (default, all the
+ // warnings)
- // first, we get the parameters and create an application context
- ApplContext ac = new ApplContext(language);
+ // first, we get the parameters and create an application context
+ ApplContext ac = new ApplContext(language);
- if (profile != null && !"none".equals(profile)) {
- if ("css1".equals(profile) || "css2".equals(profile)
- || "css21".equals(profile) || "css3".equals(profile)
- || "svg".equals(profile) || "svgbasic".equals(profile)
- || "svgtiny".equals(profile)) {
- ac.setCssVersion(profile);
- } else {
- ac.setProfile(profile);
- ac.setCssVersion(PropertiesLoader.config
- .getProperty("defaultProfile"));
- }
- } else {
- ac.setProfile(profile);
- ac.setCssVersion(PropertiesLoader.config
- .getProperty("defaultProfile"));
- }
+ if (profile != null && !"none".equals(profile)) {
+ if ("css1".equals(profile) || "css2".equals(profile) || "css21".equals(profile) || "css3".equals(profile)
+ || "svg".equals(profile) || "svgbasic".equals(profile) || "svgtiny".equals(profile)) {
+ ac.setCssVersion(profile);
+ } else {
+ ac.setProfile(profile);
+ ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile"));
+ }
+ } else {
+ ac.setProfile(profile);
+ ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile"));
+ }
- // medium to use
- ac.setMedium(medium);
+ // medium to use
+ ac.setMedium(medium);
- // HTML document
- try {
- DocumentParser URLparser = new DocumentParser(ac, uri);
+ // HTML document
+ try {
+ DocumentParser urlParser = new DocumentParser(ac, uri);
- return handleRequest(ac, uri, URLparser.getStyleSheet(),
- warningLevel, true, resource);
- } catch (Exception e) {
- Activator.log(e);
- }
- return null;
- }
+ return handleRequest(ac, uri, urlParser.getStyleSheet(), warningLevel, true, resource);
+ } catch (Exception e) {
+ Activator.log(e);
+ }
+ return null;
+ }
- private ValidationResult handleRequest(ApplContext ac, String title,
- StyleSheet styleSheet, int warningLevel,
- boolean errorReport, IResource resource) throws Exception {
+ private ValidationResult handleRequest(ApplContext ac, String title, StyleSheet styleSheet, int warningLevel,
+ boolean errorReport, IResource resource) throws Exception {
- if (styleSheet == null) {
- throw new IOException(ac.getMsg().getServletString("process") + " "
- + title);
- }
+ if (styleSheet == null) {
+ throw new IOException(ac.getMsg().getServletString("process") + " " + title);
+ }
- styleSheet.findConflicts(ac);
- ValidationResult result = new ValidationResult();
- CssError[] errors = styleSheet.getErrors().getErrors();
- for (CssError cssError : errors) {
- String msg = cssError.getException().getLocalizedMessage();
- if (msg != null && msg.trim().length() > 0) {
- ValidatorMessage message = createMessage(resource, cssError
- .getLine(), msg, IMarker.SEVERITY_WARNING);
- result.add(message);
- }
- }
- Warning[] warnings = styleSheet.getWarnings().getWarnings();
- for (Warning warning : warnings) {
- ValidatorMessage message = createMessage(resource, warning
- .getLine(), warning.getWarningMessage(),
- IMarker.SEVERITY_WARNING);
- result.add(message);
- }
- return result;
- }
+ styleSheet.findConflicts(ac);
+ ValidationResult result = new ValidationResult();
+ CssError[] errors = styleSheet.getErrors().getErrors();
+ for (CssError cssError : errors) {
+ String msg = cssError.getException().getLocalizedMessage();
+ if (msg != null && msg.trim().length() > 0) {
+ ValidatorMessage message = createMessage(resource, cssError.getLine(), msg, IMarker.SEVERITY_WARNING);
+ result.add(message);
+ }
+ }
+ Warning[] warnings = styleSheet.getWarnings().getWarnings();
+ for (Warning warning : warnings) {
+ ValidatorMessage message = createMessage(resource, warning.getLine(), warning.getWarningMessage(),
+ IMarker.SEVERITY_WARNING);
+ result.add(message);
+ }
+ return result;
+ }
- private ValidatorMessage createMessage(IResource resource, int line,
- String msg, int severity) {
- ValidatorMessage message = ValidatorMessage.create(msg, resource);
- message.setAttribute(IMarker.LINE_NUMBER, line);
- message.setAttribute(IMarker.SEVERITY, severity);
- return message;
- }
+ private ValidatorMessage createMessage(IResource resource, int line, String msg, int severity) {
+ ValidatorMessage message = ValidatorMessage.create(msg, resource);
+ message.setAttribute(IMarker.LINE_NUMBER, line);
+ message.setAttribute(IMarker.SEVERITY, severity);
+ return message;
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/internal/validation/ValidatorPropMessages.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/internal/validation/ValidatorPropMessages.java Thu Sep 02 15:18:58 2010 -0700
@@ -24,21 +24,20 @@
import org.symbian.tools.wrttools.Activator;
-public class ValidatorPropMessages {
+public final class ValidatorPropMessages {
private static final String BUNDLE_NAME = "org.symbian.tools.wrttools.core.internal.validation.messages"; //$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
- private ValidatorPropMessages() {
- }
+ private ValidatorPropMessages() {
+ }
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
Activator.log(e);
- return '!' + key + '!';
- }
- }
+ return '!' + key + '!';
+ }
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/internal/validation/WrtApplicationValidator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/internal/validation/WrtApplicationValidator.java Thu Sep 02 15:18:58 2010 -0700
@@ -36,289 +36,249 @@
@SuppressWarnings("restriction")
public class WrtApplicationValidator extends AbstractValidator {
- @Override
- public ValidationResult validate(IResource resource, int kind,
- ValidationState state, IProgressMonitor monitor) {
- if (ProjectUtils.isPlist(resource)) {
- return validatePlist((IFile) resource);
- } else if (isProject(resource)) {
- return validateProject((IProject) resource);
- } else {
- return null;
- }
- }
+ @Override
+ public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
+ if (ProjectUtils.isPlist(resource)) {
+ return validatePlist((IFile) resource);
+ } else if (isProject(resource)) {
+ return validateProject((IProject) resource);
+ } else {
+ return null;
+ }
+ }
- private ValidationResult validateProject(IProject resource) {
- ValidationResult result = new ValidationResult();
- try {
- isPlistPresent(resource, result);
- } catch (CoreException e) {
- Activator.log(e);
- }
- return result;
- }
+ private ValidationResult validateProject(IProject resource) {
+ ValidationResult result = new ValidationResult();
+ try {
+ isPlistPresent(resource, result);
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ return result;
+ }
- private boolean isProject(IResource resource) {
- return resource.getType() == IResource.PROJECT
- && ProjectUtils.hasWrtNature(resource.getProject());
- }
+ private boolean isProject(IResource resource) {
+ return resource.getType() == IResource.PROJECT && ProjectUtils.hasWrtNature(resource.getProject());
+ }
- private ValidationResult validatePlist(IFile resource) {
- ValidationResult result = new ValidationResult();
- IStructuredModel structuredModel;
- try {
- structuredModel = StructuredModelManager.getModelManager()
- .getModelForRead(resource);
- try {
- if (structuredModel instanceof IDOMModel) {
- IDOMModel model = (IDOMModel) structuredModel;
- validateElement((IDOMElement) model.getDocument()
- .getDocumentElement(), result, resource);
- checkHtml(model, resource, result);
- checkPlistValues(model, resource, result);
- }
- } finally {
- if (structuredModel != null) {
- structuredModel.releaseFromRead();
- }
- }
- } catch (IOException e) {
- Activator.log(e);
- } catch (CoreException e) {
- Activator.log(e);
- }
- return result;
- }
+ private ValidationResult validatePlist(IFile resource) {
+ ValidationResult result = new ValidationResult();
+ IStructuredModel structuredModel;
+ try {
+ structuredModel = StructuredModelManager.getModelManager().getModelForRead(resource);
+ try {
+ if (structuredModel instanceof IDOMModel) {
+ IDOMModel model = (IDOMModel) structuredModel;
+ validateElement((IDOMElement) model.getDocument().getDocumentElement(), result, resource);
+ checkHtml(model, resource, result);
+ checkPlistValues(model, resource, result);
+ }
+ } finally {
+ if (structuredModel != null) {
+ structuredModel.releaseFromRead();
+ }
+ }
+ } catch (IOException e) {
+ Activator.log(e);
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ return result;
+ }
private static enum PListElements {
plist, array, data, date, dict, real, integer, string, FALSE, TRUE, key, xml
};
- private void validateElement(IDOMElement element, ValidationResult result,
- IResource resource) {
- // showData("");
+ private void validateElement(IDOMElement element, ValidationResult result, IResource resource) {
+ // showData("");
PListElements[] values = PListElements.values();
- boolean isValidElement = false;
+ boolean isValidElement = false;
for (PListElements validElement : values) {
- if (validElement.toString().equalsIgnoreCase(
- element.getNodeName().trim())) {
- isValidElement = true;
- break;
+ if (validElement.toString().equalsIgnoreCase(element.getNodeName().trim())) {
+ isValidElement = true;
+ break;
- }
- continue;
- }
- if (!isValidElement) {
- Object[] arguments = { " ", element.getNodeName().trim() };
- String message = MessageFormat.format(ValidatorPropMessages
- .getString("plist.element.not.supported")
- + "{0}" + "{1}", arguments);
- result.add(createMessage(resource, message, element
- .getStartOffset(), element.getEndOffset()));
- }
+ }
+ continue;
+ }
+ if (!isValidElement) {
+ Object[] arguments = { " ", element.getNodeName().trim() };
+ String message = MessageFormat.format(ValidatorPropMessages.getString("plist.element.not.supported")
+ + "{0}" + "{1}", arguments);
+ result.add(createMessage(resource, message, element.getStartOffset(), element.getEndOffset()));
+ }
- NodeList childNodes = element.getChildNodes();
- for (int i = 0; i < childNodes.getLength(); i++) {
- Node item = childNodes.item(i);
- if (item.getNodeType() == Node.ELEMENT_NODE) {
- validateElement((IDOMElement) item, result, resource);
- }
- }
- }
+ NodeList childNodes = element.getChildNodes();
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node item = childNodes.item(i);
+ if (item.getNodeType() == Node.ELEMENT_NODE) {
+ validateElement((IDOMElement) item, result, resource);
+ }
+ }
+ }
- private ValidatorMessage createMessage(IResource resource, String message,
- int startOffset, int endOffset) {
- ValidatorMessage msg = ValidatorMessage.create(message, resource);
- msg.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
- msg.setAttribute(IMarker.CHAR_START, startOffset);
- msg.setAttribute(IMarker.CHAR_END, endOffset);
- return msg;
- }
+ private ValidatorMessage createMessage(IResource resource, String message, int startOffset, int endOffset) {
+ ValidatorMessage msg = ValidatorMessage.create(message, resource);
+ msg.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ msg.setAttribute(IMarker.CHAR_START, startOffset);
+ msg.setAttribute(IMarker.CHAR_END, endOffset);
+ return msg;
+ }
- private boolean checkHtml(IDOMModel model, IFile plist,
- ValidationResult result) {
- String text = model.getStructuredDocument().get();
- IRegion region = CoreUtil.getIndexFileNameRegion(text);
- boolean checkHtml = false;
- if (region != null) {
- String htmlName = text.substring(region.getOffset(), region
- .getOffset()
- + region.getLength());
- IFile htmlFile = null;
- try {
- htmlFile = getFile(plist.getProject(), new Path(htmlName), 0,
- "html", "htm");
- } catch (CoreException e) {
- Activator.log(e);
- }
- if (htmlFile == null) {
- Object[] arguments = { htmlName, "<>", htmlName };
- String message = MessageFormat.format(ValidatorPropMessages
- .getString("plist.html.element.mismatch")
- + "{0}" + "{1}" + "{2}", arguments);
- result.add(createMessage(plist, message, region.getOffset(),
- region.getOffset() + region.getLength()));
- }
- } else {
- String message = ValidatorPropMessages
- .getString("plist.html.element.mailHtml.missing");
- ValidatorMessage msg = createMessage(plist, message, 0, 0);
- setMessageOnRootElement(msg, model);
- result.add(msg);
- }
+ private boolean checkHtml(IDOMModel model, IFile plist, ValidationResult result) {
+ String text = model.getStructuredDocument().get();
+ IRegion region = CoreUtil.getIndexFileNameRegion(text);
+ boolean checkHtml = false;
+ if (region != null) {
+ String htmlName = text.substring(region.getOffset(), region.getOffset() + region.getLength());
+ IFile htmlFile = null;
+ try {
+ htmlFile = getFile(plist.getProject(), new Path(htmlName), 0, "html", "htm");
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ if (htmlFile == null) {
+ Object[] arguments = { htmlName, "<>", htmlName };
+ String message = MessageFormat.format(ValidatorPropMessages.getString("plist.html.element.mismatch")
+ + "{0}" + "{1}" + "{2}", arguments);
+ result.add(createMessage(plist, message, region.getOffset(), region.getOffset() + region.getLength()));
+ }
+ } else {
+ String message = ValidatorPropMessages.getString("plist.html.element.mailHtml.missing");
+ ValidatorMessage msg = createMessage(plist, message, 0, 0);
+ setMessageOnRootElement(msg, model);
+ result.add(msg);
+ }
+
+ return checkHtml;
+ }
- return checkHtml;
- }
-
- private void setMessageOnRootElement(ValidatorMessage msg, IDOMModel model) {
- Element element = model.getDocument().getDocumentElement();
- int begin = 0, end = 0;
- if (element instanceof IDOMNode) {
- IDOMNode node = (IDOMNode) element;
- begin = node.getStartOffset();
- end = node.getFirstStructuredDocumentRegion().getEnd();
- }
- msg.setAttribute(IMarker.CHAR_START, begin);
- msg.setAttribute(IMarker.CHAR_END, end);
- }
+ private void setMessageOnRootElement(ValidatorMessage msg, IDOMModel model) {
+ Element element = model.getDocument().getDocumentElement();
+ int begin = 0, end = 0;
+ if (element instanceof IDOMNode) {
+ IDOMNode node = (IDOMNode) element;
+ begin = node.getStartOffset();
+ end = node.getFirstStructuredDocumentRegion().getEnd();
+ }
+ msg.setAttribute(IMarker.CHAR_START, begin);
+ msg.setAttribute(IMarker.CHAR_END, end);
+ }
- private IFile getFile(IContainer container, IPath path, int segment,
- String... extensions) throws CoreException {
- if (segment + 1 == path.segmentCount()) {
- return getFile(container, path.lastSegment(), extensions);
- } else {
- String name = path.segment(segment).toLowerCase();
- IResource[] members = container.members();
- for (IResource resource : members) {
- if (resource.getName().toLowerCase().equals(name)) {
- if (resource.getType() == IResource.FOLDER) {
- return getFile((IContainer) resource, path,
- segment + 1, extensions);
- }
- }
- }
- }
- return null;
- }
+ private IFile getFile(IContainer container, IPath path, int segment, String... extensions) throws CoreException {
+ if (segment + 1 == path.segmentCount()) {
+ return getFile(container, path.lastSegment(), extensions);
+ } else {
+ String name = path.segment(segment).toLowerCase();
+ IResource[] members = container.members();
+ for (IResource resource : members) {
+ if (resource.getName().toLowerCase().equals(name)) {
+ if (resource.getType() == IResource.FOLDER) {
+ return getFile((IContainer) resource, path, segment + 1, extensions);
+ }
+ }
+ }
+ }
+ return null;
+ }
- private IFile getFile(IContainer container, String lastSegment,
- String[] extensions) throws CoreException {
- final Set<String> names = new TreeSet<String>();
- names.add(lastSegment.toLowerCase());
- for (String extension : extensions) {
- names.add(lastSegment.concat(".").concat(extension).toLowerCase());
- }
- IResource[] members = container.members();
- for (IResource resource : members) {
- if (resource.getType() == IResource.FILE
- && names.contains(resource.getName().toLowerCase())
- && resource.isAccessible()) {
- return (IFile) resource;
- }
- }
- return null;
- }
+ private IFile getFile(IContainer container, String lastSegment, String[] extensions) throws CoreException {
+ final Set<String> names = new TreeSet<String>();
+ names.add(lastSegment.toLowerCase());
+ for (String extension : extensions) {
+ names.add(lastSegment.concat(".").concat(extension).toLowerCase());
+ }
+ IResource[] members = container.members();
+ for (IResource resource : members) {
+ if (resource.getType() == IResource.FILE && names.contains(resource.getName().toLowerCase())
+ && resource.isAccessible()) {
+ return (IFile) resource;
+ }
+ }
+ return null;
+ }
- private void checkPlistValues(IDOMModel model, IResource plist,
- ValidationResult result) {
- String source = model.getStructuredDocument().get();
- if (!hasAttributeValue(source, "DisplayName")) {
- Object[] arguments = { " 'Display Name' ",
- ValidatorPropMessages.getString("not.in.plist.file") };
- String message = MessageFormat.format(ValidatorPropMessages
- .getString("plist.mankey.mising")
- + "{0}" + "{1}", arguments);
- ValidatorMessage msg = createMessage(plist, message, 0, 0);
- setMessageOnRootElement(msg, model);
- result.add(msg);
- } else /* validating Widget name (Display name) */
- {
- Matcher matcher = CoreUtil.getPropertyLookupPattern("DisplayName")
- .matcher(source);
- if (matcher.find()) {
- String strError = Util.validateWidgetName(matcher.group(1));
- if (strError != null) {
- Object[] arguments = {
- " 'Display Name' ",
- ValidatorPropMessages
- .getString("contains.invalid.character") };
- String message = MessageFormat.format(ValidatorPropMessages
- .getString("plist.mankey.mising")
- + "{0}" + "{1}", arguments);
+ private void checkPlistValues(IDOMModel model, IResource plist, ValidationResult result) {
+ String source = model.getStructuredDocument().get();
+ if (!hasAttributeValue(source, "DisplayName")) {
+ Object[] arguments = { " 'Display Name' ", ValidatorPropMessages.getString("not.in.plist.file") };
+ String message = MessageFormat.format(ValidatorPropMessages.getString("plist.mankey.mising") + "{0}"
+ + "{1}", arguments);
+ ValidatorMessage msg = createMessage(plist, message, 0, 0);
+ setMessageOnRootElement(msg, model);
+ result.add(msg);
+ } else { /* validating Widget name (Display name) */
+ Matcher matcher = CoreUtil.getPropertyLookupPattern("DisplayName").matcher(source);
+ if (matcher.find()) {
+ String strError = Util.validateWidgetName(matcher.group(1));
+ if (strError != null) {
+ Object[] arguments = { " 'Display Name' ",
+ ValidatorPropMessages.getString("contains.invalid.character") };
+ String message = MessageFormat.format(ValidatorPropMessages.getString("plist.mankey.mising")
+ + "{0}" + "{1}", arguments);
- ValidatorMessage msg = createMessage(plist, message,
- matcher.start(), matcher.end());
- result.add(msg);
- }
- }
- }
+ ValidatorMessage msg = createMessage(plist, message, matcher.start(), matcher.end());
+ result.add(msg);
+ }
+ }
+ }
- if (!hasAttributeValue(source, "MainHTML")) {
- Object[] arguments = { " 'MainHTML ' ",
- ValidatorPropMessages.getString("not.in.plist.file") };
- String message = MessageFormat.format(ValidatorPropMessages
- .getString("plist.mankey.mising")
- + "{0}" + "{1}", arguments);
- ValidatorMessage msg = createMessage(plist, message, 0, 0);
- setMessageOnRootElement(msg, model);
- result.add(msg);
- }
- if (!hasAttributeValue(source, "Identifier")) {
- Object[] arguments = { " 'Identifier ' ",
- ValidatorPropMessages.getString("not.in.plist.file") };
- String message = MessageFormat.format(ValidatorPropMessages
- .getString("plist.mankey.mising")
- + "{0}" + "{1}", arguments);
- ValidatorMessage msg = createMessage(plist, message, 0, 0);
- setMessageOnRootElement(msg, model);
- result.add(msg);
- } else /* validating Widget Idenfier (UID) */
- {
- Matcher matcher = CoreUtil.getPropertyLookupPattern("Identifier")
- .matcher(source);
- if (matcher.find()) {
- String strError = Util.validateWidgetID(matcher.group(1));
- if (strError != null) {
- Object[] arguments = {
- " 'Identifier' ",
- ValidatorPropMessages
- .getString("contains.invalid.character") };
- String message = MessageFormat.format(ValidatorPropMessages
- .getString("plist.mankey.mising")
- + "{0}" + "{1}", arguments);
+ if (!hasAttributeValue(source, "MainHTML")) {
+ Object[] arguments = { " 'MainHTML ' ", ValidatorPropMessages.getString("not.in.plist.file") };
+ String message = MessageFormat.format(ValidatorPropMessages.getString("plist.mankey.mising") + "{0}"
+ + "{1}", arguments);
+ ValidatorMessage msg = createMessage(plist, message, 0, 0);
+ setMessageOnRootElement(msg, model);
+ result.add(msg);
+ }
+ if (!hasAttributeValue(source, "Identifier")) {
+ Object[] arguments = { " 'Identifier ' ", ValidatorPropMessages.getString("not.in.plist.file") };
+ String message = MessageFormat.format(ValidatorPropMessages.getString("plist.mankey.mising") + "{0}"
+ + "{1}", arguments);
+ ValidatorMessage msg = createMessage(plist, message, 0, 0);
+ setMessageOnRootElement(msg, model);
+ result.add(msg);
+ } else { /* validating Widget Idenfier (UID) */
+ Matcher matcher = CoreUtil.getPropertyLookupPattern("Identifier").matcher(source);
+ if (matcher.find()) {
+ String strError = Util.validateWidgetID(matcher.group(1));
+ if (strError != null) {
+ Object[] arguments = { " 'Identifier' ",
+ ValidatorPropMessages.getString("contains.invalid.character") };
+ String message = MessageFormat.format(ValidatorPropMessages.getString("plist.mankey.mising")
+ + "{0}" + "{1}", arguments);
- ValidatorMessage msg = createMessage(plist, message,
- matcher.start(1), matcher.end(1));
- result.add(msg);
- }
- }
- }
- }
+ ValidatorMessage msg = createMessage(plist, message, matcher.start(1), matcher.end(1));
+ result.add(msg);
+ }
+ }
+ }
+ }
- private boolean hasAttributeValue(String source, String propertyName) {
- Pattern pattern = CoreUtil.getPropertyLookupPattern(propertyName);
- boolean hasAttr = true;
- Matcher matcher = pattern.matcher(source);
- if (!matcher.find()) {
- hasAttr = false;
- } else {
- hasAttr = matcher.group(1).trim().length() > 0;
- }
- return hasAttr;
- }
+ private boolean hasAttributeValue(String source, String propertyName) {
+ Pattern pattern = CoreUtil.getPropertyLookupPattern(propertyName);
+ boolean hasAttr = true;
+ Matcher matcher = pattern.matcher(source);
+ if (!matcher.find()) {
+ hasAttr = false;
+ } else {
+ hasAttr = matcher.group(1).trim().length() > 0;
+ }
+ return hasAttr;
+ }
- private void isPlistPresent(IProject project, ValidationResult result)
- throws CoreException {
- IResource[] members = project.members();
- for (IResource resource : members) {
- if (ProjectUtils.isPlist(resource)) {
- return;
- }
- }
- ValidatorMessage msg = ValidatorMessage.create(ValidatorPropMessages
- .getString("plist.File.Not.Present"), project);
- msg.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ private void isPlistPresent(IProject project, ValidationResult result) throws CoreException {
+ IResource[] members = project.members();
+ for (IResource resource : members) {
+ if (ProjectUtils.isPlist(resource)) {
+ return;
+ }
+ }
+ ValidatorMessage msg = ValidatorMessage.create(ValidatorPropMessages.getString("plist.File.Not.Present"),
+ project);
+ msg.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
- result.add(msg);
- }
+ result.add(msg);
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/internal/validation/messages.properties Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/internal/validation/messages.properties Thu Sep 02 15:18:58 2010 -0700
@@ -1,8 +1,8 @@
plist.File.Not.Present=Mandatory file info.plist is missing in the widget project. For further processing please include info.plist and try again.
html.File.Not.Present=Main HTML file is missing. For further processing please include the main html file and try again.
-WidgetModel.Divergent.Files.Present=Unnecessary files are included. To minimize the widget size please only include the required files. The supported file types are .htm, .html, .png, .gif, .jpg.
+WidgetModel.Divergent.Files.Present=Unnecessary files are included. To minimize the widget size please only include the required files. The supported file types are .htm, .html, .png, .gif, .jpg.
-todo.WidgetModel.Divergent.Files.Present=Remove the unsupported file
+todo.WidgetModel.Divergent.Files.Present=Remove the unsupported file
todo.include.plist=Please include the info.plist file to the project
todo.include.html=Please include the html file to the project
@@ -14,14 +14,14 @@
todo.correct.plist.for.html =Correct Plist Entry for MainHTML
-plist.mankey.mising =Mandatory Plist element
+plist.mankey.mising = Mandatory Plist element
not.in.plist.file=not in plist file. Please add plist element values to the info.plist file.
todo.add.mankey.plist.element =Add the mandatory Plist element values to Info.plist.
contains.invalid.character =contains invalid characters
todo.valid.character=Enter valid character to Info.plist.
plist.key.string.mising =Missing string pair for the key element. Please add the string element for the key.
-todo.add.mankey.string =Add the string element of mandatory Info.plist key element
+todo.add.mankey.string =Add the string element of mandatory Info.plist key element
plist.element.not.closed =A malformed XML element was found. Please delete or change the plist element from info.plist file.
todo.element.not.closed = Delete or change the Plist element from Info.plist
@@ -86,7 +86,7 @@
todo.xml.doctype.error.missing.open.and.close=XML doctype missing open'<' and close'>'
xml.element.error.missing.close=XML start element missing close'>'
-xml.element.error.missing.open=XML start element missing open'<'
+xml.element.error.missing.open=XML start element missing open'<'
xml.element.error.missing.open.and.close=XML start element missing open'<' and close'>'
todo.xml.element.error.missing.close=XML start element missing close'>'
@@ -103,16 +103,16 @@
todo.xml.element.end.error.missing.open.and.close= XML end element missing open'<' and close'>'
char.present.before.start.line= Invalid Character present before Starting of document
-todo.char.present.before.start.line=Remove Invalid Character present
+todo.char.present.before.start.line=Remove Invalid Character present
plist.parser.error.at.line.no= Plist Parse Error at line number :
-todo.plist.parser.error.at.line.no= Verify Plist Element at line number
+todo.plist.parser.error.at.line.no= Verify Plist Element at line number
non.referenced.html.File.Present=Non referenced Html File Present. To minimize the widget size please only include the required files.
-todo.non.referenced.html.File.Present= Verify Non referenced Html File
+todo.non.referenced.html.File.Present= Verify Non referenced Html File
duplicate.plist.file.present=Duplicate plist file detected in the widget project. To minimize the widget size please only include the required files.
-subfolder.duplicate.plist.file.present = More Plist files are present in the project sub directory. Please include only required files.
+subfolder.duplicate.plist.file.present = More Plist files are present in the project sub directory. Please include only required files.
-todo.duplicate.plist.file.present= Remove Duplicate plist file
+todo.duplicate.plist.file.present= Remove Duplicate plist file
plist.File.Not.selected= Plist File is not selected from package option.
todo.plist.File.Not.selected Plist file needs to be selected for packaging
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WrtLibInitializer.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WrtLibInitializer.java Thu Sep 02 15:18:58 2010 -0700
@@ -17,91 +17,90 @@
import org.symbian.tools.wrttools.Activator;
public class WrtLibInitializer extends JsGlobalScopeContainerInitializer {
-
public static class WrtLocation implements LibraryLocation {
private static final WrtLocation LOCATION = new WrtLocation();
-
- public char[][] getLibraryFileNames() {
- return convert(getFiles());
- }
+
+ public char[][] getLibraryFileNames() {
+ return convert(getFiles());
+ }
- private char[][] convert(String[] files) {
- final Set<char[]> set = new HashSet<char[]>();
- for (String string : files) {
- if (string.endsWith(".js")) {
- set.add(string.toCharArray());
- }
- }
- return set.toArray(new char[set.size()][]);
- }
+ private char[][] convert(String[] files) {
+ final Set<char[]> set = new HashSet<char[]>();
+ for (String string : files) {
+ if (string.endsWith(".js")) {
+ set.add(string.toCharArray());
+ }
+ }
+ return set.toArray(new char[set.size()][]);
+ }
- public IPath getLibraryPathInPlugin() {
+ public IPath getLibraryPathInPlugin() {
return new Path("/libraries/core");
- }
-
+ }
+
public static WrtLocation getInstance() {
- return LOCATION;
- }
-
- public String[] getFiles() {
- Bundle bundle = Activator.getDefault().getBundle();
- String path = getLibraryPathInPlugin().toString();
+ return LOCATION;
+ }
- final Set<String> set = getEntries(bundle, path);
- return set.toArray(new String[set.size()]);
- }
+ public String[] getFiles() {
+ Bundle bundle = Activator.getDefault().getBundle();
+ String path = getLibraryPathInPlugin().toString();
+
+ final Set<String> set = getEntries(bundle, path);
+ return set.toArray(new String[set.size()]);
+ }
@SuppressWarnings("rawtypes")
private Set<String> getEntries(Bundle bundle, String p) {
- final Set<String> set = new TreeSet<String>();
- Enumeration entries = bundle.getEntryPaths(p);
- while (entries.hasMoreElements()) {
- String path = (String) entries.nextElement();
- if (path.endsWith("/")) {
- set.addAll(getEntries(bundle, path));
- } else {
- set.add(path.substring(getLibraryPathInPlugin().toString().length()));
- }
- }
- return set;
- }
+ final Set<String> set = new TreeSet<String>();
+ Enumeration entries = bundle.getEntryPaths(p);
+ while (entries.hasMoreElements()) {
+ String path = (String) entries.nextElement();
+ if (path.endsWith("/")) {
+ set.addAll(getEntries(bundle, path));
+ } else {
+ set.add(path.substring(getLibraryPathInPlugin().toString().length()));
+ }
+ }
+ return set;
+ }
- public String getLibraryPath(String name) {
- System.out.println(name);
- return null;
- }
+ public String getLibraryPath(String name) {
+ System.out.println(name);
+ return null;
+ }
- public String getLibraryPath(char[] name) {
- Bundle bundle = Activator.getDefault().getBundle();
- URL url = FileLocator.find(bundle, getLibraryPathInPlugin().append(new String(name)), null);
- try {
- URL fileURL = FileLocator.toFileURL(url);
- return fileURL.getPath();
- } catch (IOException e) {
- Activator.log(e);
- }
- return null;
- }
+ public String getLibraryPath(char[] name) {
+ Bundle bundle = Activator.getDefault().getBundle();
+ URL url = FileLocator.find(bundle, getLibraryPathInPlugin().append(new String(name)), null);
+ try {
+ URL fileURL = FileLocator.toFileURL(url);
+ return fileURL.getPath();
+ } catch (IOException e) {
+ Activator.log(e);
+ }
+ return null;
+ }
- public IPath getWorkingLibPath() {
- System.out.println();
- return null;
- }
- }
+ public IPath getWorkingLibPath() {
+ System.out.println();
+ return null;
+ }
+ }
- public LibraryLocation getLibraryLocation() {
+ public LibraryLocation getLibraryLocation() {
return WrtLocation.getInstance();
- }
+ }
- @Override
- public String getDescription() {
+ @Override
+ public String getDescription() {
return "WebRuntime Toolkit Support Library";
- }
-
- @Override
- public String getDescription(IPath containerPath, IJavaScriptProject project) {
- return containerPath.lastSegment();
- }
+ }
+
+ @Override
+ public String getDescription(IPath containerPath, IJavaScriptProject project) {
+ return containerPath.lastSegment();
+ }
@Override
public String[] containerSuperTypes() {
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/ExcludeFileAction.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/ExcludeFileAction.java Thu Sep 02 15:18:58 2010 -0700
@@ -38,77 +38,68 @@
import org.symbian.tools.wrttools.util.ProjectUtils;
public class ExcludeFileAction implements IObjectActionDelegate {
-
- private final List<IFile> selectedFiles = new ArrayList<IFile>();
- private final List<IFolder> selectedFolders = new ArrayList<IFolder>();
- public ExcludeFileAction() {
- super();
- }
+
+ private final List<IFile> selectedFiles = new ArrayList<IFile>();
+ private final List<IFolder> selectedFolders = new ArrayList<IFolder>();
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
+ public ExcludeFileAction() {
+ super();
+ }
- public void run(IAction action) {
- for (IFile file : selectedFiles) {
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ public void run(IAction action) {
+ for (IFile file : selectedFiles) {
ProjectUtils.exclude(file);
- }
-
- for(IFolder folder : selectedFolders){
- try{
+ }
+ for (IFolder folder : selectedFolders) {
+ try {
ProjectUtils.exclude(folder);
- excludeFolder( folder);
- }
- catch (CoreException x) {
+ excludeFolder(folder);
+ } catch (CoreException x) {
Activator.log("error setting exclude property on folder: " + folder.getName(), x);
- }
- }
- /*Refresh project tree when property is changed */
- PlatformUI.getWorkbench().getDecoratorManager().update("org.symbian.tools.wrttools.decorator");
- }
-
+ }
+ }
+ /*Refresh project tree when property is changed */
+ PlatformUI.getWorkbench().getDecoratorManager().update("org.symbian.tools.wrttools.decorator");
+ }
+
@SuppressWarnings("rawtypes")
public void selectionChanged(IAction action, ISelection selection) {
- selectedFiles.clear();
- selectedFolders.clear();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- for (Iterator iter = ss.iterator(); iter.hasNext();) {
- Object obj = iter.next();
- if (obj instanceof IFile) {
-
- IFile file = (IFile) obj;
- selectedFiles.add(file);
-
- }
-
- if(obj instanceof IFolder){
- IFolder folder = (IFolder) obj;
- selectedFolders.add(folder);
- }
- }
- }
- }
-
-
- /**
- *
- * @param folder
- * @throws CoreException
- */
+ selectedFiles.clear();
+ selectedFolders.clear();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ for (Iterator iter = ss.iterator(); iter.hasNext();) {
+ Object obj = iter.next();
+ if (obj instanceof IFile) {
+
+ IFile file = (IFile) obj;
+ selectedFiles.add(file);
+
+ }
- private void excludeFolder(IFolder folder) throws CoreException{
- folder.accept(new IResourceVisitor() {
- public boolean visit(IResource resource)throws CoreException {
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
+ if (obj instanceof IFolder) {
+ IFolder folder = (IFolder) obj;
+ selectedFolders.add(folder);
+ }
+ }
+ }
+ }
+
+ private void excludeFolder(IFolder folder) throws CoreException {
+ folder.accept(new IResourceVisitor() {
+ public boolean visit(IResource resource) throws CoreException {
+ if (resource instanceof IFile) {
+ IFile file = (IFile) resource;
ProjectUtils.exclude(file);
- }
- else if (resource instanceof IFolder) {
- IFolder folder = (IFolder) resource;
+ } else if (resource instanceof IFolder) {
+ IFolder folder = (IFolder) resource;
ProjectUtils.exclude(folder);
- }
- return true;
- }
- });
- }
+ }
+ return true;
+ }
+ });
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/IncludeFileAction.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/IncludeFileAction.java Thu Sep 02 15:18:58 2010 -0700
@@ -39,19 +39,17 @@
import org.symbian.tools.wrttools.util.ProjectUtils;
public class IncludeFileAction implements IObjectActionDelegate {
-
private final List<IFile> selectedFiles = new ArrayList<IFile>();
private final List<IFolder> selectedFolders = new ArrayList<IFolder>();
-
- public IncludeFileAction() {
+ public IncludeFileAction() {
super();
}
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
- public void run(IAction action) {
+ public void run(IAction action) {
for (IFile file : selectedFiles) {
ProjectUtils.include(file);
}
@@ -92,12 +90,6 @@
}
}
- /**
- *
- * @param folder
- * @throws CoreException
- */
-
private void includeFolder(IFolder folder) throws CoreException {
folder.accept(new IResourceVisitor() {
public boolean visit(IResource resource) throws CoreException {
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/WRTPackagerConstants.java Thu Sep 02 10:50:38 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-
-package org.symbian.tools.wrttools.core.packager;
-
-import org.eclipse.core.runtime.QualifiedName;
-
-public class WRTPackagerConstants {
- public static QualifiedName EXCLUDE_PROPERTY = new QualifiedName("org.symbian.tools.wrttools.core.packager",
- "exclude");
-}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/WrtPackager.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/WrtPackager.java Thu Sep 02 15:18:58 2010 -0700
@@ -59,7 +59,11 @@
}
public IPath getPathInPackage(IResource resource) {
- return ProjectUtils.isExcluded(resource) ? null : resource.getFullPath().makeRelative();
+ if (ProjectUtils.isExcluded(resource)) {
+ return null;
+ } else {
+ return resource.getFullPath().makeRelative();
+ }
}
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/ProjectRenameParticipant.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/project/ProjectRenameParticipant.java Thu Sep 02 15:18:58 2010 -0700
@@ -26,7 +26,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.ltk.core.refactoring.Change;
@@ -69,13 +68,12 @@
}
@Override
- public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context)
- throws OperationCanceledException {
+ public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) {
return null;
}
@Override
- public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
+ public Change createChange(IProgressMonitor pm) throws CoreException {
final IFile file = project.getFile(CoreUtil.METADATA_FILE);
if (file.isAccessible()) {
IStructuredModel model = null;
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CompoundValidator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CompoundValidator.java Thu Sep 02 15:18:58 2010 -0700
@@ -22,34 +22,32 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-
public class CompoundValidator implements IValidator {
- private final IValidator[] validators;
+ private final IValidator[] validators;
- public CompoundValidator(IValidator ... validators) {
- this.validators = validators;
- }
-
- public CompoundValidator(IValidator validator,
- IValidator[] validators) {
- this.validators = new IValidator[validators.length + 1];
- this.validators[0] = validator;
- System.arraycopy(validators, 0, this.validators, 1, validators.length);
- }
+ public CompoundValidator(IValidator... validators) {
+ this.validators = validators;
+ }
+
+ public CompoundValidator(IValidator validator, IValidator[] validators) {
+ this.validators = new IValidator[validators.length + 1];
+ this.validators[0] = validator;
+ System.arraycopy(validators, 0, this.validators, 1, validators.length);
+ }
- public IStatus validate(Object value) {
- IStatus status = Status.OK_STATUS;
-
- for (IValidator validator : validators) {
- IStatus s = validator.validate(value);
- switch (s.getSeverity()) {
- case IStatus.ERROR:
- return s;
- case IStatus.WARNING:
- status = s;
- }
- }
- return status;
- }
+ public IStatus validate(Object value) {
+ IStatus status = Status.OK_STATUS;
+
+ for (IValidator validator : validators) {
+ IStatus s = validator.validate(value);
+ switch (s.getSeverity()) {
+ case IStatus.ERROR:
+ return s;
+ case IStatus.WARNING:
+ status = s;
+ }
+ }
+ return status;
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CoreUtil.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CoreUtil.java Thu Sep 02 15:18:58 2010 -0700
@@ -20,20 +20,20 @@
import org.eclipse.jface.text.Region;
import org.symbian.tools.wrttools.Activator;
-public class CoreUtil {
+public final class CoreUtil {
+ private static class IndexFileRecord {
+ public final IFile fileName;
+ public final long timeStamp;
+
+ public IndexFileRecord(IFile fileName, long timeStamp) {
+ this.fileName = fileName;
+ this.timeStamp = timeStamp;
+ }
+ }
+ private static final Map<IProject, IndexFileRecord> INDEX_FILES = new HashMap<IProject, IndexFileRecord>();
public static final String METADATA_FILE = "Info.plist";
public static final String PROPERTY_PATTERN = "<key>\\s*{0}\\s*</key>\\s*<string>\\s*(.*)\\s*</string>";
- public static String getIndexFileName(String buffer) {
- if (buffer != null) {
- Matcher matcher = getPropertyLookupPattern("MainHTML").matcher(buffer);
- if (matcher.find()) {
- return matcher.group(1);
- }
- }
- return null;
- }
-
public static String getApplicationName(String buffer) {
if (buffer != null) {
Matcher matcher = getPropertyLookupPattern("DisplayName").matcher(buffer);
@@ -44,19 +44,6 @@
return null;
}
- public static Pattern getPropertyLookupPattern(String propertyName) {
- return Pattern.compile(MessageFormat.format(PROPERTY_PATTERN, propertyName), Pattern.CASE_INSENSITIVE);
- }
-
- public static IRegion getIndexFileNameRegion(String string) {
- Matcher matcher = getPropertyLookupPattern("MainHTML").matcher(string);
- if (matcher.find()) {
- int start = matcher.start(1);
- return new Region(start, matcher.end(1) - start);
- }
- return null;
- }
-
public static IFile getFile(IProject project, String fileName) throws CoreException {
String n = fileName.toLowerCase();
IResource[] members = project.members();
@@ -69,36 +56,6 @@
return null;
}
- public static String readFile(IFile file) throws CoreException {
- try {
- if (file != null && file.isAccessible()) {
- final BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents(),
- file.getCharset()));
- return read(reader);
- }
- return null;
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(
- "Failed to read file {0} in project {1}", file.getName(), file.getProject().getName())));
- }
- }
-
- public static String read(final Reader reader) throws IOException {
- StringBuffer buffer = new StringBuffer();
- try {
- int c = 0;
- char[] buf = new char[4096];
- while ((c = reader.read(buf)) > 0) {
- buffer.append(buf, 0, c);
- }
- return buffer.toString();
- } finally {
- reader.close();
- }
- }
-
- private static final Map<IProject, IndexFileRecord> INDEX_FILES = new HashMap<IProject, IndexFileRecord>();
-
public static synchronized IFile getIndexFile(IProject project) throws CoreException {
// There will really be a lot of calls to this method. We need to cache values.
IFile file = getFile(project, METADATA_FILE);
@@ -124,13 +81,58 @@
return null;
}
- private static class IndexFileRecord {
- public final IFile fileName;
- public final long timeStamp;
+ public static String getIndexFileName(String buffer) {
+ if (buffer != null) {
+ Matcher matcher = getPropertyLookupPattern("MainHTML").matcher(buffer);
+ if (matcher.find()) {
+ return matcher.group(1);
+ }
+ }
+ return null;
+ }
- public IndexFileRecord(IFile fileName, long timeStamp) {
- this.fileName = fileName;
- this.timeStamp = timeStamp;
+ public static IRegion getIndexFileNameRegion(String string) {
+ Matcher matcher = getPropertyLookupPattern("MainHTML").matcher(string);
+ if (matcher.find()) {
+ int start = matcher.start(1);
+ return new Region(start, matcher.end(1) - start);
+ }
+ return null;
+ }
+
+ public static Pattern getPropertyLookupPattern(String propertyName) {
+ return Pattern.compile(MessageFormat.format(PROPERTY_PATTERN, propertyName), Pattern.CASE_INSENSITIVE);
+ }
+
+ public static String read(final Reader reader) throws IOException {
+ StringBuffer buffer = new StringBuffer();
+ try {
+ int c = 0;
+ char[] buf = new char[4096];
+ while ((c = reader.read(buf)) > 0) {
+ buffer.append(buf, 0, c);
+ }
+ return buffer.toString();
+ } finally {
+ reader.close();
}
}
+
+ public static String readFile(IFile file) throws CoreException {
+ try {
+ if (file != null && file.isAccessible()) {
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents(),
+ file.getCharset()));
+ return read(reader);
+ }
+ return null;
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(
+ "Failed to read file {0} in project {1}", file.getName(), file.getProject().getName())));
+ }
+ }
+
+ private CoreUtil() {
+ // Do not instantiate
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/Messages.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/Messages.java Thu Sep 02 15:18:58 2010 -0700
@@ -16,26 +16,23 @@
* Assumptions/Requirement/Pre-requisites:
* Failures and causes:
*/
-
package org.symbian.tools.wrttools.util;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-public class Messages {
- private static final String BUNDLE_NAME = "org.symbian.tools.wrttools.util.messages"; //$NON-NLS-1$
+public final class Messages {
+ private static final String BUNDLE_NAME = "org.symbian.tools.wrttools.util.messages"; //$NON-NLS-1$
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
-
- private Messages() {
- }
+ private Messages() {
+ }
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java Thu Sep 02 15:18:58 2010 -0700
@@ -69,11 +69,10 @@
import org.eclipse.wst.validation.ValidationFramework;
import org.symbian.tools.wrttools.Activator;
import org.symbian.tools.wrttools.WidgetProjectNature;
-import org.symbian.tools.wrttools.core.packager.WRTPackagerConstants;
import org.symbian.tools.wrttools.wizards.WrtLibraryWizardPage;
@SuppressWarnings("restriction")
-public class ProjectUtils {
+public final class ProjectUtils {
public static final String EXCLUDE_MARKER_ID = "org.symbian.tools.wrttools.excluded";
private static final class FocusOnProjectJob extends Job {
@@ -363,7 +362,6 @@
public static void exclude(IResource resource) {
try {
resource.createMarker(EXCLUDE_MARKER_ID);
- resource.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
} catch (CoreException e) {
Activator.log(e);
}
@@ -372,7 +370,6 @@
public static void include(IResource resource) {
try {
IMarker[] markers = resource.findMarkers(EXCLUDE_MARKER_ID, false, IResource.DEPTH_ZERO);
- resource.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, null);
for (IMarker marker : markers) {
marker.delete();
}
@@ -380,4 +377,8 @@
Activator.log(e);
}
}
+
+ private ProjectUtils() {
+ // Do not instantiate
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/RegexpValidator.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/RegexpValidator.java Thu Sep 02 15:18:58 2010 -0700
@@ -28,26 +28,27 @@
import org.symbian.tools.wrttools.Activator;
public class RegexpValidator implements IValidator {
- private final String errorMessage;
- private Pattern pattern;
- private final boolean match;
+ private final String errorMessage;
+ private final Pattern pattern;
+ private final boolean match;
- public RegexpValidator(String pattern, String errorMessage, boolean match) {
- this.errorMessage = errorMessage;
- this.match = match;
- this.pattern = Pattern.compile(pattern);
- }
+ public RegexpValidator(String pattern, String errorMessage, boolean match) {
+ this.errorMessage = errorMessage;
+ this.match = match;
+ this.pattern = Pattern.compile(pattern);
+ }
- public IStatus validate(Object value) {
- String string = value.toString();
- Matcher matcher = pattern.matcher(string);
- if (match && !matcher.matches()) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(errorMessage, string));
- } else if (!match && matcher.find()) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(errorMessage, string.substring(matcher.start(), matcher.end())));
- } else {
- return Status.OK_STATUS;
- }
- }
+ public IStatus validate(Object value) {
+ String string = value.toString();
+ Matcher matcher = pattern.matcher(string);
+ if (match && !matcher.matches()) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(errorMessage, string));
+ } else if (!match && matcher.find()) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(errorMessage,
+ string.substring(matcher.start(), matcher.end())));
+ } else {
+ return Status.OK_STATUS;
+ }
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/Util.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/Util.java Thu Sep 02 15:18:58 2010 -0700
@@ -18,9 +18,7 @@
*/
package org.symbian.tools.wrttools.util;
-
-public class Util {
-
+public final class Util {
public static String removeSpaces(String widgetName) {
return widgetName != null ? widgetName.replace(" ", "") : "";
}
@@ -96,4 +94,8 @@
return null;
}
+
+ private Util() {
+ // Do not instantiate
+ }
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/NewWrtAppTemplatePage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/NewWrtAppTemplatePage.java Thu Sep 02 15:18:58 2010 -0700
@@ -30,7 +30,7 @@
/**
* Entry for the basic template parameters.
- *
+ *
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
public class NewWrtAppTemplatePage extends AbstractNewApplicationWizardPage {
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/ArchivedProject.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/ArchivedProject.java Thu Sep 02 15:18:58 2010 -0700
@@ -39,10 +39,10 @@
@SuppressWarnings("restriction")
public class ArchivedProject implements ProjectRecord {
- public boolean hasConflicts;
- public int level;
- public Object parent;
- public Object dotProject;
+ private boolean hasConflicts;
+ private final int level;
+ private final Object parent;
+ private final Object dotProject;
private String projectName;
private final ILeveledImportStructureProvider provider;
private IProjectDescription description;
@@ -68,7 +68,7 @@
/**
* Get the name of the project
- *
+ *
* @return String
*/
public String getProjectName() {
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/FileSystemProject.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/FileSystemProject.java Thu Sep 02 15:18:58 2010 -0700
@@ -49,7 +49,7 @@
/**
* Create a record for a project based on the info in the file.
- *
+ *
* @param file
*/
public FileSystemProject(File location) {
@@ -77,9 +77,8 @@
}
/**
- * Gets the label to be used when rendering this project record in the
- * UI.
- *
+ * Gets the label to be used when rendering this project record in the UI.
+ *
* @return String the label
* @since 3.4
*/
@@ -99,7 +98,7 @@
/**
* Returns whether the given project description file path is in the
* default location for a project
- *
+ *
* @param path
* The path to examine
* @return Whether the given path is the default location for a project
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/ProjectRecord.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/ProjectRecord.java Thu Sep 02 15:18:58 2010 -0700
@@ -36,4 +36,4 @@
void setHasConflicts(boolean b);
ImportOperation getImportOperation(IProject project, ILeveledImportStructureProvider structureProvider,
IOverwriteQuery query);
-}
\ No newline at end of file
+}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/WrtProjectLocationWizardPage.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/WrtProjectLocationWizardPage.java Thu Sep 02 15:18:58 2010 -0700
@@ -92,13 +92,7 @@
@SuppressWarnings({ "restriction", "unchecked", "rawtypes" })
public class WrtProjectLocationWizardPage extends WizardPage implements IOverwriteQuery {
-
- /**
- * @since 3.5
- *
- */
private final class ProjectLabelProvider extends LabelProvider implements IColorProvider {
-
public Color getBackground(Object element) {
return null;
}
@@ -132,16 +126,12 @@
// the wizard was invoked.
private static String previouslyBrowsedDirectory = ""; //$NON-NLS-1$
- private final static String STORE_ARCHIVE_SELECTED = "WizardProjectsImportPage.STORE_ARCHIVE_SELECTED"; //$NON-NLS-1$
+ private static final String STORE_ARCHIVE_SELECTED = "WizardProjectsImportPage.STORE_ARCHIVE_SELECTED"; //$NON-NLS-1$
private Text archivePathField;
-
private Button browseArchivesButton;
-
private Button browseDirectoriesButton;
-
- List createdProjects;
-
+ private List createdProjects;
private Text directoryPathField;
// The last time that the file or folder at the selected path was modified
@@ -160,7 +150,7 @@
/**
* The import structure provider.
- *
+ *
* @since 3.4
*/
private ILeveledImportStructureProvider structureProvider;
@@ -189,7 +179,7 @@
/**
* Collect the list of .project files that are under directory into files.
- *
+ *
* @param files
* @param directory
* @param directoriesVisited
@@ -253,7 +243,7 @@
/**
* Collect the list of .project files that are under directory into files.
- *
+ *
* @param files
* @param monitor
* The monitor to report to
@@ -292,13 +282,6 @@
return true;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
- * .Composite)
- */
public void createControl(Composite parent) {
initializeDialogUnits(parent);
@@ -319,7 +302,7 @@
/**
* Create the project described in record. If it is successful return true.
- *
+ *
* @param record
* @return boolean <code>true</code> if successful
* @throws InterruptedException
@@ -348,7 +331,7 @@
/**
* Create the selected projects
- *
+ *
* @return boolean <code>true</code> if all project creations were
* successful.
*/
@@ -397,7 +380,7 @@
/**
* Create the checkbox list for the found projects.
- *
+ *
* @param workArea
*/
private void createProjectsList(Composite workArea) {
@@ -421,67 +404,24 @@
gridData.heightHint = new PixelConverter(projectsList.getControl()).convertHeightInCharsToPixels(10);
projectsList.getControl().setLayoutData(gridData);
projectsList.setContentProvider(new ITreeContentProvider() {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
public void dispose() {
-
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java
- * .lang.Object)
- */
public Object[] getChildren(Object parentElement) {
return null;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.IStructuredContentProvider#getElements
- * (java.lang.Object)
- */
public Object[] getElements(Object inputElement) {
return getProjectRecords();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java
- * .lang.Object)
- */
public Object getParent(Object element) {
return null;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java
- * .lang.Object)
- */
public boolean hasChildren(Object element) {
return false;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse
- * .jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@@ -490,13 +430,6 @@
projectsList.setLabelProvider(new ProjectLabelProvider());
projectsList.addCheckStateListener(new ICheckStateListener() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged
- * (org.eclipse.jface.viewers.CheckStateChangedEvent)
- */
public void checkStateChanged(CheckStateChangedEvent event) {
ProjectRecord element = (ProjectRecord) event.getElement();
if (element.hasConflicts()) {
@@ -513,7 +446,7 @@
/**
* Create the area where you select the root directory for the projects.
- *
+ *
* @param workArea
* Composite
*/
@@ -565,12 +498,6 @@
browseArchivesButton.setEnabled(false);
browseDirectoriesButton.addSelectionListener(new SelectionAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetS
- * elected(org.eclipse.swt.events.SelectionEvent)
- */
public void widgetSelected(SelectionEvent e) {
handleLocationDirectoryButtonPressed();
}
@@ -578,13 +505,6 @@
});
browseArchivesButton.addSelectionListener(new SelectionAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
- * .swt.events.SelectionEvent)
- */
public void widgetSelected(SelectionEvent e) {
handleLocationArchiveButtonPressed();
}
@@ -592,32 +512,15 @@
});
directoryPathField.addTraverseListener(new TraverseListener() {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse
- * .swt.events.TraverseEvent)
- */
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_RETURN) {
e.doit = false;
updateProjectsList(directoryPathField.getText().trim());
}
}
-
});
directoryPathField.addFocusListener(new FocusAdapter() {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt
- * .events.FocusEvent)
- */
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
updateProjectsList(directoryPathField.getText().trim());
}
@@ -625,14 +528,6 @@
});
archivePathField.addTraverseListener(new TraverseListener() {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse
- * .swt.events.TraverseEvent)
- */
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_RETURN) {
e.doit = false;
@@ -643,39 +538,18 @@
});
archivePathField.addFocusListener(new FocusAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt
- * .events.FocusEvent)
- */
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
updateProjectsList(archivePathField.getText().trim());
}
});
projectFromDirectoryRadio.addSelectionListener(new SelectionAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
- * .swt.events.SelectionEvent)
- */
public void widgetSelected(SelectionEvent e) {
directoryRadioSelected();
}
});
projectFromArchiveRadio.addSelectionListener(new SelectionAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
- * .swt.events.SelectionEvent)
- */
public void widgetSelected(SelectionEvent e) {
archiveRadioSelected();
}
@@ -684,7 +558,7 @@
/**
* Create the selection buttons in the listComposite.
- *
+ *
* @param listComposite
*/
private void createSelectionButtons(Composite listComposite) {
@@ -716,15 +590,7 @@
Button deselectAll = new Button(buttonsComposite, SWT.PUSH);
deselectAll.setText(DataTransferMessages.DataTransfer_deselectAll);
deselectAll.addSelectionListener(new SelectionAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
- * .swt.events.SelectionEvent)
- */
public void widgetSelected(SelectionEvent e) {
-
projectsList.setCheckedElements(new Object[0]);
setPageComplete(false);
}
@@ -735,13 +601,6 @@
Button refresh = new Button(buttonsComposite, SWT.PUSH);
refresh.setText(DataTransferMessages.DataTransfer_refresh);
refresh.addSelectionListener(new SelectionAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
- * .swt.events.SelectionEvent)
- */
public void widgetSelected(SelectionEvent e) {
if (projectFromDirectoryRadio.getSelection()) {
updateProjectsList(directoryPathField.getText().trim());
@@ -767,7 +626,7 @@
/**
* Display an error dialog with the specified message.
- *
+ *
* @param message
* the error message
*/
@@ -784,7 +643,7 @@
/**
* Method used for test suite.
- *
+ *
* @return Button the Import from Directory RadioButton
*/
public Button getProjectFromDirectoryRadio() {
@@ -796,9 +655,9 @@
* workspace or archive, selected by the user. If a project with the same
* name exists in both the source workspace and the current workspace, then
* the hasConflicts flag would be set on that project record.
- *
+ *
* Method declared public for test suite.
- *
+ *
* @return ProjectRecord[] array of projects that can be imported into the
* workspace
*/
@@ -815,7 +674,7 @@
/**
* Retrieve all the projects in the current workspace.
- *
+ *
* @return IProject[] array of IProject in the current workspace
*/
private IProject[] getProjectsInWorkspace() {
@@ -827,7 +686,7 @@
/**
* Method used for test suite.
- *
+ *
* @return CheckboxTreeViewer the viewer containing all the projects found
*/
public CheckboxTreeViewer getProjectsList() {
@@ -941,7 +800,7 @@
/**
* Determine if the project with the given name is in the current workspace.
- *
+ *
* @param projectName
* String the project name to check
* @return boolean true if the project with the given name is in this
@@ -971,7 +830,7 @@
* The <code>WizardDataTransfer</code> implementation of this
* <code>IOverwriteQuery</code> method asks the user whether the existing
* resource at the given path should be overwritten.
- *
+ *
* @param pathString
* @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>,
* <code>"ALL"</code>, or <code>"CANCEL"</code>
@@ -1017,7 +876,7 @@
* Use the dialog store to restore widget values to the values that they
* held last time this wizard was used to completion, or alternatively, if
* an initial path is specified, use it to select values.
- *
+ *
* Method declared public only for use of tests.
*/
public void restoreWidgetValues() {
@@ -1046,7 +905,7 @@
/**
* Since Finish was pressed, write widget values to the dialog store so that
* they will persist into the next invocation of this wizard page.
- *
+ *
* Method declared public only for use of tests.
*/
public void saveWidgetValues() {
@@ -1073,7 +932,7 @@
/**
* Update the list of projects based on path. Method declared public only
* for test suite.
- *
+ *
* @param path
*/
public void updateProjectsList(final String path) {
@@ -1104,14 +963,6 @@
final boolean dirSelected = this.projectFromDirectoryRadio.getSelection();
try {
getContainer().run(true, true, new IRunnableWithProgress() {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.operation.IRunnableWithProgress#run(org
- * .eclipse.core.runtime.IProgressMonitor)
- */
public void run(IProgressMonitor monitor) {
monitor.beginTask(DataTransferMessages.WizardProjectsImportPage_SearchingMessage, 100);
@@ -1157,10 +1008,7 @@
while (filesIterator.hasNext()) {
selectedProjects[index++] = (ProjectRecord) filesIterator.next();
}
- }
-
- else if (dirSelected && directory.isDirectory()) {
-
+ } else if (dirSelected && directory.isDirectory()) {
if (!collectProjectFilesFromDirectory(files, directory, null, monitor)) {
return;
}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/WrtProjectsImportWizard.java Thu Sep 02 10:50:38 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/WrtProjectsImportWizard.java Thu Sep 02 15:18:58 2010 -0700
@@ -33,48 +33,47 @@
import org.symbian.tools.wrttools.core.WRTImages;
import org.symbian.tools.wrttools.util.ProjectUtils;
-public class WrtProjectsImportWizard extends Wizard implements
- IImportWizard, INewWizard, IExecutableExtension {
+public class WrtProjectsImportWizard extends Wizard implements IImportWizard, INewWizard, IExecutableExtension {
private WrtProjectLocationWizardPage mainPage;
- private IConfigurationElement config;
+ private IConfigurationElement config;
public WrtProjectsImportWizard() {
setWindowTitle("Import WRT Project");
- setNeedsProgressMonitor(true);
+ setNeedsProgressMonitor(true);
setDefaultPageImageDescriptor(WRTImages.importWizardBanner());
}
- @Override
- public boolean performCancel() {
- mainPage.performCancel();
- return true;
- }
+ @Override
+ public boolean performCancel() {
+ mainPage.performCancel();
+ return true;
+ }
- @Override
- public boolean performFinish() {
- if (mainPage.createProjects()) {
- BasicNewProjectResourceWizard.updatePerspective(config);
- List<IProject> projects = mainPage.getCreatedProjects();
- ProjectUtils.focusOn(projects.toArray(new IProject[projects.size()]));
- return true;
- } else {
- return false;
- }
- }
+ @Override
+ public boolean performFinish() {
+ if (mainPage.createProjects()) {
+ BasicNewProjectResourceWizard.updatePerspective(config);
+ List<IProject> projects = mainPage.getCreatedProjects();
+ ProjectUtils.focusOn(projects.toArray(new IProject[projects.size()]));
+ return true;
+ } else {
+ return false;
+ }
+ }
- @Override
- public void addPages() {
+ @Override
+ public void addPages() {
mainPage = new WrtProjectLocationWizardPage();
- addPage(mainPage);
- }
+ addPage(mainPage);
+ }
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // Do nothing
- }
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ // Do nothing
+ }
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) throws CoreException {
- this.config = config;
- }
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+ throws CoreException {
+ this.config = config;
+ }
}