use of com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage in project liferay-ide by liferay.
the class ProblemAction method run.
public void run(final Problem problem, final ISelectionProvider provider) {
final IResource resource = MigrationUtil.getIResourceFromProblem(problem);
WorkspaceJob migrationJob = new WorkspaceJob("Marking migration problem as done") {
public IStatus runInWorkspace(IProgressMonitor monitor) {
IStatus retval = Status.OK_STATUS;
if ((resource != null) && resource.exists()) {
final IMarker marker = resource.getMarker(problem.getMarkerId());
if (marker != null) {
retval = runWithMarker(problem, marker);
if (provider instanceof Viewer) {
final Viewer viewer = (Viewer) provider;
FindBreakingChangesPage page = UpgradeView.getPage(Page.findbreackingchangesPageId, FindBreakingChangesPage.class);
TreeViewer treeViewer = page.getTreeViewer();
UIUtil.async(new Runnable() {
public void run() {
viewer.refresh();
treeViewer.refresh();
}
});
}
} else {
retval = ProjectUI.createErrorStatus("Unable to get marker from file");
}
} else {
retval = ProjectUI.createErrorStatus("Unable to get file from problem");
}
return retval;
}
};
migrationJob.schedule();
}
use of com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage in project liferay-ide by liferay.
the class ProblemAction method refreshTableViewer.
protected void refreshTableViewer() {
FindBreakingChangesPage page = UpgradeView.getPage(Page.findbreackingchangesPageId, FindBreakingChangesPage.class);
TableViewer problemsViewer = page.getProblemsViewer();
UIUtil.async(new Runnable() {
@Override
public void run() {
final Object selection = problemsViewer.getStructuredSelection().getFirstElement();
List<Problem> problems = null;
if (selection instanceof IFile) {
IFile file = (IFile) selection;
problems = MigrationUtil.getProblemsFromResource(file);
} else if (selection instanceof Problem) {
ISelection se = page.getTreeViewer().getSelection();
if (se instanceof TreeSelection) {
problems = MigrationUtil.getCurrentProblemsFromTreeNode((TreeSelection) se);
}
}
if (ListUtil.isNotEmpty(problems)) {
problemsViewer.setInput(problems.toArray());
problemsViewer.setSelection(new StructuredSelection(problems.get(0)));
} else {
problemsViewer.setInput(null);
}
}
});
}
use of com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage in project liferay-ide by liferay.
the class RemoveAction method run.
@Override
public void run() {
// final MigrationView mv = (MigrationView) UIUtil.showView( MigrationView.ID );
// final CommonViewer commonViewer = mv.getCommonViewer();
final FindBreakingChangesPage page = UpgradeView.getPage(Page.findbreackingchangesPageId, FindBreakingChangesPage.class);
final TreeViewer treeViewer = page.getTreeViewer();
Object selection = treeViewer.getStructuredSelection().getFirstElement();
if (selection instanceof MigrationProblems) {
MigrationProblems migrationProblem = (MigrationProblems) selection;
MigrationUtil.removeMigrationProblems(migrationProblem);
IResource project = MigrationUtil.getResourceFromMigrationProblems(migrationProblem);
if (project != null) {
MarkerUtil.clearMarkers(project, MigrationConstants.MARKER_TYPE, null);
}
}
treeViewer.setInput(CoreUtil.getWorkspaceRoot());
treeViewer.expandToLevel(2);
}
use of com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage in project liferay-ide by liferay.
the class MigrateProjectHandler method _setButtonState.
private void _setButtonState(boolean enableState) {
FindBreakingChangesPage page = UpgradeView.getPage(Page.findbreackingchangesPageId, FindBreakingChangesPage.class);
page.setButtonState(enableState);
}
use of com.liferay.ide.project.ui.upgrade.animated.FindBreakingChangesPage in project liferay-ide by liferay.
the class MigrateProjectHandler method refreshViewer.
protected void refreshViewer(List<Problem> allProblems) {
FindBreakingChangesPage page = UpgradeView.getPage(Page.findbreackingchangesPageId, FindBreakingChangesPage.class);
TableViewer problemsViewer = page.get_problemsViewer();
TreeViewer treeViewer = page.getTreeViewer();
UIUtil.async(new Runnable() {
@Override
public void run() {
problemsViewer.setInput(allProblems);
Object currentTreeNode = treeViewer.getStructuredSelection().getFirstElement();
String currentPath = null;
if (currentTreeNode instanceof FileProblems) {
FileProblems currentNode = (FileProblems) currentTreeNode;
File currentFile = currentNode.getFile();
currentPath = currentFile.getAbsolutePath();
}
MigrationContentProvider contentProvider = (MigrationContentProvider) treeViewer.getContentProvider();
MigrationProblemsContainer mc = (MigrationProblemsContainer) contentProvider.getProblems().get(0);
for (MigrationProblems project : mc.getProblemsArray()) {
Iterator<FileProblems> fileProblemItertor = new LinkedList<>(Arrays.asList(project.getProblems())).iterator();
while (fileProblemItertor.hasNext()) {
FileProblems fileProblem = fileProblemItertor.next();
File file = fileProblem.getFile();
String fileAbsolutePath = file.getAbsolutePath();
if (fileAbsolutePath.equals(currentPath)) {
List<Problem> problems = fileProblem.getProblems();
problems.clear();
problems.addAll(allProblems);
break;
}
}
}
}
});
}
Aggregations