JBoss Tools SVN: r16918 - in trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools: src/org/jboss/ide/eclipse/archives/webtools/filesets and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-07-30 17:23:26 -0400 (Thu, 30 Jul 2009)
New Revision: 16918
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.32
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.40
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.42
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.50
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.51
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.eap.43
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.eap.50
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/Fileset.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/NewServerFilesetHandler.java
Log:
JBIDE-4680
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.32
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.32 2009-07-30 20:07:37 UTC (rev 16917)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.32 2009-07-30 21:23:26 UTC (rev 16918)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<filesets>
-<fileset excludes="" folder="{config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
+<fileset excludes="" folder="server/${config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
</filesets>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.40
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.40 2009-07-30 20:07:37 UTC (rev 16917)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.40 2009-07-30 21:23:26 UTC (rev 16918)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<filesets>
-<fileset excludes="" folder="{config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
+<fileset excludes="" folder="server/${config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
</filesets>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.42
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.42 2009-07-30 20:07:37 UTC (rev 16917)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.42 2009-07-30 21:23:26 UTC (rev 16918)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<filesets>
-<fileset excludes="" folder="{config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
+<fileset excludes="" folder="server/${config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
</filesets>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.50
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.50 2009-07-30 20:07:37 UTC (rev 16917)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.50 2009-07-30 21:23:26 UTC (rev 16918)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<filesets>
-<fileset excludes="" folder="{config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
+<fileset excludes="" folder="server/${config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
</filesets>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.51
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.51 2009-07-30 20:07:37 UTC (rev 16917)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.51 2009-07-30 21:23:26 UTC (rev 16918)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<filesets>
-<fileset excludes="" folder="{config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
+<fileset excludes="" folder="server/${config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
</filesets>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.eap.43
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.eap.43 2009-07-30 20:07:37 UTC (rev 16917)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.eap.43 2009-07-30 21:23:26 UTC (rev 16918)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<filesets>
-<fileset excludes="" folder="{config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
+<fileset excludes="" folder="server/${config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
</filesets>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.eap.50
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.eap.50 2009-07-30 20:07:37 UTC (rev 16917)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/filesetdata/org.jboss.ide.eclipse.as.eap.50 2009-07-30 21:23:26 UTC (rev 16918)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<filesets>
-<fileset excludes="" folder="{config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
+<fileset excludes="" folder="server/${config}/conf" includes="jboss-log4j.xml" name="Log4j.xml"/>
</filesets>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/Fileset.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/Fileset.java 2009-07-30 20:07:37 UTC (rev 16917)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/Fileset.java 2009-07-30 21:23:26 UTC (rev 16918)
@@ -11,8 +11,10 @@
package org.jboss.ide.eclipse.archives.webtools.filesets;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
public class Fileset implements Cloneable {
@@ -47,6 +49,17 @@
*/
public String getFolder() {
String tmp = folder == null ? "" : folder; //$NON-NLS-1$
+
+ // TODO do the string replacement! perhaps use variables plugin
+ IJBossServerRuntime ajbsrt = (IJBossServerRuntime) server.getRuntime()
+ .loadAdapter(IJBossServerRuntime.class,
+ new NullProgressMonitor());
+ String config = null;
+ if( ajbsrt != null )
+ config = ajbsrt.getJBossConfiguration();
+ if( config != null )
+ tmp = tmp.replace("${config}", config); //$NON-NLS-1$
+
IPath p = new Path(tmp);
if( !p.isAbsolute() && server != null ) {
if( server.getRuntime() != null )
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/NewServerFilesetHandler.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/NewServerFilesetHandler.java 2009-07-30 20:07:37 UTC (rev 16917)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/NewServerFilesetHandler.java 2009-07-30 21:23:26 UTC (rev 16918)
@@ -57,22 +57,6 @@
list.addAll(Arrays.asList(sets));
Fileset[] finalSets = (Fileset[]) list.toArray(new Fileset[list.size()]);
-
- /*
- * Replace {config} with server/config if this is a jboss server
- */
- IJBossServerRuntime ajbsrt = (IJBossServerRuntime) server.getRuntime()
- .loadAdapter(IJBossServerRuntime.class,
- new NullProgressMonitor());
- String config = null;
- if( ajbsrt != null )
- config = ajbsrt.getJBossConfiguration();
- for( int i = 0; i < finalSets.length; i++ ) {
- String folder = finalSets[i].getRawFolder();
- if( config != null )
- folder = folder.replace("{config}", "server/" + config); //$NON-NLS-1$ //$NON-NLS-2$
- finalSets[i].setFolder(folder);
- }
FilesetUtil.saveFilesets(server, finalSets);
}
}
15 years, 5 months
JBoss Tools SVN: r16917 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-07-30 16:07:37 -0400 (Thu, 30 Jul 2009)
New Revision: 16917
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
Log:
JBIDE-4687: Wrong CA when there is incomplete tag (a tag with no closing '>'-char)
Issue is fixed
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java 2009-07-30 20:06:55 UTC (rev 16916)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java 2009-07-30 20:07:37 UTC (rev 16917)
@@ -31,6 +31,7 @@
public static final int R_XML_ATTRIBUTE_NAME = 910;
public static final int R_TAG_INSERTION = 500;
public static final int R_XML_ATTRIBUTE_VALUE_TEMPLATE = 91;
+ public static final int R_CLOSE_TAG = 1550;
private static final long serialVersionUID = 3257007635692926512L;
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-07-30 20:06:55 UTC (rev 16916)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-07-30 20:07:37 UTC (rev 16917)
@@ -23,18 +23,29 @@
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
import org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
+import org.eclipse.wst.xml.ui.internal.editor.CMImageUtil;
+import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
+import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
import org.jboss.tools.common.el.core.model.ELInstance;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.model.ELModel;
@@ -44,6 +55,7 @@
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.w3c.dom.Attr;
@@ -77,7 +89,150 @@
return super.computeCompletionProposals(viewer, offset);
}
+
/**
+ * The reason of overriding is that the method returns wrong region in case of incomplete tag (a tag with no '>'-closing char)
+ * In this case we have to return that previous incomplete tag instead of the current tag)
+ */
+ public IStructuredDocumentRegion getStructuredDocumentRegion(int pos) {
+ IStructuredDocumentRegion sdRegion = null;
+ if (fDocument == null)
+ return null;
+
+ int lastOffset = pos;
+ IStructuredDocument doc = (IStructuredDocument) fDocument;
+
+ do {
+ sdRegion = doc.getRegionAtCharacterOffset(lastOffset);
+ if (sdRegion != null) {
+ ITextRegion region = sdRegion.getRegionAtCharacterOffset(lastOffset);
+ if (region != null && region.getType() == DOMRegionContext.XML_TAG_OPEN &&
+ sdRegion.getStartOffset(region) == lastOffset) {
+ // The offset is at the beginning of the region
+ if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+// sdRegion = sdRegion.getPrevious();
+ sdRegion = null;
+ }
+ else {
+ // Is there no separating whitespace from the previous region?
+ // If not,
+ // then that region is the important one
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(lastOffset - 1);
+ if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() == previousRegion.getLength())) {
+// sdRegion = sdRegion.getPrevious();
+ sdRegion = null;
+ }
+ }
+ }
+ }
+ lastOffset--;
+ } while (sdRegion == null && lastOffset >= 0);
+ return sdRegion;
+ }
+
+ /**
+ * The reason of overriding is that the method returns wrong region in case of incomplete tag (a tag with no '>'-closing char)
+ * In this case we have to return that previous incomplete tag instead of the current tag)
+ */
+ protected ITextRegion getCompletionRegion(int documentPosition, Node domnode) {
+ if (domnode == null) {
+ return null;
+ }
+ // Get the original WTP Structured Document Region
+ IStructuredDocumentRegion sdNormalRegion = super.getStructuredDocumentRegion(documentPosition);
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(documentPosition);
+
+ // If original and fixed regions are different we have to replace domnode with its parent node
+ if (sdFixedRegion != null && !sdFixedRegion.equals(sdNormalRegion)) {
+ Node prevnode = domnode.getParentNode();
+ if (prevnode != null) {
+ domnode = prevnode;
+ }
+ }
+ return super.getCompletionRegion(documentPosition, domnode);
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor#computeTagNameProposals(int, java.lang.String, org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion, org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode, org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)
+ */
+ protected ContentAssistRequest computeTagNameProposals(int documentPosition, String matchString, ITextRegion completionRegion, IDOMNode nodeAtOffset, IDOMNode node) {
+ ContentAssistRequest contentAssistRequest = null;
+ IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition);
+
+ if (sdRegion != nodeAtOffset.getFirstStructuredDocumentRegion()) {
+ // completing the *first* tag in "<tagname1 |<tagname2"
+ IDOMNode actualNode = (IDOMNode) node.getModel().getIndexedRegion(sdRegion.getStartOffset(completionRegion));
+ if (actualNode != null) {
+ if (actualNode.getFirstStructuredDocumentRegion() == sdRegion) {
+ // start tag
+ if ((documentPosition >= sdRegion.getStartOffset(completionRegion) + completionRegion.getLength()) &&
+ (documentPosition > sdRegion.getStartOffset(completionRegion) + completionRegion.getTextLength())){
+ // it's attributes
+ contentAssistRequest = newContentAssistRequest(actualNode, actualNode, sdRegion, completionRegion, documentPosition - matchString.length(), matchString.length(), matchString);
+ if (node.getStructuredDocument().getRegionAtCharacterOffset(sdRegion.getStartOffset(completionRegion) - 1).getRegionAtCharacterOffset(sdRegion.getStartOffset(completionRegion) - 1).getType() == DOMRegionContext.XML_TAG_OPEN) {
+ addAttributeNameProposals(contentAssistRequest);
+ }
+ addTagCloseProposals(contentAssistRequest);
+ }
+ else {
+ // it's name
+ contentAssistRequest = newContentAssistRequest(actualNode, actualNode.getParentNode(), sdRegion, completionRegion, documentPosition - matchString.length(), matchString.length(), matchString);
+ addTagNameProposals(contentAssistRequest, getElementPositionForModelQuery(actualNode));
+ }
+ }
+ else {
+ if (documentPosition >= sdRegion.getStartOffset(completionRegion) + completionRegion.getLength()) {
+ // insert name
+ contentAssistRequest = newContentAssistRequest(actualNode, actualNode.getParentNode(), sdRegion, completionRegion, documentPosition, 0, matchString);
+ }
+ else {
+ // replace name
+ contentAssistRequest = newContentAssistRequest(actualNode, actualNode.getParentNode(), sdRegion, completionRegion, sdRegion.getStartOffset(completionRegion), completionRegion.getTextLength(), matchString);
+ }
+ addEndTagNameProposals(contentAssistRequest);
+ }
+ }
+ }
+ else {
+ if (documentPosition > sdRegion.getStartOffset(completionRegion) + completionRegion.getTextLength()) {
+ // unclosed tag with only a name; should prompt for attributes
+ // and a close instead
+ contentAssistRequest = newContentAssistRequest(nodeAtOffset, node, sdRegion, completionRegion, documentPosition - matchString.length(), matchString.length(), matchString);
+ addAttributeNameProposals(contentAssistRequest);
+ addTagCloseProposals(contentAssistRequest);
+ }
+ else {
+ if (sdRegion.getRegions().get(0).getType() != DOMRegionContext.XML_END_TAG_OPEN) {
+ int replaceLength = documentPosition - sdRegion.getStartOffset(completionRegion);
+ contentAssistRequest = newContentAssistRequest(node, node.getParentNode(), sdRegion, completionRegion, sdRegion.getStartOffset(completionRegion), replaceLength, matchString);
+ addTagNameProposals(contentAssistRequest, getElementPositionForModelQuery(nodeAtOffset));
+ }
+ else {
+ IDOMNode actualNode = (IDOMNode) node.getModel().getIndexedRegion(documentPosition);
+ if (actualNode != null) {
+ if (documentPosition >= sdRegion.getStartOffset(completionRegion) + completionRegion.getTextLength()) {
+ contentAssistRequest = newContentAssistRequest(actualNode, actualNode.getParentNode(), sdRegion, completionRegion, documentPosition, 0, matchString);
+ }
+ else {
+ contentAssistRequest = newContentAssistRequest(actualNode, actualNode.getParentNode(), sdRegion, completionRegion, sdRegion.getStartOffset(completionRegion), completionRegion.getTextLength(), matchString);
+ }
+ addEndTagNameProposals(contentAssistRequest);
+ }
+ }
+ }
+ }
+ return contentAssistRequest;
+ }
+
+ private int getElementPositionForModelQuery(Node child) {
+ return getElementPosition(child);
+ // return -1;
+ }
+ /**
* Helper method to reuse functionality for getting context when no proposals are needed.
* @param viewer
* @param offset
@@ -270,8 +425,65 @@
/*
* Calculates and adds the tag close proposals to the Content Assist Request object
+ *
*/
protected void addTagCloseProposals(ContentAssistRequest contentAssistRequest) {
+ IDOMNode node = (IDOMNode) contentAssistRequest.getParent();
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ int contentType = CMElementDeclaration.ANY;
+ // if it's XML and content doesn't HAVE to be element, add "/>"
+ // proposal.
+ boolean endWithSlashBracket = (getXML(node) && (contentType != CMElementDeclaration.ELEMENT));
+
+ Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
+
+ // is the start tag ended properly?
+ if ((contentAssistRequest.getDocumentRegion() == node.getFirstStructuredDocumentRegion()) && !(node.getFirstStructuredDocumentRegion()).isEnded()) {
+ setErrorMessage(null);
+ // prompt with a close for the start tag
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, ">", //$NON-NLS-1$
+ getOffset(),
+ 0, 2, image, NLS.bind(XMLUIMessages.Close_with__, (new Object[]{" '>'"})), //$NON-NLS-1$
+ null, null, TextProposal.R_CLOSE_TAG);
+ contentAssistRequest.addProposal(proposal);
+
+ // prompt with the closer for the start tag and an end tag
+ // if one is not present
+ if (node.getEndStructuredDocumentRegion() == null) {
+ // make sure tag name is actually what it thinks it
+ // is...(eg. <%@ vs. <jsp:directive)
+ IStructuredDocumentRegion sdr = contentAssistRequest.getDocumentRegion();
+ String openingTagText = (sdr != null) ? sdr.getFullText() : ""; //$NON-NLS-1$
+ if ((openingTagText != null) && (openingTagText.indexOf(node.getNodeName()) != -1)) {
+ proposal = new AutoContentAssistantProposal(true, "></" + node.getNodeName() + ">", //$NON-NLS-2$//$NON-NLS-1$
+ getOffset(),
+ 0, 1, image, NLS.bind(XMLUIMessages.Close_with____, (new Object[]{node.getNodeName()})), null, null, TextProposal.R_CLOSE_TAG);
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+ // prompt with slash bracket "/>" incase if it's a self
+ // ending tag
+ if (endWithSlashBracket) {
+ proposal = new AutoContentAssistantProposal(true, "/>", //$NON-NLS-1$
+ getOffset(),
+ 0, 1, image, NLS.bind(XMLUIMessages.Close_with__, (new Object[]{" \"/>\""})), //$NON-NLS-1$
+ null, null, TextProposal.R_CLOSE_TAG + 1); // +1 to bring to top of list
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+ else if ((contentAssistRequest.getDocumentRegion() == node.getLastStructuredDocumentRegion()) && !node.getLastStructuredDocumentRegion().isEnded()) {
+ setErrorMessage(null);
+ // prompt with a closing end character for the end tag
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, ">", //$NON-NLS-1$
+ getOffset(),
+ 0, 1, image, NLS.bind(XMLUIMessages.Close_with__, (new Object[]{" '>'"})), //$NON-NLS-1$
+ null, null, TextProposal.R_CLOSE_TAG);
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+ else if (node.getNodeType() == Node.DOCUMENT_NODE) {
+ setErrorMessage(UNKNOWN_CONTEXT);
+ }
}
/*
@@ -453,7 +665,12 @@
if (xmlDocument == null)
return EMPTY_TAGS;
- Node n = findNodeForOffset(xmlDocument, getOffset());
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return EMPTY_TAGS;
+
+ Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
if (n == null)
return EMPTY_TAGS;
@@ -507,7 +724,12 @@
if (xmlDocument == null)
return null;
- Node n = findNodeForOffset(xmlDocument, getOffset());
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return null;
+
+ Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
if (n == null)
return null;
@@ -556,7 +778,12 @@
if (xmlDocument == null)
return null;
- Node n = findNodeForOffset(xmlDocument, getOffset());
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return null;
+
+ Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
if (n == null)
return null;
@@ -673,7 +900,12 @@
if (xmlDocument == null)
return null;
- Node n = findNodeForOffset(xmlDocument, getOffset());
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return null;
+
+ Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
if (n == null)
return null;
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-07-30 20:06:55 UTC (rev 16916)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-07-30 20:07:37 UTC (rev 16917)
@@ -19,6 +19,7 @@
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
@@ -95,7 +96,12 @@
if (xmlDocument == null)
return;
- Node n = findNodeForOffset(xmlDocument, getOffset());
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return;
+
+ Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
while (n != null) {
if (!(n instanceof Element)) {
if (n instanceof Attr) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-07-30 20:06:55 UTC (rev 16916)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-07-30 20:07:37 UTC (rev 16917)
@@ -24,11 +24,11 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.xml.core.internal.document.NodeContainer;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
-import org.eclipse.wst.xml.ui.internal.editor.CMImageUtil;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
import org.jboss.tools.common.el.core.resolver.ELContext;
@@ -145,7 +145,7 @@
* @param context The context object instance
* @return
*/
- public ITagLibrary[] getTagLibraries(IPageContext context) {
+ protected ITagLibrary[] getTagLibraries(IPageContext context) {
Map<String, INameSpace> nameSpaces = context.getNameSpaces(getOffset());
if (nameSpaces == null || nameSpaces.isEmpty())
return EMPTY_LIBRARIES;
@@ -288,10 +288,15 @@
if (xmlDocument == null)
return false;
- Node n = findNodeForOffset(xmlDocument, getOffset());
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return false;
+
+ Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
if (n == null)
return false;
-
+
// Find the first parent tag
if (!(n instanceof Element)) {
if (n instanceof Attr) {
@@ -362,7 +367,7 @@
if (image == null) {
image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
}
- String displayString = closingTag;
+ String displayString = closingTag; //$NON-NLS-1$
IContextInformation contextInformation = null;
String additionalProposalInfo = textProposal.getContextInfo();
int relevance = textProposal.getRelevance();
@@ -427,7 +432,7 @@
image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
}
- String displayString = closingTag;
+ String displayString = closingTag; //$NON-NLS-1$
IContextInformation contextInformation = null;
String additionalProposalInfo = textProposal.getContextInfo();
int relevance = textProposal.getRelevance();
15 years, 5 months
JBoss Tools SVN: r16916 - in workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui: src/org/eclipse/wst/common/componentcore/ui and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-07-30 16:06:55 -0400 (Thu, 30 Jul 2009)
New Revision: 16916
Added:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/ModuleCoreUIPlugin.java
Removed:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/ComponentCoreUIPlugin.java
Modified:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/DependencyPageExtensionManager.java
Log:
renaming plugin class
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF 2009-07-30 20:05:07 UTC (rev 16915)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF 2009-07-30 20:06:55 UTC (rev 16916)
@@ -3,7 +3,7 @@
Bundle-Name: WTP UI Overrides
Bundle-SymbolicName: org.eclipse.wst.common.modulecore.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.wst.common.componentcore.ui.ComponentCoreUIPlugin
+Bundle-Activator: org.eclipse.wst.common.componentcore.ui.ModuleCoreUIPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources;bundle-version="3.5.0",
Deleted: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/ComponentCoreUIPlugin.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/ComponentCoreUIPlugin.java 2009-07-30 20:05:07 UTC (rev 16915)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/ComponentCoreUIPlugin.java 2009-07-30 20:06:55 UTC (rev 16916)
@@ -1,97 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2009 Red Hat
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rob Stryker - initial implementation and ongoing maintenance
- ******************************************************************************/
-package org.eclipse.wst.common.componentcore.ui;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class ComponentCoreUIPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.wst.common.modulecore.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static ComponentCoreUIPlugin plugin;
-
- /**
- * The constructor
- */
- public ComponentCoreUIPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ComponentCoreUIPlugin getDefault() {
- return plugin;
- }
-
- public static void log(Exception e) {
- log(e.getMessage(), e);
- }
-
- public static void log(String message, Exception e) {
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
- getDefault().getLog().log(status);
- }
- public static IStatus createStatus(int severity, int aCode,
- String aMessage, Throwable exception) {
- return new Status(severity, PLUGIN_ID, aCode,
- aMessage != null ? aMessage : "No message.", exception); //$NON-NLS-1$
- }
- public static IStatus createErrorStatus(int aCode, String aMessage,
- Throwable exception) {
- return createStatus(IStatus.ERROR, aCode, aMessage, exception);
- }
-
- public static IStatus createStatus(int severity, String message, Throwable exception) {
- return new Status(severity, PLUGIN_ID, message, exception);
- }
-
- public static IStatus createStatus(int severity, String message) {
- return createStatus(severity, message, null);
- }
- public static void logError(Throwable exception) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception));
- }
-
- public static void logError(CoreException exception) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() );
- }
-
-}
Copied: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/ModuleCoreUIPlugin.java (from rev 16914, workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/ComponentCoreUIPlugin.java)
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/ModuleCoreUIPlugin.java (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/ModuleCoreUIPlugin.java 2009-07-30 20:06:55 UTC (rev 16916)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * Copyright (c) 2009 Red Hat
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ ******************************************************************************/
+package org.eclipse.wst.common.componentcore.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ModuleCoreUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.wst.common.modulecore.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static ModuleCoreUIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public ModuleCoreUIPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ModuleCoreUIPlugin getDefault() {
+ return plugin;
+ }
+
+ public static void log(Exception e) {
+ log(e.getMessage(), e);
+ }
+
+ public static void log(String message, Exception e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ getDefault().getLog().log(status);
+ }
+ public static IStatus createStatus(int severity, int aCode,
+ String aMessage, Throwable exception) {
+ return new Status(severity, PLUGIN_ID, aCode,
+ aMessage != null ? aMessage : "No message.", exception); //$NON-NLS-1$
+ }
+ public static IStatus createErrorStatus(int aCode, String aMessage,
+ Throwable exception) {
+ return createStatus(IStatus.ERROR, aCode, aMessage, exception);
+ }
+
+ public static IStatus createStatus(int severity, String message, Throwable exception) {
+ return new Status(severity, PLUGIN_ID, message, exception);
+ }
+
+ public static IStatus createStatus(int severity, String message) {
+ return createStatus(severity, message, null);
+ }
+ public static void logError(Throwable exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception));
+ }
+
+ public static void logError(CoreException exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() );
+ }
+
+}
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-07-30 20:05:07 UTC (rev 16915)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-07-30 20:06:55 UTC (rev 16916)
@@ -72,7 +72,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.componentcore.ui.ComponentCoreUIPlugin;
+import org.eclipse.wst.common.componentcore.ui.ModuleCoreUIPlugin;
import org.eclipse.wst.common.componentcore.ui.Messages;
import org.eclipse.wst.common.componentcore.ui.propertypage.internal.AddFolderDialog;
import org.eclipse.wst.common.componentcore.ui.propertypage.internal.ComponentDependencyContentProvider;
@@ -737,7 +737,7 @@
IDataModelOperation operation = getRemoveComponentOperation(component);
operation.execute(null, null);
} catch( ExecutionException e) {
- ComponentCoreUIPlugin.logError(e);
+ ModuleCoreUIPlugin.logError(e);
}
}
}
@@ -795,7 +795,7 @@
try {
ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor());
} catch( CoreException e ) {
- ComponentCoreUIPlugin.logError(e);
+ ModuleCoreUIPlugin.logError(e);
}
}
@@ -833,7 +833,7 @@
try {
dm.getDefaultOperation().execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
- ComponentCoreUIPlugin.logError(e);
+ ModuleCoreUIPlugin.logError(e);
}
}
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/DependencyPageExtensionManager.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/DependencyPageExtensionManager.java 2009-07-30 20:05:07 UTC (rev 16915)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/DependencyPageExtensionManager.java 2009-07-30 20:06:55 UTC (rev 16916)
@@ -23,7 +23,7 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.eclipse.wst.common.componentcore.ui.ComponentCoreUIPlugin;
+import org.eclipse.wst.common.componentcore.ui.ModuleCoreUIPlugin;
import org.eclipse.wst.common.componentcore.ui.propertypage.IDependencyPageProvider;
public class DependencyPageExtensionManager {
@@ -53,7 +53,7 @@
HashMap<String, IDependencyPageProvider> temp = new HashMap<String, IDependencyPageProvider>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] cf = registry.getConfigurationElementsFor(
- ComponentCoreUIPlugin.PLUGIN_ID, "moduleDependencyPropertyPage"); //$NON-NLS-1$
+ ModuleCoreUIPlugin.PLUGIN_ID, "moduleDependencyPropertyPage"); //$NON-NLS-1$
for( int i = 0; i < cf.length; i++ ) {
try {
temp.put(cf[i].getAttribute("id"), //$NON-NLS-1$
@@ -66,7 +66,7 @@
public WizardFragment loadReferenceWizardFragment(String id) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] cf = registry.getConfigurationElementsFor(
- ComponentCoreUIPlugin.PLUGIN_ID, "referenceWizardFragment"); //$NON-NLS-1$
+ ModuleCoreUIPlugin.PLUGIN_ID, "referenceWizardFragment"); //$NON-NLS-1$
for( int i = 0; i < cf.length; i++ ) {
if( cf[i].getAttribute("id").equals(id)) //$NON-NLS-1$
try {
@@ -79,7 +79,7 @@
public ReferenceExtension[] getReferenceExtensions() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] cf = registry.getConfigurationElementsFor(
- ComponentCoreUIPlugin.PLUGIN_ID, "referenceWizardFragment"); //$NON-NLS-1$
+ ModuleCoreUIPlugin.PLUGIN_ID, "referenceWizardFragment"); //$NON-NLS-1$
ArrayList<ReferenceExtension> list = new ArrayList<ReferenceExtension>();
for( int i = 0; i < cf.length; i++ ) {
list.add(new ReferenceExtension(cf[i]));
15 years, 5 months
JBoss Tools SVN: r16914 - workspace/rstryker/wtpPropertyPageContrib.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-07-30 16:01:28 -0400 (Thu, 30 Jul 2009)
New Revision: 16914
Added:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui/
Removed:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/
Log:
renaming project
Copied: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.modulecore.ui (from rev 16913, workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui)
15 years, 5 months
JBoss Tools SVN: r16912 - in workspace/rstryker/wtpPropertyPageContrib: org.eclipse.jst.common.ui and 19 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-07-30 15:58:41 -0400 (Thu, 30 Jul 2009)
New Revision: 16912
Added:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.classpath
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.project
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.settings/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.settings/org.eclipse.jdt.core.prefs
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/META-INF/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/META-INF/MANIFEST.MF
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/JstCommonUIPlugin.class
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/Messages.class
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/ExternalJarReferenceWizardFragment.class
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment$1.class
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment$2.class
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment$3.class
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment.class
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/VariableReferenceWizardFragment.class
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/messages.properties
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/build.properties
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/icons/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/icons/jar_obj.gif
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/plugin.xml
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/JstCommonUIPlugin.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/Messages.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/ExternalJarReferenceWizardFragment.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/VariableReferenceWizardFragment.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/messages.properties
Log:
hate this, trying to reorg project properly
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.classpath
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.classpath (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.classpath 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.project
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.project (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.project 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.common.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/.settings/org.eclipse.jdt.core.prefs 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,8 @@
+#Thu Jul 30 14:13:32 PDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/META-INF/MANIFEST.MF
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/META-INF/MANIFEST.MF (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/META-INF/MANIFEST.MF 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Ui
+Bundle-SymbolicName: org.eclipse.jst.common.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.jst.common.ui.JstCommonUIPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.wst.server.ui;bundle-version="1.1.102",
+ org.eclipse.jdt.core;bundle-version="3.5.0",
+ org.eclipse.jdt.ui;bundle-version="3.5.0",
+ org.eclipse.wst.common.modulecore;bundle-version="1.1.300",
+ org.eclipse.wst.common.modulecore.ui;bundle-version="1.0.0",
+ org.eclipse.wst.server.core;bundle-version="1.1.101",
+ org.eclipse.core.resources;bundle-version="3.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/JstCommonUIPlugin.class
===================================================================
(Binary files differ)
Property changes on: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/JstCommonUIPlugin.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/Messages.class
===================================================================
(Binary files differ)
Property changes on: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/Messages.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/ExternalJarReferenceWizardFragment.class
===================================================================
(Binary files differ)
Property changes on: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/ExternalJarReferenceWizardFragment.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment$1.class
===================================================================
(Binary files differ)
Property changes on: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment$2.class
===================================================================
(Binary files differ)
Property changes on: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment$3.class
===================================================================
(Binary files differ)
Property changes on: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment$3.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment.class
===================================================================
(Binary files differ)
Property changes on: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/VariableReferenceWizardFragment.class
===================================================================
(Binary files differ)
Property changes on: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/assembly/wizard/VariableReferenceWizardFragment.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/messages.properties
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/messages.properties (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/bin/org/eclipse/jst/common/ui/messages.properties 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,7 @@
+JarTitle=Add a Jar Reference
+JarDescription="Here you can reference a workspace Jar\nThis is not a suggested use-case, but is here for backwards compatability.
+ExternalJarTitle=Add an External Jar Reference
+ExternalJarDescription=Here you can reference a filesystem Jar\nThis is not a suggested use-case, but is here for backwards compatability.
+Browse=Browse...
+VariableReferenceTitle=Add a Variable Reference
+VariableReferenceDescription="Here you can reference a variable which maps to a single jar.\nThis is not a suggested use-case, but is here for backwards compatability.
\ No newline at end of file
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/build.properties
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/build.properties (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/build.properties 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/icons/jar_obj.gif
===================================================================
(Binary files differ)
Property changes on: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/icons/jar_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/plugin.xml
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/plugin.xml (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/plugin.xml 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.wst.common.modulecore.ui.referenceWizardFragment">
+ <referenceFragment
+ class="org.eclipse.jst.common.ui.assembly.wizard.JarReferenceWizardFragment"
+ icon="icons/jar_obj.gif"
+ id="org.eclipse.jst.common.ui.jarReference"
+ name="Jar">
+ </referenceFragment>
+ <referenceFragment
+ class="org.eclipse.jst.common.ui.assembly.wizard.ExternalJarReferenceWizardFragment"
+ icon="icons/jar_obj.gif"
+ id="org.eclipse.jst.common.ui.externalJarReference"
+ name="External Jar">
+ </referenceFragment>
+ <referenceFragment
+ class="org.eclipse.jst.common.ui.assembly.wizard.VariableReferenceWizardFragment"
+ icon="icons/jar_obj.gif"
+ id="org.eclipse.jst.common.ui.variableReference"
+ name="Variable">
+ </referenceFragment>
+ </extension>
+
+</plugin>
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/JstCommonUIPlugin.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/JstCommonUIPlugin.java (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/JstCommonUIPlugin.java 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,50 @@
+package org.eclipse.jst.common.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class JstCommonUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.jst.common.ui";
+
+ // The shared instance
+ private static JstCommonUIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public JstCommonUIPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static JstCommonUIPlugin getDefault() {
+ return plugin;
+ }
+
+}
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/Messages.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/Messages.java (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/Messages.java 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,22 @@
+package org.eclipse.jst.common.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.jst.common.ui.messages"; //$NON-NLS-1$
+ public static String JarTitle;
+ public static String JarDescription;
+ public static String ExternalJarTitle;
+ public static String ExternalJarDescription;
+ public static String Browse;
+ public static String VariableReferenceTitle;
+ public static String VariableReferenceDescription;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/ExternalJarReferenceWizardFragment.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/ExternalJarReferenceWizardFragment.java (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/ExternalJarReferenceWizardFragment.java 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * Copyright (c) 2009 Red Hat
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ ******************************************************************************/
+package org.eclipse.jst.common.ui.assembly.wizard;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
+import org.eclipse.jst.common.ui.Messages;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+
+public class ExternalJarReferenceWizardFragment extends JarReferenceWizardFragment {
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ Composite c = super.createComposite(parent, handle);
+ handle.setTitle(Messages.ExternalJarTitle);
+ handle.setDescription(Messages.ExternalJarDescription);
+ return c;
+ }
+
+ protected void buttonPressed() {
+ selected = BuildPathDialogAccess
+ .chooseExternalJAREntries(browse.getShell());
+ viewer.refresh();
+ }
+
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ IVirtualComponent rootComponent = (IVirtualComponent)getTaskModel().getObject(IReferenceWizardConstants.ROOT_COMPONENT);
+ if (selected != null && selected.length > 0) {
+ ArrayList<IVirtualComponent> compList = new ArrayList<IVirtualComponent>();
+ ArrayList<String> paths = new ArrayList<String>();
+ for (int i = 0; i < selected.length; i++) {
+ // IPath fullPath = project.getFile(selected[i]).getFullPath();
+ String type = VirtualArchiveComponent.LIBARCHIVETYPE
+ + IPath.SEPARATOR;
+ IVirtualComponent archive = ComponentCore
+ .createArchiveComponent(rootComponent.getProject(),
+ type + selected[i].toString());
+ compList.add(archive);
+ paths.add(selected[i].lastSegment());
+ }
+ IVirtualComponent[] components = (IVirtualComponent[]) compList.toArray(new IVirtualComponent[compList.size()]);
+ String[] paths2 = (String[]) paths.toArray(new String[paths.size()]);
+ getTaskModel().putObject(IReferenceWizardConstants.COMPONENT, components);
+ getTaskModel().putObject(IReferenceWizardConstants.COMPONENT_PATH, paths2);
+ }
+ }
+}
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment.java (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/JarReferenceWizardFragment.java 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,160 @@
+/******************************************************************************
+ * Copyright (c) 2009 Red Hat
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ ******************************************************************************/
+package org.eclipse.jst.common.ui.assembly.wizard;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
+import org.eclipse.jst.common.ui.Messages;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+
+public class JarReferenceWizardFragment extends WizardFragment {
+ protected LabelProvider labelProvider = null;
+ protected ITreeContentProvider contentProvider = null;
+ protected TreeViewer viewer;
+ protected Button browse;
+ protected IPath[] paths;
+ protected IWizardHandle handle;
+ protected IPath[] selected = new IPath[]{};
+ public boolean hasComposite() {
+ return true;
+ }
+
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ this.handle = handle;
+ handle.setTitle(Messages.JarTitle);
+ handle.setDescription(Messages.JarDescription);
+
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayout(new FormLayout());
+ viewer = new TreeViewer(c, SWT.SINGLE | SWT.BORDER);
+ viewer.setContentProvider(getContentProvider());
+ viewer.setLabelProvider(getLabelProvider());
+ viewer.setInput(ResourcesPlugin.getWorkspace());
+
+ browse = new Button(c, SWT.NONE);
+ browse.setText(Messages.Browse);
+ FormData fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.bottom = new FormAttachment(100, -5);
+ browse.setLayoutData(fd);
+
+ fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = new FormAttachment(0, 5);
+ fd.right = new FormAttachment(100, -5);
+ fd.bottom = new FormAttachment(browse, -5);
+ viewer.getTree().setLayoutData(fd);
+
+ browse.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ buttonPressed();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+ return c;
+ }
+
+ protected void buttonPressed() {
+ IProject project = (IProject)getTaskModel().getObject(IReferenceWizardConstants.PROJECT);
+ selected = BuildPathDialogAccess.chooseJAREntries(
+ browse.getShell(),
+ project.getLocation(), new IPath[0]);
+ viewer.refresh();
+ }
+
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ IVirtualComponent rootComponent = (IVirtualComponent)getTaskModel().getObject(IReferenceWizardConstants.ROOT_COMPONENT);
+ if (selected != null && selected.length > 0) {
+ ArrayList<IVirtualComponent> compList = new ArrayList<IVirtualComponent>();
+ ArrayList<String> paths = new ArrayList<String>();
+ for (int i = 0; i < selected.length; i++) {
+ // IPath fullPath = project.getFile(selected[i]).getFullPath();
+ String type = VirtualArchiveComponent.LIBARCHIVETYPE
+ + IPath.SEPARATOR;
+ IVirtualComponent archive = ComponentCore
+ .createArchiveComponent(rootComponent.getProject(),
+ type + selected[i].makeRelative().toString());
+ compList.add(archive);
+ paths.add(selected[i].lastSegment());
+ }
+ IVirtualComponent[] components = (IVirtualComponent[]) compList.toArray(new IVirtualComponent[compList.size()]);
+ String[] paths2 = (String[]) paths.toArray(new String[paths.size()]);
+ getTaskModel().putObject(IReferenceWizardConstants.COMPONENT, components);
+ getTaskModel().putObject(IReferenceWizardConstants.COMPONENT_PATH, paths2);
+ }
+ }
+
+ protected LabelProvider getLabelProvider() {
+ if (labelProvider == null) {
+ labelProvider = new LabelProvider() {
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ return element == null ? "" : element.toString();//$NON-NLS-1$
+ }
+ };
+ }
+ return labelProvider;
+ }
+
+ protected ITreeContentProvider getContentProvider() {
+ if (contentProvider == null) {
+ contentProvider = new ITreeContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return selected == null ? new Object[]{} : selected;
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ public void dispose() {
+ }
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+ public Object getParent(Object element) {
+ return null;
+ }
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ };
+ }
+ return contentProvider;
+ }
+}
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/VariableReferenceWizardFragment.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/VariableReferenceWizardFragment.java (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/assembly/wizard/VariableReferenceWizardFragment.java 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * Copyright (c) 2009 Red Hat
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ ******************************************************************************/
+package org.eclipse.jst.common.ui.assembly.wizard;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
+import org.eclipse.jst.common.ui.Messages;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+
+public class VariableReferenceWizardFragment extends JarReferenceWizardFragment {
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ Composite c = super.createComposite(parent, handle);
+ handle.setTitle(Messages.VariableReferenceTitle);
+ handle.setDescription(Messages.VariableReferenceDescription);
+ return c;
+ }
+
+ protected void buttonPressed() {
+ selected = BuildPathDialogAccess.chooseVariableEntries(
+ browse.getShell(), new Path[0]);
+ viewer.refresh();
+ }
+
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ IVirtualComponent rootComponent = (IVirtualComponent)getTaskModel().getObject(IReferenceWizardConstants.ROOT_COMPONENT);
+ if (selected != null && selected.length > 0) {
+ ArrayList<IVirtualComponent> compList = new ArrayList<IVirtualComponent>();
+ ArrayList<String> paths = new ArrayList<String>();
+ for (int i = 0; i < selected.length; i++) {
+ IPath resolvedPath = JavaCore.getResolvedVariablePath(selected[i]);
+ java.io.File file = new java.io.File(resolvedPath.toOSString());
+ if (file.isFile() && file.exists()) {
+ String type = VirtualArchiveComponent.VARARCHIVETYPE
+ + IPath.SEPARATOR;
+ IVirtualComponent archive = ComponentCore
+ .createArchiveComponent(rootComponent.getProject(),
+ type + selected[i].toString());
+ compList.add(archive);
+ paths.add(resolvedPath.lastSegment());
+ }
+ }
+ IVirtualComponent[] components = (IVirtualComponent[]) compList.toArray(new IVirtualComponent[compList.size()]);
+ String[] paths2 = (String[]) paths.toArray(new String[paths.size()]);
+ getTaskModel().putObject(IReferenceWizardConstants.COMPONENT, components);
+ getTaskModel().putObject(IReferenceWizardConstants.COMPONENT_PATH, paths2);
+ }
+ }
+}
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/messages.properties
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/messages.properties (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/messages.properties 2009-07-30 19:58:41 UTC (rev 16912)
@@ -0,0 +1,7 @@
+JarTitle=Add a Jar Reference
+JarDescription="Here you can reference a workspace Jar\nThis is not a suggested use-case, but is here for backwards compatability.
+ExternalJarTitle=Add an External Jar Reference
+ExternalJarDescription=Here you can reference a filesystem Jar\nThis is not a suggested use-case, but is here for backwards compatability.
+Browse=Browse...
+VariableReferenceTitle=Add a Variable Reference
+VariableReferenceDescription="Here you can reference a variable which maps to a single jar.\nThis is not a suggested use-case, but is here for backwards compatability.
\ No newline at end of file
15 years, 5 months
JBoss Tools SVN: r16911 - workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-07-30 15:53:41 -0400 (Thu, 30 Jul 2009)
New Revision: 16911
Modified:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/ComponentCoreUIPlugin.java
Log:
JBIDE-4320 - rename of plugin
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/ComponentCoreUIPlugin.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/ComponentCoreUIPlugin.java 2009-07-30 19:52:10 UTC (rev 16910)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/ComponentCoreUIPlugin.java 2009-07-30 19:53:41 UTC (rev 16911)
@@ -23,7 +23,7 @@
public class ComponentCoreUIPlugin extends AbstractUIPlugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.wst.common.componentcore.ui"; //$NON-NLS-1$
+ public static final String PLUGIN_ID = "org.eclipse.wst.common.modulecore.ui"; //$NON-NLS-1$
// The shared instance
private static ComponentCoreUIPlugin plugin;
15 years, 5 months
JBoss Tools SVN: r16910 - trunk/bpel/releng/maps.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2009-07-30 15:52:10 -0400 (Thu, 30 Jul 2009)
New Revision: 16910
Added:
trunk/bpel/releng/maps/mozilla.map
Modified:
trunk/bpel/releng/maps/project.map
Log:
add missing bpel plugin
Added: trunk/bpel/releng/maps/mozilla.map
===================================================================
--- trunk/bpel/releng/maps/mozilla.map (rev 0)
+++ trunk/bpel/releng/maps/mozilla.map 2009-07-30 19:52:10 UTC (rev 16910)
@@ -0,0 +1,9 @@
+!*** from http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/co...
+
+feature@org.mozilla.xpcom.feature,1.8.1.3-20080312=GET,http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/eclipse/features/org.mozilla.xpcom.feature_1.8.1.3-20080312.jar
+plugin@org.mozilla.xpcom,1.8.1.3-20080312=GET,http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/eclipse/plugins/org.mozilla.xpcom_1.8.1.3-20080312.jar
+
+feature@org.mozilla.xulrunner.feature,1.8.1.3-20080312=GET,http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/eclipse/features/org.mozilla.xulrunner.feature_1.8.1.3-20080312.jar
+plugin@org.mozilla.xulrunner.carbon.macosx,1.8.1.3-20080312=GET,http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/eclipse/plugins/org.mozilla.xulrunner.carbon.macosx_1.8.1.3-20080312.jar
+plugin@org.mozilla.xulrunner.win32.win32.x86,1.8.1.3-20080312=GET,http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/eclipse/plugins/org.mozilla.xulrunner.win32.win32.x86_1.8.1.3-20080312.jar
+plugin@org.mozilla.xulrunner.gtk.linux,1.8.1.3-20080312=GET,http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/eclipse/plugins/org.mozilla.xulrunner.gtk.linux.x86_1.8.1.3-20080312.jar
\ No newline at end of file
Property changes on: trunk/bpel/releng/maps/mozilla.map
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/bpel/releng/maps/project.map
===================================================================
--- trunk/bpel/releng/maps/project.map 2009-07-30 19:40:44 UTC (rev 16909)
+++ trunk/bpel/releng/maps/project.map 2009-07-30 19:52:10 UTC (rev 16910)
@@ -13,4 +13,5 @@
plugin@org.eclipse.bpel.validator=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/bpel/plugins/org.eclipse.bpel.validator
plugin@org.eclipse.bpel.wsil.model=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/bpel/plugins/org.eclipse.bpel.wsil.model
plugin@org.eclipse.bpel.xpath10=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/bpel/plugins/org.eclipse.bpel.xpath10
+plugin@org.jboss.tools.bpel.as.integration=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/bpel/plugins/org.jboss.tools.bpel.as.integration
plugin@org.eclipse.tools.bpel.ui.test=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/bpel/tests/org.eclipse.tools.bpel.ui.test
15 years, 5 months
JBoss Tools SVN: r16909 - in workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-07-30 15:40:44 -0400 (Thu, 30 Jul 2009)
New Revision: 16909
Added:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/IReferenceWizardConstants.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ModuleAssemblyRootPage.java
Removed:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/icons/jar_obj.gif
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ear/EarModuleDependenciesPropertyPage.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ear/EarModuleDependencyPageProvider.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/AddModuleDependenciesPropertiesPage.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ExternalJarReferenceWizardFragment.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/JarReferenceWizardFragment.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ModuleAssemblyRootPage.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/VariableReferenceWizardFragment.java
Modified:
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/.project
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/META-INF/MANIFEST.MF
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/build.properties
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/plugin.xml
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/IDependencyPageProvider.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ComponentDependencyContentProvider.java
workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/NewReferenceWizard.java
Log:
JBIDE-4320 - splitting into several plugins after call today
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/.project
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/.project 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/.project 2009-07-30 19:40:44 UTC (rev 16909)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.wst.common.componentcore.ui</name>
+ <name>org.eclipse.wst.common.modulecore.ui</name>
<comment></comment>
<projects>
</projects>
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/META-INF/MANIFEST.MF
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/META-INF/MANIFEST.MF 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/META-INF/MANIFEST.MF 2009-07-30 19:40:44 UTC (rev 16909)
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WTP UI Overrides
-Bundle-SymbolicName: org.eclipse.wst.common.componentcore.ui;singleton:=true
+Bundle-SymbolicName: org.eclipse.wst.common.modulecore.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.wst.common.componentcore.ui.ComponentCoreUIPlugin
Require-Bundle: org.eclipse.ui,
@@ -14,14 +14,12 @@
org.eclipse.jst.common.frameworks;bundle-version="1.1.300",
org.eclipse.wst.common.project.facet.core;bundle-version="1.4.0",
org.eclipse.jst.j2ee;bundle-version="1.1.300",
- org.eclipse.jdt;bundle-version="3.5.0",
- org.eclipse.jdt.core;bundle-version="3.5.0",
- org.eclipse.jdt.ui;bundle-version="3.5.0",
org.eclipse.wst.server.ui;bundle-version="1.1.102",
org.eclipse.wst.server.core;bundle-version="1.1.101",
org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.1.300",
- org.eclipse.jem.util;bundle-version="2.0.200",
+ org.eclipse.jem.util;bundle-version="2.0.200",
org.eclipse.emf.ecore;bundle-version="2.5.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Eclipse.org
+Export-Package: org.eclipse.wst.common.componentcore.ui.propertypage
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/build.properties
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/build.properties 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/build.properties 2009-07-30 19:40:44 UTC (rev 16909)
@@ -2,4 +2,5 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ icons/
Deleted: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/icons/jar_obj.gif
===================================================================
(Binary files differ)
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/plugin.xml
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/plugin.xml 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/plugin.xml 2009-07-30 19:40:44 UTC (rev 16909)
@@ -11,7 +11,7 @@
adaptable="true"
objectClass="org.eclipse.core.resources.IProject"
name="Module Assembly"
- class="org.eclipse.wst.common.componentcore.ui.propertypage.internal.ModuleAssemblyRootPage"
+ class="org.eclipse.wst.common.componentcore.ui.propertypage.ModuleAssemblyRootPage"
id="org.eclipse.wst.common.componentcore.ui.J2EEDependenciesPage">
<enabledWhen>
<and>
@@ -23,41 +23,14 @@
</page>
</extension>
-<!--
- <extension
- point="org.eclipse.wst.common.componentcore.ui.moduleDependencyPropertyPage">
- <dependencyPage
- class="org.eclipse.wst.common.componentcore.ui.propertypage.internal.EarModuleDependencyPageProvider"
- id="org.eclipse.wst.common.componentcore.ui.earDependencyPage">
- </dependencyPage>
- </extension>
- -->
<extension
- point="org.eclipse.wst.common.componentcore.ui.referenceWizardFragment">
+ point="org.eclipse.wst.common.modulecore.ui.referenceWizardFragment">
<referenceFragment
class="org.eclipse.wst.common.componentcore.ui.propertypage.internal.ProjectReferenceWizardFragment"
icon="icons/prj_obj.gif"
id="org.eclipse.wst.common.componentcore.ui.newProjectReference"
name="Project">
</referenceFragment>
- <referenceFragment
- class="org.eclipse.wst.common.componentcore.ui.propertypage.internal.JarReferenceWizardFragment"
- icon="icons/jar_obj.gif"
- id="org.eclipse.wst.common.componentcore.ui.jarReference"
- name="Jar">
- </referenceFragment>
- <referenceFragment
- class="org.eclipse.wst.common.componentcore.ui.propertypage.internal.ExternalJarReferenceWizardFragment"
- icon="icons/jar_obj.gif"
- id="org.eclipse.wst.common.componentcore.ui.externalJarReference"
- name="External Jar">
- </referenceFragment>
- <referenceFragment
- class="org.eclipse.wst.common.componentcore.ui.propertypage.internal.VariableReferenceWizardFragment"
- icon="icons/jar_obj.gif"
- id="org.eclipse.wst.common.componentcore.ui.variableReference"
- name="Variable">
- </referenceFragment>
</extension>
</plugin>
Copied: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java (from rev 16831, workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/AddModuleDependenciesPropertiesPage.java)
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -0,0 +1,892 @@
+/******************************************************************************
+ * Copyright (c) 2009 Red Hat
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ ******************************************************************************/
+package org.eclipse.wst.common.componentcore.ui.propertypage;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
+import org.eclipse.wst.common.componentcore.internal.ComponentResource;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
+import org.eclipse.wst.common.componentcore.internal.operation.RemoveReferenceComponentsDataModelProvider;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.componentcore.ui.ComponentCoreUIPlugin;
+import org.eclipse.wst.common.componentcore.ui.Messages;
+import org.eclipse.wst.common.componentcore.ui.propertypage.internal.AddFolderDialog;
+import org.eclipse.wst.common.componentcore.ui.propertypage.internal.ComponentDependencyContentProvider;
+import org.eclipse.wst.common.componentcore.ui.propertypage.internal.NewReferenceWizard;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+
+public class AddModuleDependenciesPropertiesPage implements Listener,
+ IModuleDependenciesControl {
+
+ private static final String DEPLOY_PATH_PROPERTY = new Integer(0).toString();
+ private static final String SOURCE_PROPERTY = new Integer(1).toString();
+
+
+ protected final String PATH_SEPARATOR = String.valueOf(IPath.SEPARATOR);
+ private boolean hasInitialized = false;
+ protected final IProject project;
+ protected final ModuleAssemblyRootPage propPage;
+ protected IVirtualComponent rootComponent = null;
+ protected Text componentNameText;
+ protected Label availableModules;
+ protected TableViewer availableComponentsViewer;
+ protected Button addMappingButton, addReferenceButton, removeButton;
+ protected Composite buttonColumn;
+ protected static final IStatus OK_STATUS = IDataModelProvider.OK_STATUS;
+ protected Listener tableListener;
+ protected Listener labelListener;
+
+ // Mappings that existed when the page was opened (or last saved)
+ protected HashMap<IVirtualComponent, String> oldComponentToRuntimePath = new HashMap<IVirtualComponent, String>();
+
+ // Mappings that are current
+ protected HashMap<IVirtualComponent, String> objectToRuntimePath = new HashMap<IVirtualComponent, String>();
+
+ // A single list of wb-resource mappings. If there's any change,
+ // all old will be removed and new ones added
+ protected ArrayList<ComponentResourceProxy> resourceMappings = new ArrayList<ComponentResourceProxy>();
+
+ // keeps track if a change has occurred in wb-resource mappings
+ protected boolean resourceMappingsChanged = false;
+
+ /**
+ * Constructor for AddModulestoEARPropertiesControl.
+ */
+ public AddModuleDependenciesPropertiesPage(final IProject project,
+ final ModuleAssemblyRootPage page) {
+ this.project = project;
+ this.propPage = page;
+ rootComponent = ComponentCore.createComponent(project);
+ }
+
+ /*
+ * UI Creation Methods
+ */
+
+ public Composite createContents(final Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ ModuleAssemblyRootPage.createDescriptionComposite(composite,
+ Messages.ModuleAssemblyRootPageDescription);
+ createListGroup(composite);
+ refresh();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ protected void createListGroup(Composite parent) {
+ Composite listGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ listGroup.setLayout(layout);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.horizontalIndent = 5;
+ listGroup.setLayoutData(gData);
+
+ availableModules = new Label(listGroup, SWT.NONE);
+ gData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL);
+ availableModules.setText(Messages.ModuleAssembly);
+ availableModules.setLayoutData(gData);
+ createTableComposite(listGroup);
+ }
+
+ protected void createTableComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gData);
+ fillComposite(composite);
+ }
+
+ public void fillComposite(Composite parent) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createTable(parent);
+ createButtonColumn(parent);
+ }
+
+ protected void createButtonColumn(Composite parent) {
+ buttonColumn = createButtonColumnComposite(parent);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ buttonColumn.setLayoutData(data);
+ createPushButtons();
+ }
+
+ protected void createPushButtons() {
+ addMappingButton = createPushButton(Messages.AddFolderElipses);
+ addReferenceButton = createPushButton(Messages.AddReference);
+ removeButton = createPushButton(Messages.RemoveSelected);
+ }
+
+ protected Button createPushButton(String label) {
+ Button aButton = new Button(buttonColumn, SWT.PUSH);
+ aButton.setText(label);
+ aButton.addListener(SWT.Selection, this);
+ aButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return aButton;
+ }
+
+ public Composite createButtonColumnComposite(Composite parent) {
+ Composite aButtonColumn = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ aButtonColumn.setLayout(layout);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
+ aButtonColumn.setLayoutData(data);
+ return aButtonColumn;
+ }
+
+ public Group createGroup(Composite parent) {
+ return new Group(parent, SWT.NULL);
+ }
+
+ protected void createTable(Composite parent) {
+ if (rootComponent != null) {
+ availableComponentsViewer = createAvailableComponentsViewer(parent);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.FILL_VERTICAL);
+ availableComponentsViewer.getTable().setLayoutData(gd);
+
+ ComponentDependencyContentProvider provider = createProvider();
+ provider.setRuntimePaths(objectToRuntimePath);
+ provider.setResourceMappings(resourceMappings);
+ availableComponentsViewer.setContentProvider(provider);
+ availableComponentsViewer.setLabelProvider(provider);
+ addTableListeners();
+ }
+ }
+
+ /**
+ * Subclasses should over-ride this and extend the class
+ */
+ protected ComponentDependencyContentProvider createProvider() {
+ return new ComponentDependencyContentProvider();
+ }
+
+ /*
+ * Listeners of various events
+ */
+
+ protected void addTableListeners() {
+ addHoverHelpListeners();
+ addDoubleClickListener();
+ addSelectionListener();
+ }
+
+ protected void addHoverHelpListeners() {
+ final Table table = availableComponentsViewer.getTable();
+ createLabelListener(table);
+ createTableListener(table);
+ table.addListener(SWT.Dispose, tableListener);
+ table.addListener(SWT.KeyDown, tableListener);
+ table.addListener(SWT.MouseMove, tableListener);
+ table.addListener(SWT.MouseHover, tableListener);
+ }
+
+ protected void createLabelListener(final Table table) {
+ labelListener = new Listener() {
+ public void handleEvent(Event event) {
+ Label label = (Label) event.widget;
+ Shell shell = label.getShell();
+ switch (event.type) {
+ case SWT.MouseDown:
+ Event e = new Event();
+ e.item = (TableItem) label.getData("_TABLEITEM"); //$NON-NLS-1$
+ table.setSelection(new TableItem[] { (TableItem) e.item });
+ table.notifyListeners(SWT.Selection, e);
+ shell.dispose();
+ table.setFocus();
+ break;
+ case SWT.MouseExit:
+ shell.dispose();
+ break;
+ }
+ }
+ };
+ }
+
+ protected void createTableListener(final Table table) {
+ tableListener = new Listener() {
+ Shell tip = null;
+ Label label = null;
+
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ case SWT.KeyDown:
+ case SWT.MouseMove: {
+ if (tip == null)
+ break;
+ tip.dispose();
+ tip = null;
+ label = null;
+ break;
+ }
+ case SWT.MouseHover: {
+ TableItem item = table.getItem(new Point(event.x, event.y));
+ if (item != null && item.getData() != null && !canEdit(item.getData())) {
+ if (tip != null && !tip.isDisposed())
+ tip.dispose();
+ tip = new Shell(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell(),
+ SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+ tip.setBackground(Display.getDefault().getSystemColor(
+ SWT.COLOR_INFO_BACKGROUND));
+ FillLayout layout = new FillLayout();
+ layout.marginWidth = 2;
+ tip.setLayout(layout);
+ label = new Label(tip, SWT.WRAP);
+ label.setForeground(Display.getDefault()
+ .getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+ label.setBackground(Display.getDefault()
+ .getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ label.setData("_TABLEITEM", item); //$NON-NLS-1$
+ label.setText( Messages.InternalLibJarWarning);
+ label.addListener(SWT.MouseExit, labelListener);
+ label.addListener(SWT.MouseDown, labelListener);
+ Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Rectangle rect = item.getBounds(0);
+ Point pt = table.toDisplay(rect.x, rect.y);
+ tip.setBounds(pt.x, pt.y - size.y, size.x, size.y);
+ tip.setVisible(true);
+ }
+ }
+ }
+ }
+ };
+ }
+
+ protected boolean canEdit(Object data) {
+ if( data == null ) return false;
+ if( !(data instanceof VirtualArchiveComponent)) return true;
+
+ VirtualArchiveComponent d2 = (VirtualArchiveComponent)data;
+ boolean sameProject = d2.getWorkspaceRelativePath() != null
+ && d2.getWorkspaceRelativePath().segment(0)
+ .equals(rootComponent.getProject().getName());
+ return !(sameProject && isPhysicallyAdded(d2));
+ }
+
+ protected void addDoubleClickListener() {
+ availableComponentsViewer.setColumnProperties(new String[] {
+ DEPLOY_PATH_PROPERTY, SOURCE_PROPERTY });
+
+ CellEditor[] editors = new CellEditor[] {
+ new TextCellEditor(availableComponentsViewer.getTable()),
+ new TextCellEditor()};
+ availableComponentsViewer.setCellEditors(editors);
+ availableComponentsViewer
+ .setCellModifier(new RuntimePathCellModifier());
+ }
+
+ protected void addSelectionListener() {
+ availableComponentsViewer.addSelectionChangedListener(
+ new ISelectionChangedListener(){
+ public void selectionChanged(SelectionChangedEvent event) {
+ viewerSelectionChanged();
+ }
+ });
+ }
+
+ protected void viewerSelectionChanged() {
+ removeButton.setEnabled(getSelectedObject() != null && canEdit(getSelectedObject()));
+ }
+
+ protected Object getSelectedObject() {
+ IStructuredSelection sel = (IStructuredSelection)availableComponentsViewer.getSelection();
+ return sel.getFirstElement();
+ }
+
+ private class RuntimePathCellModifier implements ICellModifier {
+
+ public boolean canModify(Object element, String property) {
+ if( property.equals(DEPLOY_PATH_PROPERTY)) {
+ if (element instanceof VirtualArchiveComponent) {
+ try {
+ return canEdit(element);
+ } catch (IllegalArgumentException iae) {
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public Object getValue(Object element, String property) {
+ Object data = element; //((TableItem)element).getData();
+ if( data instanceof IVirtualComponent ) {
+ return objectToRuntimePath.get(element) == null ? new Path("/") //$NON-NLS-1$
+ .toString() : objectToRuntimePath.get(element);
+ } else if( data instanceof ComponentResourceProxy) {
+ return ((ComponentResourceProxy)data).runtimePath.toString();
+ }
+ return new Path("/"); //$NON-NLS-1$
+ }
+
+ public void modify(Object element, String property, Object value) {
+ if (property.equals(DEPLOY_PATH_PROPERTY)) {
+ TableItem item = (TableItem) element;
+ if( item.getData() instanceof IVirtualComponent) {
+ objectToRuntimePath.put((IVirtualComponent)item.getData(), (String) value);
+ } else if( item.getData() instanceof ComponentResourceProxy) {
+ ComponentResourceProxy c = ((ComponentResourceProxy)item.getData());
+ c.runtimePath = new Path((String)value);
+ resourceMappingsChanged = true;
+ }
+ refresh();
+ }
+ }
+
+ }
+
+ public void handleEvent(Event event) {
+ if( event.widget == addMappingButton)
+ handleAddMappingButton();
+ else if( event.widget == addReferenceButton)
+ handleAddReferenceButton();
+ else if( event.widget == removeButton )
+ handleRemoveSelectedButton();
+ }
+
+ protected void handleAddMappingButton() {
+ AddFolderDialog afd = new AddFolderDialog(addMappingButton.getShell(), project);
+ if( afd.open() == Window.OK) {
+ IContainer c = afd.getSelected();
+ if( c != null ) {
+ IPath p = c.getProjectRelativePath();
+ ComponentResourceProxy proxy = new ComponentResourceProxy(p, new Path("/")); //$NON-NLS-1$
+ resourceMappings.add(proxy);
+ refresh();
+ }
+ }
+ }
+
+ protected void handleAddReferenceButton() {
+ NewReferenceWizard wizard = new NewReferenceWizard();
+ // fill the task model
+ wizard.getTaskModel().putObject(NewReferenceWizard.PROJECT, project);
+ wizard.getTaskModel().putObject(NewReferenceWizard.ROOT_COMPONENT, rootComponent);
+
+ WizardDialog wd = new WizardDialog(addReferenceButton.getShell(), wizard);
+ if( wd.open() != Window.CANCEL) {
+ Object c1 = wizard.getTaskModel().getObject(NewReferenceWizard.COMPONENT);
+ Object p1 = wizard.getTaskModel().getObject(NewReferenceWizard.COMPONENT_PATH);
+ IVirtualComponent[] compArr = c1 instanceof IVirtualComponent ?
+ new IVirtualComponent[] { (IVirtualComponent)c1 } :
+ (IVirtualComponent[])c1;
+ String[] pathArr = p1 instanceof String ?
+ new String[] { (String)p1 } :
+ (String[])p1;
+ for( int i = 0; i < compArr.length; i++ ) {
+ objectToRuntimePath.put(compArr[i], pathArr[i]);
+ }
+ refresh();
+ }
+ }
+
+ protected void handleRemoveSelectedButton() {
+ ISelection sel = availableComponentsViewer.getSelection();
+ if( sel instanceof IStructuredSelection ) {
+ Object o = ((IStructuredSelection)sel).getFirstElement();
+ if( o instanceof IVirtualComponent)
+ objectToRuntimePath.remove(o);
+ else if( o instanceof ComponentResourceProxy)
+ resourceMappings.remove(o);
+ refresh();
+ }
+ }
+
+ public TableViewer createAvailableComponentsViewer(Composite parent) {
+ int flags = SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI;
+
+ Table table = new Table(parent, flags);
+ availableComponentsViewer = new TableViewer(table);
+
+ // set up table layout
+ TableLayout tableLayout = new org.eclipse.jface.viewers.TableLayout();
+ tableLayout.addColumnData(new ColumnWeightData(400, true));
+ tableLayout.addColumnData(new ColumnWeightData(500, true));
+ table.setLayout(tableLayout);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ availableComponentsViewer.setSorter(null);
+
+ TableColumn bndColumn = new TableColumn(table, SWT.NONE, 0);
+ bndColumn.setText(Messages.DeployPathColumn);
+ bndColumn.setResizable(true);
+
+ TableColumn projectColumn = new TableColumn(table, SWT.NONE, 1);
+ projectColumn.setText(Messages.SourceColumn);
+ projectColumn.setResizable(true);
+
+ tableLayout.layout(table, true);
+ return availableComponentsViewer;
+
+ }
+
+ protected boolean isPhysicallyAdded(VirtualArchiveComponent component) {
+ try {
+ component.getProjectRelativePath();
+ return true;
+ } catch (IllegalArgumentException e) {
+ return false;
+ }
+ }
+
+ /**
+ * This should only be called on changes, such as adding a project
+ * reference, adding a lib reference etc.
+ *
+ * It will reset the input, manually re-add missing elements, and do other
+ * tasks
+ */
+ public void refresh() {
+ resetTableUI();
+ if (!hasInitialized) {
+ initialize();
+ resetTableUI();
+ }
+
+ }
+
+ protected void resetTableUI() {
+ IWorkspaceRoot input = ResourcesPlugin.getWorkspace().getRoot();
+ availableComponentsViewer.setInput(input);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ int numlines = Math.min(10, availableComponentsViewer.getTable()
+ .getItemCount());
+ data.heightHint = availableComponentsViewer.getTable().getItemHeight()
+ * numlines;
+ availableComponentsViewer.getTable().setLayoutData(data);
+ GridData btndata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
+ buttonColumn.setLayoutData(btndata);
+ }
+
+ protected void initialize() {
+ IVirtualReference[] refs = rootComponent.getReferences();
+ IVirtualComponent comp;
+ for( int i = 0; i < refs.length; i++ ) {
+ comp = refs[i].getReferencedComponent();
+ String val = refs[i].getRuntimePath().append(refs[i].getArchiveName()).toString();
+ objectToRuntimePath.put(comp, val);
+ oldComponentToRuntimePath.put((IVirtualComponent) comp, val);
+ }
+
+ ComponentResource[] allMappings = findAllMappings();
+ for( int i = 0; i < allMappings.length; i++ ) {
+ resourceMappings.add(new ComponentResourceProxy(
+ allMappings[i].getSourcePath(), allMappings[i].getRuntimePath()
+ ));
+ }
+ hasInitialized = true;
+ }
+
+ protected ComponentResource[] findAllMappings() {
+ StructureEdit structureEdit = null;
+ try {
+ structureEdit = StructureEdit.getStructureEditForRead(project);
+ WorkbenchComponent component = structureEdit.getComponent();
+ Object[] arr = component.getResources().toArray();
+ ComponentResource[] result = new ComponentResource[arr.length];
+ for( int i = 0; i < arr.length; i++ )
+ result[i] = (ComponentResource)arr[i];
+ return result;
+ } catch(Exception e) {
+ } finally {
+ structureEdit.dispose();
+ }
+ return new ComponentResource[]{};
+ }
+
+ public class ComponentResourceProxy {
+ public IPath source, runtimePath;
+ public ComponentResourceProxy(IPath source, IPath runtimePath) {
+ this.source = source;
+ this.runtimePath = runtimePath;
+ }
+ }
+
+ /*
+ * Clean-up methods are below. These include performCancel, performDefaults,
+ * performOK, and any other methods that are called *only* by this one.
+ */
+ public void setVisible(boolean visible) {
+ }
+
+ public void performDefaults() {
+ }
+
+ public boolean performCancel() {
+ return true;
+ }
+
+ public void dispose() {
+ Table table = null;
+ if (availableComponentsViewer != null) {
+ table = availableComponentsViewer.getTable();
+ }
+ if (table == null || tableListener == null)
+ return;
+ table.removeListener(SWT.Dispose, tableListener);
+ table.removeListener(SWT.KeyDown, tableListener);
+ table.removeListener(SWT.MouseMove, tableListener);
+ table.removeListener(SWT.MouseHover, tableListener);
+ }
+
+
+
+ /*
+ * This is where the OK work goes. Lots of it. Watch your head.
+ * xiao xin
+ */
+ protected boolean preHandleChanges(IProgressMonitor monitor) {
+ return true;
+ }
+
+ protected boolean postHandleChanges(IProgressMonitor monitor) {
+ return true;
+ }
+
+ public boolean performOk() {
+ boolean result = true;
+ result &= saveResourceChanges();
+ result &= saveReferenceChanges();
+ return result;
+ }
+
+ protected boolean saveResourceChanges() {
+ removeAllResourceMappings();
+ addNewResourceMappings();
+ return true;
+ }
+ protected boolean addNewResourceMappings() {
+ ComponentResourceProxy[] proxies = (ComponentResourceProxy[]) resourceMappings.toArray(new ComponentResourceProxy[resourceMappings.size()]);
+ IVirtualFolder rootFolder = rootComponent.getRootFolder();
+ for( int i = 0; i < proxies.length; i++ ) {
+ try {
+ rootFolder.getFolder(proxies[i].runtimePath).createLink(proxies[i].source, 0, null);
+ } catch( CoreException ce ) {
+ }
+ }
+ resourceMappingsChanged = false;
+ return true;
+ }
+
+ protected boolean removeAllResourceMappings() {
+ StructureEdit moduleCore = null;
+ try {
+ moduleCore = StructureEdit.getStructureEditForWrite(project);
+ moduleCore.getComponent().getResources().clear();
+ }
+ finally {
+ if (moduleCore != null) {
+ moduleCore.saveIfNecessary(new NullProgressMonitor());
+ moduleCore.dispose();
+ }
+ }
+ return true;
+ }
+
+ protected boolean saveReferenceChanges() {
+ // Fill our delta lists
+ ArrayList<IVirtualComponent> added = new ArrayList<IVirtualComponent>();
+ ArrayList<IVirtualComponent> removed = new ArrayList<IVirtualComponent>();
+ ArrayList<IVirtualComponent> changed = new ArrayList<IVirtualComponent>();
+
+ Iterator<IVirtualComponent> j = oldComponentToRuntimePath.keySet().iterator();
+ Object key, val;
+ while (j.hasNext()) {
+ key = j.next();
+ val = oldComponentToRuntimePath.get(key);
+ if( !objectToRuntimePath.containsKey(key))
+ removed.add((IVirtualComponent)key);
+ else if (!val.equals(objectToRuntimePath.get(key)))
+ changed.add((IVirtualComponent)key);
+ }
+
+ j = objectToRuntimePath.keySet().iterator();
+ while (j.hasNext()) {
+ key = j.next();
+ if (!oldComponentToRuntimePath.containsKey(key))
+ added.add((IVirtualComponent)key);
+ }
+
+ NullProgressMonitor monitor = new NullProgressMonitor();
+ boolean subResult = preHandleChanges(monitor);
+ if( !subResult )
+ return false;
+
+ handleDeltas(removed, changed, added);
+ subResult &= postHandleChanges(monitor);
+
+ // Now update the variables
+ oldComponentToRuntimePath.clear();
+ ArrayList<IVirtualComponent> keys = new ArrayList<IVirtualComponent>();
+ keys.addAll(objectToRuntimePath.keySet());
+ Iterator<IVirtualComponent> i = keys.iterator();
+ while(i.hasNext()) {
+ IVirtualComponent vc = i.next();
+ String path = objectToRuntimePath.get(vc);
+ oldComponentToRuntimePath.put(vc, path);
+ }
+ return subResult;
+ }
+
+ // Subclass can override if it has a good way to handle changed elements
+ protected void handleDeltas(ArrayList<IVirtualComponent> removed,
+ ArrayList<IVirtualComponent> changed, ArrayList<IVirtualComponent> added) {
+ ArrayList<IVirtualComponent> removed2 = new ArrayList<IVirtualComponent>();
+ ArrayList<IVirtualComponent> added2 = new ArrayList<IVirtualComponent>();
+ removed2.addAll(removed);
+ removed2.addAll(changed);
+ added2.addAll(added);
+ added2.addAll(changed);
+
+ // meld the changed into the added / removed for less efficiency ;)
+ // basically we lack "change" operations and only have add / remove
+ handleRemoved(removed2);
+ handleAdded(added2);
+ }
+ protected void handleRemoved(ArrayList<IVirtualComponent> removed) {
+ // If it's removed it should *only* be a virtual component already
+ Iterator<IVirtualComponent> i = removed.iterator();
+ IVirtualComponent component;
+ while(i.hasNext()) {
+ try {
+ component = i.next();
+ IDataModelOperation operation = getRemoveComponentOperation(component);
+ operation.execute(null, null);
+ } catch( ExecutionException e) {
+ ComponentCoreUIPlugin.logError(e);
+ }
+ }
+ }
+
+ protected IDataModelOperation getRemoveComponentOperation(IVirtualComponent component) {
+ String path, archiveName;
+ path = new Path(oldComponentToRuntimePath.get(component)).removeLastSegments(1).toString();
+ archiveName = new Path(oldComponentToRuntimePath.get(component)).lastSegment();
+
+ IDataModelProvider provider = getRemoveReferenceDataModelProvider(component);
+ IDataModel model = DataModelFactory.createDataModel(provider);
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, rootComponent);
+ List<IVirtualComponent> modHandlesList = (List<IVirtualComponent>) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+ modHandlesList.add(component);
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modHandlesList);
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
+ Map<IVirtualComponent, String> uriMap = new HashMap<IVirtualComponent, String>();
+ uriMap.put(component, archiveName);
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
+ return model.getDefaultOperation();
+ }
+
+ protected IDataModelProvider getRemoveReferenceDataModelProvider(IVirtualComponent component) {
+ return new RemoveReferenceComponentsDataModelProvider();
+ }
+
+
+ protected void handleChanged(ArrayList<IVirtualComponent> changed) {
+ Iterator<IVirtualComponent> i = changed.iterator();
+ IVirtualComponent component;
+ IVirtualReference ref;
+ IPath p;
+ while(i.hasNext()) {
+ component = i.next();
+ ref = rootComponent.getReference(component.getName());
+ p = new Path(objectToRuntimePath.get(component));
+ ref.setRuntimePath(p);
+ }
+ }
+
+ protected void handleAdded(ArrayList<IVirtualComponent> added) {
+ final ArrayList<IVirtualComponent> components = new ArrayList<IVirtualComponent>();
+ Iterator<IVirtualComponent> i = added.iterator();
+ IVirtualComponent o;
+ while(i.hasNext()) {
+ o = i.next();
+ components.add((IVirtualComponent)o);
+ }
+
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable(){
+ public void run(IProgressMonitor monitor) throws CoreException{
+ addComponents(components);
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor());
+ } catch( CoreException e ) {
+ ComponentCoreUIPlugin.logError(e);
+ }
+ }
+
+ protected void addComponents(ArrayList<IVirtualComponent> components) throws CoreException {
+ Iterator<IVirtualComponent> i = components.iterator();
+ while(i.hasNext()) {
+ addOneComponent(i.next());
+ }
+ }
+
+ protected IDataModelProvider getAddReferenceDataModelProvider(IVirtualComponent component) {
+ return new CreateReferenceComponentsDataModelProvider();
+ }
+
+ protected void addOneComponent(IVirtualComponent component) throws CoreException {
+ String path, archiveName;
+ path = new Path(objectToRuntimePath.get(component)).removeLastSegments(1).toString();
+ archiveName = new Path(objectToRuntimePath.get(component)).lastSegment();
+
+ IDataModelProvider provider = getAddReferenceDataModelProvider(component);
+ IDataModel dm = DataModelFactory.createDataModel(provider);
+
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, rootComponent);
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, Arrays.asList(component));
+
+ //[Bug 238264] the uri map needs to be manually set correctly
+ Map<IVirtualComponent, String> uriMap = new HashMap<IVirtualComponent, String>();
+ uriMap.put(component, archiveName);
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
+
+ IStatus stat = dm.validateProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+ if (stat != OK_STATUS)
+ throw new CoreException(stat);
+ try {
+ dm.getDefaultOperation().execute(new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ ComponentCoreUIPlugin.logError(e);
+ }
+ }
+
+ /**
+ * [Bug 238264]
+ * determines a unique URI mapping name for a given component
+ * this is in case two components have the same name.
+ *
+ * @return returns a valid (none duplicate) uri mapping name for the given component\
+ */
+ private String getURIMappingName(IVirtualComponent archive) {
+
+ //get the default uri map name for the given archive
+ IPath componentPath = Path.fromOSString(archive.getName());
+ String uriMapName = componentPath.lastSegment().replace(' ', '_');
+
+
+ //check to be sure this uri mapping is not already in use by another reference
+ boolean dupeArchiveName;
+ String refedCompName;
+ int lastDotIndex;
+ String increment;
+ IVirtualReference [] existingRefs = rootComponent.getReferences();
+ for(int i=0;i<existingRefs.length;i++){
+ refedCompName = existingRefs[i].getReferencedComponent().getName();
+
+ //if uri mapping names of the refed component and the given archive are the same
+ // find a new uri map name for the given archive
+ if(existingRefs[i].getArchiveName().equals(uriMapName)){
+ dupeArchiveName = true;
+ //find a new uriMapName for the given component
+ for(int j=1; dupeArchiveName; j++){
+ lastDotIndex = uriMapName.lastIndexOf('.');
+ increment = "_"+j; //$NON-NLS-1$
+
+ //create the new potential name
+ if(lastDotIndex != -1){
+ uriMapName = uriMapName.substring(0, lastDotIndex) + increment + uriMapName.substring(lastDotIndex);
+ } else {
+ uriMapName = uriMapName.substring(0)+increment;
+ }
+
+ //determine if the new potential name is valid
+ for(int k=0; k<existingRefs.length; k++) {
+ dupeArchiveName = existingRefs[k].getArchiveName().equals(uriMapName);
+ if(dupeArchiveName) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return uriMapName;
+ }
+}
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/IDependencyPageProvider.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/IDependencyPageProvider.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/IDependencyPageProvider.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -12,7 +12,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.wst.common.componentcore.ui.propertypage.internal.DependencyPageExtensionManager;
-import org.eclipse.wst.common.componentcore.ui.propertypage.internal.ModuleAssemblyRootPage;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
/**
Added: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/IReferenceWizardConstants.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/IReferenceWizardConstants.java (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/IReferenceWizardConstants.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -0,0 +1,8 @@
+package org.eclipse.wst.common.componentcore.ui.propertypage;
+
+public interface IReferenceWizardConstants {
+ public static final String COMPONENT = "dependency.component"; //$NON-NLS-1$
+ public static final String COMPONENT_PATH = "dependency.component.path"; //$NON-NLS-1$
+ public static final String PROJECT = "root.project"; //$NON-NLS-1$
+ public static final String ROOT_COMPONENT = "root.component"; //$NON-NLS-1$
+}
Copied: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ModuleAssemblyRootPage.java (from rev 16830, workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ModuleAssemblyRootPage.java)
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ModuleAssemblyRootPage.java (rev 0)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ModuleAssemblyRootPage.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -0,0 +1,175 @@
+/******************************************************************************
+ * Copyright (c) 2009 Red Hat
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ ******************************************************************************/
+package org.eclipse.wst.common.componentcore.ui.propertypage;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ui.Messages;
+import org.eclipse.wst.common.componentcore.ui.propertypage.internal.DependencyPageExtensionManager;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+/**
+ * Primary project property page for Module assembly;
+ */
+public class ModuleAssemblyRootPage extends PropertyPage {
+
+ private IProject project;
+ private IModuleDependenciesControl[] controls = new IModuleDependenciesControl[0];
+
+ public ModuleAssemblyRootPage() {
+ super();
+ }
+
+ private Composite getFacetErrorComposite(final Composite parent) {
+ final String errorCheckingFacet = Messages.ErrorCheckingFacets;
+ setErrorMessage(errorCheckingFacet);
+ return getErrorComposite(parent, errorCheckingFacet);
+ }
+ private Composite getVirtCompErrorComposite(final Composite parent) {
+ final String errorCheckingFacet = Messages.ErrorNotVirtualComponent;
+ setErrorMessage(errorCheckingFacet);
+ return getErrorComposite(parent, errorCheckingFacet);
+ }
+
+
+ private Composite getErrorComposite(final Composite parent, final String error) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ final GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ final Label label= new Label(composite, SWT.NONE);
+ label.setText(error);
+ return composite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ if (!controls[i].performOk()) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ public void performDefaults() {
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ controls[i].performDefaults();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performCancel()
+ */
+ public boolean performCancel() {
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ if (!controls[i].performCancel()) {
+ return false;
+ }
+ }
+ }
+ return super.performCancel();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
+ */
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ controls[i].setVisible(visible);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ for (int i = 0; i < controls.length; i++) {
+ if(controls[i] != null){
+ controls[i].dispose();
+ }
+ }
+ }
+
+ protected static void createDescriptionComposite(final Composite parent, final String description) {
+ Composite descriptionComp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ descriptionComp.setLayout(layout);
+ descriptionComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fillDescription(descriptionComp, description);
+ }
+
+ private static void fillDescription(Composite c, String s) {
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 250;
+ Text text = new Text(c, SWT.READ_ONLY | SWT.WRAP);
+ text.setLayoutData(data);
+ text.setText(s);
+ }
+
+ protected Control createContents(Composite parent) {
+
+ // Need to find out what type of project we are handling
+ project = (IProject) getElement().getAdapter(IResource.class);
+ if( project != null ) {
+ try {
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ IDependencyPageProvider provider = null;
+ if( facetedProject == null )
+ return getFacetErrorComposite(parent);
+
+ provider = DependencyPageExtensionManager.getManager().getProvider(facetedProject);
+ if( provider != null ) {
+ controls = provider.createPages(facetedProject, this);
+ return provider.createRootControl(controls, parent);
+ }
+
+ if( ComponentCore.createComponent(project) == null )
+ return getVirtCompErrorComposite(parent);
+
+ AddModuleDependenciesPropertiesPage page = new AddModuleDependenciesPropertiesPage(project, this);
+ controls = new IModuleDependenciesControl[1];
+ controls[0] = page;
+ return page.createContents(parent);
+ } catch( CoreException ce ) {
+ }
+ }
+ return getFacetErrorComposite(parent);
+ }
+}
Deleted: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ear/EarModuleDependenciesPropertyPage.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ear/EarModuleDependenciesPropertyPage.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ear/EarModuleDependenciesPropertyPage.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -1,51 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2009 Red Hat
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rob Stryker - initial implementation and ongoing maintenance
- ******************************************************************************/
-package org.eclipse.wst.common.componentcore.ui.propertypage.ear;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.wst.common.componentcore.ui.propertypage.internal.AddModuleDependenciesPropertiesPage;
-import org.eclipse.wst.common.componentcore.ui.propertypage.internal.ModuleAssemblyRootPage;
-
-public class EarModuleDependenciesPropertyPage extends
- AddModuleDependenciesPropertiesPage {
- public EarModuleDependenciesPropertyPage(IProject project,
- ModuleAssemblyRootPage page) {
- super(project, page);
- }
-
-// protected IDataModelOperation generateEARDDOperation() {
-// IDataModel model = DataModelFactory.createDataModel(new EarCreateDeploymentFilesDataModelProvider());
-// model.setProperty(ICreateDeploymentFilesDataModelProperties.GENERATE_DD, rootComponent);
-// model.setProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT, project);
-// return model.getDefaultOperation();
-// }
-//
-// public boolean postHandleChanges(IProgressMonitor monitor) {
-// return true;
-// }
-//
-// protected void handleRemoved(ArrayList<IVirtualComponent> removed) {
-// super.handleRemoved(removed);
-// J2EEComponentClasspathUpdater.getInstance().queueUpdateEAR(rootComponent.getProject());
-// }
-//
-// protected IDataModelProvider getRemoveReferenceDataModelProvider(Object component) {
-// return new RemoveComponentFromEnterpriseApplicationDataModelProvider();
-// }
-//
-//// protected void postAddProjects(Set moduleProjects) throws CoreException {
-//// EarFacetRuntimeHandler.updateModuleProjectRuntime(rootComponent.getProject(), moduleProjects, new NullProgressMonitor());
-//// }
-//
-// protected IDataModelProvider getAddReferenceDataModelProvider(IVirtualComponent component) {
-// return new AddComponentToEnterpriseApplicationDataModelProvider();
-// }
-}
Deleted: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ear/EarModuleDependencyPageProvider.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ear/EarModuleDependencyPageProvider.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/ear/EarModuleDependencyPageProvider.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -1,40 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2009 Red Hat
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rob Stryker - initial implementation and ongoing maintenance
- ******************************************************************************/
-package org.eclipse.wst.common.componentcore.ui.propertypage.ear;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.componentcore.ui.propertypage.IDependencyPageProvider;
-import org.eclipse.wst.common.componentcore.ui.propertypage.IModuleDependenciesControl;
-import org.eclipse.wst.common.componentcore.ui.propertypage.internal.ModuleAssemblyRootPage;
-
-public class EarModuleDependencyPageProvider implements IDependencyPageProvider {
-
- public boolean canHandle(IFacetedProject project) {
- boolean isEAR = project.hasProjectFacet(ProjectFacetsManager.getProjectFacet("jst.ear")); //$NON-NLS-1$
- return isEAR;
- }
-
- public IModuleDependenciesControl[] createPages(IFacetedProject project,
- ModuleAssemblyRootPage parent) {
- return new IModuleDependenciesControl[] {
- new EarModuleDependenciesPropertyPage(project.getProject(), parent)
- };
- }
-
- public Composite createRootControl(IModuleDependenciesControl[] pages,
- Composite parent) {
- if( pages.length == 1 && pages[0] != null)
- return pages[0].createContents(parent);
- return null;
- }
-}
Deleted: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/AddModuleDependenciesPropertiesPage.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/AddModuleDependenciesPropertiesPage.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/AddModuleDependenciesPropertiesPage.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -1,890 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2009 Red Hat
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rob Stryker - initial implementation and ongoing maintenance
- ******************************************************************************/
-package org.eclipse.wst.common.componentcore.ui.propertypage.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.ComponentResource;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.internal.operation.RemoveReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.componentcore.ui.ComponentCoreUIPlugin;
-import org.eclipse.wst.common.componentcore.ui.Messages;
-import org.eclipse.wst.common.componentcore.ui.propertypage.IModuleDependenciesControl;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-
-public class AddModuleDependenciesPropertiesPage implements Listener,
- IModuleDependenciesControl {
-
- private static final String DEPLOY_PATH_PROPERTY = new Integer(0).toString();
- private static final String SOURCE_PROPERTY = new Integer(1).toString();
-
-
- protected final String PATH_SEPARATOR = ComponentDependencyContentProvider.PATH_SEPARATOR;
- private boolean hasInitialized = false;
- protected final IProject project;
- protected final ModuleAssemblyRootPage propPage;
- protected IVirtualComponent rootComponent = null;
- protected Text componentNameText;
- protected Label availableModules;
- protected TableViewer availableComponentsViewer;
- protected Button addMappingButton, addReferenceButton, removeButton;
- protected Composite buttonColumn;
- protected static final IStatus OK_STATUS = IDataModelProvider.OK_STATUS;
- protected Listener tableListener;
- protected Listener labelListener;
-
- // Mappings that existed when the page was opened (or last saved)
- protected HashMap<IVirtualComponent, String> oldComponentToRuntimePath = new HashMap<IVirtualComponent, String>();
-
- // Mappings that are current
- protected HashMap<IVirtualComponent, String> objectToRuntimePath = new HashMap<IVirtualComponent, String>();
-
- // A single list of wb-resource mappings. If there's any change,
- // all old will be removed and new ones added
- protected ArrayList<ComponentResourceProxy> resourceMappings = new ArrayList<ComponentResourceProxy>();
-
- // keeps track if a change has occurred in wb-resource mappings
- protected boolean resourceMappingsChanged = false;
-
- /**
- * Constructor for AddModulestoEARPropertiesControl.
- */
- public AddModuleDependenciesPropertiesPage(final IProject project,
- final ModuleAssemblyRootPage page) {
- this.project = project;
- this.propPage = page;
- rootComponent = ComponentCore.createComponent(project);
- }
-
- /*
- * UI Creation Methods
- */
-
- public Composite createContents(final Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- ModuleAssemblyRootPage.createDescriptionComposite(composite,
- Messages.ModuleAssemblyRootPageDescription);
- createListGroup(composite);
- refresh();
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- protected void createListGroup(Composite parent) {
- Composite listGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- listGroup.setLayout(layout);
- GridData gData = new GridData(GridData.FILL_BOTH);
- gData.horizontalIndent = 5;
- listGroup.setLayoutData(gData);
-
- availableModules = new Label(listGroup, SWT.NONE);
- gData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_FILL);
- availableModules.setText(Messages.ModuleAssembly);
- availableModules.setLayoutData(gData);
- createTableComposite(listGroup);
- }
-
- protected void createTableComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridData gData = new GridData(GridData.FILL_BOTH);
- composite.setLayoutData(gData);
- fillComposite(composite);
- }
-
- public void fillComposite(Composite parent) {
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(GridData.FILL_BOTH));
- createTable(parent);
- createButtonColumn(parent);
- }
-
- protected void createButtonColumn(Composite parent) {
- buttonColumn = createButtonColumnComposite(parent);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- buttonColumn.setLayoutData(data);
- createPushButtons();
- }
-
- protected void createPushButtons() {
- addMappingButton = createPushButton(Messages.AddFolderElipses);
- addReferenceButton = createPushButton(Messages.AddReference);
- removeButton = createPushButton(Messages.RemoveSelected);
- }
-
- protected Button createPushButton(String label) {
- Button aButton = new Button(buttonColumn, SWT.PUSH);
- aButton.setText(label);
- aButton.addListener(SWT.Selection, this);
- aButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- return aButton;
- }
-
- public Composite createButtonColumnComposite(Composite parent) {
- Composite aButtonColumn = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- aButtonColumn.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_BEGINNING);
- aButtonColumn.setLayoutData(data);
- return aButtonColumn;
- }
-
- public Group createGroup(Composite parent) {
- return new Group(parent, SWT.NULL);
- }
-
- protected void createTable(Composite parent) {
- if (rootComponent != null) {
- availableComponentsViewer = createAvailableComponentsViewer(parent);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.FILL_VERTICAL);
- availableComponentsViewer.getTable().setLayoutData(gd);
-
- ComponentDependencyContentProvider provider = createProvider();
- provider.setRuntimePaths(objectToRuntimePath);
- provider.setResourceMappings(resourceMappings);
- availableComponentsViewer.setContentProvider(provider);
- availableComponentsViewer.setLabelProvider(provider);
- addTableListeners();
- }
- }
-
- /**
- * Subclasses should over-ride this and extend the class
- */
- protected ComponentDependencyContentProvider createProvider() {
- return new ComponentDependencyContentProvider();
- }
-
- /*
- * Listeners of various events
- */
-
- protected void addTableListeners() {
- addHoverHelpListeners();
- addDoubleClickListener();
- addSelectionListener();
- }
-
- protected void addHoverHelpListeners() {
- final Table table = availableComponentsViewer.getTable();
- createLabelListener(table);
- createTableListener(table);
- table.addListener(SWT.Dispose, tableListener);
- table.addListener(SWT.KeyDown, tableListener);
- table.addListener(SWT.MouseMove, tableListener);
- table.addListener(SWT.MouseHover, tableListener);
- }
-
- protected void createLabelListener(final Table table) {
- labelListener = new Listener() {
- public void handleEvent(Event event) {
- Label label = (Label) event.widget;
- Shell shell = label.getShell();
- switch (event.type) {
- case SWT.MouseDown:
- Event e = new Event();
- e.item = (TableItem) label.getData("_TABLEITEM"); //$NON-NLS-1$
- table.setSelection(new TableItem[] { (TableItem) e.item });
- table.notifyListeners(SWT.Selection, e);
- shell.dispose();
- table.setFocus();
- break;
- case SWT.MouseExit:
- shell.dispose();
- break;
- }
- }
- };
- }
-
- protected void createTableListener(final Table table) {
- tableListener = new Listener() {
- Shell tip = null;
- Label label = null;
-
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose:
- case SWT.KeyDown:
- case SWT.MouseMove: {
- if (tip == null)
- break;
- tip.dispose();
- tip = null;
- label = null;
- break;
- }
- case SWT.MouseHover: {
- TableItem item = table.getItem(new Point(event.x, event.y));
- if (item != null && item.getData() != null && !canEdit(item.getData())) {
- if (tip != null && !tip.isDisposed())
- tip.dispose();
- tip = new Shell(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(),
- SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
- tip.setBackground(Display.getDefault().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
- FillLayout layout = new FillLayout();
- layout.marginWidth = 2;
- tip.setLayout(layout);
- label = new Label(tip, SWT.WRAP);
- label.setForeground(Display.getDefault()
- .getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- label.setBackground(Display.getDefault()
- .getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- label.setData("_TABLEITEM", item); //$NON-NLS-1$
- label.setText( Messages.InternalLibJarWarning);
- label.addListener(SWT.MouseExit, labelListener);
- label.addListener(SWT.MouseDown, labelListener);
- Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Rectangle rect = item.getBounds(0);
- Point pt = table.toDisplay(rect.x, rect.y);
- tip.setBounds(pt.x, pt.y - size.y, size.x, size.y);
- tip.setVisible(true);
- }
- }
- }
- }
- };
- }
-
- protected boolean canEdit(Object data) {
- if( data == null ) return false;
- if( !(data instanceof VirtualArchiveComponent)) return true;
-
- VirtualArchiveComponent d2 = (VirtualArchiveComponent)data;
- boolean sameProject = d2.getWorkspaceRelativePath() != null
- && d2.getWorkspaceRelativePath().segment(0)
- .equals(rootComponent.getProject().getName());
- return !(sameProject && isPhysicallyAdded(d2));
- }
-
- protected void addDoubleClickListener() {
- availableComponentsViewer.setColumnProperties(new String[] {
- DEPLOY_PATH_PROPERTY, SOURCE_PROPERTY });
-
- CellEditor[] editors = new CellEditor[] {
- new TextCellEditor(availableComponentsViewer.getTable()),
- new TextCellEditor()};
- availableComponentsViewer.setCellEditors(editors);
- availableComponentsViewer
- .setCellModifier(new RuntimePathCellModifier());
- }
-
- protected void addSelectionListener() {
- availableComponentsViewer.addSelectionChangedListener(
- new ISelectionChangedListener(){
- public void selectionChanged(SelectionChangedEvent event) {
- viewerSelectionChanged();
- }
- });
- }
-
- protected void viewerSelectionChanged() {
- removeButton.setEnabled(getSelectedObject() != null && canEdit(getSelectedObject()));
- }
-
- protected Object getSelectedObject() {
- IStructuredSelection sel = (IStructuredSelection)availableComponentsViewer.getSelection();
- return sel.getFirstElement();
- }
-
- private class RuntimePathCellModifier implements ICellModifier {
-
- public boolean canModify(Object element, String property) {
- if( property.equals(DEPLOY_PATH_PROPERTY)) {
- if (element instanceof VirtualArchiveComponent) {
- try {
- return canEdit(element);
- } catch (IllegalArgumentException iae) {
- }
- }
- return true;
- }
- return false;
- }
-
- public Object getValue(Object element, String property) {
- Object data = element; //((TableItem)element).getData();
- if( data instanceof IVirtualComponent ) {
- return objectToRuntimePath.get(element) == null ? new Path("/") //$NON-NLS-1$
- .toString() : objectToRuntimePath.get(element);
- } else if( data instanceof ComponentResourceProxy) {
- return ((ComponentResourceProxy)data).runtimePath.toString();
- }
- return new Path("/"); //$NON-NLS-1$
- }
-
- public void modify(Object element, String property, Object value) {
- if (property.equals(DEPLOY_PATH_PROPERTY)) {
- TableItem item = (TableItem) element;
- if( item.getData() instanceof IVirtualComponent) {
- objectToRuntimePath.put((IVirtualComponent)item.getData(), (String) value);
- } else if( item.getData() instanceof ComponentResourceProxy) {
- ComponentResourceProxy c = ((ComponentResourceProxy)item.getData());
- c.runtimePath = new Path((String)value);
- resourceMappingsChanged = true;
- }
- refresh();
- }
- }
-
- }
-
- public void handleEvent(Event event) {
- if( event.widget == addMappingButton)
- handleAddMappingButton();
- else if( event.widget == addReferenceButton)
- handleAddReferenceButton();
- else if( event.widget == removeButton )
- handleRemoveSelectedButton();
- }
-
- protected void handleAddMappingButton() {
- AddFolderDialog afd = new AddFolderDialog(addMappingButton.getShell(), project);
- if( afd.open() == Window.OK) {
- IContainer c = afd.getSelected();
- if( c != null ) {
- IPath p = c.getProjectRelativePath();
- ComponentResourceProxy proxy = new ComponentResourceProxy(p, new Path("/")); //$NON-NLS-1$
- resourceMappings.add(proxy);
- refresh();
- }
- }
- }
-
- protected void handleAddReferenceButton() {
- NewReferenceWizard wizard = new NewReferenceWizard();
- // fill the task model
- wizard.getTaskModel().putObject(NewReferenceWizard.PROJECT, project);
- wizard.getTaskModel().putObject(NewReferenceWizard.ROOT_COMPONENT, rootComponent);
-
- WizardDialog wd = new WizardDialog(addReferenceButton.getShell(), wizard);
- if( wd.open() != Window.CANCEL) {
- Object c1 = wizard.getTaskModel().getObject(NewReferenceWizard.COMPONENT);
- Object p1 = wizard.getTaskModel().getObject(NewReferenceWizard.COMPONENT_PATH);
- IVirtualComponent[] compArr = c1 instanceof IVirtualComponent ?
- new IVirtualComponent[] { (IVirtualComponent)c1 } :
- (IVirtualComponent[])c1;
- String[] pathArr = p1 instanceof String ?
- new String[] { (String)p1 } :
- (String[])p1;
- for( int i = 0; i < compArr.length; i++ ) {
- objectToRuntimePath.put(compArr[i], pathArr[i]);
- }
- refresh();
- }
- }
-
- protected void handleRemoveSelectedButton() {
- ISelection sel = availableComponentsViewer.getSelection();
- if( sel instanceof IStructuredSelection ) {
- Object o = ((IStructuredSelection)sel).getFirstElement();
- if( o instanceof IVirtualComponent)
- objectToRuntimePath.remove(o);
- else if( o instanceof ComponentResourceProxy)
- resourceMappings.remove(o);
- refresh();
- }
- }
-
- public TableViewer createAvailableComponentsViewer(Composite parent) {
- int flags = SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI;
-
- Table table = new Table(parent, flags);
- availableComponentsViewer = new TableViewer(table);
-
- // set up table layout
- TableLayout tableLayout = new org.eclipse.jface.viewers.TableLayout();
- tableLayout.addColumnData(new ColumnWeightData(400, true));
- tableLayout.addColumnData(new ColumnWeightData(500, true));
- table.setLayout(tableLayout);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- availableComponentsViewer.setSorter(null);
-
- TableColumn bndColumn = new TableColumn(table, SWT.NONE, 0);
- bndColumn.setText(Messages.DeployPathColumn);
- bndColumn.setResizable(true);
-
- TableColumn projectColumn = new TableColumn(table, SWT.NONE, 1);
- projectColumn.setText(Messages.SourceColumn);
- projectColumn.setResizable(true);
-
- tableLayout.layout(table, true);
- return availableComponentsViewer;
-
- }
-
- protected boolean isPhysicallyAdded(VirtualArchiveComponent component) {
- try {
- component.getProjectRelativePath();
- return true;
- } catch (IllegalArgumentException e) {
- return false;
- }
- }
-
- /**
- * This should only be called on changes, such as adding a project
- * reference, adding a lib reference etc.
- *
- * It will reset the input, manually re-add missing elements, and do other
- * tasks
- */
- public void refresh() {
- resetTableUI();
- if (!hasInitialized) {
- initialize();
- resetTableUI();
- }
-
- }
-
- protected void resetTableUI() {
- IWorkspaceRoot input = ResourcesPlugin.getWorkspace().getRoot();
- availableComponentsViewer.setInput(input);
- GridData data = new GridData(GridData.FILL_BOTH);
- int numlines = Math.min(10, availableComponentsViewer.getTable()
- .getItemCount());
- data.heightHint = availableComponentsViewer.getTable().getItemHeight()
- * numlines;
- availableComponentsViewer.getTable().setLayoutData(data);
- GridData btndata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_BEGINNING);
- buttonColumn.setLayoutData(btndata);
- }
-
- protected void initialize() {
- IVirtualReference[] refs = rootComponent.getReferences();
- IVirtualComponent comp;
- for( int i = 0; i < refs.length; i++ ) {
- comp = refs[i].getReferencedComponent();
- String val = refs[i].getRuntimePath().append(refs[i].getArchiveName()).toString();
- objectToRuntimePath.put(comp, val);
- oldComponentToRuntimePath.put((IVirtualComponent) comp, val);
- }
-
- ComponentResource[] allMappings = findAllMappings();
- for( int i = 0; i < allMappings.length; i++ ) {
- resourceMappings.add(new ComponentResourceProxy(
- allMappings[i].getSourcePath(), allMappings[i].getRuntimePath()
- ));
- }
- hasInitialized = true;
- }
-
- protected ComponentResource[] findAllMappings() {
- StructureEdit structureEdit = null;
- try {
- structureEdit = StructureEdit.getStructureEditForRead(project);
- WorkbenchComponent component = structureEdit.getComponent();
- Object[] arr = component.getResources().toArray();
- ComponentResource[] result = new ComponentResource[arr.length];
- for( int i = 0; i < arr.length; i++ )
- result[i] = (ComponentResource)arr[i];
- return result;
- } catch(Exception e) {
- } finally {
- structureEdit.dispose();
- }
- return new ComponentResource[]{};
- }
-
- public class ComponentResourceProxy {
- public IPath source, runtimePath;
- public ComponentResourceProxy(IPath source, IPath runtimePath) {
- this.source = source;
- this.runtimePath = runtimePath;
- }
- }
-
- /*
- * Clean-up methods are below. These include performCancel, performDefaults,
- * performOK, and any other methods that are called *only* by this one.
- */
- public void setVisible(boolean visible) {
- }
-
- public void performDefaults() {
- }
-
- public boolean performCancel() {
- return true;
- }
-
- public void dispose() {
- Table table = null;
- if (availableComponentsViewer != null) {
- table = availableComponentsViewer.getTable();
- }
- if (table == null || tableListener == null)
- return;
- table.removeListener(SWT.Dispose, tableListener);
- table.removeListener(SWT.KeyDown, tableListener);
- table.removeListener(SWT.MouseMove, tableListener);
- table.removeListener(SWT.MouseHover, tableListener);
- }
-
-
-
- /*
- * This is where the OK work goes. Lots of it. Watch your head.
- * xiao xin
- */
- protected boolean preHandleChanges(IProgressMonitor monitor) {
- return true;
- }
-
- protected boolean postHandleChanges(IProgressMonitor monitor) {
- return true;
- }
-
- public boolean performOk() {
- boolean result = true;
- result &= saveResourceChanges();
- result &= saveReferenceChanges();
- return result;
- }
-
- protected boolean saveResourceChanges() {
- removeAllResourceMappings();
- addNewResourceMappings();
- return true;
- }
- protected boolean addNewResourceMappings() {
- ComponentResourceProxy[] proxies = (ComponentResourceProxy[]) resourceMappings.toArray(new ComponentResourceProxy[resourceMappings.size()]);
- IVirtualFolder rootFolder = rootComponent.getRootFolder();
- for( int i = 0; i < proxies.length; i++ ) {
- try {
- rootFolder.getFolder(proxies[i].runtimePath).createLink(proxies[i].source, 0, null);
- } catch( CoreException ce ) {
- }
- }
- resourceMappingsChanged = false;
- return true;
- }
-
- protected boolean removeAllResourceMappings() {
- StructureEdit moduleCore = null;
- try {
- moduleCore = StructureEdit.getStructureEditForWrite(project);
- moduleCore.getComponent().getResources().clear();
- }
- finally {
- if (moduleCore != null) {
- moduleCore.saveIfNecessary(new NullProgressMonitor());
- moduleCore.dispose();
- }
- }
- return true;
- }
-
- protected boolean saveReferenceChanges() {
- // Fill our delta lists
- ArrayList<IVirtualComponent> added = new ArrayList<IVirtualComponent>();
- ArrayList<IVirtualComponent> removed = new ArrayList<IVirtualComponent>();
- ArrayList<IVirtualComponent> changed = new ArrayList<IVirtualComponent>();
-
- Iterator<IVirtualComponent> j = oldComponentToRuntimePath.keySet().iterator();
- Object key, val;
- while (j.hasNext()) {
- key = j.next();
- val = oldComponentToRuntimePath.get(key);
- if( !objectToRuntimePath.containsKey(key))
- removed.add((IVirtualComponent)key);
- else if (!val.equals(objectToRuntimePath.get(key)))
- changed.add((IVirtualComponent)key);
- }
-
- j = objectToRuntimePath.keySet().iterator();
- while (j.hasNext()) {
- key = j.next();
- if (!oldComponentToRuntimePath.containsKey(key))
- added.add((IVirtualComponent)key);
- }
-
- NullProgressMonitor monitor = new NullProgressMonitor();
- boolean subResult = preHandleChanges(monitor);
- if( !subResult )
- return false;
-
- handleDeltas(removed, changed, added);
- subResult &= postHandleChanges(monitor);
-
- // Now update the variables
- oldComponentToRuntimePath.clear();
- ArrayList<IVirtualComponent> keys = new ArrayList<IVirtualComponent>();
- keys.addAll(objectToRuntimePath.keySet());
- Iterator<IVirtualComponent> i = keys.iterator();
- while(i.hasNext()) {
- IVirtualComponent vc = i.next();
- String path = objectToRuntimePath.get(vc);
- oldComponentToRuntimePath.put(vc, path);
- }
- return subResult;
- }
-
- // Subclass can override if it has a good way to handle changed elements
- protected void handleDeltas(ArrayList<IVirtualComponent> removed,
- ArrayList<IVirtualComponent> changed, ArrayList<IVirtualComponent> added) {
- ArrayList<IVirtualComponent> removed2 = new ArrayList<IVirtualComponent>();
- ArrayList<IVirtualComponent> added2 = new ArrayList<IVirtualComponent>();
- removed2.addAll(removed);
- removed2.addAll(changed);
- added2.addAll(added);
- added2.addAll(changed);
-
- // meld the changed into the added / removed for less efficiency ;)
- // basically we lack "change" operations and only have add / remove
- handleRemoved(removed2);
- handleAdded(added2);
- }
- protected void handleRemoved(ArrayList<IVirtualComponent> removed) {
- // If it's removed it should *only* be a virtual component already
- Iterator<IVirtualComponent> i = removed.iterator();
- IVirtualComponent component;
- while(i.hasNext()) {
- try {
- component = i.next();
- IDataModelOperation operation = getRemoveComponentOperation(component);
- operation.execute(null, null);
- } catch( ExecutionException e) {
- ComponentCoreUIPlugin.logError(e);
- }
- }
- }
-
- protected IDataModelOperation getRemoveComponentOperation(IVirtualComponent component) {
- String path, archiveName;
- path = new Path(oldComponentToRuntimePath.get(component)).removeLastSegments(1).toString();
- archiveName = new Path(oldComponentToRuntimePath.get(component)).lastSegment();
-
- IDataModelProvider provider = getRemoveReferenceDataModelProvider(component);
- IDataModel model = DataModelFactory.createDataModel(provider);
- model.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, rootComponent);
- List<IVirtualComponent> modHandlesList = (List<IVirtualComponent>) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
- modHandlesList.add(component);
- model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modHandlesList);
- model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
- Map<IVirtualComponent, String> uriMap = new HashMap<IVirtualComponent, String>();
- uriMap.put(component, archiveName);
- model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
- return model.getDefaultOperation();
- }
-
- protected IDataModelProvider getRemoveReferenceDataModelProvider(IVirtualComponent component) {
- return new RemoveReferenceComponentsDataModelProvider();
- }
-
-
- protected void handleChanged(ArrayList<IVirtualComponent> changed) {
- Iterator<IVirtualComponent> i = changed.iterator();
- IVirtualComponent component;
- IVirtualReference ref;
- IPath p;
- while(i.hasNext()) {
- component = i.next();
- ref = rootComponent.getReference(component.getName());
- p = new Path(objectToRuntimePath.get(component));
- ref.setRuntimePath(p);
- }
- }
-
- protected void handleAdded(ArrayList<IVirtualComponent> added) {
- final ArrayList<IVirtualComponent> components = new ArrayList<IVirtualComponent>();
- Iterator<IVirtualComponent> i = added.iterator();
- IVirtualComponent o;
- while(i.hasNext()) {
- o = i.next();
- components.add((IVirtualComponent)o);
- }
-
- IWorkspaceRunnable runnable = new IWorkspaceRunnable(){
- public void run(IProgressMonitor monitor) throws CoreException{
- addComponents(components);
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor());
- } catch( CoreException e ) {
- ComponentCoreUIPlugin.logError(e);
- }
- }
-
- protected void addComponents(ArrayList<IVirtualComponent> components) throws CoreException {
- Iterator<IVirtualComponent> i = components.iterator();
- while(i.hasNext()) {
- addOneComponent(i.next());
- }
- }
-
- protected IDataModelProvider getAddReferenceDataModelProvider(IVirtualComponent component) {
- return new CreateReferenceComponentsDataModelProvider();
- }
-
- protected void addOneComponent(IVirtualComponent component) throws CoreException {
- String path, archiveName;
- path = new Path(objectToRuntimePath.get(component)).removeLastSegments(1).toString();
- archiveName = new Path(objectToRuntimePath.get(component)).lastSegment();
-
- IDataModelProvider provider = getAddReferenceDataModelProvider(component);
- IDataModel dm = DataModelFactory.createDataModel(provider);
-
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, rootComponent);
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, Arrays.asList(component));
-
- //[Bug 238264] the uri map needs to be manually set correctly
- Map<IVirtualComponent, String> uriMap = new HashMap<IVirtualComponent, String>();
- uriMap.put(component, archiveName);
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
-
- IStatus stat = dm.validateProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
- if (stat != OK_STATUS)
- throw new CoreException(stat);
- try {
- dm.getDefaultOperation().execute(new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- ComponentCoreUIPlugin.logError(e);
- }
- }
-
- /**
- * [Bug 238264]
- * determines a unique URI mapping name for a given component
- * this is in case two components have the same name.
- *
- * @return returns a valid (none duplicate) uri mapping name for the given component\
- */
- private String getURIMappingName(IVirtualComponent archive) {
-
- //get the default uri map name for the given archive
- IPath componentPath = Path.fromOSString(archive.getName());
- String uriMapName = componentPath.lastSegment().replace(' ', '_');
-
-
- //check to be sure this uri mapping is not already in use by another reference
- boolean dupeArchiveName;
- String refedCompName;
- int lastDotIndex;
- String increment;
- IVirtualReference [] existingRefs = rootComponent.getReferences();
- for(int i=0;i<existingRefs.length;i++){
- refedCompName = existingRefs[i].getReferencedComponent().getName();
-
- //if uri mapping names of the refed component and the given archive are the same
- // find a new uri map name for the given archive
- if(existingRefs[i].getArchiveName().equals(uriMapName)){
- dupeArchiveName = true;
- //find a new uriMapName for the given component
- for(int j=1; dupeArchiveName; j++){
- lastDotIndex = uriMapName.lastIndexOf('.');
- increment = "_"+j; //$NON-NLS-1$
-
- //create the new potential name
- if(lastDotIndex != -1){
- uriMapName = uriMapName.substring(0, lastDotIndex) + increment + uriMapName.substring(lastDotIndex);
- } else {
- uriMapName = uriMapName.substring(0)+increment;
- }
-
- //determine if the new potential name is valid
- for(int k=0; k<existingRefs.length; k++) {
- dupeArchiveName = existingRefs[k].getArchiveName().equals(uriMapName);
- if(dupeArchiveName) {
- break;
- }
- }
- }
- }
- }
-
- return uriMapName;
- }
-}
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ComponentDependencyContentProvider.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ComponentDependencyContentProvider.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ComponentDependencyContentProvider.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -25,7 +25,7 @@
import org.eclipse.wst.common.componentcore.internal.ComponentResource;
import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.ui.propertypage.internal.AddModuleDependenciesPropertiesPage.ComponentResourceProxy;
+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.ComponentResourceProxy;
/*
Deleted: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ExternalJarReferenceWizardFragment.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ExternalJarReferenceWizardFragment.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ExternalJarReferenceWizardFragment.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -1,61 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2009 Red Hat
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rob Stryker - initial implementation and ongoing maintenance
- ******************************************************************************/
-package org.eclipse.wst.common.componentcore.ui.propertypage.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.ui.Messages;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-
-public class ExternalJarReferenceWizardFragment extends JarReferenceWizardFragment {
- public Composite createComposite(Composite parent, IWizardHandle handle) {
- Composite c = super.createComposite(parent, handle);
- handle.setTitle(Messages.ExternalJarTitle);
- handle.setDescription(Messages.ExternalJarDescription);
- return c;
- }
-
- protected void buttonPressed() {
- selected = BuildPathDialogAccess
- .chooseExternalJAREntries(browse.getShell());
- viewer.refresh();
- }
-
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- IVirtualComponent rootComponent = (IVirtualComponent)getTaskModel().getObject(NewReferenceWizard.ROOT_COMPONENT);
- if (selected != null && selected.length > 0) {
- ArrayList<IVirtualComponent> compList = new ArrayList<IVirtualComponent>();
- ArrayList<String> paths = new ArrayList<String>();
- for (int i = 0; i < selected.length; i++) {
- // IPath fullPath = project.getFile(selected[i]).getFullPath();
- String type = VirtualArchiveComponent.LIBARCHIVETYPE
- + IPath.SEPARATOR;
- IVirtualComponent archive = ComponentCore
- .createArchiveComponent(rootComponent.getProject(),
- type + selected[i].toString());
- compList.add(archive);
- paths.add(selected[i].lastSegment());
- }
- IVirtualComponent[] components = (IVirtualComponent[]) compList.toArray(new IVirtualComponent[compList.size()]);
- String[] paths2 = (String[]) paths.toArray(new String[paths.size()]);
- getTaskModel().putObject(NewReferenceWizard.COMPONENT, components);
- getTaskModel().putObject(NewReferenceWizard.COMPONENT_PATH, paths2);
- }
- }
-}
Deleted: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/JarReferenceWizardFragment.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/JarReferenceWizardFragment.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/JarReferenceWizardFragment.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -1,159 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2009 Red Hat
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rob Stryker - initial implementation and ongoing maintenance
- ******************************************************************************/
-package org.eclipse.wst.common.componentcore.ui.propertypage.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.ui.Messages;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-
-public class JarReferenceWizardFragment extends WizardFragment {
- protected LabelProvider labelProvider = null;
- protected ITreeContentProvider contentProvider = null;
- protected TreeViewer viewer;
- protected Button browse;
- protected IPath[] paths;
- protected IWizardHandle handle;
- protected IPath[] selected = new IPath[]{};
- public boolean hasComposite() {
- return true;
- }
-
- public Composite createComposite(Composite parent, IWizardHandle handle) {
- this.handle = handle;
- handle.setTitle(Messages.JarTitle);
- handle.setDescription(Messages.JarDescription);
-
- Composite c = new Composite(parent, SWT.NONE);
- c.setLayout(new FormLayout());
- viewer = new TreeViewer(c, SWT.SINGLE | SWT.BORDER);
- viewer.setContentProvider(getContentProvider());
- viewer.setLabelProvider(getLabelProvider());
- viewer.setInput(ResourcesPlugin.getWorkspace());
-
- browse = new Button(c, SWT.NONE);
- browse.setText(Messages.Browse);
- FormData fd = new FormData();
- fd.left = new FormAttachment(0, 5);
- fd.bottom = new FormAttachment(100, -5);
- browse.setLayoutData(fd);
-
- fd = new FormData();
- fd.left = new FormAttachment(0, 5);
- fd.top = new FormAttachment(0, 5);
- fd.right = new FormAttachment(100, -5);
- fd.bottom = new FormAttachment(browse, -5);
- viewer.getTree().setLayoutData(fd);
-
- browse.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- buttonPressed();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
- return c;
- }
-
- protected void buttonPressed() {
- IProject project = (IProject)getTaskModel().getObject(NewReferenceWizard.PROJECT);
- selected = BuildPathDialogAccess.chooseJAREntries(
- browse.getShell(),
- project.getLocation(), new IPath[0]);
- viewer.refresh();
- }
-
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- IVirtualComponent rootComponent = (IVirtualComponent)getTaskModel().getObject(NewReferenceWizard.ROOT_COMPONENT);
- if (selected != null && selected.length > 0) {
- ArrayList<IVirtualComponent> compList = new ArrayList<IVirtualComponent>();
- ArrayList<String> paths = new ArrayList<String>();
- for (int i = 0; i < selected.length; i++) {
- // IPath fullPath = project.getFile(selected[i]).getFullPath();
- String type = VirtualArchiveComponent.LIBARCHIVETYPE
- + IPath.SEPARATOR;
- IVirtualComponent archive = ComponentCore
- .createArchiveComponent(rootComponent.getProject(),
- type + selected[i].makeRelative().toString());
- compList.add(archive);
- paths.add(selected[i].lastSegment());
- }
- IVirtualComponent[] components = (IVirtualComponent[]) compList.toArray(new IVirtualComponent[compList.size()]);
- String[] paths2 = (String[]) paths.toArray(new String[paths.size()]);
- getTaskModel().putObject(NewReferenceWizard.COMPONENT, components);
- getTaskModel().putObject(NewReferenceWizard.COMPONENT_PATH, paths2);
- }
- }
-
- protected LabelProvider getLabelProvider() {
- if (labelProvider == null) {
- labelProvider = new LabelProvider() {
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- return element == null ? "" : element.toString();//$NON-NLS-1$
- }
- };
- }
- return labelProvider;
- }
-
- protected ITreeContentProvider getContentProvider() {
- if (contentProvider == null) {
- contentProvider = new ITreeContentProvider() {
- public Object[] getElements(Object inputElement) {
- return selected == null ? new Object[]{} : selected;
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- public void dispose() {
- }
- public boolean hasChildren(Object element) {
- return false;
- }
- public Object getParent(Object element) {
- return null;
- }
- public Object[] getChildren(Object parentElement) {
- return null;
- }
- };
- }
- return contentProvider;
- }
-}
Deleted: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ModuleAssemblyRootPage.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ModuleAssemblyRootPage.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/ModuleAssemblyRootPage.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -1,176 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2009 Red Hat
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rob Stryker - initial implementation and ongoing maintenance
- ******************************************************************************/
-package org.eclipse.wst.common.componentcore.ui.propertypage.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ui.Messages;
-import org.eclipse.wst.common.componentcore.ui.propertypage.IDependencyPageProvider;
-import org.eclipse.wst.common.componentcore.ui.propertypage.IModuleDependenciesControl;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * Primary project property page for Module assembly;
- */
-public class ModuleAssemblyRootPage extends PropertyPage {
-
- private IProject project;
- private IModuleDependenciesControl[] controls = new IModuleDependenciesControl[0];
-
- public ModuleAssemblyRootPage() {
- super();
- }
-
- private Composite getFacetErrorComposite(final Composite parent) {
- final String errorCheckingFacet = Messages.ErrorCheckingFacets;
- setErrorMessage(errorCheckingFacet);
- return getErrorComposite(parent, errorCheckingFacet);
- }
- private Composite getVirtCompErrorComposite(final Composite parent) {
- final String errorCheckingFacet = Messages.ErrorNotVirtualComponent;
- setErrorMessage(errorCheckingFacet);
- return getErrorComposite(parent, errorCheckingFacet);
- }
-
-
- private Composite getErrorComposite(final Composite parent, final String error) {
- final Composite composite = new Composite(parent, SWT.NONE);
- final GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- final Label label= new Label(composite, SWT.NONE);
- label.setText(error);
- return composite;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- for (int i = 0; i < controls.length; i++) {
- if (controls[i] != null) {
- if (!controls[i].performOk()) {
- return false;
- }
- }
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- public void performDefaults() {
- for (int i = 0; i < controls.length; i++) {
- if (controls[i] != null) {
- controls[i].performDefaults();
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performCancel()
- */
- public boolean performCancel() {
- for (int i = 0; i < controls.length; i++) {
- if (controls[i] != null) {
- if (!controls[i].performCancel()) {
- return false;
- }
- }
- }
- return super.performCancel();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- for (int i = 0; i < controls.length; i++) {
- if (controls[i] != null) {
- controls[i].setVisible(visible);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
- public void dispose() {
- super.dispose();
- for (int i = 0; i < controls.length; i++) {
- if(controls[i] != null){
- controls[i].dispose();
- }
- }
- }
-
- protected static void createDescriptionComposite(final Composite parent, final String description) {
- Composite descriptionComp = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- descriptionComp.setLayout(layout);
- descriptionComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fillDescription(descriptionComp, description);
- }
-
- private static void fillDescription(Composite c, String s) {
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 250;
- Text text = new Text(c, SWT.READ_ONLY | SWT.WRAP);
- text.setLayoutData(data);
- text.setText(s);
- }
-
- protected Control createContents(Composite parent) {
-
- // Need to find out what type of project we are handling
- project = (IProject) getElement().getAdapter(IResource.class);
- if( project != null ) {
- try {
- IFacetedProject facetedProject = ProjectFacetsManager.create(project);
- IDependencyPageProvider provider = null;
- if( facetedProject == null )
- return getFacetErrorComposite(parent);
-
- provider = DependencyPageExtensionManager.getManager().getProvider(facetedProject);
- if( provider != null ) {
- controls = provider.createPages(facetedProject, this);
- return provider.createRootControl(controls, parent);
- }
-
- if( ComponentCore.createComponent(project) == null )
- return getVirtCompErrorComposite(parent);
-
- AddModuleDependenciesPropertiesPage page = new AddModuleDependenciesPropertiesPage(project, this);
- controls = new IModuleDependenciesControl[1];
- controls[0] = page;
- return page.createContents(parent);
- } catch( CoreException ce ) {
- }
- }
- return getFacetErrorComposite(parent);
- }
-}
Modified: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/NewReferenceWizard.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/NewReferenceWizard.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/NewReferenceWizard.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -15,16 +15,12 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import org.eclipse.wst.common.componentcore.ui.Messages;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
import org.eclipse.wst.server.ui.internal.wizard.TaskWizard;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
-public class NewReferenceWizard extends TaskWizard {
+public class NewReferenceWizard extends TaskWizard implements IReferenceWizardConstants {
- public static final String COMPONENT = "dependency.component"; //$NON-NLS-1$
- public static final String COMPONENT_PATH = "dependency.component.path"; //$NON-NLS-1$
- public static final String PROJECT = "root.project"; //$NON-NLS-1$
- public static final String ROOT_COMPONENT = "root.component"; //$NON-NLS-1$
-
public NewReferenceWizard() {
super(Messages.NewReferenceWizard, new WizardFragment() {
protected void createChildFragments(List<WizardFragment> list) {
Deleted: workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/VariableReferenceWizardFragment.java
===================================================================
--- workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/VariableReferenceWizardFragment.java 2009-07-30 16:12:55 UTC (rev 16908)
+++ workspace/rstryker/wtpPropertyPageContrib/org.eclipse.wst.common.componentcore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/internal/VariableReferenceWizardFragment.java 2009-07-30 19:40:44 UTC (rev 16909)
@@ -1,66 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2009 Red Hat
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rob Stryker - initial implementation and ongoing maintenance
- ******************************************************************************/
-package org.eclipse.wst.common.componentcore.ui.propertypage.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.ui.Messages;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-
-public class VariableReferenceWizardFragment extends JarReferenceWizardFragment {
- public Composite createComposite(Composite parent, IWizardHandle handle) {
- Composite c = super.createComposite(parent, handle);
- handle.setTitle(Messages.VariableReferenceTitle);
- handle.setDescription(Messages.VariableReferenceDescription);
- return c;
- }
-
- protected void buttonPressed() {
- selected = BuildPathDialogAccess.chooseVariableEntries(
- browse.getShell(), new Path[0]);
- viewer.refresh();
- }
-
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- IVirtualComponent rootComponent = (IVirtualComponent)getTaskModel().getObject(NewReferenceWizard.ROOT_COMPONENT);
- if (selected != null && selected.length > 0) {
- ArrayList<IVirtualComponent> compList = new ArrayList<IVirtualComponent>();
- ArrayList<String> paths = new ArrayList<String>();
- for (int i = 0; i < selected.length; i++) {
- IPath resolvedPath = JavaCore.getResolvedVariablePath(selected[i]);
- java.io.File file = new java.io.File(resolvedPath.toOSString());
- if (file.isFile() && file.exists()) {
- String type = VirtualArchiveComponent.VARARCHIVETYPE
- + IPath.SEPARATOR;
- IVirtualComponent archive = ComponentCore
- .createArchiveComponent(rootComponent.getProject(),
- type + selected[i].toString());
- compList.add(archive);
- paths.add(resolvedPath.lastSegment());
- }
- }
- IVirtualComponent[] components = (IVirtualComponent[]) compList.toArray(new IVirtualComponent[compList.size()]);
- String[] paths2 = (String[]) paths.toArray(new String[paths.size()]);
- getTaskModel().putObject(NewReferenceWizard.COMPONENT, components);
- getTaskModel().putObject(NewReferenceWizard.COMPONENT_PATH, paths2);
- }
- }
-}
15 years, 5 months