--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/LibraryAdditionConfigObject.java Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/internal/projects/LibraryAdditionConfigObject.java Tue Aug 31 15:21:04 2010 -0700
@@ -21,11 +21,15 @@
import java.io.IOException;
import java.io.InputStream;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
@@ -47,11 +51,19 @@
throws CoreException {
IFile file = project.getFile(name);
if (!file.exists()) {
+ createContainers(file.getParent());
file.create(contents, false, monitor);
}
return file;
}
+ private void createContainers(IContainer container) throws CoreException {
+ if (container.getType() == IResource.FOLDER && !container.exists()) {
+ createContainers(container.getParent());
+ ((IFolder) container).create(false, true, new NullProgressMonitor());
+ }
+ }
+
public void addIncludedJsFile(IProject project, IFile file) {
// It is highly likely this code is extremely specific to Symbian web runtime.
// Please open a bug and clarify the requirements
@@ -63,21 +75,25 @@
try {
model = StructuredModelManager.getModelManager().getModelForEdit(page);
if (model instanceof IDOMModel) {
- IDOMDocument document = ((IDOMModel) model).getDocument();
- String path = file.getProjectRelativePath().makeAbsolute().toString();
-
- NodeList scripts = document.getElementsByTagName("script");
+ final IDOMDocument document = ((IDOMModel) model).getDocument();
+ final String path = file.getProjectRelativePath().makeRelative().toString();
+ final NodeList scripts = document.getElementsByTagName("script");
+ boolean hasScript = false;
for (int i = 0; i < scripts.getLength(); i++) {
-
+ if (path.equals(((Element) scripts.item(i)).getAttribute("src"))) {
+ hasScript = true;
+ break;
+ }
}
-
- NodeList heads = document.getElementsByTagName("head");
- if (heads.getLength() > 0) {
- Element el = document.createElement("script");
- el.setAttribute("type", "text/javascript");
- el.setAttribute("src", path);
- heads.item(0).appendChild(el);
- model.save();
+ if (!hasScript) {
+ final NodeList heads = document.getElementsByTagName("head");
+ if (heads.getLength() > 0) {
+ Element el = document.createElement("script");
+ el.setAttribute("type", "text/javascript");
+ el.setAttribute("src", path);
+ heads.item(0).appendChild(el);
+ model.save();
+ }
}
}
} catch (IOException e) {
@@ -92,5 +108,4 @@
}
}
}
-
}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/LibraryInstallDelegate.java Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/LibraryInstallDelegate.java Tue Aug 31 15:21:04 2010 -0700
@@ -34,6 +34,7 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.symbian.tools.tmw.core.TMWCore;
import org.symbian.tools.tmw.core.projects.IProjectSetupConfig;
+import org.symbian.tools.tmw.core.utilities.NonClosingStream;
public abstract class LibraryInstallDelegate implements IDelegate {
@@ -49,8 +50,8 @@
while (en != null) {
if (!en.isDirectory()) {
final IPath entry = new Path(en.getName());
- final IFile f = setupConfig.addFile(project, basePath.append(entry), stream,
- new NullProgressMonitor());
+ final IFile f = setupConfig.addFile(project, basePath.append(entry), new NonClosingStream(
+ stream), new NullProgressMonitor());
if (isIncludeFile(entry)) {
setupConfig.addIncludedJsFile(project, f);
}
--- a/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/ProjectCreationConfigFactory.java Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/runtimes/ProjectCreationConfigFactory.java Tue Aug 31 15:21:04 2010 -0700
@@ -20,14 +20,10 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+import org.symbian.tools.tmw.core.internal.projects.LibraryAdditionConfigObject;
public class ProjectCreationConfigFactory implements IActionConfigFactory {
- // Basically this is an ugly hack. Our project wizard will replace this config
- // object with WizardContext
- public static final Object CONFIG_STANDIN = "standin_config";
-
public Object create() throws CoreException {
- return CONFIG_STANDIN;
+ return new LibraryAdditionConfigObject();
}
-
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/utilities/NonClosingStream.java Tue Aug 31 15:21:04 2010 -0700
@@ -0,0 +1,34 @@
+/**
+ * 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.utilities;
+
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+public final class NonClosingStream extends FilterInputStream {
+ public NonClosingStream(InputStream in) {
+ super(in);
+ }
+
+ @Override
+ public void close() throws IOException {
+ // Avoid closing ZIP file
+ }
+}
\ No newline at end of file
--- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/AbstractPreviewPage.java Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preview/AbstractPreviewPage.java Tue Aug 31 15:21:04 2010 -0700
@@ -25,206 +25,193 @@
import org.symbian.tools.tmw.previewer.Images;
import org.symbian.tools.tmw.previewer.PreviewerPlugin;
-public abstract class AbstractPreviewPage extends Page implements IPreviewPage,
- ISelectionProvider {
- private final IAction refreshAction = new Action("Refresh") {
- public void run() {
- refresh(true);
- };
- };
- private final IAction toggleRefresh = new Action("Toggle Refresh",
- IAction.AS_RADIO_BUTTON) {
- public void run() {
- toggleRefresh();
- };
- };
+public abstract class AbstractPreviewPage extends Page implements IPreviewPage, ISelectionProvider {
+ private final IAction refreshAction = new Action("Refresh") {
+ public void run() {
+ refresh(true);
+ };
+ };
+ private final IAction toggleRefresh = new Action("Toggle Refresh", IAction.AS_RADIO_BUTTON) {
+ public void run() {
+ toggleRefresh();
+ };
+ };
- protected IProject project;
- private Browser browser;
- private boolean toggleState = true;
- private final PreviewView previewView;
- private boolean needsRefresh = false;
+ protected IProject project;
+ private Browser browser;
+ private boolean toggleState = true;
+ private final PreviewView previewView;
+ private boolean needsRefresh = false;
- public AbstractPreviewPage(IProject project, PreviewView previewView) {
- this.project = project;
- this.previewView = previewView;
- }
+ public AbstractPreviewPage(IProject project, PreviewView previewView) {
+ this.project = project;
+ this.previewView = previewView;
+ }
- protected void toggleRefresh() {
- toggleState = !toggleState;
- toggleRefresh.setChecked(toggleState);
- previewView.setProjectAutorefresh(project, toggleState);
- toggleRefresh.setToolTipText(getToggleActionTooltip());
- if (toggleState && needsRefresh) {
- refresh(true);
- }
- }
+ protected void toggleRefresh() {
+ toggleState = !toggleState;
+ toggleRefresh.setChecked(toggleState);
+ previewView.setProjectAutorefresh(project, toggleState);
+ toggleRefresh.setToolTipText(getToggleActionTooltip());
+ if (toggleState && needsRefresh) {
+ refresh(true);
+ }
+ }
- @Override
- public void createControl(Composite parent) {
- browser = createBrowser(parent);
- browser.setLayoutData(new GridData(GridData.FILL_BOTH));
- browser.setUrl(getURI().toASCIIString());
- }
+ @Override
+ public void createControl(Composite parent) {
+ browser = createBrowser(parent);
+ browser.setLayoutData(new GridData(GridData.FILL_BOTH));
+ browser.setUrl(getURI().toASCIIString());
+ }
- protected abstract Browser createBrowser(Composite parent);
+ protected abstract Browser createBrowser(Composite parent);
- private URI getURI() {
- return PreviewerPlugin.getDefault().getHttpPreviewer().previewProject(
- project, null);
- }
+ private URI getURI() {
+ return PreviewerPlugin.getDefault().getHttpPreviewer().previewProject(project, null);
+ }
+
+ @Override
+ public Control getControl() {
+ return browser;
+ }
- @Override
- public Control getControl() {
- return browser;
- }
+ @Override
+ public void setFocus() {
+ if (browser != null && !browser.isDisposed()) {
+ browser.setFocus();
+ }
+ }
- @Override
- public void setFocus() {
- if (browser != null && !browser.isDisposed()) {
- browser.setFocus();
- }
- }
-
- private boolean refreshScheduled = false;
+ private boolean refreshScheduled = false;
- public synchronized void process(Collection<IFile> files) {
- if (!isDisposed() && !refreshScheduled && needsRefresh(files)) {
- asyncExec(new Runnable() {
- public void run() {
- refreshBrowser();
- }
- });
- refreshScheduled = true;
- }
- }
+ public synchronized void process(Collection<IFile> files) {
+ if (!isDisposed() && !refreshScheduled && needsRefresh(files)) {
+ asyncExec(new Runnable() {
+ public void run() {
+ refreshBrowser();
+ }
+ });
+ refreshScheduled = true;
+ }
+ }
- protected void promptIfNeeded() {
- if (toggleState) {
- toggleState = previewView.promptUserToToggle(project, toggleState);
- toggleRefresh.setChecked(toggleState);
- }
- }
+ protected void promptIfNeeded() {
+ if (toggleState) {
+ toggleState = previewView.promptUserToToggle(project, toggleState);
+ toggleRefresh.setChecked(toggleState);
+ }
+ }
- private void asyncExec(Runnable runnable) {
- getControl().getDisplay().asyncExec(runnable);
- }
+ private void asyncExec(Runnable runnable) {
+ getControl().getDisplay().asyncExec(runnable);
+ }
- private boolean needsRefresh(Collection<IFile> files) {
- for (IFile iFile : files) {
- if (iFile.getProject().equals(project)) {
- return true;
- }
- }
- return false;
- }
+ private boolean needsRefresh(Collection<IFile> files) {
+ for (IFile iFile : files) {
+ if (iFile.getProject().equals(project)) {
+ return true;
+ }
+ }
+ return false;
+ }
- protected synchronized void refresh(final boolean manual) {
- try {
- if (!isDisposed()) {
- final Control focusControl = browser.getDisplay()
- .getFocusControl();
- if (manual && CoreUtil.isMac()) {
- browser.getParent().forceFocus();
- }
- browser.setUrl(getURI().toASCIIString());
- refreshAction.setImageDescriptor(PreviewerPlugin
- .getImageDescriptor(Images.GREEN_SYNC));
- asyncExec(new Runnable() {
- public void run() {
- if (!manual && focusControl != null) {
- focusControl.setFocus();
- } else if (manual) {
- browser.forceFocus();
- }
- }
- });
- refreshAction.setToolTipText("Refresh the preview browser");
- }
- needsRefresh = false;
- } finally {
- refreshScheduled = false;
- }
- }
+ protected synchronized void refresh(final boolean manual) {
+ try {
+ if (!isDisposed()) {
+ final Control focusControl = browser.getDisplay().getFocusControl();
+ if (manual && CoreUtil.isMac()) {
+ browser.getParent().forceFocus();
+ }
+ browser.setUrl(getURI().toASCIIString());
+ refreshAction.setImageDescriptor(PreviewerPlugin.getImageDescriptor(Images.GREEN_SYNC));
+ asyncExec(new Runnable() {
+ public void run() {
+ if (!manual && focusControl != null && !focusControl.isDisposed()) {
+ focusControl.setFocus();
+ } else if (manual) {
+ browser.forceFocus();
+ }
+ }
+ });
+ refreshAction.setToolTipText("Refresh the preview browser");
+ }
+ needsRefresh = false;
+ } finally {
+ refreshScheduled = false;
+ }
+ }
- @Override
- public void init(IPageSite pageSite) {
- super.init(pageSite);
- IToolBarManager toolBar = pageSite.getActionBars().getToolBarManager();
+ @Override
+ public void init(IPageSite pageSite) {
+ super.init(pageSite);
+ IToolBarManager toolBar = pageSite.getActionBars().getToolBarManager();
- contributeToToolbar(toolBar);
+ contributeToToolbar(toolBar);
- refreshAction.setImageDescriptor(PreviewerPlugin
- .getImageDescriptor(Images.GREEN_SYNC));
- refreshAction.setToolTipText("Refresh the preview browser");
- toolBar.add(refreshAction);
+ refreshAction.setImageDescriptor(PreviewerPlugin.getImageDescriptor(Images.GREEN_SYNC));
+ refreshAction.setToolTipText("Refresh the preview browser");
+ toolBar.add(refreshAction);
- toggleState = previewView.getProjectAutorefresh(project);
+ toggleState = previewView.getProjectAutorefresh(project);
- toggleRefresh.setImageDescriptor(PreviewerPlugin
- .getImageDescriptor(Images.YELLOW_SYNC));
- toggleRefresh.setToolTipText(getToggleActionTooltip());
- toggleRefresh.setChecked(toggleState);
- toolBar.add(toggleRefresh);
+ toggleRefresh.setImageDescriptor(PreviewerPlugin.getImageDescriptor(Images.YELLOW_SYNC));
+ toggleRefresh.setToolTipText(getToggleActionTooltip());
+ toggleRefresh.setChecked(toggleState);
+ toolBar.add(toggleRefresh);
- pageSite.getActionBars().setGlobalActionHandler(
- ActionFactory.REFRESH.getId(), refreshAction);
- getSite().setSelectionProvider(this);
- }
+ pageSite.getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
+ getSite().setSelectionProvider(this);
+ }
- protected void contributeToToolbar(IToolBarManager toolBar) {
- // Do nothing here
- }
+ protected void contributeToToolbar(IToolBarManager toolBar) {
+ // Do nothing here
+ }
- private String getToggleActionTooltip() {
- return toggleState ? "Disable preview autorefresh"
- : "Enable preview autorefresh";
- }
+ private String getToggleActionTooltip() {
+ return toggleState ? "Disable preview autorefresh" : "Enable preview autorefresh";
+ }
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- // Do nothing
- }
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ // Do nothing
+ }
- public ISelection getSelection() {
- return new StructuredSelection(project);
- }
+ public ISelection getSelection() {
+ return new StructuredSelection(project);
+ }
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
- // Do nothing
- }
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ // Do nothing
+ }
- public void setSelection(ISelection selection) {
- // Do nothing
- }
+ public void setSelection(ISelection selection) {
+ // Do nothing
+ }
- public boolean isDisposed() {
- return browser != null && browser.isDisposed();
- }
+ public boolean isDisposed() {
+ return browser != null && browser.isDisposed();
+ }
- private synchronized void refreshBrowser() {
- if (toggleState) {
- promptIfNeeded();
- }
- if (toggleState) {
- refresh(false);
- } else {
- needsRefresh = true;
- refreshAction.setImageDescriptor(PreviewerPlugin
- .getImageDescriptor(Images.RED_SYNC));
- refreshAction
- .setToolTipText("Refresh the preview browser (there are updated files)");
- }
- }
+ private synchronized void refreshBrowser() {
+ if (toggleState) {
+ promptIfNeeded();
+ }
+ if (toggleState) {
+ refresh(false);
+ } else {
+ needsRefresh = true;
+ refreshAction.setImageDescriptor(PreviewerPlugin.getImageDescriptor(Images.RED_SYNC));
+ refreshAction.setToolTipText("Refresh the preview browser (there are updated files)");
+ }
+ }
- public IProject getProject() {
- return project;
- }
+ public IProject getProject() {
+ return project;
+ }
- public synchronized void projectRenamed(IPath newPath) {
- if (!isDisposed()) {
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- newPath.lastSegment());
- }
- }
+ public synchronized void projectRenamed(IPath newPath) {
+ if (!isDisposed()) {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(newPath.lastSegment());
+ }
+ }
}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/project/ZipInstaller.java Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/project/ZipInstaller.java Tue Aug 31 15:21:04 2010 -0700
@@ -20,7 +20,6 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -53,6 +52,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.symbian.tools.tmw.core.utilities.NonClosingStream;
import org.symbian.tools.tmw.internal.util.OpenFilesRunnable;
import org.symbian.tools.tmw.internal.util.Util;
import org.symbian.tools.tmw.ui.TMWCoreUI;
@@ -211,17 +211,6 @@
return new ByteArrayInputStream(file.toByteArray());
}
- private static final class NonClosingStream extends FilterInputStream {
- private NonClosingStream(InputStream in) {
- super(in);
- }
-
- @Override
- public void close() throws IOException {
- // Avoid closing ZIP file
- }
- }
-
private static final class TemplateContext extends AbstractContext {
private final IProjectTemplateContext context;
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/WizardContext.java Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/WizardContext.java Tue Aug 31 15:21:04 2010 -0700
@@ -2,8 +2,6 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.io.FilterInputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.Collection;
@@ -36,6 +34,7 @@
import org.eclipse.swt.widgets.Text;
import org.symbian.tools.tmw.core.TMWCore;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
+import org.symbian.tools.tmw.core.utilities.NonClosingStream;
import org.symbian.tools.tmw.internal.util.Util;
import org.symbian.tools.tmw.ui.TMWCoreUI;
import org.symbian.tools.tmw.ui.project.IProjectTemplate;
@@ -310,17 +309,6 @@
}
}
- private static final class NonClosingStream extends FilterInputStream {
- private NonClosingStream(InputStream in) {
- super(in);
- }
-
- @Override
- public void close() throws IOException {
- // Avoid closing ZIP file
- }
- }
-
public void addIncludedJsFile(IProject project, IFile file) {
jsIncludes.add(file.getProjectRelativePath().makeRelative().toString());
}
--- a/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/NewApplicationWizard.java Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/NewApplicationWizard.java Tue Aug 31 15:21:04 2010 -0700
@@ -43,7 +43,7 @@
import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
import org.symbian.tools.tmw.core.TMWCore;
import org.symbian.tools.tmw.core.projects.IFProjSupport;
-import org.symbian.tools.tmw.core.runtimes.ProjectCreationConfigFactory;
+import org.symbian.tools.tmw.core.projects.IProjectSetupConfig;
import org.symbian.tools.tmw.internal.ui.wizard.NewApplicationDetailsWizardPage;
import org.symbian.tools.tmw.internal.ui.wizard.NewApplicationFacetsWizardPage;
import org.symbian.tools.tmw.internal.ui.wizard.NewApplicationTemplateWizardPage;
@@ -110,7 +110,7 @@
final Collection<Action> actions = fpjwc.getProjectFacetActions();
final Collection<Action> toReplace = new HashSet<IFacetedProject.Action>();
for (Action action : actions) {
- if (action.getConfig() == ProjectCreationConfigFactory.CONFIG_STANDIN) {
+ if (action.getConfig() instanceof IProjectSetupConfig) {
toReplace.add(action);
}
}
--- a/plugins/org.symbian.tools.wrttools/plugin.xml Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/plugin.xml Tue Aug 31 15:21:04 2010 -0700
@@ -332,12 +332,6 @@
<extension
point="org.symbian.tools.wrttools.jsLibraries">
<library
- icon="icons/main16_prev.gif"
- id="org.symbian.wrtkit"
- installer="org.symbian.tools.wrttools.core.libraries.WRTKitInstaller"
- name="WRTKit">
- </library>
- <library
icon="icons/phonegap.png"
id="phonegap"
installer="org.symbian.tools.wrttools.core.libraries.PhoneGapInstaller"
@@ -360,7 +354,6 @@
<adapt
type="org.eclipse.core.resources.IProject">
</adapt>
-
</with>
</enablement>
@@ -1029,7 +1022,7 @@
<constraint>
<requires
facet="tmw.core"
- ignore-problems="1.0">
+ version="[1.0">
</requires>
</constraint>
<action
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/WRTKitInstaller.java Tue Aug 31 11:58:53 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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.wrttools.core.libraries;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.symbian.tools.wrttools.Activator;
-import org.symbian.tools.wrttools.util.CoreUtil;
-import org.symbian.tools.wrttools.util.ProjectUtils;
-
-public class WRTKitInstaller implements IJSLibraryInstaller {
- private static final String JS_PATH = "WRTKit/WRTKit.js";
-
- public void install(IProject project, Map<String, String> parameters, IProgressMonitor monitor)
- throws CoreException, IOException {
- monitor.beginTask("Installing WRTKit library", 15);
-
- IFolder folder = project.getFolder("WRTKit");
-
- if (folder != null && !folder.exists()) {
- folder.create(false, true, new SubProgressMonitor(monitor, 1));
- }
- InputStream zip = FileLocator.openStream(Activator.getDefault().getBundle(), new Path("/libraries/wrtkit.zip"),
- true);
- ProjectUtils.unzip(zip, folder, 0, "WRTKit", new SubProgressMonitor(monitor, 10));
-
- LibrariesUtils.addJSToHtml(project, "Adding WRTKit Library", new String[] { JS_PATH }, null);
- monitor.done();
- }
-
- public boolean isInstalled(IProject project) {
- final IJavaScriptProject jsProject = JavaScriptCore.create(project);
- return CoreUtil.hasType(jsProject, "NotificationPopup") && CoreUtil.hasType(jsProject, "UIManager");
- }
-}
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/NonClosingStream.java Tue Aug 31 11:58:53 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +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.util;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * This allows blocking the IP clients from closing the stream. This
- * class is needed when creating workbench files from the Zip archives.
- */
-public final class NonClosingStream extends FilterInputStream {
- public NonClosingStream(InputStream in) {
- super(in);
- }
-
- @Override
- public void close() throws IOException {
- // We do not need Eclipse closing the Zip stream
- }
-}
\ No newline at end of file
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/ProjectUtils.java Tue Aug 31 15:21:04 2010 -0700
@@ -19,11 +19,7 @@
package org.symbian.tools.wrttools.util;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
import java.net.URI;
-import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
@@ -31,12 +27,10 @@
import java.util.List;
import java.util.TreeSet;
import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
import javax.swing.filechooser.FileSystemView;
import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
@@ -220,19 +214,6 @@
}
}
- private static void checkParent(IContainer parent) throws CoreException {
- if (parent.getType() == IResource.FOLDER && !parent.exists()) {
- checkParent(parent.getParent());
- ((IFolder) parent).create(false, true, new NullProgressMonitor());
- }
- }
-
- public static void copyFile(IProject project, String name, ZipInputStream stream, long size,
- IProgressMonitor monitor) throws CoreException, IOException {
- IFile file = project.getFile(name);
- file.create(new NonClosingStream(stream), true, new SubProgressMonitor(monitor, 1));
- }
-
public static IProject createWrtProject(String name, URI uri, IProgressMonitor monitor) throws CoreException {
uri = isDefaultProjectLocation(uri) ? null : uri;
monitor.beginTask("Create project resources", 30);
@@ -360,49 +341,6 @@
return !EXCLUDED.contains(fileName);
}
- public static void unzip(String archiveFile, IContainer location, int trimSegments, IProgressMonitor progressMonitor)
- throws IOException, CoreException {
- unzip(new FileInputStream(archiveFile), location, trimSegments, archiveFile, progressMonitor);
- }
-
- public static void unzip(InputStream in, IContainer location, int trimSegments, String label,
- IProgressMonitor progressMonitor) throws IOException, CoreException {
- progressMonitor.beginTask(MessageFormat.format("Unpacking {0}", label), IProgressMonitor.UNKNOWN);
- ZipInputStream stream = new ZipInputStream(in);
- try {
- ZipEntry nextEntry;
- int count = 0;
- while ((nextEntry = stream.getNextEntry()) != null) {
- count++;
- IPath p = new Path(nextEntry.getName()).removeFirstSegments(trimSegments);
- if (!isIgnored(p) && !nextEntry.isDirectory()) {
- IFile file = location.getFile(p);
- checkParent(file.getParent());
- if (file.exists()) {
- file.setContents(new NonClosingStream(stream), false, true, new SubProgressMonitor(
- progressMonitor, 1));
- } else {
- file.create(new NonClosingStream(stream), true, new SubProgressMonitor(progressMonitor, 1));
- }
- }
- }
- if (count == 0) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "Selected archive file does not contain application files"));
- }
- } finally {
- stream.close();
- }
- progressMonitor.done();
- }
-
- private static boolean isIgnored(IPath p) {
- if (p.segmentCount() == 1) {
- return IProjectDescription.DESCRIPTION_FILE_NAME.equals(p.lastSegment());
- }
- return false;
- }
-
public static boolean isExcluded(IResource resource) {
if (resource.getType() == IResource.PROJECT || resource.getType() == IResource.ROOT) {
return false;
--- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WgzImportWizard.java Tue Aug 31 11:58:53 2010 -0700
+++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WgzImportWizard.java Tue Aug 31 15:21:04 2010 -0700
@@ -1,7 +1,6 @@
package org.symbian.tools.wrttools.wizards;
import java.io.File;
-import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
@@ -15,9 +14,7 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -59,12 +56,13 @@
// 2. Unpack archive
boolean success = false;
try {
- ProjectUtils.unzip(archiveName, project, 1, new SubProgressMonitor(
- monitor, 40));
+ // TODO
+ // ProjectUtils.unzip(archiveName, project, 1, new SubProgressMonitor(
+ // monitor, 40));
success = true;
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "Archive unpacking failed", e));
+ // throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ //
+ // } catch (IO"Archive unpacking failed", e));
} finally {
if (!success) {
project.delete(true, true, new NullProgressMonitor());