JBoss Tools SVN: r38849 - trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-02-16 17:43:35 -0500 (Thu, 16 Feb 2012)
New Revision: 38849
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/ToolTip.java
Log:
JBIDE-10938 tooltips fail in wizard examples
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/ToolTip.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/ToolTip.java 2012-02-16 21:45:39 UTC (rev 38848)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/ToolTip.java 2012-02-16 22:43:35 UTC (rev 38849)
@@ -462,12 +462,14 @@
CURRENT_TOOLTIP = shell;
control.getShell().addListener(SWT.Deactivate, shellListener);
- shell.addDisposeListener(new DisposeListener() {
+ control.getShell().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
- control.getShell().removeListener(SWT.Deactivate, shellListener);
- control.getShell().removeDisposeListener(this);
+ if (control != null && !control.isDisposed() && control.getShell() != null && !control.getShell().isDisposed()) {
+ control.getShell().removeListener(SWT.Deactivate, shellListener);
+ control.getShell().removeDisposeListener(this);
+ }
}
});
if (popupDelay > 0) {
12 years, 7 months
JBoss Tools SVN: r38847 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: utils and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-16 16:37:37 -0500 (Thu, 16 Feb 2012)
New Revision: 38847
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java
Log:
[JBIDE-10941] made sure viewer.refresh() is called within the UI-thread
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java 2012-02-16 21:00:32 UTC (rev 38846)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java 2012-02-16 21:37:37 UTC (rev 38847)
@@ -14,6 +14,7 @@
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
+import org.jboss.tools.openshift.express.internal.ui.utils.DisposeUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import com.openshift.express.client.IApplication;
@@ -31,8 +32,9 @@
}
/**
- * Operation called when the user clicks on 'Show In>Remote Console'. If no Console/Worker existed, a new one is
- * created, otherwise, it is displayed. {@inheritDoc}
+ * Operation called when the user clicks on 'Show In>Remote Console'. If no
+ * Console/Worker existed, a new one is created, otherwise, it is displayed.
+ * {@inheritDoc}
*/
@Override
public void run() {
@@ -69,7 +71,7 @@
} finally {
monitor.done();
if (viewer != null) {
- viewer.refresh();
+ refresh();
}
}
return Status.OK_STATUS;
@@ -80,7 +82,7 @@
}
}
if (viewer != null) {
- viewer.refresh();
+ refresh();
}
}
@@ -88,4 +90,15 @@
return selection instanceof IApplication;
}
+ private void refresh() {
+ if (!DisposeUtils.isDisposed(viewer))
+ viewer.getControl().getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ viewer.refresh();
+ }
+ });
+ }
+
}
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java 2012-02-16 21:37:37 UTC (rev 38847)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.utils;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Control;
+
+public class DisposeUtils {
+
+ public static boolean isDisposed(Control control) {
+ return control == null
+ || control.isDisposed();
+ }
+
+ public static boolean isDisposed(Viewer viewer) {
+ return viewer == null
+ || isDisposed(viewer.getControl());
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 7 months
JBoss Tools SVN: r38846 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-16 16:00:32 -0500 (Thu, 16 Feb 2012)
New Revision: 38846
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
corrected warning, removed unneeded import
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-16 20:55:13 UTC (rev 38845)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-16 21:00:32 UTC (rev 38846)
@@ -41,7 +41,6 @@
import org.jboss.tools.openshift.express.internal.ui.ImportFailedException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException;
-import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import com.openshift.express.client.IApplication;
import com.openshift.express.client.IEmbeddableCartridge;
12 years, 7 months
JBoss Tools SVN: r38845 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-16 15:55:13 -0500 (Thu, 16 Feb 2012)
New Revision: 38845
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
Log:
[JBIDE-10844] corrected wizard title
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-02-16 20:53:27 UTC (rev 38844)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-02-16 20:55:13 UTC (rev 38845)
@@ -61,7 +61,7 @@
private Text passwordText = null;
public CredentialsWizardPage(IWizard wizard, IUserAwareModel wizardModel) {
- super("Server connection", "Please provide your OpenShift Express credentials.", "Server Connection",
+ super("Sign in to OpenShift", "Please provide your OpenShift Express credentials.", "Server Connection",
wizard);
this.pageModel = new CredentialsWizardPageModel(wizardModel);
}
12 years, 7 months
JBoss Tools SVN: r38844 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-16 15:53:27 -0500 (Thu, 16 Feb 2012)
New Revision: 38844
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
Log:
[JBIDE-10735] added descriptions to new-wizard and import wizard declaration (plugin.xml)
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-02-16 20:03:16 UTC (rev 38843)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-02-16 20:53:27 UTC (rev 38844)
@@ -18,6 +18,7 @@
icon="icons/openshift-logo-white-icon.png"
id="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.createNewApplicationWizard"
name="OpenShift Express Application">
+ <description>Create a new OpenShift Express Application</description>
</wizard>
</extension>
<extension
@@ -32,6 +33,7 @@
icon="icons/openshift-logo-white-icon.png"
id="org.jboss.tools.openshift.express.ui.importExistingApplicationWizard"
name="Existing OpenShift Express Application">
+ <description>Import an existing OpenShift Express Application</description>
</wizard>
</extension>
<extension
@@ -39,7 +41,7 @@
<perspectiveExtension
targetID="org.jboss.tools.common.ui.JBossPerspective">
<newWizardShortcut
- id="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.ImportProjectNewWizard">
+ id="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.createNewApplicationWizard">
</newWizardShortcut>
</perspectiveExtension>
</extension>
12 years, 7 months
JBoss Tools SVN: r38843 - trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-02-16 15:03:16 -0500 (Thu, 16 Feb 2012)
New Revision: 38843
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/ToolTip.java
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/DescriptionToolTip.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
Log:
JBIDE-10938 tooltips fail in wizard examples
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/DescriptionToolTip.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/DescriptionToolTip.java 2012-02-16 19:56:21 UTC (rev 38842)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/DescriptionToolTip.java 2012-02-16 20:03:16 UTC (rev 38843)
@@ -11,7 +11,6 @@
package org.jboss.tools.central.editors;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.window.ToolTip;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2012-02-16 19:56:21 UTC (rev 38842)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2012-02-16 20:03:16 UTC (rev 38843)
@@ -929,7 +929,7 @@
categoryComposite.setClient(composite);
String description = category.getDescription();
if (description != null && !description.isEmpty() && categoryComposite.getControl() != null) {
- final ToolTip toolTip = new DescriptionToolTip(categoryComposite.getControl(), description);
+ final DescriptionToolTip toolTip = new DescriptionToolTip(categoryComposite.getControl(), description);
toolTip.activate();
}
}
@@ -957,7 +957,7 @@
private void hookTooltip(FormText tutorialText, ProjectExample tutorial) {
final String description = JBossCentralActivator.getDefault().getDescription(tutorial);
if (description != null && !description.isEmpty()) {
- ToolTip toolTip = new DescriptionToolTip(tutorialText, description);
+ DescriptionToolTip toolTip = new DescriptionToolTip(tutorialText, description);
toolTip.activate();
}
}
Added: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/ToolTip.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/ToolTip.java (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/ToolTip.java 2012-02-16 20:03:16 UTC (rev 38843)
@@ -0,0 +1,681 @@
+package org.jboss.tools.central.editors;
+
+import java.util.HashMap;
+
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * This class gives implementors to provide customized tooltips for any control.
+ *
+ * @since 3.3
+ */
+public abstract class ToolTip {
+ private Control control;
+
+ private int xShift = 3;
+
+ private int yShift = 0;
+
+ private int popupDelay = 0;
+
+ private int hideDelay = 0;
+
+ private ToolTipOwnerControlListener listener;
+
+ private HashMap data;
+
+ // Ensure that only one tooltip is active in time
+ private static Shell CURRENT_TOOLTIP;
+
+ /**
+ * Recreate the tooltip on every mouse move
+ */
+ public static final int RECREATE = 1;
+
+ /**
+ * Don't recreate the tooltip as long the mouse doesn't leave the area
+ * triggering the tooltip creation
+ */
+ public static final int NO_RECREATE = 1 << 1;
+
+ private TooltipHideListener hideListener = new TooltipHideListener();
+
+ private Listener shellListener;
+
+ private boolean hideOnMouseDown = true;
+
+ private boolean respectDisplayBounds = true;
+
+ private boolean respectMonitorBounds = true;
+
+ private int style;
+
+ private Object currentArea;
+
+ /**
+ * Create new instance which add TooltipSupport to the widget
+ *
+ * @param control
+ * the control on whose action the tooltip is shown
+ */
+ public ToolTip(Control control) {
+ this(control, RECREATE, false);
+ }
+
+ /**
+ * @param control
+ * the control to which the tooltip is bound
+ * @param style
+ * style passed to control tooltip behavior
+ *
+ * @param manualActivation
+ * <code>true</code> if the activation is done manually using
+ * {@link #show(Point)}
+ * @see #RECREATE
+ * @see #NO_RECREATE
+ */
+ public ToolTip(Control control, int style, boolean manualActivation) {
+ this.control = control;
+ this.style = style;
+ this.control.addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ data = null;
+ deactivate();
+ }
+
+ });
+
+ this.listener = new ToolTipOwnerControlListener();
+ this.shellListener = new Listener() {
+ public void handleEvent(final Event event) {
+ if (ToolTip.this.control != null
+ && !ToolTip.this.control.isDisposed()) {
+ ToolTip.this.control.getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ // Check if the new active shell is the tooltip
+ // itself
+ if (ToolTip.this.control.getDisplay()
+ .getActiveShell() != CURRENT_TOOLTIP) {
+ toolTipHide(CURRENT_TOOLTIP, event);
+ }
+ }
+
+ });
+ }
+ }
+ };
+
+ if (!manualActivation) {
+ activate();
+ }
+ }
+
+ /**
+ * Restore arbitrary data under the given key
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
+ */
+ public void setData(String key, Object value) {
+ if (data == null) {
+ data = new HashMap();
+ }
+ data.put(key, value);
+ }
+
+ /**
+ * Get the data restored under the key
+ *
+ * @param key
+ * the key
+ * @return data or <code>null</code> if no entry is restored under the key
+ */
+ public Object getData(String key) {
+ if (data != null) {
+ return data.get(key);
+ }
+ return null;
+ }
+
+ /**
+ * Set the shift (from the mouse position triggered the event) used to
+ * display the tooltip.
+ * <p>
+ * By default the tooltip is shifted 3 pixels to the right.
+ * </p>
+ *
+ * @param p
+ * the new shift
+ */
+ public void setShift(Point p) {
+ xShift = p.x;
+ yShift = p.y;
+ }
+
+ /**
+ * Activate tooltip support for this control
+ */
+ public void activate() {
+ deactivate();
+ control.addListener(SWT.Dispose, listener);
+ control.addListener(SWT.MouseHover, listener);
+ control.addListener(SWT.MouseMove, listener);
+ control.addListener(SWT.MouseExit, listener);
+ control.addListener(SWT.MouseDown, listener);
+ control.addListener(SWT.MouseWheel, listener);
+ }
+
+ /**
+ * Deactivate tooltip support for the underlying control
+ */
+ public void deactivate() {
+ control.removeListener(SWT.Dispose, listener);
+ control.removeListener(SWT.MouseHover, listener);
+ control.removeListener(SWT.MouseMove, listener);
+ control.removeListener(SWT.MouseExit, listener);
+ control.removeListener(SWT.MouseDown, listener);
+ control.removeListener(SWT.MouseWheel, listener);
+ }
+
+ /**
+ * Return whether the tooltip respects bounds of the display.
+ *
+ * @return <code>true</code> if the tooltip respects bounds of the display
+ */
+ public boolean isRespectDisplayBounds() {
+ return respectDisplayBounds;
+ }
+
+ /**
+ * Set to <code>false</code> if display bounds should not be respected or
+ * to <code>true</code> if the tooltip is should repositioned to not
+ * overlap the display bounds.
+ * <p>
+ * Default is <code>true</code>
+ * </p>
+ *
+ * @param respectDisplayBounds
+ */
+ public void setRespectDisplayBounds(boolean respectDisplayBounds) {
+ this.respectDisplayBounds = respectDisplayBounds;
+ }
+
+ /**
+ * Return whether the tooltip respects bounds of the monitor.
+ *
+ * @return <code>true</code> if tooltip respects the bounds of the monitor
+ */
+ public boolean isRespectMonitorBounds() {
+ return respectMonitorBounds;
+ }
+
+ /**
+ * Set to <code>false</code> if monitor bounds should not be respected or
+ * to <code>true</code> if the tooltip is should repositioned to not
+ * overlap the monitors bounds. The monitor the tooltip belongs to is the
+ * same is control's monitor the tooltip is shown for.
+ * <p>
+ * Default is <code>true</code>
+ * </p>
+ *
+ * @param respectMonitorBounds
+ */
+ public void setRespectMonitorBounds(boolean respectMonitorBounds) {
+ this.respectMonitorBounds = respectMonitorBounds;
+ }
+
+ /**
+ * Should the tooltip displayed because of the given event.
+ * <p>
+ * <b>Subclasses may overwrite this to get custom behavior</b>
+ * </p>
+ *
+ * @param event
+ * the event
+ * @return <code>true</code> if tooltip should be displayed
+ */
+ protected boolean shouldCreateToolTip(Event event) {
+ if ((style & NO_RECREATE) != 0) {
+ Object tmp = getToolTipArea(event);
+
+ // No new area close the current tooltip
+ if (tmp == null) {
+ hide();
+ return false;
+ }
+
+ boolean rv = !tmp.equals(currentArea);
+ return rv;
+ }
+
+ return true;
+ }
+
+ /**
+ * This method is called before the tooltip is hidden
+ *
+ * @param event
+ * the event trying to hide the tooltip
+ * @return <code>true</code> if the tooltip should be hidden
+ */
+ private boolean shouldHideToolTip(Event event) {
+ if (event != null && event.type == SWT.MouseMove
+ && (style & NO_RECREATE) != 0) {
+ Object tmp = getToolTipArea(event);
+
+ // No new area close the current tooltip
+ if (tmp == null) {
+ hide();
+ return false;
+ }
+
+ boolean rv = !tmp.equals(currentArea);
+ return rv;
+ }
+
+ return true;
+ }
+
+ /**
+ * This method is called to check for which area the tooltip is
+ * created/hidden for. In case of {@link #NO_RECREATE} this is used to
+ * decide if the tooltip is hidden recreated.
+ *
+ * <code>By the default it is the widget the tooltip is created for but could be any object. To decide if
+ * the area changed the {@link Object#equals(Object)} method is used.</code>
+ *
+ * @param event
+ * the event
+ * @return the area responsible for the tooltip creation or
+ * <code>null</code> this could be any object describing the area
+ * (e.g. the {@link Control} onto which the tooltip is bound to, a
+ * part of this area e.g. for {@link ColumnViewer} this could be a
+ * {@link ViewerCell})
+ */
+ protected Object getToolTipArea(Event event) {
+ return control;
+ }
+
+ /**
+ * Start up the tooltip programmatically
+ *
+ * @param location
+ * the location relative to the control the tooltip is shown
+ */
+ public void show(Point location) {
+ Event event = new Event();
+ event.x = location.x;
+ event.y = location.y;
+ event.widget = control;
+ toolTipCreate(event);
+ }
+
+ private Shell toolTipCreate(final Event event) {
+ if (shouldCreateToolTip(event)) {
+ Shell shell = new Shell(control.getShell(), SWT.ON_TOP | SWT.TOOL
+ | SWT.NO_FOCUS);
+ shell.setLayout(new FillLayout());
+
+ toolTipOpen(shell, event);
+
+ return shell;
+ }
+
+ return null;
+ }
+
+ private void toolTipShow(Shell tip, Event event) {
+ if (!tip.isDisposed()) {
+ currentArea = getToolTipArea(event);
+ createToolTipContentArea(event, tip);
+ if (isHideOnMouseDown()) {
+ toolTipHookBothRecursively(tip);
+ } else {
+ toolTipHookByTypeRecursively(tip, true, SWT.MouseExit);
+ }
+
+ tip.pack();
+ Point size = tip.getSize();
+ Point location = fixupDisplayBounds(size, getLocation(size, event));
+
+ // Need to adjust a bit more if the mouse cursor.y == tip.y and
+ // the cursor.x is inside the tip
+ Point cursorLocation = tip.getDisplay().getCursorLocation();
+
+ if (cursorLocation.y == location.y && location.x < cursorLocation.x
+ && location.x + size.x > cursorLocation.x) {
+ location.y -= 2;
+ }
+
+ tip.setLocation(location);
+ tip.setVisible(true);
+ }
+ }
+
+ private Point fixupDisplayBounds(Point tipSize, Point location) {
+ if (respectDisplayBounds || respectMonitorBounds) {
+ Rectangle bounds;
+ Point rightBounds = new Point(tipSize.x + location.x, tipSize.y
+ + location.y);
+
+ Monitor[] ms = control.getDisplay().getMonitors();
+
+ if (respectMonitorBounds && ms.length > 1) {
+ // By default present in the monitor of the control
+ bounds = control.getMonitor().getBounds();
+ Point p = new Point(location.x, location.y);
+
+ // Search on which monitor the event occurred
+ Rectangle tmp;
+ for (int i = 0; i < ms.length; i++) {
+ tmp = ms[i].getBounds();
+ if (tmp.contains(p)) {
+ bounds = tmp;
+ break;
+ }
+ }
+
+ } else {
+ bounds = control.getDisplay().getBounds();
+ }
+
+ if (!(bounds.contains(location) && bounds.contains(rightBounds))) {
+ if (rightBounds.x > bounds.x + bounds.width) {
+ location.x -= rightBounds.x - (bounds.x + bounds.width);
+ }
+
+ if (rightBounds.y > bounds.y + bounds.height) {
+ location.y -= rightBounds.y - (bounds.y + bounds.height);
+ }
+
+ if (location.x < bounds.x) {
+ location.x = bounds.x;
+ }
+
+ if (location.y < bounds.y) {
+ location.y = bounds.y;
+ }
+ }
+ }
+
+ return location;
+ }
+
+ /**
+ * Get the display relative location where the tooltip is displayed.
+ * Subclasses may overwrite to implement custom positioning.
+ *
+ * @param tipSize
+ * the size of the tooltip to be shown
+ * @param event
+ * the event triggered showing the tooltip
+ * @return the absolute position on the display
+ */
+ public Point getLocation(Point tipSize, Event event) {
+ return control.toDisplay(event.x + xShift, event.y + yShift);
+ }
+
+ private void toolTipHide(Shell tip, Event event) {
+ if (tip != null && !tip.isDisposed() && shouldHideToolTip(event)) {
+ if (!control.getShell().isDisposed()) {
+ control.getShell().removeListener(SWT.Deactivate, shellListener);
+ }
+ currentArea = null;
+ passOnEvent(tip, event);
+ tip.dispose();
+ CURRENT_TOOLTIP = null;
+ afterHideToolTip(event);
+ }
+ }
+
+ private void passOnEvent(Shell tip, Event event) {
+ if (control != null && !control.isDisposed() && event != null
+ && event.widget != control && event.type == SWT.MouseDown) {
+ // the following was left in order to fix bug 298770 with minimal change. In 3.7, the complete method should be removed.
+ tip.close();
+ }
+ }
+
+ private void toolTipOpen(final Shell shell, final Event event) {
+ // Ensure that only one Tooltip is shown in time
+ if (CURRENT_TOOLTIP != null) {
+ toolTipHide(CURRENT_TOOLTIP, null);
+ }
+
+ CURRENT_TOOLTIP = shell;
+
+ control.getShell().addListener(SWT.Deactivate, shellListener);
+ shell.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ control.getShell().removeListener(SWT.Deactivate, shellListener);
+ control.getShell().removeDisposeListener(this);
+ }
+ });
+ if (popupDelay > 0) {
+ control.getDisplay().timerExec(popupDelay, new Runnable() {
+ public void run() {
+ toolTipShow(shell, event);
+ }
+ });
+ } else {
+ toolTipShow(CURRENT_TOOLTIP, event);
+ }
+
+ if (hideDelay > 0) {
+ control.getDisplay().timerExec(popupDelay + hideDelay,
+ new Runnable() {
+
+ public void run() {
+ toolTipHide(shell, null);
+ }
+ });
+ }
+ }
+
+ private void toolTipHookByTypeRecursively(Control c, boolean add, int type) {
+ if (add) {
+ c.addListener(type, hideListener);
+ } else {
+ c.removeListener(type, hideListener);
+ }
+
+ if (c instanceof Composite) {
+ Control[] children = ((Composite) c).getChildren();
+ for (int i = 0; i < children.length; i++) {
+ toolTipHookByTypeRecursively(children[i], add, type);
+ }
+ }
+ }
+
+ private void toolTipHookBothRecursively(Control c) {
+ c.addListener(SWT.MouseDown, hideListener);
+ c.addListener(SWT.MouseExit, hideListener);
+
+ if (c instanceof Composite) {
+ Control[] children = ((Composite) c).getChildren();
+ for (int i = 0; i < children.length; i++) {
+ toolTipHookBothRecursively(children[i]);
+ }
+ }
+ }
+
+ /**
+ * Creates the content area of the the tooltip.
+ *
+ * @param event
+ * the event that triggered the activation of the tooltip
+ * @param parent
+ * the parent of the content area
+ * @return the content area created
+ */
+ protected abstract Composite createToolTipContentArea(Event event,
+ Composite parent);
+
+ /**
+ * This method is called after a tooltip is hidden.
+ * <p>
+ * <b>Subclasses may override to clean up requested system resources</b>
+ * </p>
+ *
+ * @param event
+ * event triggered the hiding action (may be <code>null</code>
+ * if event wasn't triggered by user actions directly)
+ */
+ protected void afterHideToolTip(Event event) {
+
+ }
+
+ /**
+ * Set the hide delay.
+ *
+ * @param hideDelay
+ * the delay before the tooltip is hidden. If <code>0</code>
+ * the tooltip is shown until user moves to other item
+ */
+ public void setHideDelay(int hideDelay) {
+ this.hideDelay = hideDelay;
+ }
+
+ /**
+ * Set the popup delay.
+ *
+ * @param popupDelay
+ * the delay before the tooltip is shown to the user. If
+ * <code>0</code> the tooltip is shown immediately
+ */
+ public void setPopupDelay(int popupDelay) {
+ this.popupDelay = popupDelay;
+ }
+
+ /**
+ * Return if hiding on mouse down is set.
+ *
+ * @return <code>true</code> if hiding on mouse down in the tool tip is on
+ */
+ public boolean isHideOnMouseDown() {
+ return hideOnMouseDown;
+ }
+
+ /**
+ * If you don't want the tool tip to be hidden when the user clicks inside
+ * the tool tip set this to <code>false</code>. You maybe also need to
+ * hide the tool tip yourself depending on what you do after clicking in the
+ * tooltip (e.g. if you open a new {@link Shell})
+ *
+ * @param hideOnMouseDown
+ * flag to indicate of tooltip is hidden automatically on mouse
+ * down inside the tool tip
+ */
+ public void setHideOnMouseDown(final boolean hideOnMouseDown) {
+ // Only needed if there's currently a tooltip active
+ if (CURRENT_TOOLTIP != null && !CURRENT_TOOLTIP.isDisposed()) {
+ // Only change if value really changed
+ if (hideOnMouseDown != this.hideOnMouseDown) {
+ control.getDisplay().syncExec(new Runnable() {
+
+ public void run() {
+ if (CURRENT_TOOLTIP != null
+ && CURRENT_TOOLTIP.isDisposed()) {
+ toolTipHookByTypeRecursively(CURRENT_TOOLTIP,
+ hideOnMouseDown, SWT.MouseDown);
+ }
+ }
+
+ });
+ }
+ }
+
+ this.hideOnMouseDown = hideOnMouseDown;
+ }
+
+ /**
+ * Hide the currently active tool tip
+ */
+ public void hide() {
+ toolTipHide(CURRENT_TOOLTIP, null);
+ }
+
+ private class ToolTipOwnerControlListener implements Listener {
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ case SWT.KeyDown:
+ case SWT.MouseDown:
+ case SWT.MouseMove:
+ case SWT.MouseWheel:
+ toolTipHide(CURRENT_TOOLTIP, event);
+ break;
+ case SWT.MouseHover:
+ toolTipCreate(event);
+ break;
+ case SWT.MouseExit:
+ /*
+ * Check if the mouse exit happened because we move over the
+ * tooltip
+ */
+ if (CURRENT_TOOLTIP != null && !CURRENT_TOOLTIP.isDisposed()) {
+ if (CURRENT_TOOLTIP.getBounds().contains(
+ control.toDisplay(event.x, event.y))) {
+ break;
+ }
+ }
+
+ toolTipHide(CURRENT_TOOLTIP, event);
+ break;
+ }
+ }
+ }
+
+ private class TooltipHideListener implements Listener {
+ public void handleEvent(Event event) {
+ if (event.widget instanceof Control) {
+
+ Control c = (Control) event.widget;
+ Shell shell = c.getShell();
+
+ switch (event.type) {
+ case SWT.MouseDown:
+ if (isHideOnMouseDown()) {
+ toolTipHide(shell, event);
+ }
+ break;
+ case SWT.MouseExit:
+ /*
+ * Give some insets to ensure we get exit informations from
+ * a wider area ;-)
+ */
+ Rectangle rect = shell.getBounds();
+ rect.x += 5;
+ rect.y += 5;
+ rect.width -= 10;
+ rect.height -= 10;
+
+ if (!rect.contains(c.getDisplay().getCursorLocation())) {
+ toolTipHide(shell, event);
+ }
+
+ break;
+ }
+ }
+ }
+ }
+}
12 years, 7 months
JBoss Tools SVN: r38842 - in trunk/forge/plugins/org.jboss.tools.forge.runtime.ext: META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-02-16 14:56:21 -0500 (Thu, 16 Feb 2012)
New Revision: 38842
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/MANIFEST.MF
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
Log:
fix compilation problem - take 5
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/MANIFEST.MF 2012-02-16 18:37:50 UTC (rev 38841)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/MANIFEST.MF 2012-02-16 19:56:21 UTC (rev 38842)
@@ -7,3 +7,4 @@
Eclipse-BundleShape: dir
Bundle-Vendor: JBoss by Red Hat
Bundle-ClassPath: bin/
+Require-Bundle: org.jboss.tools.forge.runtime;bundle-version="1.0.0"
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2012-02-16 18:37:50 UTC (rev 38841)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2012-02-16 19:56:21 UTC (rev 38842)
@@ -4,4 +4,3 @@
jars.compile.order = bin/
source.bin/ = src/
output.bin/ = bin/
-additional.bundles = org.jboss.tools.forge.runtime
12 years, 7 months
JBoss Tools SVN: r38841 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-16 13:37:50 -0500 (Thu, 16 Feb 2012)
New Revision: 38841
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
Log:
fixing widget disposed error that was put to log before
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-02-16 18:19:57 UTC (rev 38840)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-02-16 18:37:50 UTC (rev 38841)
@@ -666,7 +666,7 @@
if(result != Dialog.OK) {
final IWizardContainer container = getWizard().getContainer();
if(container instanceof WizardDialog) {
- dbc.dispose();
+ event.doit = false;
((WizardDialog)container).close();
}
}
12 years, 7 months
JBoss Tools SVN: r38840 - in trunk/maven/plugins: org.jboss.tools.maven.core/poms and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-02-16 13:19:57 -0500 (Thu, 16 Feb 2012)
New Revision: 38840
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/poms/jsf-template20.xml
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java
trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java
Log:
JBIDE-10762 : cleaned up mavenification of projects, added JSF 2.0 maven library provider
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/plugin.properties 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/plugin.properties 2012-02-16 18:19:57 UTC (rev 38840)
@@ -6,6 +6,7 @@
Maven_library_provider=Maven library provider
Maven_JSF_1_2_Libraries=Maven JSF 1.2 Libraries
Maven_JSF_1_1_Libraries=Maven JSF 1.1 Libraries
+Maven_JSF_2_0_Libraries=Maven JSF 2.0 Libraries
Hibernate_3_3_2_Libraries=Hibernate 3.3.2 Libraries
Maven_Portlet_1_0_Libraries=Maven Portlet 1.0 Libraries
Maven_Portlet_2_0_Libraries=Maven Portlet 2.0 Libraries
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml 2012-02-16 18:19:57 UTC (rev 38840)
@@ -39,6 +39,10 @@
facet="jst.connector"
soft="true"
version="[1.0"/>
+ <requires
+ facet="jst.webfragment"
+ soft="true"
+ version="[3.0"/>
</or>
</constraint>
</project-facet-version>
@@ -116,8 +120,24 @@
</enablement>
</provider>
</extension>
-
+
<extension point="org.eclipse.jst.common.project.facet.core.libraryProviders">
+ <provider id="jsf20-maven-library-provider" extends="maven-library-provider">
+ <label>%Maven_JSF_2_0_Libraries</label>
+ <param name="template" value="platform:/plugin/org.jboss.tools.maven.core/poms/jsf-template20.xml"/>
+ <enablement>
+ <and>
+ <with variable="projectFacets">
+ <test property="org.jboss.tools.maven.core.projectFacets" value="jst.jsf,jboss.m2" forcePluginActivation="true"/>
+ </with>
+ <with variable="requestingProjectFacet">
+ <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.jsf:2.0" forcePluginActivation="true"/>
+ </with>
+ </and>
+ </enablement>
+ </provider>
+ </extension>
+ <extension point="org.eclipse.jst.common.project.facet.core.libraryProviders">
<provider id="hibernate332-maven-library-provider" extends="maven-library-provider">
<label>%Hibernate_3_3_2_Libraries</label>
<param name="template" value="platform:/plugin/org.jboss.tools.maven.core/poms/hibernate332-template.xml"/>
@@ -170,6 +190,7 @@
</enablement>
</provider>
</extension>
+
<extension point="org.eclipse.jst.common.project.facet.core.libraryProviders">
<provider id="portletbridge200alpha-maven-library-provider" extends="maven-library-provider">
Added: trunk/maven/plugins/org.jboss.tools.maven.core/poms/jsf-template20.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/poms/jsf-template20.xml (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/poms/jsf-template20.xml 2012-02-16 18:19:57 UTC (rev 38840)
@@ -0,0 +1,30 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>template</groupId>
+ <artifactId>template</artifactId>
+ <packaging>pom</packaging>
+ <version>0.0.1-SNAPSHOT</version>
+ <properties>
+ <javaee6.web.spec.version>2.0.0.Final</javaee6.web.spec.version>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-web-6.0</artifactId>
+ <version>${javaee6.web.spec.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec.javax.faces</groupId>
+ <artifactId>jboss-jsf-api_2.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-02-16 18:19:57 UTC (rev 38840)
@@ -49,17 +49,17 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jst.common.project.facet.JavaFacetUtils;
import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.MavenModelManager;
import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.project.IProjectConfigurationManager;
import org.eclipse.m2e.jdt.internal.BuildPathManager;
import org.eclipse.m2e.model.edit.pom.Dependency;
+import org.eclipse.m2e.model.edit.pom.DependencyManagement;
import org.eclipse.m2e.model.edit.pom.PomFactory;
import org.eclipse.m2e.model.edit.pom.PropertyElement;
import org.eclipse.m2e.model.edit.pom.Repository;
@@ -69,7 +69,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.osgi.framework.BundleContext;
/**
@@ -91,6 +91,10 @@
public static final String ENCODING = "UTF-8"; //$NON-NLS-1$
public static final List<LibraryProviderOperationConfig> libraryProviderOperationConfigs = new ArrayList<LibraryProviderOperationConfig>();
+
+ private static final String DEFAULT_COMPILER_LEVEL = "1.5"; //$NON-NLS-1$
+
+ private static final String DEFAULT_WEBCONTENT_ROOT = "src/main/webapp"; //$NON-NLS-1$
// The shared instance
private static MavenCoreActivator plugin;
@@ -165,50 +169,6 @@
}
project.open(monitor);
}
- IJavaProject javaProject = JavaCore.create(project);
- IProjectDescription description = project.getDescription();
- String[] natureIds = description.getNatureIds();
- boolean hasJavaNature = false;
- for (int i = 0; i < natureIds.length; i++) {
- if (JavaCore.NATURE_ID.equals(natureIds[i])) {
- hasJavaNature = true;
- break;
- }
- }
- if (!hasJavaNature) {
- // EAR project
- createFolder("target",monitor, project); //$NON-NLS-1$
- IFolder binFolder = createFolder("target/classes",monitor, project); //$NON-NLS-1$
- String[] newNatureIds = new String[natureIds.length + 1];
- for (int i = 0; i < natureIds.length; i++) {
- newNatureIds[i]=natureIds[i];
- }
- newNatureIds[natureIds.length] = JavaCore.NATURE_ID;
- description.setNatureIds(newNatureIds);
- project.setDescription(description, monitor);
- javaProject.setRawClasspath(new IClasspathEntry[0], monitor);
- javaProject.setOutputLocation(binFolder.getFullPath(), monitor);
- IClasspathEntry entry = JavaRuntime.getDefaultJREContainerEntry();
- IClasspathEntry[] entries = javaProject.getRawClasspath();
- IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
- System.arraycopy(entries, 0, newEntries, 0, entries.length);
- newEntries[entries.length] = entry;
- javaProject.setRawClasspath(newEntries, monitor);
- }
- if (FacetedProjectFramework.hasProjectFacet(project, IJ2EEFacetConstants.ENTERPRISE_APPLICATION)) {
- String sourceDirectory = getSourceDirectory(javaProject);
- if (sourceDirectory == null || sourceDirectory.trim().length() <= 0) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFolder rootVFolder = component.getRootFolder();
- IContainer rootFolder = rootVFolder.getUnderlyingFolder();
- IPath path = rootFolder.getFullPath();
- IClasspathEntry[] entries = javaProject.getRawClasspath();
- IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
- System.arraycopy(entries, 0, newEntries, 0, entries.length);
- newEntries[entries.length] = JavaCore.newSourceEntry(path);
- javaProject.setRawClasspath(newEntries, monitor);
- }
- }
addMavenCapabilities(project, monitor, model);
return project;
}
@@ -254,8 +214,7 @@
boolean hasJavaNature = project.hasNature(JavaCore.NATURE_ID);
if (hasJavaNature) {
IJavaProject javaProject = JavaCore.create(project);
- IClasspathContainer mavenContainer = BuildPathManager
- .getMaven2ClasspathContainer(javaProject);
+ IClasspathContainer mavenContainer = BuildPathManager.getMaven2ClasspathContainer(javaProject);
if (mavenContainer == null) {
IPath path = new Path(BuildPathManager.CONTAINER_ID);
setContainerPath(monitor, javaProject, path);
@@ -325,34 +284,46 @@
public static void updateMavenProjectConfiguration(IProject project)
throws CoreException {
- IProjectConfigurationManager configurationManager = MavenPlugin
- .getDefault().getProjectConfigurationManager();
- configurationManager.updateProjectConfiguration(project,
- new NullProgressMonitor());
+ IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();
+ configurationManager.updateProjectConfiguration(project, new NullProgressMonitor());
}
- public static void addMavenWarPlugin(Build build, IProject project) throws JavaModelException {
- org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
- plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
- plugin.setArtifactId("maven-war-plugin"); //$NON-NLS-1$
-
- Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
+ public static void addMavenWarPlugin(Build build, IProject project, IProjectFacetVersion webFacetversion) throws JavaModelException {
IVirtualComponent component = ComponentCore.createComponent(project);
+ if (component == null) {
+ return;
+ }
IVirtualFolder rootFolder = component.getRootFolder();
IContainer root = rootFolder.getUnderlyingFolder();
String webContentRoot = root.getProjectRelativePath().toString();
- Xpp3Dom warSourceDirectory = new Xpp3Dom("warSourceDirectory"); //$NON-NLS-1$
- if (webContentRoot.startsWith(SEPARATOR)) {
- warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + webContentRoot);
- } else {
- warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + SEPARATOR + webContentRoot);
+ boolean isDefaultWarSource = DEFAULT_WEBCONTENT_ROOT.equals(webContentRoot);
+ boolean needsFailOnMissingWebXml = webFacetversion != null && JavaEEProjectUtilities.DYNAMIC_WEB_25.compareTo(webFacetversion) < 1;
+ if (isDefaultWarSource && !needsFailOnMissingWebXml) {
+ return;
}
- configuration.addChild(warSourceDirectory);
+ org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
+ plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
+ plugin.setArtifactId("maven-war-plugin"); //$NON-NLS-1$
+ plugin.setVersion("2.2");//$NON-NLS-1$
+ Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
+ if (!isDefaultWarSource){
+ Xpp3Dom warSourceDirectory = new Xpp3Dom("warSourceDirectory"); //$NON-NLS-1$
+ if (webContentRoot.startsWith(SEPARATOR)) {
+ warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + webContentRoot);
+ } else {
+ warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + SEPARATOR + webContentRoot);
+ }
+ configuration.addChild(warSourceDirectory);
+ }
+ if (needsFailOnMissingWebXml) {
+ Xpp3Dom failOnMissingWebXml = new Xpp3Dom("failOnMissingWebXml"); //$NON-NLS-1$
+ failOnMissingWebXml.setValue("false");//$NON-NLS-1$
+ configuration.addChild(failOnMissingWebXml);
+ }
+
plugin.setConfiguration(configuration);
build.getPlugins().add(plugin);
-
- addResource(build, project, null);
}
public static void addResource(Build build, IProject project, String sourceDirectory)
@@ -373,34 +344,36 @@
build.getResources().add(resource);
}
- public static void addMavenEarPlugin(Build build, IProject project, IDataModel m2FacetModel, String ejbArtifactId, boolean addModule) throws JavaModelException {
+ public static void addMavenEarPlugin(Build build, IProject project, IDataModel m2FacetModel, String ejbArtifactId,
+ IProjectFacetVersion earFacetVersion, boolean addSeamModules) throws JavaModelException {
String sourceDirectory = getEarRoot(project);
- build.setSourceDirectory(sourceDirectory);
org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
plugin.setArtifactId("maven-ear-plugin"); //$NON-NLS-1$
-
+ plugin.setVersion("2.7");//$NON-NLS-1$
Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
- Xpp3Dom version = new Xpp3Dom("version"); //$NON-NLS-1$
- version.setValue("5"); //$NON-NLS-1$
- configuration.addChild(version);
- Xpp3Dom generateApplicationXml = new Xpp3Dom("generateApplicationXml"); //$NON-NLS-1$
- generateApplicationXml.setValue("true"); //$NON-NLS-1$
- configuration.addChild(generateApplicationXml);
+ if (earFacetVersion != null) {
+ String earVersion = earFacetVersion.getVersionString();
+ if (earVersion.endsWith(".0")) {//$NON-NLS-1$
+ //YYiikes
+ earVersion = ""+Double.valueOf(earVersion).intValue();//$NON-NLS-1$
+ }
+ Xpp3Dom version = new Xpp3Dom("version"); //$NON-NLS-1$
+ version.setValue(earVersion); //$NON-NLS-1$
+ configuration.addChild(version);
+ }
Xpp3Dom defaultLibBundleDir = new Xpp3Dom("defaultLibBundleDir"); //$NON-NLS-1$
defaultLibBundleDir.setValue("lib"); //$NON-NLS-1$
configuration.addChild(defaultLibBundleDir);
- Xpp3Dom earSourceDirectory = new Xpp3Dom("earSourceDirectory"); //$NON-NLS-1$
- earSourceDirectory.setValue(sourceDirectory);
- configuration.addChild(earSourceDirectory);
+ if(!"src/main/application".equals(sourceDirectory)) {//$NON-NLS-1$
+ Xpp3Dom earSourceDirectory = new Xpp3Dom("earSourceDirectory"); //$NON-NLS-1$
+ earSourceDirectory.setValue(sourceDirectory);
+ configuration.addChild(earSourceDirectory);
+ }
- if (addModule) {
+ if (addSeamModules) {
Xpp3Dom modules = new Xpp3Dom("modules"); //$NON-NLS-1$
configuration.addChild(modules);
-
- Xpp3Dom seamModule = getEarModule("ejbModule", "org.jboss.seam", //$NON-NLS-1$ //$NON-NLS-2$
- "jboss-seam", ROOT_DIR, null); //$NON-NLS-1$ //$NON-NLS-2$
- modules.addChild(seamModule);
if (ejbArtifactId != null) {
String ejbModuleName = ejbArtifactId + ".jar"; //$NON-NLS-1$
@@ -432,15 +405,10 @@
"commons-digester", "commons-digester", "/lib", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
modules.addChild(commonDigester);
- //Xpp3Dom mvel14 = getEarModule("jarModule", //$NON-NLS-1$
- // "org.mvel", "mvel14", "/", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- //modules.addChild(mvel14);
}
plugin.setConfiguration(configuration);
build.getPlugins().add(plugin);
-
- addResource(build, project, sourceDirectory);
}
private static Xpp3Dom getEarModule(String module,
@@ -467,20 +435,22 @@
return earModule;
}
- public static void addMavenEjbPlugin(Build build, IProject project) throws JavaModelException {
- org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
- plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
- plugin.setArtifactId("maven-ejb-plugin"); //$NON-NLS-1$
- plugin.setInherited("true"); //$NON-NLS-1$
-
- Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
- Xpp3Dom ejbVersion = new Xpp3Dom("ejbVersion"); //$NON-NLS-1$
- ejbVersion.setValue("3.0"); //$NON-NLS-1$
- configuration.addChild(ejbVersion);
- plugin.setConfiguration(configuration);
- build.getPlugins().add(plugin);
-
- addResource(build, project, null);
+ public static void addMavenEjbPlugin(Build build, IProject project, IProjectFacetVersion ejbFacetVersion) throws JavaModelException {
+ if (ejbFacetVersion != null) {
+ String version = ejbFacetVersion.getVersionString();
+ if (!"2.1".equals(version)) { //$NON-NLS-1$
+ org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
+ plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
+ plugin.setArtifactId("maven-ejb-plugin"); //$NON-NLS-1$
+ plugin.setVersion("2.3"); //$NON-NLS-1$
+ Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
+ Xpp3Dom ejbVersion = new Xpp3Dom("ejbVersion"); //$NON-NLS-1$
+ ejbVersion.setValue(version);
+ configuration.addChild(ejbVersion);
+ plugin.setConfiguration(configuration);
+ build.getPlugins().add(plugin);
+ }
+ }
}
public static String getOutputDirectory(IJavaProject javaProject) throws CoreException {
@@ -512,12 +482,21 @@
addProperties(projectModel,libraryModel);
addRepositories(projectModel,libraryModel);
addPlugins(projectModel,libraryModel);
- addDependencies(projectModel,libraryModel);
+
+ DependencyManagement depMgtProject = projectModel.getDependencyManagement();
+ DependencyManagement depMgtLibrary = libraryModel.getDependencyManagement();
+ if (depMgtLibrary != null && !depMgtLibrary.getDependencies().isEmpty()) {
+ if (depMgtProject == null) {
+ depMgtProject = PomFactory.eINSTANCE.createDependencyManagement();
+ projectModel.setDependencyManagement(depMgtProject);
+ }
+ addDependencies(projectModel.getDependencyManagement().getDependencies(),libraryModel.getDependencyManagement().getDependencies());
+ }
+ //getDependencies() never returns null
+ addDependencies(projectModel.getDependencies(),libraryModel.getDependencies());
}
- private static void addDependencies(org.eclipse.m2e.model.edit.pom.Model projectModel, org.eclipse.m2e.model.edit.pom.Model libraryModel) {
- List<org.eclipse.m2e.model.edit.pom.Dependency> projectDependencies = projectModel.getDependencies();
- List<org.eclipse.m2e.model.edit.pom.Dependency> libraryDependencies = libraryModel.getDependencies();
+ private static void addDependencies(List<org.eclipse.m2e.model.edit.pom.Dependency> projectDependencies , List<org.eclipse.m2e.model.edit.pom.Dependency> libraryDependencies) {
for (Dependency dependency:libraryDependencies) {
if (!dependencyExists(dependency,projectDependencies)) {
Dependency newDependency = (Dependency) EcoreUtil.copy(dependency);
@@ -527,8 +506,7 @@
}
- private static boolean dependencyExists(Dependency dependency,
- List<Dependency> projectDependencies) {
+ private static boolean dependencyExists(Dependency dependency, List<Dependency> projectDependencies) {
String groupId = dependency.getGroupId();
String artifactId = dependency.getArtifactId();
if (artifactId == null) {
@@ -733,12 +711,13 @@
public static void addCompilerPlugin(Build build, IProject project) {
String compilerLevel = JavaFacetUtils.getCompilerLevel(project);
- if (compilerLevel == null) {
+ if (compilerLevel == null || DEFAULT_COMPILER_LEVEL.equals(compilerLevel)) {
return;
}
org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
plugin.setArtifactId("maven-compiler-plugin"); //$NON-NLS-1$
+ plugin.setVersion("2.3.2");
Xpp3Dom configuration = new Xpp3Dom( "configuration" ); //$NON-NLS-1$
Xpp3Dom source = new Xpp3Dom("source"); //$NON-NLS-1$
source.setValue(compilerLevel); //$NON-NLS-1$
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java 2012-02-16 18:19:57 UTC (rev 38840)
@@ -16,10 +16,15 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
/**
* A utility class for Eclipse Projects.
@@ -135,4 +140,20 @@
return relative.replace('\\', '/'); //$NON-NLS-1$ //$NON-NLS-2$
}
+ public static void removeWTPContainers(IDataModel m2FacetModel, IProject project) throws JavaModelException {
+ if (m2FacetModel != null && project != null && m2FacetModel.getBooleanProperty(IJBossMavenConstants.REMOVE_WTP_CLASSPATH_CONTAINERS)) {
+ IJavaProject javaProject = JavaCore.create(project);
+ if(javaProject != null) {
+ // remove classpatch container from JavaProject
+ ArrayList<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
+ for(IClasspathEntry entry : javaProject.getRawClasspath()) {
+ String path = entry.getPath().toString();
+ if(path != null && !path.startsWith("org.eclipse.jst.j2ee.internal.")) {
+ newEntries.add(entry);
+ }
+ }
+ javaProject.setRawClasspath(newEntries.toArray(new IClasspathEntry[newEntries.size()]), null);
+ }
+ }
+ }
}
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java 2012-02-16 18:19:57 UTC (rev 38840)
@@ -98,8 +98,8 @@
}
}
if(propertyName.equals(IJBossMavenConstants.PACKAGING)){
- String groupId = getStringProperty(IJBossMavenConstants.PACKAGING);
- if (groupId == null || groupId.trim().length() <= 0) {
+ String packaging = getStringProperty(IJBossMavenConstants.PACKAGING);
+ if (packaging == null || packaging.trim().length() <= 0) {
status = new Status(IStatus.ERROR, MavenCoreActivator.PLUGIN_ID , Messages.MavenFacetInstallPage_The_packaging_field_is_required);
}
}
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java 2012-02-16 18:19:57 UTC (rev 38840)
@@ -40,6 +40,7 @@
import org.jboss.tools.maven.core.IJBossMavenConstants;
import org.jboss.tools.maven.core.MavenCoreActivator;
import org.jboss.tools.maven.core.Messages;
+import org.jboss.tools.maven.core.ProjectUtil;
import org.jboss.tools.maven.core.libprov.MavenLibraryProviderInstallOperation;
/**
@@ -70,80 +71,74 @@
if (!pom.exists()) {
Model model = new Model();
model.setModelVersion(IJBossMavenConstants.MAVEN_MODEL_VERSION);
- model.setGroupId(config
- .getStringProperty(IJBossMavenConstants.GROUP_ID));
- String artifactId = config
- .getStringProperty(IJBossMavenConstants.ARTIFACT_ID);
+ model.setGroupId(config.getStringProperty(IJBossMavenConstants.GROUP_ID));
+ String artifactId = config.getStringProperty(IJBossMavenConstants.ARTIFACT_ID);
model.setArtifactId(artifactId);
- model.setVersion(config
- .getStringProperty(IJBossMavenConstants.VERSION));
- model.setName(config
- .getStringProperty(IJBossMavenConstants.NAME));
- model.setPackaging(config
- .getStringProperty(IJBossMavenConstants.PACKAGING));
- model.setDescription(config
- .getStringProperty(IJBossMavenConstants.DESCRIPTION));
+ model.setVersion(config.getStringProperty(IJBossMavenConstants.VERSION));
+ model.setName(config.getStringProperty(IJBossMavenConstants.NAME));
+ String packaging = config.getStringProperty(IJBossMavenConstants.PACKAGING);
+ model.setPackaging(packaging);
+ String description = config.getStringProperty(IJBossMavenConstants.DESCRIPTION);
+ if (description != null && description.trim().length() > 0) {
+ model.setDescription(description);
+ }
Build build = new Build();
model.setBuild(build);
// build.setFinalName(artifactId);
if (fpwc.hasProjectFacet(JavaFacet.FACET)) {
- String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
- build.setOutputDirectory(outputDirectory);
+// String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
+// if (!"${basedir}/target/classes".equals(outputDirectory)) {
+// build.setOutputDirectory(outputDirectory);
+// }
String sourceDirectory = MavenCoreActivator.getSourceDirectory(javaProject);
- if (sourceDirectory != null) {
+ if (sourceDirectory != null && !"${basedir}/src/main/java".equals(sourceDirectory)) {
build.setSourceDirectory(sourceDirectory);
}
+ MavenCoreActivator.addResource(build, project, sourceDirectory);
+
}
- if (fpwc.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
-
- MavenCoreActivator.addMavenWarPlugin(build, project);
+ IProjectFacetVersion webFacetVersion = fpwc.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
+ if (webFacetVersion != null && "war".equals(packaging)) {
+ MavenCoreActivator.addMavenWarPlugin(build, project, webFacetVersion);
}
- if (fpwc.hasProjectFacet(IJ2EEFacetConstants.EJB_FACET)) {
-
- MavenCoreActivator.addMavenEjbPlugin(build, project);
+ IProjectFacetVersion ejbFacetVersion = fpwc.getProjectFacetVersion(IJ2EEFacetConstants.EJB_FACET);
+ if (ejbFacetVersion != null && "ejb".equals(packaging)) {
+ MavenCoreActivator.addMavenEjbPlugin(build, project, ejbFacetVersion);
}
- if (fpwc
- .hasProjectFacet(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET)) {
- MavenCoreActivator.addMavenEarPlugin(build, project,
- config, null, false);
- MavenCoreActivator.createMavenProject(project.getName(),
- monitor, model, true);
+ IProjectFacetVersion earFacetVersion = fpwc.getProjectFacetVersion(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET);
+ if (earFacetVersion != null && "ear".equals(packaging)) {
+ MavenCoreActivator.addMavenEarPlugin(build, project, config, null, earFacetVersion, false);
+ MavenCoreActivator.createMavenProject(project.getName(), monitor, model, true);
}
IProjectFacet seamFacet = ProjectFacetsManager.getProjectFacet(SEAM_FACET_ID);
- if (!fpwc.hasProjectFacet(seamFacet)) {
+ if (!"pom".equals(packaging) && !fpwc.hasProjectFacet(seamFacet)) {
MavenCoreActivator.addCompilerPlugin(build, project);
}
if (!pom.exists()) {
- MavenModelManager modelManager = MavenPlugin.getDefault()
- .getMavenModelManager();
+ MavenModelManager modelManager = MavenPlugin.getMavenModelManager();
modelManager.createMavenModel(pom, model);
}
}
- boolean hasMavenNature = MavenCoreActivator.addMavenNature(project,
- monitor);
+ MavenCoreActivator.addMavenNature(project, monitor);
if (fpwc.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
IClasspathAttribute attribute = JavaCore
.newClasspathAttribute(
IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY,
- ClasspathDependencyUtil.getDefaultRuntimePath(
- true).toString());
- MavenCoreActivator.addClasspathAttribute(javaProject,
- attribute, monitor);
+ ClasspathDependencyUtil.getDefaultRuntimePath(true).toString());
+ MavenCoreActivator.addClasspathAttribute(javaProject, attribute, monitor);
}
// FIXME
IClasspathAttribute attribute = JavaCore.newClasspathAttribute(
MavenCoreActivator.OWNER_PROJECT_FACETS_ATTR,
IJBossMavenConstants.M2_FACET_ID);
- MavenCoreActivator.addClasspathAttribute(javaProject, attribute,
- monitor);
+ MavenCoreActivator.addClasspathAttribute(javaProject, attribute, monitor);
- List<LibraryProviderOperationConfig> configs = MavenCoreActivator
- .getLibraryProviderOperationConfigs();
+ List<LibraryProviderOperationConfig> configs = MavenCoreActivator.getLibraryProviderOperationConfigs();
if (configs.size() > 0) {
MavenLibraryProviderInstallOperation operation = new MavenLibraryProviderInstallOperation();
for (LibraryProviderOperationConfig libraryProviderOperationConfig : configs) {
@@ -151,6 +146,8 @@
}
configs.clear();
}
+
+ ProjectUtil.removeWTPContainers(config, project);
} finally {
if (fpwc != null) {
fpwc.dispose();
Modified: trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java 2012-02-16 18:19:57 UTC (rev 38840)
@@ -15,6 +15,7 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
import org.apache.maven.project.MavenProject;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
@@ -86,7 +87,7 @@
private boolean isHibernateProject(MavenProject mavenProject) {
List<Artifact> artifacts = new ArrayList<Artifact>();
- ArtifactFilter filter = new org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter(
+ ArtifactFilter filter = new ScopeArtifactFilter(
Artifact.SCOPE_TEST);
for (Artifact artifact : mavenProject.getArtifacts()) {
if (filter.include(artifact)) {
Modified: trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml 2012-02-16 18:19:57 UTC (rev 38840)
@@ -85,6 +85,7 @@
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
<version>${seam.version}</version>
+ <type>ejb</type>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
@@ -311,7 +312,6 @@
<artifactId>jboss-deployers-client-spi</artifactId>
</exclusion>
</exclusions>
-
</dependency>
<dependency>
<groupId>org.jboss.seam.embedded</groupId>
@@ -503,6 +503,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
@@ -511,7 +512,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.5</version>
+ <version>2.7.2</version>
<configuration>
<argLine>-Dsun.lang.ClassLoader.allowArraySyntax=true</argLine>
</configuration>
Modified: trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java 2012-02-16 18:19:57 UTC (rev 38840)
@@ -43,12 +43,11 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.MavenModelManager;
import org.eclipse.m2e.core.internal.IMavenConstants;
-import org.eclipse.m2e.core.internal.MavenPluginActivator;
import org.eclipse.m2e.core.internal.project.ResolverConfigurationIO;
-import org.eclipse.m2e.core.internal.project.registry.MavenProjectManager;
import org.eclipse.m2e.core.project.ResolverConfiguration;
import org.eclipse.m2e.model.edit.pom.Configuration;
import org.eclipse.m2e.model.edit.pom.Plugin;
@@ -67,6 +66,7 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.maven.core.IJBossMavenConstants;
import org.jboss.tools.maven.core.MavenCoreActivator;
+import org.jboss.tools.maven.core.ProjectUtil;
import org.jboss.tools.maven.core.xpl.ProjectUpdater;
import org.jboss.tools.seam.core.SeamUtil;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
@@ -144,8 +144,7 @@
}
- public void configureSeamProject(IDataModel seamFacetModel,
- IDataModel m2FacetModel) {
+ public void configureSeamProject(IDataModel seamFacetModel, IDataModel m2FacetModel) {
Assert.isNotNull(seamFacetModel);
Assert.isNotNull(m2FacetModel);
webProjectName = seamFacetModel.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
@@ -162,11 +161,9 @@
configureParentProject(m2FacetModel, seamFacetModel);
configureWarProject(m2FacetModel, seamFacetModel);
configureTestProject(m2FacetModel, seamFacetModel);
- if (!SeamFacetAbstractInstallDelegate
- .isWarConfiguration(seamFacetModel)) {
+ if (!SeamFacetAbstractInstallDelegate.isWarConfiguration(seamFacetModel)) {
configureEjbProject(m2FacetModel, seamFacetModel);
configureEarProject(m2FacetModel, seamFacetModel);
-
}
}
@@ -231,8 +228,7 @@
dependency = new Dependency();
dependency.setGroupId("org.testng"); //$NON-NLS-1$
dependency.setArtifactId("testng"); //$NON-NLS-1$
- // FIXME
- dependency.setVersion("${testng.version}"); //$NON-NLS-1$
+ //dependency.setVersion("${testng.version}"); //$NON-NLS-1$
dependency.setClassifier("jdk15"); //$NON-NLS-1$
dependency.setScope("compile"); //$NON-NLS-1$
dependencies.add(dependency);
@@ -257,7 +253,6 @@
dependency.setGroupId(groupId);
dependency.setArtifactId(artifactId);
dependency.setType("war"); //$NON-NLS-1$
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setScope("test"); //$NON-NLS-1$
dependencies.add(dependency);
@@ -267,7 +262,6 @@
dependency.setGroupId(groupId);
dependency.setArtifactId(ejbArtifactId);
dependency.setType("ejb"); //$NON-NLS-1$
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setScope("test"); //$NON-NLS-1$
dependencies.add(dependency);
}
@@ -297,9 +291,9 @@
if (sourceDirectory != null) {
build.setTestSourceDirectory(sourceDirectory);
}
- String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
- build.setOutputDirectory(outputDirectory);
- build.setTestOutputDirectory(outputDirectory);
+ //String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
+ //build.setOutputDirectory(outputDirectory);
+ //build.setTestOutputDirectory(outputDirectory);
MavenCoreActivator.addResource(build, project, sourceDirectory);
Resource resource = new Resource();
@@ -361,21 +355,17 @@
Dependency dependency = new Dependency();
dependency.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
dependency.setArtifactId(ejbProjectName);
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setType("ejb"); //$NON-NLS-1$
- dependency.setScope("runtime"); //$NON-NLS-1$
dependencies.add(dependency);
dependency = new Dependency();
dependency.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
dependency.setArtifactId(webProjectName);
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setType("war"); //$NON-NLS-1$
- dependency.setScope("runtime"); //$NON-NLS-1$
dependencies.add(dependency);
dependency = getSeamDependency();
- dependency.setVersion("${seam.version}"); //$NON-NLS-1$
+ //dependency.setVersion("${seam.version}"); //$NON-NLS-1$
dependency.setType("ejb"); //$NON-NLS-1$
dependency.setScope("compile"); //$NON-NLS-1$
List<Exclusion> exclusions = dependency.getExclusions();
@@ -466,16 +456,9 @@
Build build = new Build();
try {
build.setFinalName(earProjectName);
-
- String sourceDirectory = MavenCoreActivator.getEarRoot(project);
- if (sourceDirectory != null) {
- build.setSourceDirectory(sourceDirectory);
- }
- build.setOutputDirectory("target/classes"); //$NON-NLS-1$
- MavenCoreActivator.addMavenEarPlugin(build, project, m2FacetModel, ejbArtifactId, true);
+ MavenCoreActivator.addMavenEarPlugin(build, project, m2FacetModel, ejbArtifactId, JavaEEProjectUtilities.ENTERPRISE_APPLICATION_50, true);
model.setBuild(build);
MavenCoreActivator.createMavenProject(earProjectName, null, model, true);
- removeWTPContainers(m2FacetModel, project);
} catch (Exception e) {
MavenSeamActivator.log(e);
}
@@ -545,16 +528,17 @@
try {
// FIXME
//build.setFinalName(ejbArtifactId);
- String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
- build.setOutputDirectory(outputDirectory);
+ //String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
+ //build.setOutputDirectory(outputDirectory);
String sourceDirectory = MavenCoreActivator.getSourceDirectory(javaProject);
if (sourceDirectory != null) {
build.setSourceDirectory(sourceDirectory);
}
- MavenCoreActivator.addMavenEjbPlugin(build, project);
+ MavenCoreActivator.addMavenEjbPlugin(build, project, JavaEEProjectUtilities.EJB_30);
model.setBuild(build);
MavenCoreActivator.createMavenProject(ejbProjectName, null, model, true);
- removeWTPContainers(m2FacetModel, project);
+
+ ProjectUtil.removeWTPContainers(m2FacetModel, project);
} catch (Exception e) {
MavenSeamActivator.log(e);
}
@@ -642,7 +626,7 @@
dependency.setGroupId("org.jboss.seam"); //$NON-NLS-1$
dependency.setArtifactId("jboss-seam-debug"); //$NON-NLS-1$
// FIXME
- dependency.setVersion("${seam.version}"); //$NON-NLS-1$
+ //dependency.setVersion("${seam.version}"); //$NON-NLS-1$
addDependency(pomFile,dependency);
@@ -737,14 +721,14 @@
dependency = new Dependency();
dependency.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
dependency.setArtifactId(ejbProjectName);
- dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
dependency.setType("ejb"); //$NON-NLS-1$
dependency.setScope("provided"); //$NON-NLS-1$
addDependency(pomFile,dependency);
}
updateProject(pomFile, new WarProjectUpdater(webProject));
- removeWTPContainers(m2FacetModel, webProject);
+
+ ProjectUtil.removeWTPContainers(m2FacetModel, webProject);
} catch (Exception e) {
MavenSeamActivator.log(e);
}
@@ -780,33 +764,6 @@
return newPlugin;
}
- private void removeWTPContainers(IDataModel m2FacetModel,
- IProject webProject) throws JavaModelException {
- if (m2FacetModel.getBooleanProperty(IJBossMavenConstants.REMOVE_WTP_CLASSPATH_CONTAINERS)) {
- IJavaProject javaProject = JavaCore.create(webProject);
- IClasspathEntry[] entries = javaProject.getRawClasspath();
- List<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
- for (int i = 0; i < entries.length; i++) {
- IClasspathEntry entry = entries[i];
- boolean add = true;
- if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
- // FIXME
- IPath path = entry.getPath();
- if (path != null) {
- String value = path.toString();
- if (value.startsWith("org.eclipse.jst")) { //$NON-NLS-1$
- add = false;
- }
- }
- }
- if (add) {
- newEntries.add(entry);
- }
- }
- javaProject.setRawClasspath(newEntries.toArray(new IClasspathEntry[0]), null);
- }
- }
-
private Dependency getHibernateValidator() {
Dependency dependency = new Dependency();
dependency.setGroupId("org.hibernate"); //$NON-NLS-1$
@@ -851,6 +808,7 @@
dependency = new Dependency();
dependency.setGroupId("org.jboss.seam"); //$NON-NLS-1$
dependency.setArtifactId("jboss-seam"); //$NON-NLS-1$
+ dependency.setType("ejb");
return dependency;
}
@@ -860,7 +818,7 @@
InputStream inputStream = null;
try {
URL resolvedURL = FileLocator.resolve(parentPomEntryURL);
- MavenModelManager modelManager = MavenPlugin.getDefault().getMavenModelManager();
+ MavenModelManager modelManager = MavenPlugin.getMavenModelManager();
inputStream = resolvedURL.openStream();
Model model = modelManager.readMavenModel(inputStream);
model.setArtifactId(parentArtifactId);
@@ -899,6 +857,7 @@
try {
Model rootPomModel = modelManager.readMavenModel(rootPom);
List<Dependency> seamDependencies = rootPomModel.getDependencyManagement().getDependencies();
+
setArtifactVersion("jsf.version", properties, "javax.faces", "jsf-api", seamDependencies); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String richfacesVersion = setArtifactVersion("richfaces.version", properties, "org.richfaces.framework", "richfaces-impl", seamDependencies); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (richfacesVersion == null) {
@@ -950,11 +909,26 @@
}
List<String> modules = model.getModules();
+
modules.add("../" + artifactId); //$NON-NLS-1$
if (!SeamFacetAbstractInstallDelegate
.isWarConfiguration(seamFacetModel)) {
modules.add("../" + ejbArtifactId); //$NON-NLS-1$
modules.add("../" + earArtifactId); //$NON-NLS-1$
+
+ Dependency dependency = new Dependency();
+ dependency.setGroupId(model.getGroupId());
+ dependency.setArtifactId(ejbProjectName);
+ dependency.setType("ejb"); //$NON-NLS-1$
+ dependency.setVersion(projectVersion);
+ model.getDependencyManagement().getDependencies().add(0, dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId(model.getGroupId());
+ dependency.setArtifactId(webProjectName);
+ dependency.setType("war"); //$NON-NLS-1$
+ dependency.setVersion(projectVersion);
+ model.getDependencyManagement().getDependencies().add(1, dependency);
}
webProjectName = seamFacetModel.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
@@ -963,7 +937,6 @@
location = location.append(parentProjectName);
MavenCoreActivator.createMavenProject(parentProjectName, null, model, false, location);
// disable workspace resolution
- MavenProjectManager projectManager = MavenPluginActivator.getDefault().getMavenProjectManager();
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(parentProjectName);
ResolverConfiguration configuration = ResolverConfigurationIO.readResolverConfiguration(project);
configuration.setResolveWorkspaceProjects(false);
@@ -1117,7 +1090,7 @@
}
configuration.setStringValue(WAR_SOURCE_DIRECTORY, value);
}
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
boolean first = true;
for (IPath output:outputs) {
if (first) {
Modified: trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java 2012-02-16 18:19:57 UTC (rev 38840)
@@ -10,10 +10,8 @@
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
import org.eclipse.wst.common.project.facet.core.events.IProjectFacetActionEvent;
import org.jboss.tools.maven.core.IJBossMavenConstants;
-import org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider;
import org.jboss.tools.maven.seam.MavenSeamActivator;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
-import org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
public class MavenPostInstallListener implements IFacetedProjectListener {
@@ -31,11 +29,10 @@
boolean isM2Project = false;
for (IProjectFacetVersion projectFacetVersion : projectFacets) {
IProjectFacet projectFacet = projectFacetVersion.getProjectFacet();
- if (ISeamFacetDataModelProperties.SEAM_FACET_ID.equals(projectFacet
- .getId())) {
+ if (ISeamFacetDataModelProperties.SEAM_FACET_ID.equals(projectFacet.getId())) {
isSeamProject = true;
}
- if (IJBossMavenConstants.M2_FACET_ID.equals(projectFacet.getId())) {
+ else if (IJBossMavenConstants.M2_FACET_ID.equals(projectFacet.getId())) {
isM2Project = true;
}
}
@@ -46,9 +43,8 @@
IDataModel dataModel = (IDataModel) object;
if ( SEAM_FACET_MODEL_PROVIDER.equals(dataModel.getID())) {
seamFacetModel = dataModel;
- }
-
- if ( M2_FACET_MODEL_PROVIDER.equals(dataModel.getID()) ) {
+ }
+ else if ( M2_FACET_MODEL_PROVIDER.equals(dataModel.getID()) ) {
m2FacetModel = dataModel;
}
}
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java 2012-02-16 18:17:15 UTC (rev 38839)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java 2012-02-16 18:19:57 UTC (rev 38840)
@@ -128,6 +128,7 @@
packaging.setLayoutData(gd);
String[] items = { "war","ear", "ejb", "jar" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
packaging.setItems(items);
+ synchHelper.synchCombo(packaging, IJBossMavenConstants.PACKAGING, null);
IFacetedProjectWorkingCopy fpwc = null;
try {
@@ -135,8 +136,7 @@
if (!mavenProjectExists) {
if (fpwc.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
packaging.select(0);
- } else if (fpwc
- .hasProjectFacet(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET)) {
+ } else if (fpwc.hasProjectFacet(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET)) {
packaging.select(1);
} else if (fpwc.hasProjectFacet(IJ2EEFacetConstants.EJB_FACET)) {
packaging.select(2);
@@ -147,7 +147,6 @@
String mavenPackaging = getDataModel().getStringProperty(IJBossMavenConstants.PACKAGING);
packaging.setText(mavenPackaging);
}
- synchHelper.synchCombo(packaging, IJBossMavenConstants.PACKAGING, null);
name = createField(composite, Messages.MavenFacetInstallPage_Name, IJBossMavenConstants.NAME);
name.setText(projectName);
@@ -162,6 +161,8 @@
seamVersion.setText("2.1.1.GA"); //$NON-NLS-1$
} else if ("2.2".equals(seamFacetVersion.getVersionString())) { //$NON-NLS-1$
seamVersion.setText("2.2.1.Final"); //$NON-NLS-1$
+ } else if ("2.3".equals(seamFacetVersion.getVersionString())) { //$NON-NLS-1$
+ seamVersion.setText("2.3.0.ALPHA"); //$NON-NLS-1$
}
Button removeWTPContainers = new Button(composite,SWT.CHECK);
removeWTPContainers.setText(Messages.MavenFacetInstallPage_Remove_WTP_Classpath_containers);
12 years, 7 months