use of org.eclipse.sapphire.modeling.Path 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);
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class ImportSDKProjectsCheckboxCustomPart method updateValidation.
@Override
protected void updateValidation() {
retval = Status.createOkStatus();
Value<Path> sdkLocationPath = _op().getSdkLocation();
Path sdkLocation = sdkLocationPath.content();
if (sdkLocation != null) {
IStatus status = ProjectImportUtil.validateSDKPath(sdkLocation.toPortableString());
if (status.isOK()) {
final int projectsCount = checkBoxViewer.getTable().getItemCount();
final int selectedProjectsCount = checkBoxViewer.getCheckedElements().length;
if (projectsCount == 0) {
retval = Status.createErrorStatus("No available projects can be imported.");
}
if ((projectsCount > 0) && (selectedProjectsCount == 0)) {
retval = Status.createErrorStatus("At least one project must be specified.");
}
}
} else {
retval = Status.createErrorStatus("SDK path cannot be empty");
}
refreshValidation();
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class ProjectLocationValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
int countPossibleWorkspaceSDKProjects = SDKUtil.countPossibleWorkspaceSDKProjects();
if (countPossibleWorkspaceSDKProjects > 1) {
return StatusBridge.create(ProjectCore.createErrorStatus("This workspace has more than one SDK."));
}
Value<Path> sdkLocation = _op().getSdkLocation();
final Path location = sdkLocation.content(true);
if ((location == null) || location.isEmpty()) {
return StatusBridge.create(ProjectCore.createErrorStatus("Liferay Plugins SDK or Maven location is empty."));
}
IStatus buildType = ImportLiferayModuleProjectOpMethods.getBuildType(location.removeFileExtension().toPortableString());
SDK sdk = SDKUtil.createSDKFromLocation(PathBridge.create(location));
if (sdk != null) {
String version = sdk.getVersion();
if (version != null) {
Version sdkVersion = new Version(version);
int result = sdkVersion.compareTo(new Version("6.1.0"));
if (result < 0) {
return StatusBridge.create(ProjectCore.createErrorStatus("This tool doesn't support 6.0.x."));
}
}
} else if (!buildType.getMessage().equals("maven")) {
return StatusBridge.create(ProjectCore.createErrorStatus("Plugins SDK or Maven location is not valid."));
}
return retval;
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class ImportLiferayWorkspaceWizard method performPostFinish.
@Override
protected void performPostFinish() {
super.performPostFinish();
final ImportLiferayWorkspaceOp op = element().nearest(ImportLiferayWorkspaceOp.class);
Path projectPath = op.getWorkspaceLocation().content();
final IProject newProject = CoreUtil.getProject(projectPath.lastSegment());
try {
addToWorkingSets(newProject);
} catch (Exception ex) {
ProjectUI.logError("Unable to add project to working set", ex);
}
openLiferayPerspective(newProject);
ProjectExplorerLayoutUtil.setNested(true);
}
use of org.eclipse.sapphire.modeling.Path in project liferay-ide by liferay.
the class BackupLocationValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
Value<Path> backupLocation = _op().getBackupLocation();
Path location = backupLocation.content();
if (location != null) {
if (!location.isAbsolute()) {
return Status.createErrorStatus("\"" + location.toPortableString() + "\" is not an absolute path.");
}
if (location.toFile().isFile()) {
return Status.createErrorStatus("\"" + location.toPortableString() + "\" is not a folder.");
}
}
return retval;
}
Aggregations