use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class AbstractRemoteServerPublisher method processResourceDeltas.
protected void processResourceDeltas(IModuleResourceDelta[] deltas, ZipOutputStream zip, Map<ZipEntry, String> deleteEntries, String deletePrefix, String deltaPrefix, boolean adjustGMTOffset) throws IOException, CoreException {
for (IModuleResourceDelta delta : deltas) {
final int deltaKind = delta.getKind();
final IResource deltaResource = (IResource) delta.getModuleResource().getAdapter(IResource.class);
final IProject deltaProject = deltaResource.getProject();
// IDE-110 IDE-648
final IWebProject lrproject = LiferayCore.create(IWebProject.class, deltaProject);
if (lrproject != null) {
final IFolder webappRoot = lrproject.getDefaultDocrootFolder();
IPath deltaPath = null;
if (webappRoot != null && webappRoot.exists()) {
final IPath deltaFullPath = deltaResource.getFullPath();
final IPath containerFullPath = webappRoot.getFullPath();
deltaPath = new Path(deltaPrefix + deltaFullPath.makeRelativeTo(containerFullPath));
if (deltaPath != null && deltaPath.segmentCount() > 0) {
break;
}
}
if (deltaKind == IModuleResourceDelta.ADDED || deltaKind == IModuleResourceDelta.CHANGED) {
addToZip(deltaPath, deltaResource, zip, adjustGMTOffset);
} else if (deltaKind == IModuleResourceDelta.REMOVED) {
addRemoveProps(deltaPath, deltaResource, zip, deleteEntries, deletePrefix);
} else if (deltaKind == IModuleResourceDelta.NO_CHANGE) {
IModuleResourceDelta[] children = delta.getAffectedChildren();
processResourceDeltas(children, zip, deleteEntries, deletePrefix, deltaPrefix, adjustGMTOffset);
}
}
}
}
use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class AddServiceBuilderOperation method _createServiceBuilderFile.
private IStatus _createServiceBuilderFile(IProject project, IProgressMonitor monitor) {
// IDE-110 IDE-648
IWebProject webproject = LiferayCore.create(IWebProject.class, project);
if ((webproject == null) || (webproject.getDefaultDocrootFolder() == null)) {
return ServiceCore.createErrorStatus("Could not find webapp root folder.");
}
IFolder defaultDocroot = webproject.getDefaultDocrootFolder();
Path path = new Path("WEB-INF/" + getDataModel().getStringProperty(SERVICE_FILE));
IFile serviceBuilderFile = defaultDocroot.getFile(path);
if (FileUtil.notExists(serviceBuilderFile)) {
try {
createDefaultServiceBuilderFile(serviceBuilderFile, monitor);
} catch (Exception ex) {
return ServiceCore.createErrorStatus(ex);
}
}
return Status.OK_STATUS;
}
use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class ThemeDiffResourceListener method shouldProcessResourceDelta.
protected boolean shouldProcessResourceDelta(IResourceDelta delta) {
IPath fullPath = delta.getFullPath();
// IDE-110 IDE-648
IWebProject webproject = LiferayCore.create(IWebProject.class, delta.getResource().getProject());
if ((webproject == null) || (webproject.getDefaultDocrootFolder() == null)) {
return false;
}
IFolder webappRoot = webproject.getDefaultDocrootFolder();
IPath diffPath = webappRoot.getFolder(new Path("_diffs")).getFullPath();
return diffPath.isPrefixOf(fullPath);
}
use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class NewServiceBuilderDataModelProvider method getServiceFile.
protected IFile getServiceFile() {
String serviceFileProperty = getStringProperty(SERVICE_FILE);
IWebProject webproject = LiferayCore.create(IWebProject.class, getTargetProject());
if (CoreUtil.isNullOrEmpty(serviceFileProperty) || (webproject == null)) {
return null;
}
// IDE-110 IDE-648
IResource serviceXmlResource = webproject.findDocrootResource(new Path("WEB-INF/" + serviceFileProperty));
if (FileUtil.exists(serviceXmlResource) && (serviceXmlResource instanceof IFile)) {
return (IFile) serviceXmlResource;
}
return null;
}
use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class HasServiceFilePropertyTester method test.
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof IResource) {
IResource resource = (IResource) receiver;
IWebProject webproject = LiferayCore.create(IWebProject.class, resource.getProject());
if (webproject != null) {
try {
// IDE-110 IDE-648
IResource serviceResource = webproject.findDocrootResource(new Path("WEB-INF/" + ILiferayConstants.SERVICE_XML_FILE));
if (FileUtil.exists(serviceResource)) {
return true;
}
} catch (Throwable t) {
}
}
}
return false;
}
Aggregations