Author: elvisisking
Date: 2010-09-28 09:50:17 -0400 (Tue, 28 Sep 2010)
New Revision: 25265
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/META-INF/MANIFEST.MF
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Utils.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/BasePublishingHandler.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ShowPublishedLocationsHandler.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/DeleteServerDialog.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java
Log:
JBIDE-6979 Published Locations shell for Modeshape is always shown on 1st monitor. Fixed
that dialog, as well as, Delete Server, and Publishing wizard, which had the same problem.
I was trying to adjust size and position of dialogs and it wasn't working correctly
when 2 monitors are present. Got rid of the code that did that and now letting Eclipse/SWT
do all sizing and positioning.
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/META-INF/MANIFEST.MF
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/META-INF/MANIFEST.MF 2010-09-28
13:49:09 UTC (rev 25264)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/META-INF/MANIFEST.MF 2010-09-28
13:50:17 UTC (rev 25265)
@@ -20,5 +20,6 @@
.
Export-Package: javax.jcr.nodetype,
org.jboss.tools.modeshape.rest,
+ org.modeshape.common.i18n,
org.modeshape.web.jcr.rest.client,
org.modeshape.web.jcr.rest.client.domain
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Utils.java
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Utils.java 2010-09-28
13:49:09 UTC (rev 25264)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Utils.java 2010-09-28
13:50:17 UTC (rev 25265)
@@ -20,9 +20,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISharedImages;
import org.modeshape.common.util.CheckArg;
import org.modeshape.web.jcr.rest.client.Status;
@@ -52,41 +49,6 @@
}
/**
- * Sizes the shell to the minimum of it's current size or the width and height
display percentages.
- *
- * @param shell the shell being resized (if necessary) and located
- * @param widthPercentage a number between 1 and 100 indicating a percentage of the
screen size (defaults to 50 if bad value)
- * @param heightPercentage a number between 1 and 100 indicating a percentage of the
screen size (defaults to 50 if bad value)
- */
- public static void centerAndSizeShellRelativeToDisplay( Shell shell,
- int widthPercentage,
- int heightPercentage ) {
- if ((widthPercentage < 1) || (widthPercentage > 100)) {
- widthPercentage = 50;
- }
-
- if ((heightPercentage < 1) || (heightPercentage > 100)) {
- heightPercentage = 50;
- }
-
- // size
- Rectangle shellBounds = shell.getBounds();
- Rectangle displayBounds = shell.getDisplay().getClientArea();
- int scaledWidth = displayBounds.width * widthPercentage / 100;
- int scaledHeight = displayBounds.height * heightPercentage / 100;
- shell.setSize(Math.min(scaledWidth, shellBounds.width), Math.min(scaledHeight,
shellBounds.height));
- Point size = shell.getSize();
-
- // center
- int excessX = displayBounds.width - size.x;
- int excessY = displayBounds.height - size.y;
- int x = displayBounds.x + (excessX / 2);
- int y = displayBounds.y + (excessY / 2);
-
- shell.setLocation(x, y);
- }
-
- /**
* Converts the non-Eclipse status severity to an Eclipse severity level. An {@link
Status.Severity#UNKNOWN unknown status} is
* converted to {@link IStatus#CANCEL cancel}.
*
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/BasePublishingHandler.java
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/BasePublishingHandler.java 2010-09-28
13:49:09 UTC (rev 25264)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/BasePublishingHandler.java 2010-09-28
13:50:17 UTC (rev 25265)
@@ -24,7 +24,6 @@
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.RestClientI18n;
-import org.jboss.tools.modeshape.rest.Utils;
import org.jboss.tools.modeshape.rest.jobs.PublishJob.Type;
import org.jboss.tools.modeshape.rest.wizards.PublishWizard;
import org.modeshape.web.jcr.rest.client.Status;
@@ -103,7 +102,6 @@
protected void initializeBounds() {
super.initializeBounds();
getShell().setImage(Activator.getDefault().getImage(ModeShape_IMAGE_16x));
- Utils.centerAndSizeShellRelativeToDisplay(getShell(), 75, 75);
}
};
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ShowPublishedLocationsHandler.java
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ShowPublishedLocationsHandler.java 2010-09-28
13:49:09 UTC (rev 25264)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ShowPublishedLocationsHandler.java 2010-09-28
13:50:17 UTC (rev 25265)
@@ -9,9 +9,8 @@
package org.jboss.tools.modeshape.rest.actions;
import java.util.Set;
+import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
@@ -31,31 +30,11 @@
* The <code>ShowPublishedLocationsHandler</code> displays a dialog that
shows information on which ModeShape repositories a
* {@link org.eclipse.core.resources.IFile file} has been published to.
*/
-public final class ShowPublishedLocationsHandler implements IHandler {
+public final class ShowPublishedLocationsHandler extends AbstractHandler {
/**
* {@inheritDoc}
*
- * @see
org.eclipse.core.commands.IHandler#addHandlerListener(org.eclipse.core.commands.IHandlerListener)
- */
- @Override
- public void addHandlerListener( IHandlerListener handlerListener ) {
- // nothing to do
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#dispose()
- */
- @Override
- public void dispose() {
- // nothing to do
- }
-
- /**
- * {@inheritDoc}
- *
* @see
org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
@@ -90,34 +69,4 @@
return null;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#isEnabled()
- */
- @Override
- public boolean isEnabled() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#isHandled()
- */
- @Override
- public boolean isHandled() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.eclipse.core.commands.IHandler#removeHandlerListener(org.eclipse.core.commands.IHandlerListener)
- */
- @Override
- public void removeHandlerListener( IHandlerListener handlerListener ) {
- // nothing to do
- }
-
}
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/DeleteServerDialog.java
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/DeleteServerDialog.java 2010-09-28
13:49:09 UTC (rev 25264)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/DeleteServerDialog.java 2010-09-28
13:50:17 UTC (rev 25265)
@@ -24,7 +24,6 @@
import org.eclipse.swt.widgets.Shell;
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.RestClientI18n;
-import org.jboss.tools.modeshape.rest.Utils;
import org.modeshape.common.util.CheckArg;
import org.modeshape.web.jcr.rest.client.domain.IModeShapeObject;
import org.modeshape.web.jcr.rest.client.domain.Server;
@@ -53,9 +52,9 @@
*/
public DeleteServerDialog( Shell parentShell,
Collection<Server> serversBeingDeleted ) {
- super(parentShell, RestClientI18n.deleteServerDialogTitle.text(),
Activator.getDefault().getImage(ModeShape_IMAGE_16x), null,
- MessageDialog.QUESTION, new String[] {IDialogConstants.OK_LABEL,
IDialogConstants.CANCEL_LABEL}, 0);
-
+ super(parentShell, RestClientI18n.deleteServerDialogTitle.text(),
Activator.getDefault().getImage(ModeShape_IMAGE_16x),
+ null, MessageDialog.QUESTION, new String[] {IDialogConstants.OK_LABEL,
IDialogConstants.CANCEL_LABEL}, 0);
+
CheckArg.isNotNull(serversBeingDeleted, "serversBeingDeleted");
this.serversBeingDeleted = serversBeingDeleted;
@@ -111,15 +110,4 @@
return null;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
- */
- @Override
- protected void initializeBounds() {
- super.initializeBounds();
- Utils.centerAndSizeShellRelativeToDisplay(getShell(), 75, 75);
- }
-
}
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java 2010-09-28
13:49:09 UTC (rev 25264)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java 2010-09-28
13:50:17 UTC (rev 25265)
@@ -49,7 +49,6 @@
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.RestClientI18n;
import org.jboss.tools.modeshape.rest.ServerManager;
-import org.jboss.tools.modeshape.rest.Utils;
import org.modeshape.common.util.CheckArg;
import org.modeshape.web.jcr.rest.client.Status;
import org.modeshape.web.jcr.rest.client.Status.Severity;
@@ -321,17 +320,6 @@
}
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
- */
- @Override
- protected void initializeBounds() {
- super.initializeBounds();
- Utils.centerAndSizeShellRelativeToDisplay(getShell(), 75, 75);
- }
-
//
===========================================================================================================================
// Inner Class
//
===========================================================================================================================