Search in sources :

Example 11 with TablePart

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

the class PortalJarsSection 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 12 with TablePart

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

the class PortalJarsSection method _updateUpDownButtons.

private void _updateUpDownButtons() {
    TablePart tablePart = getTablePart();
    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 13 with TablePart

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

the class RequiredDeploymentContextsSection method _updateButtons.

private void _updateButtons() {
    TableViewer viewer = getTablePart().getTableViewer();
    TableItem[] selection = viewer.getTable().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 : TableItem(org.eclipse.swt.widgets.TableItem) TablePart(com.liferay.ide.ui.form.TablePart) TableViewer(org.eclipse.jface.viewers.TableViewer)

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