Search in sources :

Example 6 with FindBreakingChangesPage

use of com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage in project liferay-ide by liferay.

the class RunMigrationToolAction method run.

@Override
public void run() {
    if ((_selection == null) || _selection.isEmpty()) {
        _selection = getSelectionProjects();
    }
    final FindBreakingChangesPage page = UpgradeView.getPage(Page.findbreackingchangesPageId, FindBreakingChangesPage.class);
    if (_selection != null) {
        try {
            Map<String, Object> breakingChangeParameters = new HashMap<>();
            breakingChangeParameters.put("CombineExistedProblem", getCombineExistedProjects());
            UIUtil.executeCommand("com.liferay.ide.project.ui.migrateProject", _selection, breakingChangeParameters);
        } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
            page.setButtonState(true);
            ProjectUI.createErrorStatus("Error in migrate command", e);
        }
    } else {
        page.setButtonState(true);
    }
}
Also used : NotHandledException(org.eclipse.core.commands.NotHandledException) HashMap(java.util.HashMap) FindBreakingChangesPage(com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage) NotDefinedException(org.eclipse.core.commands.common.NotDefinedException) ExecutionException(org.eclipse.core.commands.ExecutionException) NotEnabledException(org.eclipse.core.commands.NotEnabledException)

Example 7 with FindBreakingChangesPage

use of com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage in project liferay-ide by liferay.

the class IgnoreAlwaysAction method run.

@Override
public void run() {
    final Problem problem = MigrationUtil.getProblemFromSelection(getSelection());
    _storeIgnoredProblem(problem);
    new WorkspaceJob("Ignore all problems of this type") {

        public IStatus runInWorkspace(IProgressMonitor monitor) {
            IStatus retval = Status.OK_STATUS;
            try {
                FindBreakingChangesPage page = UpgradeView.getPage(Page.findbreackingchangesPageId, FindBreakingChangesPage.class);
                TreeViewer treeViewer = page.getTreeViewer();
                MigrationContentProvider contentProvider = (MigrationContentProvider) treeViewer.getContentProvider();
                final MigrationProblemsContainer mpContainer = (MigrationProblemsContainer) contentProvider.getProblems().get(0);
                final MigrationProblems[] projectProblem = mpContainer.getProblemsArray();
                for (MigrationProblems pProblem : projectProblem) {
                    FileProblems[] fProblems = pProblem.getProblems();
                    for (FileProblems fp : fProblems) {
                        List<Problem> problems = fp.getProblems();
                        Iterator<Problem> iterator = problems.iterator();
                        while (iterator.hasNext()) {
                            Problem p = iterator.next();
                            if (p.getTicket().equals(problem.getTicket())) {
                                new IgnoreAction().run(p, _provider);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                retval = ProjectUI.createErrorStatus("Unable to get file from problem");
            }
            return retval;
        }
    }.schedule();
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) TreeViewer(org.eclipse.jface.viewers.TreeViewer) FindBreakingChangesPage(com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage) WorkspaceJob(org.eclipse.core.resources.WorkspaceJob) MigrationProblems(com.liferay.ide.project.core.upgrade.MigrationProblems) MigrationProblemsContainer(com.liferay.ide.project.core.upgrade.MigrationProblemsContainer) IOException(java.io.IOException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) FileProblems(com.liferay.ide.project.core.upgrade.FileProblems) Iterator(java.util.Iterator) Problem(com.liferay.blade.api.Problem) List(java.util.List)

Aggregations

FindBreakingChangesPage (com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage)7 TreeViewer (org.eclipse.jface.viewers.TreeViewer)4 MigrationProblems (com.liferay.ide.project.core.upgrade.MigrationProblems)3 List (java.util.List)3 TableViewer (org.eclipse.jface.viewers.TableViewer)3 Problem (com.liferay.blade.api.Problem)2 FileProblems (com.liferay.ide.project.core.upgrade.FileProblems)2 MigrationProblemsContainer (com.liferay.ide.project.core.upgrade.MigrationProblemsContainer)2 Iterator (java.util.Iterator)2 IFile (org.eclipse.core.resources.IFile)2 IResource (org.eclipse.core.resources.IResource)2 WorkspaceJob (org.eclipse.core.resources.WorkspaceJob)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStatus (org.eclipse.core.runtime.IStatus)2 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1