Search in sources :

Example 1 with ImportLiferayWorkspaceWizard

use of com.liferay.ide.project.ui.workspace.ImportLiferayWorkspaceWizard in project liferay-ide by liferay.

the class ImportLiferayWorkspaceAction method run.

@Override
public void run(IIntroSite site, Properties params) {
    ImportLiferayWorkspaceWizard wizard = new ImportLiferayWorkspaceWizard();
    WizardDialog dialog = new WizardDialog(site.getShell(), wizard);
    if (dialog.open() == Window.OK) {
        IntroPlugin.closeIntro();
    }
}
Also used : ImportLiferayWorkspaceWizard(com.liferay.ide.project.ui.workspace.ImportLiferayWorkspaceWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 2 with ImportLiferayWorkspaceWizard

use of com.liferay.ide.project.ui.workspace.ImportLiferayWorkspaceWizard in project liferay-ide by liferay.

the class ImportLiferayWorkspaceFromInstallerAction method run.

@Override
public void run(IIntroSite site, Properties params) {
    Location platformLocation = Platform.getInstallLocation();
    File location = new File(platformLocation.getURL().getFile());
    if (Platform.getOS().equals(Platform.OS_MACOSX)) {
        location = location.getParentFile().getParentFile();
    }
    IPath path = new Path(location.getAbsolutePath());
    File workspaceDir = path.append("../liferay-workspace").toFile();
    if (!workspaceDir.exists()) {
        MessageDialog.openInformation(site.getShell(), "Liferay", "Can't import liferay workspace.\nDirectory \"" + workspaceDir.getAbsolutePath() + "\" doesn't exist.");
        return;
    }
    Job job = new WorkspaceJob("Importing Liferay Workspace...") {

        @Override
        public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
            ImportLiferayWorkspaceWizard wizard = new ImportLiferayWorkspaceWizard();
            ImportLiferayWorkspaceOp op = wizard.element().nearest(ImportLiferayWorkspaceOp.class);
            op.setWorkspaceLocation(workspaceDir.getAbsolutePath());
            op.setProvisionLiferayBundle(true);
            if (op.validation().ok()) {
                op.execute(ProgressMonitorBridge.create(monitor));
                return Status.OK_STATUS;
            } else {
                return StatusBridge.create(op.validation());
            }
        }
    };
    job.schedule();
    _openLiferayPerspective();
    ProjectExplorerLayoutUtil.setNested(true);
    IntroPlugin.closeIntro();
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) ImportLiferayWorkspaceOp(com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IPath(org.eclipse.core.runtime.IPath) WorkspaceJob(org.eclipse.core.resources.WorkspaceJob) Job(org.eclipse.core.runtime.jobs.Job) WorkspaceJob(org.eclipse.core.resources.WorkspaceJob) File(java.io.File) ImportLiferayWorkspaceWizard(com.liferay.ide.project.ui.workspace.ImportLiferayWorkspaceWizard) Location(org.eclipse.osgi.service.datalocation.Location)

Aggregations

ImportLiferayWorkspaceWizard (com.liferay.ide.project.ui.workspace.ImportLiferayWorkspaceWizard)2 ImportLiferayWorkspaceOp (com.liferay.ide.project.core.workspace.ImportLiferayWorkspaceOp)1 File (java.io.File)1 WorkspaceJob (org.eclipse.core.resources.WorkspaceJob)1 IPath (org.eclipse.core.runtime.IPath)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Path (org.eclipse.core.runtime.Path)1 Job (org.eclipse.core.runtime.jobs.Job)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 Location (org.eclipse.osgi.service.datalocation.Location)1