plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/ArchivedProject.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Thu, 02 Sep 2010 10:50:38 -0700
changeset 483 109da596fa9d
parent 470 d4809db37847
child 484 f5df819c1852
permissions -rw-r--r--
Fixed relevant FindBug messages
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     1
/**
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     2
 * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     3
 * All rights reserved.
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     8
 *
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     9
 * Initial Contributors:
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    10
 * Symbian Foundation - initial contribution.
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    11
 * Contributors:
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    12
 * Description:
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    13
 * Overview:
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    14
 * Details:
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    15
 * Platforms/Drives/Compatibility:
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    16
 * Assumptions/Requirement/Pre-requisites:
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    17
 * Failures and causes:
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    18
 */
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
package org.symbian.tools.wrttools.wizards.projectimport;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    21
import java.io.BufferedReader;
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
import java.io.IOException;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    23
import java.io.InputStream;
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    24
import java.io.InputStreamReader;
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
import java.net.URI;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
import java.util.List;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    27
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
import org.eclipse.core.resources.IProject;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
import org.eclipse.core.resources.IProjectDescription;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
import org.eclipse.core.resources.ResourcesPlugin;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    31
import org.eclipse.core.runtime.CoreException;
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    32
import org.eclipse.osgi.util.NLS;
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    33
import org.eclipse.ui.dialogs.IOverwriteQuery;
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    34
import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages;
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
import org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    37
import org.symbian.tools.wrttools.util.CoreUtil;
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    38
import org.symbian.tools.wrttools.util.ProjectUtils;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    39
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    40
@SuppressWarnings("restriction")
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    41
public class ArchivedProject implements ProjectRecord {
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    42
    public boolean hasConflicts;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    43
    public int level;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    44
    public Object parent;
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    45
    public Object dotProject;
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    46
    private String projectName;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    47
    private final ILeveledImportStructureProvider provider;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    48
    private IProjectDescription description;
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    49
    private final Object infoPlist;
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    50
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
    /**
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    52
     * @param file
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    53
     *            The Object representing the .project file
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    54
     * @param parent
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    55
     *            The parent folder of the .project file
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    56
     * @param level
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    57
     *            The number of levels deep in the provider the file is
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    58
     */
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    59
    public ArchivedProject(Object infoPlist, Object dotProject, Object parent, int level,
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    60
            ILeveledImportStructureProvider structureProvider) {
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    61
        this.infoPlist = infoPlist;
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    62
        this.dotProject = dotProject;
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    63
        provider = structureProvider;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    64
        this.parent = parent;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    65
        this.level = level;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    66
        setProjectName();
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    67
    }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    68
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    69
    /**
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    70
     * Get the name of the project
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    71
     * 
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    72
     * @return String
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    73
     */
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    74
    public String getProjectName() {
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    75
        return projectName;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    76
    }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    77
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    78
    /**
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    79
     * @return Returns the hasConflicts.
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    80
     */
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    81
    public boolean hasConflicts() {
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    82
        return hasConflicts;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    83
    }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    84
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    85
    /**
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    86
     * Set the name of the project based on the projectFile.
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    87
     */
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    88
    private void setProjectName() {
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    89
        try {
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    90
            if (dotProject != null) {
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    91
                InputStream stream = provider.getContents(dotProject);
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    92
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    93
                // If we can get a description pull the name from there
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    94
                if (stream != null) {
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    95
                    description = ResourcesPlugin.getWorkspace().loadProjectDescription(stream);
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    96
                    stream.close();
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
    97
                    projectName = description.getName();
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    98
                }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    99
            } else {
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
   100
                InputStream stream = provider.getContents(infoPlist);
483
109da596fa9d Fixed relevant FindBug messages
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
   101
                if (stream != null) {
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
   102
                    String manifest = CoreUtil.read(new BufferedReader(new InputStreamReader(stream)));
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
   103
                    projectName = CoreUtil.getApplicationName(manifest);
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
   104
                }
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   105
            }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   106
        } catch (CoreException e) {
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   107
            // no good couldn't get the name
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   108
        } catch (IOException e) {
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   109
            // no good couldn't get the name
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   110
        }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   111
    }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   112
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   113
    @SuppressWarnings("unchecked")
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   114
    public ImportOperation getImportOperation(IProject project, ILeveledImportStructureProvider structureProvider,
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   115
            IOverwriteQuery query) {
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   116
        // import from archive
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   117
        List<Object> fileSystemObjects = structureProvider.getChildren(parent);
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   118
        fileSystemObjects = ProjectUtils.filterExternalProjectEntries(fileSystemObjects);
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   119
        structureProvider.setStrip(level);
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   120
        return new ImportOperation(project.getFullPath(), structureProvider.getRoot(), structureProvider, query,
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   121
                fileSystemObjects);
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   122
    }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   123
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   124
    public URI getLocationURI() {
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   125
        return null;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   126
    }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   127
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   128
    public String getProjectLabel() {
204
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
   129
        String path = provider.getLabel(parent);
fff9c0c94fa4 Import wizard can now import files from any IDE - either filesystem projects or ZIP files
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 200
diff changeset
   130
        return NLS.bind(DataTransferMessages.WizardProjectsImportPage_projectLabel, projectName, path);
200
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   131
    }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   132
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   133
    public void setHasConflicts(boolean hasConflicts) {
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   134
        this.hasConflicts = hasConflicts;
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   135
    }
830136ec8316 Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   136
}