JBoss Tools SVN: r9721 - trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-08-14 08:19:46 -0400 (Thu, 14 Aug 2008)
New Revision: 9721
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java
Log:
JBIDE-2612
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java 2008-08-14 12:18:15 UTC (rev 9720)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java 2008-08-14 12:19:46 UTC (rev 9721)
@@ -19,6 +19,7 @@
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.draw2d.geometry.Point;
+import org.jboss.tools.common.meta.XModelEntity;
import org.jboss.tools.common.model.ui.action.XModelObjectActionList;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.ui.actions.ActionRegistry;
@@ -68,10 +69,10 @@
IStructuredSelection ss = (IStructuredSelection)s;
XModelObject object = SelectionUtil.getTarget(ss.getFirstElement());
if(object != null) {
+ String entityName = object.getModelEntity().getName();
if(object.getModelEntity().getName().equals(SeamPagesConstants.ENT_DIAGRAM_ITEM_OUTPUT)
&& object instanceof ReferenceObject && ((ReferenceObject)object).getReference() == null) {
- //virtual link
- return;
+ entityName = "SeamPagesDiagramItemOutputVirtual_ActionList";
}
PagesDiagramEditPart part = (PagesDiagramEditPart)getViewer().getRootEditPart().getChildren().get(0);
Properties p = new Properties();
@@ -84,7 +85,9 @@
}
p.put("diagramEditPart", part);
- XModelObjectActionList list = new XModelObjectActionList(object.getModelEntity().getActionList(), object, SelectionUtil.getTargets(ss), new Object[]{object, p});
+ XModelEntity entity = object.getModel().getMetaData().getEntity(entityName);
+ if(entity == null) return;
+ XModelObjectActionList list = new XModelObjectActionList(entity.getActionList(), object, SelectionUtil.getTargets(ss), new Object[]{object, p});
Menu menu = getMenu();
list.createMenu(menu);
list.removeLastSeparator(menu);
17 years, 5 months
JBoss Tools SVN: r9720 - in trunk/seam/plugins/org.jboss.tools.seam.pages.xml: resources/help and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-08-14 08:18:15 -0400 (Thu, 14 Aug 2008)
New Revision: 9720
Added:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/GoToNodeNandler.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/help/keys-seam-pages.properties
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
Log:
JBIDE-2612
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-08-14 12:07:01 UTC (rev 9719)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-08-14 12:18:15 UTC (rev 9720)
@@ -75,6 +75,8 @@
class="org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler"/>
<xclass id="org.jboss.tools.seam.pages.xml.model.handlers.DeletePageItemHandler"
class="org.jboss.tools.seam.pages.xml.model.handlers.DeletePageItemHandler"/>
+ <xclass id="org.jboss.tools.seam.pages.xml.model.handlers.GoToNodeNandler"
+ class="org.jboss.tools.seam.pages.xml.model.handlers.GoToNodeNandler"/>
<xclass id="org.jboss.tools.seam.pages.xml.model.handlers.AddViewSupport"
class="org.jboss.tools.seam.pages.xml.model.handlers.AddViewSupport"/>
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/help/keys-seam-pages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/help/keys-seam-pages.properties 2008-08-14 12:07:01 UTC (rev 9719)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/help/keys-seam-pages.properties 2008-08-14 12:18:15 UTC (rev 9720)
@@ -195,3 +195,6 @@
FileSystemFolder_CreateFileSeamPage_0.WindowTitle=Add Seam Page File
FileSystemFolder_CreateFileSeamPage_0.Title=Seam Page File
+SeamItem_SelectNode.WindowTitle=Select Matching Node
+SeamItem_SelectNode.Title=Matching Nodes
+SeamItem_SelectNode.Message=Please Select a Node
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-08-14 12:07:01 UTC (rev 9719)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-08-14 12:18:15 UTC (rev 9720)
@@ -2817,7 +2817,8 @@
</XModelAttributes>
<XActionItem kind="list">
<XActionItem ICON="action.empty" displayName="New" kind="list" name="CreateActions">
- <!--XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
+ <XActionItem HIDE="always" HandlerClassName="%SpecialWizard%"
+ ICON="action.empty"
PROPERTIES="support=org.jboss.tools.seam.pages.xml.model.handlers.AddViewSupport"
displayName="New Page (wizard)..." kind="action" name="AddPageWizard">
<EntityData EntityName="SeamPagesAddViewWizard">
@@ -2825,20 +2826,18 @@
<AttributeData AttributeName="create file" Mandatory="no"/>
<AttributeData AttributeName="template" Mandatory="no"/>
</EntityData>
- </XActionItem-->
+ </XActionItem>
<XActionItem
HandlerClassName="org.jboss.tools.seam.ui.pages.editor.commands.AddPageOnDiagramHandler"
- ICON="action.empty"
- displayName="New Page..." kind="action" name="AddPage"/>
- <!--XActionItem
+ ICON="action.empty" displayName="New Page..." kind="action" name="AddPage"/>
+ <XActionItem HIDE="always"
HandlerClassName="org.jboss.tools.jsf.model.handlers.JSFProcessRegirectHandler"
ICON="action.empty"
PROPERTIES="actionpath=CreateActions/AddException"
- displayName="New Exception (wizard)..." kind="action" name="AddExceptionWizard"/-->
+ displayName="New Exception (wizard)..." kind="action" name="AddExceptionWizard"/>
<XActionItem
HandlerClassName="org.jboss.tools.seam.ui.pages.editor.commands.AddExceptionOnDiagramHandler"
- ICON="action.empty"
- displayName="New Exception ..." kind="action" name="AddException"/>
+ ICON="action.empty" displayName="New Exception ..." kind="action" name="AddException"/>
</XActionItem>
<XActionItem HIDE="always"
HandlerClassName="org.jboss.tools.jsf.model.handlers.CreateCommentHandler"
@@ -2980,7 +2979,11 @@
<XActionItem HIDE="disabled"
HandlerClassName="org.jboss.tools.struts.model.handlers.SelectInNavigatorHandler"
ICON="action.empty" displayName="Select in Tree Views" kind="action" name="Select"/>
- <XActionItem kind="list" name="BreakPointActions"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.GoToNodeNandler"
+ ICON="action.empty"
+ PROPERTIES="help=SeamItem_SelectNode;wizard=org.jboss.tools.seam.ui.pages.editor.wizard.SelectItemWizard"
+ displayName="Go To Node" kind="action" name="GoTo"/>
<XActionItem displayName="Verify" kind="list" name="ProcessVerifyActions">
<XActionItem kind="list" name="StaticActions">
<XActionItem BaseActionName="VerifyAll"
@@ -3141,6 +3144,43 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
+ <XModelEntity
+ ImplementingClass=""
+ XMLSUBPATH="" name="SeamPagesDiagramItemOutputVirtual_ActionList">
+ <XChildrenEntities/>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.jsf.process-item-output" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem
+ HandlerClassName="org.jboss.tools.jsf.model.handlers.AutolayoutTransitionHandler"
+ ICON="action.empty" displayName="Auto Layout" kind="action" name="Autolayout"/>
+ <XActionItem kind="list" name="LinkActions">
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.jsf.model.handlers.ModifyLinkHandler"
+ ICON="action.empty" PROPERTIES="value=no;property=shortcut"
+ displayName="Show as Transition" kind="action" name="AsTransition"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.jsf.model.handlers.ModifyLinkHandler"
+ ICON="action.empty" PROPERTIES="value=yes;property=shortcut"
+ displayName="Show as Shortcut" kind="action" name="AsSrortcut"/>
+ <XActionItem HIDE="always"
+ HandlerClassName="org.jboss.tools.jsf.model.handlers.ModifyLinkHandler"
+ ICON="action.empty" PROPERTIES="value=yes;property=hidden"
+ displayName="Hide" kind="action" name="Hide"/>
+ </XActionItem>
+ <XActionItem displayName="move" kind="list" name="MoveActions">
+ <XActionItem HIDE="always"
+ HandlerClassName="org.jboss.tools.jsf.model.handlers.OutputMoveHandler"
+ ICON="action.empty" displayName="Move" kind="action" name="Move"/>
+ </XActionItem>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
<XEntityExtension name="FileFolder">
<XChildrenEntities>
<XChildEntity name="FileSeamPages12"/>
Added: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/GoToNodeNandler.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/GoToNodeNandler.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/GoToNodeNandler.java 2008-08-14 12:18:15 UTC (rev 9720)
@@ -0,0 +1,37 @@
+package org.jboss.tools.seam.pages.xml.model.handlers;
+
+import java.util.ArrayList;
+import java.util.Properties;
+
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.jst.web.model.ReferenceObject;
+import org.jboss.tools.jst.web.model.handlers.FindItemOnDiagramHandler;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesDiagramStructureHelper;
+
+public class GoToNodeNandler extends FindItemOnDiagramHandler {
+
+ public GoToNodeNandler() {
+ }
+
+ public boolean isEnabled(XModelObject object) {
+ if(!super.isEnabled(object)) return false;
+ if(!(object instanceof ReferenceObject)) return false;
+ if(((ReferenceObject)object).getReference() != null) return false;
+ return true;
+ }
+
+ protected void fillProperties(XModelObject object, Properties p) {
+ super.fillProperties(object, p);
+ p.put("object", object.getParent());
+
+ //TODO find all matching nodes taking into account EL.
+ XModelObject[] outputs = object.getChildren();
+ ArrayList<XModelObject> targets = new ArrayList<XModelObject>();
+ for (int i = 0; i < outputs.length; i++) {
+ XModelObject o = SeamPagesDiagramStructureHelper.getInstance().getItemOutputTarget(outputs[i]);
+ if(o != null) targets.add(o);
+ }
+ p.put("items", targets.toArray(new XModelObject[0]));
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r9719 - in trunk: jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170 and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-08-14 08:07:01 -0400 (Thu, 14 Aug 2008)
New Revision: 9719
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/edit_doctype_test.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2569/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2569/selection.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2526Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2170Test.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
was added junit tests
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/edit_doctype_test.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/edit_doctype_test.xhtml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/edit_doctype_test.xhtml 2008-08-14 12:07:01 UTC (rev 9719)
@@ -0,0 +1,74 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+<f:loadBundle basename="resources" var="msg" />
+<head>
+<title><ui:insert name="pageTitle">Page Title</ui:insert></title>
+<style type="text/css">
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+}
+
+.header {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 18px;
+}
+
+.bottom {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9px;
+ text-align: center;
+ vertical-align: middle;
+ color: #8E969D;
+}
+</style>
+</head>
+
+<body bgcolor="#ffffff">
+<table style="border: 1px solid #CAD6E0" align="center" cellpadding="0"
+ cellspacing="0" border="0" width="400">
+ <tbody>
+
+ <tr>
+ <td class="header" height="42" align="center" valign="middle"
+ width="100%" bgcolor="#E4EBEB">Facelets Hello Application</td>
+ </tr>
+ <tr>
+ <td height="1" width="100%" bgcolor="#CAD6E0"></td>
+ </tr>
+
+ <tr>
+ <td width="100%" colspan="2">
+ <table width="100%" style="height: 150px" align="left"
+ cellpadding="0" cellspacing="0" border="0">
+ <tbody>
+ <tr>
+ <td align="center" width="100%" valign="middle"><h:message
+ showSummary="true" showDetail="false"
+ style="color: red; font-weight: bold;" for="name" />
+ <form jsfc="h:form" id="idForCheck">${msg.prompt} <input
+ label="Name" jsfc="h:inputText" required="true" id="name"
+ value="#{person.name}" /> <input type="submit"
+ jsfc="h:commandButton" id="submit" action="greeting"
+ value="Say Hello" /></form>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" valign="bottom" height="1" width="100%"
+ bgcolor="#CAD6E0"></td>
+ </tr>
+ </tbody>
+</table>
+</body>
+
+</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2569/selection.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2569/selection.jsp (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2569/selection.jsp 2008-08-14 12:07:01 UTC (rev 9719)
@@ -0,0 +1,10 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ some text
+ </body>
+</html>
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-08-14 12:02:49 UTC (rev 9718)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-08-14 12:07:01 UTC (rev 9719)
@@ -31,6 +31,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2297Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2434Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2505Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2526Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2582Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2584Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2594Test;
@@ -90,6 +91,7 @@
suite.addTestSuite(JBIDE2582Test.class);
suite.addTestSuite(JBIDE2594Test.class);
suite.addTestSuite(JBIDE924Test.class);
+ suite.addTestSuite(JBIDE2526Test.class);
// $JUnit-END$
// added by Max Areshkau
// add here projects which should be imported for junit tests
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2526Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2526Test.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2526Test.java 2008-08-14 12:07:01 UTC (rev 9719)
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.jsf.vpe.jsf.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.util.SelectionUtil;
+import org.jboss.tools.vpe.editor.util.TextUtil;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsISelection;
+import org.mozilla.interfaces.nsISelectionController;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @author sdzmitrovich
+ *
+ * http://jira.jboss.com/jira/browse/JBIDE-2569
+ *
+ */
+public class JBIDE2526Test extends VpeTest {
+
+ private static final String SELECTION_PAGE_NAME = "JBIDE/2569/selection.jsp"; //$NON-NLS-1$
+
+ public JBIDE2526Test(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ * @throws Throwable
+ */
+ public void testSourceSelection() throws Throwable {
+
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(SELECTION_PAGE_NAME,
+ JsfAllTests.IMPORT_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get controller
+ VpeController controller = getVpeController(part);
+ assertNotNull(controller);
+
+ Document document = getSourceDocument(controller);
+
+ Node body = document.getDocumentElement().getElementsByTagName("body")
+ .item(0);
+
+ NodeList children = body.getChildNodes();
+
+ for (int i = 0; i < children.getLength(); i++) {
+
+ Node child = children.item(i);
+
+ if (child.getNodeType() == Node.TEXT_NODE
+ && child.getNodeValue() != null)
+
+ SelectionUtil.setSourceSelection(controller.getPageContext(),
+ child, 0, child.getNodeValue().length() - 1);
+
+ nsISelection selection = controller.getVisualSelectionController()
+ .getSelection(nsISelectionController.SELECTION_NORMAL);
+
+ assertEquals(0, selection.getAnchorOffset());
+ assertEquals(TextUtil.visualPosition(child.getNodeValue(), child
+ .getNodeValue().length() - 1), selection.getFocusOffset());
+
+ }
+
+ // check exception
+ if (getException() != null) {
+ throw getException();
+ }
+
+ }
+
+}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2170Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2170Test.java 2008-08-14 12:02:49 UTC (rev 9718)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2170Test.java 2008-08-14 12:07:01 UTC (rev 9719)
@@ -12,15 +12,21 @@
package org.jboss.tools.jsf.vpe.jsf.test.jbide;
import org.eclipse.core.resources.IFile;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.DocTypeUtil;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMDocumentType;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
/**
*
@@ -39,6 +45,10 @@
private static final String COMPLEX_DOCTYPE_TEST_PAGE_NAME = "JBIDE/2170/complex_doctype_test.xhtml"; //$NON-NLS-1$
+ private static final String EDIT_DOCTYPE_TEST_PAGE_NAME = "JBIDE/2170/edit_doctype_test.xhtml"; //$NON-NLS-1$
+
+ private static final String ELEMENT_ID = "idForCheck"; //$NON-NLS-1$
+
private static final String CORRECT_NAME = "html3"; //$NON-NLS-1$
public JsfJbide2170Test(String name) {
@@ -57,8 +67,9 @@
setException(null);
// get test page path
- IFile file = (IFile) TestUtil.getComponentPath(
- WITHOUT_DOCTYPE_TEST_PAGE_NAME, JsfAllTests.IMPORT_PROJECT_NAME);
+ IFile file = (IFile) TestUtil
+ .getComponentPath(WITHOUT_DOCTYPE_TEST_PAGE_NAME,
+ JsfAllTests.IMPORT_PROJECT_NAME);
IEditorInput input = new FileEditorInput(file);
@@ -149,7 +160,8 @@
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(
- TEMPLATE_DOCTYPE_TEST_PAGE_NAME, JsfAllTests.IMPORT_PROJECT_NAME);
+ TEMPLATE_DOCTYPE_TEST_PAGE_NAME,
+ JsfAllTests.IMPORT_PROJECT_NAME);
IEditorInput input = new FileEditorInput(file);
@@ -193,8 +205,9 @@
setException(null);
// get test page path
- IFile file = (IFile) TestUtil.getComponentPath(
- COMPLEX_DOCTYPE_TEST_PAGE_NAME, JsfAllTests.IMPORT_PROJECT_NAME);
+ IFile file = (IFile) TestUtil
+ .getComponentPath(COMPLEX_DOCTYPE_TEST_PAGE_NAME,
+ JsfAllTests.IMPORT_PROJECT_NAME);
IEditorInput input = new FileEditorInput(file);
@@ -227,4 +240,68 @@
}
+ /**
+ *
+ * @throws Throwable
+ */
+ public void testEditDoctypePage() throws Throwable {
+
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(
+ EDIT_DOCTYPE_TEST_PAGE_NAME, JsfAllTests.IMPORT_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ VpeController controller = getVpeController(part);
+
+ // controller must be not null
+ assertNotNull(controller);
+
+ // get document from opened page
+ Document document = getSourceDocument(controller);
+
+ // controller must be not null
+ assertNotNull(document);
+
+ // get doctype
+ DocumentType documentType = document.getDoctype();
+
+ // documentType must be not null
+ assertNotNull(documentType);
+
+ int start = ((IDOMNode) documentType).getStartOffset();
+ int end = ((IDOMNode) documentType).getEndOffset();
+
+ // get editor control
+ StyledText styledText = part.getSourceEditor().getTextViewer()
+ .getTextWidget();
+ assertNotNull(styledText);
+ styledText.replaceTextRange(start, end - start, "");
+
+ TestUtil.delay(500);
+
+ controller.visualRefresh();
+
+ TestUtil.delay(500);
+
+ nsIDOMDocument visualDocument = getVpeVisualDocument(part);
+
+ nsIDOMElement element = visualDocument.getElementById(ELEMENT_ID);
+ assertNotNull(element);
+
+ // check exception
+ if (getException() != null) {
+ throw getException();
+ }
+
+ }
+
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-08-14 12:02:49 UTC (rev 9718)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-08-14 12:07:01 UTC (rev 9719)
@@ -3228,5 +3228,13 @@
public VpeSelectionController getVisualSelectionController() {
return visualSelectionController;
}
+
+ /**
+ *
+ * @return sourceBuilder
+ */
+ public VpeSourceDomBuilder getSourceBuilder() {
+ return sourceBuilder;
+ }
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2008-08-14 12:02:49 UTC (rev 9718)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2008-08-14 12:07:01 UTC (rev 9719)
@@ -33,6 +33,7 @@
import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.mozilla.interfaces.nsIDOMDocument;
+import org.w3c.dom.Document;
/**
@@ -168,7 +169,17 @@
return document;
}
+
+ /**
+ *
+ * @return source document
+ */
+ protected Document getSourceDocument(VpeController controller) {
+ return controller.getSourceBuilder().getSourceDocument();
+
+ }
+
/**
* Gets visual page editor controller.
*
@@ -279,6 +290,4 @@
this.checkWarning = checkWarning;
}
-
-
}
17 years, 5 months
JBoss Tools SVN: r9718 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-08-14 08:02:49 -0400 (Thu, 14 Aug 2008)
New Revision: 9718
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/FindItemOnDiagramHandler.java
Log:
JBIDE-2612
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/FindItemOnDiagramHandler.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/FindItemOnDiagramHandler.java 2008-08-14 10:28:51 UTC (rev 9717)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/FindItemOnDiagramHandler.java 2008-08-14 12:02:49 UTC (rev 9718)
@@ -27,10 +27,7 @@
public void executeHandler(XModelObject object, Properties p) throws XModelException {
p = new Properties();
- p.put("object", object);
- String help = action.getProperty("help");
- //"JSFProcess_SelectItem"
- p.put("help", help);
+ fillProperties(object, p);
String wizard = action.getProperty("wizard");
//"org.jboss.tools.jsf.ui.editor.wizard.SelectItemWizard"
SpecialWizard sw = SpecialWizardFactory.createSpecialWizard(wizard);
@@ -45,6 +42,13 @@
}
selectInEditor(selected);
}
+
+ protected void fillProperties(XModelObject object, Properties p) {
+ p.put("object", object);
+ String help = action.getProperty("help");
+ //"JSFProcess_SelectItem"
+ p.put("help", help);
+ }
public static void selectInEditor(XModelObject selected) {
if(selected == null) return;
17 years, 5 months
JBoss Tools SVN: r9717 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-08-14 06:28:51 -0400 (Thu, 14 Aug 2008)
New Revision: 9717
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectAdoptOperation.java
Log:
JBIDE-2579
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectAdoptOperation.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectAdoptOperation.java 2008-08-14 10:16:16 UTC (rev 9716)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectAdoptOperation.java 2008-08-14 10:28:51 UTC (rev 9717)
@@ -13,8 +13,11 @@
import java.io.File;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.common.model.XJob;
import org.jboss.tools.common.model.XModelConstants;
import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.project.IModelNature;
@@ -59,25 +62,47 @@
}
protected void postCreateWebNature() {
- File projectFile = getEclipseFile();
+ final File projectFile = getEclipseFile();
+ final IProject p = getProject();
+ model.getProperties().put(XModelConstants.AUTOLOAD, new JSFAutoLoad());
if(projectFile != null) {
if(projectFile.isFile()) {
- IFile f = EclipseResourceUtil.getFile(projectFile.getAbsolutePath());
- if(f != null && f.exists()) {
- try {
- f.delete(true, new NullProgressMonitor());
- } catch (CoreException e) {
- JSFModelPlugin.getPluginLog().logError(e);
+ XJob.addRunnable(new XJob.XRunnable() {
+ public String getId() {
+ return "Remove temporary working files.";
+ }
+ public void run() {
+ IFile f = EclipseResourceUtil.getFile(projectFile
+ .getAbsolutePath());
+ if (f != null && f.exists()) {
+ try {
+ f.delete(true, new NullProgressMonitor());
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ deleteExternally();
+ }
+ } else {
+ deleteExternally();
+ }
+ }
+
+ private void deleteExternally() {
projectFile.delete();
+ if(p != null && p.exists()) {
+ try {
+ p.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (CoreException e2) {
+ JSFModelPlugin.getPluginLog().logError(e2);
+ }
+ }
}
- } else {
- projectFile.delete();
- }
+
+ });
}
}
- model.getProperties().put(XModelConstants.AUTOLOAD, new JSFAutoLoad());
}
+
private File getEclipseFile() {
String fn = getProject().getLocation().toString() + "/" + IModelNature.PROJECT_FILE;
File f = new File(fn);
17 years, 5 months
JBoss Tools SVN: r9716 - trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-08-14 06:16:16 -0400 (Thu, 14 Aug 2008)
New Revision: 9716
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2612
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java 2008-08-14 08:41:25 UTC (rev 9715)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java 2008-08-14 10:16:16 UTC (rev 9716)
@@ -17,7 +17,10 @@
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.swt.SWT;
+import org.jboss.tools.jst.web.model.ReferenceObject;
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.edit.LinkEditPart;
@@ -92,6 +95,16 @@
} else {
g.setForegroundColor(getForegroundColor());
}
+
+ Page page=null;
+ if(link.getFromElement() instanceof Page)
+ page = (Page)link.getFromElement();
+
+ if(page != null && page.getData() != null && page.getData() instanceof ReferenceObject && ((ReferenceObject)page.getData()).getReference() == null){
+ g.setLineDash(new int[]{3,3});
+ g.setLineStyle(SWT.LINE_CUSTOM);
+ }
+
PointList points = getPoints();
Point point = points.getPoint(0);
Point beg = new Point();
17 years, 5 months
JBoss Tools SVN: r9715 - workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-08-14 04:41:25 -0400 (Thu, 14 Aug 2008)
New Revision: 9715
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
Log:
fix some bugs
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-08-14 08:41:00 UTC (rev 9714)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-08-14 08:41:25 UTC (rev 9715)
@@ -133,12 +133,25 @@
event.doit = true;
}
});
- sourceViewer.getTree().addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
+// sourceViewer.getTree().addListener(SWT.m, listener)
+ sourceViewer.getTree().addTreeListener(new TreeListener(){
+
+ public void treeCollapsed(TreeEvent e) {
+ treeExpanded(e);
+ }
+
+ public void treeExpanded(TreeEvent e) {
rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
null, new Object());
}
+
});
+// (new PaintListener() {
+// public void paintControl(PaintEvent e) {
+// rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
+// null, new Object());
+// }
+// });
if (initSourceTreeViewerProviders()) {
initSourceTreeViewer();
}
@@ -179,11 +192,23 @@
new Transfer[] { TemplateTransfer.getInstance() },
new TargetTreeDropTargetListener(targetViewer,
getGraphicalViewer()));
- targetViewer.getTree().addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
+// targetViewer.getTree().addPaintListener(new PaintListener() {
+// public void paintControl(PaintEvent e) {
+// rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
+// null, new Object());
+// }
+// });
+ targetViewer.getTree().addTreeListener(new TreeListener(){
+
+ public void treeCollapsed(TreeEvent e) {
+ treeExpanded(e);
+ }
+
+ public void treeExpanded(TreeEvent e) {
rootModel.firePropertyChange(RootModel.P_REFRESH_PANEL,
null, new Object());
}
+
});
if (initTargetTreeViewerProviders()) {
initTargetTreeViewer();
@@ -450,7 +475,12 @@
viewer.setInput(cw.getTreeViewerInputContents());
// the viewer must be expanded , then the graphics model can
// calculate the location correctly
+// viewer.refresh();
+ try{
viewer.expandAll();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
if (viewer == this.sourceViewer) {
this.createSourceGraphModels();
17 years, 5 months
JBoss Tools SVN: r9713 - in workspace/dart/plugins/org.jboss.tools.smooks.xml: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-08-14 04:40:09 -0400 (Thu, 14 Aug 2008)
New Revision: 9713
Added:
workspace/dart/plugins/org.jboss.tools.smooks.xml/icons/
workspace/dart/plugins/org.jboss.tools.smooks.xml/icons/sample.gif
workspace/dart/plugins/org.jboss.tools.smooks.xml/plugin.xml
workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/wizards/
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.xml/META-INF/MANIFEST.MF
workspace/dart/plugins/org.jboss.tools.smooks.xml/build.properties
workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/XmlActivator.java
workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/model/XMLStructuredModelContentProvider.java
workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/model/XMLStructuredModelLabelProvider.java
workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java
workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java
Log:
replace the contentprovider and labelprovider of the xsd.edit's
Modified: workspace/dart/plugins/org.jboss.tools.smooks.xml/META-INF/MANIFEST.MF
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/META-INF/MANIFEST.MF 2008-08-14 07:31:20 UTC (rev 9712)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/META-INF/MANIFEST.MF 2008-08-14 08:40:09 UTC (rev 9713)
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Xml StrucutredData Extention Plug-in
-Bundle-SymbolicName: org.jboss.tools.smooks.xml
+Bundle-SymbolicName: org.jboss.tools.smooks.xml;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.jboss.tools.smooks.xml.XmlActivator
Require-Bundle: org.eclipse.ui,
@@ -12,5 +12,9 @@
org.jboss.tools.smooks.model.edit,
org.jboss.tools.smooks.ui,
org.eclipse.ui.views,
- org.junit
+ org.junit,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.eclipse.xsd.edit,
+ org.eclipse.emf.edit.ui
Eclipse-LazyStart: true
Modified: workspace/dart/plugins/org.jboss.tools.smooks.xml/build.properties
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/build.properties 2008-08-14 07:31:20 UTC (rev 9712)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/build.properties 2008-08-14 08:40:09 UTC (rev 9713)
@@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ plugin.xml
Added: workspace/dart/plugins/org.jboss.tools.smooks.xml/icons/sample.gif
===================================================================
(Binary files differ)
Property changes on: workspace/dart/plugins/org.jboss.tools.smooks.xml/icons/sample.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dart/plugins/org.jboss.tools.smooks.xml/plugin.xml
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/plugin.xml (rev 0)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/plugin.xml 2008-08-14 08:40:09 UTC (rev 9713)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.jboss.tools.smooks.ui.viewerInitor">
+ <viewerInitor
+ contentProvider="org.jboss.tools.smooks.xml.model.XMLStructuredModelContentProvider"
+ creationWizard="org.jboss.tools.smooks.xml.ui.XMLStructuredDataWizard"
+ labelProvider="org.jboss.tools.smooks.xml.model.XMLStructuredModelLabelProvider"
+ name="XML/XSD"
+ typeID="org.jboss.tools.smooks.xml.viewerInitor.xml">
+ </viewerInitor>
+ </extension>
+
+</plugin>
Property changes on: workspace/dart/plugins/org.jboss.tools.smooks.xml/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/XmlActivator.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/XmlActivator.java 2008-08-14 07:31:20 UTC (rev 9712)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/XmlActivator.java 2008-08-14 08:40:09 UTC (rev 9713)
@@ -10,6 +10,8 @@
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.smooks.xml";
+
+ public static final String TYPE_ID = "org.jboss.tools.smooks.xml.viewerInitor.xml";
// The shared instance
private static XmlActivator plugin;
Modified: workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/model/XMLStructuredModelContentProvider.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/model/XMLStructuredModelContentProvider.java 2008-08-14 07:31:20 UTC (rev 9712)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/model/XMLStructuredModelContentProvider.java 2008-08-14 08:40:09 UTC (rev 9713)
@@ -10,204 +10,17 @@
******************************************************************************/
package org.jboss.tools.smooks.xml.model;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.xsd.provider.XSDItemProviderAdapterFactory;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDAttributeUse;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDParticleContent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
/**
* @author Dart Peng
*
* @CreateTime Jul 24, 2008
*/
-public class XMLStructuredModelContentProvider implements ITreeContentProvider {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
- * Object)
- */
- public Object[] getChildren(Object obj) {
- // for AbstractXMLObject (come from xml file fragment)
- if(obj instanceof DocumentObject){
- return new Object[]{((DocumentObject)obj).getRootTag()};
- }
-
- if(obj instanceof TagObject){
- List c = new ArrayList();
- List pros = ((TagObject)obj).getProperties();
- c.addAll(pros);
- c.addAll(((TagObject)obj).getChildren());
-
- return c.toArray();
- }
-
- // for XSD (come from XML Schema file)
- if (obj instanceof XSDSchema) {
- XSDSchema schema = (XSDSchema) obj;
- return schema.getElementDeclarations().toArray();
- }
- if (obj instanceof XSDElementDeclaration) {
- XSDElementDeclaration element = (XSDElementDeclaration) obj;
- XSDTypeDefinition td = element.getType();
- XSDSimpleTypeDefinition st = td.getSimpleType();
- // if the element is a simple type , return empty children
- if (st != null)
- return new Object[] {};
- // if the element is complex type , to find the element and
- // attributes defined by the type
-
- if (td instanceof XSDComplexTypeDefinition) {
- List<Object> childrenList = new ArrayList<Object>();
- XSDComplexTypeDefinition ctype = (XSDComplexTypeDefinition) td;
-
- List attributeContents = ctype.getAttributeContents();
- // first , add all attributes into children list
- for (Iterator iterator2 = attributeContents.iterator(); iterator2
- .hasNext();) {
- XSDAttributeUse attributeUse = (XSDAttributeUse) iterator2
- .next();
- XSDAttributeDeclaration attribute = attributeUse
- .getAttributeDeclaration();
- childrenList.add(attribute);
- }
- XSDParticle xsdparticle = td.getComplexType();
- if (xsdparticle != null) {
- XSDParticleContent term = xsdparticle.getContent();
- if (term instanceof XSDModelGroup) {
- List list = ((XSDModelGroup) term).getParticles();
- // second , to find the element define in the element
- for (Iterator iterator2 = list.iterator(); iterator2
- .hasNext();) {
- XSDParticle xp = (XSDParticle) iterator2.next();
- XSDParticleContent content = xp.getContent();
- if (content instanceof XSDElementDeclaration) {
- // if the element is reference element , don't
- // to add it
- XSDElementDeclaration child = (XSDElementDeclaration) content;
- if (child.isElementDeclarationReference()) {
- continue;
- }
- childrenList.add(child);
- }
- }
- }
- }
-
- return childrenList.toArray();
- }
- }
- return new Object[] {};
+public class XMLStructuredModelContentProvider extends AdapterFactoryContentProvider {
+ public XMLStructuredModelContentProvider() {
+ super(new XSDItemProviderAdapterFactory());
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object )
- */
- public Object getParent(Object arg0) {
- // if(arg0 instanceof)
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
- * Object)
- */
- public boolean hasChildren(Object obj) {
-
- // for AbstractXMLObject (come from xml file fragment)
- if(obj instanceof DocumentObject){
- return true;
- }
-
- if(obj instanceof TagObject){
- List pros = ((TagObject)obj).getProperties();
- List c = (((TagObject)obj).getChildren());
- return !pros.isEmpty() || !c.isEmpty();
- }
-
- // for XSD (come from XML Schema file)
-
- if (obj instanceof XSDSchema) {
- XSDSchema schema = (XSDSchema) obj;
- return !schema.getElementDeclarations().isEmpty();
- }
- if (obj instanceof XSDElementDeclaration) {
- XSDElementDeclaration element = (XSDElementDeclaration) obj;
- XSDTypeDefinition td = element.getType();
- XSDSimpleTypeDefinition st = td.getSimpleType();
- // if the element is a simple type , return false
- if (st != null)
- return false;
- // if the element is complex type , check the attributes and child
- // elements count
-
- if (td instanceof XSDComplexTypeDefinition) {
- boolean hasChildren = false;
- XSDComplexTypeDefinition ctype = (XSDComplexTypeDefinition) td;
- hasChildren = !ctype.getAttributeContents().isEmpty();
- XSDParticle xsdparticle = td.getComplexType();
- if (xsdparticle != null) {
- XSDParticleContent term = xsdparticle.getContent();
- if (term instanceof XSDModelGroup) {
- hasChildren = !((XSDModelGroup) term).getParticles()
- .isEmpty()
- || hasChildren;
- }
- }
-
- return hasChildren;
- }
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java
- * .lang.Object)
- */
- public Object[] getElements(Object arg0) {
- if (arg0 instanceof List) {
- return ((List) arg0).toArray();
- }
- return new Object[] {};
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
- * .viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
-
- }
-
}
Modified: workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/model/XMLStructuredModelLabelProvider.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/model/XMLStructuredModelLabelProvider.java 2008-08-14 07:31:20 UTC (rev 9712)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/model/XMLStructuredModelLabelProvider.java 2008-08-14 08:40:09 UTC (rev 9713)
@@ -10,27 +10,17 @@
******************************************************************************/
package org.jboss.tools.smooks.xml.model;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.xsd.provider.XSDItemProviderAdapterFactory;
/**
* @author Dart Peng
* @Date Jul 30, 2008
*/
-public class XMLStructuredModelLabelProvider extends LabelProvider {
+public class XMLStructuredModelLabelProvider extends AdapterFactoryLabelProvider {
- @Override
- public Image getImage(Object element) {
- // TODO Auto-generated method stub
- return super.getImage(element);
+ public XMLStructuredModelLabelProvider() {
+ super(new XSDItemProviderAdapterFactory());
}
- @Override
- public String getText(Object element) {
- if(element instanceof XMLStructuredModel){
-// ((XMLStructuredModel)element).
- }
- return super.getText(element);
- }
-
}
Modified: workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java 2008-08-14 07:31:20 UTC (rev 9712)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java 2008-08-14 08:40:09 UTC (rev 9713)
@@ -3,6 +3,9 @@
*/
package org.jboss.tools.smooks.xml.ui;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
@@ -16,6 +19,7 @@
public class XMLStructuredDataWizard extends Wizard implements
IStrucutredDataCreationWizard {
XMLStructuredDataWizardPage page = null;
+ Object xsdElement = null;
/**
*
*/
@@ -38,6 +42,7 @@
*/
@Override
public boolean performFinish() {
+ xsdElement = this.page.getReturnRootElementDec();
return true;
}
@@ -46,8 +51,7 @@
}
public Object getTreeViewerInputContents() {
- // TODO Auto-generated method stub
- return null;
+ return xsdElement;
}
public void init(IEditorSite site, IEditorInput input) {
Modified: workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java 2008-08-14 07:31:20 UTC (rev 9712)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java 2008-08-14 08:40:09 UTC (rev 9713)
@@ -3,6 +3,11 @@
*/
package org.jboss.tools.smooks.xml.ui;
+import java.io.IOException;
+import java.util.Collections;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
@@ -22,6 +27,8 @@
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDResourceFactoryImpl;
import org.jboss.tools.smooks.xml.model.XMLStructuredModelContentProvider;
import org.jboss.tools.smooks.xml.model.XMLStructuredModelLabelProvider;
@@ -52,6 +59,10 @@
super(pageName);
// TODO Auto-generated constructor stub
}
+
+ public Object getReturnRootElementDec(){
+ return this.tableViewer.getInput();
+ }
/*
* (non-Javadoc)
@@ -248,7 +259,25 @@
final Button loadXSDButton = new Button(xsdfileTextComposite, SWT.NONE);
loadXSDButton.setText("Load");
+ loadXSDButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ Resource resource = new XSDResourceFactoryImpl().createResource(URI
+ .createFileURI(xsdFileText.getText()));
+ try {
+ resource.load(Collections.EMPTY_MAP);
+ XSDSchema schema = (XSDSchema) resource.getContents().get(0);
+ tableViewer.setInput(schema);
+ changeWizardPageStatus();
+ } catch (IOException e1) {
+ //ignore
+ }
+ }
+
+ });
+
tableViewer = CheckboxTableViewer.newCheckList(xsdComposite,
SWT.FULL_SELECTION | SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
@@ -270,9 +299,10 @@
Object checkObject = event.getElement();
boolean check = event.getChecked();
flag = false;
- tableViewer.setAllChecked(true);
+ tableViewer.setAllChecked(false);
tableViewer.setChecked(checkObject, check);
flag = true;
+ changeWizardPageStatus();
}
}
});
@@ -346,4 +376,12 @@
changeWizardPageStatus();
}
+ public CheckboxTableViewer getTableViewer() {
+ return tableViewer;
+ }
+
+ public void setTableViewer(CheckboxTableViewer tableViewer) {
+ this.tableViewer = tableViewer;
+ }
+
}
17 years, 5 months
JBoss Tools SVN: r9712 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-08-14 03:31:20 -0400 (Thu, 14 Aug 2008)
New Revision: 9712
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2244
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-08-14 06:20:17 UTC (rev 9711)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-08-14 07:31:20 UTC (rev 9712)
@@ -105,6 +105,7 @@
selectMethod = new Button(container, SWT.CHECK);
selectMethod.setText("Use Console Configuration");
selectMethod.setSelection(true);
+ selectMethod.setEnabled(false);
selectMethod.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent e) {
17 years, 5 months