Search in sources :

Example 1 with PluginPackageModel

use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.

the class PluginPackageInputContext method createModel.

@Override
protected IBaseModel createModel(IEditorInput input) throws CoreException {
    PluginPackageModel model = null;
    if (input instanceof IFileEditorInput) {
        IDocument document = getDocumentProvider().getDocument(input);
        IFile file = ((IFileEditorInput) input).getFile();
        model = new PluginPackageModel(file, document, true);
        model.setUnderlyingResource(file);
        model.setCharset(file.getCharset());
        return model;
    }
    return null;
}
Also used : IFile(org.eclipse.core.resources.IFile) IFileEditorInput(org.eclipse.ui.IFileEditorInput) PluginPackageModel(com.liferay.ide.portlet.core.PluginPackageModel) IDocument(org.eclipse.jface.text.IDocument)

Example 2 with PluginPackageModel

use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.

the class PortalDeployExcludesSection method createJarsArray.

protected void createJarsArray() {
    _fJars = new Vector<>();
    PluginPackageModel model = (PluginPackageModel) getPage().getModel();
    String[] excludeJars = model.getPortalDeloyExcludesJars();
    IProject project = getProject();
    IFolder docroot = CoreUtil.getDefaultDocrootFolder(project);
    if ((docroot == null) || ProjectUtil.isMavenProject(project) || ProjectUtil.isExtProject(project)) {
        TablePart tablePart = getTablePart();
        tablePart.setButtonEnabled(_ADD_INDEX, false);
        return;
    }
    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 excludeJarPath = sdkLocation.append(type).append(docroot.getFullPath());
    if (excludeJarPath != null) {
        for (String excludeJar : excludeJars) {
            if (excludeJar.startsWith("**/WEB-INF/lib/")) {
                excludeJar = excludeJar.substring(excludeJar.lastIndexOf("/"));
            }
            File jarFile = new File(excludeJarPath.append("WEB-INF/lib").toFile(), excludeJar.trim());
            if (jarFile.isFile() && jarFile.exists()) {
                _fJars.add(jarFile);
            }
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) PluginPackageModel(com.liferay.ide.portlet.core.PluginPackageModel) IPluginPackageModel(com.liferay.ide.portlet.core.IPluginPackageModel) TablePart(com.liferay.ide.ui.form.TablePart) SDK(com.liferay.ide.sdk.core.SDK) File(java.io.File) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder)

Example 3 with PluginPackageModel

use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.

the class PortalJarsSection 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.removePortalDependencyJars(removedFiles);
    _updateButtons();
}
Also used : IPluginPackageModel(com.liferay.ide.portlet.core.IPluginPackageModel) PluginPackageModel(com.liferay.ide.portlet.core.PluginPackageModel) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 4 with PluginPackageModel

use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.

the class RequiredDeploymentContextsSection 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());
}
Also used : PluginPackageModel(com.liferay.ide.portlet.core.PluginPackageModel) IPluginPackageModel(com.liferay.ide.portlet.core.IPluginPackageModel)

Example 5 with PluginPackageModel

use of com.liferay.ide.portlet.core.PluginPackageModel in project liferay-ide by liferay.

the class RequiredDeploymentContextsSection method createServiceDepsArray.

protected void createServiceDepsArray() {
    _contexts = new Vector<>();
    PluginPackageModel model = (PluginPackageModel) getPage().getModel();
    String[] requiredDeploymentContexts = model.getRequiredDeploymentContexts();
    Collections.addAll(_contexts, requiredDeploymentContexts);
}
Also used : PluginPackageModel(com.liferay.ide.portlet.core.PluginPackageModel) IPluginPackageModel(com.liferay.ide.portlet.core.IPluginPackageModel)

Aggregations

PluginPackageModel (com.liferay.ide.portlet.core.PluginPackageModel)21 IPluginPackageModel (com.liferay.ide.portlet.core.IPluginPackageModel)17 File (java.io.File)6 IPath (org.eclipse.core.runtime.IPath)6 Iterator (java.util.Iterator)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 ExternalFileSelectionDialog (com.liferay.ide.ui.wizard.ExternalFileSelectionDialog)3 IProject (org.eclipse.core.resources.IProject)3 IDocument (org.eclipse.jface.text.IDocument)3 SDK (com.liferay.ide.sdk.core.SDK)2 IFolder (org.eclipse.core.resources.IFolder)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 Shell (org.eclipse.swt.widgets.Shell)2 LiferayProjectSelectionDialog (com.liferay.ide.project.ui.dialog.LiferayProjectSelectionDialog)1 IDEFormEditor (com.liferay.ide.ui.form.IDEFormEditor)1 TablePart (com.liferay.ide.ui.form.TablePart)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1