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);
}
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();
}
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);
}
}
}
}
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);
}
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);
}
Aggregations