Search in sources :

Example 1 with TablePart

use of com.liferay.ide.ui.form.TablePart in project liferay-ide by liferay.

the class PortalDeployExcludesSection method _updateUpDownButtons.

private void _updateUpDownButtons() {
    TablePart tablePart = getTablePart();
    // if (fSortAction.isChecked()) {
    // tablePart.setButtonEnabled(UP_INDEX, false);
    // tablePart.setButtonEnabled(DOWN_INDEX, false);
    // return;
    // }
    TableViewer viewer = getTablePart().getTableViewer();
    Table table = viewer.getTable();
    TableItem[] selection = table.getSelection();
    boolean hasSelection = false;
    if (ListUtil.isNotEmpty(selection)) {
        hasSelection = true;
    }
    boolean canMove = false;
    if ((table.getItemCount() > 1) && (selection.length == 1)) {
        canMove = true;
    }
    tablePart.setButtonEnabled(_UP_INDEX, canMove && isEditable() && hasSelection && table.getSelectionIndex() > 0);
    tablePart.setButtonEnabled(_DOWN_INDEX, canMove && hasSelection && isEditable() && table.getSelectionIndex() < table.getItemCount() - 1);
}
Also used : Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem) TablePart(com.liferay.ide.ui.form.TablePart) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 2 with TablePart

use of com.liferay.ide.ui.form.TablePart in project liferay-ide by liferay.

the class PortalDeployExcludesSection method createClient.

public void createClient(Section section, FormToolkit toolkit) {
    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.MULTI, 2, toolkit);
    TablePart tablePart = getTablePart();
    _fViewer = tablePart.getTableViewer();
    _fViewer.setContentProvider(new PortalJarsContentProvider());
    _fViewer.setLabelProvider(new PortalJarsLabelProvider());
    toolkit.paintBordersFor(container);
    _makeActions();
    section.setClient(container);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.minimumWidth = 250;
    gd.grabExcessVerticalSpace = true;
    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    section.setLayoutData(gd);
    section.setText(Msgs.portalDeployExcludeJars);
    _createSectionToolbar(section);
    initialize();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) TablePart(com.liferay.ide.ui.form.TablePart) GridData(org.eclipse.swt.layout.GridData)

Example 3 with TablePart

use of com.liferay.ide.ui.form.TablePart 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 4 with TablePart

use of com.liferay.ide.ui.form.TablePart in project liferay-ide by liferay.

the class PortalDeployExcludesSection method _updateButtons.

private void _updateButtons() {
    TableViewer viewer = getTablePart().getTableViewer();
    Table table = viewer.getTable();
    TableItem[] selection = table.getSelection();
    boolean hasSelection = false;
    if (ListUtil.isNotEmpty(selection)) {
        hasSelection = true;
    }
    TablePart tablePart = getTablePart();
    tablePart.setButtonEnabled(_ADD_INDEX, isEditable());
    _updateUpDownButtons();
    tablePart.setButtonEnabled(_REMOVE_INDEX, isEditable() && hasSelection);
}
Also used : Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem) TablePart(com.liferay.ide.ui.form.TablePart) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 5 with TablePart

use of com.liferay.ide.ui.form.TablePart in project liferay-ide by liferay.

the class PortalTldsSection method _updateButtons.

private void _updateButtons() {
    TablePart tablePart = getTablePart();
    Table table = tablePart.getTableViewer().getTable();
    TableItem[] selection = table.getSelection();
    boolean hasSelection = false;
    if (ListUtil.isNotEmpty(selection)) {
        hasSelection = true;
    }
    tablePart.setButtonEnabled(_ADD_INDEX, isEditable());
    _updateUpDownButtons();
    tablePart.setButtonEnabled(_REMOVE_INDEX, isEditable() && hasSelection);
}
Also used : Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem) TablePart(com.liferay.ide.ui.form.TablePart)

Aggregations

TablePart (com.liferay.ide.ui.form.TablePart)13 TableItem (org.eclipse.swt.widgets.TableItem)8 Table (org.eclipse.swt.widgets.Table)7 TableViewer (org.eclipse.jface.viewers.TableViewer)6 GridData (org.eclipse.swt.layout.GridData)4 Composite (org.eclipse.swt.widgets.Composite)4 IPluginPackageModel (com.liferay.ide.portlet.core.IPluginPackageModel)1 PluginPackageModel (com.liferay.ide.portlet.core.PluginPackageModel)1 SDK (com.liferay.ide.sdk.core.SDK)1 File (java.io.File)1 IFolder (org.eclipse.core.resources.IFolder)1 IProject (org.eclipse.core.resources.IProject)1 IPath (org.eclipse.core.runtime.IPath)1