Author: elvisisking
Date: 2011-04-06 12:00:10 -0400 (Wed, 06 Apr 2011)
New Revision: 30384
Modified:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java
Log:
JBIDE-8688 ModeShape Tools' Published Locations Dialog's Table Is Sized Too Small
When It Contains Just A Couple Rows. Table is now being sized by the number of published
locations. When a small number a couple blank rows are added to the size.
Modified:
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java
===================================================================
---
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java 2011-04-06
15:58:42 UTC (rev 30383)
+++
branches/jbosstools-3.2.x/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java 2011-04-06
16:00:10 UTC (rev 30384)
@@ -16,7 +16,9 @@
import static org.jboss.tools.modeshape.rest.IUiConstants.REPOSITORY_IMAGE;
import static org.jboss.tools.modeshape.rest.IUiConstants.SERVER_IMAGE;
import static org.jboss.tools.modeshape.rest.IUiConstants.WORKSPACE_IMAGE;
+
import java.util.Collection;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -46,8 +48,8 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.jboss.tools.modeshape.rest.Activator;
+import org.jboss.tools.modeshape.rest.PublishedResourceHelper.WorkspaceLocation;
import org.jboss.tools.modeshape.rest.RestClientI18n;
-import org.jboss.tools.modeshape.rest.PublishedResourceHelper.WorkspaceLocation;
import org.modeshape.common.util.CheckArg;
import org.modeshape.web.jcr.rest.client.domain.Server;
@@ -136,7 +138,7 @@
RestClientI18n.publishedLocationsDialogMsg.text(file.getFullPath()),
MessageDialog.INFORMATION,
new String[] {IDialogConstants.OK_LABEL}, 0);
- CheckArg.isNotNull(workspaceLocations, "workspaceLocations");
+ CheckArg.isNotNull(workspaceLocations, "workspaceLocations");
//$NON-NLS-1$
this.workspaceLocations = workspaceLocations;
// make sure dialog is resizable
@@ -185,6 +187,12 @@
table.setLayoutData(new GridData(GridData.FILL_BOTH));
table.setHeaderVisible(true);
table.setLinesVisible(true);
+
+ // set height of table
+ ((GridData)table.getLayoutData()).minimumHeight = (table.getItemHeight() * 3);
+ int locations = this.workspaceLocations.size() + 2;
+ int numRows = (locations < 6) ? locations : Math.min(locations, 12);
+ ((GridData)table.getLayoutData()).heightHint = (table.getItemHeight() *
numRows);
// create columns
for (int numCols = COLUMNS.length, i = 0; i < numCols; ++i) {
@@ -347,7 +355,7 @@
// should never get here
assert false;
- return "";
+ return ""; //$NON-NLS-1$
}
/**
Show replies by date