JBoss Tools SVN: r10479 - documentation/trunk/movies/edit_and_run_criteria.
by jbosstools-commits@lists.jboss.org
Author: msorokin
Date: 2008-09-25 10:39:36 -0400 (Thu, 25 Sep 2008)
New Revision: 10479
Modified:
documentation/trunk/movies/edit_and_run_criteria/edit_and_run_criteria.wnk
Log:
Modified: documentation/trunk/movies/edit_and_run_criteria/edit_and_run_criteria.wnk
===================================================================
(Binary files differ)
16 years, 3 months
JBoss Tools SVN: r10478 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core: validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-09-25 10:22:58 -0400 (Thu, 25 Sep 2008)
New Revision: 10478
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
Log:
JBIDE-1497.
Internal methods prepared to be called with EL model objects
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java 2008-09-25 13:12:01 UTC (rev 10477)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java 2008-09-25 14:22:58 UTC (rev 10478)
@@ -260,7 +260,7 @@
if(resolvedToken==null && parentVar.getElToken()!=null) {
try {
// Initialize parent vars.
- engine.resolveSeamELOperand(project, file, var.getElToken().getText(), var.getElToken().getText(), 0, true, parentVars, this);
+ engine.resolveSeamELOperand(project, file, var.getElToken().getText(), true, parentVars, this);
resolvedToken = parentVar.getResolvedElToken();
} catch (StringIndexOutOfBoundsException e) {
SeamCorePlugin.getPluginLog().logError(e);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-09-25 13:12:01 UTC (rev 10477)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-09-25 14:22:58 UTC (rev 10478)
@@ -97,7 +97,9 @@
public List<String> getCompletions(ISeamProject project, IFile file, String documentContent, CharSequence prefix,
int position, boolean returnEqualedVariablesOnly, List<Var> vars) throws BadLocationException, StringIndexOutOfBoundsException {
List<String> completions = new ArrayList<String>();
- SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, documentContent, prefix, position, returnEqualedVariablesOnly, vars, new ElVarSearcher(project, file, this));
+ String prefix2 = SeamELCompletionEngine.getPrefix(documentContent, position + prefix.length());
+
+ SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, prefix2, returnEqualedVariablesOnly, vars, new ElVarSearcher(project, file, this));
if (status.isOK()) {
completions.addAll(status.getProposals());
}
@@ -122,7 +124,7 @@
* Resolve EL.
* @param project Seam project.
* @param file
- * @param documentContent
+ * @param operand
* @param prefix Text between #{ and cursor position in document.
* @param position Cursor position in document
* @param returnEqualedVariablesOnly if "false" use prefix as mask.
@@ -132,9 +134,9 @@
* @throws BadLocationException
* @throws StringIndexOutOfBoundsException
*/
- public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, String documentContent, CharSequence prefix,
- int position, boolean returnEqualedVariablesOnly, List<Var> vars, ElVarSearcher varSearcher) throws BadLocationException, StringIndexOutOfBoundsException {
- String oldEl = prefix.toString();
+ public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, String operand,
+ boolean returnEqualedVariablesOnly, List<Var> vars, ElVarSearcher varSearcher) throws BadLocationException, StringIndexOutOfBoundsException {
+ String oldEl = operand;
Var var = varSearcher.findVarForEl(oldEl, vars, true);
String suffix = "";
String newEl = oldEl;
@@ -158,18 +160,18 @@
newEl = var.getElToken().getText() + suffix + oldEl.substring(var.getName().length());
}
}
- String newDocumentContent = documentContent;
+ String newOperand = operand;
boolean prefixWasChanged = newEl!=oldEl;
if(prefixWasChanged) {
- newDocumentContent = documentContent.substring(0, position) + newEl;
+ newOperand = newEl;
}
- SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, newDocumentContent, newEl, position, returnEqualedVariablesOnly);
+ SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, newOperand, returnEqualedVariablesOnly);
if(prefixWasChanged) {
// Replace new EL by original one in result status.
ELOperandToken newLastResolvedToken = status.getLastResolvedToken();
- SeamELOperandTokenizer tokenizer = new SeamELOperandTokenizer(documentContent, position + prefix.length());
+ SeamELOperandTokenizer tokenizer = new SeamELOperandTokenizer(operand, operand.length());
List<ELOperandToken> oldTokens = tokenizer.getTokens();
status.setTokens(oldTokens);
if(newLastResolvedToken != null) {
@@ -194,7 +196,7 @@
}
if(!returnEqualedVariablesOnly && vars!=null) {
- status.getProposals().addAll(getVarNameProposals(vars, prefix.toString()));
+ status.getProposals().addAll(getVarNameProposals(vars, operand.toString()));
}
return status;
}
@@ -203,13 +205,13 @@
* Returns MemberInfo for last segment of EL. Null if El is not resolved.
* @param project
* @param file
- * @param elBody EL without #{}
+ * @param operand EL without #{}
* @return MemberInfo for last segment of EL. Null if El is not resolved.
* @throws BadLocationException
* @throws StringIndexOutOfBoundsException
*/
- public TypeInfoCollector.MemberInfo resolveSeamEL(ISeamProject project, IFile file, String elBody) throws BadLocationException, StringIndexOutOfBoundsException {
- SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, elBody, elBody, 0, true);
+ public TypeInfoCollector.MemberInfo resolveSeamEL(ISeamProject project, IFile file, String operand) throws BadLocationException, StringIndexOutOfBoundsException {
+ SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, operand, true);
return status.getMemberOfResolvedOperand();
}
@@ -261,7 +263,7 @@
* Resolves Seam EL
* @param project
* @param file
- * @param documentContent
+ * @param operand
* @param prefix
* @param position
* @param returnEqualedVariablesOnly
@@ -269,10 +271,10 @@
* @throws BadLocationException
* @throws StringIndexOutOfBoundsException
*/
- public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, String documentContent, String prefix,
- int position, boolean returnEqualedVariablesOnly) throws BadLocationException, StringIndexOutOfBoundsException {
+ public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, String operand,
+ boolean returnEqualedVariablesOnly) throws BadLocationException, StringIndexOutOfBoundsException {
- SeamELOperandTokenizer tokenizer = new SeamELOperandTokenizer(documentContent, position + prefix.length());
+ SeamELOperandTokenizer tokenizer = new SeamELOperandTokenizer(operand, operand.length());
SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(tokenizer.getTokens());
List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
@@ -312,8 +314,8 @@
Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
for (ISeamContextVariable var : resolvedVariables) {
String varName = var.getName();
- if(varName.startsWith(prefix)) {
- proposals.add(varName.substring(prefix.length()));
+ if(varName.startsWith(operand)) {
+ proposals.add(varName.substring(operand.length()));
}
}
status.setProposals(proposals);
@@ -327,8 +329,8 @@
Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
for (ISeamContextVariable var : resolvedVariables) {
String varName = var.getName();
- if(prefix.length()<=varName.length()) {
- proposals.add(varName.substring(prefix.length()));
+ if(operand.length()<=varName.length()) {
+ proposals.add(varName.substring(operand.length()));
} else if(returnEqualedVariablesOnly) {
proposals.add(varName);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-09-25 13:12:01 UTC (rev 10477)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-09-25 14:22:58 UTC (rev 10478)
@@ -304,7 +304,7 @@
}
SeamELOperandResolveStatus status =
- engine.resolveSeamELOperand(project, file, operand, prefix, position, true, varListForCurentValidatedNode, elVarSearcher);
+ engine.resolveSeamELOperand(project, file, operand, true, varListForCurentValidatedNode, elVarSearcher);
if(status.getUsedVariables().size()==0 && status.isError()) {
// Save resources with unknown variables names
16 years, 3 months
JBoss Tools SVN: r10477 - trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib.
by jbosstools-commits@lists.jboss.org
Author: KrisVerlaenen
Date: 2008-09-25 09:12:01 -0400 (Thu, 25 Sep 2008)
New Revision: 10477
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/antlr-runtime.jar
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/core-3.2.3.v_686_R32x.jar
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/drools-compiler.jar
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/mvel.jar
Modified:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/drools-core.jar
Log:
Adding dependency jars to lib
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/antlr-runtime.jar
===================================================================
(Binary files differ)
Property changes on: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/antlr-runtime.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/core-3.2.3.v_686_R32x.jar
===================================================================
(Binary files differ)
Property changes on: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/core-3.2.3.v_686_R32x.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/drools-compiler.jar
===================================================================
(Binary files differ)
Property changes on: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/drools-compiler.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/drools-core.jar
===================================================================
(Binary files differ)
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/mvel.jar
===================================================================
(Binary files differ)
Property changes on: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/mvel.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 3 months
JBoss Tools SVN: r10476 - in trunk/seam/plugins/org.jboss.tools.seam.ui.pages: src/org/jboss/tools/seam/ui/pages/editor/edit and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-09-25 08:37:33 -0400 (Thu, 25 Sep 2008)
New Revision: 10476
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_exception.png
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_minus.png
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_page.png
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_plus.png
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEndpointEditPolicy.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesXYLayoutEditPolicy.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFeedbackFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/FigureFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFeedbackFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamListFigure.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2254
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_exception.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_exception.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_minus.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_minus.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_page.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_page.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_plus.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/resources/org/jboss/tools/seam/ui/pages/editor/icons/ico_plus.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -133,7 +133,9 @@
String text = "";
// if (getLink().getJSFModel().getOptions().showShortcutPath())
+ if(getLink().getToElement() != null)
text = getLink().getToElement().getName();
+
shortcutLabel = new GEFLabel(text, FigureFactory.normalColor);
// if (getLink().getJSFModel().getOptions().showShortcutIcon())
shortcutLabel.setIcon(icon);
@@ -251,9 +253,10 @@
public void linkChange(Link source) {
pathLabel.setText(getLink().getName());
// if (getLinkModel().getJSFModel().getOptions().showShortcutPath())
+ if(getLink().getToElement() != null)
shortcutLabel.setText(getLink().getToElement().getName());
-// else
-// shortcutLabel.setText("");
+ else
+ shortcutLabel.setText("");
// if (getLinkModel().getJSFModel().getOptions().showShortcutIcon())
shortcutLabel.setIcon(icon);
// else
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEndpointEditPolicy.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEndpointEditPolicy.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEndpointEditPolicy.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -26,7 +26,6 @@
import org.eclipse.gef.handles.AbstractHandle;
import org.eclipse.gef.handles.ConnectionHandle;
import org.eclipse.gef.tools.ConnectionEndpointTracker;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.events.MouseEvent;
import org.jboss.tools.jst.web.model.ReferenceObject;
@@ -34,6 +33,7 @@
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
import org.jboss.tools.seam.ui.pages.editor.figures.ConnectionFigure;
+import org.jboss.tools.seam.ui.pages.editor.figures.FigureFactory;
public class LinkEndpointEditPolicy
@@ -70,7 +70,7 @@
super.addSelectionHandles();
addPagesHandles();
- getConnectionFigure().setSelected(true);
+ getConnectionFigure().setForegroundColor(FigureFactory.selectedColor);
}
protected ConnectionFigure getConnectionFigure() {
@@ -80,7 +80,7 @@
protected void removeSelectionHandles() {
super.removeSelectionHandles();
removePagesHandles();
- getConnectionFigure().setSelected(false);
+ getConnectionFigure().setForegroundColor(FigureFactory.normalColor);
}
protected List createSelectionHandles() {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesXYLayoutEditPolicy.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesXYLayoutEditPolicy.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesXYLayoutEditPolicy.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.RectangleFigure;
@@ -115,7 +116,7 @@
((RectangleFigure) figure).setXOR(true);
((RectangleFigure) figure).setFill(true);
figure.setBackgroundColor(NodeFigure.ghostFillColor);
- figure.setForegroundColor(NodeFigure.whiteColor);
+ figure.setForegroundColor(ColorConstants.white);
}
return figure;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -18,7 +18,6 @@
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.swt.SWT;
-import org.jboss.tools.jst.web.model.ReferenceObject;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
import org.jboss.tools.seam.ui.pages.editor.edit.LinkEditPart;
@@ -87,15 +86,7 @@
editPart.clear();
}
- private boolean selected;
-
protected void outlineShape(Graphics g) {
- if(selected) {
- g.setForegroundColor(FigureFactory.selectedColor);
- } else {
- g.setForegroundColor(getForegroundColor());
- }
-
Page page=null;
if(link != null && link.getFromElement() instanceof Page)
page = (Page)link.getFromElement();
@@ -197,10 +188,6 @@
beg.y = point.y;
}
}
- public void setSelected(boolean selected) {
- this.selected = selected;
- repaint();
- }
public void layout() {
if(getParent() != null)
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFeedbackFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFeedbackFigure.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFeedbackFigure.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor.figures;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Rectangle;
@@ -24,7 +25,7 @@
protected void paintFigure(Graphics g) {
g.setXORMode(true);
- g.setForegroundColor(whiteColor);
+ g.setForegroundColor(ColorConstants.white);
g.setBackgroundColor(ghostFillColor);
Rectangle r = getBounds().getCopy();
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFigure.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFigure.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor.figures;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LineBorder;
@@ -19,19 +20,30 @@
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.handles.HandleBounds;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.gef.GEFGraphicalViewer;
+import org.jboss.tools.seam.ui.pages.editor.PagesEditor;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PageException;
import org.jboss.tools.seam.ui.pages.editor.edit.ExceptionEditPart;
import org.jboss.tools.seam.ui.pages.editor.figures.xpl.CompressNameUtil;
import org.jboss.tools.seam.ui.pages.editor.figures.xpl.FixedConnectionAnchor;
-import org.jboss.tools.seam.ui.pages.editor.print.PrintIconHelper;
public class ExceptionFigure extends NodeFigure implements HandleBounds {
private static final Dimension SIZE = new Dimension(56, 100);
+
+ private static final Color exceptionBackgroundColor = new Color(null, 0xea, 0xf3, 0xff);
+
+ private static final Color exceptionForegroundColor = new Color(null, 0x41, 0x77, 0xa0);
+
+ private static final Color borderColor = new Color(null, 0x67, 0x7f, 0x91);
+
+ private static final Color greyForeground = new Color(null, 0x99, 0x95, 0x99);
+
+ private static final Image exceptionImage = ImageDescriptor.createFromFile(
+ PagesEditor.class, "icons/ico_exception.png").createImage();
- private Image icon = null;
public PageException exc;
@@ -46,28 +58,18 @@
}
public void setIcon(Image i) {
- icon = PrintIconHelper.getPrintImage(i);
}
public ExceptionFigure(PageException group) {
this.exc = group;
- if (group != null && group.getData() != null) {
- setIcon(group.getImage());
- }
-
setOpaque(false);
setLayoutManager(new XYLayout());
- setBorder(new GroupBorder(blackColor));
+ setBorder(new GroupBorder(ColorConstants.black));
if (group != null) {
FixedConnectionAnchor c;
- c = new FixedConnectionAnchor(this);
- c.offsetV = 10;
- //c.offsetH = -1;
- connectionAnchors.put("1_IN", c);
- inputConnectionAnchors.addElement(c);
c = new FixedConnectionAnchor(this);
c.offsetV = 10;
@@ -108,18 +110,15 @@
g.setBackgroundColor(lightGrayColor);
}
- g.fillRectangle(1, 1, r.width-2, r.height-2);
-
- g.setBackgroundColor(whiteColor);
-
- g.fillRectangle(1, 1, 22, 19);
-
- if (icon != null)
- g.drawImage(icon, 4, 2);
+ Rectangle boundingRect = new Rectangle(1, 1, r.width, r.height);
+ g.fillRectangle(boundingRect);
+
+ g.drawImage(exceptionImage, 1, 1);
+
if(exc != null){
g.setFont(nodeLabelFont);
- g.drawString(getExceptionReadOnlyLabel(), 27, 3);
+ g.drawString(getExceptionReadOnlyLabel(), 27, 1);
}
@@ -149,17 +148,14 @@
int height = r.height - 1;
if (exc != null)
- graphics.setForegroundColor(blackColor);
+ graphics.setForegroundColor(borderColor);
else
- graphics.setForegroundColor(darkGrayColor);
-
+ graphics.setForegroundColor(greyForeground);
+
graphics.drawLine(1, 0, width-1, 0);
graphics.drawLine(0, 1, 0, height - 1);
graphics.drawLine(1, height, width-1, height);
graphics.drawLine(width, 1, width, height - 1);
- graphics.drawLine(23 , 0, 23, height);
-
-
}
public void mouseDoubleClicked(MouseEvent me) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/FigureFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/FigureFactory.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/FigureFactory.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -11,44 +11,37 @@
package org.jboss.tools.seam.ui.pages.editor.figures;
import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.ManhattanConnectionRouter;
import org.eclipse.draw2d.PolygonDecoration;
import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.jdt.internal.ui.preferences.formatter.BlankLinesTabPage;
import org.eclipse.swt.graphics.Color;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.edit.LinkEditPart;
import org.jboss.tools.seam.ui.pages.editor.edit.xpl.PagesConnectionRouter;
public class FigureFactory {
- public static final Color normalColor = new Color(null, 0xb5, 0xb5, 0xb5);
- public static final Color selectedColor = new Color(null, 0x44, 0xa9, 0xf3);
+ public static final Color normalColor = new Color(null, 0x88, 0x89, 0x88);
+ public static final Color selectedColor = new Color(null, 0xff, 0x84, 0x00);
public static final Color highlightColor = ColorConstants.black;
public static final PointList TRIANGLE_TIP = new PointList();
static {
- TRIANGLE_TIP.addPoint(0, 0);
- TRIANGLE_TIP.addPoint(-1, -1);
- TRIANGLE_TIP.addPoint(-7, -4);
- TRIANGLE_TIP.addPoint(-8, -4);
- TRIANGLE_TIP.addPoint(-8, 4);
- TRIANGLE_TIP.addPoint(0, 0);
+ TRIANGLE_TIP.addPoint(0, -3);
+ TRIANGLE_TIP.addPoint(7, 0);
+ TRIANGLE_TIP.addPoint(0, 3);
}
public static ConnectionFigure createNewBendableWire(LinkEditPart part,
Link link) {
ConnectionFigure conn = new ConnectionFigure(part);
- conn.setForegroundColor(NodeFigure.blackColor);
+ conn.setForegroundColor(normalColor);
PolygonDecoration decor = new PolygonDecoration();
- decor.setBackgroundColor(NodeFigure.blackColor);
decor.setTemplate(TRIANGLE_TIP);
decor.setScale(1, 1);
- decor.setForegroundColor(NodeFigure.blackColor);
conn.setTargetDecoration(decor);
-
+ decor.setFill(false);
return conn;
}
@@ -59,7 +52,6 @@
conn.setForegroundColor(selectedColor);
PolygonDecoration decor = new PolygonDecoration();
- decor.setBackgroundColor(NodeFigure.whiteColor);
decor.setTemplate(TRIANGLE_TIP);
decor.setScale(1, 1);
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -22,54 +22,13 @@
public class NodeFigure extends
BaseNodeFigure {
- public static final Color blackColor = new Color(null, 0x00, 0x00, 0x00);
-
- public static final Color whiteColor = new Color(null, 0xff, 0xff, 0xff);
-
- public static final Color orangeColor = new Color(null, 0xff, 0xea, 0x82);
-
- public static final Color yellowColor = new Color(null, 0xff, 0xf6, 0xcb);
-
- public static final Color brownColor = new Color(null, 0xf0, 0xe8, 0xbf);
-
- public static final Color lightGrayColor = new Color(null, 0xf1, 0xf1, 0xf1);
-
- public static final Color darkGrayColor = new Color(null, 0xb3, 0xb3, 0xb3);
-
- public static final Color lightBlueColor = new Color(null, 0xd4, 0xe6, 0xff);
-
- public static final Color darkBlueColor = new Color(null, 0x97, 0xc4, 0xff);
-
- public static final Color pattSelected = new Color(null, 0xc6, 0xda, 0xe8);
-
- public static final Color pattBorder = new Color(null, 0x3e, 0x75, 0x99);
-
- public static final Color errorColor = new Color(null, 0xff, 0xb9, 0xb9);
-
- public static final Color errorSelected = new Color(null, 0xff, 0xa2, 0xa2);
-
- public static final Color errorBorder = new Color(null, 0xc5, 0x63, 0x62);
-
- public static final Color selectedColor = new Color(null, 0xf0, 0xe8, 0xbf);
-
- public static final Color borderColor = new Color(null, 0x86, 0x7d, 0x51);
-
+
public final static Color ghostFillColor = new Color(null, 31, 31, 31);
- public static final Color exceptionBackgroundColor = new Color(null, 0xff, 0xe3, 0xe7);
-
- public static final Color exceptionForegroundColor = blackColor; //new Color(null, 0x99, 0x07, 0x02);
-
- public static final Color button1Color = new Color(null, 0xff, 0xf6, 0xc8);
- public static final Color button2Color = new Color(null, 0x98, 0x99, 0x98);
- public static final Color button3Color = new Color(null, 0xff, 0xe8, 0x79);
- public static final Color button4Color = new Color(null, 0xdb, 0xc7, 0x68);
-
public static final Font nodeLabelFont = new Font(null, "default", 10, SWT.BOLD); // TODO: use preference font mechanism for this
- public static final Font nameParamFont = new Font(null, "default", 10, SWT.BOLD); // TODO: use preference font mechanism for this
- public static final Font valueParamFont = new Font(null, "default", 10, SWT.NORMAL); // TODO: use preference font mechanism for this
-
+ public static final Color lightGrayColor = new Color(null, 0xf1, 0xf1, 0xf1);
+
public static final Image errorIcon = ModelUIImages
.getImage("error_co.gif");
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFeedbackFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFeedbackFigure.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFeedbackFigure.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor.figures;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Rectangle;
@@ -24,7 +25,7 @@
protected void paintFigure(Graphics g) {
g.setXORMode(true);
- g.setForegroundColor(whiteColor);
+ g.setForegroundColor(ColorConstants.white);
g.setBackgroundColor(ghostFillColor);
Rectangle r = getBounds().getCopy();
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor.figures;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
@@ -19,21 +20,36 @@
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.handles.HandleBounds;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.jst.web.model.ReferenceObject;
import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesDiagramStructureHelper;
+import org.jboss.tools.seam.ui.pages.editor.PagesEditor;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
import org.jboss.tools.seam.ui.pages.editor.edit.PageEditPart;
import org.jboss.tools.seam.ui.pages.editor.figures.xpl.FixedConnectionAnchor;
-import org.jboss.tools.seam.ui.pages.editor.print.PrintIconHelper;
public class PageFigure extends NodeFigure implements HandleBounds{
private static final Dimension SIZE = new Dimension(56, 100);
+
+ private static final Color backgroundColor = new Color(null, 0xff, 0xf7, 0xcb);
+
+ private static final Color foregroundColor = new Color(null, 0x9d, 0x96, 0x24);
+
+ private static final Color greyBackground = new Color(null, 0xf1, 0xf1, 0xf1);
+
+ private static final Color greyForeground = new Color(null, 0x99, 0x95, 0x99);
+
+ private static final Image pageImage = ImageDescriptor.createFromFile(
+ PagesEditor.class, "icons/ico_page.png").createImage();
+
+ private static final Image plusImage = ImageDescriptor.createFromFile(
+ PagesEditor.class, "icons/ico_plus.png").createImage();
- private Image icon = null;
+ private static final Image minusImage = ImageDescriptor.createFromFile(
+ PagesEditor.class, "icons/ico_minus.png").createImage();
public Page page;
@@ -50,7 +66,7 @@
}
public void setIcon(Image i) {
- icon = PrintIconHelper.getPrintImage(i);
+ //icon = PrintIconHelper.getPrintImage(i);
}
@@ -65,13 +81,13 @@
setOpaque(false);
setLayoutManager(new XYLayout());
- setBorder(new PageBorder(blackColor));
+ setBorder(new PageBorder(ColorConstants.black));
if (page != null) {
FixedConnectionAnchor c;
c = new FixedConnectionAnchor(this);
c.offsetV = 10;
- c.offsetH = -1;
+ c.offsetH = -8;
connectionAnchors.put("1_IN", c);
inputConnectionAnchors.addElement(c);
@@ -110,50 +126,30 @@
g.translate(r.getLocation());
int height = r.height - 1;
- int start = 0;
-
- g.setBackgroundColor(whiteColor);
-
- g.fillRectangle(start + 1, 1, 22, 190); // fill left part
-
- // drawIcon
- if (icon != null)
- g.drawImage(icon, start + getInsetX(), getInsetY());
-
- if(page != null && page.getData() != null && SeamPagesDiagramStructureHelper.instance.isUnconfirmedPage((XModelObject)page.getData())){
- g.drawImage(errorIcon, start + getInsetX(), getInsetY()+8);
- }
-
- //color the page
if (page != null) {
- g.setBackgroundColor(new Color(null, 0xff, 0xff, 0xc2));
- } else {
- g.setBackgroundColor(lightGrayColor);
+ if(page.isConfirmed()){
+ g.setBackgroundColor(backgroundColor);
+ g.setForegroundColor(foregroundColor);
+ }else{
+ g.setBackgroundColor(greyBackground);
+ g.setForegroundColor(greyForeground);
+ }
+ } else{
+ g.setBackgroundColor(greyBackground);
+ g.setForegroundColor(greyForeground);
}
- Rectangle boundingRect = new Rectangle(22, 1, r.width, r.height);
+ Rectangle boundingRect = new Rectangle(1, 1, r.width, r.height);
g.fillRectangle(boundingRect);
+
+ // drawIcon
+ g.drawImage(pageImage, 1, 1);
-// if(g instanceof ScaledGraphics) {
-// // scaled graphcis does not support gradients ;(
-// g.fillRectangle(boundingRect);
-// } else {
-// Display display = Display.getCurrent();
-//
-//
-// Point topLeft = boundingRect.getTopLeft();
-// Point bottomRight = boundingRect.getBottomRight();
-//
-// Pattern pattern = new Pattern(display, topLeft.x, topLeft.y,
-// bottomRight.x, bottomRight.y,
-// ColorConstants.white, g.getBackgroundColor());
-// g.setBackgroundPattern(pattern);
-// g.fillRectangle(boundingRect);
-// g.setBackgroundPattern(null);
-// pattern.dispose();
-// }
+ if(page != null && page.getData() != null && SeamPagesDiagramStructureHelper.instance.isUnconfirmedPage((XModelObject)page.getData())){
+ g.drawImage(errorIcon, getInsetX(), getInsetY()+8);
+ }
if(page != null && page.getName() != null){
g.setFont(nodeLabelFont);
@@ -162,50 +158,9 @@
if(page.getChildren().size() != 0){
if(page.isParamsVisible()){
- g.setForegroundColor(blackColor);
- g.drawLine(4, height-13, 11, height-13);
- g.drawLine(4, height-13, 4, height-6);
-
- g.drawLine(6, height-9, 10, height-9);
-
- g.setForegroundColor(button2Color);
- g.drawLine(12, height-13, 12, height-5);
- g.drawLine(4, height-5, 12, height-5);
-
- g.setForegroundColor(button3Color);
- g.setBackgroundColor(button3Color);
- g.drawLine(5, height-4, 13, height-4);
- g.drawLine(13, height-4, 13, height-12);
- g.fillRectangle(6, height-11, 5, 2);
- g.fillRectangle(6, height-8, 5, 2);
-
- g.setForegroundColor(button4Color);
- g.drawLine(5, height-7, 5, height-12);
- g.drawLine(5, height-12, 10, height-12);
+ g.drawImage(minusImage, 4, height-12);
}else{
-
- g.setForegroundColor(button2Color);
- g.drawLine(4, height-13, 11, height-13);
- g.drawLine(4, height-13, 4, height-6);
-
- g.setForegroundColor(blackColor);
-
- g.drawLine(6, height-9, 10, height-9);
- g.drawLine(8, height-11, 8, height-7);
-
- g.drawLine(12, height-13, 12, height-5);
- g.drawLine(4, height-5, 12, height-5);
-
- g.setForegroundColor(button3Color);
- g.drawLine(5, height-4, 13, height-4);
- g.drawLine(13, height-4, 13, height-12);
-
- g.drawLine(6, height-6, 11, height-6);
- g.drawLine(11, height-6, 11, height-12);
-
- g.setForegroundColor(whiteColor);
- g.drawLine(5, height-6, 5, height-12);
- g.drawLine(5, height-12, 11, height-12);
+ g.drawImage(plusImage, 4, height-12);
}
}
}
@@ -239,19 +194,14 @@
}
if (page != null)
- graphics.setForegroundColor(blackColor);
+ graphics.setForegroundColor(foregroundColor);
else
- graphics.setForegroundColor(darkGrayColor);
+ graphics.setForegroundColor(greyForeground);
graphics.drawLine(1, 0, width-1, 0);
graphics.drawLine(0, 1, 0, height - 1);
graphics.drawLine(1, height, width-1, height);
graphics.drawLine(width, 1, width, height - 1);
- graphics.drawLine(23 , 0, 23, height);
+ }
}
-
-
-
-
-}
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamFigure.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamFigure.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -17,12 +17,18 @@
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.handles.HandleBounds;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Param;
import org.jboss.tools.seam.ui.pages.editor.edit.ParamEditPart;
public class ParamFigure extends NodeFigure implements HandleBounds {
private static final Dimension SIZE = new Dimension(56, 100);
+
+ private static final Font nameParamFont = new Font(null, "default", 10, SWT.BOLD); // TODO: use preference font mechanism for this
+ private static final Font valueParamFont = new Font(null, "default", 10, SWT.NORMAL); // TODO: use preference font mechanism for this
+
public Param param;
ParamEditPart editPart;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamListFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamListFigure.java 2008-09-25 10:06:19 UTC (rev 10475)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ParamListFigure.java 2008-09-25 12:37:33 UTC (rev 10476)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor.figures;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LineBorder;
@@ -23,6 +24,8 @@
public class ParamListFigure extends NodeFigure implements HandleBounds {
private static final Dimension SIZE = new Dimension(56, 100);
+
+ private static final Color darkGrayColor = new Color(null, 0xb3, 0xb3, 0xb3);
public PageWrapper paramList;
@@ -42,7 +45,7 @@
setOpaque(false);
setLayoutManager(new ParamListLayout());
- setBorder(new GroupBorder(blackColor));
+ setBorder(new GroupBorder(ColorConstants.black));
}
/**
16 years, 3 months
JBoss Tools SVN: r10475 - trunk/smooks/plugins/org.jboss.tools.smooks.javabean/icons/obj16.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-09-25 06:06:19 -0400 (Thu, 25 Sep 2008)
New Revision: 10475
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/icons/obj16/javaarraymodel.gif
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/icons/obj16/javalistmodel.gif
Log:
added two icons
Added: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/icons/obj16/javaarraymodel.gif
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/icons/obj16/javaarraymodel.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/icons/obj16/javalistmodel.gif
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/icons/obj16/javalistmodel.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 3 months
JBoss Tools SVN: r10474 - in trunk/smooks/plugins/org.jboss.tools.smooks.java2xml: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-09-25 06:06:18 -0400 (Thu, 25 Sep 2008)
New Revision: 10474
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/libs/freemarker-2.3.8.jar
trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/DOM2FreeMarkerTransformor.java
trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/FreeMarkerContentReplacer.java
trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/utils/
trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/utils/XMLConstants.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/.classpath
trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/META-INF/MANIFEST.MF
Log:
create two class for DOM/FreeMarker transformation
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/.classpath
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/.classpath 2008-09-25 10:04:24 UTC (rev 10473)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/.classpath 2008-09-25 10:06:18 UTC (rev 10474)
@@ -1,8 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" path="libs/dom4j-1.6.1.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="lib" path="libs/dom4j-1.6.1.jar"/>
+ <classpathentry kind="lib" path="libs/freemarker-2.3.8.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/META-INF/MANIFEST.MF 2008-09-25 10:04:24 UTC (rev 10473)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/META-INF/MANIFEST.MF 2008-09-25 10:06:18 UTC (rev 10474)
@@ -16,3 +16,6 @@
Eclipse-LazyStart: true
Bundle-ClassPath: libs/dom4j-1.6.1.jar,
.
+Export-Package: org.jboss.tools.smooks.java2xml,
+ org.jboss.tools.smooks.java2xml.analyzer,
+ org.jboss.tools.smooks.java2xml.utils
Added: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/libs/freemarker-2.3.8.jar
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/libs/freemarker-2.3.8.jar
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/DOM2FreeMarkerTransformor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/DOM2FreeMarkerTransformor.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/DOM2FreeMarkerTransformor.java 2008-09-25 10:06:18 UTC (rev 10474)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.java2xml.analyzer;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.jboss.tools.smooks.java2xml.utils.XMLConstants;
+
+/**
+ * @author Dart Peng
+ * @Date : Sep 25, 2008
+ */
+public class DOM2FreeMarkerTransformor {
+
+ public String transformDOM(Document document) {
+ Element element = document.getRootElement();
+ StringBuffer buffer = new StringBuffer();
+ transform(element, buffer);
+ return buffer.toString();
+ }
+
+ protected void transform(Element element, StringBuffer buffer) {
+ String name = element.getName();
+ if (XMLConstants.REPLACE_FREEMARKER_FOR_EXPRESS_ELEMENT_NAME
+ .equals(name)) {
+ String desc = element
+ .attributeValue(XMLConstants.REPLACE_FREEMARKER_FOR_EXPRESS_ELEMENT_ATTRIBUTE);
+ name = "#" + desc;
+ }
+ String attributesString = "";
+ if(!isFreeMarkerExpression(name)){
+ attributesString = buildAttributeString(element);
+ }
+ List children = element.elements();
+ if (children.isEmpty()) {
+ buffer.append("<" + name + " " +attributesString + "/>");
+ return;
+ } else {
+ buffer.append("<" + name + " " +attributesString + "/>");
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ Element child = (Element) iterator.next();
+ transform(child, buffer);
+ }
+ if(isFreeMarkerExpression(name)){
+ name = name.trim();
+ int index = name.indexOf(" ");
+ if(index != -1){
+ name = name.substring(0,index);
+ }
+ }
+ buffer.append("</" + name + ">");
+ }
+ }
+
+ private String buildAttributeString(Element element) {
+ List list = element.attributes();
+ StringBuffer buffer = new StringBuffer("");
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ Attribute att = (Attribute) iterator.next();
+ String name = att.getName();
+ String value = att.getValue();
+ if(value == null) value = "";
+ if(name != null){
+ buffer.append(name);
+ buffer.append("=");
+ buffer.append("\"");
+ buffer.append(value);
+ buffer.append("\"");
+ buffer.append(" ");
+ }
+ }
+ return buffer.toString();
+ }
+
+ private boolean isFreeMarkerExpression(String str){
+ return str.startsWith("#");
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/DOM2FreeMarkerTransformor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/FreeMarkerContentReplacer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/FreeMarkerContentReplacer.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/FreeMarkerContentReplacer.java 2008-09-25 10:06:18 UTC (rev 10474)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.java2xml.analyzer;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Enumeration;
+
+import org.jboss.tools.smooks.java2xml.utils.XMLConstants;
+
+import freemarker.core.TemplateElement;
+import freemarker.core.TextBlock;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+
+/**
+ * @author Dart Peng
+ * @Date : Sep 25, 2008
+ */
+public class FreeMarkerContentReplacer {
+
+ public String replaceFreeMarkerTemplate(Reader reader) throws IOException {
+
+ Configuration fmConfiguration = new Configuration();
+ fmConfiguration.setTagSyntax(Configuration.AUTO_DETECT_TAG_SYNTAX);
+ StringBuffer buffer = new StringBuffer();
+ Template template;
+ template = new Template("XML2Java_FreeMarker", reader, fmConfiguration);
+ TemplateElement root = template.getRootTreeNode();
+ visitTemplateElement(root, buffer);
+ return buffer.toString();
+ }
+
+ public String replaceFreeMarkerTemplate(String templateContents)
+ throws IOException {
+ Reader reader = new StringReader(templateContents);
+ return replaceFreeMarkerTemplate(reader);
+ }
+
+ private void visitTemplateElement(TemplateElement model, StringBuffer buffer) {
+
+ Enumeration children = ((TemplateElement) model).children();
+ if (!"MixedContent".equals(model.getNodeName())) {
+ buffer
+ .append("<"
+ + XMLConstants.REPLACE_FREEMARKER_FOR_EXPRESS_ELEMENT_NAME
+ + " "
+ + XMLConstants.REPLACE_FREEMARKER_FOR_EXPRESS_ELEMENT_ATTRIBUTE
+ + "= \"" + model.getDescription() + "\">");
+ }
+ while (children.hasMoreElements()) {
+ Object obj = children.nextElement();
+ if (!(obj instanceof TextBlock)) {
+ TemplateElement child = (TemplateElement) obj;
+ String str = child.getSource();
+ if (child.isLeaf()) {
+ if (child.getNodeName().equals("DollarVariable")) {
+ buffer.append(child.getSource());
+ } else {
+ buffer.append(child.getDescription());
+ }
+ continue;
+ }
+ visitTemplateElement(child, buffer);
+ } else {
+ buffer.append(obj);
+ }
+ }
+ if (!"MixedContent".equals(model.getNodeName())) {
+ buffer.append("</"
+ + XMLConstants.REPLACE_FREEMARKER_FOR_EXPRESS_ELEMENT_NAME
+ + ">");
+ }
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/FreeMarkerContentReplacer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/utils/XMLConstants.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/utils/XMLConstants.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/utils/XMLConstants.java 2008-09-25 10:06:18 UTC (rev 10474)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.java2xml.utils;
+
+/**
+ * @author Dart Peng
+ * @Date : Sep 25, 2008
+ */
+public class XMLConstants {
+ public static final String REPLACE_FREEMARKER_FOR_EXPRESS_ELEMENT_NAME = "adfafdafafda_dfafda";
+
+ public static final String REPLACE_FREEMARKER_FOR_EXPRESS_ELEMENT_ATTRIBUTE = "desc";
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/utils/XMLConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 3 months
JBoss Tools SVN: r10473 - trunk/smooks/plugins/org.jboss.tools.smooks.xml.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-09-25 06:04:24 -0400 (Thu, 25 Sep 2008)
New Revision: 10473
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.xml/plugin.xml
Log:
delete the XSD file importor
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.xml/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.xml/plugin.xml 2008-09-25 09:48:34 UTC (rev 10472)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.xml/plugin.xml 2008-09-25 10:04:24 UTC (rev 10473)
@@ -3,13 +3,6 @@
<plugin>
<extension
point="org.jboss.tools.smooks.ui.viewerInitor">
- <viewerInitor
- contentProvider="org.jboss.tools.smooks.xsd.model.XSDStructuredModelContentProvider"
- creationWizard="org.jboss.tools.smooks.xsd.ui.XSDStructuredDataWizard"
- labelProvider="org.jboss.tools.smooks.xsd.model.XSDStructuredModelLabelProvider"
- name="XSD"
- typeID="org.jboss.tools.smooks.xml.viewerInitor.xsd">
- </viewerInitor>
<viewerInitor
contentProvider="org.jboss.tools.smooks.xml.ui.XMLStructuredDataContentProvider"
creationWizard="org.jboss.tools.smooks.xml.ui.XMLStructuredDataWizard"
16 years, 3 months
JBoss Tools SVN: r10472 - in trunk/smooks/tests/org.jboss.tools.smooks.test: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-09-25 05:48:34 -0400 (Thu, 25 Sep 2008)
New Revision: 10472
Added:
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/xml/FreeMarkerTest.java
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/xml/test.flt
Modified:
trunk/smooks/tests/org.jboss.tools.smooks.test/.classpath
trunk/smooks/tests/org.jboss.tools.smooks.test/META-INF/MANIFEST.MF
Log:
add some codes for testing FreeMarker2DOM , DOM2FreeMarker
Modified: trunk/smooks/tests/org.jboss.tools.smooks.test/.classpath
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.test/.classpath 2008-09-25 05:32:49 UTC (rev 10471)
+++ trunk/smooks/tests/org.jboss.tools.smooks.test/.classpath 2008-09-25 09:48:34 UTC (rev 10472)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Modified: trunk/smooks/tests/org.jboss.tools.smooks.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.test/META-INF/MANIFEST.MF 2008-09-25 05:32:49 UTC (rev 10471)
+++ trunk/smooks/tests/org.jboss.tools.smooks.test/META-INF/MANIFEST.MF 2008-09-25 09:48:34 UTC (rev 10472)
@@ -19,7 +19,8 @@
org.eclipse.xsd.edit,
org.eclipse.emf,
org.eclipse.emf.ecore.edit,
- org.eclipse.emf.edit.ui
+ org.eclipse.emf.edit.ui,
+ org.jboss.tools.smooks.java2xml
Eclipse-LazyStart: true
Bundle-ClassPath: lib/dom4j-1.6.1.jar,
.
Added: trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/xml/FreeMarkerTest.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/xml/FreeMarkerTest.java (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/xml/FreeMarkerTest.java 2008-09-25 09:48:34 UTC (rev 10472)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.test.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import junit.framework.TestCase;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.io.SAXReader;
+import org.jboss.tools.smooks.java2xml.analyzer.DOM2FreeMarkerTransformor;
+import org.jboss.tools.smooks.java2xml.analyzer.FreeMarkerContentReplacer;
+
+/**
+ * @author Dart Peng
+ * @Date : Sep 25, 2008
+ */
+public class FreeMarkerTest extends TestCase {
+ public void testParse() throws DocumentException, IOException {
+ Reader reader = new InputStreamReader(FreeMarkerTest.class
+ .getResourceAsStream("test.flt"));
+ FreeMarkerContentReplacer replacer = new FreeMarkerContentReplacer();
+ String contents = replacer.replaceFreeMarkerTemplate(reader);
+ System.out.println(contents);
+
+ SAXReader sax = new SAXReader();
+ Document doc = sax.read(new ByteArrayInputStream(contents.getBytes()));
+ DOM2FreeMarkerTransformor trans = new DOM2FreeMarkerTransformor();
+ String result = trans.transformDOM(doc);
+
+ System.out.println(result);
+ }
+}
Property changes on: trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/xml/FreeMarkerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/xml/test.flt
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/xml/test.flt (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/xml/test.flt 2008-09-25 09:48:34 UTC (rev 10472)
@@ -0,0 +1,11 @@
+<shipping-history date="${history.creationDate}">
+ <warehouse id="${history.warehouse.id}" location="${history.warehouse.name}" />
+ <trackingNumbers>
+ <#list history.trackingNumbers as trackingNumber>
+ <trackingNumber>
+ <shipperID>${trackingNumber.shipperID}</shipperID>
+ <shipmentNumber>${trackingNumber.shipmentNumber}</shipmentNumber>
+ </trackingNumber>
+ </#list>
+ </trackingNumbers>
+</shipping-history>
16 years, 3 months
JBoss Tools SVN: r10471 - trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-09-25 01:32:49 -0400 (Thu, 25 Sep 2008)
New Revision: 10471
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
Log:
trying to fix exception during deleting resources. project.close() added before project delete.
org.eclipse.core.runtime.CoreException: File not found: /local/hudson/jobs/redhat-jbosss-tools-nightly/workspace/jbds-build/3.0.0.Beta1-N200809241802/tests/workspace/seam_ear-ejb/.settings/org.eclipse.jdt.core.prefs.
[java] at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:55)
[java] at org.eclipse.core.internal.filesystem.local.LocalFile.openInputStream(LocalFile.java:365)
[java] at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:622)
[java] at org.eclipse.core.internal.resources.File.getContents(File.java:298)
[java] at org.eclipse.core.internal.resources.ProjectPreferences.load(ProjectPreferences.java:455)
[java] at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:307)
[java] at org.eclipse.core.internal.preferences.EclipsePreferences.getChild(EclipsePreferences.java:412)
[java] at org.eclipse.core.internal.preferences.EclipsePreferences.internalNode(EclipsePreferences.java:541)
[java] at org.eclipse.core.internal.preferences.EclipsePreferences.node(EclipsePreferences.java:662)
[java] at org.eclipse.core.resources.ProjectScope.getNode(ProjectScope.java:67)
[java] at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$EclipsePreferencesAdapter.getNode(JavaEditor.java:368)
[java] at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$EclipsePreferencesAdapter.contains(JavaEditor.java:394)
[java] at org.eclipse.ui.texteditor.ChainedPreferenceStore.getVisibleStore(ChainedPreferenceStore.java:529)
[java] at org.eclipse.ui.texteditor.ChainedPreferenceStore.handlePropertyChangeEvent(ChainedPreferenceStore.java:413)
[java] at org.eclipse.ui.texteditor.ChainedPreferenceStore.access$0(ChainedPreferenceStore.java:408)
[java] at org.eclipse.ui.texteditor.ChainedPreferenceStore$PropertyChangeListener.propertyChange(ChainedPreferenceStore.java:69)
[java] at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$EclipsePreferencesAdapter.firePropertyChangeEvent(JavaEditor.java:404)
[java] at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$EclipsePreferencesAdapter$PreferenceChangeListener.preferenceChange(JavaEditor.java:341)
[java] at org.eclipse.core.internal.preferences.EclipsePreferences$2.run(EclipsePreferences.java:746)
[java] at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
[java] at org.eclipse.core.internal.preferences.EclipsePreferences.firePreferenceEvent(EclipsePreferences.java:749)
[java] at org.eclipse.core.internal.preferences.EclipsePreferences.remove(EclipsePreferences.java:859)
[java] at org.eclipse.core.internal.preferences.EclipsePreferences.removeNode(EclipsePreferences.java:872)
[java] at org.eclipse.core.internal.preferences.EclipsePreferences.removeNode(EclipsePreferences.java:883)
[java] at org.eclipse.core.internal.resources.ProjectPreferences.removeNode(ProjectPreferences.java:242)
[java] at org.eclipse.core.internal.resources.ProjectPreferences.deleted(ProjectPreferences.java:134)
[java] at org.eclipse.core.internal.resources.ProjectPreferences.deleted(ProjectPreferences.java:165)
[java] at org.eclipse.core.internal.resources.Resource.deleteResource(Resource.java:772)
[java] at org.eclipse.core.internal.localstore.DeleteVisitor.delete(DeleteVisitor.java:67)
[java] at org.eclipse.core.internal.localstore.DeleteVisitor.visit(DeleteVisitor.java:150)
[java] at org.eclipse.core.internal.localstore.UnifiedTree.accept(UnifiedTree.java:99)
[java] at org.eclipse.core.internal.localstore.FileSystemResourceManager.delete(FileSystemResourceManager.java:228)
[java] at org.eclipse.core.internal.resources.ResourceTree.internalDeleteFolder(ResourceTree.java:350)
[java] at org.eclipse.core.internal.resources.ResourceTree.internalDeleteProject(ResourceTree.java:385)
[java] at org.eclipse.core.internal.resources.ResourceTree.standardDeleteProject(ResourceTree.java:831)
[java] at org.eclipse.core.internal.resources.Resource.unprotectedDelete(Resource.java:1720)
[java] at org.eclipse.core.internal.resources.Resource.delete(Resource.java:706)
[java] at org.eclipse.core.internal.resources.Project.delete(Project.java:317)
[java] at org.jboss.tools.seam.core.test.project.facet.AbstractSeamFacetTest.tearDown(AbstractSeamFacetTest.java:114)
[java] at org.jboss.tools.seam.ui.test.wizard.Seam12EARNewOperationTest.tearDown(Seam12EARNewOperationTest.java:93)
[java] at junit.framework.TestCase.runBare(TestCase.java:136)
[java] at junit.framework.TestResult$1.protect(TestResult.java:106)
[java] at junit.framework.TestResult.runProtected(TestResult.java:124)
[java] at junit.framework.TestResult.run(TestResult.java:109)
[java] at junit.framework.TestCase.run(TestCase.java:120)
[java] at junit.framework.TestSuite.runTest(TestSuite.java:230)
[java] at junit.framework.TestSuite.run(TestSuite.java:225)
[java] at junit.framework.TestSuite.runTest(TestSuite.java:230)
[java] at junit.framework.TestSuite.run(TestSuite.java:225)
[java] at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:354)
[java] at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:206)
[java] at org.eclipse.test.UITestApplication$3.run(UITestApplication.java:195)
[java] at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
[java] at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
[java] at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3378)
[java] at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3036)
[java] at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
[java] at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
[java] at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
[java] at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
[java] at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
[java] at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
[java] at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
[java] at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
[java] at org.eclipse.test.UITestApplication.runApplication(UITestApplication.java:138)
[java] at org.eclipse.test.UITestApplication.run(UITestApplication.java:60)
[java] at org.eclipse.test.UITestApplication.start(UITestApplication.java:210)
[java] at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
[java] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
[java] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
[java] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
[java] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
[java] at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
[java] at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
[java] at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
[java] at org.eclipse.core.launcher.Main.main(Main.java:30)
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2008-09-25 01:35:11 UTC (rev 10470)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2008-09-25 05:32:49 UTC (rev 10471)
@@ -111,6 +111,7 @@
for (IResource r : this.resourcesToCleanup) {
try {
System.out.println("Deleting " + r);
+ r.getProject().close(null);
r.delete(true, null);
} catch(Exception e) {
System.out.println("Error deleting " + r);
16 years, 3 months
JBoss Tools SVN: r10470 - in trunk/archives/plugins/org.jboss.ide.eclipse.archives.core: src/eclipse/org/jboss/ide/eclipse/archives/core and 15 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-09-24 21:35:11 -0400 (Wed, 24 Sep 2008)
New Revision: 10470
Added:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.properties
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/AntNLS.java
Removed:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/AntActionType.java
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/.settings/org.eclipse.jdt.core.prefs
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceChangeListener.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/RegisterArchivesJob.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/SaveArchivesJob.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVFS.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesNature.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntArchivesCore.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntBuildListener.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVFS.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/asf/DirectoryScanner.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/EventManager.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchive.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveAction.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFolder.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModel.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/INamedContainerArchiveNode.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IVariableManager.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFolderImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/ArchivesUnmarshallerImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/StrictXercesXSMarshaller.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/AbstractArchiveType.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/StringSubstitutionEngineClone.java
Log:
NLS that works even from ant! yay!
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/.settings/org.eclipse.jdt.core.prefs 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/.settings/org.eclipse.jdt.core.prefs 2008-09-25 01:35:11 UTC (rev 10470)
@@ -1,4 +1,4 @@
-#Mon Jan 21 18:36:05 EST 2008
+#Wed Sep 24 20:01:11 EDT 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -7,6 +7,64 @@
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -1,6 +1,7 @@
package org.jboss.ide.eclipse.archives.core;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.build.ModelChangeListenerWithRefresh;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
@@ -15,22 +16,24 @@
import org.jboss.ide.eclipse.archives.core.project.ProjectUtils;
public class WorkspaceArchivesCore extends ArchivesCore {
+ static {
+ NLS.initializeMessages("org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages", ArchivesCoreMessages.class); //$NON-NLS-1$
+ }
- public WorkspaceArchivesCore ()
- {
+ public WorkspaceArchivesCore () {
super(WORKSPACE);
ArchivesCore.setInstance(this);
ArchivesModel.instance().addModelListener(new ModelChangeListenerWithRefresh());
}
-
+
protected IExtensionManager createExtensionManager() {
return new WorkspaceExtensionManager();
}
-
+
protected IPreferenceManager createPreferenceManager() {
return new WorkspacePreferenceManager();
}
-
+
protected IArchivesVFS createVFS() {
return new WorkspaceVFS();
}
@@ -42,5 +45,9 @@
protected IArchivesLogger createLogger() {
return new ArchivesWorkspaceLogger();
}
-
+
+ protected String bind2(String message, Object[] bindings) {
+ return NLS.bind(message, bindings);
+ }
+
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceChangeListener.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceChangeListener.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceChangeListener.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -42,7 +42,6 @@
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
import org.jboss.ide.eclipse.archives.core.model.IArchiveModel;
-import org.jboss.ide.eclipse.archives.core.model.IArchivesLogger;
/**
* Update the model if someone changes the packaging file by hand
@@ -82,22 +81,24 @@
while(i.hasNext()) {
final IProject p = i.next();
try {
- if( p.getSessionProperty(new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, "localname")) == null ) {
+ if( p.getSessionProperty(new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, "localname")) == null ) { //$NON-NLS-1$
try {
ArchivesModel.instance().registerProject(p.getLocation(), new NullProgressMonitor());
- new Job("Refresh Project: " + p.getName()) {
+ new Job(ArchivesCore.bind(ArchivesCoreMessages.RefreshProject, p.getName())) {
protected IStatus run(IProgressMonitor monitor) {
try {
p.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
} catch( CoreException e ) {
- IStatus status = new Status(IStatus.WARNING, ArchivesCorePlugin.PLUGIN_ID, "Could not refresh project " + p.getName(), e);
+ IStatus status = new Status(IStatus.WARNING, ArchivesCorePlugin.PLUGIN_ID,
+ ArchivesCore.bind(ArchivesCoreMessages.RefreshProjectFailed, p.getName()),e);
return status;
}
return Status.OK_STATUS;
}
}.schedule();
} catch( ArchivesModelException ame ) {
- ArchivesCore.getInstance().getLogger().log(IStatus.ERROR, "Could not register project " + p.getName(), ame);
+ ArchivesCore.getInstance().getLogger().log(IStatus.ERROR,
+ ArchivesCore.bind(ArchivesCoreMessages.RegisterProjectFailed, p.getName()), ame);
}
}
} catch( CoreException ce ) {
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -15,14 +15,14 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
/**
- * This class responds to model change events.
- * It is given a delta as to what nodes are added, removed, or changed.
+ * This class responds to model change events.
+ * It is given a delta as to what nodes are added, removed, or changed.
* It then keeps the output file for the top level archive in sync with
* the changes to the model.
- *
+ *
* If the automatic builder is not enabled for this project, the listener
- * does nothing.
- *
+ * does nothing.
+ *
* @author Rob Stryker (rob.stryker(a)redhat.com)
*
*/
@@ -34,7 +34,7 @@
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IContainer proj = root.getContainerForLocation(pack.getProjectPath());
try {
- proj.setSessionProperty(new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, "localname"), "inUse");
+ proj.setSessionProperty(new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, "localname"), "inUse"); //$NON-NLS-1$ //$NON-NLS-2$
if( pack.isDestinationInWorkspace() ) {
// refresh the root package node
IResource res = root.getContainerForLocation(pack.getProjectPath());
@@ -46,19 +46,19 @@
}
}
}
-
+
try {
proj.getFile(new Path(IArchiveModel.DEFAULT_PACKAGES_FILE)).refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
} catch( CoreException ce ) {
}
} catch( CoreException ce ) {
}
-
+
try {
- proj.setSessionProperty(new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, "localname"), null);
+ proj.setSessionProperty(new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, "localname"), null); //$NON-NLS-1$
} catch( CoreException ce ) {
}
-
+
}
}
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/RegisterArchivesJob.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/RegisterArchivesJob.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/RegisterArchivesJob.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -5,6 +5,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
@@ -13,11 +14,11 @@
private IProject[] projects;
private Runnable callback;
public RegisterArchivesJob(IProject[] projects, Runnable callback) {
- super("Register Project Archives");
+ super(ArchivesCoreMessages.RegisterProject);
this.projects = projects;
this.callback = callback;
}
-
+
protected IStatus run(IProgressMonitor monitor) {
// register the projects
for( int i = 0; i < projects.length; i++ ) {
@@ -28,7 +29,7 @@
return status;
}
}
-
+
callback.run();
return Status.OK_STATUS;
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/SaveArchivesJob.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/SaveArchivesJob.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/SaveArchivesJob.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -6,6 +6,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
@@ -17,24 +18,24 @@
this(projectPath, null, null);
}
public SaveArchivesJob(IPath projectPath,Runnable runnable, String jobName) {
- super(jobName == null ? "Save Archives Job" : jobName);
+ super(jobName == null ? ArchivesCoreMessages.SaveArchivesJob : jobName);
this.runnable = runnable;
this.projectPath = projectPath;
}
protected IStatus run(IProgressMonitor monitor) {
- if( runnable != null ) {
+ if( runnable != null ) {
try {
runnable.run();
} catch( Exception e ) {
- IStatus status = new Status(IStatus.ERROR, ArchivesCorePlugin.PLUGIN_ID, "Problem executing pre-save runnable", e);
+ IStatus status = new Status(IStatus.ERROR, ArchivesCorePlugin.PLUGIN_ID, ArchivesCoreMessages.ErrorPreSave, e);
return status;
}
}
try {
ArchivesModel.instance().save(projectPath, new NullProgressMonitor());
} catch( ArchivesModelException ame ) {
- IStatus status = new Status(IStatus.ERROR, ArchivesCorePlugin.PLUGIN_ID, "Problem saving archives model", ame);
+ IStatus status = new Status(IStatus.ERROR, ArchivesCorePlugin.PLUGIN_ID, ArchivesCoreMessages.ErrorUpdatingModel, ame);
return status;
}
return Status.OK_STATUS;
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -39,31 +39,31 @@
/**
* This class will be responsible for loading extension points in the core.
- *
+ *
* @author Rob Stryker (rob.stryker(a)redhat.com)
*
*/
public class WorkspaceExtensionManager implements IExtensionManager {
- public static final String ARCHIVE_TYPES_EXTENSION_ID = "org.jboss.ide.eclipse.archives.core.archiveTypes";
- public static final String ACTION_TYPES_EXTENSION_ID = "org.jboss.ide.eclipse.archives.core.actionTypes";
- public static final String VARIABLE_PROVIDER_EXTENSION_ID = "org.jboss.ide.eclipse.archives.core.variableProviders";
-
+ public static final String ARCHIVE_TYPES_EXTENSION_ID = "org.jboss.ide.eclipse.archives.core.archiveTypes"; //$NON-NLS-1$
+ public static final String ACTION_TYPES_EXTENSION_ID = "org.jboss.ide.eclipse.archives.core.actionTypes"; //$NON-NLS-1$
+ public static final String VARIABLE_PROVIDER_EXTENSION_ID = "org.jboss.ide.eclipse.archives.core.variableProviders"; //$NON-NLS-1$
+
private IExtension[] findExtension (String extensionId) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(extensionId);
return extensionPoint.getExtensions();
}
-
+
private static Hashtable<String, IArchiveType> archiveTypes;
private void loadPackageTypes () {
archiveTypes = new Hashtable<String, IArchiveType>();
IExtension[] extensions = findExtension(ARCHIVE_TYPES_EXTENSION_ID);
-
+
for (int i = 0; i < extensions.length; i++) {
IConfigurationElement elements[] = extensions[i].getConfigurationElements();
for (int j = 0; j < elements.length; j++) {
try {
- Object executable = elements[j].createExecutableExtension("class");
+ Object executable = elements[j].createExecutableExtension("class"); //$NON-NLS-1$
IArchiveType type = (IArchiveType)executable;
archiveTypes.put(type.getId(), type);
} catch (InvalidRegistryObjectException e) {
@@ -74,7 +74,7 @@
}
}
}
-
+
public IArchiveType getArchiveType (String packageType) {
if (archiveTypes == null)
loadPackageTypes();
@@ -113,7 +113,7 @@
IConfigurationElement elements[] = extensions[i].getConfigurationElements();
for (int j = 0; j < elements.length; j++) {
try {
- Object executable = elements[j].createExecutableExtension("class");
+ Object executable = elements[j].createExecutableExtension("class"); //$NON-NLS-1$
IActionType type = (IActionType)executable;
actionTypes.put(type.getId(), type);
} catch (InvalidRegistryObjectException e) {
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -48,8 +48,8 @@
*
*/
public class WorkspacePreferenceManager extends AbstractPreferenceInitializer implements IPreferenceManager {
- public static final String AUTOMATIC_BUILDER_ENABLED = "org.jboss.ide.eclipse.archives.core.automaticBuilderEnabled";
- public static final String PROJECT_SPECIFIC_PREFS = "org.jboss.ide.eclipse.archives.core.projectSpecificPreferencesEnabled";
+ public static final String AUTOMATIC_BUILDER_ENABLED = "org.jboss.ide.eclipse.archives.core.automaticBuilderEnabled"; //$NON-NLS-1$
+ public static final String PROJECT_SPECIFIC_PREFS = "org.jboss.ide.eclipse.archives.core.projectSpecificPreferencesEnabled"; //$NON-NLS-1$
private static IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
private static IResource getResource(IPath path) {
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVFS.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVFS.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVFS.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -17,14 +17,14 @@
public class WorkspaceVFS implements IArchivesVFS, IDynamicVariableResolver {
public WorkspaceVFS() {
}
-
+
public IPath[] getWorkspaceChildren(IPath path) {
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if( res != null || !(res instanceof IContainer)) {
try {
IResource[] resources = ((IContainer)res).members();
IPath[] paths = new IPath[resources.length];
- for( int i = 0; i < resources.length; i++ )
+ for( int i = 0; i < resources.length; i++ )
paths[i] = resources[i].getFullPath();
return paths;
} catch( CoreException ce ) {
@@ -36,7 +36,7 @@
public IPath workspacePathToAbsolutePath(IPath path) {
IResource r = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
- IPath append = new Path("");
+ IPath append = new Path(""); //$NON-NLS-1$
while( r == null && path.segmentCount() > 0) {
append = new Path(path.lastSegment()).append(append);
path = path.removeLastSegments(1);
@@ -49,13 +49,13 @@
public String getProjectName(IPath absolutePath) {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for( int i = 0; i < projects.length; i++ )
+ for( int i = 0; i < projects.length; i++ )
if( projects[i].getLocation().equals(absolutePath))
return projects[i].getName();
return null;
}
-
+
private String currentProject;
public synchronized String performStringSubstitution(String expression,
String projectName, boolean reportUndefinedVariables)
@@ -63,7 +63,7 @@
// set this project name
if( expression == null )
return null;
-
+
currentProject = projectName;
try {
return VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(expression);
@@ -71,7 +71,7 @@
currentProject = null;
}
}
-
+
// Since the extension point re-instantiates this, we must delegate to the official instance
public String resolveValue(IDynamicVariable variable, String argument)
throws CoreException {
Deleted: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/AntActionType.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/AntActionType.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/AntActionType.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -1,55 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.archives.core.model.types;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.jboss.ide.eclipse.archives.core.model.IActionType;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveAction;
-
-/**
- * @author rob.stryker <rob.stryker(a)redhat.com>
- *
- */
-public class AntActionType implements IActionType, IExecutableExtension {
-
- private IConfigurationElement element;
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- if( element == null ) element = config;
- }
- public String getId() {
- return element.getAttribute("id");
- }
-
- public String getLabel() {
- return element.getAttribute("label");
- }
-
- public void execute(IArchiveAction action) {
- System.out.println("Ant Working!");
- }
-
- public String getStringRepresentation(IArchiveAction action) {
- return "Ant action";
- }
-}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -12,6 +12,7 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
@@ -25,20 +26,20 @@
*/
public class WorkspaceJARArchiveType extends AbstractArchiveType {
- public static final String TYPE_ID = "jar";
-
+ public static final String TYPE_ID = "jar"; //$NON-NLS-1$
+
public IArchive createDefaultConfiguration(String projectName, IProgressMonitor monitor) {
//IPackageType t = this;
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
Assert.isNotNull(project);
-
+
IJavaProject javaProject = JavaCore.create(project);
Assert.isNotNull(javaProject);
-
+
if (monitor == null) monitor = new NullProgressMonitor();
-
- monitor.beginTask("Creating default JAR configuration for java project \"" + project.getName() + "\"", 2);
-
+
+ monitor.beginTask(ArchivesCore.bind(ArchivesCoreMessages.CreatingDefaultJarConfig, project.getName()), 2);
+
IPath outputPath;
try {
outputPath = javaProject.getOutputLocation();
@@ -46,31 +47,31 @@
ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, e.getMessage(), e);
return null;
}
-
+
outputPath = outputPath.removeFirstSegments(1);
IContainer outputContainer = project.getFolder(outputPath);
-
- IArchive jar = new ArchiveImpl();
-
+
+ IArchive jar = new ArchiveImpl();
+
jar.setDestinationPath(project.getLocation());
jar.setInWorkspace(true);
jar.setExploded(false);
- jar.setName(project.getName() + ".jar");
+ jar.setName(project.getName() + ".jar"); //$NON-NLS-1$
jar.setArchiveType(this);
-
+
IArchiveFileSet classes = new ArchiveFileSetImpl();
- classes.setIncludesPattern("**/*");
+ classes.setIncludesPattern("**/*"); //$NON-NLS-1$
classes.setRawSourcePath(outputContainer.getFullPath().toString());
classes.setInWorkspace(true);
-
+
try {
jar.addChild(classes);
} catch( ArchivesModelException ame ) {
}
-
+
monitor.worked(1);
monitor.done();
-
+
return jar;
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -56,7 +56,7 @@
*/
public class ArchivesBuilder extends IncrementalProjectBuilder {
- public static final String BUILDER_ID = "org.jboss.ide.eclipse.archives.core.archivesBuilder";
+ public static final String BUILDER_ID = "org.jboss.ide.eclipse.archives.core.archivesBuilder"; //$NON-NLS-1$
/**
* Build.
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesNature.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesNature.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesNature.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -33,16 +33,16 @@
/**
* The nature associated with archives, specifically
* the builder is added or removed based on this nature.
- *
+ *
* @author Rob Stryker (rob.stryker(a)redhat.com)
*
*/
public class ArchivesNature implements IProjectNature {
- public static final String NATURE_ID = "org.jboss.ide.eclipse.archives.core.archivesNature";
-
+ public static final String NATURE_ID = "org.jboss.ide.eclipse.archives.core.archivesNature"; //$NON-NLS-1$
+
private IProject project;
-
+
public void configure() throws CoreException {
addProjectBuilder(project, ArchivesBuilder.BUILDER_ID);
}
@@ -58,24 +58,24 @@
public void setProject(IProject project) {
this.project = project;
}
-
+
public static boolean addProjectBuilder(IProject project, String builderId)
{
try
{
IProjectDescription desc = project.getDescription();
ICommand[] commands = desc.getBuildSpec();
-
+
//add builders to project
ICommand builderCommand = desc.newCommand();
builderCommand.setBuilderName(builderId);
-
+
ICommand[] newCommands = new ICommand[commands.length + 1];
System.arraycopy(commands, 0, newCommands, 0, commands.length);
newCommands[newCommands.length - 1] = builderCommand;
-
+
desc.setBuildSpec(newCommands);
-
+
project.setDescription(desc, new NullProgressMonitor());
}
catch (CoreException e)
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -1,27 +1,17 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
*
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.archives.core;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.jboss.ide.eclipse.archives.core.model.IArchivesLogger;
import org.jboss.ide.eclipse.archives.core.model.IExtensionManager;
import org.jboss.ide.eclipse.archives.core.model.IPreferenceManager;
@@ -34,28 +24,28 @@
*/
public abstract class ArchivesCore {
- public static final String PLUGIN_ID = "org.jboss.ide.eclipse.archives.core";
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.archives.core"; //$NON-NLS-1$
private static ArchivesCore instance;
// Due to classloader restrictions we won't be able to lazy load, but that should be ok as long
// as we keep the construction of ArchivesCore subclasses to a minimum
public static ArchivesCore getInstance() {
return instance;
}
-
+
public static void setInstance(ArchivesCore instance) {
ArchivesCore.instance = instance;
}
-
-
+
+
public static final int STANDALONE = 0;
public static final int WORKSPACE = 1;
-
+
private int runType;
private IArchivesVFS vfs;
private IExtensionManager extensionManager;
private IPreferenceManager preferenceManager;
private IArchivesLogger logger;
-
+
public ArchivesCore(int runType) {
this.runType = runType;
vfs = createVFS();
@@ -63,12 +53,12 @@
preferenceManager = createPreferenceManager();
logger = createLogger();
}
-
+
protected abstract IArchivesVFS createVFS();
protected abstract IExtensionManager createExtensionManager();
protected abstract IPreferenceManager createPreferenceManager();
protected abstract IArchivesLogger createLogger();
-
+
public int getRunType() {
return runType;
}
@@ -84,6 +74,29 @@
public IArchivesLogger getLogger() {
return logger;
}
-
+
public abstract void preRegisterProject(IPath project);
+
+ protected abstract String bind2(String message, Object[] bindings);
+
+
+
+ // Static convenience methods
+ public static String bind(String message, Object[] bindings) {
+ return ArchivesCore.getInstance().bind2(message, bindings);
+ }
+ public static String bind(String message, String binding1) {
+ return ArchivesCore.getInstance().bind2(message, new Object[]{binding1});
+ }
+ public static String bind(String message, String binding1, String binding2) {
+ return ArchivesCore.getInstance().bind2(message, new Object[]{binding1, binding2});
+ }
+
+ public static void log(IStatus status) {
+ ArchivesCore.getInstance().getLogger().log(status);
+ }
+ public static void log(int severity, String message,Throwable throwable) {
+ ArchivesCore.getInstance().getLogger().log(severity, message, throwable);
+ }
+
}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -0,0 +1,60 @@
+package org.jboss.ide.eclipse.archives.core;
+
+
+public class ArchivesCoreMessages {
+
+ public static String CleanedArchiveTrace;
+ public static String CleanedProjectTrace;
+ public static String FileRemovedTrace;
+ public static String UpdatedFileTrace;
+ public static String FinishedBuildingProjectTrace;
+ public static String FinishedBuildingArchiveTrace;
+ public static String FinishedCollectingFilesetTrace;
+ public static String StartedBuildingProjectTrace;
+ public static String StartedBuildingArchiveTrace;
+ public static String StartedCollectingFilesetTrace;
+
+
+ public static String RuntimeErrorDuringBuild;
+ public static String ProjectCannotBeBuilt;
+
+ public static String ErrorLocatingRootNode;
+ public static String BuildingProject;
+ public static String BuildingArchive;
+ public static String CreatingFolders;
+ public static String BuildingFilesets;
+ public static String CannotBuildBadConfiguration;
+ public static String CannotBuildOutputLocationNotWriteable;
+ public static String ErrorCreatingOutputFile;
+ public static String ProjectArchivesIncrementalBuild;
+
+ public static String ErrorUpdatingModel;
+ public static String ErrorUnmarshallingFile;
+ public static String ArchivesListenerError;
+ public static String CouldNotCreateScanner;
+ public static String ErrorAddChildNode;
+
+ public static String RemovingFileset;
+ public static String RemovingCountFiles;
+ public static String ErrorEmptyingFolder;
+ public static String ErrorCreatingFile;
+ public static String CopyingCountFiles;
+ public static String FileCopyFailed;
+ public static String DeletingCountFiles;
+ public static String FileDeleteFailed;
+ public static String VariableUndefined;
+
+ public static String KeyIsNull;
+ public static String ValueIsNull;
+
+ /*
+ * Eclipse
+ */
+ public static String RefreshProject;
+ public static String RefreshProjectFailed;
+ public static String RegisterProjectFailed;
+ public static String RegisterProject;
+ public static String ErrorPreSave;
+ public static String SaveArchivesJob;
+ public static String CreatingDefaultJarConfig;
+}
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.properties
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.properties (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCoreMessages.properties 2008-09-25 01:35:11 UTC (rev 10470)
@@ -0,0 +1,50 @@
+CleanedArchiveTrace=Cleaned archive {0}
+CleanedProjectTrace=Cleaned project {0}
+FileRemovedTrace=Removed {0} in {1} at {2}
+UpdatedFileTrace=Updated {0} in {1} at {2}
+FinishedBuildingProjectTrace=Finished building project {0}
+FinishedBuildingArchiveTrace=Finished building archive {0}
+FinishedCollectingFilesetTrace=Finished collecting fileset {0}
+StartedBuildingProjectTrace=Started building project {0}
+StartedBuildingArchiveTrace=Started building archive {0}
+StartedCollectingFilesetTrace=Started collecting fileset {0}
+
+RuntimeErrorDuringBuild=A runtime error has occurred during the build.
+ProjectCannotBeBuilt=Project {0} does not exist or has no .packages file. Skipping.
+
+ErrorLocatingRootNode=An error occurred locating the root node for {0}
+BuildingProject=Building project {0}
+BuildingArchive=Building archive {0}
+CreatingFolders=Creating folders
+BuildingFilesets=Building filesets
+CannotBuildBadConfiguration=Cannot build archive "{0}" due to a problem in the archive's configuration.
+CannotBuildOutputLocationNotWriteable=Cannot build archive "{0}. Output location {1} is not writeable.
+ErrorCreatingOutputFile=Error creating output file for node {0}
+ProjectArchivesIncrementalBuild=Project Archives Incremental Build
+ErrorUpdatingModel=Error updating model changes
+ErrorUnmarshallingFile=Error unmarshalling packages file {0}
+ArchivesListenerError=Archives listener error
+CouldNotCreateScanner=Could not create directory scanner
+ErrorAddChildNode=Error adding child node {0}
+
+RemovingFileset=Removing fileset: {0}
+RemovingCountFiles=Removing {0} files
+ErrorEmptyingFolder=Error emptying folder {0}
+ErrorCreatingFile=Error creating file {0}
+CopyingCountFiles=Copying {0} files
+FileCopyFailed=File copy failed. source={0} destination={1}
+DeletingCountFiles=Deleting {0} files
+FileDeleteFailed=Error deleting file {0}
+VariableUndefined=Variable {0} undefined
+
+KeyIsNull=Key is null in {0}
+ValueIsNull=Value is null in {0}
+
+# Eclipse
+RefreshProject=Refresh project {0}
+RefreshProjectFailed=Could not refresh project {0}
+RegisterProjectFailed=Could not register project {0}
+RegisterProject=Register Project
+SaveArchivesJob=Save archives job
+ErrorPreSave=Problem executing pre-save runnable
+CreatingDefaultJarConfig=Creating default JAR configuration for java project "{0}"
\ No newline at end of file
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntArchivesCore.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntArchivesCore.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntArchivesCore.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -6,6 +6,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.IActionType;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
@@ -14,6 +15,7 @@
import org.jboss.ide.eclipse.archives.core.model.IArchivesVFS;
import org.jboss.ide.eclipse.archives.core.model.IExtensionManager;
import org.jboss.ide.eclipse.archives.core.model.IPreferenceManager;
+import org.jboss.ide.eclipse.archives.core.xpl.AntNLS;
/**
* A core API entry point for ant.
@@ -21,6 +23,11 @@
*
*/
public class AntArchivesCore extends ArchivesCore {
+ static {
+ AntNLS.initializeMessages("org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages", ArchivesCoreMessages.class); //$NON-NLS-1$
+ }
+
+
private Project currentProject;
private Task currentTask;
public AntArchivesCore () {
@@ -28,6 +35,10 @@
ArchivesModel.instance().addBuildListener(new AntBuildListener());
}
+ protected String bind2(String message, Object[] bindings) {
+ return AntNLS.bind(message, bindings);
+ }
+
public void setProject(Project p) {
currentProject = p;
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntBuildListener.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntBuildListener.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntBuildListener.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -3,6 +3,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveBuildListener;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
@@ -11,53 +12,55 @@
public class AntBuildListener implements IArchiveBuildListener {
public void buildFailed(IArchive pkg, IStatus status) {
- ArchivesCore.getInstance().getLogger().log(status);
+ ArchivesCore.log(status);
}
public void error(IArchiveNode node, IStatus[] multi) {
for( int i = 0; i < multi.length; i++ ) {
- ArchivesCore.getInstance().getLogger().log(multi[i]);
+ ArchivesCore.log(multi[i]);
}
}
public void cleanArchive(IArchive pkg) {
- ArchivesCore.getInstance().getLogger().log(IStatus.INFO, "Cleaned archive " + pkg.getName(), null);
+ ArchivesCore.log(IStatus.INFO, ArchivesCore.bind(ArchivesCoreMessages.CleanedArchiveTrace,pkg.getName()), null);
}
public void cleanProject(IPath project) {
- ArchivesCore.getInstance().getLogger().log(IStatus.INFO, "Cleaned project " + project, null);
+ ArchivesCore.log(IStatus.INFO,ArchivesCore.bind(ArchivesCoreMessages.CleanedProjectTrace, project.toString()),null);
}
public void fileRemoved(IArchive topLevelArchive, IArchiveFileSet fileset,
IPath filePath) {
FileWrapper[] wrappers = fileset.getMatches(filePath);
for( int i = 0; i < wrappers.length; i++ ) {
- ArchivesCore.getInstance().getLogger().log(IStatus.OK, "Removed " + filePath + " in " + topLevelArchive.getName()
- + " at " + wrappers[i].getRootArchiveRelative().toString(), null);
+ String s = ArchivesCore.bind(ArchivesCoreMessages.FileRemovedTrace,
+ new Object[] {filePath, topLevelArchive.getName(), wrappers[i].getRootArchiveRelative().toString()});
+ ArchivesCore.log(IStatus.OK, s, null);
}
}
public void fileUpdated(IArchive topLevelArchive, IArchiveFileSet fileset,
IPath filePath) {
FileWrapper[] wrappers = fileset.getMatches(filePath);
for( int i = 0; i < wrappers.length; i++ ) {
- ArchivesCore.getInstance().getLogger().log(IStatus.OK, "Updated " + filePath + " in " + topLevelArchive.getName()
- + " at " + wrappers[i].getRootArchiveRelative().toString(), null);
+ String s = ArchivesCore.bind(ArchivesCoreMessages.UpdatedFileTrace,
+ new Object[] {filePath, topLevelArchive.getName(), wrappers[i].getRootArchiveRelative().toString()});
+ ArchivesCore.log(IStatus.OK, s, null);
}
}
public void finishedBuild(IPath project) {
- ArchivesCore.getInstance().getLogger().log(IStatus.INFO, "Finished building " + project.toString(), null);
+ ArchivesCore.log(IStatus.INFO, ArchivesCore.bind(ArchivesCoreMessages.FinishedBuildingProjectTrace,project.toString()), null);
}
public void finishedBuildingArchive(IArchive pkg) {
- ArchivesCore.getInstance().getLogger().log(IStatus.INFO, "Finished building archive " + pkg.getRootArchiveRelativePath(), null);
+ ArchivesCore.log(IStatus.INFO, ArchivesCore.bind(ArchivesCoreMessages.FinishedBuildingArchiveTrace,pkg.getRootArchiveRelativePath().toString()), null);
}
public void finishedCollectingFileSet(IArchiveFileSet fileset) {
- ArchivesCore.getInstance().getLogger().log(IStatus.INFO, "Finished collecting fileset " + fileset.toString(), null);
+ ArchivesCore.log(IStatus.INFO, ArchivesCore.bind(ArchivesCoreMessages.FinishedCollectingFilesetTrace, fileset.toString()), null);
}
public void startedBuild(IPath project) {
- ArchivesCore.getInstance().getLogger().log(IStatus.INFO, "Started building project " + project.toString(), null);
+ ArchivesCore.log(IStatus.INFO, ArchivesCore.bind(ArchivesCoreMessages.StartedBuildingProjectTrace,project.toString()), null);
}
public void startedBuildingArchive(IArchive pkg) {
- ArchivesCore.getInstance().getLogger().log(IStatus.INFO, "Started building archive " + pkg.toString(), null);
+ ArchivesCore.log(IStatus.INFO, ArchivesCore.bind(ArchivesCoreMessages.StartedBuildingArchiveTrace, pkg.toString()), null);
}
public void startedCollectingFileSet(IArchiveFileSet fileset) {
- ArchivesCore.getInstance().getLogger().log(IStatus.INFO, "Started collecting fileset " + fileset.toString(), null);
+ ArchivesCore.log(IStatus.INFO, ArchivesCore.bind(ArchivesCoreMessages.StartedCollectingFilesetTrace, fileset.toString()), null);
}
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVFS.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVFS.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVFS.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -12,6 +12,7 @@
import org.jboss.ide.eclipse.archives.core.xpl.StringSubstitutionEngineClone;
public class AntVFS implements IArchivesVFS, IVariableManager {
+ public static final String SUFFIX = ".dir"; //$NON-NLS-1$
private String currentProject;
public String performStringSubstitution(String expression,
boolean reportUndefinedVariables) throws CoreException {
@@ -30,7 +31,7 @@
if( ((AntArchivesCore)ArchivesCore.getInstance()).getProject().getProperty(variable) != null ) return true;
return false;
}
-
+
public String getVariableValue(String variable) {
if( IVariableManager.CURRENT_PROJECT.equals(variable))
return currentProject;
@@ -40,7 +41,7 @@
public IPath[] getWorkspaceChildren(IPath path) {
ArrayList<IPath> list = new ArrayList<IPath>();
IPath pathAbsolute = workspacePathToAbsolutePath(path);
-
+
if( pathAbsolute != null && pathAbsolute.toFile().exists() ) {
String[] children = pathAbsolute.toFile().list();
for( int i = 0; i < children.length; i++ ) {
@@ -52,9 +53,9 @@
}
public IPath workspacePathToAbsolutePath(IPath path) {
if( path.segmentCount() > 0 && path.segment(0) != null ) {
- String projNameProperty = path.segment(0) + ".dir";
+ String projNameProperty = path.segment(0) + SUFFIX;
Object result = ((AntArchivesCore)ArchivesCore.getInstance()).getProject().getProperties().get(projNameProperty);
- if( result != null && result instanceof String)
+ if( result != null && result instanceof String)
return new Path((String)result).append(path.removeFirstSegments(1));
}
return null;
@@ -63,10 +64,10 @@
public String getProjectName(IPath absolutePath) {
for (Iterator iter = ((AntArchivesCore)ArchivesCore.getInstance()).getProject().getProperties().keySet().iterator(); iter.hasNext(); ) {
String property = (String) iter.next();
- if (property.endsWith(".dir")) {
+ if (property.endsWith(SUFFIX)) {
String val = ((AntArchivesCore)ArchivesCore.getInstance()).getProject().getProperty(property);
if( val != null && new Path(val).equals(absolutePath)) {
- return property.substring(0, property.lastIndexOf("."));
+ return property.substring(0, property.lastIndexOf('.'));
}
}
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -31,6 +31,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
@@ -61,7 +62,7 @@
for (Iterator iter = getProject().getProperties().keySet().iterator(); iter.hasNext(); ) {
String property = (String) iter.next();
- if (property.endsWith(".dir")) {
+ if (property.endsWith(AntVFS.SUFFIX)) {
System.setProperty(property, getProject().getProperty(property));
}
}
@@ -73,10 +74,11 @@
ArchivesModel.instance().registerProject(projectPath, monitor);
new ArchiveBuildDelegate().fullProjectBuild(projectPath, new NullProgressMonitor());
} else {
- getCore().getLogger().log(IStatus.ERROR, "Project \"" + projectPath + "\" does not exist or has no .packages file. Skipping.", null);
+ getCore().log(IStatus.ERROR,
+ getCore().bind(ArchivesCoreMessages.ProjectCannotBeBuilt, projectPath.toString()), null);
}
} catch(RuntimeException e ) {
- getCore().getLogger().log(IStatus.ERROR, "A runtime error has occurred during build.", e);
+ getCore().getLogger().log(IStatus.ERROR, ArchivesCoreMessages.RuntimeErrorDuringBuild, e);
}
finally {
Thread.currentThread().setContextClassLoader(original);
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/asf/DirectoryScanner.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/asf/DirectoryScanner.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/asf/DirectoryScanner.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -18,12 +18,12 @@
/*
- * This file has been CHANGED, MODIFIED, EDITED.
+ * This file has been CHANGED, MODIFIED, EDITED.
* It has been coppied because list(File file) is
* a private method and is not able to be overridden.
- *
- * For archives, we need to be able to delegate to
- * the eclipse VFS / resource model.
+ *
+ * For archives, we need to be able to delegate to
+ * the eclipse VFS / resource model.
* rob.stryker(a)redhat.com
*/
package org.jboss.ide.eclipse.archives.core.asf;
@@ -133,11 +133,17 @@
* files in all proper subdirectories of a directory called "modules"
*
*/
+
+/*
+ * Note: This class ideally should be translated, but since
+ * it was stolen from ant, I'd rather leave it as close to the ant
+ * version as possible.
+ */
public class DirectoryScanner
implements FileScanner, SelectorScanner, ResourceFactory {
/** Is OpenVMS the operating system we're running on? */
- private static final boolean ON_VMS = Os.isFamily("openvms");
+ private static final boolean ON_VMS = Os.isFamily("openvms");//$NON-NLS-1$
/**
* Patterns which should be excluded by default.
@@ -153,30 +159,30 @@
*/
protected static final String[] DEFAULTEXCLUDES = {
// Miscellaneous typical temporary files
- "**/*~",
- "**/#*#",
- "**/.#*",
- "**/%*%",
- "**/._*",
+ "**/*~", //$NON-NLS-1$
+ "**/#*#",//$NON-NLS-1$
+ "**/.#*",//$NON-NLS-1$
+ "**/%*%",//$NON-NLS-1$
+ "**/._*",//$NON-NLS-1$
// CVS
- "**/CVS",
- "**/CVS/**",
- "**/.cvsignore",
+ "**/CVS",//$NON-NLS-1$
+ "**/CVS/**",//$NON-NLS-1$
+ "**/.cvsignore",//$NON-NLS-1$
// SCCS
- "**/SCCS",
- "**/SCCS/**",
+ "**/SCCS",//$NON-NLS-1$
+ "**/SCCS/**",//$NON-NLS-1$
// Visual SourceSafe
- "**/vssver.scc",
+ "**/vssver.scc",//$NON-NLS-1$
// Subversion
- "**/.svn",
- "**/.svn/**",
+ "**/.svn",//$NON-NLS-1$
+ "**/.svn/**",//$NON-NLS-1$
// Mac
- "**/.DS_Store"
+ "**/.DS_Store"//$NON-NLS-1$
};
/** Helper. */
@@ -732,7 +738,7 @@
String pattern = p.replace('/', File.separatorChar)
.replace('\\', File.separatorChar);
if (pattern.endsWith(File.separator)) {
- pattern += "**";
+ pattern += "**";//$NON-NLS-1$
}
return pattern;
}
@@ -791,7 +797,7 @@
// set in/excludes to reasonable defaults if needed:
boolean nullIncludes = (includes == null);
- includes = nullIncludes ? new String[] {"**"} : includes;
+ includes = nullIncludes ? new String[] {"**"} : includes;//$NON-NLS-1$
boolean nullExcludes = (excludes == null);
excludes = nullExcludes ? new String[0] : excludes;
@@ -802,29 +808,29 @@
}
} else {
if (!basedir.exists()) {
- illegal = new IllegalStateException("basedir " + basedir
- + " does not exist");
+ illegal = new IllegalStateException("basedir " + basedir//$NON-NLS-1$
+ + " does not exist");//$NON-NLS-1$
}
if (!basedir.isDirectory()) {
- illegal = new IllegalStateException("basedir " + basedir
- + " is not a directory");
+ illegal = new IllegalStateException("basedir " + basedir//$NON-NLS-1$
+ + " is not a directory");//$NON-NLS-1$
}
if (illegal != null) {
throw illegal;
}
}
- if (isIncluded("")) {
- if (!isExcluded("")) {
- if (isSelected("", basedir)) {
- dirsIncluded.addElement("");
+ if (isIncluded("")) {//$NON-NLS-1$
+ if (!isExcluded("")) {//$NON-NLS-1$
+ if (isSelected("", basedir)) {//$NON-NLS-1$
+ dirsIncluded.addElement("");//$NON-NLS-1$
} else {
- dirsDeselected.addElement("");
+ dirsDeselected.addElement("");//$NON-NLS-1$
}
} else {
- dirsExcluded.addElement("");
+ dirsExcluded.addElement("");//$NON-NLS-1$
}
} else {
- dirsNotIncluded.addElement("");
+ dirsNotIncluded.addElement("");//$NON-NLS-1$
}
checkIncludePatterns();
clearCaches();
@@ -863,9 +869,9 @@
newroots.put(SelectorUtils.rtrimWildcardTokens(
includes[i]), includes[i]);
}
- if (newroots.containsKey("") && basedir != null) {
+ if (newroots.containsKey("") && basedir != null) {//$NON-NLS-1$
// we are going to scan everything anyway
- scandir(basedir, "", true);
+ scandir(basedir, "", true);//$NON-NLS-1$
} else {
// only scan directories that can include matched files or
// directories
@@ -998,7 +1004,7 @@
// set in/excludes to reasonable defaults if needed:
boolean nullIncludes = (includes == null);
- includes = nullIncludes ? new String[] {"**"} : includes;
+ includes = nullIncludes ? new String[] {"**"} : includes;//$NON-NLS-1$
boolean nullExcludes = (excludes == null);
excludes = nullExcludes ? new String[0] : excludes;
@@ -1054,19 +1060,19 @@
*/
protected void scandir(File dir, String vpath, boolean fast) {
if (dir == null) {
- throw new BuildException("dir must not be null.");
+ throw new BuildException("dir must not be null.");//$NON-NLS-1$
} else if (!dir.exists()) {
- throw new BuildException(dir + " doesn't exist.");
+ throw new BuildException(dir + " doesn't exist.");//$NON-NLS-1$
} else if (!dir.isDirectory()) {
- throw new BuildException(dir + " is not a directory.");
+ throw new BuildException(dir + " is not a directory.");//$NON-NLS-1$
}
// avoid double scanning of directories, can only happen in fast mode
if (fast && hasBeenScanned(vpath)) {
return;
}
-
+
// LINE MODIFIED FOR JBOSS TOOLS; was dir.list();
- File[] newfiles = list(dir);
+ File[] newfiles = list(dir);
if (newfiles == null) {
/*
@@ -1076,8 +1082,8 @@
* (2) an IO error occurred (why doesn't it throw an exception
* then???)
*/
- throw new BuildException("IO error scanning directory '"
- + dir.getAbsolutePath() + "'");
+ throw new BuildException("IO error scanning directory '"//$NON-NLS-1$
+ + dir.getAbsolutePath() + "'");//$NON-NLS-1$
}
if (!followSymlinks) {
Vector<File> noLinks = new Vector<File>();
@@ -1092,8 +1098,8 @@
noLinks.addElement(newfiles[i]);
}
} catch (IOException ioe) {
- String msg = "IOException caught while checking "
- + "for links, couldn't get canonical path!";
+ String msg = "IOException caught while checking "//$NON-NLS-1$
+ + "for links, couldn't get canonical path!";//$NON-NLS-1$
// will be caught and redirected to Ant's logging system
System.err.println(msg);
noLinks.addElement(newfiles[i]);
@@ -1131,7 +1137,7 @@
protected String getName(File file) {
return file.getName();
}
-
+
/**
* Process included file.
* @param name path of the file relative to the directory of the FileSet.
@@ -1176,7 +1182,7 @@
protected void postInclude(File f, String name) {
// do nothing
}
-
+
protected void postExclude(File f, String name) {
// do nothing
}
@@ -1234,7 +1240,7 @@
private boolean isDeeper(String pattern, String name) {
Vector p = SelectorUtils.tokenizePath(pattern);
Vector n = SelectorUtils.tokenizePath(name);
- return p.contains("**") || p.size() > n.size();
+ return p.contains("**") || p.size() > n.size();//$NON-NLS-1$
}
/**
@@ -1254,7 +1260,7 @@
* @since Ant 1.6
*/
private boolean isMorePowerfulThanExcludes(String name, String includepattern) {
- String soughtexclude = name + File.separator + "**";
+ String soughtexclude = name + File.separator + "**";//$NON-NLS-1$
for (int counter = 0; counter < excludes.length; counter++) {
if (excludes[counter].equals(soughtexclude)) {
return false;
@@ -1272,7 +1278,7 @@
name = (name.endsWith(File.separator)) ? name : name + File.separator;
for (int i = 0; i < excludes.length; i++) {
String e = excludes[i];
- if (e.endsWith("**") && SelectorUtils.matchPath(
+ if (e.endsWith("**") && SelectorUtils.matchPath(//$NON-NLS-1$
e.substring(0, e.length() - 2), name, isCaseSensitive())) {
return true;
}
@@ -1333,7 +1339,7 @@
*/
public synchronized String[] getIncludedFiles() {
if (filesIncluded == null) {
- throw new IllegalStateException("Must call scan() first");
+ throw new IllegalStateException("Must call scan() first");//$NON-NLS-1$
}
String[] files = new String[filesIncluded.size()];
filesIncluded.copyInto(files);
@@ -1348,7 +1354,7 @@
*/
public synchronized int getIncludedFilesCount() {
if (filesIncluded == null) {
- throw new IllegalStateException("Must call scan() first");
+ throw new IllegalStateException("Must call scan() first");//$NON-NLS-1$
}
return filesIncluded.size();
}
@@ -1416,7 +1422,7 @@
*/
public synchronized String[] getIncludedDirectories() {
if (dirsIncluded == null) {
- throw new IllegalStateException("Must call scan() first");
+ throw new IllegalStateException("Must call scan() first");//$NON-NLS-1$
}
String[] directories = new String[dirsIncluded.size()];
dirsIncluded.copyInto(directories);
@@ -1431,7 +1437,7 @@
*/
public synchronized int getIncludedDirsCount() {
if (dirsIncluded == null) {
- throw new IllegalStateException("Must call scan() first");
+ throw new IllegalStateException("Must call scan() first");//$NON-NLS-1$
}
return dirsIncluded.size();
}
@@ -1541,7 +1547,7 @@
protected File[] list2(File file) {
return file.listFiles();
}
-
+
/**
* From <code>base</code> traverse the filesystem in order to find
* a file that matches the given name.
@@ -1596,7 +1602,7 @@
}
File[] files = list(base);
if (files == null) {
- throw new BuildException("IO error scanning directory "
+ throw new BuildException("IO error scanning directory "//$NON-NLS-1$
+ base.getAbsolutePath());
}
boolean[] matchCase = cs ? CS_SCAN_ONLY : CS_THEN_NON_CS;
@@ -1636,8 +1642,8 @@
return FILE_UTILS.isSymbolicLink(base, current)
|| isSymlink(new File(base, current), pathElements);
} catch (IOException ioe) {
- String msg = "IOException caught while checking "
- + "for links, couldn't get canonical path!";
+ String msg = "IOException caught while checking "//$NON-NLS-1$
+ + "for links, couldn't get canonical path!";//$NON-NLS-1$
// will be caught and redirected to Ant's logging system
System.err.println(msg);
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -33,6 +33,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.EventManager;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
@@ -72,14 +73,16 @@
IArchiveModelRootNode root = ArchivesModel.instance().getRoot(project);
if( root == null ) {
- IStatus s = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, "An error occurred locating the root node for " + project.toOSString(), null);
+ IStatus s = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
+ ArchivesCore.bind(ArchivesCoreMessages.ErrorLocatingRootNode, project.toOSString()), null);
EventManager.error(null, new IStatus[]{s});
monitor.done();
} else {
IArchiveNode[] nodes = root.getChildren(IArchiveNode.TYPE_ARCHIVE);
ArrayList<IStatus> errors = new ArrayList<IStatus>();
- monitor.beginTask("Building project " + ArchivesCore.getInstance().getVFS().getProjectName(project), nodes.length * 1000);
+ monitor.beginTask( ArchivesCore.bind(ArchivesCoreMessages.BuildingProject,
+ ArchivesCore.getInstance().getVFS().getProjectName(project)), nodes.length * 1000);
for( int i = 0; i < nodes.length; i++ ) {
errors.addAll(Arrays.asList(fullArchiveBuild(((IArchive)nodes[i]),
@@ -102,8 +105,7 @@
protected IStatus[] fullArchiveBuild(IArchive pkg, IProgressMonitor monitor, boolean log) {
if( !pkg.canBuild() ) {
IStatus s = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
- "Cannot Build archive \"" + pkg.getName() +
- "\" due to a problem in the archive's configuration.", null);
+ ArchivesCore.bind(ArchivesCoreMessages.CannotBuildBadConfiguration, pkg.getName()), null);
if( log )
EventManager.error(pkg, new IStatus[]{s});
monitor.done();
@@ -118,9 +120,8 @@
if( dest != null && !dest.toFile().exists() ) {
if( !dest.toFile().mkdirs() ) {
IStatus s = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
- "Cannot Build archive \"" + pkg.getName() +
- "\". Output location " + dest +
- " is not writeable", null);
+ ArchivesCore.bind(ArchivesCoreMessages.CannotBuildOutputLocationNotWriteable,
+ pkg.getName(), dest.toString()), null);
if( log )
EventManager.error(pkg, new IStatus[]{s});
monitor.done();
@@ -135,7 +136,8 @@
* create folders: 800
* build filesets: 7000
*/
- monitor.beginTask("Building Archive " + pkg.toString(), 8000);
+ monitor.beginTask(ArchivesCore.bind(
+ ArchivesCoreMessages.BuildingArchive, pkg.toString()), 8000);
// Run the pre actions
// IArchiveAction[] actions = pkg.getActions();
@@ -147,7 +149,8 @@
if( !ModelTruezipBridge.createFile(pkg) ) {
- IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, "Error creating output file for node " + pkg.toString());
+ IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
+ ArchivesCore.bind(ArchivesCoreMessages.ErrorCreatingOutputFile,pkg.toString()));
errors.add(e);
}
monitor.worked(200);
@@ -155,10 +158,10 @@
// force create all folders
IArchiveFolder[] folders = ModelUtil.findAllDescendentFolders(pkg);
IProgressMonitor folderMonitor = new SubProgressMonitor(monitor, 800);
- folderMonitor.beginTask("Creating folders", folders.length * 100);
+ folderMonitor.beginTask(ArchivesCoreMessages.CreatingFolders, folders.length * 100);
for( int i = 0; i < folders.length; i++ ) {
if( !ModelTruezipBridge.createFile(folders[i])) {
- IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, "Error creating output file for node " + folders[i].toString());
+ IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, ArchivesCore.bind(ArchivesCoreMessages.ErrorCreatingOutputFile,folders[i].toString()));
errors.add(e);
}
folderMonitor.worked(100);
@@ -168,7 +171,7 @@
// build the filesets
IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(pkg);
IProgressMonitor filesetMonitor = new SubProgressMonitor(monitor, 7000);
- filesetMonitor.beginTask("Building filesets", filesets.length * 1000);
+ filesetMonitor.beginTask(ArchivesCoreMessages.BuildingFilesets, filesets.length * 1000);
for( int i = 0; i < filesets.length; i++ ) {
IStatus[] errors2 = fullFilesetBuild(filesets[i], new SubProgressMonitor(filesetMonitor, 1000), pkg);
errors.addAll(Arrays.asList(errors2));
@@ -223,7 +226,7 @@
// removed get more work because all filesets are being rescanned before handling the removed
int totalWork = (addedChanged.size()*100) + (removed.size()*200) + 50;
- monitor.beginTask("Project Archives Incremental Build", totalWork);
+ monitor.beginTask(ArchivesCoreMessages.ProjectArchivesIncrementalBuild, totalWork);
// find any and all filesets that match each file
Iterator<IPath> i;
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -29,6 +29,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.EventManager;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
@@ -69,7 +70,7 @@
try {
errors = handle(delta);
} catch( Exception e ) {
- IStatus er = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, "Error updating model changes", e);
+ IStatus er = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, ArchivesCoreMessages.ErrorUpdatingModel, e);
errors = new IStatus[] { er };
}
IArchiveNode node = delta.getPreNode() == null ? delta.getPostNode() : delta.getPreNode();
@@ -257,8 +258,7 @@
protected IStatus logCannotBuildError(IArchive archive) {
IStatus s = new Status(IStatus.WARNING, ArchivesCore.PLUGIN_ID,
- "Cannot Build archive \"" + archive.getName() +
- "\" due to a problem in the archive's configuration.", null);
+ ArchivesCore.bind(ArchivesCoreMessages.CannotBuildBadConfiguration, archive.getName()), null);
return s;
}
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -31,6 +31,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveModelNode;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
@@ -190,7 +191,8 @@
packages = XMLBinding.unmarshal(packagesFile.toFile(), monitor);
} catch( XbException xbe ) {
// Empty / non-working XML file loaded
- ArchivesCore.getInstance().getLogger().log(IStatus.ERROR, "Error unmarshalling packages file " + packagesFile, xbe);
+ ArchivesCore.getInstance().getLogger().log(IStatus.ERROR,
+ ArchivesCore.bind(ArchivesCoreMessages.ErrorUnmarshallingFile, packagesFile.toString()), xbe);
return null;
}
} else {
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -29,7 +29,6 @@
import org.eclipse.core.runtime.Path;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.asf.DirectoryScanner;
-import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
import org.jboss.ide.eclipse.archives.core.util.PathUtils;
/**
@@ -48,16 +47,16 @@
};
public static DirectoryScannerExtension createDirectoryScanner(IArchiveFileSet fs, boolean scan) {
- return createDirectoryScanner(fs.getRawSourcePath(), fs.getRootArchiveRelativePath(),
- fs.getIncludesPattern(), fs.getExcludesPattern(), fs.getProjectName(),
+ return createDirectoryScanner(fs.getRawSourcePath(), fs.getRootArchiveRelativePath(),
+ fs.getIncludesPattern(), fs.getExcludesPattern(), fs.getProjectName(),
fs.isInWorkspace(), fs.getDescriptorVersion(), scan);
}
-
+
public static DirectoryScannerExtension createDirectoryScanner (
- String rawPath, IPath rootArchiveRelativePath,
- String includes, String excludes, String projectName,
+ String rawPath, IPath rootArchiveRelativePath,
+ String includes, String excludes, String projectName,
boolean inWorkspace, double version, boolean scan) {
-
+
ScannableFileSet fs = new ScannableFileSet();
fs.rawPath = rawPath;
fs.rootArchiveRelativePath = rootArchiveRelativePath;
@@ -73,12 +72,12 @@
return scanner;
}
-
+
/**
* Exposes the isIncluded method so that entire scans do not need to occur
- * to find matches.
- *
- * Overwrites
+ * to find matches.
+ *
+ * Overwrites
*/
public static class DirectoryScannerExtension extends DirectoryScanner {
protected boolean workspaceRelative;
@@ -87,10 +86,10 @@
protected HashMap<String, ArrayList<FileWrapper>> matchesMap;
public DirectoryScannerExtension(ScannableFileSet fs) {
this.fs = fs;
- String includes = fs.includes == null ? "" : fs.includes;
- String excludes = fs.excludes == null ? "" : fs.excludes;
- String includesList[] = includes.split(" ?, ?");
- String excludesList[] = excludes.split(" ?, ?");
+ String includes = fs.includes == null ? "" : fs.includes; //$NON-NLS-1$
+ String excludes = fs.excludes == null ? "" : fs.excludes; //$NON-NLS-1$
+ String includesList[] = includes.split(" ?, ?"); //$NON-NLS-1$
+ String excludesList[] = excludes.split(" ?, ?"); //$NON-NLS-1$
setExcludes(excludesList);
setIncludes(includesList);
workspaceRelative = fs.inWorkspace;
@@ -98,10 +97,10 @@
matchesMap = new HashMap<String, ArrayList<FileWrapper>>();
setBasedir2(fs.rawPath);
}
-
+
public void setBasedir2(String path) {
-
- IPath translatedPath = new Path(PathUtils.getAbsoluteLocation(path, fs.projectName, fs.inWorkspace, fs.version));
+
+ IPath translatedPath = new Path(PathUtils.getAbsoluteLocation(path, fs.projectName, fs.inWorkspace, fs.version));
if( workspaceRelative ) {
IPath p = PathUtils.getGlobalLocation(path, fs.projectName, true, fs.version);
setBasedir(new FileWrapper(p.toFile(), translatedPath));
@@ -113,20 +112,20 @@
protected String getName(File file) {
return workspaceRelative ? ((FileWrapper)file).getOutputName() : super.getName(file);
}
-
+
/* Only used when workspace relative! */
protected File[] list2(File file) {
- if( fs.inWorkspace )
+ if( fs.inWorkspace )
return list2workspace(file);
else
return list2absolute(file);
}
-
+
protected File[] list2workspace(File file) {
- IPath workspaceRelative = ((FileWrapper)file).getWrapperPath();
+ IPath workspaceRelative = ((FileWrapper)file).getWrapperPath();
if( workspaceRelative == null )
return new File[0];
-
+
IPath[] childrenWorkspace = ArchivesCore.getInstance()
.getVFS().getWorkspaceChildren(workspaceRelative);
IPath[] childrenAbsolute = globalize(childrenWorkspace);
@@ -136,7 +135,7 @@
}
return files;
}
-
+
protected IPath[] globalize(IPath[] paths) {
IPath[] results = new IPath[paths.length];
for( int i = 0; i < paths.length; i++ )
@@ -144,7 +143,7 @@
.getVFS().workspacePathToAbsolutePath(paths[i]);
return results;
}
-
+
protected File[] list2absolute(File file) {
File[] children = file.listFiles();
FileWrapper[] children2 = new FileWrapper[children.length];
@@ -165,7 +164,7 @@
matchesMap.put(((FileWrapper)f).getAbsolutePath(), l);
}
l.add(f2);
- }
+ }
}
}
@@ -173,21 +172,21 @@
public FileWrapper[] getMatchedArray() {
return (FileWrapper[]) matches.toArray(new FileWrapper[matches.size()]);
}
-
+
public HashMap<String, ArrayList<FileWrapper>> getMatchedMap() {
return matchesMap;
}
-
+
public class FileWrapper extends File {
// The actual source file
File f;
-
+
// The path of this file, either workspace relative or global
IPath path;
-
+
// the path of this file relative to the fileset
String fsRelative;
-
+
public FileWrapper(File delegate, IPath path2) {
super(delegate.getAbsolutePath());
f = delegate;
@@ -203,17 +202,17 @@
public String getFilesetRelative() {
return fsRelative;
}
-
+
void setFilesetRelative(String s) {
fsRelative = s;
}
-
+
public IPath getRootArchiveRelative() {
if( fs.rootArchiveRelativePath != null )
return fs.rootArchiveRelativePath.append(fsRelative);
return null;
}
-
+
public boolean equals(Object o) {
if( o instanceof FileWrapper ) {
FileWrapper fo = (FileWrapper)o;
@@ -222,7 +221,7 @@
return false;
}
}
-
+
public boolean couldBeIncluded(String name, boolean inWorkspace) {
return super.isIncluded(name) && !super.isExcluded(name);
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/EventManager.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/EventManager.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/EventManager.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -25,6 +25,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
/**
@@ -210,12 +211,6 @@
}
protected static void logError(Exception e) {
- e.printStackTrace();
- try {
- StackTraceElement[] trace = Thread.currentThread().getStackTrace();
- ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, "Archives Listener error in " + trace[1].getMethodName(), e);
- } catch( Exception f ) {
- ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, "Archives Listener error", e);
- }
+ ArchivesCore.log(IStatus.WARNING, ArchivesCoreMessages.ArchivesListenerError, e);
}
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchive.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchive.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchive.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -23,50 +23,50 @@
import org.eclipse.core.runtime.IPath;
-/**
+/**
* <p>
* This interface represents an archive definition.
* An archive definition consists of a list of folders, filesets, and sub-packages
* </p>
- *
+ *
* @author <a href="marshall(a)jboss.org">Marshall Culpepper</a>
* @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
* @version $Revision: 1939 $
*/
public interface IArchive extends INamedContainerArchiveNode {
- public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackage.";
- public static final String PACKAGE_TYPE_ATTRIBUTE = ATTRIBUTE_PREFIX + "packageType";
- public static final String EXPLODED_ATTRIBUTE = ATTRIBUTE_PREFIX + "exploded";
- public static final String DESTINATION_ATTRIBUTE = ATTRIBUTE_PREFIX + "destination";
- public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace";
-
+ public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackage."; //$NON-NLS-1$
+ public static final String PACKAGE_TYPE_ATTRIBUTE = ATTRIBUTE_PREFIX + "packageType"; //$NON-NLS-1$
+ public static final String EXPLODED_ATTRIBUTE = ATTRIBUTE_PREFIX + "exploded"; //$NON-NLS-1$
+ public static final String DESTINATION_ATTRIBUTE = ATTRIBUTE_PREFIX + "destination"; //$NON-NLS-1$
+ public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace"; //$NON-NLS-1$
+
/**
* @return The package type of this package.
*/
public IArchiveType getArchiveType();
-
+
/**
* return the raw string from the delegate even if the type is not found
* @return
*/
public String getArchiveTypeId();
-
+
/**
* @return Whether or not this package will be build exploded, or as a directory instead of a ZIP/JAR
*/
public boolean isExploded();
-
+
/**
- * @return Whether or not this package is a "top-level" package
+ * @return Whether or not this package is a "top-level" package
* aka, not a child of another folder or package
* IOW: The parent must be null or a model node
*/
public boolean isTopLevel();
-
+
/**
- * If this package is top-level, there are two types of destinations it can have.
- * "Inside" the workspace, and "outside" the workspace.
+ * If this package is top-level, there are two types of destinations it can have.
+ * "Inside" the workspace, and "outside" the workspace.
* @return Whether or not the destination of this package is in the workspace
*/
public boolean isDestinationInWorkspace();
@@ -91,7 +91,7 @@
public void setArchiveType(IArchiveType type);
/**
- * Set the package type via ID.
+ * Set the package type via ID.
* @param type
*/
public void setArchiveType(String type);
@@ -101,20 +101,20 @@
* @param exploded
*/
public void setExploded(boolean exploded);
-
+
/**
* Sets the destination path for this package.
* In workspace paths are relative to workspace root.
* Out of workspace paths are file-system absolute
- * @param path The path where this archive will be built.
+ * @param path The path where this archive will be built.
*/
public void setDestinationPath (IPath path);
-
+
/**
* Set's whether the destination is workspace relative or not
*/
- public void setInWorkspace(boolean inWorkspace);
-
+ public void setInWorkspace(boolean inWorkspace);
+
/**
* Top level archives should return a list of actions which
* must be done before or after building this archive
@@ -123,5 +123,5 @@
public IArchiveAction[] getActions();
public IArchiveAction[] getPreActions();
public IArchiveAction[] getPostActions();
-
+
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveAction.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveAction.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveAction.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -27,30 +27,30 @@
*/
public interface IArchiveAction extends IArchiveNode {
- public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IArchiveAction.";
- public static final String ACTION_TYPE_ATTRIBUTE = ATTRIBUTE_PREFIX + "type";
- public static final String ACTION_TIME_ATTRIBUTE = ATTRIBUTE_PREFIX + "time";
+ public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IArchiveAction."; //$NON-NLS-1$
+ public static final String ACTION_TYPE_ATTRIBUTE = ATTRIBUTE_PREFIX + "type"; //$NON-NLS-1$
+ public static final String ACTION_TIME_ATTRIBUTE = ATTRIBUTE_PREFIX + "time"; //$NON-NLS-1$
-
+
/**
* A constant to indicate the action is to run before
- * the build
+ * the build
*/
- public static final String PRE_BUILD = "preBuild";
+ public static final String PRE_BUILD = "preBuild"; //$NON-NLS-1$
/**
- * A constant to indicate the action is to run after the build
+ * A constant to indicate the action is to run after the build
*/
- public static final String POST_BUILD = "postBuild";
+ public static final String POST_BUILD = "postBuild"; //$NON-NLS-1$
/**
- * Get whether this should be executed
+ * Get whether this should be executed
* before or after building the parent archive.
* @return
*/
public String getTime();
/**
- * Set whether this should be executed
+ * Set whether this should be executed
* before or after building the parent archive.
* @return
*/
@@ -63,30 +63,30 @@
* @return
*/
public String getTypeString();
-
+
/**
- * Get the type of action this is.
+ * Get the type of action this is.
* These are to be provided via an extension point
* or ant task to be discovered in ArchivesCore.
* @return
*/
public IActionType getType();
-
-
+
+
/**
- * Set the type of action this is.
+ * Set the type of action this is.
* These are to be provided via an extension point
* or ant task to be discovered in ArchivesCore.
* @return
*/
public void setType(String type);
-
+
/**
* Execute me
*/
public void execute();
-
+
/**
* ToString must give something usable
*/
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -28,29 +28,29 @@
* <p>
* This interface represents a file set inside of a package definition or folder.
* </p>
- *
+ *
* @author <a href="marshall(a)jboss.org">Marshall Culpepper</a>
* @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
* @version $Revision: 1930 $
*/
public interface IArchiveFileSet extends IArchiveNode {
- public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFileSet.";
- public static final String INCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "includes";
- public static final String EXCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "excludes";
- public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace";
- public static final String FLATTENED_ATTRIBUTE = ATTRIBUTE_PREFIX + "flattened";
- public static final String SOURCE_PATH_ATTRIBUTE = ATTRIBUTE_PREFIX + "sourcePath";
+ public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFileSet."; //$NON-NLS-1$
+ public static final String INCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "includes"; //$NON-NLS-1$
+ public static final String EXCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "excludes"; //$NON-NLS-1$
+ public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace"; //$NON-NLS-1$
+ public static final String FLATTENED_ATTRIBUTE = ATTRIBUTE_PREFIX + "flattened"; //$NON-NLS-1$
+ public static final String SOURCE_PATH_ATTRIBUTE = ATTRIBUTE_PREFIX + "sourcePath"; //$NON-NLS-1$
/**
* @return Whether or not this fileset's basedir is inside the workspace
*/
public boolean isInWorkspace();
-
+
/**
* @return Whether or not the fileset is flattened
*/
public boolean isFlattened();
-
+
/**
* @return the source path from the delegate with no translation at all
*/
@@ -60,64 +60,64 @@
* Force the scanner to check for matched files again
*/
public void resetScanner();
-
+
/**
* @return The includes pattern for this fileset
*/
public String getIncludesPattern();
-
+
/**
* @return The excludes pattern for this fileset
*/
public String getExcludesPattern();
-
+
/**
* Sets the "root" or "source" of this fileset (file-system or workspace relative)
* @param path The absolute path that is the source of this fileset
*/
public void setRawSourcePath (String raw);
-
+
/**
* Set the includes pattern for this fileset. This pattern uses the same syntax as Ant's include pattern.
* @param includes The includes pattern for this fileset
*/
public void setIncludesPattern(String includes);
-
+
/**
* Set the excludes pattern for this fileset. This pattern uses the same syntax as Ant's exclude pattern.
* @param excludes The excludes pattern for this fileset
*/
public void setExcludesPattern(String excludes);
-
+
/**
* Set whether or not this fileset's source is in the workspace. This will automatically be handled if you
* use setSingleFile, setSourceProject, setSourceContainer, or setSourceFolder.
* @param isInWorkspace Whether or not this fileset's source is in the workspace
*/
public void setInWorkspace(boolean isInWorkspace);
-
+
/**
* Sets whether or not this fileset is flattened.
*/
public void setFlattened(boolean flattened);
-
-
+
+
/**
* @return An array of matching IPath's in the filesystem (for external filesystem filesets)
*/
public FileWrapper[] findMatchingPaths();
-
+
/**
* Get the FileWrapper objects that match this path
* @param path
* @return
*/
public FileWrapper[] getMatches(IPath path);
-
+
/**
* This method returns whether the global path passed in matches this fileset.
- * It must give an accurate answer regardless of whether the path is cached or not.
- *
+ * It must give an accurate answer regardless of whether the path is cached or not.
+ *
* @param path The absolute path on the filesystem to check.
* @return Whether or not this fileset matches the passed-in path
*/
@@ -125,8 +125,8 @@
/**
* This method returns whether the path passed in matches this fileset.
- * It must give an accurate answer regardless of whether the path is cached or not.
- *
+ * It must give an accurate answer regardless of whether the path is cached or not.
+ *
* @param path The absolute path on the filesystem to check.
* @param inWorkspace Whether this is a workspace path or a global path
* @return Whether or not this fileset matches the passed-in path
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFolder.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFolder.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFolder.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -23,5 +23,5 @@
public interface IArchiveFolder extends INamedContainerArchiveNode {
- public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFolder.";
+ public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFolder."; //$NON-NLS-1$
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModel.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModel.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModel.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -33,7 +33,7 @@
*
*/
public interface IArchiveModel {
- public static final String DEFAULT_PACKAGES_FILE = ".packages";
+ public static final String DEFAULT_PACKAGES_FILE = ".packages"; //$NON-NLS-1$
public boolean isProjectRegistered(IPath projectPath);
public void save(IPath projectPath, IProgressMonitor monitor) throws ArchivesModelException;
@@ -48,7 +48,7 @@
public IArchiveModelRootNode getRoot(IPath project);
public IArchiveModelRootNode[] getModelNodes();
public boolean accept(IArchiveNodeVisitor visitor);
-
+
public void addBuildListener(IArchiveBuildListener listener);
public void removeBuildListener(IArchiveBuildListener listener);
public IArchiveBuildListener[] getBuildListeners();
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/INamedContainerArchiveNode.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/INamedContainerArchiveNode.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/INamedContainerArchiveNode.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -27,36 +27,36 @@
* This interface represents a folder inside a package definition.
* A folder can contain packages, filesets, and sub-folders.
* </p>
- *
+ *
* @author <a href="marshall(a)jboss.org">Marshall Culpepper</a>
* @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
* @version $Revision: 1929 $
*/
public interface INamedContainerArchiveNode extends IArchiveNode {
- public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.INamedContainerArchiveNode";
- public static final String NAME_ATTRIBUTE = ATTRIBUTE_PREFIX + "name";
+ public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.INamedContainerArchiveNode"; //$NON-NLS-1$
+ public static final String NAME_ATTRIBUTE = ATTRIBUTE_PREFIX + "name"; //$NON-NLS-1$
/**
* @return The name of this folder
*/
public String getName();
-
+
/**
* Set the name of this folder
* @param name The name of this folder
*/
public void setName(String name);
-
+
/**
* @return An array of sub-packages of this folder
*/
public IArchive[] getArchives();
-
+
/**
* @return An array of sub-folders of this folder
*/
public IArchiveFolder[] getFolders();
-
+
/**
* @return An array of filesets whose destination is this folder
*/
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IVariableManager.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IVariableManager.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IVariableManager.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -26,7 +26,7 @@
*
*/
public interface IVariableManager {
- public static final String CURRENT_PROJECT = "archives_current_project";
+ public static final String CURRENT_PROJECT = "archives_current_project"; //$NON-NLS-1$
public boolean containsVariable(String variable);
public String getVariableValue(String variable);
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -28,6 +28,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
@@ -47,29 +48,29 @@
private FileWrapper[] matchingPaths;
private HashMap<String, ArrayList<FileWrapper>> matchingMap;
private boolean rescanRequired = true;
-
+
public ArchiveFileSetImpl() {
this(new XbFileSet());
}
-
+
public ArchiveFileSetImpl (XbFileSet delegate) {
super(delegate);
}
-
+
/*
* @see IArchiveFileSet#getExcludesPattern()
*/
public String getExcludesPattern() {
return getFileSetDelegate().getExcludes();
}
-
+
/*
* @see IArchiveFileSet#isInWorkspace()
*/
public boolean isInWorkspace() {
return getFileSetDelegate().isInWorkspace();
}
-
+
/*
* @see IArchiveFileSet#getIncludesPattern()
*/
@@ -85,14 +86,14 @@
return getFileSetDelegate().getDir();
}
-
+
/*
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet#isFlattened()
*/
public boolean isFlattened() {
return getFileSetDelegate().isFlattened();
}
-
+
/*
* @see IArchiveFileSet#matchesPath(IPath)
*/
@@ -105,12 +106,12 @@
IPath globalPath = path;
if( inWorkspace )
globalPath = ArchivesCore.getInstance().getVFS().workspacePathToAbsolutePath(path);
-
+
ArrayList<FileWrapper> result = matchingMap.get(globalPath.toFile().getAbsolutePath());
if( result != null )
- if( result.size() > 0 )
+ if( result.size() > 0 )
return true;
-
+
return getScanner().couldBeIncluded(path.toString(), inWorkspace);
}
@@ -121,7 +122,7 @@
return (FileWrapper[]) l.toArray(new FileWrapper[l.size()]);
return new FileWrapper[0];
}
-
+
/*
* @see IArchiveFileSet#findMatchingPaths()
*/
@@ -129,7 +130,7 @@
getScanner();
return matchingPaths;
}
-
+
/*
* Will re-scan if required, or use cached scanner
* @return
@@ -145,21 +146,21 @@
matchingMap = scanner.getMatchedMap();
}
} catch( IllegalStateException ise ) {
- ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, "Could not create directory scanner", ise);
+ ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, ArchivesCoreMessages.CouldNotCreateScanner, ise);
matchingPaths = new FileWrapper[0];
matchingMap = new HashMap<String, ArrayList<FileWrapper>>();
}
}
return scanner;
}
-
+
/*
* @see IArchiveNode#getNodeType()
*/
public int getNodeType() {
return TYPE_ARCHIVE_FILESET;
}
-
+
/*
* @see IArchiveFileSet#setExcludesPattern(String)
*/
@@ -186,7 +187,7 @@
getFileSetDelegate().setInWorkspace(isInWorkspace);
rescanRequired = true;
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet#setFlattened(boolean)
@@ -196,25 +197,25 @@
getFileSetDelegate().setFlattened(flat);
rescanRequired = true;
}
-
+
/*
* @see IArchiveFileSet#setSourcePath(IPath, boolean)
*/
public void setRawSourcePath (String raw) {
Assert.isNotNull(raw);
String src = getRawSourcePath();
- attributeChanged(SOURCE_PATH_ATTRIBUTE,
- src == null ? null : src.toString(),
+ attributeChanged(SOURCE_PATH_ATTRIBUTE,
+ src == null ? null : src.toString(),
raw == null ? null : raw);
getFileSetDelegate().setDir(raw);
rescanRequired = true;
}
-
+
protected XbFileSet getFileSetDelegate () {
return (XbFileSet)nodeDelegate;
}
-
+
/*
* filesets have no path of their own
* and should not be the parents of any other node
@@ -222,7 +223,7 @@
* @see IArchiveNode#getRootArchiveRelativePath()
*/
public IPath getRootArchiveRelativePath() {
- return getParent().getRootArchiveRelativePath();
+ return getParent().getRootArchiveRelativePath();
}
/*
@@ -231,30 +232,30 @@
public void resetScanner() {
rescanRequired = true;
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl#validateChild(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
*/
public boolean validateModel() {
- return getAllChildren().length == 0 ? true : false;
+ return getAllChildren().length == 0 ? true : false;
}
-
+
public boolean canBuild() {
return PathUtils.getGlobalLocation(this) != null && super.canBuild();
}
-
+
public String toString() {
StringBuffer sb = new StringBuffer();
- sb.append("{dir=");
+ sb.append("{dir="); //$NON-NLS-1$
sb.append(getFileSetDelegate().getDir());
- sb.append(",includes=");
+ sb.append(",includes="); //$NON-NLS-1$
sb.append(getFileSetDelegate().getIncludes());
- sb.append(",excludes=");
+ sb.append(",excludes="); //$NON-NLS-1$
sb.append(getFileSetDelegate().getExcludes());
- sb.append(",inWorkspace=");
+ sb.append(",inWorkspace="); //$NON-NLS-1$
sb.append(getFileSetDelegate().isInWorkspace());
- sb.append(",flatten=");
+ sb.append(",flatten="); //$NON-NLS-1$
sb.append(getFileSetDelegate().isFlattened());
return sb.toString();
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFolderImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFolderImpl.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFolderImpl.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -33,7 +33,7 @@
/**
* A PackageFolderImpl.
- *
+ *
* @author <a href="marshall(a)jboss.org">Marshall Culpepper</a>
* @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
* @version $Revision: 1930 $
@@ -42,7 +42,7 @@
IArchiveFolder {
private XbFolder folderDelegate;
-
+
public ArchiveFolderImpl() {
this(new XbFolder());
}
@@ -106,18 +106,18 @@
protected XbFolder getFolderDelegate () {
return folderDelegate;
}
-
+
public String toString() {
- return "folder[" + getName() + "]";
+ return "folder[" + getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
/*
* @see IArchiveNode#getRootArchiveRelativePath()
*/
public IPath getRootArchiveRelativePath() {
return getParent().getRootArchiveRelativePath().append(getName());
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl#validateChild(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -39,13 +39,13 @@
/**
* An archive
- *
+ *
* @author Rob stryker
*/
public class ArchiveImpl extends ArchiveNodeImpl implements IArchive {
private XbPackage packageDelegate;
-
+
public ArchiveImpl() {
this(new XbPackage());
}
@@ -53,7 +53,7 @@
super(delegate);
this.packageDelegate = delegate;
}
-
+
/*
* @see IArchiveNode#getNodeType()
*/
@@ -67,14 +67,14 @@
public boolean isDestinationInWorkspace() {
return packageDelegate.isInWorkspace();
}
-
+
public String getRawDestinationPath() {
if( !isTopLevel() )
- return "";
- return packageDelegate.getToDir() == null ? "" : packageDelegate.getToDir();
+ return ""; //$NON-NLS-1$
+ return packageDelegate.getToDir() == null ? "" : packageDelegate.getToDir(); //$NON-NLS-1$
}
-
-
+
+
/*
* @see IArchive#getArchiveFilePath()
*/
@@ -82,7 +82,7 @@
IPath p = PathUtils.getGlobalLocation(this);
return p == null ? null : p.append(getName());
}
-
+
/*
* @see IArchive#getFileSets()
*/
@@ -112,7 +112,7 @@
System.arraycopy(nodes, 0, pkgs, 0, nodes.length);
return pkgs;
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchive#getActions()
@@ -123,7 +123,7 @@
System.arraycopy(nodes, 0, actions, 0, nodes.length);
return actions;
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchive#getPreActions()
@@ -131,7 +131,7 @@
public IArchiveAction[] getPreActions() {
return new IArchiveAction[0]; // TODO getPreActions
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchive#getPostActions()
@@ -153,22 +153,22 @@
public IArchiveType getArchiveType() {
return ArchivesCore.getInstance().getExtensionManager().getArchiveType(packageDelegate.getPackageType());
}
-
+
/*
* @see IArchive#isExploded()
*/
public boolean isExploded() {
return packageDelegate.isExploded();
}
-
+
/*
* @see IArchive#isTopLevel()
*/
public boolean isTopLevel() {
- return (packageDelegate.getParent() == null ||
+ return (packageDelegate.getParent() == null ||
packageDelegate.getParent() instanceof XbPackages);
}
-
+
/*
* @see IArchive#setDestinationPath(IPath, boolean)
*/
@@ -185,7 +185,7 @@
attributeChanged(IN_WORKSPACE_ATTRIBUTE, new Boolean(isDestinationInWorkspace()), new Boolean(inWorkspace));
packageDelegate.setInWorkspace(inWorkspace);
}
-
+
/*
* @see IArchive#setExploded(boolean)
*/
@@ -217,19 +217,19 @@
attributeChanged(PACKAGE_TYPE_ATTRIBUTE, getArchiveTypeId(), type);
packageDelegate.setPackageType(type);
}
-
+
public String toString() {
return getName();
}
-
+
/*
* @see IArchive#getArchiveTypeId()
*/
public String getArchiveTypeId() {
return packageDelegate.getPackageType();
}
-
- /*
+
+ /*
* @see IArchiveNode#getRootArchiveRelativePath()
*/
public IPath getRootArchiveRelativePath() {
@@ -237,7 +237,7 @@
return new Path(getName());
return getParent().getRootArchiveRelativePath().append(getName());
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl#validateChild(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -6,7 +6,7 @@
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
+ * published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
@@ -29,6 +29,7 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
@@ -49,13 +50,13 @@
protected XbPackageNodeWithProperties nodeDelegate;
protected IArchiveNode parent;
protected ArrayList<ArchiveNodeImpl> children;
-
+
// cached data for deltas
protected HashMap<String, NodeDelta> attributeChanges;
protected HashMap<String, NodeDelta> propertyChanges;
protected HashMap<IArchiveNode, Integer> childChanges;
-
-
+
+
public ArchiveNodeImpl (XbPackageNodeWithProperties delegate) {
nodeDelegate = delegate;
children = new ArrayList<ArchiveNodeImpl>();
@@ -65,11 +66,11 @@
propertyChanges = new HashMap<String, NodeDelta>();
childChanges = new HashMap<IArchiveNode, Integer>();
}
-
+
public XbPackageNode getNodeDelegate() {
return nodeDelegate;
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getRoot()
@@ -77,7 +78,7 @@
public IArchiveNode getRoot() {
return parent == null ? this : parent.getRoot();
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getModel()
@@ -86,17 +87,17 @@
Object root = getRoot();
return root instanceof IArchiveModelRootNode ? (IArchiveModelRootNode)root : null;
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getDescriptorVersion()
*/
public double getDescriptorVersion() {
IArchiveModelRootNode root = getModelRootNode();
- return root != null ? root.getDescriptorVersion() :
+ return root != null ? root.getDescriptorVersion() :
IArchiveModelRootNode.DESCRIPTOR_VERSION_1_2;
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getRootArchive()
@@ -107,7 +108,7 @@
if( getNodeType() == IArchiveNode.TYPE_ARCHIVE ) topArchives = (IArchive)this;
while( parent != null ) {
- if( parent.getNodeType() == IArchiveNode.TYPE_ARCHIVE )
+ if( parent.getNodeType() == IArchiveNode.TYPE_ARCHIVE )
topArchives = (IArchive)parent;
parent = parent.getParent();
}
@@ -121,7 +122,7 @@
public IArchiveNode[] getAllChildren () {
return children.toArray(new IArchiveNode[children.size()]);
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getChildren(int)
@@ -134,10 +135,10 @@
typedChildren.add(child);
}
}
-
+
return typedChildren.toArray(new IArchiveNode[typedChildren.size()]);
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#hasChildren()
@@ -145,7 +146,7 @@
public boolean hasChildren () {
return nodeDelegate.hasChildren();
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#hasChild(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
@@ -171,12 +172,12 @@
if( getParent() != null && parent != getParent()) {
getParent().removeChild(this);
}
-
+
this.parent = parent;
- nodeDelegate.setParent(parent == null ? null :
+ nodeDelegate.setParent(parent == null ? null :
((ArchiveNodeImpl)parent).getNodeDelegate());
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getProject()
@@ -185,7 +186,7 @@
IArchiveModelRootNode root = getModelRootNode();
return root == null ? null : root.getProjectPath();
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getProjectName()
@@ -194,7 +195,7 @@
IPath path = getProjectPath();
return ArchivesCore.getInstance().getVFS().getProjectName(path);
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getProperty(java.lang.String)
@@ -202,7 +203,7 @@
public String getProperty(String property) {
return getProperties().getProperty(property);
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#setProperty(java.lang.String, java.lang.String)
@@ -231,7 +232,7 @@
public boolean accept(IArchiveNodeVisitor visitor) {
return accept(visitor, false);
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#accept(org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor, boolean)
@@ -239,10 +240,10 @@
public boolean accept(IArchiveNodeVisitor visitor, boolean depthFirst) {
IArchiveNode children[] = getAllChildren();
boolean keepGoing = true;
-
+
if (!depthFirst)
keepGoing = visitor.visit(this);
-
+
if (keepGoing) {
for (int i = 0; i < children.length; i++) {
if (keepGoing) {
@@ -250,13 +251,13 @@
}
}
}
-
+
if (depthFirst && keepGoing)
keepGoing = visitor.visit(this);
-
+
return keepGoing;
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#addChild(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
@@ -280,7 +281,7 @@
childChanges(child, IArchiveNodeDelta.CHILD_ADDED);
if( !validateModel()) {
removeChild(child);
- throw new ArchivesModelException("Unable to add child node: " + child.toString());
+ throw new ArchivesModelException(ArchivesCore.bind(ArchivesCoreMessages.ErrorAddChildNode, child.toString()));
}
}
@@ -290,20 +291,20 @@
*/
public boolean validateModel() {
IArchiveNode[] kids = getAllChildren();
- for( int i = 0; i < kids.length; i++ )
- if( !kids[i].validateModel() )
+ for( int i = 0; i < kids.length; i++ )
+ if( !kids[i].validateModel() )
return false;
return true;
}
-
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#canBuild()
*/
public boolean canBuild() {
IArchiveNode[] kids = getAllChildren();
- for( int i = 0; i < kids.length; i++ )
- if( !kids[i].canBuild() )
+ for( int i = 0; i < kids.length; i++ )
+ if( !kids[i].canBuild() )
return false;
return true;
}
@@ -335,21 +336,21 @@
protected void attributeChanged(String key, Object beforeValue, Object afterValue) {
int kind = IArchiveNodeDelta.ATTRIBUTE_CHANGED;
HashMap<String, NodeDelta> map = attributeChanges;
-
+
// short circuit if no change has REALLY occurred
if( beforeValue != null && beforeValue.equals(afterValue)) return;
-
+
if( map.containsKey(key)) {
Object original = map.get(key).getBefore();
- if( original == null && afterValue == null )
+ if( original == null && afterValue == null )
map.remove(key);
- else if( original == null )
+ else if( original == null )
map.put(key, new NodeDelta(original, afterValue, kind));
else if( original.equals(afterValue))
// value was changed from x to y, then back to x. Therefore, no change
map.remove(key);
else
- // value was changed from x to y to z.
+ // value was changed from x to y to z.
// Before should remain x, after should become z
map.put(key, new NodeDelta(original, afterValue, kind));
} else {
@@ -357,7 +358,7 @@
map.put(key, new NodeDelta(beforeValue, afterValue, kind));
}
}
-
+
/**
* A property has changed. Save the change so it can be represented in a delta
*/
@@ -365,14 +366,14 @@
HashMap<String, NodeDelta> changeMap = propertyChanges;
// short circuit if no change has REALLY occurred
if( beforeValue != null && beforeValue.equals(afterValue)) return;
-
-
+
+
if( changeMap.containsKey(key)) {
// element has already been added, removed, or changed since last save
Object original = changeMap.get(key).getBefore();
- if( original == null && afterValue == null )
+ if( original == null && afterValue == null )
changeMap.remove(key);
- else if( original == null )
+ else if( original == null )
changeMap.put(key, new NodeDelta(original, afterValue, IArchiveNodeDelta.PROPERTY_ADDED));
else if( original.equals(afterValue))
// value was changed from x to y, then back to x. Therefore, no change
@@ -392,7 +393,7 @@
changeMap.put(key, new NodeDelta(beforeValue, afterValue, kind));
}
}
-
+
/**
* A child has changed. Save the change
* @param node
@@ -409,17 +410,17 @@
} else {
childChanges.put(node, new Integer(changeType));
}
- }
-
+ }
+
/*
* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getDelta()
*/
public IArchiveNodeDelta getDelta() {
- return new ArchiveNodeDeltaImpl(null, this, (HashMap<String, NodeDelta>)attributeChanges.clone(),
+ return new ArchiveNodeDeltaImpl(null, this, (HashMap<String, NodeDelta>)attributeChanges.clone(),
(HashMap<String, NodeDelta>)propertyChanges.clone(), (HashMap<IArchiveNode, Integer>)childChanges.clone());
}
-
+
/**
* Forget all past state
*/
@@ -427,10 +428,10 @@
attributeChanges.clear();
propertyChanges.clear();
childChanges.clear();
-
+
// clear children recursively
IArchiveNode[] children = getAllChildren();
- for( int i = 0; i < children.length; i++ )
+ for( int i = 0; i < children.length; i++ )
((ArchiveNodeImpl)children[i]).clearDelta();
}
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/ArchivesUnmarshallerImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/ArchivesUnmarshallerImpl.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/ArchivesUnmarshallerImpl.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -40,7 +40,7 @@
/**
* Unmarshaller implementation.
* WARNING: this implementation is not thread-safe.
- *
+ *
* Taken from JBoss XB. Changed to let getParser() be public.
*
* @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
@@ -193,7 +193,7 @@
DocumentBinding binding) throws JBossXBException {
if (binding != null) {
throw new IllegalStateException(
- "DocumentBinding API is not supported anymore!");
+ "DocumentBinding API is not supported anymore!"); //$NON-NLS-1$
}
return unmarshal(systemId, factory, (Object) null);
}
@@ -202,7 +202,7 @@
DocumentBinding binding) throws JBossXBException {
if (binding != null) {
throw new IllegalStateException(
- "DocumentBinding API is not supported anymore!");
+ "DocumentBinding API is not supported anymore!"); //$NON-NLS-1$
}
return unmarshal(reader, factory, (Object) null);
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/StrictXercesXSMarshaller.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/StrictXercesXSMarshaller.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/StrictXercesXSMarshaller.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -103,8 +103,8 @@
private XSAttributeUse currentAttribute;
private XSTypeDefinition currentElementType;
- private String simpleContentProperty = "value";
-
+ private String simpleContentProperty = "value";//$NON-NLS-1$
+
private MarshallingContext ctx = new MarshallingContext()
{
private ContentHandler ch;
@@ -113,7 +113,7 @@
{
if(currentAttribute == null)
{
- throw new JBossXBRuntimeException("There is no current attribute!");
+ throw new JBossXBRuntimeException("There is no current attribute!"); //$NON-NLS-1$
}
return currentAttribute.getRequired();
}
@@ -122,7 +122,7 @@
{
if(currentElementType == null)
{
- throw new JBossXBRuntimeException("There is no current element!");
+ throw new JBossXBRuntimeException("There is no current element!"); //$NON-NLS-1$
}
return currentElementType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE;
}
@@ -239,7 +239,7 @@
{
if(model == null)
{
- throw new JBossXBRuntimeException("XSModel is not available!");
+ throw new JBossXBRuntimeException("XSModel is not available!"); //$NON-NLS-1$
}
this.model = model;
@@ -254,9 +254,9 @@
{
if(rootQNames.isEmpty())
{
- throw new JBossXBRuntimeException("If type name (" +
+ throw new JBossXBRuntimeException("If type name (" + //$NON-NLS-1$
rootTypeQName +
- ") for the root element is specified then the name for the root element is required!"
+ ") for the root element is specified then the name for the root element is required!" //$NON-NLS-1$
);
}
QName rootQName = (QName)rootQNames.get(0);
@@ -266,7 +266,7 @@
);
if(type == null)
{
- throw new JBossXBRuntimeException("Global type definition is not found: " + rootTypeQName);
+ throw new JBossXBRuntimeException("Global type definition is not found: " + rootTypeQName); //$NON-NLS-1$
}
if(isArrayWrapper(type))
@@ -299,7 +299,7 @@
XSNamedMap components = model.getComponents(XSConstants.ELEMENT_DECLARATION);
if(components.getLength() == 0)
{
- throw new JBossXBRuntimeException("The schema doesn't contain global element declarations.");
+ throw new JBossXBRuntimeException("The schema doesn't contain global element declarations."); //$NON-NLS-1$
}
for(int i = 0; i < components.getLength(); ++i)
@@ -325,17 +325,17 @@
if(element == null)
{
XSNamedMap components = model.getComponents(XSConstants.ELEMENT_DECLARATION);
- String roots = "";
+ String roots = ""; //$NON-NLS-1$
for(int j = 0; j < components.getLength(); ++j)
{
XSObject xsObject = components.item(j);
if(j > 0)
{
- roots += ", ";
+ roots += ", "; //$NON-NLS-1$
}
- roots += "{" + xsObject.getNamespace() + "}" + xsObject.getName();
+ roots += "{" + xsObject.getNamespace() + "}" + xsObject.getName(); //$NON-NLS-1$ //$NON-NLS-2$
}
- throw new IllegalStateException("Root element not found: " + qName + " among " + roots);
+ throw new IllegalStateException("Root element not found: " + qName + " among " + roots); //$NON-NLS-1$ //$NON-NLS-2$
}
Object o = provider.getRoot(root, null, element.getNamespace(), element.getName());
@@ -367,7 +367,7 @@
propertyIsTrueOrNotSet(Marshaller.PROP_OUTPUT_INDENTATION)
);
content.handleContent(contentWriter);
- log.trace("marshalled:\n" + traceWriter.getBuffer().toString());
+ log.trace("marshalled:\n" + traceWriter.getBuffer().toString()); //$NON-NLS-1$
}
}
@@ -384,7 +384,7 @@
if(trace)
{
String prefix = getPrefix(elementNs);
- log.trace("started element ns=" + elementNs + ", local=" + elementLocal + ", prefix=" + prefix);
+ log.trace("started element ns=" + elementNs + ", local=" + elementLocal + ", prefix=" + prefix); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
if(value != null)
@@ -398,7 +398,7 @@
if(trace)
{
- log.trace("finished element ns=" + elementNs + ", local=" + elementLocal);
+ log.trace("finished element ns=" + elementNs + ", local=" + elementLocal); //$NON-NLS-1$ //$NON-NLS-2$
}
return result;
@@ -426,7 +426,7 @@
marshalComplexType(elementNs, elementLocal, (XSComplexTypeDefinition)type, declareNs, declareXsiType);
break;
default:
- throw new IllegalStateException("Unexpected type category: " + type.getTypeCategory());
+ throw new IllegalStateException("Unexpected type category: " + type.getTypeCategory()); //$NON-NLS-1$
}
}
@@ -444,7 +444,7 @@
boolean genPrefix = prefix == null && elementUri != null && elementUri.length() > 0;
if(genPrefix)
{
- prefix = "ns_" + elementLocal;
+ prefix = "ns_" + elementLocal; //$NON-NLS-1$
}
AttributesImpl attrs = null;
@@ -482,7 +482,7 @@
{
attrs = new AttributesImpl(1);
}
- attrs.add(null, prefix, "xmlns:" + prefix, null, (String)elementUri);
+ attrs.add(null, prefix, "xmlns:" + prefix, null, (String)elementUri); //$NON-NLS-1$
}
String qName = prefixLocalName(prefix, elementLocal);
@@ -534,13 +534,13 @@
if(genPrefix)
{
// todo: it's possible that the generated prefix already mapped. this should be fixed
- prefix = "ns_" + elementLocalName;
+ prefix = "ns_" + elementLocalName; //$NON-NLS-1$
declareNamespace(prefix, elementNsUri);
if(attrs == null)
{
attrs = new AttributesImpl(1);
}
- attrs.add(null, prefix, "xmlns:" + prefix, null, elementNsUri);
+ attrs.add(null, prefix, "xmlns:" + prefix, null, elementNsUri); //$NON-NLS-1$
}
for(int i = 0; i < attributeUses.getLength(); ++i)
@@ -564,12 +564,12 @@
attrPrefix = getPrefix(attrNs);
if(attrPrefix == null && attrNs != null && attrNs.length() > 0)
{
- attrPrefix = "ns_" + attrLocal;
- attrs.add(null, attrPrefix, "xmlns:" + attrPrefix, null, attrNs);
+ attrPrefix = "ns_" + attrLocal; //$NON-NLS-1$
+ attrs.add(null, attrPrefix, "xmlns:" + attrPrefix, null, attrNs); //$NON-NLS-1$
}
}
- String qName = attrPrefix == null || attrPrefix.length() == 0 ? attrLocal : attrPrefix + ":" + attrLocal;
+ String qName = attrPrefix == null || attrPrefix.length() == 0 ? attrLocal : attrPrefix + ":" + attrLocal; //$NON-NLS-1$
// todo: this is a quick fix for boolean pattern (0|1 or true|false) should be refactored
XSSimpleTypeDefinition attrType = attrDec.getTypeDefinition();
@@ -589,9 +589,9 @@
}
else
{
- throw new JBossXBRuntimeException("Expected value for list type is an array or " +
+ throw new JBossXBRuntimeException("Expected value for list type is an array or " + //$NON-NLS-1$
List.class.getName() +
- " but got: " +
+ " but got: " + //$NON-NLS-1$
attrValue
);
}
@@ -628,8 +628,8 @@
}
else
{
- throw new JBossXBRuntimeException("Marshalling of list types with item types not from " +
- Constants.NS_XML_SCHEMA + " is not supported."
+ throw new JBossXBRuntimeException("Marshalling of list types with item types not from " + //$NON-NLS-1$
+ Constants.NS_XML_SCHEMA + " is not supported." //$NON-NLS-1$
);
}
}
@@ -643,11 +643,11 @@
String item = attrType.getLexicalPattern().item(0);
if(item.indexOf('0') != -1 && item.indexOf('1') != -1)
{
- attrValue = ((Boolean)attrValue).booleanValue() ? "1" : "0";
+ attrValue = ((Boolean)attrValue).booleanValue() ? "1" : "0"; //$NON-NLS-1$ //$NON-NLS-2$
}
else
{
- attrValue = ((Boolean)attrValue).booleanValue() ? "true" : "false";
+ attrValue = ((Boolean)attrValue).booleanValue() ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
else if(Constants.QNAME_QNAME.getNamespaceURI().equals(attrType.getNamespace()) &&
@@ -666,7 +666,7 @@
qNamePrefix = qNameValue.getPrefix();
if(qNamePrefix == null || qNamePrefix.length() == 0)
{
- qNamePrefix = "ns_" + qNameValue.getLocalPart();
+ qNamePrefix = "ns_" + qNameValue.getLocalPart(); //$NON-NLS-1$
}
declareNs(attrs, qNamePrefix, ns);
nsRegistry.addPrefixMapping(qNamePrefix, ns);
@@ -692,11 +692,11 @@
attrDec.getTypeDefinition().getName(),
attrValue.toString()
);
- } // end if attrValue != null
+ } // end if attrValue != null
else if( currentAttribute.getRequired()){
// its required and is not present. Must throw exception
String name = currentAttribute.getAttrDeclaration().getName();
- throw new JBossXBRuntimeException("Required Attribute " + name + " is not present");
+ throw new JBossXBRuntimeException("Required Attribute " + name + " is not present"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
currentAttribute = null;
@@ -849,7 +849,7 @@
}
break;
default:
- throw new IllegalStateException("Unexpected term type: " + term.getType());
+ throw new IllegalStateException("Unexpected term type: " + term.getType()); //$NON-NLS-1$
}
return marshalled;
}
@@ -875,7 +875,7 @@
declareXsiType = true;
if(log.isTraceEnabled())
{
- log.trace(value.getClass() + " is mapped to xsi:type " + xsiTypeQName);
+ log.trace(value.getClass() + " is mapped to xsi:type " + xsiTypeQName); //$NON-NLS-1$
}
XSTypeDefinition xsiType = model.getTypeDefinition(xsiTypeQName.getLocalPart(),
@@ -884,11 +884,11 @@
if(xsiType == null)
{
- log.warn("Class " +
+ log.warn("Class " + //$NON-NLS-1$
value.getClass() +
- " is mapped to type " +
+ " is mapped to type " + //$NON-NLS-1$
xsiTypeQName +
- " but the type is not found in schema."
+ " but the type is not found in schema." //$NON-NLS-1$
);
}
// todo should check derivation also, i.e. if(xsiType.derivedFrom())
@@ -951,21 +951,21 @@
{
if(ignoreUnresolvedWildcard)
{
- log.warn("Failed to marshal wildcard. Class mapping not found for " +
+ log.warn("Failed to marshal wildcard. Class mapping not found for " + //$NON-NLS-1$
o.getClass() +
- "@" +
+ "@" + //$NON-NLS-1$
o.hashCode() +
- ": " + o
+ ": " + o //$NON-NLS-1$
);
return true;
}
else
{
- throw new IllegalStateException("Failed to marshal wildcard. Class mapping not found for " +
+ throw new IllegalStateException("Failed to marshal wildcard. Class mapping not found for " + //$NON-NLS-1$
o.getClass() +
- "@" +
+ "@" + //$NON-NLS-1$
o.hashCode() +
- ": " + o
+ ": " + o //$NON-NLS-1$
);
}
}
@@ -993,7 +993,7 @@
if(elDec == null)
{
- throw new JBossXBRuntimeException("Element " + mapping.elementName + " is not declared in the schema.");
+ throw new JBossXBRuntimeException("Element " + mapping.elementName + " is not declared in the schema."); //$NON-NLS-1$ //$NON-NLS-2$
}
Object elementValue = provider.getRoot(root, null, elDec.getNamespace(), elDec.getName());
@@ -1024,10 +1024,10 @@
typeNames.add(new QName(type.getNamespace(), type.getName()));
}
}
- throw new JBossXBRuntimeException("Type " +
+ throw new JBossXBRuntimeException("Type " + //$NON-NLS-1$
mapping.typeName +
- " is not defined in the schema." +
- " Defined types are: " + typeNames
+ " is not defined in the schema." + //$NON-NLS-1$
+ " Defined types are: " + typeNames //$NON-NLS-1$
);
}
@@ -1044,9 +1044,9 @@
}
else
{
- throw new JBossXBRuntimeException("Class mapping for " +
+ throw new JBossXBRuntimeException("Class mapping for " + //$NON-NLS-1$
mapping.cls +
- " is associated with neither global element name nor global type name."
+ " is associated with neither global element name nor global type name." //$NON-NLS-1$
);
}
@@ -1074,7 +1074,7 @@
marshalled = marshalModelGroupSequence(modelGroup.getParticles(), declareNs);
break;
default:
- throw new IllegalStateException("Unexpected compsitor: " + modelGroup.getCompositor());
+ throw new IllegalStateException("Unexpected compsitor: " + modelGroup.getCompositor()); //$NON-NLS-1$
}
return marshalled;
}
@@ -1146,7 +1146,7 @@
{
// todo: qname are also not yet supported
throw new JBossXBRuntimeException(
- "Expected value for list type is an array or " + List.class.getName() + " but got: " + value
+ "Expected value for list type is an array or " + List.class.getName() + " but got: " + value //$NON-NLS-1$ //$NON-NLS-2$
);
}
@@ -1154,8 +1154,8 @@
}
else
{
- throw new JBossXBRuntimeException("Marshalling of list types with item types not from " +
- Constants.NS_XML_SCHEMA + " is not supported."
+ throw new JBossXBRuntimeException("Marshalling of list types with item types not from " + //$NON-NLS-1$
+ Constants.NS_XML_SCHEMA + " is not supported." //$NON-NLS-1$
);
}
}
@@ -1177,7 +1177,7 @@
prefix = qName.getPrefix();
if(prefix == null || prefix.length() == 0)
{
- prefix = qName.getLocalPart() + "_ns";
+ prefix = qName.getLocalPart() + "_ns"; //$NON-NLS-1$
}
nsRegistry.addPrefixMapping(prefix, qName.getNamespaceURI());
declareNs(attrs, prefix, qName.getNamespaceURI());
@@ -1204,11 +1204,11 @@
String item = type.getLexicalPattern().item(0);
if(item.indexOf('0') != -1 && item.indexOf('1') != -1)
{
- marshalled = ((Boolean)value).booleanValue() ? "1" : "0";
+ marshalled = ((Boolean)value).booleanValue() ? "1" : "0";//$NON-NLS-1$ //$NON-NLS-2$
}
else
{
- marshalled = ((Boolean)value).booleanValue() ? "true" : "false";
+ marshalled = ((Boolean)value).booleanValue() ? "true" : "false";//$NON-NLS-1$ //$NON-NLS-2$
}
}
else
@@ -1219,13 +1219,13 @@
Method getValue;
try
{
- getValue = value.getClass().getMethod("value", null);
+ getValue = value.getClass().getMethod("value", null); //$NON-NLS-1$
}
catch(NoSuchMethodException e)
{
try
{
- getValue = value.getClass().getMethod("getValue", null);
+ getValue = value.getClass().getMethod("getValue", null); //$NON-NLS-1$
}
catch(NoSuchMethodException e1)
{
@@ -1235,12 +1235,12 @@
values.add(lexicalEnumeration.item(i));
}
- throw new JBossXBRuntimeException("Failed to find neither value() nor getValue() in " +
+ throw new JBossXBRuntimeException("Failed to find neither value() nor getValue() in " + //$NON-NLS-1$
value.getClass() +
- " which is bound to enumeration type (" +
+ " which is bound to enumeration type (" + //$NON-NLS-1$
type.getNamespace() +
- ", " +
- type.getName() + "): " + values
+ ", " + //$NON-NLS-1$
+ type.getName() + "): " + values //$NON-NLS-1$
);
}
}
@@ -1252,7 +1252,7 @@
catch(Exception e)
{
throw new JBossXBRuntimeException(
- "Failed to invoke getValue() on " + value + " to get the enumeration value", e
+ "Failed to invoke getValue() on " + value + " to get the enumeration value", e//$NON-NLS-1$ //$NON-NLS-2$
);
}
}
@@ -1278,19 +1278,19 @@
String xsiPrefix = nsRegistry.getPrefix(Constants.NS_XML_SCHEMA_INSTANCE);
if(xsiPrefix == null)
{
- attrs.add(Constants.NS_XML_SCHEMA, "xmlns", "xmlns:xsi", null, Constants.NS_XML_SCHEMA_INSTANCE);
- xsiPrefix = "xsi";
+ attrs.add(Constants.NS_XML_SCHEMA, "xmlns", "xmlns:xsi", null, Constants.NS_XML_SCHEMA_INSTANCE);//$NON-NLS-1$ //$NON-NLS-2$
+ xsiPrefix = "xsi"; //$NON-NLS-1$
}
String pref = getPrefix(type.getNamespace());
if(pref == null)
{
// the ns is not declared
- result = pref = type.getName() + "_ns";
+ result = pref = type.getName() + "_ns"; //$NON-NLS-1$
}
String typeQName = pref == null ? type.getName() : pref + ':' + type.getName();
- attrs.add(Constants.NS_XML_SCHEMA_INSTANCE, "type", xsiPrefix + ":type", null, typeQName);
+ attrs.add(Constants.NS_XML_SCHEMA_INSTANCE, "type", xsiPrefix + ":type", null, typeQName);//$NON-NLS-1$ //$NON-NLS-2$
return result;
}
@@ -1350,9 +1350,9 @@
if(!nillable)
{
- throw new JBossXBRuntimeException("Failed to marshal " +
+ throw new JBossXBRuntimeException("Failed to marshal " + //$NON-NLS-1$
new QName(elementNs, elementLocal) +
- ": Java value is null but the element is not nillable."
+ ": Java value is null but the element is not nillable." //$NON-NLS-1$
);
}
@@ -1360,9 +1360,9 @@
String prefix = getPrefix(elementNs);
if(prefix == null && elementNs != null && elementNs.length() > 0)
{
- prefix = "ns_" + elementLocal;
+ prefix = "ns_" + elementLocal; //$NON-NLS-1$
attrs = new AttributesImpl(2);
- attrs.add(null, prefix, "xmlns:" + prefix, null, elementNs);
+ attrs.add(null, prefix, "xmlns:" + prefix, null, elementNs); //$NON-NLS-1$
}
else
{
@@ -1372,17 +1372,17 @@
String xsiPrefix = getPrefix(Constants.NS_XML_SCHEMA_INSTANCE);
if(xsiPrefix == null)
{
- xsiPrefix = "xsi";
+ xsiPrefix = "xsi"; //$NON-NLS-1$
attrs.add(null,
xsiPrefix,
- "xmlns:xsi",
+ "xmlns:xsi", //$NON-NLS-1$
null,
Constants.NS_XML_SCHEMA_INSTANCE
);
}
- String nilQName = xsiPrefix + ":nil";
- attrs.add(Constants.NS_XML_SCHEMA_INSTANCE, "nil", nilQName, null, "1");
+ String nilQName = xsiPrefix + ":nil"; //$NON-NLS-1$
+ attrs.add(Constants.NS_XML_SCHEMA_INSTANCE, "nil", nilQName, null, "1"); //$NON-NLS-1$ //$NON-NLS-2$
String qName = prefixLocalName(prefix, elementLocal);
content.startElement(elementNs, elementLocal, qName, attrs);
@@ -1431,7 +1431,7 @@
public void remove()
{
- throw new UnsupportedOperationException("remove is not implemented.");
+ throw new UnsupportedOperationException("remove is not implemented."); //$NON-NLS-1$
}
};
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -60,21 +60,21 @@
public static final int NUM_UNMARSHAL_MONITOR_STEPS = 3;
public static final int NUM_MARSHALL_MONITOR_STEPS = 2;
- private static URL schema = XMLBinding.class.getClassLoader().getResource("packages.xsd");
- private static URL log4jxml = XMLBinding.class.getClassLoader().getResource("log4j.xml");
+ private static URL schema = XMLBinding.class.getClassLoader().getResource("packages.xsd"); //$NON-NLS-1$
+ private static URL log4jxml = XMLBinding.class.getClassLoader().getResource("log4j.xml"); //$NON-NLS-1$
private static SchemaBinding binding;
private static boolean initialized = false;
static {
- System.setProperty("log4j.configuration", log4jxml.toString());
+ System.setProperty("log4j.configuration", log4jxml.toString()); //$NON-NLS-1$
}
public static void init ()
{
try {
InputStream stream = schema.openStream();
- binding = XsdBinder.bind(stream, "UTF-8", (String)null);
+ binding = XsdBinder.bind(stream, "UTF-8", (String)null); //$NON-NLS-1$
stream.close();
initialized = true;
} catch (IOException e) {
@@ -124,8 +124,8 @@
monitor.worked(1);
binding.setStrictSchema(true);
unmarshaller.setValidation(true);
- unmarshaller.getParser().setFeature("http://apache.org/xml/features/validation/schema", true);
- unmarshaller.getParser().setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", schema.toExternalForm());
+ unmarshaller.getParser().setFeature("http://apache.org/xml/features/validation/schema", true); //$NON-NLS-1$
+ unmarshaller.getParser().setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", schema.toExternalForm()); //$NON-NLS-1$
Object xmlObject = unmarshaller.unmarshal(in, binding);
monitor.worked(1);
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -35,31 +35,31 @@
public Object getRoot(Object o, MarshallingContext context, String namespaceURI, String localName) {
return o;
}
-
+
protected Object getNodeChildren(XbPackageNode node, String name)
{
- if ("package".equals(name)) {
+ if ("package".equals(name)) { //$NON-NLS-1$
return node.getChildren(XbPackage.class);
- }
- else if ("folder".equals(name)) {
+ }
+ else if ("folder".equals(name)) {//$NON-NLS-1$
return node.getChildren(XbFolder.class);
}
- else if ("fileset".equals(name)) {
+ else if ("fileset".equals(name)) {//$NON-NLS-1$
return node.getChildren(XbFileSet.class);
}
- else if ("properties".equals(name) && node instanceof XbPackageNodeWithProperties) {
+ else if ("properties".equals(name) && node instanceof XbPackageNodeWithProperties) {//$NON-NLS-1$
return ((XbPackageNodeWithProperties)node).getProperties();
}
- else if ("property".equals(name) && node instanceof XbProperties) {
+ else if ("property".equals(name) && node instanceof XbProperties) {//$NON-NLS-1$
return ((XbProperties)node).getProperties().getPropertyElements();
}
- else if( "buildAction".equals(name) && node instanceof XbPackage) {
+ else if( "buildAction".equals(name) && node instanceof XbPackage) {//$NON-NLS-1$
return ((XbPackage)node).getActions();
}
-
+
return null;
}
-
+
public Object getChildren(Object object, MarshallingContext context, String namespaceURI, String localName)
{
if (object instanceof XbPackageNode) {
@@ -68,64 +68,64 @@
}
return null;
}
-
-
+
+
public Object getAttributeValue(Object object, MarshallingContext context,
String namespaceURI, String localName) {
if( object instanceof XbPackages ) {
- if("version".equals(localName))
+ if("version".equals(localName))//$NON-NLS-1$
return ((XbPackages)object).getVersion();
}
else if (object instanceof XbPackage) {
XbPackage pkg = (XbPackage)object;
- if("id".equals(localName))
+ if("id".equals(localName))//$NON-NLS-1$
return pkg.getId();
- else if ("type".equals(localName))
+ else if ("type".equals(localName))//$NON-NLS-1$
return pkg.getPackageType();
- else if ("name".equals(localName))
+ else if ("name".equals(localName))//$NON-NLS-1$
return pkg.getName();
- else if ("exploded".equals(localName))
+ else if ("exploded".equals(localName))//$NON-NLS-1$
return Boolean.valueOf(pkg.isExploded());
- else if ("todir".equals(localName))
+ else if ("todir".equals(localName))//$NON-NLS-1$
return pkg.getToDir();
- else if ("inWorkspace".equals(localName))
- return ""+pkg.isInWorkspace();
+ else if ("inWorkspace".equals(localName))//$NON-NLS-1$
+ return ""+pkg.isInWorkspace();//$NON-NLS-1$
}
else if (object instanceof XbFolder) {
XbFolder folder = (XbFolder) object;
- if ("name".equals(localName))
+ if ("name".equals(localName))//$NON-NLS-1$
return folder.getName();
}
else if (object instanceof XbFileSet) {
XbFileSet fileset = (XbFileSet)object;
- if ("dir".equals(localName))
+ if ("dir".equals(localName))//$NON-NLS-1$
return fileset.getDir();
- else if ("includes".equals(localName))
+ else if ("includes".equals(localName))//$NON-NLS-1$
return fileset.getIncludes();
- else if ("excludes".equals(localName))
+ else if ("excludes".equals(localName))//$NON-NLS-1$
return fileset.getExcludes();
- else if ("inWorkspace".equals(localName))
- return "" + fileset.isInWorkspace();
- else if("flatten".equals(localName))
+ else if ("inWorkspace".equals(localName))//$NON-NLS-1$
+ return "" + fileset.isInWorkspace();//$NON-NLS-1$
+ else if("flatten".equals(localName))//$NON-NLS-1$
return new Boolean(fileset.isFlattened()).toString();
}
else if (object instanceof XbProperty) {
XbProperty prop = (XbProperty) object;
- if ("name".equals(localName))
+ if ("name".equals(localName))//$NON-NLS-1$
return prop.getName();
- else if ("value".equals(localName))
+ else if ("value".equals(localName))//$NON-NLS-1$
return prop.getValue();
} else if( object instanceof XbAction ) {
XbAction action = (XbAction)object;
- if("time".equals(localName))
+ if("time".equals(localName))//$NON-NLS-1$
return action.getTime();
- if("type".equals(localName))
+ if("type".equals(localName))//$NON-NLS-1$
return action.getType();
}
return null;
}
-
- // do not care ;)
+
+ // do not care ;)
public Object getElementValue(Object object, MarshallingContext context, String namespaceURI, String localName) {
return null;
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -26,16 +26,19 @@
import java.util.Iterator;
import java.util.Properties;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
+
public class XbProperties extends XbPackageNode {
private PropertiesExt properties;
-
+
public XbProperties () {
super();
this.properties = new PropertiesExt();
}
-
+
public XbProperties (XbProperties props) {
super(props);
this.properties = new PropertiesExt();
@@ -44,32 +47,34 @@
addProperty(element);
}
}
-
+
protected Object clone() throws CloneNotSupportedException {
return new XbProperties(this);
}
-
+
public class PropertiesExt extends Properties {
private static final long serialVersionUID = 1L;
private Hashtable propertyElements;
-
+
public PropertiesExt () {
propertyElements = new Hashtable();
}
-
+
/**
* Will map String key -> XbProperty element(key,value) in the local structure
* and map String key -> String value in the superclass
- *
+ *
* @return The String value held previously
*/
public synchronized Object put(Object key, Object value) {
if( key == null )
- throw new NullPointerException("Key is null in " + getClass().getName());
-
+ throw new NullPointerException( ArchivesCore.bind(
+ ArchivesCoreMessages.KeyIsNull, getClass().getName()));
+
if( value == null )
- throw new NullPointerException("Value is null in " + getClass().getName());
-
+ throw new NullPointerException( ArchivesCore.bind(
+ ArchivesCoreMessages.ValueIsNull, getClass().getName()));
+
if (!propertyElements.containsKey(key)) {
XbProperty element = new XbProperty();
element.setName((String)key);
@@ -79,32 +84,32 @@
XbProperty element = (XbProperty)propertyElements.get(key);
element.setValue((String)value);
}
-
+
return super.put(key, value);
}
-
+
public synchronized Object remove(Object key) {
propertyElements.remove(key);
return super.remove(key);
}
-
+
public Collection getPropertyElements () {
return propertyElements.values();
}
}
-
+
public PropertiesExt getProperties () {
return properties;
}
-
+
public void addProperty (Object property) {
addProperty((XbProperty)property);
}
-
+
public void addProperty (XbProperty property) {
properties.setProperty(property.getName(), property.getValue());
addChild(property);
}
-
-
+
+
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/AbstractArchiveType.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/AbstractArchiveType.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/AbstractArchiveType.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -37,10 +37,10 @@
if( element == null ) element = config;
}
public String getId() {
- return element.getAttribute("id");
+ return element.getAttribute("id"); //$NON-NLS-1$
}
public String getLabel() {
- return element.getAttribute("label");
+ return element.getAttribute("label"); //$NON-NLS-1$
}
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -12,19 +12,19 @@
public static IPath getGlobalLocation(IArchiveNode node) {
if( node instanceof IArchive ) {
IArchive a = (IArchive)node;
- return getGlobalLocation(a.getRawDestinationPath(),
- a.getProjectName(), a.isDestinationInWorkspace(),
+ return getGlobalLocation(a.getRawDestinationPath(),
+ a.getProjectName(), a.isDestinationInWorkspace(),
a.getDescriptorVersion());
}
else if( node instanceof IArchiveFileSet ) {
IArchiveFileSet a = (IArchiveFileSet)node;
- return getGlobalLocation(a.getRawSourcePath(),
- a.getProjectName(), a.isInWorkspace(),
+ return getGlobalLocation(a.getRawSourcePath(),
+ a.getProjectName(), a.isInWorkspace(),
a.getDescriptorVersion());
}
return null;
}
-
+
public static String getAbsoluteLocation(IArchiveNode node) {
if( node instanceof IArchive ) {
IArchive a = (IArchive)node;
@@ -38,7 +38,7 @@
}
// Get the actual file located on the filesystem
- public static IPath getGlobalLocation(String expression,
+ public static IPath getGlobalLocation(String expression,
String projectName, boolean inWorkspace, double version) {
String absolute = getAbsoluteLocation(expression, projectName, inWorkspace, version);
if( absolute != null ) {
@@ -53,12 +53,12 @@
}
// Get an absolute path, workspace-absolute or fs-absolute
- public static String getAbsoluteLocation(String expression,
+ public static String getAbsoluteLocation(String expression,
String projectName, boolean inWorkspace, double version) {
-
- if( inWorkspace && ("".equals(expression) || ".".equals(expression)))
+
+ if( inWorkspace && ("".equals(expression) || ".".equals(expression))) //$NON-NLS-1$ //$NON-NLS-2$
return new Path(projectName).makeAbsolute().toString();
-
+
try {
String translated = ArchivesCore.getInstance().getVFS().
performStringSubstitution(expression, projectName, true);
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -32,6 +32,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
@@ -83,13 +84,14 @@
* }
*/
public static FileWrapperStatusPair fullFilesetRemove(final IArchiveFileSet fileset, IProgressMonitor monitor, boolean sync) {
- monitor.beginTask("Removing fileset: " + fileset.toString(), 2500);
+ monitor.beginTask(ArchivesCore.bind(ArchivesCoreMessages.RemovingFileset,fileset.toString()), 2500);
FileWrapper[] files = fileset.findMatchingPaths();
final ArrayList<IStatus> errors = new ArrayList<IStatus>();
final ArrayList<FileWrapper> list = new ArrayList<FileWrapper>();
list.addAll(Arrays.asList(files));
IProgressMonitor filesMonitor = new SubProgressMonitor(monitor, 2000);
- filesMonitor.beginTask("Removing " + files.length + " files", files.length * 100);
+ filesMonitor.beginTask( ArchivesCore.bind(
+ ArchivesCoreMessages.RemovingCountFiles, new Integer(files.length).toString()), files.length * 100);
for( int i = 0; i < files.length; i++ ) {
if( !ModelUtil.otherFilesetMatchesPathAndOutputLocation(fileset, files[i])) {
// remove
@@ -104,7 +106,8 @@
// kinda ugly here. delete all empty folders beneath
File folder = getFile(fileset);
if( !cleanFolder(folder, false) ) {
- IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, "Error emptying folder " + folder.toString());
+ IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
+ ArchivesCore.bind(ArchivesCoreMessages.ErrorEmptyingFolder,folder.toString()));
errors.add(e);
}
monitor.worked(250);
@@ -119,7 +122,8 @@
b = createFile(node);
}
if( !b ) {
- IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, "Error creating file " + getFile(node).toString());
+ IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
+ ArchivesCore.bind(ArchivesCoreMessages.ErrorCreatingFile,getFile(node).toString()));
errors.add(e);
}
return true;
@@ -137,14 +141,17 @@
}
public static IStatus[] copyFiles(IArchiveFileSet fileset, final FileWrapper[] files, IProgressMonitor monitor, boolean sync) {
- monitor.beginTask("Copying " + files.length + " files", files.length * 100);
+ monitor.beginTask(ArchivesCore.bind(ArchivesCoreMessages.CopyingCountFiles,
+ new Integer(files.length).toString()), files.length * 100);
boolean b = true;
ArrayList<IStatus> list = new ArrayList<IStatus>();
final File[] destFiles = getFiles(files, fileset);
for( int i = 0; i < files.length; i++ ) {
b = TrueZipUtil.copyFile(files[i].getAbsolutePath(), destFiles[i]);
if( b == false ) {
- list.add(new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, "File copy failed. Source=" + files[i].getAbsolutePath() + ", dest=" + destFiles[i]));
+ list.add(new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
+ ArchivesCore.bind(ArchivesCoreMessages.FileCopyFailed,
+ files[i].getAbsolutePath(), destFiles[i].toString())));
}
monitor.worked(100);
}
@@ -158,12 +165,14 @@
* Deleting files
*/
public static IStatus[] deleteFiles(IArchiveFileSet fileset, final FileWrapper[] files, IProgressMonitor monitor, boolean sync ) {
- monitor.beginTask("Deleting " + files.length + " files", files.length * 100);
+ monitor.beginTask(ArchivesCore.bind(ArchivesCoreMessages.DeletingCountFiles,
+ new Integer(files.length).toString()), files.length * 100);
final File[] destFiles = getFiles(files, fileset);
ArrayList<IStatus> list = new ArrayList<IStatus>();
for( int i = 0; i < files.length; i++ ) {
if( !TrueZipUtil.deleteAll(destFiles[i]) ) {
- IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, "Error deleting file " + destFiles[i].toString());
+ IStatus e = new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
+ ArchivesCore.bind(ArchivesCoreMessages.FileDeleteFailed, destFiles[i].toString()));
list.add(e);
}
monitor.worked(100);
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/AntNLS.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/AntNLS.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/AntNLS.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -0,0 +1,464 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * 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:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.jboss.ide.eclipse.archives.core.xpl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.*;
+
+/**
+ * Common superclass for all message bundle classes. Provides convenience
+ * methods for manipulating messages.
+ * <p>
+ * The <code>#bind</code> methods perform string substitution and should be
+ * considered a convenience and <em>not</em> a full substitute replacement for
+ * <code>MessageFormat#format</code> method calls.
+ * </p>
+ * <p>
+ * Text appearing within curly braces in the given message, will be interpreted
+ * as a numeric index to the corresponding substitution object in the given
+ * array. Calling the <code>#bind</code> methods with text that does not map to
+ * an integer will result in an {@link IllegalArgumentException}.
+ * </p>
+ * <p>
+ * Text appearing within single quotes is treated as a literal. A single quote
+ * is escaped by a preceeding single quote.
+ * </p>
+ * <p>
+ * Clients who wish to use the full substitution power of the
+ * <code>MessageFormat</code> class should call that class directly and not use
+ * these <code>#bind</code> methods.
+ * </p>
+ * <p>
+ * Clients may subclass this type.
+ * </p>
+ *
+ * @since 3.1
+ */
+public abstract class AntNLS {
+
+ private static final Object[] EMPTY_ARGS = new Object[0];
+ private static final String EXTENSION = ".properties"; //$NON-NLS-1$
+ private static String[] nlSuffixes;
+ /*
+ * NOTE do not change the name of this field; it is set by the Framework
+ * using reflection
+ */
+// private static FrameworkLog frameworkLog;
+
+ static final int SEVERITY_ERROR = 0x04;
+ static final int SEVERITY_WARNING = 0x02;
+ /*
+ * This object is assigned to the value of a field map to indicate that a
+ * translated message has already been assigned to that field.
+ */
+ static final Object ASSIGNED = new Object();
+
+ /**
+ * Creates a new NLS instance.
+ */
+ protected AntNLS() {
+ }
+
+ /**
+ * Bind the given message's substitution locations with the given string
+ * value.
+ *
+ * @param message
+ * the message to be manipulated
+ * @param binding
+ * the object to be inserted into the message
+ * @return the manipulated String
+ * @throws IllegalArgumentException
+ * if the text appearing within curly braces in the given
+ * message does not map to an integer
+ */
+ public static String bind(String message, Object binding) {
+ return internalBind(message, null, String.valueOf(binding), null);
+ }
+
+ /**
+ * Bind the given message's substitution locations with the given string
+ * values.
+ *
+ * @param message
+ * the message to be manipulated
+ * @param binding1
+ * An object to be inserted into the message
+ * @param binding2
+ * A second object to be inserted into the message
+ * @return the manipulated String
+ * @throws IllegalArgumentException
+ * if the text appearing within curly braces in the given
+ * message does not map to an integer
+ */
+ public static String bind(String message, Object binding1, Object binding2) {
+ return internalBind(message, null, String.valueOf(binding1), String
+ .valueOf(binding2));
+ }
+
+ /**
+ * Bind the given message's substitution locations with the given string
+ * values.
+ *
+ * @param message
+ * the message to be manipulated
+ * @param bindings
+ * An array of objects to be inserted into the message
+ * @return the manipulated String
+ * @throws IllegalArgumentException
+ * if the text appearing within curly braces in the given
+ * message does not map to an integer
+ */
+ public static String bind(String message, Object[] bindings) {
+ return internalBind(message, bindings, null, null);
+ }
+
+ /**
+ * Initialize the given class with the values from the specified message
+ * bundle.
+ *
+ * @param bundleName
+ * fully qualified path of the class name
+ * @param clazz
+ * the class where the constants will exist
+ */
+ public static void initializeMessages(final String bundleName,
+ final Class clazz) {
+ if (System.getSecurityManager() == null) {
+ load(bundleName, clazz);
+ return;
+ }
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ load(bundleName, clazz);
+ return null;
+ }
+ });
+ }
+
+ /*
+ * Perform the string substitution on the given message with the specified
+ * args. See the class comment for exact details.
+ */
+ private static String internalBind(String message, Object[] args,
+ String argZero, String argOne) {
+ if (message == null)
+ return "No message available."; //$NON-NLS-1$
+ if (args == null || args.length == 0)
+ args = EMPTY_ARGS;
+
+ int length = message.length();
+ // estimate correct size of string buffer to avoid growth
+ int bufLen = length + (args.length * 5);
+ if (argZero != null)
+ bufLen += argZero.length() - 3;
+ if (argOne != null)
+ bufLen += argOne.length() - 3;
+ StringBuffer buffer = new StringBuffer(bufLen < 0 ? 0 : bufLen);
+ for (int i = 0; i < length; i++) {
+ char c = message.charAt(i);
+ switch (c) {
+ case '{':
+ int index = message.indexOf('}', i);
+ // if we don't have a matching closing brace then...
+ if (index == -1) {
+ buffer.append(c);
+ break;
+ }
+ i++;
+ if (i >= length) {
+ buffer.append(c);
+ break;
+ }
+ // look for a substitution
+ int number = -1;
+ try {
+ number = Integer.parseInt(message.substring(i, index));
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException();
+ }
+ if (number == 0 && argZero != null)
+ buffer.append(argZero);
+ else if (number == 1 && argOne != null)
+ buffer.append(argOne);
+ else {
+ if (number >= args.length || number < 0) {
+ buffer.append("<missing argument>"); //$NON-NLS-1$
+ i = index;
+ break;
+ }
+ buffer.append(args[number]);
+ }
+ i = index;
+ break;
+ case '\'':
+ // if a single quote is the last char on the line then skip it
+ int nextIndex = i + 1;
+ if (nextIndex >= length) {
+ buffer.append(c);
+ break;
+ }
+ char next = message.charAt(nextIndex);
+ // if the next char is another single quote then write out one
+ if (next == '\'') {
+ i++;
+ buffer.append(c);
+ break;
+ }
+ // otherwise we want to read until we get to the next single
+ // quote
+ index = message.indexOf('\'', nextIndex);
+ // if there are no more in the string, then skip it
+ if (index == -1) {
+ buffer.append(c);
+ break;
+ }
+ // otherwise write out the chars inside the quotes
+ buffer.append(message.substring(nextIndex, index));
+ i = index;
+ break;
+ default:
+ buffer.append(c);
+ }
+ }
+ return buffer.toString();
+ }
+
+ /*
+ * Build an array of property files to search. The returned array contains
+ * the property fields in order from most specific to most generic. So, in
+ * the FR_fr locale, it will return file_fr_FR.properties, then
+ * file_fr.properties, and finally file.properties.
+ */
+ private static String[] buildVariants(String root) {
+ if (nlSuffixes == null) {
+ // build list of suffixes for loading resource bundles
+ String nl = Locale.getDefault().toString();
+ ArrayList result = new ArrayList(4);
+ int lastSeparator;
+ while (true) {
+ result.add('_' + nl + EXTENSION);
+ lastSeparator = nl.lastIndexOf('_');
+ if (lastSeparator == -1)
+ break;
+ nl = nl.substring(0, lastSeparator);
+ }
+ // add the empty suffix last (most general)
+ result.add(EXTENSION);
+ nlSuffixes = (String[]) result.toArray(new String[result.size()]);
+ }
+ root = root.replace('.', '/');
+ String[] variants = new String[nlSuffixes.length];
+ for (int i = 0; i < variants.length; i++)
+ variants[i] = root + nlSuffixes[i];
+ return variants;
+ }
+
+ private static void computeMissingMessages(String bundleName, Class clazz,
+ Map fieldMap, Field[] fieldArray, boolean isAccessible) {
+ // iterate over the fields in the class to make sure that there aren't
+ // any empty ones
+ final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
+ final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
+ final int numFields = fieldArray.length;
+ for (int i = 0; i < numFields; i++) {
+ Field field = fieldArray[i];
+ if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED)
+ continue;
+ // if the field has a a value assigned, there is nothing to do
+ if (fieldMap.get(field.getName()) == ASSIGNED)
+ continue;
+ try {
+ // Set a value for this empty field. We should never get an
+ // exception here because
+ // we know we have a public static non-final field. If we do get
+ // an exception, silently
+ // log it and continue. This means that the field will (most
+ // likely) be un-initialized and
+ // will fail later in the code and if so then we will see both
+ // the NPE and this error.
+ String value = "NLS missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$
+// if (Debug.DEBUG_MESSAGE_BUNDLES)
+// System.out.println(value);
+ log(SEVERITY_WARNING, value, null);
+ if (!isAccessible)
+ field.setAccessible(true);
+ field.set(null, value);
+ } catch (Exception e) {
+ log(
+ SEVERITY_ERROR,
+ "Error setting the missing message value for: " + field.getName(), e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /*
+ * Load the given resource bundle using the specified class loader.
+ */
+ static void load(final String bundleName, Class clazz) {
+ long start = System.currentTimeMillis();
+ final Field[] fieldArray = clazz.getDeclaredFields();
+ ClassLoader loader = clazz.getClassLoader();
+
+ boolean isAccessible = (clazz.getModifiers() & Modifier.PUBLIC) != 0;
+
+ // build a map of field names to Field objects
+ final int len = fieldArray.length;
+ Map fields = new HashMap(len * 2);
+ for (int i = 0; i < len; i++)
+ fields.put(fieldArray[i].getName(), fieldArray[i]);
+
+ // search the variants from most specific to most general, since
+ // the MessagesProperties.put method will mark assigned fields
+ // to prevent them from being assigned twice
+ final String[] variants = buildVariants(bundleName);
+ for (int i = 0; i < variants.length; i++) {
+ // loader==null if we're launched off the Java boot classpath
+ final InputStream input = loader == null ? ClassLoader
+ .getSystemResourceAsStream(variants[i]) : loader
+ .getResourceAsStream(variants[i]);
+ if (input == null)
+ continue;
+ try {
+ final MessagesProperties properties = new MessagesProperties(
+ fields, bundleName, isAccessible);
+ properties.load(input);
+ } catch (IOException e) {
+ log(SEVERITY_ERROR, "Error loading " + variants[i], e); //$NON-NLS-1$
+ } finally {
+ if (input != null)
+ try {
+ input.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ computeMissingMessages(bundleName, clazz, fields, fieldArray,
+ isAccessible);
+// if (Debug.DEBUG_MESSAGE_BUNDLES)
+// System.out
+// .println("Time to load message bundle: " + bundleName + " was " + (System.currentTimeMillis() - start) + "ms."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ /*
+ * The method adds a log entry based on the error message and exception. The
+ * output is written to the System.err.
+ *
+ * This method is only expected to be called if there is a problem in the
+ * NLS mechanism. As a result, translation facility is not available here
+ * and messages coming out of this log are generally not translated.
+ *
+ * @param severity - severity of the message (SEVERITY_ERROR or
+ * SEVERITY_WARNING)
+ *
+ * @param message - message to log
+ *
+ * @param e - exception to log
+ */
+ static void log(int severity, String message, Exception e) {
+// if (frameworkLog != null) {
+// frameworkLog.log(new FrameworkLogEntry(
+// "org.eclipse.osgi", severity, 1, message, 0, e, null)); //$NON-NLS-1$
+// return;
+// }
+ String statusMsg;
+ switch (severity) {
+ case SEVERITY_ERROR:
+ statusMsg = "Error: "; //$NON-NLS-1$
+ break;
+ case SEVERITY_WARNING:
+ // intentionally fall through:
+ default:
+ statusMsg = "Warning: "; //$NON-NLS-1$
+ }
+ if (message != null)
+ statusMsg += message;
+ if (e != null)
+ statusMsg += ": " + e.getMessage(); //$NON-NLS-1$
+ System.err.println(statusMsg);
+ if (e != null)
+ e.printStackTrace();
+ }
+
+ /*
+ * Class which sub-classes java.util.Properties and uses the #put method to
+ * set field values rather than storing the values in the table.
+ */
+ private static class MessagesProperties extends Properties {
+
+ private static final int MOD_EXPECTED = Modifier.PUBLIC
+ | Modifier.STATIC;
+ private static final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
+ private static final long serialVersionUID = 1L;
+
+ private final String bundleName;
+ private final Map fields;
+ private final boolean isAccessible;
+
+ public MessagesProperties(Map fieldMap, String bundleName,
+ boolean isAccessible) {
+ super();
+ this.fields = fieldMap;
+ this.bundleName = bundleName;
+ this.isAccessible = isAccessible;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.util.Hashtable#put(java.lang.Object, java.lang.Object)
+ */
+ public synchronized Object put(Object key, Object value) {
+ Object fieldObject = fields.put(key, ASSIGNED);
+ // if already assigned, there is nothing to do
+ if (fieldObject == ASSIGNED)
+ return null;
+ if (fieldObject == null) {
+ final String msg = "NLS unused message: " + key + " in: " + bundleName;//$NON-NLS-1$ //$NON-NLS-2$
+// if (Debug.DEBUG_MESSAGE_BUNDLES)
+// System.out.println(msg);
+ log(SEVERITY_WARNING, msg, null);
+ return null;
+ }
+ final Field field = (Field) fieldObject;
+ // can only set value of public static non-final fields
+ if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED)
+ return null;
+ try {
+ // Check to see if we are allowed to modify the field. If we
+ // aren't (for instance
+ // if the class is not public) then change the accessible
+ // attribute of the field
+ // before trying to set the value.
+ if (!isAccessible)
+ field.setAccessible(true);
+ // Set the value into the field. We should never get an
+ // exception here because
+ // we know we have a public static non-final field. If we do get
+ // an exception, silently
+ // log it and continue. This means that the field will (most
+ // likely) be un-initialized and
+ // will fail later in the code and if so then we will see both
+ // the NPE and this error.
+ field.set(null, value);
+ } catch (Exception e) {
+ log(SEVERITY_ERROR, "Exception setting field value.", e); //$NON-NLS-1$
+ }
+ return null;
+ }
+ }
+}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/StringSubstitutionEngineClone.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/StringSubstitutionEngineClone.java 2008-09-25 00:02:27 UTC (rev 10469)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/StringSubstitutionEngineClone.java 2008-09-25 01:35:11 UTC (rev 10470)
@@ -4,7 +4,7 @@
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -21,25 +21,26 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.IVariableManager;
/**
* Performs string substitution for context and value variables.
*/
public class StringSubstitutionEngineClone {
-
+
// delimiters
- private static final String VARIABLE_START = "${";
+ private static final String VARIABLE_START = "${"; //$NON-NLS-1$
private static final char VARIABLE_END = '}';
// parsing states
private static final int SCAN_FOR_START = 0;
private static final int SCAN_FOR_END = 1;
-
+
/**
* Resulting string
*/
private StringBuffer fResult;
-
+
class VariableReference {
private StringBuffer fText;
public VariableReference() {
@@ -52,21 +53,21 @@
return fText.toString();
}
}
-
+
public String performStringSubstitution(String expression, boolean reportUndefinedVariables, IVariableManager manager ) throws CoreException {
substitute(expression, reportUndefinedVariables,manager );
return fResult.toString();
}
-
+
public void validateStringVariables(String expression, IVariableManager manager ) throws CoreException {
performStringSubstitution(expression, true, manager );
}
-
+
private HashSet substitute(String expression, boolean reportUndefinedVariables, IVariableManager manager) throws CoreException {
Stack fStack;
fResult = new StringBuffer(expression.length());
fStack = new Stack();
-
+
HashSet resolvedVariables = new HashSet();
int pos = 0;
@@ -84,7 +85,7 @@
pos = start + 2;
state = SCAN_FOR_END;
- fStack.push(new VariableReference());
+ fStack.push(new VariableReference());
} else {
// done - no more variables
fResult.append(expression.substring(pos));
@@ -109,14 +110,14 @@
tos.append(expression.substring(pos, start));
}
pos = start + 2;
- fStack.push(new VariableReference());
+ fStack.push(new VariableReference());
} else {
// end of variable reference
VariableReference tos = (VariableReference)fStack.pop();
- String substring = expression.substring(pos, end);
+ String substring = expression.substring(pos, end);
tos.append(substring);
resolvedVariables.add(substring);
-
+
pos = end + 1;
String value= resolve(tos, reportUndefinedVariables, manager);
if (value == null) {
@@ -148,15 +149,15 @@
var.append(tos.getText());
}
}
-
+
return resolvedVariables;
}
/**
* Resolve and return the value of the given variable reference,
- * possibly <code>null</code>.
- *
+ * possibly <code>null</code>.
+ *
* @param var
* @param reportUndefinedVariables whether to report undefined variables as
* an error
@@ -170,10 +171,11 @@
name = text;
if( !manager.containsVariable(name)) {
if( reportUndefinedVariables )
- throw new CoreException(new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID, "Variable " + name + " undefined"));
+ throw new CoreException(new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
+ ArchivesCore.bind(ArchivesCoreMessages.VariableUndefined, name)));
return getOriginalVarText(var);
}
-
+
String ret = manager.getVariableValue(name);
if(ret == null)
return getOriginalVarText(var);
16 years, 3 months