JBoss Tools SVN: r18168 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-10-19 12:55:23 -0400 (Mon, 19 Oct 2009)
New Revision: 18168
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java
Log:
JBIDE-3563: Code assist for "class" and "styleClass" attributes for html and jsf tags.
Minor changes (commented)
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java 2009-10-19 16:52:31 UTC (rev 18167)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java 2009-10-19 16:55:23 UTC (rev 18168)
@@ -59,6 +59,7 @@
}
/**
+ * Returns the style name found in the specified CSS Rule
*
* @param cssRule
* @param styleName
14 years, 8 months
JBoss Tools SVN: r18167 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb: schema and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-10-19 12:52:31 -0400 (Mon, 19 Oct 2009)
New Revision: 18167
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/include.exsd
Log:
JBIDE-3563: Code assist for "class" and "styleClass" attributes for html and jsf tags.
Minor changes on Include schema (commented) and plugin.xml
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2009-10-19 16:34:38 UTC (rev 18166)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2009-10-19 16:52:31 UTC (rev 18167)
@@ -90,11 +90,9 @@
</contexttype>
<cssholder uri="">
- <tag name="style" caseinsensitive="true" />
- <tag name="link" caseinsensitive="true">
- <attribute
- name="href">
- </attribute>
+ <tag name="style" />
+ <tag name="link">
+ <attribute name="href" />
</tag>
</cssholder>
</extension>
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/include.exsd
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/include.exsd 2009-10-19 16:34:38 UTC (rev 18166)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/include.exsd 2009-10-19 16:52:31 UTC (rev 18167)
@@ -7,7 +7,6 @@
</appInfo>
<documentation>
The extension point allows the application to define URIs, tags and Attributes that allow the part of code to be included into the page content.
-
</documentation>
</annotation>
@@ -18,8 +17,7 @@
</appInfo>
<documentation>
Defines an extension point for the Include definitions.
-
- This extension point is used to add information on which tags/tag attributes are used to include a source into a JSP/XHTML page
+This extension point is used to add information on which tags/tag attributes are used to include a source into a JSP/XHTML page
</documentation>
</annotation>
<complexType>
@@ -76,7 +74,7 @@
<element name="tag">
<annotation>
<documentation>
- Defines a tag item. Contains information on tags that have the 'include-to-page-content' possibility.
+ Defines a tag item. Contains information on tags that have the 'include-to-page-content' possibility or 'load CSS Style Sheet' possibility depending on its parent schema element
</documentation>
</annotation>
<complexType>
@@ -96,7 +94,7 @@
<element name="attribute">
<annotation>
<documentation>
- Defines an attribute item. Contains information on attributes that have the 'include-to-page-content' possibility.
+ Defines an attribute item. Contains information on attributes that have the 'include-to-page-content' possibility or 'load CSS Style Sheet' possibility depending on its parent schema element
</documentation>
</annotation>
<complexType>
@@ -109,7 +107,7 @@
</attribute>
</complexType>
</element>
-
+
<element name="contexttype">
<annotation>
<documentation>
@@ -146,7 +144,7 @@
</attribute>
</complexType>
</element>
-
+
<element name="cssholder">
<annotation>
<documentation>
@@ -183,15 +181,27 @@
</appInfo>
<documentation>
<pre>
- <extension-point id="KbInclude" name="Kb Include Context Buillder" />
+ <extension-point id="KbInclude" name="Kb Include Context Buillder" />
- <extension point="org.jboss.tools.jst.web.kb.KbInclude">
- <include uri="http://java.sun.com/jsf/core">
- <tag name="jsp.include">
- <attribute name="file" />
- </tag>
- </include>
- </extension>
+ <extension point="org.jboss.tools.jst.web.kb.KbInclude">
+ <include uri="http://java.sun.com/jsf/core">
+ <tag name="jsp.include">
+ <attribute name="file" />
+ </tag>
+ </include>
+ <contexttype id="JSP_PAGE_CONTEXT_TYPE">
+ <contenttype id="org.eclipse.jst.jsp.core.jspsource" />
+ </contexttype>
+ <contexttype id="FACELETS_PAGE_CONTEXT_TYPE">
+ <contenttype id="org.eclipse.wst.html.core.htmlsource" />
+ </contexttype>
+ <cssholder uri="">
+ <tag name="style"/>
+ <tag name="link">
+ <attribute name="href"/>
+ </tag>
+ </cssholder>
+ </extension>
</pre>
</documentation>
</annotation>
14 years, 8 months
JBoss Tools SVN: r18166 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-10-19 12:34:38 -0400 (Mon, 19 Oct 2009)
New Revision: 18166
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5043
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java 2009-10-19 16:32:46 UTC (rev 18165)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java 2009-10-19 16:34:38 UTC (rev 18166)
@@ -10,16 +10,24 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.jspeditor.dnd;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IFileEditorInput;
import org.jboss.tools.common.model.ui.editors.dnd.AbsoluteFilePathAttributeValueLoader;
+import org.jboss.tools.common.model.ui.editors.dnd.DropData;
import org.jboss.tools.common.model.ui.editors.dnd.DropURI;
import org.jboss.tools.common.model.ui.editors.dnd.IAttributeValueLoader;
import org.jboss.tools.common.model.ui.editors.dnd.IDropWizardModel;
import org.jboss.tools.common.model.ui.editors.dnd.ITagProposal;
import org.jboss.tools.common.model.ui.editors.dnd.ITagProposalLoader;
import org.jboss.tools.common.model.ui.editors.dnd.LoadBundleBaseNameAttributeValueLoader;
+import org.jboss.tools.common.model.ui.editors.dnd.composite.TagAttributesComposite;
import org.jboss.tools.common.model.ui.editors.dnd.context.DropContext;
public class FileTagProposalLoader implements ITagProposalLoader {
@@ -28,6 +36,14 @@
private static final Map<String,TagProposal[]> extensionMap = new HashMap<String,TagProposal[]>();
+ private static Map<String,String[]> requiredAttributes = new HashMap<String, String[]>();
+
+ static {
+ requiredAttributes.put("h:graphicImage", new String[]{"value"});
+ requiredAttributes.put("html:img", new String[]{"page"});
+ requiredAttributes.put("s:graphicImage", new String[]{"url"});
+ requiredAttributes.put("s:decorate", new String[]{"template"});
+ }
static TagProposal[] IMG_TAG_PROPOSALS = new TagProposal[]{
new TagProposal(
DropURI.JSF_HTML_URI,
@@ -49,11 +65,11 @@
new AbsoluteFilePathAttributeValueLoader("page","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
),
new TagProposal(
- DropURI.SEAM_URI,
- "s", //$NON-NLS-1$
- "graphicImage", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("url","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- )
+ DropURI.SEAM_URI,
+ "s", //$NON-NLS-1$
+ "graphicImage", //$NON-NLS-1$
+ new AbsoluteFilePathAttributeValueLoader("url","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ )
// yradtsevich: fix of JBIDE-3984: Exclude t:graphicImage option from Insert tag dialog
// ,
// new TagProposal(
@@ -96,11 +112,11 @@
);
static TagProposal S_DECORATE = new TagProposal(
- DropURI.SEAM_URI,
- "s", //$NON-NLS-1$
- "decorate", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("template","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- );
+ DropURI.SEAM_URI,
+ "s", //$NON-NLS-1$
+ "decorate", //$NON-NLS-1$
+ new AbsoluteFilePathAttributeValueLoader("template","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ );
static TagProposal[] PAGE_TAG_PROPOSALS = new TagProposal[]{
JSP_INCLUDE,
@@ -160,12 +176,36 @@
}
public TagProposal[] getTagProposals(Object data) {
- String fileName = data.toString();
+ DropData dropData = (DropData)data;
+ String fileName = dropData.getMimeData();
String extension = fileName.substring(fileName.lastIndexOf(".")+1); //$NON-NLS-1$
TagProposal[] tagProposals = (TagProposal[])extensionMap.get(extension.toLowerCase());
if(tagProposals==null) {
tagProposals = new TagProposal[0];
}
+ if(dropData.getEditorInput() instanceof IFileEditorInput) {
+ IFile f = ((IFileEditorInput)dropData.getEditorInput()).getFile();
+ List<TagProposal> result = new ArrayList<TagProposal>();
+ for (int i = 0; i < tagProposals.length; i++) {
+ dropData.getValueProvider().setProposal(tagProposals[i]);
+ TagAttributesComposite.AttributeDescriptorValue[] values = dropData.getValueProvider().getValues();
+ if(values == null || values.length == 0) continue;
+ Set<String> as = new HashSet<String>();
+ for (int k = 0; k < values.length; k++) {
+ as.add(values[k].getName());
+ }
+ String tag = tagProposals[i].getPrefix() + ":" + tagProposals[i].getName();
+ String[] atrs = requiredAttributes.get(tag);
+ boolean ok = true;
+ if(atrs != null) for (int k = 0; k < atrs.length && ok; k++) {
+ if(!as.contains(atrs[k])) ok = false;
+ }
+ if(!ok) continue;
+ result.add(tagProposals[i]);
+ }
+
+ return result.toArray(new TagProposal[0]);
+ }
return tagProposals;
}
14 years, 8 months
JBoss Tools SVN: r18165 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-10-19 12:32:46 -0400 (Mon, 19 Oct 2009)
New Revision: 18165
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5043
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java 2009-10-19 16:31:58 UTC (rev 18164)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java 2009-10-19 16:32:46 UTC (rev 18165)
@@ -40,10 +40,10 @@
page2.setProperties(fDropCommand.getProperties());
ITagProposal[] proposals =
- TagProposalsComposite.getTagProposals(getMimeType(),getMimeData(), fDropCommand.getTagProposalFactory());
+ TagProposalsComposite.getTagProposals(getMimeType(),getWizardModel().getDropData(), fDropCommand.getTagProposalFactory());
if(TagProposalsComposite.areThereTagProposals(
- getMimeType(),getMimeData(), fDropCommand.getTagProposalFactory())
+ getMimeType(),getWizardModel().getDropData(), fDropCommand.getTagProposalFactory())
) {
if(proposals.length > 1) {
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java 2009-10-19 16:31:58 UTC (rev 18164)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java 2009-10-19 16:32:46 UTC (rev 18165)
@@ -80,7 +80,7 @@
page2 = new OutputLinkWizardPage();
ITagProposal[] proposals =
- TagProposalsComposite.getTagProposals(getMimeType(),getMimeData(), fDropCommand.getTagProposalFactory());
+ TagProposalsComposite.getTagProposals(getMimeType(),getWizardModel().getDropData(), fDropCommand.getTagProposalFactory());
this.addPage(page2);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java 2009-10-19 16:31:58 UTC (rev 18164)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java 2009-10-19 16:32:46 UTC (rev 18165)
@@ -48,11 +48,11 @@
page2 = new PanelGridWizardPage();
ITagProposal[] proposals = TagProposalsComposite.getTagProposals(
- getMimeType(), getMimeData(), fDropCommand
+ getMimeType(), getWizardModel().getDropData(), fDropCommand
.getTagProposalFactory());
if (TagProposalsComposite.areThereTagProposals(getMimeType(),
- getMimeData(), fDropCommand.getTagProposalFactory())) {
+ getWizardModel().getDropData(), fDropCommand.getTagProposalFactory())) {
if (proposals.length > 1) {
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java 2009-10-19 16:31:58 UTC (rev 18164)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java 2009-10-19 16:32:46 UTC (rev 18165)
@@ -81,7 +81,7 @@
page2 = new SelectItemsWizardPage();
ITagProposal[] proposals = TagProposalsComposite.getTagProposals(
- getMimeType(), getMimeData(), fDropCommand
+ getMimeType(), getWizardModel().getDropData(), fDropCommand
.getTagProposalFactory());
this.addPage(page2);
14 years, 8 months
JBoss Tools SVN: r18164 - in trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd: composite and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-10-19 12:31:58 -0400 (Mon, 19 Oct 2009)
New Revision: 18164
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommand.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5043
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommand.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommand.java 2009-10-19 15:17:05 UTC (rev 18163)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommand.java 2009-10-19 16:31:58 UTC (rev 18164)
@@ -67,7 +67,7 @@
ITagProposal[] proposals
= TagProposalsComposite.getTagProposals(
getDefaultModel().getDropData().getMimeType(),
- getDefaultModel().getDropData().getMimeData(),
+ getDefaultModel().getDropData(),
tagProposalFactory
);
if(proposals.length==1) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java 2009-10-19 15:17:05 UTC (rev 18163)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java 2009-10-19 16:31:58 UTC (rev 18164)
@@ -61,7 +61,9 @@
public void setAttributeValue(String name, Object value) {
if(name==null) throw new IllegalArgumentException("Attribute name cannot be null"); //$NON-NLS-1$
AttributeDescriptorValue descrValue = findDescriptor(name);
- if(descrValue==null) throw new IllegalArgumentException("Attribute '" + name + "' not found"); //$NON-NLS-1$ //$NON-NLS-2$
+ if(descrValue==null) {
+ throw new IllegalArgumentException("Attribute '" + name + "' not found"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
descrValue.setValue(value);
fireModelChaged(ATTRIBUTE_VALUE,null,descrValue);
}
@@ -190,7 +192,7 @@
ITagProposal[] proposals
= TagProposalsComposite.getTagProposals(
getDropData().getMimeType(),
- getDropData().getMimeData(),
+ getDropData(),
tagProposalFactory
);
if(proposals.length>1) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizard.java 2009-10-19 15:17:05 UTC (rev 18163)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizard.java 2009-10-19 16:31:58 UTC (rev 18164)
@@ -47,10 +47,10 @@
page1 = new TagProposalsWizardPage();
page2 = new TagAttributesWizardPage();
ITagProposal[] proposals =
- TagProposalsComposite.getTagProposals(getMimeType(),getMimeData(), fDropCommand.getTagProposalFactory());
+ TagProposalsComposite.getTagProposals(getMimeType(),getWizardModel().getDropData(), fDropCommand.getTagProposalFactory());
if(TagProposalsComposite.areThereTagProposals(
- getMimeType(),getMimeData(), fDropCommand.getTagProposalFactory())
+ getMimeType(),getWizardModel().getDropData(), fDropCommand.getTagProposalFactory())
) {
if(proposals.length>1) {
this.addPage(page1);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java 2009-10-19 15:17:05 UTC (rev 18163)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java 2009-10-19 16:31:58 UTC (rev 18164)
@@ -26,6 +26,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
+import org.jboss.tools.common.model.ui.editors.dnd.DropData;
import org.jboss.tools.common.model.ui.editors.dnd.IDropWizardModel;
import org.jboss.tools.common.model.ui.editors.dnd.ITagProposal;
import org.jboss.tools.common.model.ui.editors.dnd.ITagProposalFactory;
@@ -44,7 +45,7 @@
model.getTagProposalFactory().getProposalLoader(
fModel.getDropData().getMimeType()
).getTagProposals(
- fModel.getDropData().getMimeData()
+ fModel.getDropData()
);
GridLayout layout = new GridLayout();
@@ -163,11 +164,11 @@
return getTagProposals().length>0;
}
- public static boolean areThereTagProposals(String mimeType,String dropData, ITagProposalFactory tagProposalFactory) {
+ public static boolean areThereTagProposals(String mimeType,DropData dropData, ITagProposalFactory tagProposalFactory) {
return tagProposalFactory.getProposalLoader(mimeType).getTagProposals(dropData).length>0;
}
- public static ITagProposal[] getTagProposals(String mimeType,String dropData, ITagProposalFactory tagProposalFactory) {
+ public static ITagProposal[] getTagProposals(String mimeType,DropData dropData, ITagProposalFactory tagProposalFactory) {
return tagProposalFactory.getProposalLoader(mimeType).getTagProposals(dropData);
}
14 years, 8 months
JBoss Tools SVN: r18163 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal: jpa/actions and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-10-19 11:17:05 -0400 (Mon, 19 Oct 2009)
New Revision: 18163
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfosCollection.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/DebugJavaCompletionProposalComputer.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/SaveQueryEditorListener.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ChangeStructure.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/wizard/HibernateJPARefactoring.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4328 - fixed
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/DebugJavaCompletionProposalComputer.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/DebugJavaCompletionProposalComputer.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/DebugJavaCompletionProposalComputer.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -99,6 +99,7 @@
}
+ @SuppressWarnings("unchecked")
public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
// TODO Auto-generated method stub
return Collections.EMPTY_LIST;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/SaveQueryEditorListener.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/SaveQueryEditorListener.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/SaveQueryEditorListener.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -49,6 +49,7 @@
* @author Dmitry Geraskov
*
*/
+@SuppressWarnings("restriction")
public class SaveQueryEditorListener implements IPropertyListener {
public static final String id = "AbstractQueryEditor.ReplaceString"; //$NON-NLS-1$
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -31,6 +31,7 @@
*
* @author Vitali
*/
+@SuppressWarnings("restriction")
public class JPAMapToolActionDelegate extends AbstractHandler implements IObjectActionDelegate,
IEditorActionDelegate, IViewActionDelegate {
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -64,6 +64,7 @@
*
* @author Vitali Yemialyanchyk
*/
+@SuppressWarnings("restriction")
public class JPAMapToolActor {
/**
@@ -201,7 +202,6 @@
/**
* update compilation unit of currently opened editor
*/
- @SuppressWarnings("restriction")
public void updateOpen() {
IWorkbenchWindow activeWorkbenchWindow = getActiveWorkbenchWindow();
if (activeWorkbenchWindow == null) {
@@ -265,7 +265,6 @@
/**
* @param sel - current selected workspace element for processing
*/
- @SuppressWarnings("restriction")
synchronized private void updateSelectedItems(ISelection sel) {
//System.out.println("Blah! " + selection); //$NON-NLS-1$
if (sel instanceof TextSelection) {
@@ -343,7 +342,6 @@
* @param obj
* @return exclusion result
*/
- @SuppressWarnings("restriction")
protected boolean excludeElement(Object obj) {
boolean res = false;
if (obj instanceof JarPackageFragmentRoot) {
@@ -372,7 +370,6 @@
* Process object - java element to collect all it's children CompilationUnits
* @param obj
*/
- @SuppressWarnings("restriction")
protected void processJavaElements(Object obj) {
if (obj instanceof ICompilationUnit) {
ICompilationUnit cu = (ICompilationUnit)obj;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.hibernate.eclipse.jdt.ui.internal.jpa.collect;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -689,6 +690,7 @@
* its dependencies
* @param icu - startup point entity compilation unit
*/
+ @SuppressWarnings("unchecked")
public void collect(ICompilationUnit icu) {
if (icu == null) {
@@ -701,33 +703,48 @@
if (cu.types() == null || cu.types().size() == 0 ) {
return;
}
- Object tmp = cu.types().get(0);
- if (!(tmp instanceof TypeDeclaration)) {
+ boolean hasTypeDeclaration = false;
+ Iterator it = cu.types().iterator();
+ while (it.hasNext()) {
+ Object tmp = it.next();
+ if (tmp instanceof TypeDeclaration) {
+ hasTypeDeclaration = true;
+ break;
+ }
+ }
+ if (!hasTypeDeclaration) {
// ignore EnumDeclaration & AnnotationTypeDeclaration
return;
}
- String fullyQualifiedName = null;
+ ArrayList<String> fullyQualifiedNames = new ArrayList<String>();
//TODO: should inspect all types in cu? so next method to get fullyQualifiedName:
- //((TypeDeclaration)tmp).resolveBinding().getBinaryName()
if (cu.getTypeRoot() == null || cu.getTypeRoot().findPrimaryType() == null) {
- //fullyQualifiedName = ((TypeDeclaration)tmp).resolveBinding().getBinaryName();
- return;
+ it = cu.types().iterator();
+ while (it.hasNext()) {
+ Object tmp = it.next();
+ if (tmp instanceof TypeDeclaration) {
+ fullyQualifiedNames.add(((TypeDeclaration)tmp).resolveBinding().getBinaryName());
+ }
+ }
} else {
- fullyQualifiedName = cu.getTypeRoot().findPrimaryType().getFullyQualifiedName();
+ fullyQualifiedNames.add(cu.getTypeRoot().findPrimaryType().getFullyQualifiedName());
}
- if (mapCUs_Info.containsKey(fullyQualifiedName)) {
- return;
- }
- CollectEntityInfo finder = new CollectEntityInfo();
- cu.accept(finder);
- EntityInfo result = finder.getEntityInfo();
- if (result != null) {
- result.adjustParameters();
- mapCUs_Info.put(fullyQualifiedName, result);
- Iterator<String> it = result.getDependences();
- while (it.hasNext()) {
- String fullyQualifiedNameTmp = it.next();
- collect(fullyQualifiedNameTmp);
+ Iterator<String> itFQNames = fullyQualifiedNames.iterator();
+ while (itFQNames.hasNext()) {
+ String fullyQualifiedName = itFQNames.next();
+ if (!mapCUs_Info.containsKey(fullyQualifiedName)) {
+ CollectEntityInfo finder = new CollectEntityInfo(fullyQualifiedName);
+ cu.accept(finder);
+ EntityInfo result = finder.getEntityInfo();
+ if (result != null) {
+ result.adjustParameters();
+ mapCUs_Info.put(fullyQualifiedName, result);
+ Iterator<String> itDep = result.getDependences();
+ while (itDep.hasNext()) {
+ String fullyQualifiedNameTmp = itDep.next();
+ collect(fullyQualifiedNameTmp);
+ }
+ }
}
}
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -60,14 +60,19 @@
* storage of collected info
*/
protected EntityInfo entityInfo = new EntityInfo();
+
+ protected String fullyQualifiedName = null;
+ public CollectEntityInfo(String fullyQualifiedName) {
+ this.fullyQualifiedName = fullyQualifiedName;
+ entityInfo.setFullyQualifiedName(fullyQualifiedName);
+ }
+
public EntityInfo getEntityInfo() {
return entityInfo;
}
public boolean visit(CompilationUnit node) {
- entityInfo.setFullyQualifiedName(
- node.getTypeRoot().findPrimaryType().getFullyQualifiedName());
if (node.getProblems().length > 0) {//this includes warnings too
entityInfo.setCompilerProblemsFlag(true);
}
@@ -288,6 +293,11 @@
public boolean visit(TypeDeclaration node) {
+ ITypeBinding typeBinding = node.resolveBinding();
+ String nodeName = typeBinding == null ? null : typeBinding.getBinaryName();
+ if (fullyQualifiedName == null || !fullyQualifiedName.equalsIgnoreCase(nodeName)) {
+ return false;
+ }
boolean isAbstruct = entityInfo.isAbstractFlag() ||
Modifier.isAbstract(node.getModifiers()) || node.isInterface();
entityInfo.setAbstractFlag(isAbstruct);
@@ -595,10 +605,12 @@
}
else if (type.isQualifiedType()) {
QualifiedType qt = (QualifiedType)type;
+ @SuppressWarnings("unused")
ITypeBinding tb = qt.resolveBinding();
}
else if (type.isWildcardType()) {
WildcardType wt = (WildcardType)type;
+ @SuppressWarnings("unused")
ITypeBinding tb = wt.resolveBinding();
}
return true;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfo.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfo.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -1,13 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.hibernate.eclipse.jdt.ui.internal.jpa.common;
import java.util.Iterator;
@@ -581,6 +581,10 @@
setExistingImports.remove(existingImport);
}
+ public void collectExistingImport(Set<String> setExistingImports) {
+ setExistingImports.addAll(this.setExistingImports);
+ }
+
public void addRequiredImport(String requiredImport) {
setRequiredImports.add(requiredImport);
}
@@ -589,6 +593,10 @@
setRequiredImports.remove(requiredImport);
}
+ public void collectRequiredImport(Set<String> setRequiredImports) {
+ setRequiredImports.addAll(this.setRequiredImports);
+ }
+
public boolean needImport(String checkImport) {
return (!setExistingImports.contains(checkImport) && setRequiredImports.contains(checkImport));
}
@@ -600,4 +608,27 @@
public int getFromMethodCounter() {
return fromMethodCounter;
}
+
+ public String toString() {
+ return getFullyQualifiedName();
+ }
+
+ public int hashCode() {
+ return getFullyQualifiedName().hashCode();
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof EntityInfo)) {
+ return false;
+ }
+ EntityInfo ei = (EntityInfo)obj;
+ if (getFullyQualifiedName().equals(ei.getFullyQualifiedName()) &&
+ getFullyQualifiedParentName().equals(ei.getFullyQualifiedParentName())) {
+ return true;
+ }
+ return false;
+ }
}
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfosCollection.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfosCollection.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfosCollection.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.jdt.ui.internal.jpa.common;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.ICompilationUnit;
+
+/**
+ * To handle EntityInfo bundle complex properties:
+ * for example several EntityInfos in one file ->
+ * so here is necessary to handle it's imports
+ *
+ * @author Vitali
+ */
+public class EntityInfosCollection {
+
+ /**
+ * path to the innermost resource enclosing these EntityInfos
+ */
+ protected IPath path;
+ /**
+ *
+ */
+ protected ICompilationUnit iCompilationUnit;
+ /**
+ *
+ */
+ protected org.eclipse.jdt.core.dom.CompilationUnit compilationUnit;
+ /**
+ * collection of EntityInfo's
+ */
+ protected HashMap<String, EntityInfo> entityInfos = new HashMap<String, EntityInfo>();
+ /**
+ * existing imports set
+ */
+ protected Set<String> setExistingImports = new TreeSet<String>();
+ /**
+ * required imports set
+ */
+ protected Set<String> setRequiredImports = new TreeSet<String>();
+
+ public void addEntityInfo(EntityInfo ei) {
+ entityInfos.put(ei.getFullyQualifiedName(), ei);
+ }
+
+ public EntityInfo getEntityInfo(String fullyQualifiedName) {
+ return entityInfos.get(fullyQualifiedName);
+ }
+
+ public void updateExistingImportSet() {
+ setExistingImports.clear();
+ Iterator<EntityInfo> it = entityInfos.values().iterator();
+ while (it.hasNext()) {
+ it.next().collectExistingImport(setExistingImports);
+ }
+ }
+
+ public void updateRequiredImportSet() {
+ setRequiredImports.clear();
+ Iterator<EntityInfo> it = entityInfos.values().iterator();
+ while (it.hasNext()) {
+ it.next().collectRequiredImport(setRequiredImports);
+ }
+ }
+
+ public boolean needImport(String checkImport) {
+ return (!setExistingImports.contains(checkImport) && setRequiredImports.contains(checkImport));
+ }
+
+ public IPath getPath() {
+ return path;
+ }
+
+ public void setPath(IPath path) {
+ this.path = path;
+ }
+
+ public ICompilationUnit getICompilationUnit() {
+ return iCompilationUnit;
+ }
+
+ public void setICompilationUnit(ICompilationUnit iCompilationUnit) {
+ this.iCompilationUnit = iCompilationUnit;
+ }
+
+ public org.eclipse.jdt.core.dom.CompilationUnit getCompilationUnit() {
+ return compilationUnit;
+ }
+
+ public void setCompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit compilationUnit) {
+ this.compilationUnit = compilationUnit;
+ }
+
+ public String toString() {
+ StringBuffer res = new StringBuffer();
+ Iterator<EntityInfo> it = entityInfos.values().iterator();
+ while (it.hasNext()) {
+ res.append(it.next());
+ res.append(";"); //$NON-NLS-1$
+ }
+ return res.toString();
+ }
+
+ public int hashCode() {
+ return toString().hashCode();
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof EntityInfosCollection)) {
+ return false;
+ }
+ EntityInfosCollection eic = (EntityInfosCollection)obj;
+ if (toString().equals(eic.toString())) {
+ return true;
+ }
+ return false;
+ }
+}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -1,36 +1,38 @@
/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ * Copyright (c) 2007-2009 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.hibernate.eclipse.jdt.ui.internal.jpa.process;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filebuffers.LocationKind;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.text.edits.MalformedTreeException;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.jdt.ui.Activator;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
+import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfosCollection;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
import org.hibernate.eclipse.jdt.ui.internal.jpa.process.wizard.HibernateJPAWizard;
import org.hibernate.eclipse.jdt.ui.internal.jpa.process.wizard.IHibernateJPAWizardData;
@@ -216,7 +218,7 @@
}
}
if (performChange) {
- performChange(bufferManager);
+ performCommit(entities, bufferManager);
}
performDisconnect(bufferManager);
}
@@ -233,23 +235,22 @@
changes.clear();
}
- protected void performChange(ITextFileBufferManager bufferManager) {
+ protected void performCommit(final Map<String, EntityInfo> entities,
+ ITextFileBufferManager bufferManager) {
+
+ HashSet<IPath> paths = new HashSet<IPath>();
for (int i = 0; i < changes.size(); i++) {
ChangeStructure cs = changes.get(i);
+ paths.add(cs.path);
+ }
+ Iterator<IPath> it = paths.iterator();
+ while (it.hasNext()) {
+ ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(it.next(), LocationKind.IFILE);
try {
- if (cs.textFileBuffer != null && cs.textEdit != null &&
- ((cs.change != null && cs.change.isEnabled()) || (cs.change == null))) {
- IDocument document = cs.textFileBuffer.getDocument();
- cs.textEdit.apply(document);
- // commit changes to underlying file
- cs.textFileBuffer.commit(null, true);
- }
+ // commit changes to underlying file
+ textFileBuffer.commit(null, true);
} catch (CoreException e) {
HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
- } catch (MalformedTreeException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("MalformedTreeException: ", e); //$NON-NLS-1$
- } catch (BadLocationException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("BadLocationException: ", e); //$NON-NLS-1$
}
}
}
@@ -258,58 +259,73 @@
Map<String, EntityInfo> entities) {
changes.clear();
+ HashMap<IPath, EntityInfosCollection> modifications = new HashMap<IPath, EntityInfosCollection>();
Iterator<Map.Entry<String, EntityInfo>> it = entities.entrySet().iterator();
- try {
- while (it.hasNext()) {
- Map.Entry<String, EntityInfo> entry = it.next();
- if (entry.getValue().isInterfaceFlag()) {
- continue;
+ while (it.hasNext()) {
+ Map.Entry<String, EntityInfo> entry = it.next();
+ if (entry.getValue().isInterfaceFlag()) {
+ continue;
+ }
+ final String fullyQualifiedName = entry.getKey();
+ ICompilationUnit icu = Utils.findCompilationUnit(javaProject, fullyQualifiedName);
+ org.eclipse.jdt.core.dom.CompilationUnit cu = Utils.getCompilationUnit(icu, true);
+ final IPath path = cu.getJavaElement().getPath();
+ EntityInfosCollection eiCollection = null;
+ if (modifications.containsKey(path)) {
+ eiCollection = modifications.get(path);
+ } else {
+ eiCollection = new EntityInfosCollection();
+ eiCollection.setPath(path);
+ eiCollection.setICompilationUnit(icu);
+ eiCollection.setCompilationUnit(cu);
+ modifications.put(path, eiCollection);
+ try {
+ bufferManager.connect(path, LocationKind.IFILE, null);
+ } catch (CoreException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
}
- collectModification(bufferManager, entry.getKey(), entry.getValue(), entities);
}
- } catch (CoreException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
+ final EntityInfo entityInfo = entry.getValue();
+ //
+ entityInfo.updateColumnAnnotationImport(defaultStrLength != columnLength);
+ entityInfo.updateVersionImport(enableOptLock && entityInfo.isAddVersionFlag());
+ //
+ eiCollection.addEntityInfo(entityInfo);
}
+ Iterator<EntityInfosCollection> itEIC = modifications.values().iterator();
+ while (itEIC.hasNext()) {
+ EntityInfosCollection eic = itEIC.next();
+ eic.updateExistingImportSet();
+ eic.updateRequiredImportSet();
+ collectModification(bufferManager, eic, entities);
+ }
}
- public void collectModification(ITextFileBufferManager bufferManager, String fullyQualifiedName,
- EntityInfo entityInfo, Map<String, EntityInfo> entities) throws CoreException {
+ public void collectModification(ITextFileBufferManager bufferManager,
+ EntityInfosCollection entityInfos, Map<String, EntityInfo> entities) {
- //
- entityInfo.updateColumnAnnotationImport(defaultStrLength != columnLength);
- entityInfo.updateVersionImport(enableOptLock && entityInfo.isAddVersionFlag());
- //
ChangeStructure cs = new ChangeStructure();
- cs.fullyQualifiedName = fullyQualifiedName;
- ICompilationUnit icu = Utils.findCompilationUnit(javaProject, fullyQualifiedName);
- org.eclipse.jdt.core.dom.CompilationUnit cu = Utils.getCompilationUnit(icu, false);
- cs.path = cu.getJavaElement().getPath();
- try {
- bufferManager.connect(cs.path, LocationKind.IFILE, null);
- cs.textFileBuffer = bufferManager.getTextFileBuffer(cs.path, LocationKind.IFILE);
- // retrieve the buffer
- cs.icu = icu;
- AST ast = cu.getAST();
- ASTRewrite rewriter = ASTRewrite.create(ast);
- // ... rewrite
- ProcessEntityInfo processor = new ProcessEntityInfo();
- processor.setAnnotationStyle(annotationStyle);
- processor.setDefaultStrLength(defaultStrLength);
- processor.setEnableOptLock(enableOptLock);
- processor.setEntityInfo(entityInfo);
- processor.setEntities(entities);
- processor.setASTRewrite(rewriter);
- cu.accept(processor);
- ////
- IDocument documentChange = cs.textFileBuffer.getDocument();
- cs.textEdit = rewriter.rewriteAST(documentChange, JavaCore.getOptions());
- // add change to array of changes
- changes.add(cs);
- } catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
- } catch (MalformedTreeException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("MalformedTreeException: ", e); //$NON-NLS-1$
- }
+ cs.icu = entityInfos.getICompilationUnit();
+ cs.path = entityInfos.getPath();
+ ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(cs.path, LocationKind.IFILE);
+ // retrieve the buffer
+ AST ast = entityInfos.getCompilationUnit().getAST();
+ ASTRewrite rewriter = ASTRewrite.create(ast);
+ // ... rewrite
+ ProcessEntityInfo processor = new ProcessEntityInfo();
+ processor.setAnnotationStyle(annotationStyle);
+ processor.setDefaultStrLength(defaultStrLength);
+ processor.setEnableOptLock(enableOptLock);
+ processor.setEntityInfos(entityInfos);
+ processor.setEntities(entities);
+ processor.setASTRewrite(rewriter);
+ entityInfos.getCompilationUnit().accept(processor);
+ ////
+ IDocument documentChange = textFileBuffer.getDocument();
+ cs.textEdit = rewriter.rewriteAST(documentChange, JavaCore.getOptions());
+ //cs.textEdit = rewriter.rewriteAST();
+ // add change to array of changes
+ changes.add(cs);
}
public boolean showRefactoringDialog(final Map<String, EntityInfo> entities,
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ChangeStructure.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ChangeStructure.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ChangeStructure.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -1,6 +1,5 @@
package org.hibernate.eclipse.jdt.ui.internal.jpa.process;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.ltk.core.refactoring.Change;
@@ -10,10 +9,8 @@
* group all information about changes of document in one structure
*/
public class ChangeStructure {
- public String fullyQualifiedName;
public IPath path;
public ICompilationUnit icu;
public TextEdit textEdit;
- public ITextFileBuffer textFileBuffer;
public Change change;
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -25,6 +25,7 @@
import org.eclipse.jdt.core.dom.ExpressionStatement;
import org.eclipse.jdt.core.dom.FieldAccess;
import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.ImportDeclaration;
import org.eclipse.jdt.core.dom.MarkerAnnotation;
import org.eclipse.jdt.core.dom.MemberValuePair;
@@ -47,6 +48,7 @@
import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.CollectEntityInfo;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
+import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfosCollection;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.JPAConst;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.OwnerType;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefColumnInfo;
@@ -64,6 +66,10 @@
public class ProcessEntityInfo extends ASTVisitor {
/**
+ * information about entity's annotations for whole compilation unit
+ */
+ protected EntityInfosCollection entityInfos;
+ /**
* information about entity's annotations
*/
protected EntityInfo entityInfo;
@@ -88,8 +94,8 @@
*/
protected boolean enableOptLock = false;
- public void setEntityInfo(EntityInfo entityInfo) {
- this.entityInfo = entityInfo;
+ public void setEntityInfos(EntityInfosCollection entityInfos) {
+ this.entityInfos = entityInfos;
}
public void setEntities(Map<String, EntityInfo> entities) {
@@ -101,11 +107,12 @@
}
public boolean visit(CompilationUnit node) {
+ entityInfo = null;
// TODO: sort all imports in alphabetic order
//ListRewrite lrw = rewriter.getListRewrite(node, CompilationUnit.IMPORTS_PROPERTY);
for (int i = 0; i < JPAConst.ALL_IMPORTS.size(); i++) {
String tmp = JPAConst.ALL_IMPORTS.get(i);
- if (entityInfo.needImport(tmp)) {
+ if (entityInfos.needImport(tmp)) {
addImport(node, tmp);
}
}
@@ -154,6 +161,15 @@
@SuppressWarnings("unchecked")
public boolean visit(TypeDeclaration node) {
+ ITypeBinding typeBinding = node.resolveBinding();
+ String nodeName = typeBinding == null ? null : typeBinding.getBinaryName();
+ if (nodeName == null) {
+ return false;
+ }
+ entityInfo = entityInfos.getEntityInfo(nodeName);
+ if (entityInfo == null) {
+ return false;
+ }
if (entityInfo.isAddMappedSuperclassFlag()) {
MarkerAnnotation matd = rewriter.getAST().newMarkerAnnotation();
matd.setTypeName(rewriter.getAST().newSimpleName(JPAConst.ANNOTATION_MAPPEDSUPERCLASS));
@@ -299,6 +315,9 @@
@SuppressWarnings("unchecked")
public boolean visit(FieldDeclaration node) {
+ if (entityInfo == null) {
+ return false;
+ }
if (annotationStyle != AnnotStyle.FIELDS) {
return true;
}
@@ -443,6 +462,9 @@
@SuppressWarnings("unchecked")
public boolean visit(MethodDeclaration node) {
+ if (entityInfo == null) {
+ return false;
+ }
if (annotationStyle != AnnotStyle.GETTERS) {
return true;
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/wizard/HibernateJPARefactoring.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/wizard/HibernateJPARefactoring.java 2009-10-19 14:01:47 UTC (rev 18162)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/wizard/HibernateJPARefactoring.java 2009-10-19 15:17:05 UTC (rev 18163)
@@ -34,7 +34,7 @@
* change info storage
*/
protected ArrayList<ChangeStructure> changes;
-
+
public HibernateJPARefactoring(ArrayList<ChangeStructure> changes) {
this.changes = changes;
}
@@ -55,9 +55,9 @@
final CompositeChange cc = new CompositeChange(""); //$NON-NLS-1$
for (int i = 0; i < changes.size(); i++) {
ChangeStructure cs = changes.get(i);
- String change_name = cs.fullyQualifiedName;
+ final String change_name = cs.path.toString();
TextFileChange change = new TextFileChange(change_name, (IFile)cs.icu.getResource());
- change.setSaveMode(TextFileChange.FORCE_SAVE);
+ change.setSaveMode(TextFileChange.LEAVE_DIRTY);
change.setEdit(cs.textEdit);
cs.change = change;
cc.add(change);
14 years, 8 months
JBoss Tools SVN: r18162 - in trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common: model/ui/action and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-10-19 10:01:47 -0400 (Mon, 19 Oct 2009)
New Revision: 18162
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/XModelObjectTreeViewComponent.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/ModelContributionManager.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/XMenuInvoker.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorViewPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5041
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/XModelObjectTreeViewComponent.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/XModelObjectTreeViewComponent.java 2009-10-19 13:54:09 UTC (rev 18161)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/XModelObjectTreeViewComponent.java 2009-10-19 14:01:47 UTC (rev 18162)
@@ -11,12 +11,18 @@
package org.jboss.tools.common.editor;
import java.util.*;
+
+import org.jboss.tools.common.meta.XModelEntity;
+import org.jboss.tools.common.meta.action.XActionList;
import org.jboss.tools.common.model.util.*;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.action.ModelContributionManager;
import org.jboss.tools.common.model.ui.dnd.ControlDragDrop;
import org.jboss.tools.common.model.ui.navigator.*;
import org.jboss.tools.common.model.ui.outline.*;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
import org.jboss.tools.common.model.*;
@@ -38,7 +44,7 @@
}
public void setMenuInvoker(TreeViewerMenuInvoker menu) {
- this.menu = menu;
+// this.menu = menu;
}
protected XModelObjectTreeViewComponent(TreeViewerModelListenerImpl listener) {
@@ -79,8 +85,11 @@
treeViewer.setLabelProvider(label = LabelDecoratorImpl.decorateLabelProvider(new NavigatorLabelProvider()));
treeViewer.setContentProvider(content);
treeViewer.setInput(cache == null ? null : cache);
+
+ initContextMenu();
menu.setViewer(treeViewer);
treeViewer.getTree().addMouseListener(menu);
+
listener.setViewer(treeViewer);
dnd.setProvider(dndProvider);
dndProvider.setTree(treeViewer.getTree());
@@ -99,6 +108,44 @@
selectionProvider.setTreeViewer(getViewer());
return treeViewer.getTree();
}
+
+ protected void initContextMenu() {
+ final ModelContributionManager menuMgr = new ModelContributionManager(null) {
+ public XActionList getActionList(XModelObject o) {
+ if(o.getFileType() != XModelObject.FILE) return super.getActionList(o);
+ String ent = o.getModelEntity().getName() + "_EditorActionList"; //$NON-NLS-1$
+ XModelEntity entity = o.getModel().getMetaData().getEntity(ent);
+ return (entity != null) ? entity.getActionList() : super.getActionList(o);
+ }
+ };
+ menu.setStandardInvoker(menuMgr);
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ fillContextMenu(manager);
+ }
+ });
+ final TreeViewer treeViewer = getViewer();
+ Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
+ treeViewer.getTree().setMenu(menu);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage().getActiveEditor().getSite()
+ .registerContextMenu(menuMgr, treeViewer);
+ }
+ });
+
+ }
+ protected void fillContextMenu(IMenuManager menu) {
+ IStructuredSelection selection =
+ (IStructuredSelection) getViewer().getSelection();
+ if(menu instanceof ModelContributionManager) {
+ ((ModelContributionManager)menu).setSelection(selection);
+ }
+ menu.update(true);
+ }
+
public Control createControl(Composite parent) {
return createControl(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
}
@@ -119,7 +166,7 @@
listener = null;
if (selectionProvider!=null) selectionProvider.dispose();
selectionProvider = null;
- menu = null;
+// menu = null;
if(label != null) {
label.dispose();
label = null;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/ModelContributionManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/ModelContributionManager.java 2009-10-19 13:54:09 UTC (rev 18161)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/ModelContributionManager.java 2009-10-19 14:01:47 UTC (rev 18162)
@@ -16,10 +16,12 @@
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.actions.ActionContext;
+import org.jboss.tools.common.meta.action.XActionList;
import org.jboss.tools.common.model.XModelObject;
public class ModelContributionManager extends MenuManager {
ActionContext context;
+ ISelection selection;
Shell shell;
public ModelContributionManager(Shell shell) {
@@ -30,6 +32,10 @@
public void setContext(ActionContext context) {
this.context = context;
}
+
+ public void setSelection(ISelection s) {
+ selection = s;
+ }
protected void update(boolean force, boolean recursive) {
if (isDirty() || force) {
@@ -41,16 +47,20 @@
if(os.length == 0) return;
XModelObject o = os[0];
if(os.length == 1) os = null;
- XModelObjectActionList l = new XModelObjectActionList(o.getModelEntity().getActionList(), o, os, new Object[]{o});
+ XModelObjectActionList l = new XModelObjectActionList(getActionList(o), o, os, new Object[]{o});
l.setShell(shell);
l.createMenu(menu);
l.removeLastSeparator(menu);
}
}
}
-
+
+ public XActionList getActionList(XModelObject o) {
+ return o.getModelEntity().getActionList();
+ }
+
public XModelObject[] getSelectedModelObjects() {
- ISelection s = context.getSelection();
+ ISelection s = context != null ? context.getSelection() : selection;
if(s.isEmpty() || !(s instanceof StructuredSelection)) return new XModelObject[0];
StructuredSelection ss = (StructuredSelection)s;
Iterator it = ss.iterator();
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/XMenuInvoker.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/XMenuInvoker.java 2009-10-19 13:54:09 UTC (rev 18161)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/XMenuInvoker.java 2009-10-19 14:01:47 UTC (rev 18162)
@@ -12,8 +12,8 @@
import java.util.*;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.dnd.DnDUtil;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
@@ -27,6 +27,14 @@
protected Viewer viewer;
protected boolean onKeyRelease = false;
+ ModelContributionManager standardInvoker;
+
+ public XMenuInvoker() {}
+
+ public void setStandardInvoker(ModelContributionManager standardInvoker) {
+ this.standardInvoker = standardInvoker;
+ }
+
public void setViewer(Viewer viewer) {
this.viewer = viewer;
}
@@ -39,6 +47,23 @@
}
public void mouseDown(MouseEvent e) {
+ if(standardInvoker != null) {
+ XModelObject eo = getModelObjectAt(new Point(e.x, e.y));
+ XModelObject o = getSelectedModelObject();
+ if(o == null && eo == null) return;
+ XModelObject[] os = getSelectedModelObjects();
+ if(eo != null && (o == null || os == null || os.length < 2)) {
+ o = eo;
+ os = null;
+ } else if(isIncluded(eo, os)) {
+ o = eo;
+ }
+ if(os != null && os.length > 0) {
+ standardInvoker.setSelection(new StructuredSelection(os));
+ } else if(o != null) {
+ standardInvoker.setSelection(new StructuredSelection(o));
+ }
+ }
}
public void mouseUp(MouseEvent e) {
@@ -46,7 +71,7 @@
}
protected void handleMouseUp(MouseEvent e) {
- if(e.button == 3) {
+ if(e.button == 3 && standardInvoker == null) {
XModelObject eo = getModelObjectAt(new Point(e.x, e.y));
XModelObject o = getSelectedModelObject();
if(o == null && eo == null) return;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorViewPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorViewPart.java 2009-10-19 13:54:09 UTC (rev 18161)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorViewPart.java 2009-10-19 14:01:47 UTC (rev 18162)
@@ -78,6 +78,7 @@
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.action.ModelContributionManager;
import org.jboss.tools.common.model.ui.dnd.ControlDragDrop;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.navigator.NavigatorLabelProvider;
@@ -242,7 +243,7 @@
}
});
//@S_CHECK@
- TreeViewerMenuInvoker listener = createMenuInvoker();
+ listener = createMenuInvoker();
listener.setViewer(viewer);
if(useModelMenu) {
viewer.getTree().addMouseListener(listener);
@@ -474,22 +475,22 @@
// MenuManager
- MenuManager menuMgr;
+ ModelContributionManager menuMgr;
+ TreeViewerMenuInvoker listener;
protected void initContextMenu() {
- menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+ menuMgr = new ModelContributionManager(getSite().getShell());
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
fillContextMenu(manager);
}
});
- if(!useModelMenu) {
- TreeViewer treeViewer = getViewer();
- Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
- treeViewer.getTree().setMenu(menu);
- getSite().registerContextMenu(menuMgr, treeViewer);
- }
+ TreeViewer treeViewer = getViewer();
+ Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
+ treeViewer.getTree().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, treeViewer);
+ listener.setStandardInvoker(menuMgr);
}
@@ -500,10 +501,12 @@
}
protected void fillContextMenu(IMenuManager menu) {
- IStructuredSelection selection =
- (IStructuredSelection) getViewer().getSelection();
- getActionGroup().setContext(new ActionContext(selection));
- getActionGroup().fillContextMenu(menu);
+// IStructuredSelection selection =
+// (IStructuredSelection) getViewer().getSelection();
+// if(menu instanceof ModelContributionManager) {
+// ((ModelContributionManager)menu).setSelection(selection);
+// }
+ menu.update(true);
}
// linking
14 years, 8 months
JBoss Tools SVN: r18161 - trunk/documentation/guides/GettingStartedGuide/en/images/first_seam.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2009-10-19 09:54:09 -0400 (Mon, 19 Oct 2009)
New Revision: 18161
Modified:
trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam25.png
trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam47.png
Log:
https://jira.jboss.org/jira/browse/JBDS-787 Context menu unification for the VPE and for the text editor - screens updated
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam25.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam47.png
===================================================================
(Binary files differ)
14 years, 8 months
JBoss Tools SVN: r18160 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-10-19 09:48:33 -0400 (Mon, 19 Oct 2009)
New Revision: 18160
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/plugin.xml
Log:
JBIDE-3563: Code assist for "class" and "styleClass" attributes for html and jsf tags.
loadStyle tags are supported as the tags defining the CSS StyleSheet holders
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/plugin.xml 2009-10-19 13:37:46 UTC (rev 18159)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/plugin.xml 2009-10-19 13:48:33 UTC (rev 18160)
@@ -350,5 +350,19 @@
<attribute name="viewId" />
</tag>
</include>
+
+ <cssholder uri="http://richfaces.org/a4j">
+ <tag name="loadStyle">
+ <attribute name="src"/>
+ </tag>
+ </cssholder>
+
+ <cssholder uri="https://ajax4jsf.dev.java.net/ajax">
+ <tag name="loadStyle">
+ <attribute name="src"/>
+ </tag>
+ </cssholder>
+
+
</extension>
</plugin>
14 years, 8 months
JBoss Tools SVN: r18159 - in trunk/jsf/plugins: org.jboss.tools.jsf.ui and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-10-19 09:37:46 -0400 (Mon, 19 Oct 2009)
New Revision: 18159
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4978
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2009-10-19 13:36:57 UTC (rev 18158)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2009-10-19 13:37:46 UTC (rev 18159)
@@ -466,12 +466,12 @@
<initializer class="org.jboss.tools.jsf.preferences.JSFPreferenceInitializer"/>
</extension>
- <extension
+ <!--extension
point="org.jboss.tools.jst.web.kb.validator">
<validator
class="org.jboss.tools.jsf.web.validation.ELValidator"
id="org.jboss.tools.jsf.ELValidator">
</validator>
- </extension>
+ </extension-->
</plugin>
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-10-19 13:36:57 UTC (rev 18158)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-10-19 13:37:46 UTC (rev 18159)
@@ -30,15 +30,14 @@
class="org.jboss.tools.jsf.ui.preferences.JSFFlowTabbedPreferencesPage"
id="org.jboss.tools.jsf.ui.jsfflowdiagram"
name="%PreferencePage_JSFFlowTabbed"/>
- <page
+ <!--page
category="org.jboss.tools.jsf.ui"
class="org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"
id="org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"
- name="%PreferencePage_Validator">
- </page>
+ name="%PreferencePage_Validator"/-->
</extension>
- <extension
+ <!--extension
point="org.eclipse.ui.propertyPages">
<page
name="%PreferencePage_JSFValidator"
@@ -50,7 +49,7 @@
</adapt>
</enabledWhen>
</page>
- </extension>
+ </extension-->
<extension id="e" name="XML Editors" point="org.jboss.tools.common.model.ui.xmlEditor">
<xmlEditor
14 years, 8 months