JBoss Tools SVN: r2392 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors: parts and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-11 11:56:54 -0400 (Wed, 11 Jul 2007)
New Revision: 2392
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java
Log:
http://jira.jboss.com/jira/browse/EXIN-367
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-11 14:55:03 UTC (rev 2391)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-11 15:56:54 UTC (rev 2392)
@@ -180,6 +180,10 @@
firePropertyChange(SET_HIDEN, null, new Boolean(hiden));
}
+ public void refreshReference(){
+ firePropertyChange(SET_HIDEN, null, new Boolean(hiden));
+ }
+
private void setElementHidden(ModelElement element, boolean hidden){
for (int i = 0; i < element.getChildren().size(); i++){
((Shape)element.getChildren().get(i)).setHiden(hidden);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java 2007-07-11 14:55:03 UTC (rev 2391)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java 2007-07-11 15:56:54 UTC (rev 2392)
@@ -29,6 +29,7 @@
import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleLabel;
import org.jboss.tools.hibernate.ui.veditor.editors.model.ComponentShape;
import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
public class ComponentShapeEditPart extends ExpandeableShapeEditPart {
@@ -71,7 +72,7 @@
figure.setSize(-1,-1);
refresh();
-// ((OrmDiagram)getParent().getModel()).setDirty(true);
+ ((OrmShape)getParent().getModel()).refreshReference();
} else {
super.propertyChange(evt);
}
17 years, 5 months
JBoss Tools SVN: r2391 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: ayukhovich
Date: 2007-07-11 10:55:03 -0400 (Wed, 11 Jul 2007)
New Revision: 2391
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPEditorMessages.properties
Log:
Add string property for resolving feature-request JBIDE-531
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPEditorMessages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPEditorMessages.properties 2007-07-11 14:53:30 UTC (rev 2390)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPEditorMessages.properties 2007-07-11 14:55:03 UTC (rev 2391)
@@ -1,3 +1,4 @@
JSPMultiPageEditor.TabLabel.VisualSource = Visual/Source
JSPMultiPageEditor.TabLabel.Visual = Visual
-JSPMultiPageEditor.TabLabel.Source = Source
\ No newline at end of file
+JSPMultiPageEditor.TabLabel.Source = Source
+JSPMultiPageEditor.TabLabel.DefaultWebBrowser = Default web browser
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2390 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-11 10:53:30 -0400 (Wed, 11 Jul 2007)
New Revision: 2390
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
Log:
EXIN-221 natures and build added to new seam project
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-11 14:32:54 UTC (rev 2389)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-11 14:53:30 UTC (rev 2390)
@@ -35,7 +35,9 @@
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
-public class SeamCoreBuilder extends IncrementalProjectBuilder {
+public class SeamCoreBuilder extends IncrementalProjectBuilder {
+ public static String BUILDER_ID = "org.jboss.tools.seam.core.seambuilder";
+
static IFileScanner[] FILE_SCANNERS = {
new JavaScanner(),
new XMLScanner(),
@@ -111,8 +113,6 @@
}
}
- public static final String BUILDER_ID = "org.jboss.tools.seam.core.seam.core";
-
private static final String MARKER_TYPE = "org.jboss.tools.seam.core.xmlProblem";
private SAXParserFactory parserFactory;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-11 14:32:54 UTC (rev 2389)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-11 14:53:30 UTC (rev 2390)
@@ -20,8 +20,10 @@
import java.util.Map;
import java.util.Set;
+import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -38,6 +40,7 @@
import org.jboss.tools.seam.core.ISeamScope;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.core.SeamCoreBuilder;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
@@ -79,9 +82,11 @@
public SeamProject() {}
public void configure() throws CoreException {
+ addToBuildSpec(SeamCoreBuilder.BUILDER_ID);
}
public void deconfigure() throws CoreException {
+ removeFromBuildSpec(SeamCoreBuilder.BUILDER_ID);
}
public IProject getProject() {
@@ -633,7 +638,47 @@
fireChanges(changes);
}
-}
-class InnerBuilder {
+ protected void addToBuildSpec(String builderID) throws CoreException {
+ IProjectDescription description = getProject().getDescription();
+ ICommand command = null;
+ ICommand commands[] = description.getBuildSpec();
+ for (int i = 0; i < commands.length && command == null; ++i) {
+ if (commands[i].getBuilderName().equals(builderID))
+ command = commands[i];
+ }
+ if (command == null) {
+ command = description.newCommand();
+ command.setBuilderName(builderID);
+ ICommand[] oldCommands = description.getBuildSpec();
+ ICommand[] newCommands = new ICommand[oldCommands.length + 1];
+ System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length);
+ newCommands[oldCommands.length] = command;
+ description.setBuildSpec(newCommands);
+ getProject().setDescription(description, null);
+ }
+ }
+
+ static String EXTERNAL_TOOL_BUILDER = "org.eclipse.ui.externaltools.ExternalToolBuilder";
+ static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle";
+
+ protected void removeFromBuildSpec(String builderID) throws CoreException {
+ IProjectDescription description = getProject().getDescription();
+ ICommand[] commands = description.getBuildSpec();
+ for (int i = 0; i < commands.length; ++i) {
+ String builderName = commands[i].getBuilderName();
+ if (!builderName.equals(builderID)) {
+ if(!builderName.equals(EXTERNAL_TOOL_BUILDER)) continue;
+ Object handle = commands[i].getArguments().get(LAUNCH_CONFIG_HANDLE);
+ if(handle == null || handle.toString().indexOf(builderID) < 0) continue;
+ }
+ ICommand[] newCommands = new ICommand[commands.length - 1];
+ System.arraycopy(commands, 0, newCommands, 0, i);
+ System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
+ description.setBuildSpec(newCommands);
+ getProject().setDescription(description, null);
+ return;
+ }
+ }
+
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-07-11 14:32:54 UTC (rev 2389)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-07-11 14:53:30 UTC (rev 2390)
@@ -37,6 +37,8 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
public class SeamFacetInstallDelegete extends Object implements IDelegate {
@@ -300,6 +302,11 @@
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+
+ //TODO check if template file org.jboss.tools.jst.web.xml is added to .settings
+ EclipseResourceUtil.addNatureToProject(project, "org.jboss.tools.jsf.jsfnature");
+ EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+
}
public static void copyFiles(File source, File dest, FileFilter filter) {
17 years, 5 months
JBoss Tools SVN: r2389 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-11 10:32:54 -0400 (Wed, 11 Jul 2007)
New Revision: 2389
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
Log:
EXIN-366: Adding elements on the diagram by double-click on fields of classes which have additional information in mapping files
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java 2007-07-11 14:22:06 UTC (rev 2388)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java 2007-07-11 14:32:54 UTC (rev 2389)
@@ -52,9 +52,11 @@
public Object visitPersistentField(Property field, Object argument) {
if (field !=null){
- if (field.getType().isCollectionType()) {
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldCollection")); //$NON-NLS-1$
- }
+ try {
+ if (field.getType().isCollectionType()) {
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldCollection")); //$NON-NLS-1$
+ }
+ } catch (Exception e) {}
}
return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java 2007-07-11 14:22:06 UTC (rev 2388)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java 2007-07-11 14:32:54 UTC (rev 2389)
@@ -595,7 +595,10 @@
StringBuffer name = new StringBuffer();
name.append(field.getName());
name.append(BUNDLE.getString("OrmModelNameVisitor.Colon"));
- String typeString = field.getType().getReturnedClass().getName();
+ String typeString = "";
+ try {
+ typeString = field.getType().getReturnedClass().getName();
+ } catch (Exception e) {}
if (typeString != null) {
/* IPersistentValueMapping value = null;
17 years, 5 months
JBoss Tools SVN: r2388 - in trunk/seam/plugins/org.jboss.tools.seam.ui: src/org/jboss/tools/seam/ui/views and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-11 10:22:06 -0400 (Wed, 11 Jul 2007)
New Revision: 2388
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
Log:
EXIN-218
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-11 14:19:58 UTC (rev 2387)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-11 14:22:06 UTC (rev 2388)
@@ -16,6 +16,7 @@
org.eclipse.wst.common.modulecore,
org.eclipse.wst.common.frameworks,
org.eclipse.wst.common.project.facet.core,
+ org.eclipse.jdt.core,
org.eclipse.jst.jsf.ui,
org.eclipse.wst.common.frameworks.ui,
org.jboss.tools.seam.core,
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-11 14:19:58 UTC (rev 2387)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-11 14:22:06 UTC (rev 2388)
@@ -13,6 +13,7 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;
import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamElement;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamScope;
@@ -62,6 +63,7 @@
}
public boolean hasChildren(Object element) {
+ if(element instanceof ISeamComponentDeclaration) return false;
return true;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2007-07-11 14:19:58 UTC (rev 2387)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2007-07-11 14:22:06 UTC (rev 2388)
@@ -1,12 +1,16 @@
package org.jboss.tools.seam.ui.views;
import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamElement;
+import org.jboss.tools.seam.core.ISeamJavaSourceReference;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamScope;
@@ -19,6 +23,18 @@
return ((ISeamScope)element).getType().toString();
} else if(element instanceof ISeamComponent) {
return "" + ((ISeamComponent)element).getName();
+ } else if(element instanceof ISeamJavaSourceReference) {
+ ISeamJavaSourceReference d = (ISeamJavaSourceReference)element;
+ IMember m = d.getSourceMember();
+ IType type = (m instanceof IType) ? (IType)m : m.getTypeRoot().findPrimaryType();
+ if(type.isBinary()) {
+ IResource r = ((ISeamElement)element).getResource();
+ String s = (r == null) ? "???" : r.getName();
+ return s + "/" + type.getFullyQualifiedName();
+ } else {
+ return type.getFullyQualifiedName();
+ }
+
} else if(element instanceof ISeamComponentDeclaration) {
IResource r = ((ISeamComponentDeclaration)element).getResource();
return r == null ? "???" : r.getName();
17 years, 5 months
JBoss Tools SVN: r2387 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-11 10:19:58 -0400 (Wed, 11 Jul 2007)
New Revision: 2387
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
Log:
http://jira.jboss.com/jira/browse/EXIN-367
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11 14:06:35 UTC (rev 2386)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11 14:19:58 UTC (rev 2387)
@@ -395,6 +395,10 @@
}
}
}
+ for(int i = reference.getChildren().size()-1;i>=0;i--){
+ if(reference.getChildren().get(i) instanceof ComponentShape)
+ hideReferences((ComponentShape)reference.getChildren().get(i));
+ }
removeLinks(reference);
getChildren().remove(reference);
elements.remove(reference);
17 years, 5 months
JBoss Tools SVN: r2386 - in trunk/seam/plugins/org.jboss.tools.seam.ui: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-11 10:06:35 -0400 (Wed, 11 Jul 2007)
New Revision: 2386
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
Log:
EXIN-218 Seam Components View implemented with common navigator framework.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-11 14:04:27 UTC (rev 2385)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-11 14:06:35 UTC (rev 2386)
@@ -9,6 +9,7 @@
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.ui.ide,
+ org.eclipse.ui.navigator,
org.eclipse.jst.servlet.ui,
org.eclipse.wst.web.ui,
org.eclipse.wst.common.project.facet.ui,
@@ -28,6 +29,7 @@
org.eclipse.jst.j2ee.web
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.seam.ui,
+ org.jboss.tools.seam.ui.views,
org.jboss.tools.seam.ui.internal.project.facet;x-internal:=true,
org.jboss.tools.seam.ui.widget.editor,
org.jboss.tools.seam.ui.widget.field,
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-11 14:04:27 UTC (rev 2385)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-11 14:06:35 UTC (rev 2386)
@@ -94,6 +94,13 @@
id="org.jboss.tools.seam.ui.views.SeamComponentsView"
name="Seam Components">
</view>
+ <view
+ category="org.jboss.tools.seam.ui"
+ class="org.eclipse.ui.navigator.CommonNavigator"
+ icon="icons/sample.gif"
+ id="org.jboss.tools.seam.ui.views.SeamComponentsNavigator"
+ name="Seam Components Navigator">
+ </view>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
@@ -108,4 +115,37 @@
</perspectiveExtension>
</extension>
+<extension point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding viewerId="org.jboss.tools.seam.ui.views.SeamComponentsNavigator">
+ <includes>
+ <contentExtension pattern="org.jboss.tools.seam.ui.views.rootContent" />
+ </includes>
+ </viewerContentBinding>
+</extension>
+
+<extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ name="Seam Root Content Provider"
+ priority="highest"
+ icon="icons/sample.gif"
+ activeByDefault="true"
+ contentProvider="org.jboss.tools.seam.ui.views.RootContentProvider"
+ labelProvider="org.jboss.tools.seam.ui.views.SeamLabelProvider"
+ id="org.jboss.tools.seam.ui.views.rootContent">
+ <triggerPoints>
+ <or>
+ <instanceof
+ value="org.eclipse.core.resources.IWorkspaceRoot" />
+ <instanceof
+ value="org.jboss.tools.seam.core.ISeamElement" />
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="org.jboss.tools.seam.core.ISeamElement" />
+ </or>
+ </possibleChildren>
+ </navigatorContent>
+</extension>
+
</plugin>
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-11 14:06:35 UTC (rev 2386)
@@ -0,0 +1,109 @@
+package org.jboss.tools.seam.ui.views;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamElement;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamScope;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
+import org.jboss.tools.seam.core.event.SeamProjectChangeEvent;
+
+public class RootContentProvider implements ITreeContentProvider, ISeamProjectChangeListener {
+ protected Viewer viewer;
+ IWorkspaceRoot root;
+
+ Set<ISeamProject> processed = new HashSet<ISeamProject>();
+
+ public Object[] getChildren(Object parentElement) {
+ if(parentElement instanceof IWorkspaceRoot) {
+ IWorkspaceRoot root = (IWorkspaceRoot)parentElement;
+ IProject[] ps = root.getProjects();
+ List<ISeamProject> children = new ArrayList<ISeamProject>();
+ for (int i = 0; i < ps.length; i++) {
+ ISeamProject p = SeamCorePlugin.getSeamProject(ps[i]);
+ if(p != null) {
+ if(!processed.contains(p)) {
+ processed.add(p);
+ p.addSeamProjectListener(this);
+ }
+ children.add(p);
+ }
+ }
+ return children.toArray(new ISeamProject[0]);
+ } else if(parentElement instanceof ISeamProject) {
+ return ((ISeamProject)parentElement).getScopes();
+ } else if(parentElement instanceof ISeamScope) {
+ return ((ISeamScope)parentElement).getComponents().toArray(new Object[0]);
+ } else if(parentElement instanceof ISeamComponent) {
+ return ((ISeamComponent)parentElement).getAllDeclarations().toArray(new Object[0]);
+ }
+ return null;
+ }
+
+ public Object getParent(Object element) {
+ if(element instanceof ISeamProject) {
+ return root;
+ } else if(element instanceof ISeamElement) {
+ return ((ISeamElement)element).getParent();
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return true;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+ root = null;
+ viewer = null;
+ if(processed != null) {
+ for (ISeamProject p : processed) p.removeSeamProjectListener(this);
+ processed.clear();
+ }
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ this.viewer = viewer;
+ if(newInput instanceof IWorkspaceRoot || newInput == null) {
+ root = (IWorkspaceRoot)newInput;
+ }
+ }
+
+ public void projectChanged(SeamProjectChangeEvent event) {
+ if(viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) return;
+ Object o = event.getSource();
+ if(o instanceof ISeamElement) {
+ refresh(o);
+ } else {
+ System.out.println("event without source");
+ }
+ }
+
+ void refresh(final Object o) {
+ if(viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) return;
+ if(!(viewer instanceof StructuredViewer)) return;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ((StructuredViewer)viewer).refresh(o);
+ }
+ });
+
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2007-07-11 14:06:35 UTC (rev 2386)
@@ -0,0 +1,43 @@
+package org.jboss.tools.seam.ui.views;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamScope;
+
+public class SeamLabelProvider extends LabelProvider {
+
+ public String getText(Object element) {
+ if(element instanceof ISeamProject) {
+ return ((ISeamProject)element).getProject().getName();
+ } else if(element instanceof ISeamScope) {
+ return ((ISeamScope)element).getType().toString();
+ } else if(element instanceof ISeamComponent) {
+ return "" + ((ISeamComponent)element).getName();
+ } else if(element instanceof ISeamComponentDeclaration) {
+ IResource r = ((ISeamComponentDeclaration)element).getResource();
+ return r == null ? "???" : r.getName();
+ }
+ return element == null ? "" : element.toString();//$NON-NLS-1$
+ }
+
+ public Image getImage(Object obj) {
+ String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
+ if (obj instanceof ISeamProject) {
+ imageKey = org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT;
+ } else if(obj instanceof ISeamScope) {
+ imageKey = ISharedImages.IMG_OBJ_FOLDER;
+ } else if(obj instanceof ISeamComponent) {
+ imageKey = ISharedImages.IMG_OBJ_ELEMENT;
+ } else if(obj instanceof ISeamComponentDeclaration) {
+ imageKey = ISharedImages.IMG_OBJ_FILE;
+ }
+ return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r2385 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-11 10:04:27 -0400 (Wed, 11 Jul 2007)
New Revision: 2385
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamScope.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamScope.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
Log:
EXIN-217 ISeamScope added
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-11 13:16:45 UTC (rev 2384)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-11 14:04:27 UTC (rev 2385)
@@ -21,6 +21,19 @@
public static String NATURE_ID = "org.jboss.tools.seam.core.seam";
/**
+ * Returns list of scope objects for all scope types.
+ * @return
+ */
+ public ISeamScope[] getScopes();
+
+ /**
+ * Returns scope object for specified scope type.
+ * @param scopeType
+ * @return
+ */
+ public ISeamScope getScope(ScopeType scopeType);
+
+ /**
* Returns seam component. Project can have only one ISeamComponent with
* unique name. If project has a few seam components with the same name,
* then corresponding ISeamComponent will have all declarations
@@ -125,5 +138,5 @@
* @param listener
*/
public void removeSeamProjectListener(ISeamProjectChangeListener listener);
-
+
}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamScope.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamScope.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamScope.java 2007-07-11 14:04:27 UTC (rev 2385)
@@ -0,0 +1,11 @@
+package org.jboss.tools.seam.core;
+
+import java.util.List;
+
+public interface ISeamScope extends ISeamElement {
+
+ public ScopeType getType();
+
+ public List<ISeamComponent> getComponents();
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-11 13:16:45 UTC (rev 2384)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-11 14:04:27 UTC (rev 2385)
@@ -19,6 +19,7 @@
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
@@ -58,6 +59,10 @@
return 0;
}
+ public ScopeType getScope() {
+ return ScopeType.UNSPECIFIED;
+ }
+
/**
* Merges loaded data into currently used declaration.
* If changes were done returns a list of changes.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-11 13:16:45 UTC (rev 2384)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-11 14:04:27 UTC (rev 2385)
@@ -48,7 +48,11 @@
if(scope == null || scope.length() == 0) {
scopeType = ScopeType.UNSPECIFIED;
} else {
- scopeType = ScopeType.valueOf(scope.toUpperCase());
+ try {
+ scopeType = ScopeType.valueOf(scope.toUpperCase());
+ } catch (Exception e) {
+ scopeType = ScopeType.UNSPECIFIED;
+ }
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-11 13:16:45 UTC (rev 2384)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-11 14:04:27 UTC (rev 2385)
@@ -31,9 +31,11 @@
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamContextVariable;
+import org.jboss.tools.seam.core.ISeamElement;
import org.jboss.tools.seam.core.ISeamFactory;
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamScope;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -54,6 +56,17 @@
Set<IPath> sourcePaths = new HashSet<IPath>();
private boolean isStorageResolved = false;
+ SeamScope[] scopes = new SeamScope[ScopeType.values().length];
+ Map<ScopeType, SeamScope> scopesMap = new HashMap<ScopeType, SeamScope>();
+
+ {
+ ScopeType[] types = ScopeType.values();
+ for (int i = 0; i < scopes.length; i++) {
+ scopes[i] = new SeamScope(this, types[i]);
+ scopesMap.put(types[i], scopes[i]);
+ }
+ }
+
Map<String, SeamComponent> allComponents = new HashMap<String, SeamComponent>();
protected Set<ISeamFactory> allFactories = new HashSet<ISeamFactory>();
Set<ISeamContextVariable> allVariables = new HashSet<ISeamContextVariable>();
@@ -75,6 +88,23 @@
return project;
}
+ /**
+ * Returns list of scope objects for all scope types.
+ * @return
+ */
+ public ISeamScope[] getScopes() {
+ return scopes;
+ }
+
+ /**
+ * Returns scope object for specified scope type.
+ * @param scopeType
+ * @return
+ */
+ public ISeamScope getScope(ScopeType scopeType) {
+ return scopesMap.get(scopeType);
+ }
+
public ISeamProject getSeamProject() {
return this;
}
@@ -82,6 +112,7 @@
public void setProject(IProject project) {
this.project = project;
setSourcePath(project.getFullPath());
+ resource = project;
classPath.init();
load();
}
@@ -106,6 +137,9 @@
public void load() {
if(isStorageResolved) return;
isStorageResolved = true;
+
+ long begin = System.currentTimeMillis();
+
if(getClassPath().update()) {
getClassPath().process();
}
@@ -121,6 +155,10 @@
SeamResourceVisitor b = new SeamResourceVisitor(this);
b.visit(f);
}
+
+ long e = System.currentTimeMillis();
+
+ System.out.println("loaded in " + (e - begin));
}
/**
@@ -166,7 +204,7 @@
* @param source
*/
public void registerComponents(LoadedDeclarations ds, IPath source) {
-
+
SeamComponentDeclaration[] components = ds.getComponents().toArray(new SeamComponentDeclaration[0]);
ISeamFactory[] factories = ds.getFactories().toArray(new ISeamFactory[0]);
@@ -176,6 +214,8 @@
}
if(!sourcePaths.contains(source)) sourcePaths.add(source);
+ revalidateScopesLock++;
+
Map<Object,ISeamComponentDeclaration> currentComponents = findComponentDeclarations(source);
List<Change> addedComponents = null;
@@ -214,7 +254,8 @@
}
if(c == null && name != null) {
- c = newComponent(name);
+ ScopeType scopeType = loaded.getScope();
+ c = newComponent(name, scopeType);
allComponents.put(name, c);
allVariables.add(c);
c.addDeclaration(loaded);
@@ -252,7 +293,10 @@
fireChanges(addedComponents);
componentDeclarationsRemoved(currentComponents);
-
+
+ revalidateScopesLock--;
+ revalidateScopes();
+
Map<Object, ISeamFactory> currentFactories = findFactoryDeclarations(source);
List<Change> addedFactories = null;
for (int i = 0; i < factories.length; i++) {
@@ -286,6 +330,7 @@
public void pathRemoved(IPath source) {
if(!sourcePaths.contains(source)) return;
sourcePaths.remove(source);
+ revalidateScopesLock++;
Iterator<SeamComponent> iterator = allComponents.values().iterator();
while(iterator.hasNext()) {
List<Change> changes = null;
@@ -306,6 +351,11 @@
}
if(c.getAllDeclarations().size() == 0) {
iterator.remove();
+ ISeamElement p = c.getParent();
+ if(p instanceof SeamScope) {
+ ((SeamScope)p).removeComponent(c);
+ changes = Change.addChange(changes, new Change(p, null, c, null));
+ }
allVariables.remove(c);
changes = null;
changes = Change.addChange(changes, new Change(this, null, c, null));
@@ -313,6 +363,9 @@
}
fireChanges(changes);
}
+ revalidateScopesLock--;
+ revalidateScopes();
+
Iterator<ISeamFactory> factories = allFactories.iterator();
while(factories.hasNext()) {
AbstractContextVariable f = (AbstractContextVariable)factories.next();
@@ -363,6 +416,11 @@
}
if(c.getAllDeclarations().size() == 0) {
iterator.remove();
+ ISeamElement p = c.getParent();
+ if(p instanceof SeamScope) {
+ ((SeamScope)p).removeComponent(c);
+ changes = Change.addChange(changes, new Change(p, null, c, null));
+ }
allVariables.remove(c);
changes = Change.addChange(null, new Change(this, null, c, null));
}
@@ -507,11 +565,12 @@
return name == null ? null : allComponents.get(name);
}
- SeamComponent newComponent(String name) {
+ SeamComponent newComponent(String name, ScopeType scopeType) {
SeamComponent c = new SeamComponent();
c.setName(name);
c.setId(name);
- c.setParent(this);
+ c.setParent(getScope(scopeType));
+ ((SeamScope)getScope(scopeType)).addComponent(c);
return c;
}
@@ -554,6 +613,26 @@
}
return result;
}
+
+ int revalidateScopesLock = 0;
+ void revalidateScopes() {
+ List<Change> changes = null;
+ if(revalidateScopesLock > 0) return;
+ for(SeamComponent c : allComponents.values()) {
+ SeamScope pc = (SeamScope)c.getParent();
+ SeamScope pn = (SeamScope)getScope(c.getScope());
+ if(pc == pn) continue;
+ c.setParent(pn);
+ if(pc != null) {
+ pc.removeComponent(c);
+ changes = Change.addChange(changes, new Change(pc, null, c, null));
+ }
+ pn.addComponent(c);
+ changes = Change.addChange(changes, new Change(pn, null, null, c));
+ }
+ fireChanges(changes);
+ }
+
}
class InnerBuilder {
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamScope.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamScope.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamScope.java 2007-07-11 14:04:27 UTC (rev 2385)
@@ -0,0 +1,35 @@
+package org.jboss.tools.seam.internal.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamScope;
+import org.jboss.tools.seam.core.ScopeType;
+
+public class SeamScope extends SeamObject implements ISeamScope {
+ private List<ISeamComponent> components = new ArrayList<ISeamComponent>();
+ private ScopeType scopeType = null;
+
+ SeamScope(SeamProject project, ScopeType scopeType) {
+ setParent(project);
+ this.scopeType = scopeType;
+ }
+
+ public List<ISeamComponent> getComponents() {
+ return components;
+ }
+
+ public void addComponent(ISeamComponent component) {
+ components.add(component);
+ }
+
+ public void removeComponent(ISeamComponent component) {
+ components.remove(component);
+ }
+
+ public ScopeType getType() {
+ return scopeType;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2007-07-11 13:16:45 UTC (rev 2384)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2007-07-11 14:04:27 UTC (rev 2385)
@@ -38,7 +38,11 @@
public ScopeType getScope() {
if(scope == null || scope.length() == 0) return ScopeType.UNSPECIFIED;
- return ScopeType.valueOf(scope);
+ try {
+ return ScopeType.valueOf(scope);
+ } catch (Exception e) {
+ return ScopeType.UNSPECIFIED;
+ }
}
public String getScopeAsString() {
17 years, 5 months
JBoss Tools SVN: r2384 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors: parts and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-11 09:16:45 -0400 (Wed, 11 Jul 2007)
New Revision: 2384
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java
Log:
EXIN-366: Adding elements on the diagram by double-click on fields of classes which have additional information in mapping files
Bugs of adding subclass elements
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11 13:06:56 UTC (rev 2383)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11 13:16:45 UTC (rev 2384)
@@ -290,35 +290,45 @@
public void processExpand(ExpandeableShape shape) {
Object element = shape.getOrmElement();
if (element instanceof Property) {
- Type type = ((Property)element).getType();
- if (type.isEntityType()) {
- EntityType et = (EntityType) type;
- RootClass rootClass = (RootClass)getConfiguration().getClassMapping(et.getAssociatedEntityName());
- OrmShape s = getOrCreatePersistentClass(rootClass, null);
- HashMap targets = new HashMap();
- Iterator iterator = shape.getSourceConnections().iterator();
- while (iterator.hasNext()) {
- Connection connection = (Connection)iterator.next();
- connection.setHiden(shape.getHide());
- Object el = connection.getTarget().getOrmElement();
- if (el instanceof Column) {
- targets.put(((Column)el).getName(), connection.getTarget());
- } else if (el instanceof RootClass) {
- targets.put(((RootClass)el).getClassName(), connection.getTarget());
+ Property property = (Property)element;
+ if (!property.isComposite()) {
+ Type type = ((Property)element).getType();
+ if (type.isEntityType()) {
+ EntityType et = (EntityType) type;
+ Object clazz = getConfiguration().getClassMapping(et.getAssociatedEntityName());
+ if (clazz instanceof RootClass) {
+ RootClass rootClass = (RootClass)clazz;
+ OrmShape s = getOrCreatePersistentClass(rootClass, null);
+ HashMap targets = new HashMap();
+ Iterator iterator = shape.getSourceConnections().iterator();
+ while (iterator.hasNext()) {
+ Connection connection = (Connection)iterator.next();
+ connection.setHiden(shape.getHide());
+ Object el = connection.getTarget().getOrmElement();
+ if (el instanceof Column) {
+ targets.put(((Column)el).getName(), connection.getTarget());
+ } else if (el instanceof RootClass) {
+ targets.put(((RootClass)el).getClassName(), connection.getTarget());
+ }
+ }
+ KeyValue id = rootClass.getIdentifier();
+ iterator = id.getColumnIterator();
+ while (iterator.hasNext()) {
+ Column column = (Column)iterator.next();
+ if (targets.get(column.getName()) != null && !isConnectionExist(s, (Shape)targets.get(column.getName()))) {
+ new Connection(s, (Shape)targets.get(column.getName()));
+ }
+ }
+ if(!isConnectionExist(shape, s))
+ new Connection(shape, s);
+ } else if (clazz instanceof SingleTableSubclass) {
+ OrmShape s = getOrCreatePersistentClass(((SingleTableSubclass)clazz).getRootClass(), null);
}
}
- KeyValue id = rootClass.getIdentifier();
- iterator = id.getColumnIterator();
- while (iterator.hasNext()) {
- Column column = (Column)iterator.next();
- if (targets.get(column.getName()) != null && !isConnectionExist(s, (Shape)targets.get(column.getName()))) {
- new Connection(s, (Shape)targets.get(column.getName()));
- }
- }
- if(!isConnectionExist(shape, s))
- new Connection(shape, s);
- firePropertyChange(REFRESH, null, null);
+ } else {
+ OrmShape s = getOrCreatePersistentClass(new SpecialRootClass(property), null);
}
+ firePropertyChange(REFRESH, null, null);
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-11 13:06:56 UTC (rev 2383)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-11 13:16:45 UTC (rev 2384)
@@ -60,8 +60,9 @@
Iterator iterator = rootClass.getPropertyIterator();
while (iterator.hasNext()) {
Property field = (Property)iterator.next();
- if (!field.isComposite()) {
- if (field.getValue().isSimpleValue() && !((SimpleValue)field.getValue()).isTypeSpecified()) {
+ if (field.isComposite()) {
+ bodyOrmShape = new ExpandeableShape(field);
+ } else if (field.getValue().isSimpleValue() && !((SimpleValue)field.getValue()).isTypeSpecified()) {
bodyOrmShape = new Shape(field);
} else if (field.getValue().getType().isEntityType()) {
bodyOrmShape = new ExpandeableShape(field);
@@ -71,67 +72,67 @@
bodyOrmShape = new Shape(field);
}
getChildren().add(bodyOrmShape);
- } else {
- Component component = (Component)field.getValue();
- Iterator iter = component.getPropertyIterator();
- while (iter.hasNext()) {
- Property property = (Property)iter.next();
- if (property.getValue().getType().isEntityType()) {
- bodyOrmShape = new ExpandeableShape(property);
- } else if (property.getValue().getType().isCollectionType()) {
- bodyOrmShape = new ComponentShape(property);
- } else {
- bodyOrmShape = new Shape(property);
- }
- getChildren().add(bodyOrmShape);
- }
- }
+// } else {
+// Component component = (Component)field.getValue();
+// Iterator iter = component.getPropertyIterator();
+// while (iter.hasNext()) {
+// Property property = (Property)iter.next();
+// if (property.getValue().getType().isEntityType()) {
+// bodyOrmShape = new ExpandeableShape(property);
+// } else if (property.getValue().getType().isCollectionType()) {
+// bodyOrmShape = new ComponentShape(property);
+// } else {
+// bodyOrmShape = new Shape(property);
+// }
+// getChildren().add(bodyOrmShape);
+// }
+// }
}
} else if (ormElement instanceof SingleTableSubclass) {
RootClass rootClass = ((SingleTableSubclass)ormElement).getRootClass();
- Property identifierProperty = rootClass.getIdentifierProperty();
- if (identifierProperty != null) {
- getChildren().add(new Shape(identifierProperty));
- }
+// Property identifierProperty = rootClass.getIdentifierProperty();
+// if (identifierProperty != null) {
+// getChildren().add(new Shape(identifierProperty));
+// }
- KeyValue identifier = rootClass.getIdentifier();
- if (identifier instanceof Component) {
- Iterator iterator = ((Component)identifier).getPropertyIterator();
- while (iterator.hasNext()) {
- Property property = (Property) iterator.next();
- getChildren().add(new Shape(property));
- }
- }
+// KeyValue identifier = rootClass.getIdentifier();
+// if (identifier instanceof Component) {
+// Iterator iterator = ((Component)identifier).getPropertyIterator();
+// while (iterator.hasNext()) {
+// Property property = (Property) iterator.next();
+// getChildren().add(new Shape(property));
+// }
+// }
- Iterator iterator = rootClass.getPropertyIterator();
- while (iterator.hasNext()) {
- Property field = (Property)iterator.next();
- if (!field.isComposite()) {
- if (field.getValue().getType().isEntityType()) {
- bodyOrmShape = new ExpandeableShape(field);
- } else if (field.getValue().getType().isCollectionType()) {
- bodyOrmShape = new ComponentShape(field);
- } else {
- bodyOrmShape = new Shape(field);
- }
- getChildren().add(bodyOrmShape);
- } else {
- Component component = (Component)field.getValue();
- Iterator iter = component.getPropertyIterator();
- while (iter.hasNext()) {
- Property property = (Property)iter.next();
- if (property.getValue().getType().isEntityType()) {
- bodyOrmShape = new ExpandeableShape(property);
- } else if (property.getValue().getType().isCollectionType()) {
- bodyOrmShape = new ComponentShape(property);
- } else {
- bodyOrmShape = new Shape(property);
- }
- getChildren().add(bodyOrmShape);
- }
- }
- }
+// Iterator iterator = rootClass.getPropertyIterator();
+// while (iterator.hasNext()) {
+// Property field = (Property)iterator.next();
+// if (!field.isComposite()) {
+// if (field.getValue().getType().isEntityType()) {
+// bodyOrmShape = new ExpandeableShape(field);
+// } else if (field.getValue().getType().isCollectionType()) {
+// bodyOrmShape = new ComponentShape(field);
+// } else {
+// bodyOrmShape = new Shape(field);
+// }
+// getChildren().add(bodyOrmShape);
+// } else {
+// Component component = (Component)field.getValue();
+// Iterator iter = component.getPropertyIterator();
+// while (iter.hasNext()) {
+// Property property = (Property)iter.next();
+// if (property.getValue().getType().isEntityType()) {
+// bodyOrmShape = new ExpandeableShape(property);
+// } else if (property.getValue().getType().isCollectionType()) {
+// bodyOrmShape = new ComponentShape(property);
+// } else {
+// bodyOrmShape = new Shape(property);
+// }
+// getChildren().add(bodyOrmShape);
+// }
+// }
+// }
Iterator iter = ((SingleTableSubclass)ormElement).getPropertyIterator();
while (iter.hasNext()) {
Property property = (Property)iter.next();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java 2007-07-11 13:06:56 UTC (rev 2383)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java 2007-07-11 13:16:45 UTC (rev 2384)
@@ -55,6 +55,8 @@
} else if (element instanceof Table) {
Table table = (Table)element;
text = table.getSchema() + "." + table.getName();
+ } else if (element instanceof SingleTableSubclass) {
+ text = ormLabelProvider.getText((SingleTableSubclass)element);
}
label.setText(text);
label.setIcon(ormLabelProvider.getImage(getCastedModel().getOrmElement()));
17 years, 5 months
JBoss Tools SVN: r2383 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-11 09:06:56 -0400 (Wed, 11 Jul 2007)
New Revision: 2383
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
Log:
http://jira.jboss.com/jira/browse/EXIN-367
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11 12:07:52 UTC (rev 2382)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11 13:06:56 UTC (rev 2383)
@@ -450,7 +450,8 @@
new Connection((Shape)componentShape.getChildren().get(1), elementShape);
}
}
- componentShape.setReference(childShape);
+ if(!componentShape.getParent().equals(childShape))
+ componentShape.setReference(childShape);
setDirty(true);
firePropertyChange(REFRESH, null, null);
}
17 years, 5 months