use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.
the class PortalDeployExcludesSection method initialize.
public void initialize() {
PluginPackageModel model = (PluginPackageModel) getPage().getModel();
if (model == null) {
return;
}
_fViewer.setInput(model);
_updateButtons();
model.addModelChangedListener(this);
_fAddAction.setEnabled(model.isEditable());
_fRemoveAction.setEnabled(model.isEditable());
}
use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.
the class PortalDeployExcludesSection method _handleRemove.
@SuppressWarnings("rawtypes")
private void _handleRemove() {
IStructuredSelection ssel = (IStructuredSelection) _fViewer.getSelection();
PluginPackageModel model = (PluginPackageModel) getPage().getModel();
int i = 0;
String[] removedFiles = new String[ssel.size()];
for (Iterator iter = ssel.iterator(); iter.hasNext(); i++) {
removedFiles[i] = ((File) iter.next()).getName();
}
model.removePortalDeployExcludeJar(removedFiles);
_updateButtons();
}
use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.
the class PortalDeployExcludesSection method _handleAdd.
private void _handleAdd() {
PluginPackageModel model = (PluginPackageModel) getPage().getModel();
String[] excludeJars = model.getPortalDeloyExcludesJars();
IProject project = getProject();
IFolder docroot = CoreUtil.getDefaultDocrootFolder(project);
SDK sdk = SDKUtil.getSDK(project);
IPath sdkLocation = sdk.getLocation();
String type;
if (ProjectUtil.isPortletProject(project)) {
type = "portlets";
} else if (ProjectUtil.isHookProject(project)) {
type = "hooks";
} else if (ProjectUtil.isWebProject(project)) {
type = "webs";
} else {
type = StringPool.EMPTY;
}
IPath serviceJarPath = sdkLocation.append(type).append(docroot.getFullPath());
if (serviceJarPath != null) {
Shell shell = getPage().getShell();
PortalJarViewerFilter filter = new PortalJarViewerFilter(serviceJarPath.toFile(), new String[] { "WEB-INF", "WEB-INF/lib" }, excludeJars);
ExternalFileSelectionDialog dialog = new ExternalFileSelectionDialog(shell, filter, true, false);
dialog.setInput(serviceJarPath.toFile());
dialog.create();
if (dialog.open() == Window.OK) {
Object[] selectedFiles = dialog.getResult();
try {
for (int i = 0; i < selectedFiles.length; i++) {
File jar = (File) selectedFiles[i];
if (jar.exists()) {
model.addPortalDeployExcludeJar(jar.getName());
}
}
} catch (Exception e) {
}
}
} else {
MessageDialog.openInformation(getPage().getShell(), Msgs.liferayPluginPackageEditor, Msgs.notDeterminePortalDirectory);
}
}
use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.
the class PortalJarsSection method createJarsArray.
protected void createJarsArray() {
_fJars = new Vector<>();
PluginPackageModel model = (PluginPackageModel) getPage().getModel();
String[] portalJars = model.getPortalDependencyJars();
IPath portalDir = ((PluginPackageEditor) getPage().getEditor()).getPortalDir();
if (portalDir != null) {
for (String portalJar : portalJars) {
File jarFile = new File(portalDir.append("WEB-INF/lib").toFile(), portalJar.trim());
if (jarFile.isFile() && jarFile.exists()) {
_fJars.add(jarFile);
}
}
}
}
use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.
the class PortalJarsSection method _handleAdd.
private void _handleAdd() {
PluginPackageModel model = (PluginPackageModel) getPage().getModel();
String[] existingJars = model.getPortalDependencyJars();
PluginPackageEditor editor = (PluginPackageEditor) getPage().getEditor();
IPath portalDir = editor.getPortalDir();
if (portalDir != null) {
PortalJarViewerFilter filter = new PortalJarViewerFilter(portalDir.toFile(), new String[] { "WEB-INF", "WEB-INF/lib" }, existingJars);
ExternalFileSelectionDialog dialog = new ExternalFileSelectionDialog(getPage().getShell(), filter, true, false);
dialog.setInput(portalDir.toFile());
dialog.create();
if (dialog.open() == Window.OK) {
Object[] selectedFiles = dialog.getResult();
try {
for (int i = 0; i < selectedFiles.length; i++) {
File jar = (File) selectedFiles[i];
if (jar.exists()) {
model.addPortalDependencyJar(jar.getName());
}
}
} catch (Exception e) {
}
}
} else {
MessageDialog.openInformation(getPage().getShell(), Msgs.liferayPluginPackageEditor, Msgs.notDeterminePortalDirectory);
}
}
Aggregations