JBoss Tools SVN: r8481 - in trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor: figures and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-05-30 11:08:10 -0400 (Fri, 30 May 2008)
New Revision: 8481
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageWrapper.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ParamEditPart.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ParamListEditPart.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamListFigure.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/GraphicalPartFactory.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/GraphicalPartFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/GraphicalPartFactory.java 2008-05-30 14:45:42 UTC (rev 8480)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/GraphicalPartFactory.java 2008-05-30 15:08:10 UTC (rev 8481)
@@ -15,6 +15,7 @@
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesModel;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Param;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PgException;
@@ -30,6 +31,10 @@
child = new PageEditPart();
else if (model instanceof PgException)
child = new ExceptionEditPart();
+ else if (model instanceof PageWrapper)
+ child = new ParamListEditPart();
+ else if (model instanceof Param)
+ child = new ParamEditPart();
else if (model instanceof Link)
child = new LinkEditPart();
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageWrapper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageWrapper.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageWrapper.java 2008-05-30 15:08:10 UTC (rev 8481)
@@ -0,0 +1,15 @@
+package org.jboss.tools.seam.ui.pages.editor.edit;
+
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
+
+public class PageWrapper {
+ private Page page;
+
+ public PageWrapper(Page page){
+ this.page = page;
+ }
+
+ public Page getPage(){
+ return page;
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ParamEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ParamEditPart.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ParamEditPart.java 2008-05-30 15:08:10 UTC (rev 8481)
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.edit;
+
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartListener;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DropRequest;
+import org.eclipse.swt.accessibility.AccessibleControlEvent;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Param;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PgException;
+import org.jboss.tools.seam.ui.pages.editor.figures.ExceptionFigure;
+import org.jboss.tools.seam.ui.pages.editor.figures.NodeFigure;
+import org.jboss.tools.seam.ui.pages.editor.figures.ParamFigure;
+
+public class ParamEditPart extends PagesEditPart implements PropertyChangeListener, EditPartListener, Adapter {
+ private ParamFigure fig = null;
+
+ private boolean single = true;
+
+ public boolean isSingle() {
+ return single;
+ }
+
+ public void doControlUp() {
+ }
+
+ public void doControlDown() {
+ }
+
+ public void doMouseHover(boolean cf) {
+ }
+
+ public void childAdded(EditPart child, int index) {
+ }
+
+ public void partActivated(EditPart editpart) {
+ }
+
+ public void partDeactivated(EditPart editpart) {
+ }
+
+ public void removingChild(EditPart child, int index) {
+ }
+
+ public void selectedStateChanged(EditPart editpart) {
+ if (this.getSelected() == EditPart.SELECTED_PRIMARY) {
+ ((PagesDiagramEditPart) ParamEditPart.this.getParent())
+ .setToFront(this);
+
+ }
+ }
+
+ public boolean isGroupListenerEnable() {
+ return true;
+ }
+
+
+
+ private void refreshTargetLink(Link link) {
+ if (link == null)
+ return;
+ ParamEditPart gep = (ParamEditPart) getViewer().getEditPartRegistry()
+ .get(link.getToElement());
+ if (gep == null)
+ return;
+ gep.refreshTargetConnections();
+ }
+
+
+ protected AccessibleEditPart createAccessible() {
+ return new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = "EditPart";
+ }
+
+ public void getValue(AccessibleControlEvent e) {
+ }
+
+ };
+ }
+
+ protected List getModelTargetConnections() {
+ return getExceptionModel().getInputLinks();
+ }
+
+ protected List getModelSourceConnections() {
+ return getExceptionModel().getOutputLinks();
+ }
+
+ protected void createEditPolicies() {
+ super.createEditPolicies();
+ installEditPolicy(EditPolicy.NODE_ROLE, null);
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null);
+ //installEditPolicy(EditPolicy.COMPONENT_ROLE, new PageEditPolicy());
+ //installEditPolicy(EditPolicy.LAYOUT_ROLE, new JSFFlowEditPolicy());
+ //installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,
+ // new PageEditPolicy());
+ }
+
+ /**
+ * Returns a newly created Figure to represent this.
+ *
+ * @return Figure of this.
+ */
+
+ protected IFigure createFigure() {
+ fig = new ParamFigure(getExceptionModel());
+ ((ParamFigure) fig).setEditPart(this);
+ return fig;
+ }
+
+ /**
+ * Returns the model of this as a LED.
+ *
+ * @return Model of this as an LED.
+ */
+ public Param getExceptionModel() {
+ return (Param) getModel();
+ }
+
+ Dimension size;
+
+
+
+ protected void refreshVisuals() {
+ Point loc = getExceptionModel().getLocation();
+ String text = getExceptionModel().getName();
+ if(text == null) text="Exception";
+ int width = 30+FigureUtilities.getTextExtents(text, NodeFigure.exceptionFont).width;
+ size = new Dimension(width, 21);
+ loc.x -= loc.x % 8;
+ loc.y -= loc.y % 8;
+
+ Rectangle r = new Rectangle(loc, size);
+
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this,
+ getFigure(), r);
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(
+ ConnectionEditPart connEditPart) {
+ ConnectionAnchor anc = getNodeFigure().getConnectionAnchor("1_IN");
+ return anc;
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ Point pt = new Point(((DropRequest) request).getLocation());
+ return getNodeFigure().getTargetConnectionAnchorAt(pt);
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(
+ ConnectionEditPart connEditPart) {
+ if (single) {
+ Link link = (Link) connEditPart.getModel();
+ int index = getExceptionModel().getOutputLinks().indexOf(link);
+ return getNodeFigure().getConnectionAnchor((index + 1) + "_OUT");
+ } else
+ return super.getSourceConnectionAnchor(connEditPart);
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ if (single) {
+ Point pt = new Point(((DropRequest) request).getLocation());
+ return getNodeFigure().getSourceConnectionAnchorAt(pt);
+ } else
+ return super.getSourceConnectionAnchor(request);
+ }
+
+ protected List getModelChildren() {
+ return getExceptionModel().getChildren();
+ }
+
+ protected void refreshChildren() {
+ super.refreshChildren();
+ for (int i = 0; i < getChildren().size(); i++) {
+ ((ParamEditPart) getChildren().get(i)).refresh();
+
+ }
+ }
+
+ /**
+ * @see org.eclipse.gef.EditPart#activate()
+ */
+ public void activate() {
+ if (isActive())
+ return;
+ ((Notifier) getModel()).eAdapters().add(this);
+ super.activate();
+ }
+
+ public void deactivate(){
+ if (!isActive())
+ return;
+ ((Notifier) getModel()).eAdapters().remove(this);
+ super.deactivate();
+ }
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ public void notifyChanged(Notification notification) {
+ refresh();
+ refreshVisuals();
+ }
+ /**
+ * )
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#getTarget()
+ */
+ public Notifier getTarget() {
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
+ */
+ public boolean isAdapterForType(Object type) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
+ */
+ public void setTarget(Notifier newTarget) {
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ParamListEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ParamListEditPart.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ParamListEditPart.java 2008-05-30 15:08:10 UTC (rev 8481)
@@ -0,0 +1,233 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.edit;
+
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartListener;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DropRequest;
+import org.eclipse.swt.accessibility.AccessibleControlEvent;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PgException;
+import org.jboss.tools.seam.ui.pages.editor.figures.ExceptionFigure;
+import org.jboss.tools.seam.ui.pages.editor.figures.NodeFigure;
+import org.jboss.tools.seam.ui.pages.editor.figures.ParamListFigure;
+
+public class ParamListEditPart extends PagesEditPart implements PropertyChangeListener, EditPartListener, Adapter {
+ private ParamListFigure fig = null;
+
+ private boolean single = true;
+
+ public boolean isSingle() {
+ return single;
+ }
+
+ public void doControlUp() {
+ }
+
+ public void doControlDown() {
+ }
+
+ public void doMouseHover(boolean cf) {
+ }
+
+ public void childAdded(EditPart child, int index) {
+ }
+
+ public void partActivated(EditPart editpart) {
+ }
+
+ public void partDeactivated(EditPart editpart) {
+ }
+
+ public void removingChild(EditPart child, int index) {
+ }
+
+ public void selectedStateChanged(EditPart editpart) {
+ if (this.getSelected() == EditPart.SELECTED_PRIMARY) {
+ ((PagesDiagramEditPart) ParamListEditPart.this.getParent())
+ .setToFront(this);
+
+ }
+ }
+
+ public boolean isGroupListenerEnable() {
+ return true;
+ }
+
+
+
+ private void refreshTargetLink(Link link) {
+ if (link == null)
+ return;
+ ParamListEditPart gep = (ParamListEditPart) getViewer().getEditPartRegistry()
+ .get(link.getToElement());
+ if (gep == null)
+ return;
+ gep.refreshTargetConnections();
+ }
+
+
+ protected AccessibleEditPart createAccessible() {
+ return new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = "EditPart";
+ }
+
+ public void getValue(AccessibleControlEvent e) {
+ }
+
+ };
+ }
+
+ protected void createEditPolicies() {
+ super.createEditPolicies();
+ installEditPolicy(EditPolicy.NODE_ROLE, null);
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null);
+ //installEditPolicy(EditPolicy.COMPONENT_ROLE, new PageEditPolicy());
+ //installEditPolicy(EditPolicy.LAYOUT_ROLE, new JSFFlowEditPolicy());
+ //installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,
+ // new PageEditPolicy());
+ }
+
+ /**
+ * Returns a newly created Figure to represent this.
+ *
+ * @return Figure of this.
+ */
+
+ protected IFigure createFigure() {
+ fig = new ParamListFigure(getExceptionModel());
+ ((ParamListFigure) fig).setEditPart(this);
+ return fig;
+ }
+
+ /**
+ * Returns the model of this as a LED.
+ *
+ * @return Model of this as an LED.
+ */
+ public PageWrapper getExceptionModel() {
+ return (PageWrapper) getModel();
+ }
+
+ Dimension size;
+
+
+
+ protected void refreshVisuals() {
+ Point loc = new Point(1,1);
+ size = new Dimension(10, 10);
+ loc.x -= loc.x % 8;
+ loc.y -= loc.y % 8;
+
+ Rectangle r = new Rectangle(loc, size);
+
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this,
+ getFigure(), r);
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(
+ ConnectionEditPart connEditPart) {
+ ConnectionAnchor anc = getNodeFigure().getConnectionAnchor("1_IN");
+ return anc;
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ Point pt = new Point(((DropRequest) request).getLocation());
+ return getNodeFigure().getTargetConnectionAnchorAt(pt);
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ if (single) {
+ Point pt = new Point(((DropRequest) request).getLocation());
+ return getNodeFigure().getSourceConnectionAnchorAt(pt);
+ } else
+ return super.getSourceConnectionAnchor(request);
+ }
+
+ protected List getModelChildren() {
+ return getExceptionModel().getPage().getChildren();
+ }
+
+ protected void refreshChildren() {
+ super.refreshChildren();
+ for (int i = 0; i < getChildren().size(); i++) {
+ ((ParamListEditPart) getChildren().get(i)).refresh();
+
+ }
+ }
+
+ /**
+ * @see org.eclipse.gef.EditPart#activate()
+ */
+ public void activate() {
+ if (isActive())
+ return;
+ ((Notifier) getModel()).eAdapters().add(this);
+ super.activate();
+ }
+
+ public void deactivate(){
+ if (!isActive())
+ return;
+ ((Notifier) getModel()).eAdapters().remove(this);
+ super.deactivate();
+ }
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ public void notifyChanged(Notification notification) {
+ refresh();
+ refreshVisuals();
+ }
+ /**
+ * )
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#getTarget()
+ */
+ public Notifier getTarget() {
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
+ */
+ public boolean isAdapterForType(Object type) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
+ */
+ public void setTarget(Notifier newTarget) {
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamFigure.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamFigure.java 2008-05-30 15:08:10 UTC (rev 8481)
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.MouseEvent;
+import org.eclipse.draw2d.XYLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.handles.HandleBounds;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.gef.GEFGraphicalViewer;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Param;
+import org.jboss.tools.seam.ui.pages.editor.edit.ParamEditPart;
+import org.jboss.tools.seam.ui.pages.editor.figures.xpl.FixedConnectionAnchor;
+
+public class ParamFigure extends NodeFigure implements HandleBounds {
+ private static final Dimension SIZE = new Dimension(56, 100);
+
+ private Image icon = null;
+
+ public Param exc;
+
+ ParamEditPart editPart;
+
+ public void setEditPart(ParamEditPart part) {
+ editPart = part;
+ }
+
+ public void setConstraint(IFigure child, Object constraint) {
+ super.setConstraint(child, constraint);
+ }
+
+ public void setIcon(Image i) {
+ //icon = PrintIconHelper.getPrintImage(i);
+ }
+
+
+ public void init(int number) {
+ FixedConnectionAnchor c;
+ if (number == 0)
+ number = 1;
+ for (int i = 0; i < number; i++) {
+ c = new FixedConnectionAnchor(this);
+ c.offsetV = 32 + LINK_HEIGHT * i;
+ c.leftToRight = false;
+ connectionAnchors.put((i + 1) + "_OUT", c);
+ outputConnectionAnchors.addElement(c);
+ }
+ }
+
+ public void addConnectionAnchor(int number) {
+ FixedConnectionAnchor c;
+ if (number == 1)
+ return;
+ c = new FixedConnectionAnchor(this);
+ c.offsetV = 32 + LINK_HEIGHT * (number - 1);
+ // c.offsetH = -1;
+ c.leftToRight = false;
+ connectionAnchors.put(number + "_OUT", c);
+ outputConnectionAnchors.addElement(c);
+ }
+
+ public void removeConnectionAnchor() {
+ if (outputConnectionAnchors.size() == 1)
+ return;
+ outputConnectionAnchors.remove(outputConnectionAnchors.size() - 1);
+ }
+
+ public void removeAllConnectionAnchor() {
+ outputConnectionAnchors.removeAllElements();
+ }
+
+ public ParamFigure(Param group) {
+ this.exc = group;
+
+ setOpaque(false);
+ setLayoutManager(new XYLayout());
+
+ setBorder(new GroupBorder(blackColor));
+
+ if (group != null) {
+ FixedConnectionAnchor c;
+ c = new FixedConnectionAnchor(this);
+ c.offsetV = 10;
+ //c.offsetH = -1;
+ connectionAnchors.put("1_IN", c);
+ inputConnectionAnchors.addElement(c);
+
+ c = new FixedConnectionAnchor(this);
+ c.offsetV = 10;
+ c.offsetH = -1;
+ c.leftToRight = false;
+ connectionAnchors.put("1_OUT", c);
+ outputConnectionAnchors.addElement(c);
+ }
+ }
+
+ /**
+ * @see org.eclipse.gef.handles.HandleBounds#getHandleBounds()
+ */
+ public Rectangle getHandleBounds() {
+ return getBounds().getCropped(new Insets(0, 0, 0, 0));
+ }
+
+ /**
+ * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
+ */
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ return SIZE;
+ }
+
+ int width, height;
+
+ /**
+ * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+ */
+ protected void paintFigure(Graphics g) {
+ Rectangle r = getBounds().getCopy();
+ g.translate(r.getLocation());
+
+ if (exc != null) {
+ g.setBackgroundColor(exceptionBackgroundColor);
+ g.setForegroundColor(exceptionForegroundColor);
+ } else {
+ g.setBackgroundColor(lightGrayColor);
+ }
+
+ g.fillRectangle(1, 1, r.width-2, r.height-2);
+
+ g.setBackgroundColor(whiteColor);
+
+ g.fillRectangle(1, 1, 22, 19);
+
+ if (icon != null)
+ g.drawImage(icon, 4, 2);
+
+ if(exc != null){
+ g.setFont(exceptionFont);
+ if(exc.getName() != null)
+ g.drawString(exc.getName(), 27, 3);
+ else
+ g.drawString("Exception", 27, 3);
+ }
+
+
+ }
+
+ class GroupBorder extends LineBorder {
+ public GroupBorder(Color color) {
+ super(color);
+ }
+
+ public void paint(IFigure figure, Graphics graphics, Insets insets) {
+ Rectangle r = getPaintRectangle(figure, insets).getCopy();
+ graphics.translate(r.getLocation());
+ int width = r.width - 1;
+ int height = r.height - 1;
+
+ if (exc != null)
+ graphics.setForegroundColor(blackColor);
+ else
+ graphics.setForegroundColor(darkGrayColor);
+
+ graphics.drawLine(1, 0, width-1, 0);
+ graphics.drawLine(0, 1, 0, height - 1);
+ graphics.drawLine(1, height, width-1, height);
+ graphics.drawLine(width, 1, width, height - 1);
+ graphics.drawLine(23 , 0, 23, height);
+
+
+ }
+
+ public void mouseDoubleClicked(MouseEvent me) {
+ }
+
+ public void mousePressed(MouseEvent me) {
+ if (me.button == 3) {
+ ((GEFGraphicalViewer) editPart.getViewer()).setNoDeselect();
+ editPart.getViewer().select(editPart);
+ }
+ }
+
+
+}
+}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamListFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamListFigure.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamListFigure.java 2008-05-30 15:08:10 UTC (rev 8481)
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.MouseEvent;
+import org.eclipse.draw2d.XYLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.handles.HandleBounds;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.gef.GEFGraphicalViewer;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PgException;
+import org.jboss.tools.seam.ui.pages.editor.edit.PageWrapper;
+import org.jboss.tools.seam.ui.pages.editor.edit.ParamListEditPart;
+import org.jboss.tools.seam.ui.pages.editor.figures.xpl.FixedConnectionAnchor;
+
+public class ParamListFigure extends NodeFigure implements HandleBounds {
+ private static final Dimension SIZE = new Dimension(56, 100);
+
+ private Image icon = null;
+
+ public PageWrapper paramList;
+
+ ParamListEditPart editPart;
+
+ public void setEditPart(ParamListEditPart part) {
+ editPart = part;
+ }
+
+ public void setConstraint(IFigure child, Object constraint) {
+ super.setConstraint(child, constraint);
+ }
+
+ public void setIcon(Image i) {
+ //icon = PrintIconHelper.getPrintImage(i);
+ }
+
+
+ public void init(int number) {
+ FixedConnectionAnchor c;
+ if (number == 0)
+ number = 1;
+ for (int i = 0; i < number; i++) {
+ c = new FixedConnectionAnchor(this);
+ c.offsetV = 32 + LINK_HEIGHT * i;
+ c.leftToRight = false;
+ connectionAnchors.put((i + 1) + "_OUT", c);
+ outputConnectionAnchors.addElement(c);
+ }
+ }
+
+ public void addConnectionAnchor(int number) {
+ FixedConnectionAnchor c;
+ if (number == 1)
+ return;
+ c = new FixedConnectionAnchor(this);
+ c.offsetV = 32 + LINK_HEIGHT * (number - 1);
+ // c.offsetH = -1;
+ c.leftToRight = false;
+ connectionAnchors.put(number + "_OUT", c);
+ outputConnectionAnchors.addElement(c);
+ }
+
+ public void removeConnectionAnchor() {
+ if (outputConnectionAnchors.size() == 1)
+ return;
+ outputConnectionAnchors.remove(outputConnectionAnchors.size() - 1);
+ }
+
+ public void removeAllConnectionAnchor() {
+ outputConnectionAnchors.removeAllElements();
+ }
+
+ public ParamListFigure(PageWrapper paramList) {
+ this.paramList = paramList;
+
+ setOpaque(false);
+ setLayoutManager(new XYLayout());
+
+ setBorder(new GroupBorder(blackColor));
+ }
+
+ /**
+ * @see org.eclipse.gef.handles.HandleBounds#getHandleBounds()
+ */
+ public Rectangle getHandleBounds() {
+ return getBounds().getCropped(new Insets(0, 0, 0, 0));
+ }
+
+ /**
+ * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
+ */
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ return SIZE;
+ }
+
+ int width, height;
+
+ /**
+ * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+ */
+ protected void paintFigure(Graphics g) {
+ Rectangle r = getBounds().getCopy();
+ g.translate(r.getLocation());
+
+ if (paramList != null) {
+ g.setBackgroundColor(exceptionBackgroundColor);
+ g.setForegroundColor(exceptionForegroundColor);
+ } else {
+ g.setBackgroundColor(lightGrayColor);
+ }
+
+ g.fillRectangle(1, 1, r.width-2, r.height-2);
+
+ g.setBackgroundColor(whiteColor);
+
+ g.fillRectangle(1, 1, 22, 19);
+
+ if (icon != null)
+ g.drawImage(icon, 4, 2);
+ }
+
+ class GroupBorder extends LineBorder {
+ public GroupBorder(Color color) {
+ super(color);
+ }
+
+ public void paint(IFigure figure, Graphics graphics, Insets insets) {
+ Rectangle r = getPaintRectangle(figure, insets).getCopy();
+ graphics.translate(r.getLocation());
+ int width = r.width - 1;
+ int height = r.height - 1;
+
+ if (paramList != null)
+ graphics.setForegroundColor(blackColor);
+ else
+ graphics.setForegroundColor(darkGrayColor);
+
+ graphics.drawLine(1, 0, width-1, 0);
+ graphics.drawLine(0, 1, 0, height - 1);
+ graphics.drawLine(1, height, width-1, height);
+ graphics.drawLine(width, 1, width, height - 1);
+ graphics.drawLine(23 , 0, 23, height);
+
+
+ }
+
+ public void mouseDoubleClicked(MouseEvent me) {
+ }
+
+ public void mousePressed(MouseEvent me) {
+ if (me.button == 3) {
+ ((GEFGraphicalViewer) editPart.getViewer()).setNoDeselect();
+ editPart.getViewer().select(editPart);
+ }
+ }
+
+
+}
+}
\ No newline at end of file
16 years, 7 months
JBoss Tools SVN: r8480 - in trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor: ecore/pages and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-30 10:45:42 -0400 (Fri, 30 May 2008)
New Revision: 8480
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/SetConstraintCommand.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java
Log:
JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/SetConstraintCommand.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/SetConstraintCommand.java 2008-05-30 14:45:30 UTC (rev 8479)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/SetConstraintCommand.java 2008-05-30 14:45:42 UTC (rev 8480)
@@ -27,16 +27,14 @@
oldSize = part.getSize();
oldPos = part.getLocation();
- part.setLocation(newPos);
- part.setSize(newSize);
+ part.changeLocationAndSize(newPos, newSize);
}
public void setShell(Shell shell) {
}
public void redo() {
- part.setSize(newSize);
- part.setLocation(newPos);
+ part.changeLocationAndSize(newPos, newSize);
}
public void setLocation(Rectangle r) {
@@ -57,8 +55,7 @@
}
public void undo() {
- part.setSize(oldSize);
- part.setLocation(oldPos);
+ part.changeLocationAndSize(oldPos, oldSize);
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java 2008-05-30 14:45:30 UTC (rev 8479)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java 2008-05-30 14:45:42 UTC (rev 8480)
@@ -118,4 +118,5 @@
public void childAdded(Object childData);
+ public void changeLocationAndSize(Point location, Dimension size);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java 2008-05-30 14:45:30 UTC (rev 8479)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java 2008-05-30 14:45:42 UTC (rev 8480)
@@ -180,44 +180,58 @@
* <!-- end-user-doc -->
* @generated NOT
*/
+ int updatelock = 0;
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
public void dataChanged() {
+ if(updatelock > 0) return;
+ updatelock++;
+ try {
XModelObject item = getModelObject();
- SeamPagesProcessStructureHelper h = SeamPagesProcessStructureHelper.getInstance();
+ SeamPagesProcessStructureHelper h = SeamPagesProcessStructureHelper
+ .getInstance();
- setName(h.getPageTitle(item));
- int[] shape = h.asIntArray(item, "shape");
- if(shape != null && shape.length >= 2) {
- setLocation(new Point(shape[0],shape[1]));
- } else {
- setLocation(new Point(0,0));
- }
- if(shape != null && shape.length >= 4) {
- setSize(new Dimension(shape[2],shape[3]));
- }
+ setName(h.getPageTitle(item));
+ int[] shape = h.asIntArray(item, "shape");
+ if (shape != null && shape.length >= 2) {
+ setLocation(new Point(shape[0], shape[1]));
+ } else {
+ setLocation(new Point(0, 0));
+ }
+ if (shape != null && shape.length >= 4) {
+ setSize(new Dimension(shape[2], shape[3]));
+ }
- String newParams = item.getAttributeValue("params");
- if(newParams == null) newParams = "";
- if(!params.equals(newParams)) {
- params = newParams;
- String[][] ps1 = h.getParams(item);
- List<Param> ps2 = getParams();
- for (int i = 0; i < ps1.length && i < ps2.size(); i++) {
- Param p = ps2.get(i);
- p.setName(ps1[i][0]);
- p.setValue(ps1[i][1]);
- }
- if(ps1.length > ps2.size()) {
- for (int i = ps2.size(); i < ps1.length; i++) {
- Param p = PagesFactory.eINSTANCE.createParam();
+ String newParams = item.getAttributeValue("params");
+ if (newParams == null)
+ newParams = "";
+ if (!params.equals(newParams)) {
+ params = newParams;
+ String[][] ps1 = h.getParams(item);
+ List<Param> ps2 = getParams();
+ for (int i = 0; i < ps1.length && i < ps2.size(); i++) {
+ Param p = ps2.get(i);
p.setName(ps1[i][0]);
p.setValue(ps1[i][1]);
- getChildren().add(p);
}
- } else if(ps1.length < ps2.size()) {
- for (int i = ps1.length; i < ps2.size(); i++) {
- getChildren().remove(ps2.get(i));
+ if (ps1.length > ps2.size()) {
+ for (int i = ps2.size(); i < ps1.length; i++) {
+ Param p = PagesFactory.eINSTANCE.createParam();
+ p.setName(ps1[i][0]);
+ p.setValue(ps1[i][1]);
+ getChildren().add(p);
+ }
+ } else if (ps1.length < ps2.size()) {
+ for (int i = ps1.length; i < ps2.size(); i++) {
+ getChildren().remove(ps2.get(i));
+ }
}
}
+ } finally {
+ updatelock--;
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java 2008-05-30 14:45:30 UTC (rev 8479)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java 2008-05-30 14:45:42 UTC (rev 8480)
@@ -25,9 +25,11 @@
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessStructureHelper;
+import org.jboss.tools.seam.ui.pages.SeamUiPagesPlugin;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesFactory;
@@ -239,6 +241,44 @@
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void changeLocationAndSize(Point location, Dimension size) {
+ setLocation(location);
+ setSize(size);
+ commitShapeToData();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ protected void commitShapeToData() {
+ Point location = getLocation();
+ Dimension size = getSize();
+ String shape = "";
+ if(location != null) {
+ shape = "" + location.x + "," + location.y;
+ } else {
+ shape = "0,0";
+ }
+ if(size != null) {
+ shape += "," + size.width + "," + size.height;
+ }
+ XModelObject o = getModelObject();
+ if(o != null && o.getModelEntity().getAttribute("shape") != null) {
+ try {
+ o.getModel().changeObjectAttribute(o, "shape", shape);
+ } catch (XModelException e) {
+ SeamUiPagesPlugin.getDefault().logError(e);
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
public Dimension getSize() {
16 years, 7 months
JBoss Tools SVN: r8479 - in trunk/seam/plugins/org.jboss.tools.seam.pages.xml: resources/meta and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-30 10:45:30 -0400 (Fri, 30 May 2008)
New Revision: 8479
Added:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/AuxEntityRecognizer.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
Log:
JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-05-30 14:03:24 UTC (rev 8478)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-05-30 14:45:30 UTC (rev 8479)
@@ -35,6 +35,8 @@
<xclass id="org.jboss.tools.seam.pages.xml.model.SeamPagesEntityRecognizer"
class="org.jboss.tools.seam.pages.xml.model.SeamPagesEntityRecognizer"/>
+ <xclass id="org.jboss.tools.seam.pages.xml.model.AuxEntityRecognizer"
+ class="org.jboss.tools.seam.pages.xml.model.AuxEntityRecognizer"/>
<xclass id="org.jboss.tools.seam.pages.xml.model.impl.SeamPageNavigationImpl"
class="org.jboss.tools.seam.pages.xml.model.impl.SeamPageNavigationImpl"/>
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-05-30 14:03:24 UTC (rev 8478)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-05-30 14:45:30 UTC (rev 8479)
@@ -17,6 +17,7 @@
<PAIR name="SeamPageTask" value="org.jboss.tools.seam.pages.xml.model.impl.SeamPageTaskImpl"/>
</MAPPING>
<MAPPING name="Recognizers">
+ <PAIR name="spdia$3" value="org.jboss.tools.seam.pages.xml.model.AuxEntityRecognizer"/>
<PAIR name="xml$39" value="org.jboss.tools.seam.pages.xml.model.SeamPagesEntityRecognizer"/>
</MAPPING>
</MAPPINGS>
Added: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/AuxEntityRecognizer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/AuxEntityRecognizer.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/AuxEntityRecognizer.java 2008-05-30 14:45:30 UTC (rev 8479)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.pages.xml.model;
+
+import org.jboss.tools.common.model.loaders.*;
+
+public class AuxEntityRecognizer implements EntityRecognizer {
+
+ public AuxEntityRecognizer() {}
+
+ public String getEntityName(String ext, String body) {
+ if (body == null) return null;
+ return SeamPagesFileLoader.AUXILIARY_FILE_EXTENSION.equals(ext) ? "FileAnyAuxiliary" : null;
+ }
+
+}
16 years, 7 months
JBoss Tools SVN: r8478 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-30 10:03:24 -0400 (Fri, 30 May 2008)
New Revision: 8478
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/InnerModelHelper.java
Log:
JBIDE-830
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/InnerModelHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/InnerModelHelper.java 2008-05-30 14:03:04 UTC (rev 8477)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/InnerModelHelper.java 2008-05-30 14:03:24 UTC (rev 8478)
@@ -11,8 +11,11 @@
package org.jboss.tools.seam.internal.core;
+import java.io.IOException;
+
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -23,7 +26,9 @@
import org.jboss.tools.common.model.XModelConstants;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.project.ProjectHome;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.XModelObjectUtil;
public class InnerModelHelper {
@@ -35,12 +40,8 @@
XModelObject webinf = model.getByPath("FileSystems/WEB-INF"); //$NON-NLS-1$
if(webinf != null) return model;
- IPath webInfPath = null;
+ IPath webInfPath = getWebInfPath(project);
- if(ComponentCore.createComponent(project)!=null) {
- webInfPath = getWebInfPath(project);
- }
-
if(webInfPath == null) return model;
IFolder webInfFolder = ResourcesPlugin.getWorkspace().getRoot().getFolder(webInfPath);
@@ -54,9 +55,12 @@
webinf.setAttributeValue("location", XModelConstants.WORKSPACE_REF); //$NON-NLS-1$
fs.addChild(webinf);
+ String webInfLocation = XModelObjectUtil.expand(XModelConstants.WORKSPACE_REF, model, null);
+ String webRootLocation = getWebRootPath(project, webInfLocation);
+
XModelObject webroot = model.createModelObject("FileSystemFolder", null); //$NON-NLS-1$
webroot.setAttributeValue("name", "WEB-ROOT"); //$NON-NLS-1$ //$NON-NLS-2$
- webroot.setAttributeValue("location", XModelConstants.WORKSPACE_REF + "/.."); //$NON-NLS-1$ //$NON-NLS-2$
+ webroot.setAttributeValue("location", webRootLocation); //$NON-NLS-1$ //$NON-NLS-2$
fs.addChild(webroot);
XModelObject lib = model.createModelObject("FileSystemFolder", null); //$NON-NLS-1$
@@ -69,10 +73,39 @@
//Taken from J2EEUtils and modified
public static IPath getWebInfPath(IProject project) {
- IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if(component == null) return null;
IVirtualFolder webInfDir = component.getRootFolder().getFolder(new Path("/WEB-INF"));
IPath modulePath = webInfDir.getWorkspaceRelativePath();
return (!webInfDir.exists()) ? null : modulePath;
}
+ static String getWebRootPath(IProject project, String webInfLocation) {
+ String webRootLocation = XModelConstants.WORKSPACE_REF + "/..";
+
+ IPath wrp = ProjectHome.getFirstWebContentPath(project);
+ IPath wip = ProjectHome.getWebInfPath(project);
+
+ if(wrp == null || wip == null) {
+ return webRootLocation;
+ }
+
+ IResource wrpc = ResourcesPlugin.getWorkspace().getRoot().findMember(wrp);
+ IResource wipc = ResourcesPlugin.getWorkspace().getRoot().findMember(wip);
+ if(wrpc != null && wipc != null && wipc.isLinked()) {
+ IPath p = wrpc.getLocation();
+ if(p != null) {
+ try {
+ webRootLocation = p.toFile().getCanonicalPath().replace('\\', '/');
+ } catch (IOException e) {
+ }
+ String relative = org.jboss.tools.common.util.FileUtil.getRelativePath(webInfLocation, webRootLocation);
+ if(relative != null) {
+ webRootLocation = XModelConstants.WORKSPACE_REF + relative;
+ }
+ }
+ }
+ return webRootLocation;
+ }
+
}
16 years, 7 months
JBoss Tools SVN: r8477 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-30 10:03:04 -0400 (Fri, 30 May 2008)
New Revision: 8477
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFAutoLoad.java
Log:
JBIDE-830
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFAutoLoad.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFAutoLoad.java 2008-05-30 14:02:43 UTC (rev 8476)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFAutoLoad.java 2008-05-30 14:03:04 UTC (rev 8477)
@@ -1,15 +1,21 @@
package org.jboss.tools.jsf.project;
+import java.io.IOException;
import java.util.Properties;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelConstants;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.filesystems.impl.FileSystemImpl;
import org.jboss.tools.common.model.project.IAutoLoad;
+import org.jboss.tools.common.model.project.ProjectHome;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.XModelObjectUtil;
public class JSFAutoLoad implements IAutoLoad {
@@ -35,10 +41,13 @@
webinf.setAttributeValue("name", "WEB-INF"); //$NON-NLS-1$ //$NON-NLS-2$
webinf.setAttributeValue("location", XModelConstants.WORKSPACE_REF); //$NON-NLS-1$
fs.addChild(webinf);
+
+ String webInfLocation = XModelObjectUtil.expand(XModelConstants.WORKSPACE_REF, model, null);
+ String webRootLocation = getWebRootPath(project, webInfLocation);
XModelObject webroot = model.createModelObject("FileSystemFolder", null); //$NON-NLS-1$
webroot.setAttributeValue("name", "WEB-ROOT"); //$NON-NLS-1$ //$NON-NLS-2$
- webroot.setAttributeValue("location", XModelConstants.WORKSPACE_REF + "/.."); //$NON-NLS-1$ //$NON-NLS-2$
+ webroot.setAttributeValue("location", webRootLocation); //$NON-NLS-1$ //$NON-NLS-2$
fs.addChild(webroot);
XModelObject lib = model.createModelObject("FileSystemFolder", null); //$NON-NLS-1$
@@ -48,4 +57,32 @@
}
+ static String getWebRootPath(IProject project, String webInfLocation) {
+ String webRootLocation = XModelConstants.WORKSPACE_REF + "/..";
+
+ IPath wrp = ProjectHome.getFirstWebContentPath(project);
+ IPath wip = ProjectHome.getWebInfPath(project);
+
+ if(wrp == null || wip == null) {
+ return webRootLocation;
+ }
+
+ IResource wrpc = ResourcesPlugin.getWorkspace().getRoot().findMember(wrp);
+ IResource wipc = ResourcesPlugin.getWorkspace().getRoot().findMember(wip);
+ if(wrpc != null && wipc != null && wipc.isLinked()) {
+ IPath p = wrpc.getLocation();
+ if(p != null) {
+ try {
+ webRootLocation = p.toFile().getCanonicalPath().replace('\\', '/');
+ } catch (IOException e) {
+ }
+ String relative = org.jboss.tools.common.util.FileUtil.getRelativePath(webInfLocation, webRootLocation);
+ if(relative != null) {
+ webRootLocation = XModelConstants.WORKSPACE_REF + relative;
+ }
+ }
+ }
+ return webRootLocation;
+ }
+
}
16 years, 7 months
JBoss Tools SVN: r8476 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-30 10:02:43 -0400 (Fri, 30 May 2008)
New Revision: 8476
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java
Log:
JBIDE-830
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java 2008-05-30 13:55:38 UTC (rev 8475)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java 2008-05-30 14:02:43 UTC (rev 8476)
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.jboss.tools.common.model.XModelConstants;
@@ -100,4 +101,18 @@
return (!webInfDir.exists()) ? null : modulePath;
}
+ public static IPath getFirstWebContentPath(IProject project) {
+ IPath modulePath = null;
+ try {
+ IVirtualComponent vc = ComponentCore.createComponent(project);
+ if (vc == null || vc.getRootFolder() == null)
+ return null;
+ if (ModuleCoreNature.isFlexibleProject(project)) {
+ modulePath = vc.getRootFolder().getWorkspaceRelativePath();
+ }
+ } catch (Exception ex) {
+ }
+
+ return modulePath;
+ }
}
16 years, 7 months
JBoss Tools SVN: r8475 - in trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt: org/jboss/tools and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-05-30 09:55:38 -0400 (Fri, 30 May 2008)
New Revision: 8475
Modified:
trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/pdf.xsl
trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/pdf.xsl
Log:
http://jira.jboss.com/jira/browse/JBDS-321 - deleating unnecessary import
Modified: trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/pdf.xsl
===================================================================
--- trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/pdf.xsl 2008-05-30 13:54:27 UTC (rev 8474)
+++ trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/pdf.xsl 2008-05-30 13:55:38 UTC (rev 8475)
@@ -9,6 +9,5 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="classpath:/xslt/com/jboss/pdf.xsl"/>
- <xsl:import href="common.xsl"/>
</xsl:stylesheet>
Modified: trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/pdf.xsl
===================================================================
--- trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/pdf.xsl 2008-05-30 13:54:27 UTC (rev 8474)
+++ trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/pdf.xsl 2008-05-30 13:55:38 UTC (rev 8475)
@@ -9,7 +9,6 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="classpath:/xslt/org/jboss/pdf.xsl"/>
- <xsl:import href="common.xsl"/>
<!-- Ignore image scaling in html version -->
<xsl:param name="ignore.image.scaling" select="1"/>
16 years, 7 months
JBoss Tools SVN: r8474 - in trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt: org/jboss/tools and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-05-30 09:54:27 -0400 (Fri, 30 May 2008)
New Revision: 8474
Modified:
trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/common.xsl
trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/common.xsl
Log:
http://jira.jboss.com/jira/browse/JBDS-321 - adding icon on tab of guides pages
Modified: trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/common.xsl
===================================================================
--- trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/common.xsl 2008-05-30 13:44:38 UTC (rev 8473)
+++ trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/com/jboss/tools/common.xsl 2008-05-30 13:54:27 UTC (rev 8474)
@@ -7,10 +7,58 @@
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
+
<!-- XHTML settings -->
<xsl:param name="html.stylesheet" select="'css/tools.css'"/>
+ <xsl:template name="head.content">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="title">
+ <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
+ </xsl:param>
+
+ <title xmlns="http://www.w3.org/1999/xhtml" >
+ <xsl:copy-of select="$title"/>
+ </title>
+
+ <xsl:if test="$html.stylesheet != ''">
+ <xsl:call-template name="output.html.stylesheets">
+ <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:if test="$link.mailto.url != ''">
+ <link rev="made" href="{$link.mailto.url}"/>
+ </xsl:if>
+
+ <xsl:if test="$html.base != ''">
+ <base href="{$html.base}"/>
+ </xsl:if>
+
+ <meta xmlns="http://www.w3.org/1999/xhtml" name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
+
+ <xsl:if test="$generate.meta.abstract != 0">
+ <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/>
+ <xsl:if test="$info and $info/abstract">
+ <meta xmlns="http://www.w3.org/1999/xhtml" name="description">
+ <xsl:attribute name="content">
+ <xsl:for-each select="$info/abstract[1]/*">
+ <xsl:value-of select="normalize-space(.)"/>
+ <xsl:if test="position() < last()">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:attribute>
+ </meta>
+ </xsl:if>
+ </xsl:if>
+
+ <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="images/favicon0.ico" />
+
+ <xsl:apply-templates select="." mode="head.keywords.content"/>
+ </xsl:template>
+
<!-- XHTML and PDF -->
+
</xsl:stylesheet>
Modified: trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/common.xsl
===================================================================
--- trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/common.xsl 2008-05-30 13:44:38 UTC (rev 8473)
+++ trunk/documentation/jbosstools-docbook-xslt/src/main/resources/xslt/org/jboss/tools/common.xsl 2008-05-30 13:54:27 UTC (rev 8474)
@@ -11,6 +11,53 @@
<!-- XHTML settings -->
<xsl:param name="html.stylesheet" select="'css/tools.css'"/>
+ <xsl:template name="head.content">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="title">
+ <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
+ </xsl:param>
+
+ <title xmlns="http://www.w3.org/1999/xhtml" >
+ <xsl:copy-of select="$title"/>
+ </title>
+
+ <xsl:if test="$html.stylesheet != ''">
+ <xsl:call-template name="output.html.stylesheets">
+ <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:if test="$link.mailto.url != ''">
+ <link rev="made" href="{$link.mailto.url}"/>
+ </xsl:if>
+
+ <xsl:if test="$html.base != ''">
+ <base href="{$html.base}"/>
+ </xsl:if>
+
+ <meta xmlns="http://www.w3.org/1999/xhtml" name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
+
+ <xsl:if test="$generate.meta.abstract != 0">
+ <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/>
+ <xsl:if test="$info and $info/abstract">
+ <meta xmlns="http://www.w3.org/1999/xhtml" name="description">
+ <xsl:attribute name="content">
+ <xsl:for-each select="$info/abstract[1]/*">
+ <xsl:value-of select="normalize-space(.)"/>
+ <xsl:if test="position() < last()">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:attribute>
+ </meta>
+ </xsl:if>
+ </xsl:if>
+
+ <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="images/favicon.ico" />
+
+ <xsl:apply-templates select="." mode="head.keywords.content"/>
+ </xsl:template>
+
<!-- XHTML and PDF -->
</xsl:stylesheet>
16 years, 7 months
JBoss Tools SVN: r8473 - trunk/struts/docs/struts_tools_tutorial/en/images.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-05-30 09:44:38 -0400 (Fri, 30 May 2008)
New Revision: 8473
Added:
trunk/struts/docs/struts_tools_tutorial/en/images/favicon.ico
Log:
http://jira.jboss.com/jira/browse/JBDS-321 - adding favicon.ico into images folder
Added: trunk/struts/docs/struts_tools_tutorial/en/images/favicon.ico
===================================================================
(Binary files differ)
Property changes on: trunk/struts/docs/struts_tools_tutorial/en/images/favicon.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 7 months
JBoss Tools SVN: r8472 - trunk/struts/docs/struts_tools_ref_guide/en/images.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-05-30 09:44:23 -0400 (Fri, 30 May 2008)
New Revision: 8472
Added:
trunk/struts/docs/struts_tools_ref_guide/en/images/favicon.ico
Log:
http://jira.jboss.com/jira/browse/JBDS-321 - adding favicon.ico into images folder
Added: trunk/struts/docs/struts_tools_ref_guide/en/images/favicon.ico
===================================================================
(Binary files differ)
Property changes on: trunk/struts/docs/struts_tools_ref_guide/en/images/favicon.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 7 months