use of com.liferay.ide.project.ui.dialog.CustomProjectSelectionDialog in project liferay-ide by liferay.
the class CustomJspPage method _runConvertAction.
private void _runConvertAction() {
CustomProjectSelectionDialog dialog = new CustomProjectSelectionDialog(UIUtil.getActiveShell());
dialog.setProjects(_getHookProjects());
URL imageUrl = bundle.getEntry("/icons/e16/hook.png");
Image hookImage = ImageDescriptor.createFromURL(imageUrl).createImage();
dialog.setImage(hookImage);
dialog.setTitle("Custom JSP Hook Project");
dialog.setMessage("Select Custom JSP Hook Project");
List<IProject> hookProjects = new ArrayList<>();
if (dialog.open() == Window.OK) {
final Object[] selectedProjects = dialog.getResult();
if (selectedProjects != null) {
for (Object project : selectedProjects) {
if (project instanceof IJavaProject) {
IJavaProject p = (IJavaProject) project;
hookProjects.add(p.getProject());
}
}
}
}
int size = hookProjects.size();
if (size < 1) {
return;
}
String[] sourcePaths = new String[size];
String[] projectNames = new String[size];
for (int i = 0; i < size; i++) {
IProject hookProject = hookProjects.get(i);
sourcePaths[i] = hookProject.getLocation().toOSString();
projectNames[i] = hookProject.getName();
}
CustomJspConverter converter = new CustomJspConverter();
IRuntime liferay70Runtime = _getLiferay70Runtime();
if (liferay70Runtime == null) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Convert Error", "Couldn't find Liferay 7.x Runtime.");
return;
}
String liferay62ServerLocation = _getLiferay62ServerLocation();
if (liferay62ServerLocation == null) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Convert Error", "Couldn't find Liferay 6.2 Runtime.");
return;
}
converter.setLiferay70Runtime(liferay70Runtime);
converter.setLiferay62ServerLocation(liferay62ServerLocation);
converter.setUi(this);
Value<Path> convertedProjectLocation = dataModel.getConvertedProjectLocation();
String targetPath = convertedProjectLocation.content().toPortableString();
boolean liferayWorkapce = false;
if (targetPath.equals(_defaultLocation) && _hasLiferayWorkspace) {
liferayWorkapce = true;
}
converter.doExecute(sourcePaths, projectNames, targetPath, liferayWorkapce);
}
Aggregations