Search in sources :

Example 16 with PluginPackageModel

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

the class PortalJarsSection 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 : IPluginPackageModel(com.liferay.ide.portlet.core.IPluginPackageModel) PluginPackageModel(com.liferay.ide.portlet.core.PluginPackageModel)

Example 17 with PluginPackageModel

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

the class PortalTldsSection method createTldsArray.

protected void createTldsArray() {
    _fTlds = new Vector<>();
    PluginPackageModel model = (PluginPackageModel) getPage().getModel();
    String[] portalTlds = model.getPortalDependencyTlds();
    IPath portalDir = ((PluginPackageEditor) getPage().getEditor()).getPortalDir();
    if (portalDir != null) {
        for (String portalTld : portalTlds) {
            File tldFile = new File(portalDir.append("WEB-INF/tld").toFile(), portalTld.trim());
            if (tldFile.isFile() && tldFile.exists()) {
                _fTlds.add(tldFile);
            }
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) PluginPackageModel(com.liferay.ide.portlet.core.PluginPackageModel) IPluginPackageModel(com.liferay.ide.portlet.core.IPluginPackageModel) File(java.io.File)

Example 18 with PluginPackageModel

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

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

Example 19 with PluginPackageModel

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

the class PortalTldsSection method _handleAdd.

private void _handleAdd() {
    PluginPackageModel model = (PluginPackageModel) getPage().getModel();
    String[] existingTlds = model.getPortalDependencyTlds();
    PluginPackageEditor editor = (PluginPackageEditor) getPage().getEditor();
    IPath portalDir = editor.getPortalDir();
    if (portalDir != null) {
        Shell shell = getPage().getShell();
        PortalTldViewerFilter filter = new PortalTldViewerFilter(portalDir.toFile(), new String[] { "WEB-INF", "WEB-INF/tld" }, existingTlds);
        ExternalFileSelectionDialog dialog = new ExternalFileSelectionDialog(shell, 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 tld = (File) selectedFiles[i];
                    if (tld.exists()) {
                        model.addPortalDependencyTld(tld.getName());
                    }
                }
            } catch (Exception e) {
            }
        }
    } else {
        MessageDialog.openInformation(getPage().getShell(), Msgs.liferayPluginPackageEditor, Msgs.notDeterminePortalDirectory);
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) ExternalFileSelectionDialog(com.liferay.ide.ui.wizard.ExternalFileSelectionDialog) Shell(org.eclipse.swt.widgets.Shell) PluginPackageModel(com.liferay.ide.portlet.core.PluginPackageModel) IPluginPackageModel(com.liferay.ide.portlet.core.IPluginPackageModel) File(java.io.File)

Example 20 with PluginPackageModel

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

the class PortalTldsSection 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)

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