JBoss Tools SVN: r10529 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-09-29 08:07:28 -0400 (Mon, 29 Sep 2008)
New Revision: 10529
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2698
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2008-09-29 11:15:51 UTC (rev 10528)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2008-09-29 12:07:28 UTC (rev 10529)
@@ -14,12 +14,8 @@
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jpt.core.JpaProject;
@@ -39,11 +35,9 @@
private IStructuredSelection selection;
- private GenerateInitWizardPage initPage;
+ private GenerateDdlWizardPage initPage;
- private GenerateDdlWizardPage page2;
-
public GenerateDdlWizard(JpaProject jpaProject, IStructuredSelection selection) {
super();
this.jpaProject = jpaProject;
@@ -54,12 +48,10 @@
@Override
public void addPages() {
super.addPages();
- initPage = new GenerateInitWizardPage(jpaProject);
- page2 = new GenerateDdlWizardPage("");
+ initPage = new GenerateDdlWizardPage(jpaProject);
addPage(initPage);
- addPage(page2);
}
-
+
@Override
public boolean performFinish() {
String projectName = jpaProject.getName();
@@ -67,10 +59,10 @@
if (wc != null) {
String concoleConfigurationName = initPage.getConfigurationName();
wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, concoleConfigurationName);
- wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, page2.getOutputDir()); //$NON-NLS-1$
+ wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, initPage.getOutputDir()); //$NON-NLS-1$
Map<String, String> prop = new HashMap<String, String>();
- prop.put("outputFileName", page2.getFilename());
+ prop.put("outputFileName", initPage.getFilename());
//prop.put("outputdir", project.getName() + "\\src");
prop.put("format", "true");
prop.put("scriptToConsole", "false");
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2008-09-29 11:15:51 UTC (rev 10528)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2008-09-29 12:07:28 UTC (rev 10529)
@@ -11,22 +11,18 @@
package org.jboss.tools.hibernate.jpt.ui.wizard;
import org.eclipse.core.internal.resources.LocationValidator;
-import org.eclipse.core.internal.resources.OS;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
+import org.eclipse.jpt.core.JpaProject;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
@@ -38,7 +34,7 @@
* @author Dmitry Geraskov
*
*/
-public class GenerateDdlWizardPage extends WizardPage {
+public class GenerateDdlWizardPage extends GenerateInitWizardPage {
private StringButtonDialogField outputdir;
@@ -46,27 +42,18 @@
private LocationValidator validator = new LocationValidator((Workspace) ResourcesPlugin.getWorkspace());
- /**
- * @param pageName
- */
- protected GenerateDdlWizardPage(String pageName) {
- super(pageName);
- // TODO Auto-generated constructor stub
+
+ protected GenerateDdlWizardPage(JpaProject jpaProject) {
+ super(jpaProject);
}
/* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ * @see org.jboss.tools.hibernate.jpt.ui.wizard.GenerateInitWizardPage#createChildControls(org.eclipse.swt.widgets.Composite)
*/
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
+ @Override
+ protected void createChildControls(Composite container) {
int numColumns = 3;
-
- container.setLayout(layout);
- layout.numColumns = numColumns;
- layout.verticalSpacing = 10;
-
-
+
IDialogFieldListener fieldlistener = new IDialogFieldListener() {
public void dialogFieldChanged(DialogField field) {
dialogChanged();
@@ -94,11 +81,10 @@
filename.setText("schema.ddl");
filename.setDialogFieldListener(fieldlistener);
filename.doFillIntoGrid(container, numColumns);
-
- setControl(container);
- setPageComplete( false );
- }
+ setPageComplete( false );
+ }
+
protected void dialogChanged() {
String msg = PathHelper.checkDirectory(getOutputDir(), HibernateConsoleMessages.CodeGenerationSettingsTab_output_directory, false);
@@ -120,8 +106,7 @@
return;
}
- setErrorMessage( null );
- setPageComplete( true );
+ super.dialogChanged();
}
public String getFilename(){
@@ -132,4 +117,5 @@
return outputdir.getText();
}
+
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2008-09-29 11:15:51 UTC (rev 10528)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2008-09-29 12:07:28 UTC (rev 10529)
@@ -28,13 +28,13 @@
*/
public class GenerateEntitiesWizard extends Wizard {
+
private JpaProject jpaProject;
private IStructuredSelection selection;
- private GenerateInitWizardPage initPage;
+ private GenerateEntitiesWizardPage initPage;
- private GenerateEntitiesWizardPage page2;
public GenerateEntitiesWizard( JpaProject jpaProject, IStructuredSelection selection) {
super();
@@ -46,10 +46,8 @@
@Override
public void addPages() {
super.addPages();
- initPage = new GenerateInitWizardPage(jpaProject);
- page2 = new GenerateEntitiesWizardPage("");
+ initPage = new GenerateEntitiesWizardPage(jpaProject);
addPage(initPage);
- addPage(page2);
}
@Override
@@ -61,10 +59,10 @@
String concoleConfigurationName = initPage.getConfigurationName();
wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, concoleConfigurationName);
- wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, page2.getOutputDir()); //$NON-NLS-1$
+ wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, initPage.getOutputDir()); //$NON-NLS-1$
wc.setAttribute(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER, true);
- wc.setAttribute(HibernateLaunchConstants.ATTR_PACKAGE_NAME, page2.getPackageName());
+ wc.setAttribute(HibernateLaunchConstants.ATTR_PACKAGE_NAME, initPage.getPackageName());
wc.setAttribute(HibernateLaunchConstants.ATTR_PREFER_BASIC_COMPOSITE_IDS, true);
wc.setAttribute(HibernateLaunchConstants.ATTR_AUTOMATIC_MANY_TO_MANY, true);
wc.setAttribute(HibernateLaunchConstants.ATTR_AUTOMATIC_VERSIONING, true);
@@ -88,4 +86,5 @@
}
return true;
}
+
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java 2008-09-29 11:15:51 UTC (rev 10528)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java 2008-09-29 12:07:28 UTC (rev 10529)
@@ -18,11 +18,8 @@
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
+import org.eclipse.jpt.core.JpaProject;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
@@ -34,8 +31,8 @@
* @author Dmitry Geraskov
*
*/
-public class GenerateEntitiesWizardPage extends WizardPage {
-
+public class GenerateEntitiesWizardPage extends GenerateInitWizardPage {
+
private StringButtonDialogField outputdir;
private StringDialogField packageName;
@@ -43,34 +40,17 @@
/**
* @param pageName
*/
- public GenerateEntitiesWizardPage(String pageName) {
- super(pageName);
- // TODO Auto-generated constructor stub
+ public GenerateEntitiesWizardPage(JpaProject jpaProject) {
+ super(jpaProject);
}
-
- /**
- * @param pageName
- * @param title
- * @param titleImage
- */
- public GenerateEntitiesWizardPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- // TODO Auto-generated constructor stub
- }
-
+
/* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ * @see org.jboss.tools.hibernate.jpt.ui.wizard.GenerateInitWizardPage#createChildControls(org.eclipse.swt.widgets.Composite)
*/
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
+ @Override
+ protected void createChildControls(Composite container) {
int numColumns = 3;
- container.setLayout(layout);
- layout.numColumns = numColumns;
- layout.verticalSpacing = 10;
-
-
IDialogFieldListener fieldlistener = new IDialogFieldListener() {
public void dialogFieldChanged(DialogField field) {
dialogChanged();
@@ -98,11 +78,10 @@
packageName.setLabelText(HibernateConsoleMessages.CodeGenerationSettingsTab_package);
packageName.doFillIntoGrid(container, numColumns);
- setControl(container);
- //default package is acceptable
- setPageComplete( true );
+ setPageComplete( false );
}
+
protected void dialogChanged() {
String msg = PathHelper.checkDirectory(getOutputDir(), HibernateConsoleMessages.CodeGenerationSettingsTab_output_directory, false);
@@ -120,8 +99,7 @@
}
}
- setErrorMessage( null );
- setPageComplete( true );
+ super.dialogChanged();
}
public String getPackageName(){
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-09-29 11:15:51 UTC (rev 10528)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-09-29 12:07:28 UTC (rev 10529)
@@ -58,7 +58,7 @@
* @author Dmitry Geraskov
*
*/
-public class GenerateInitWizardPage extends WizardPage {
+public abstract class GenerateInitWizardPage extends WizardPage {
private ComboDialogField connectionProfileName;
@@ -96,6 +96,8 @@
layout.numColumns = numColumns;
layout.verticalSpacing = 10;
+ createChildControls(container);
+
selectMethod = new Button(container, SWT.CHECK);
selectMethod.setText("Use Console Configuration");
selectMethod.setSelection(true);
@@ -122,19 +124,21 @@
names[i] = configuration.getName();
}
consoleConfigurationName.setItems(names);
-
-
-
consoleConfigurationName.setDialogFieldListener(fieldlistener);
consoleConfigurationName.doFillIntoGrid(container, numColumns);
- createDBGroup(container, numColumns);
+ createDBGroup(container, numColumns);
setControl(container);
- setPageComplete( false );
}
/**
+ * @param parent
+ */
+ protected abstract void createChildControls(Composite parent);
+
+
+ /**
* @param container
* @param colCount
*/
@@ -200,9 +204,7 @@
private String[] dtpConnectionProfileNames() {
List<String> list = new ArrayList<String>();
- /*for (Iterator<String> i = CollectionTools.sort(JptDbPlugin.instance().getConnectionProfileRepository().connectionProfileNames()); i.hasNext();) {
- list.add(i.next());
- }*/
+
IConnectionProfile[] cps = ProfileManager.getInstance().getProfiles();
for (int i = 0; i < cps.length; i++) {
list.add(cps[i].getName());
16 years, 3 months
JBoss Tools SVN: r10528 - trunk/vpe/plugins/org.jboss.tools.vpe/resources/help.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-09-29 07:15:51 -0400 (Mon, 29 Sep 2008)
New Revision: 10528
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/resources/help/keys-vpe.properties
Log:
=JBIDE-2773
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/resources/help/keys-vpe.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/resources/help/keys-vpe.properties 2008-09-29 11:06:45 UTC (rev 10527)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/resources/help/keys-vpe.properties 2008-09-29 11:15:51 UTC (rev 10528)
@@ -26,9 +26,13 @@
VPEGlobalElReference.location=El Value
VPEGlobalElReference.prefix=Value
+VPEGlobalElReference_AddItem.Title=Add El Item
+VPEGlobalElReference_EditItem.Title=Edit EL Item
VPEGlobalElReferenceExt.location=El Value
VPEGlobalElReferenceExt.prefix=Value
+VPEGlobalElReferenceExt_AddItem.Title=Add El Item
+VPEGlobalElReferenceExt_EditItem.Title=Edit EL Item
VpeResourcesDialog.WindowTitle=References to Resources
VpeResourcesDialog.Title=Page Design Options
16 years, 3 months
JBoss Tools SVN: r10527 - in trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor: figures and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-09-29 07:06:45 -0400 (Mon, 29 Sep 2008)
New Revision: 10527
Removed:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PathLabel.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2254
fine tuning
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-29 09:45:56 UTC (rev 10526)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java 2008-09-29 11:06:45 UTC (rev 10527)
@@ -35,6 +35,7 @@
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.gef.edit.GEFRootEditPart;
+import org.jboss.tools.common.gef.figures.GEFLabel;
import org.jboss.tools.common.gef.figures.xpl.CustomLocator;
import org.jboss.tools.seam.ui.pages.editor.PagesEditor;
import org.jboss.tools.seam.ui.pages.editor.PagesEditor.ModelSelectionProvider;
@@ -43,7 +44,6 @@
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
import org.jboss.tools.seam.ui.pages.editor.figures.ConnectionFigure;
import org.jboss.tools.seam.ui.pages.editor.figures.FigureFactory;
-import org.jboss.tools.seam.ui.pages.editor.figures.PathLabel;
public class LinkEditPart extends AbstractConnectionEditPart implements
PropertyChangeListener, EditPartListener {
@@ -60,11 +60,11 @@
private CustomLocator shortcutLocator;
- private PathLabel shortcutLabel;
+ private GEFLabel shortcutLabel;
private CustomLocator pathLocator;
- private PathLabel pathLabel;
+ private GEFLabel pathLabel;
private PageEditPart pagePart = null;
@@ -118,7 +118,7 @@
//conn.repaint();
}
- pathLabel = new PathLabel(getLink().getName());
+ pathLabel = new GEFLabel(getLink().getName(), FigureFactory.normalColor);
pathLabel.setFont(pathFont);
pathLabel.setIcon(null);
pathLabel.setTextAlignment(Label.LEFT);
@@ -135,7 +135,7 @@
if(getLink().getToElement() != null)
text = getLink().getToElement().getName();
- shortcutLabel = new PathLabel(text);
+ shortcutLabel = new GEFLabel(text, FigureFactory.normalColor);
// if (getLink().getJSFModel().getOptions().showShortcutIcon())
shortcutLabel.setIcon(icon);
// shortcutLabel.setFont(getLink().getJSFModel().getOptions()
Deleted: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PathLabel.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PathLabel.java 2008-09-29 09:45:56 UTC (rev 10526)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PathLabel.java 2008-09-29 11:06:45 UTC (rev 10527)
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.pages.editor.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-public class PathLabel extends Label{
-
- public PathLabel(String name){
- super(name);
- }
-
- protected void paintFigure(Graphics graphics){
- Rectangle bounds = getBounds();
- graphics.translate(bounds.x, bounds.y);
- if(!graphics.getForegroundColor().equals(FigureFactory.selectedColor)) graphics.setForegroundColor(FigureFactory.pathColor);
- if(getIcon()!= null)graphics.drawImage(getIcon(), getIconLocation());
- graphics.drawText(getSubStringText(), getTextLocation());
- graphics.translate(-bounds.x, -bounds.y);
- }
-
-}
\ No newline at end of file
16 years, 3 months
JBoss Tools SVN: r10526 - 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-29 05:45:56 -0400 (Mon, 29 Sep 2008)
New Revision: 10526
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELOperandResolveStatus.java
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.
Methods in SeamELCompletionEngine refactored.
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-28 08:01:34 UTC (rev 10525)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java 2008-09-29 09:45:56 UTC (rev 10526)
@@ -200,7 +200,6 @@
return null;
}
-
/**
* Finds var/value attribute in node
* @param node
@@ -260,12 +259,12 @@
if(resolvedToken==null && parentVar.getElToken()!=null) {
try {
// Initialize parent vars.
-// engine.resolveSeamELOperand(project, file, var.getElToken(), true, parentVars, this);
+ engine.resolveSeamELOperand(project, file, var.getElToken(), true, parentVars, this);
resolvedToken = parentVar.getResolvedElToken();
} catch (StringIndexOutOfBoundsException e) {
SeamCorePlugin.getPluginLog().logError(e);
-// } catch (BadLocationException e) {
-// SeamCorePlugin.getPluginLog().logError(e);
+ } catch (BadLocationException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
}
}
if(resolvedToken!=null) {
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-28 08:01:34 UTC (rev 10525)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-09-29 09:45:56 UTC (rev 10526)
@@ -109,10 +109,10 @@
//TODO change algorithm for finding operand.
String prefix2 = SeamELCompletionEngine.getPrefix(documentContent, position + prefix.length());
-// SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, parseOperand(prefix2), returnEqualedVariablesOnly, vars, new ElVarSearcher(project, file, this));
-// if (status.isOK()) {
-// completions.addAll(status.getProposals());
-// }
+ SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, parseOperand(prefix2), returnEqualedVariablesOnly, vars, new ElVarSearcher(project, file, this));
+ if (status.isOK()) {
+ completions.addAll(status.getProposals());
+ }
return completions;
}
@@ -131,74 +131,74 @@
return proposals;
}
-// public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
-// boolean returnEqualedVariablesOnly, List<Var> vars, ElVarSearcher varSearcher) throws BadLocationException, StringIndexOutOfBoundsException {
-// if(operand == null) {
-// //TODO
-// return new SeamELOperandResolveStatus(null);
-// }
-// String oldEl = operand.getText();
-// Var var = varSearcher.findVarForEl(oldEl, vars, true);
-// String suffix = "";
-// String newEl = oldEl;
-// if(var!=null) {
-// TypeInfoCollector.MemberInfo member = resolveSeamEL(project, file, var.getElToken());
-// if(member!=null && !member.getType().isArray()) {
-// IType type = member.getMemberType();
-// if(type!=null) {
-// try {
-// if(TypeInfoCollector.isInstanceofType(type, "java.util.Map")) {
-// suffix = collectionAdditionForMapDataModel;
-// } else {
-// suffix = collectionAdditionForCollectionDataModel;
-// }
-// } catch (JavaModelException e) {
-// SeamCorePlugin.getPluginLog().logError(e);
-// }
-// }
-// }
-// if(var.getElToken() != null) {
-// newEl = var.getElToken().getText() + suffix + oldEl.substring(var.getName().length());
-// }
-// }
-// boolean prefixWasChanged = newEl != oldEl;
-// ELExpression newOperand = (prefixWasChanged) ? parseOperand(newEl) : operand;
-//
-// SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, newOperand, returnEqualedVariablesOnly);
-//
-// if(prefixWasChanged) {
-// ELInvocationExpression newLastResolvedToken = status.getLastResolvedToken();
-// status.setTokens((ELInvocationExpression)operand);
-// if(newLastResolvedToken != null) {
-// if(status.getUnresolvedTokens() != null
-// && status.getUnresolvedTokens().getInvocationStartPosition() - status.getUnresolvedTokens().getStartPosition() < var.getElToken().getLength() + suffix.length()) {
-// // Last resolved token is token from "var". Set first token of original EL as last resolved one.
-// status.setLastResolvedToken(null);
-// } else {
-// // Last resolved token is token outside "var" prefix. Correct last resolved token.
-// int oldLastResolvedTokenStart = newLastResolvedToken.getInvocationStartPosition() - var.getElToken().getText().length() - suffix.length() + var.getName().length();
-// ELInvocationExpression l = (ELInvocationExpression)operand;
-// while(l != null) {
-// if(l.getInvocationStartPosition() - l.getStartPosition() <= oldLastResolvedTokenStart) {
-// status.setLastResolvedToken(l);
-// break;
-// }
-// l = l.getLeft();
-// }
-// }
-// }
-// }
-//
-// if(prefixWasChanged) {
-// var.resolveValue("#{" + var.getElToken().getText() + suffix + "}");
-// }
-//
-// if(!returnEqualedVariablesOnly && vars!=null) {
-// status.getProposals().addAll(getVarNameProposals(vars, operand.toString()));
-// }
-// return status;
-// }
+ public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
+ boolean returnEqualedVariablesOnly, List<Var> vars, ElVarSearcher varSearcher) throws BadLocationException, StringIndexOutOfBoundsException {
+ if(operand == null) {
+ //TODO
+ return new SeamELOperandResolveStatus(null);
+ }
+ String oldEl = operand.getText();
+ Var var = varSearcher.findVarForEl(oldEl, vars, true);
+ String suffix = "";
+ String newEl = oldEl;
+ if(var!=null) {
+ TypeInfoCollector.MemberInfo member = resolveSeamEL(project, file, var.getElToken());
+ if(member!=null && !member.getType().isArray()) {
+ IType type = member.getMemberType();
+ if(type!=null) {
+ try {
+ if(TypeInfoCollector.isInstanceofType(type, "java.util.Map")) {
+ suffix = collectionAdditionForMapDataModel;
+ } else {
+ suffix = collectionAdditionForCollectionDataModel;
+ }
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+ if(var.getElToken() != null) {
+ newEl = var.getElToken().getText() + suffix + oldEl.substring(var.getName().length());
+ }
+ }
+ boolean prefixWasChanged = newEl != oldEl;
+ ELExpression newOperand = (prefixWasChanged) ? parseOperand(newEl) : operand;
+ SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, newOperand, returnEqualedVariablesOnly);
+
+ if(prefixWasChanged) {
+ ELInvocationExpression newLastResolvedToken = status.getLastResolvedToken();
+ status.setTokens((ELInvocationExpression)operand);
+ if(newLastResolvedToken != null) {
+ if(status.getUnresolvedTokens() != null
+ && status.getUnresolvedTokens().getInvocationStartPosition() - status.getUnresolvedTokens().getStartPosition() < var.getElToken().getLength() + suffix.length()) {
+ // Last resolved token is token from "var". Set first token of original EL as last resolved one.
+ status.setLastResolvedToken(null);
+ } else {
+ // Last resolved token is token outside "var" prefix. Correct last resolved token.
+ int oldLastResolvedTokenStart = newLastResolvedToken.getInvocationStartPosition() - var.getElToken().getText().length() - suffix.length() + var.getName().length();
+ ELInvocationExpression l = (ELInvocationExpression)operand;
+ while(l != null) {
+ if(l.getInvocationStartPosition() - l.getStartPosition() <= oldLastResolvedTokenStart) {
+ status.setLastResolvedToken(l);
+ break;
+ }
+ l = l.getLeft();
+ }
+ }
+ }
+ }
+
+ if(prefixWasChanged) {
+ var.resolveValue("#{" + var.getElToken().getText() + suffix + "}");
+ }
+
+ if(!returnEqualedVariablesOnly && vars!=null) {
+ status.getProposals().addAll(getVarNameProposals(vars, operand.toString()));
+ }
+ return status;
+ }
+
public static ELExpression parseOperand(String operand) {
if(operand == null) return null;
String el = (operand.indexOf("#{") < 0) ? "#{" + operand + "}" : operand;
@@ -208,6 +208,7 @@
if(is.size() == 0) return null;
return is.get(0).getExpression();
}
+
/**
* Returns MemberInfo for last segment of EL. Null if El is not resolved.
* @param project
@@ -219,10 +220,9 @@
*/
public TypeInfoCollector.MemberInfo resolveSeamEL(ISeamProject project, IFile file, ELExpression operand) throws BadLocationException, StringIndexOutOfBoundsException {
if(!(operand instanceof ELInvocationExpression)) return null;
-// SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, operand, true);
-//
-// return status.getMemberOfResolvedOperand();
- return null;
+ SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, operand, true);
+
+ return status.getMemberOfResolvedOperand();
}
/**
@@ -253,293 +253,293 @@
boolean isIncomplete = expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION
&& ((ELPropertyInvocation) expr).getName() == null;
-// SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
-// ELInvocationExpression left = expr;
-//
-// ScopeType scope = getScope(project, file);
-//
-// if (expr.getLeft() == null && isIncomplete) {
-// resolvedVariables = resolveVariables(project, scope, expr, true, true);
-// } else {
-// while (left != null) {
-// List<ISeamContextVariable> resolvedVars = new ArrayList<ISeamContextVariable>();
-// resolvedVars = resolveVariables(project, scope, left,
-// left == expr, true);
-// if (resolvedVars != null && !resolvedVars.isEmpty()) {
-// resolvedVariables = resolvedVars;
-// status.setLastResolvedToken(left);
-// break;
-// }
-// left = (ELInvocationExpression) left.getLeft();
-// }
-// }
+ SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
+ ELInvocationExpression left = expr;
-// if (left != expr) {
-// resolvedVariables.clear();
-// }
+ ScopeType scope = getScope(project, file);
+ if (expr.getLeft() == null && isIncomplete) {
+ resolvedVariables = resolveVariables(project, scope, expr, true, true);
+ } else {
+ while (left != null) {
+ List<ISeamContextVariable> resolvedVars = new ArrayList<ISeamContextVariable>();
+ resolvedVars = resolveVariables(project, scope, left,
+ left == expr, true);
+ if (resolvedVars != null && !resolvedVars.isEmpty()) {
+ resolvedVariables = resolvedVars;
+ status.setLastResolvedToken(left);
+ break;
+ }
+ left = (ELInvocationExpression) left.getLeft();
+ }
+ }
+
+ if (left != expr) {
+ resolvedVariables.clear();
+ }
+
return resolvedVariables;
}
-// public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
-// boolean returnEqualedVariablesOnly) throws BadLocationException, StringIndexOutOfBoundsException {
-// if(!(operand instanceof ELInvocationExpression)) {
-// return new SeamELOperandResolveStatus(null);
-// }
-//
-// ELInvocationExpression expr = (ELInvocationExpression)operand;
-// boolean isIncomplete = expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION
-// && ((ELPropertyInvocation)expr).getName() == null;
-//
-// SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
-// ELInvocationExpression left = expr;
-//
-// List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
-// ScopeType scope = getScope(project, file);
-//
-// if (expr.getLeft() == null && isIncomplete) {
-// resolvedVariables = resolveVariables(project, scope,
-// expr, true,
-// returnEqualedVariablesOnly);
-// } else {
-// while(left != null) {
-// List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
-// resolvedVars = resolveVariables(project, scope,
-// left, left == expr,
-// returnEqualedVariablesOnly);
-// if (resolvedVars != null && !resolvedVars.isEmpty()) {
-// resolvedVariables = resolvedVars;
-// status.setLastResolvedToken(left);
-// break;
+ public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
+ boolean returnEqualedVariablesOnly) throws BadLocationException, StringIndexOutOfBoundsException {
+ if(!(operand instanceof ELInvocationExpression)) {
+ return new SeamELOperandResolveStatus(null);
+ }
+
+ ELInvocationExpression expr = (ELInvocationExpression)operand;
+ boolean isIncomplete = expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION
+ && ((ELPropertyInvocation)expr).getName() == null;
+
+ SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
+ ELInvocationExpression left = expr;
+
+ List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
+ ScopeType scope = getScope(project, file);
+
+ if (expr.getLeft() == null && isIncomplete) {
+ resolvedVariables = resolveVariables(project, scope,
+ expr, true,
+ returnEqualedVariablesOnly);
+ } else {
+ while(left != null) {
+ List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
+ resolvedVars = resolveVariables(project, scope,
+ left, left == expr,
+ returnEqualedVariablesOnly);
+ if (resolvedVars != null && !resolvedVars.isEmpty()) {
+ resolvedVariables = resolvedVars;
+ status.setLastResolvedToken(left);
+ break;
+ }
+ left = (ELInvocationExpression)left.getLeft();
+ }
+ }
+
+ // Save all resolved variables. It's useful for incremental validation.
+ if(resolvedVariables != null && resolvedVariables.size() > 0) {
+ status.setUsedVariables(resolvedVariables);
+ }
+
+ if (status.getResolvedTokens() == null &&
+ !returnEqualedVariablesOnly &&
+ expr != null &&
+ isIncomplete) {
+ // no vars are resolved
+ // the tokens are the part of var name ended with a separator (.)
+ resolvedVariables = resolveVariables(project, scope, expr, true, returnEqualedVariablesOnly);
+ Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ for (ISeamContextVariable var : resolvedVariables) {
+ String varName = var.getName();
+ if(varName.startsWith(operand.getText())) {
+ proposals.add(varName.substring(operand.getLength()));
+ }
+ }
+ status.setProposals(proposals);
+ return status;
+ }
+
+ // Here we have a list of vars for some part of expression
+ // OK. we'll proceed with members of these vars
+ if (status.getResolvedTokens() == status.getTokens()) {
+ // First segment is the last one
+ Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ for (ISeamContextVariable var : resolvedVariables) {
+ String varName = var.getName();
+ if(operand.getLength()<=varName.length()) {
+ proposals.add(varName.substring(operand.getLength()));
+ } else if(returnEqualedVariablesOnly) {
+ proposals.add(varName);
+ }
+ status.setMemberOfResolvedOperand(SeamExpressionResolver.getMemberInfoByVariable(var, true));
+ }
+ status.setLastResolvedToken(expr);
+ status.setProposals(proposals);
+ return status;
+ }
+
+ // First segment is found - proceed with next tokens
+ List<TypeInfoCollector.MemberInfo> members = new ArrayList<TypeInfoCollector.MemberInfo>();
+ for (ISeamContextVariable var : resolvedVariables) {
+ TypeInfoCollector.MemberInfo member = SeamExpressionResolver.getMemberInfoByVariable(var, returnEqualedVariablesOnly);
+ if (member != null && !members.contains(member))
+ members.add(member);
+ }
+ if(left != null) while(left != expr) {
+ left = (ELInvocationExpression)left.getParent();
+ if (left != expr) { // inside expression
+ members = resolveSegment(left, members, status, returnEqualedVariablesOnly);
+ } else { // Last segment
+ resolveLastSegment((ELInvocationExpression)operand, members, status, returnEqualedVariablesOnly);
+ break;
+ }
+ }
+
+ if(status.getProposals().isEmpty() && status.getUnpairedGettersOrSetters()!=null) {
+ status.clearUnpairedGettersOrSetters();
+ }
+ return status;
+ }
+
+ private List<TypeInfoCollector.MemberInfo> resolveSegment(ELInvocationExpression expr,
+ List<TypeInfoCollector.MemberInfo> members,
+ SeamELOperandResolveStatus status,
+ boolean returnEqualedVariablesOnly) {
+ LexicalToken lt = (expr instanceof ELPropertyInvocation)
+ ? ((ELPropertyInvocation)expr).getName()
+ : (expr instanceof ELMethodInvocation)
+ ? ((ELMethodInvocation)expr).getName()
+ : null;
+ String name = lt != null ? lt.getText() : ""; // token.getText();
+ if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION) {
+ // Find properties for the token
+ List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ if (mbr.getMemberType() == null) continue;
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
+ }
+ List<TypeInfoCollector.MemberInfo> properties = infos.getProperties();
+ for (TypeInfoCollector.MemberInfo property : properties) {
+ StringBuffer propertyName = new StringBuffer(property.getName());
+ if (property instanceof TypeInfoCollector.MethodInfo) { // Setter or getter
+ propertyName.delete(0, (propertyName.charAt(0) == 'i' ? 2 : 3));
+ propertyName.setCharAt(0, Character.toLowerCase(propertyName.charAt(0)));
+ }
+ if (name.equals(propertyName.toString())) {
+ newMembers.add(property);
+ }
+ }
+ }
+ members = newMembers;
+ if (members != null && members.size() > 0)
+ status.setLastResolvedToken(expr);
+ }
+ if (expr.getType() == ELObjectType.EL_METHOD_INVOCATION) {
+ // Find methods for the token
+ if (name.indexOf('(') != -1) {
+ name = name.substring(0, name.indexOf('('));
+ }
+ List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ if (mbr.getMemberType() == null) continue;
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
+ }
+ List<TypeInfoCollector.MemberInfo> methods = infos.getMethods();
+ for (TypeInfoCollector.MemberInfo method : methods) {
+ if (name.equals(method.getName())) {
+ newMembers.add(method);
+ }
+ }
+ }
+ members = newMembers;
+ if (members != null && members.size() > 0)
+ status.setLastResolvedToken(expr);
+ }
+ return members;
+ }
+
+ private void resolveLastSegment(ELInvocationExpression expr,
+ List<TypeInfoCollector.MemberInfo> members,
+ SeamELOperandResolveStatus status,
+ boolean returnEqualedVariablesOnly) {
+ Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION && ((ELPropertyInvocation)expr).getName() == null) {
+// if (token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
+ // return all the methods + properties
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ if (mbr instanceof MessagesInfo) {
+ // Surround the "long" keys containing the dots with [' ']
+ TreeSet<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ keys.addAll(((MessagesInfo)mbr).getKeys());
+ Iterator<String> sortedKeys = keys.iterator();
+ while(sortedKeys.hasNext()) {
+ String key = sortedKeys.next();
+ if (key == null || key.length() == 0)
+ continue;
+ if (key.indexOf('.') != -1) {
+ proposals.add("['" + key + "']");
+ } else {
+ proposals.add(key);
+ }
+ }
+ continue;
+ }
+ if (mbr.getMemberType() == null) {
+ continue;
+ }
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
+ }
+ proposals.addAll(infos.getMethodPresentationStrings());
+ proposals.addAll(infos.getPropertyPresentationStrings(status.getUnpairedGettersOrSetters()));
+ }
+ } else
+ if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION)
+ //actually any case
+// if (token.getType() == ELOperandToken.EL_VARIABLE_NAME_TOKEN ||
+// token.getType() == ELOperandToken.EL_PROPERTY_NAME_TOKEN ||
+// token.getType() == ELOperandToken.EL_METHOD_TOKEN)
+ {
+ // return filtered methods + properties
+ Set<TypeInfoCollector.MemberPresentation> proposalsToFilter = new TreeSet<TypeInfoCollector.MemberPresentation>(TypeInfoCollector.MEMBER_PRESENTATION_COMPARATOR);
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ if (mbr instanceof MessagesInfo) {
+ Collection<String> keys = ((MessagesInfo)mbr).getKeys();
+ for (String key : keys) {
+ proposalsToFilter.add(new TypeInfoCollector.MemberPresentation(key, mbr));
+ }
+ continue;
+ }
+ if (mbr.getMemberType() == null) continue;
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
+ }
+ proposalsToFilter.addAll(infos.getMethodPresentations());
+ proposalsToFilter.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
+ status.setMemberOfResolvedOperand(mbr);
+ }
+ for (TypeInfoCollector.MemberPresentation proposal : proposalsToFilter) {
+ // We do expect nothing but name for method tokens (No round brackets)
+ LexicalToken lt = (expr instanceof ELPropertyInvocation)
+ ? ((ELPropertyInvocation)expr).getName()
+ : (expr instanceof ELMethodInvocation)
+ ? ((ELMethodInvocation)expr).getName()
+ : null;
+ String filter = lt != null ? lt.getText() : ""; //token.getText();
+// if (filter.indexOf('(') != -1) {
+// filter = filter.substring(0, filter.indexOf('('));
// }
-// left = (ELInvocationExpression)left.getLeft();
-// }
-// }
-//
-// // Save all resolved variables. It's useful for incremental validation.
-// if(resolvedVariables != null && resolvedVariables.size() > 0) {
-// status.setUsedVariables(resolvedVariables);
-// }
-//
-// if (status.getResolvedTokens() == null &&
-// !returnEqualedVariablesOnly &&
-// expr != null &&
-// isIncomplete) {
-// // no vars are resolved
-// // the tokens are the part of var name ended with a separator (.)
-// resolvedVariables = resolveVariables(project, scope, expr, true, returnEqualedVariablesOnly);
-// Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
-// for (ISeamContextVariable var : resolvedVariables) {
-// String varName = var.getName();
-// if(varName.startsWith(operand.getText())) {
-// proposals.add(varName.substring(operand.getLength()));
-// }
-// }
-// status.setProposals(proposals);
-// return status;
-// }
-//
-// // Here we have a list of vars for some part of expression
-// // OK. we'll proceed with members of these vars
-// if (status.getResolvedTokens() == status.getTokens()) {
-// // First segment is the last one
-// Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
-// for (ISeamContextVariable var : resolvedVariables) {
-// String varName = var.getName();
-// if(operand.getLength()<=varName.length()) {
-// proposals.add(varName.substring(operand.getLength()));
-// } else if(returnEqualedVariablesOnly) {
-// proposals.add(varName);
-// }
-// status.setMemberOfResolvedOperand(SeamExpressionResolver.getMemberInfoByVariable(var, true));
-// }
-// status.setLastResolvedToken(expr);
-// status.setProposals(proposals);
-// return status;
-// }
-//
-// // First segment is found - proceed with next tokens
-// List<TypeInfoCollector.MemberInfo> members = new ArrayList<TypeInfoCollector.MemberInfo>();
-// for (ISeamContextVariable var : resolvedVariables) {
-// TypeInfoCollector.MemberInfo member = SeamExpressionResolver.getMemberInfoByVariable(var, returnEqualedVariablesOnly);
-// if (member != null && !members.contains(member))
-// members.add(member);
-// }
-// if(left != null) while(left != expr) {
-// left = (ELInvocationExpression)left.getParent();
-// if (left != expr) { // inside expression
-// members = resolveSegment(left, members, status, returnEqualedVariablesOnly);
-// } else { // Last segment
-// resolveLastSegment((ELInvocationExpression)operand, members, status, returnEqualedVariablesOnly);
-// break;
-// }
-// }
-//
-// if(status.getProposals().isEmpty() && status.getUnpairedGettersOrSetters()!=null) {
-// status.clearUnpairedGettersOrSetters();
-// }
-// return status;
-// }
-//
-// private List<TypeInfoCollector.MemberInfo> resolveSegment(ELInvocationExpression expr,
-// List<TypeInfoCollector.MemberInfo> members,
-// SeamELOperandResolveStatus status,
-// boolean returnEqualedVariablesOnly) {
-// LexicalToken lt = (expr instanceof ELPropertyInvocation)
-// ? ((ELPropertyInvocation)expr).getName()
-// : (expr instanceof ELMethodInvocation)
-// ? ((ELMethodInvocation)expr).getName()
-// : null;
-// String name = lt != null ? lt.getText() : ""; // token.getText();
-// if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION) {
-// // Find properties for the token
-// List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
-// for (TypeInfoCollector.MemberInfo mbr : members) {
-// if (mbr.getMemberType() == null) continue;
-// TypeInfoCollector infos = mbr.getTypeCollector();
-// if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
-// status.setMapOrCollectionOrBundleAmoungTheTokens();
-// }
-// List<TypeInfoCollector.MemberInfo> properties = infos.getProperties();
-// for (TypeInfoCollector.MemberInfo property : properties) {
-// StringBuffer propertyName = new StringBuffer(property.getName());
-// if (property instanceof TypeInfoCollector.MethodInfo) { // Setter or getter
-// propertyName.delete(0, (propertyName.charAt(0) == 'i' ? 2 : 3));
-// propertyName.setCharAt(0, Character.toLowerCase(propertyName.charAt(0)));
-// }
-// if (name.equals(propertyName.toString())) {
-// newMembers.add(property);
-// }
-// }
-// }
-// members = newMembers;
-// if (members != null && members.size() > 0)
-// status.setLastResolvedToken(expr);
-// }
-// if (expr.getType() == ELObjectType.EL_METHOD_INVOCATION) {
-// // Find methods for the token
-// if (name.indexOf('(') != -1) {
-// name = name.substring(0, name.indexOf('('));
-// }
-// List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
-// for (TypeInfoCollector.MemberInfo mbr : members) {
-// if (mbr.getMemberType() == null) continue;
-// TypeInfoCollector infos = mbr.getTypeCollector();
-// if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
-// status.setMapOrCollectionOrBundleAmoungTheTokens();
-// }
-// List<TypeInfoCollector.MemberInfo> methods = infos.getMethods();
-// for (TypeInfoCollector.MemberInfo method : methods) {
-// if (name.equals(method.getName())) {
-// newMembers.add(method);
-// }
-// }
-// }
-// members = newMembers;
-// if (members != null && members.size() > 0)
-// status.setLastResolvedToken(expr);
-// }
-// return members;
-// }
-//
-// private void resolveLastSegment(ELInvocationExpression expr,
-// List<TypeInfoCollector.MemberInfo> members,
-// SeamELOperandResolveStatus status,
-// boolean returnEqualedVariablesOnly) {
-// Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
-// if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION && ((ELPropertyInvocation)expr).getName() == null) {
-//// if (token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
-// // return all the methods + properties
-// for (TypeInfoCollector.MemberInfo mbr : members) {
-// if (mbr instanceof MessagesInfo) {
-// // Surround the "long" keys containing the dots with [' ']
-// TreeSet<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
-// keys.addAll(((MessagesInfo)mbr).getKeys());
-// Iterator<String> sortedKeys = keys.iterator();
-// while(sortedKeys.hasNext()) {
-// String key = sortedKeys.next();
-// if (key == null || key.length() == 0)
-// continue;
-// if (key.indexOf('.') != -1) {
-// proposals.add("['" + key + "']");
-// } else {
-// proposals.add(key);
-// }
-// }
-// continue;
-// }
-// if (mbr.getMemberType() == null) {
-// continue;
-// }
-// TypeInfoCollector infos = mbr.getTypeCollector();
-// if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
-// status.setMapOrCollectionOrBundleAmoungTheTokens();
-// }
-// proposals.addAll(infos.getMethodPresentationStrings());
-// proposals.addAll(infos.getPropertyPresentationStrings(status.getUnpairedGettersOrSetters()));
-// }
-// } else
-// if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION)
-// //actually any case
-//// if (token.getType() == ELOperandToken.EL_VARIABLE_NAME_TOKEN ||
-//// token.getType() == ELOperandToken.EL_PROPERTY_NAME_TOKEN ||
-//// token.getType() == ELOperandToken.EL_METHOD_TOKEN)
-// {
-// // return filtered methods + properties
-// Set<TypeInfoCollector.MemberPresentation> proposalsToFilter = new TreeSet<TypeInfoCollector.MemberPresentation>(TypeInfoCollector.MEMBER_PRESENTATION_COMPARATOR);
-// for (TypeInfoCollector.MemberInfo mbr : members) {
-// if (mbr instanceof MessagesInfo) {
-// Collection<String> keys = ((MessagesInfo)mbr).getKeys();
-// for (String key : keys) {
-// proposalsToFilter.add(new TypeInfoCollector.MemberPresentation(key, mbr));
-// }
-// continue;
-// }
-// if (mbr.getMemberType() == null) continue;
-// TypeInfoCollector infos = mbr.getTypeCollector();
-// if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
-// status.setMapOrCollectionOrBundleAmoungTheTokens();
-// }
-// proposalsToFilter.addAll(infos.getMethodPresentations());
-// proposalsToFilter.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
-// status.setMemberOfResolvedOperand(mbr);
-// }
-// for (TypeInfoCollector.MemberPresentation proposal : proposalsToFilter) {
-// // We do expect nothing but name for method tokens (No round brackets)
-// LexicalToken lt = (expr instanceof ELPropertyInvocation)
-// ? ((ELPropertyInvocation)expr).getName()
-// : (expr instanceof ELMethodInvocation)
-// ? ((ELMethodInvocation)expr).getName()
-// : null;
-// String filter = lt != null ? lt.getText() : ""; //token.getText();
-//// if (filter.indexOf('(') != -1) {
-//// filter = filter.substring(0, filter.indexOf('('));
-//// }
-// if(returnEqualedVariablesOnly) {
-// // This is used for validation.
-// if (proposal.getPresentation().equals(filter)) {
-// proposals.add(proposal.getPresentation());
-// status.setMemberOfResolvedOperand(proposal.getMember());
-// if(status.getUnpairedGettersOrSetters()!=null) {
-// TypeInfoCollector.MethodInfo unpirMethod = status.getUnpairedGettersOrSetters().get(filter);
-// status.clearUnpairedGettersOrSetters();
-// if(unpirMethod!=null) {
-// status.getUnpairedGettersOrSetters().put(filter, unpirMethod);
-// }
-// }
-// break;
-// }
-// } else if (proposal.getPresentation().startsWith(filter)) {
-// // This is used for CA.
-// proposals.add(proposal.getPresentation().substring(filter.length()));
-// }
-// }
-// }
-// status.setProposals(proposals);
-// if (status.isOK()){
-// status.setLastResolvedToken(expr);
-// }
-// }
+ if(returnEqualedVariablesOnly) {
+ // This is used for validation.
+ if (proposal.getPresentation().equals(filter)) {
+ proposals.add(proposal.getPresentation());
+ status.setMemberOfResolvedOperand(proposal.getMember());
+ if(status.getUnpairedGettersOrSetters()!=null) {
+ TypeInfoCollector.MethodInfo unpirMethod = status.getUnpairedGettersOrSetters().get(filter);
+ status.clearUnpairedGettersOrSetters();
+ if(unpirMethod!=null) {
+ status.getUnpairedGettersOrSetters().put(filter, unpirMethod);
+ }
+ }
+ break;
+ }
+ } else if (proposal.getPresentation().startsWith(filter)) {
+ // This is used for CA.
+ proposals.add(proposal.getPresentation().substring(filter.length()));
+ }
+ }
+ }
+ status.setProposals(proposals);
+ if (status.isOK()){
+ status.setLastResolvedToken(expr);
+ }
+ }
private String computeVariableName(List<ELOperandToken> tokens){
if (tokens == null)
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELOperandResolveStatus.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELOperandResolveStatus.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELOperandResolveStatus.java 2008-09-29 09:45:56 UTC (rev 10526)
@@ -0,0 +1,174 @@
+package org.jboss.tools.seam.internal.core.el;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.model.util.TypeInfoCollector;
+import org.jboss.tools.seam.core.ISeamContextVariable;
+
+/**
+ * Status of EL resolving.
+ * @author Jeremy
+ */
+public class SeamELOperandResolveStatus {
+ private ELInvocationExpression tokens;
+ public List<ISeamContextVariable> usedVariables;
+ Map<String, TypeInfoCollector.MethodInfo> unpairedGettersOrSetters;
+ Set<String> proposals;
+ private ELInvocationExpression lastResolvedToken;
+ private boolean isMapOrCollectionOrBundleAmoungTheTokens = false;
+ private TypeInfoCollector.MemberInfo memberOfResolvedOperand;
+
+ /**
+ * @return MemberInfo of last segment of EL operand. Null if El is not resolved.
+ */
+ public TypeInfoCollector.MemberInfo getMemberOfResolvedOperand() {
+ return memberOfResolvedOperand;
+ }
+
+ /**
+ * Sets MemberInfo for last segment of EL operand.
+ * @param lastResolvedMember
+ */
+ public void setMemberOfResolvedOperand(
+ TypeInfoCollector.MemberInfo lastResolvedMember) {
+ this.memberOfResolvedOperand = lastResolvedMember;
+ }
+
+ /**
+ * Constructor
+ * @param tokens Tokens of EL
+ */
+ public SeamELOperandResolveStatus(ELInvocationExpression tokens) {
+ this.tokens = tokens;
+ }
+
+ /**
+ * @return true if EL contains any not parametrized Collection or ResourceBundle.
+ */
+ public boolean isMapOrCollectionOrBundleAmoungTheTokens() {
+ return this.isMapOrCollectionOrBundleAmoungTheTokens;
+ }
+
+ public void setMapOrCollectionOrBundleAmoungTheTokens() {
+ this.isMapOrCollectionOrBundleAmoungTheTokens = true;
+ }
+
+ /**
+ * @return true if EL is resolved.
+ */
+ public boolean isOK() {
+ return !getProposals().isEmpty() || isMapOrCollectionOrBundleAmoungTheTokens();
+ }
+
+ /**
+ * @return false if El is not resolved.
+ */
+ public boolean isError() {
+ return !isOK();
+ }
+
+ /**
+ * @return List of resolved tokens of EL. Includes separators "."
+ */
+ public ELInvocationExpression getResolvedTokens() {
+ return lastResolvedToken;
+ }
+
+ /**
+ * @return List of unresolved tokens of EL.
+ */
+ public ELInvocationExpression getUnresolvedTokens() {
+ if(lastResolvedToken == tokens) return null;
+ if(lastResolvedToken != null && (lastResolvedToken.getParent() instanceof ELInvocationExpression)) {
+ return (ELInvocationExpression)lastResolvedToken.getParent();
+ }
+ ELInvocationExpression l = tokens;
+ while(l != null && l.getLeft() != lastResolvedToken) {
+ l = l.getLeft();
+ }
+ return l;
+ }
+
+ /**
+ * @return Last resolved token of EL. Can be separator "." // no, change it
+ */
+ public ELInvocationExpression getLastResolvedToken() {
+ return lastResolvedToken;
+ }
+
+ /**
+ * @param lastResolvedToken Last resolved token of EL. Can be separator "."
+ */
+ public void setLastResolvedToken(ELInvocationExpression lastResolvedToken) {
+ this.lastResolvedToken = lastResolvedToken;
+ }
+
+ /**
+ * @return Tokens of EL.
+ */
+ public ELInvocationExpression getTokens() {
+ return tokens;
+ }
+
+ /**
+ * @param tokens Tokens of EL.
+ */
+ public void setTokens(ELInvocationExpression tokens) {
+ this.tokens = tokens;
+ }
+
+ /**
+ * @return Set of proposals for EL.
+ */
+ public Set<String> getProposals() {
+ return proposals == null ? new TreeSet<String>() : proposals;
+ }
+
+ /**
+ * @param proposals Set of proposals.
+ */
+ public void setProposals(Set<String> proposals) {
+ this.proposals = proposals;
+ }
+
+ /**
+ * @return List of Seam Context Variables used in EL.
+ */
+ public List<ISeamContextVariable> getUsedVariables() {
+ return (usedVariables == null ? new ArrayList<ISeamContextVariable>() : usedVariables);
+ }
+
+ /**
+ * @param usedVariables List of Seam Context Variables used in EL.
+ */
+ public void setUsedVariables(List<ISeamContextVariable> usedVariables) {
+ this.usedVariables = usedVariables;
+ }
+
+ /**
+ * @return Map of unpaired getters and setters (getters/setters without proper setters/getters).
+ * of all properties used in EL.
+ * Key - name of property.
+ * Value - MethodInfo of existed getter/setter.
+ */
+ public Map<String, TypeInfoCollector.MethodInfo> getUnpairedGettersOrSetters() {
+ if (unpairedGettersOrSetters == null) {
+ unpairedGettersOrSetters = new HashMap<String, TypeInfoCollector.MethodInfo>();
+ }
+ return unpairedGettersOrSetters;
+ }
+
+ /**
+ * Clear Map of unpaired getters and setters.
+ */
+ public void clearUnpairedGettersOrSetters() {
+ getUnpairedGettersOrSetters().clear();
+ }
+
+}
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-28 08:01:34 UTC (rev 10525)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-09-29 09:45:56 UTC (rev 10526)
@@ -57,7 +57,7 @@
import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.internal.core.el.ElVarSearcher;
import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
-//import org.jboss.tools.seam.internal.core.el.SeamELOperandResolveStatus;
+import org.jboss.tools.seam.internal.core.el.SeamELOperandResolveStatus;
import org.jboss.tools.seam.internal.core.el.Var;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -296,46 +296,45 @@
int offset = operand.length();
if (!operand.endsWith(".")) { //$NON-NLS-1$
{
+ SeamELOperandResolveStatus status =
+ engine.resolveSeamELOperand(project, file, operandToken, true, varListForCurentValidatedNode, elVarSearcher);
-// SeamELOperandResolveStatus status =
-// engine.resolveSeamELOperand(project, file, operandToken, true, varListForCurentValidatedNode, elVarSearcher);
-//
-// if(status.getUsedVariables().size()==0 && status.isError()) {
-// // Save resources with unknown variables names
-// validationContext.addUnnamedElResource(file.getFullPath());
-// } else {
-// // Save links between resource and used variables names
-// for(ISeamContextVariable variable: status.getUsedVariables()) {
-// validationContext.addLinkedElResource(variable.getName(), file.getFullPath());
-// }
-// }
-//
-// // Check pair for getter/setter
-// if(status.getUnpairedGettersOrSetters().size()>0) {
-// TypeInfoCollector.MethodInfo unpairedMethod = status.getUnpairedGettersOrSetters().values().iterator().next();
-// String methodName = unpairedMethod.getName();
-// String propertyName = status.getUnpairedGettersOrSetters().keySet().iterator().next();
-// String missingMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_SETTER;
-// String existedMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_GETTER;
-// if(methodName.startsWith("s")) { //$NON-NLS-1$
-// missingMethodName = existedMethodName;
-// existedMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_SETTER;
-// }
-// addError(UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID, SeamPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, operand.length(), documnetOffset, file);
-// }
-//
-// if (status.isOK()) {
-// // It's valid EL.
-// return;
-// }
-//
-// ELInvocationExpression ts = status.getUnresolvedTokens();
-//
-// varName = ts.getMemberName();
-// offsetOfVarName = documnetOffset + ts.getInvocationStartPosition();
-// lengthOfVarName = varName.length();
-// unresolvedTokenIsVariable = true; //TODO
+ if(status.getUsedVariables().size()==0 && status.isError()) {
+ // Save resources with unknown variables names
+ validationContext.addUnnamedElResource(file.getFullPath());
+ } else {
+ // Save links between resource and used variables names
+ for(ISeamContextVariable variable: status.getUsedVariables()) {
+ validationContext.addLinkedElResource(variable.getName(), file.getFullPath());
+ }
+ }
+ // Check pair for getter/setter
+ if(status.getUnpairedGettersOrSetters().size()>0) {
+ TypeInfoCollector.MethodInfo unpairedMethod = status.getUnpairedGettersOrSetters().values().iterator().next();
+ String methodName = unpairedMethod.getName();
+ String propertyName = status.getUnpairedGettersOrSetters().keySet().iterator().next();
+ String missingMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_SETTER;
+ String existedMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_GETTER;
+ if(methodName.startsWith("s")) { //$NON-NLS-1$
+ missingMethodName = existedMethodName;
+ existedMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_SETTER;
+ }
+ addError(UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID, SeamPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, operand.length(), documnetOffset, file);
+ }
+
+ if (status.isOK()) {
+ // It's valid EL.
+ return;
+ }
+
+ ELInvocationExpression ts = status.getUnresolvedTokens();
+
+ varName = ts.getMemberName();
+ offsetOfVarName = documnetOffset + ts.getInvocationStartPosition();
+ lengthOfVarName = varName.length();
+ unresolvedTokenIsVariable = true; //TODO
+
// List<ELOperandToken> tokens = status.getUnresolvedTokens();
//
// for (ELOperandToken token : tokens) {
@@ -349,8 +348,8 @@
// }
}
}
-// } catch (BadLocationException e) {
-// SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
+ } catch (BadLocationException e) {
+ SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
} catch (StringIndexOutOfBoundsException e) {
SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
}
16 years, 3 months
JBoss Tools SVN: r10525 - in trunk/smooks/plugins: org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/util and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-09-28 04:01:34 -0400 (Sun, 28 Sep 2008)
New Revision: 10525
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/DocumentSelectionWarrper.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/DocumentResourceTypeDetailPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/util/SmooksModelConstants.java
trunk/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/util/SmooksModelUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/AnalyzerFactory.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/NormalSmooksModelBuilder.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/NormalSmooksModelPackage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/SmooksFileBuilder.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ResourceConfigWarrperFactory.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksNormalContentEditFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksResourceConfigFormBlock.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigFactory.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksNewWizardPage.java
Log:
Add a smooks new wizard
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -600,6 +600,7 @@
}
}
}
+ if(current == null) return null;
Class rootClass = null;
rootClassName = SmooksModelUtils.getParmaText("beanClass", current);
if (rootClassName != null && loader != null) {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/util/SmooksModelConstants.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/util/SmooksModelConstants.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/util/SmooksModelConstants.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -19,9 +19,12 @@
public static final String STREAM_FILTER_TYPE = "stream.filter.type";
public static final String SAX = "SAX";
public static final String DOM = "DOM";
+ public static final String SAX_DOM = "SAX/DOM";
public static final String BEAN_POPULATOR = "org.milyn.javabean.BeanPopulator";
public static final String DATE_DECODER = "org.milyn.javabean.decoders.DateDecoder";
+ public static final String AT_DOCUMENT = "@document";
+
public static final String BEAN_ID = "beanId";
public static final String FORMATE = "formate";
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/util/SmooksModelUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/util/SmooksModelUtils.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/util/SmooksModelUtils.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -14,12 +14,14 @@
import java.util.List;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
import org.jboss.tools.smooks.model.ParamType;
import org.jboss.tools.smooks.model.ResourceConfigType;
+import org.jboss.tools.smooks.model.ResourceType;
import org.jboss.tools.smooks.model.SmooksPackage;
/**
@@ -48,7 +50,77 @@
param.getMixed().add(ELEMENT_BINDING, binding);
return binding;
}
+
+ public static String getTransformType(ResourceConfigType resourceConfig){
+ ParamType typeParam = null;
+ if(isTransformTypeResourceConfig(resourceConfig)){
+ List paramList = resourceConfig.getParam();
+ for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
+ ParamType param = (ParamType) iterator.next();
+ if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(param.getName())) {
+ typeParam = param;
+ break;
+ }
+ }
+ if(typeParam != null){
+ return SmooksModelUtils.getAnyTypeText(typeParam);
+ }
+ }
+ return "";
+ }
+ public static void setTransformType(ResourceConfigType resourceConfig,
+ String type) {
+ if(type == null) type = "";
+ if (isTransformTypeResourceConfig(resourceConfig)) {
+ List paramList = resourceConfig.getParam();
+ for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
+ ParamType param = (ParamType) iterator.next();
+ if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(param.getName())) {
+ cleanTextToSmooksType(param);
+ setTextToSmooksType(param, type);
+ }
+ }
+ }
+ }
+
+ public static boolean isFilePathResourceConfig(ResourceConfigType resourceConfig){
+ ResourceType resource = resourceConfig.getResource();
+ if(resource != null){
+ String value = resource.getValue();
+ if(value != null){
+ if(value.startsWith("\\")){
+ return true;
+ }
+ if(value.startsWith("/")){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean isTransformTypeResourceConfig(
+ ResourceConfigType resourceConfig) {
+ String selector = resourceConfig.getSelector();
+ if (!SmooksModelConstants.GLOBAL_PARAMETERS.equals(selector)) {
+ return false;
+ }
+
+ if (resourceConfig.getParam().isEmpty()) {
+ return false;
+ } else {
+ List paramList = resourceConfig.getParam();
+ for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
+ ParamType p = (ParamType) iterator.next();
+ if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(p.getName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
public static String getParmaText(String paramName,
ResourceConfigType resourceConfigType) {
List plist = resourceConfigType.getParam();
@@ -60,21 +132,21 @@
}
return null;
}
-
- public static String getAttributeValueFromAnyType(AnyType anyType,EStructuralFeature attribute) {
+
+ public static String getAttributeValueFromAnyType(AnyType anyType,
+ EStructuralFeature attribute) {
String value = (String) anyType.getAnyAttribute().get(attribute, false);
return value;
}
-
- public static String getAnyTypeText(AnyType anyType){
+
+ public static String getAnyTypeText(AnyType anyType) {
Object value = anyType.getMixed().get(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT,
- true);
+ XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, true);
if (value != null) {
- if (value instanceof List && !((List)value).isEmpty()) {
+ if (value instanceof List && !((List) value).isEmpty()) {
return ((List) value).get(0).toString().trim();
}
-// return value.toString();
+ // return value.toString();
}
return null;
}
@@ -104,17 +176,17 @@
smooksModel.getMixed().add(
XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, text);
}
-
- public static void setTextToSmooksType(AnyType smooksModel, String text){
+
+ public static void setTextToSmooksType(AnyType smooksModel, String text) {
cleanTextToSmooksType(smooksModel);
- appendTextToSmooksType(smooksModel,text);
+ appendTextToSmooksType(smooksModel, text);
}
-
+
public static void cleanTextToSmooksType(AnyType smooksModel) {
Object obj = smooksModel.getMixed().get(
- XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT,true);
- if(obj instanceof List){
- ((List)obj).clear();
+ XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, true);
+ if (obj instanceof List) {
+ ((List) obj).clear();
}
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2008-09-28 08:01:34 UTC (rev 10525)
@@ -21,7 +21,8 @@
org.eclipse.emf.edit,
org.jboss.tools.smooks.model.edit,
org.jboss.tools.smooks.graphicalInfo,
- org.eclipse.ui.views.properties.tabbed
+ org.eclipse.ui.views.properties.tabbed,
+ org.eclipse.emf.edit.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-09-28 08:01:34 UTC (rev 10525)
@@ -48,4 +48,18 @@
</propertyTab>
</propertyTabs>
</extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.jboss.tools.smooks.ui.wizards"
+ name="Smooks">
+ </category>
+ <wizard
+ category="org.jboss.tools.smooks.ui.wizards"
+ class="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
+ icon="icons/sample.gif"
+ id="org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard"
+ name="Smooks Configuration File">
+ </wizard>
+ </extension>
</plugin>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/AnalyzerFactory.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/AnalyzerFactory.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/AnalyzerFactory.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -55,11 +55,11 @@
}
public List getRegistryTargetIDList() {
- return getIDList(sourceModelAnalyzer);
+ return getIDList(targetModelAnalyzer);
}
public List getRegistrySourceIDList() {
- return getIDList(targetModelAnalyzer);
+ return getIDList(sourceModelAnalyzer);
}
protected AnalyzerFactory() {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/NormalSmooksModelBuilder.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/NormalSmooksModelBuilder.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/NormalSmooksModelBuilder.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -41,21 +41,24 @@
.next();
this.processResouceConfig(resourceConfig, modelPackage);
}
+ if(resourceConfigList.isEmpty()){
+
+ }
}
return modelPackage;
}
protected void processResouceConfig(ResourceConfigType config,
NormalSmooksModelPackage modelPackage) {
- if (isBeanPopulator(config)) {
- modelPackage.getBeanPopulatorResourceConfigList().add(config);
- }
- if (isDateConfig(config)) {
- modelPackage.getDateResourceConfigList().add(config);
- }
- if (isSmooksTransformType(config)) {
- modelPackage.setSmooksTransformTypeResourceConfig(config);
- }
+// if (isBeanPopulator(config)) {
+// modelPackage.getBeanPopulatorResourceConfigList().add(config);
+// }
+// if (isDateConfig(config)) {
+// modelPackage.getDateResourceConfigList().add(config);
+// }
+// if (isSmooksTransformType(config)) {
+// modelPackage.setSmooksTransformTypeResourceConfig(config);
+// }
}
public static boolean isSmooksTransformType(ResourceConfigType config) {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/NormalSmooksModelPackage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/NormalSmooksModelPackage.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/NormalSmooksModelPackage.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.smooks.analyzer;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.Assert;
@@ -22,12 +21,14 @@
* Date : Sep 11, 2008
*/
public class NormalSmooksModelPackage {
- private List<ResourceConfigType> dateResourceConfigList = new ArrayList<ResourceConfigType>();
-
- private List<ResourceConfigType> beanPopulatorResourceConfigList = new ArrayList<ResourceConfigType>();
-
- private ResourceConfigType smooksTransformTypeResourceConfig;
+// private List<ResourceConfigType> dateResourceConfigList = new ArrayList<ResourceConfigType>();
+//
+// private List<ResourceConfigType> beanPopulatorResourceConfigList = new ArrayList<ResourceConfigType>();
+//
+// private ResourceConfigType smooksTransformTypeResourceConfig;
+ private List hidenSmooksElements = null;
+
private SmooksResourceListType smooksResourceList;
public NormalSmooksModelPackage(SmooksResourceListType listType){
@@ -43,50 +44,59 @@
this.smooksResourceList = smooksResourceList;
}
- /**
- * @return the dateResourceConfigList
- */
- public List<ResourceConfigType> getDateResourceConfigList() {
- return dateResourceConfigList;
+ public List getHidenSmooksElements() {
+ return hidenSmooksElements;
}
- /**
- * @param dateResourceConfigList the dateResourceConfigList to set
- */
- public void setDateResourceConfigList(
- List<ResourceConfigType> dateResourceConfigList) {
- this.dateResourceConfigList = dateResourceConfigList;
+ public void setHidenSmooksElements(
+ List hidenSmooksElements) {
+ this.hidenSmooksElements = hidenSmooksElements;
}
- /**
- * @return the beanPopulatorResourceConfigList
- */
- public List<ResourceConfigType> getBeanPopulatorResourceConfigList() {
- return beanPopulatorResourceConfigList;
- }
-
- /**
- * @param beanPopulatorResourceConfigList the beanPopulatorResourceConfigList to set
- */
- public void setBeanPopulatorResourceConfigList(
- List<ResourceConfigType> beanPopulatorResourceConfigList) {
- this.beanPopulatorResourceConfigList = beanPopulatorResourceConfigList;
- }
-
- /**
- * @return the smooksTransformTypeResourceConfig
- */
- public ResourceConfigType getSmooksTransformTypeResourceConfig() {
- return smooksTransformTypeResourceConfig;
- }
-
- /**
- * @param smooksTransformTypeResourceConfig the smooksTransformTypeResourceConfig to set
- */
- public void setSmooksTransformTypeResourceConfig(
- ResourceConfigType smooksTransformTypeResourceConfig) {
- this.smooksTransformTypeResourceConfig = smooksTransformTypeResourceConfig;
- }
+// /**
+// * @return the dateResourceConfigList
+// */
+// public List<ResourceConfigType> getDateResourceConfigList() {
+// return dateResourceConfigList;
+// }
+//
+// /**
+// * @param dateResourceConfigList the dateResourceConfigList to set
+// */
+// public void setDateResourceConfigList(
+// List<ResourceConfigType> dateResourceConfigList) {
+// this.dateResourceConfigList = dateResourceConfigList;
+// }
+//
+// /**
+// * @return the beanPopulatorResourceConfigList
+// */
+// public List<ResourceConfigType> getBeanPopulatorResourceConfigList() {
+// return beanPopulatorResourceConfigList;
+// }
+//
+// /**
+// * @param beanPopulatorResourceConfigList the beanPopulatorResourceConfigList to set
+// */
+// public void setBeanPopulatorResourceConfigList(
+// List<ResourceConfigType> beanPopulatorResourceConfigList) {
+// this.beanPopulatorResourceConfigList = beanPopulatorResourceConfigList;
+// }
+//
+// /**
+// * @return the smooksTransformTypeResourceConfig
+// */
+// public ResourceConfigType getSmooksTransformTypeResourceConfig() {
+// return smooksTransformTypeResourceConfig;
+// }
+//
+// /**
+// * @param smooksTransformTypeResourceConfig the smooksTransformTypeResourceConfig to set
+// */
+// public void setSmooksTransformTypeResourceConfig(
+// ResourceConfigType smooksTransformTypeResourceConfig) {
+// this.smooksTransformTypeResourceConfig = smooksTransformTypeResourceConfig;
+// }
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/SmooksFileBuilder.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/SmooksFileBuilder.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/SmooksFileBuilder.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -24,10 +24,14 @@
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.DocumentRoot;
+import org.jboss.tools.smooks.model.ParamType;
+import org.jboss.tools.smooks.model.ResourceConfigType;
import org.jboss.tools.smooks.model.SmooksFactory;
import org.jboss.tools.smooks.model.SmooksPackage;
import org.jboss.tools.smooks.model.SmooksResourceListType;
import org.jboss.tools.smooks.model.provider.SmooksItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.util.SmooksModelConstants;
+import org.jboss.tools.smooks.model.util.SmooksModelUtils;
import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
public class SmooksFileBuilder {
@@ -84,12 +88,12 @@
context.setDomain(domain);
analyzer.analyzeMappingGraphModel(context);
-
+
insertResoureConfig(listType, context.getGeneratorResourceList());
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
smooksResource.save(outputStream, Collections.EMPTY_MAP);
- removeSavedResourceConfig(listType,context.getGeneratorResourceList());
+ removeSavedResourceConfig(listType, context.getGeneratorResourceList());
context.getGeneratorResourceList().clear();
context.setGeneratorResourceList(null);
return new ByteArrayInputStream(outputStream.toByteArray());
@@ -140,6 +144,7 @@
// EditingDomain domain = createEditingDomain();
int length = resourceConfigList.size();
List kk = list.getAbstractResourceConfig();
+ int existingLength = kk.size();
for (int i = length - 1; i >= 0; i--) {
Object obj = resourceConfigList.get(i);
Command addResourceConfigCommand = AddCommand
@@ -150,13 +155,17 @@
.getSmooksResourceListType_AbstractResourceConfig(),
obj);
addResourceConfigCommand.execute();
+ int moveIndex = 1;
+ if (existingLength < 1) {
+ moveIndex = 0;
+ }
MoveCommand
.create(
domain,
list,
SmooksPackage.eINSTANCE
.getSmooksResourceListType_AbstractResourceConfig(),
- obj, 1).execute();
+ obj, moveIndex).execute();
}
}
@@ -173,17 +182,54 @@
protected void initSmooksParseStyle(
SmooksConfigurationFileGenerateContext context,
SmooksResourceListType resourceList) {
- // String type = context.getSmooksType();
- // if(type == null) return;
- // ResourceConfigType config =
- // SmooksFactory.eINSTANCE.createResourceConfigType();
- // config.setSelector(SmooksConstants.GLOBAL_PARAMETERS);
- // ParamType param = SmooksFactory.eINSTANCE.createParamType();
- // param.setName(SmooksConstants.STREAM_FILTER_TYPE);
- // SmooksModelUtils.appendTextToSmooksType(param, SmooksConstants.SAX);
- //
- // config.getParam().add(param);
-
- // resourceList.getAbstractResourceConfig().add(0,config);
+// String type = context.getSmooksType();
+// if (type == null)
+// return;
+// ResourceConfigType config = null;
+// if (resourceList.getAbstractResourceConfig().size() < 1) {
+// } else {
+// config = (ResourceConfigType) resourceList
+// .getAbstractResourceConfig().get(0);
+// String selector = config.getSelector();
+// if (!SmooksModelConstants.GLOBAL_PARAMETERS.equals(selector)) {
+// config = null;
+// } else {
+// if (config.getParam().isEmpty()) {
+// config = null;
+// } else {
+// ParamType param = config.getParam().get(0);
+// if (!SmooksModelConstants.STREAM_FILTER_TYPE.equals(param
+// .getName())) {
+// config = null;
+// }
+// }
+// }
+// }
+// ParamType param = null;
+// if (config == null) {
+// config = SmooksFactory.eINSTANCE.createResourceConfigType();
+// AddCommand.create(domain, resourceList, SmooksPackage.eINSTANCE.getSmooksResourceListType_AbstractResourceConfig(), config).execute();
+// MoveCommand.create(domain, resourceList, SmooksPackage.eINSTANCE.getSmooksResourceListType_AbstractResourceConfig(), config, 0);
+// config.setSelector(SmooksModelConstants.GLOBAL_PARAMETERS);
+// param = SmooksFactory.eINSTANCE.createParamType();
+// param.setName(SmooksModelConstants.STREAM_FILTER_TYPE);
+// config.getParam().add(param);
+// }else{
+// List paramList = config.getParam();
+// for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
+// ParamType p = (ParamType) iterator.next();
+// if(SmooksModelConstants.STREAM_FILTER_TYPE.equals(p.getName())){
+// param = p;
+// break;
+// }
+// }
+// if(param == null){
+// param = SmooksFactory.eINSTANCE.createParamType();
+// param.setName(SmooksModelConstants.STREAM_FILTER_TYPE);
+// config.getParam().add(param);
+// }
+// }
+// SmooksModelUtils.cleanTextToSmooksType(param);
+// SmooksModelUtils.appendTextToSmooksType(param, context.getSmooksType());
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -57,9 +57,11 @@
String gfileName = fileName + ".graph";
if (container != null) {
IFile gfile = container.getFile(new Path(gfileName));
- if(!gfile.exists()){
+ if (!gfile.exists()) {
try {
- gfile.create(new ByteArrayInputStream("".getBytes()), true, null);
+ gfile.create(
+ new ByteArrayInputStream("".getBytes()),
+ true, null);
} catch (CoreException e) {
e.printStackTrace();
}
@@ -72,17 +74,57 @@
}
}
+ public GraphicalInformationSaver(IFile file) {
+ IContainer container = file.getParent();
+ String fileName = file.getName();
+ if (fileName.endsWith(".smooks")) {
+ String gfileName = fileName + ".graph";
+ if (container != null) {
+ IFile gfile = container.getFile(new Path(gfileName));
+ if (!gfile.exists()) {
+ try {
+ gfile.create(new ByteArrayInputStream("".getBytes()),
+ true, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ String osString = gfile.getLocation().toOSString();
+ graphicalFileResource = new XMLResourceFactoryImpl()
+ .createResource(URI.createFileURI(osString));
+ }
+ }
+ }
+
public GraphInformations doLoad() throws IOException {
// throw new IOException("can't find the file");
if (graphicalFileResource != null) {
graphicalFileResource.load(Collections.EMPTY_MAP);
- GraphInformations graph = (GraphInformations) graphicalFileResource
- .getContents().get(0);
- return graph;
+ GraphInformations graph = (GraphInformations) graphicalFileResource
+ .getContents().get(0);
+ return graph;
}
return null;
}
+ public void doSave(IProgressMonitor monitor, String sourceid,
+ String targetid) throws IOException {
+ GraphInformations graph = null;
+ if (graphicalFileResource != null) {
+ if (graphicalFileResource.getContents().isEmpty()) {
+ graph = GraphicalFactory.eINSTANCE.createGraphInformations();
+ graphicalFileResource.getContents().add(graph);
+ } else {
+ graph = (GraphInformations) graphicalFileResource.getContents()
+ .get(0);
+ }
+ if (graph != null) {
+ initMappingTypes(graph, sourceid, targetid);
+ }
+ graphicalFileResource.save(Collections.EMPTY_MAP);
+ }
+ }
+
public void doSave(IProgressMonitor monitor,
SmooksConfigurationFileGenerateContext context) throws IOException,
CoreException {
@@ -101,7 +143,7 @@
initMappingTypes(graph, sourceID, targetID);
Params params = GraphicalFactory.eINSTANCE.createParams();
graph.setParams(params);
- initParams(params,context);
+ initParams(params, context);
}
graphicalFileResource.save(Collections.EMPTY_MAP);
}
@@ -111,8 +153,8 @@
private void initParams(Params params,
SmooksConfigurationFileGenerateContext context) {
Properties pros = context.getProperties();
- Enumeration<Object> keys = pros.keys();
- while(keys.hasMoreElements()){
+ Enumeration<Object> keys = pros.keys();
+ while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
Param param = GraphicalFactory.eINSTANCE.createParam();
param.setName(key);
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/DocumentSelectionWarrper.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/DocumentSelectionWarrper.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/DocumentSelectionWarrper.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -0,0 +1,24 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.ui;
+
+import org.jboss.tools.smooks.model.ResourceConfigType;
+
+/**
+ * @author dart
+ *
+ */
+public class DocumentSelectionWarrper extends ResourceConfigWarrper {
+
+ public DocumentSelectionWarrper() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public DocumentSelectionWarrper(ResourceConfigType type) {
+ super(type);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/DocumentSelectionWarrper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/DocumentResourceTypeDetailPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/DocumentResourceTypeDetailPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/DocumentResourceTypeDetailPage.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -0,0 +1,131 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.ui.editors;
+
+import java.util.Collections;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.smooks.model.ResourceType;
+import org.jboss.tools.smooks.model.SmooksPackage;
+
+/**
+ * @author dart
+ *
+ */
+public class DocumentResourceTypeDetailPage extends AbstractSmooksModelDetailPage {
+
+ private Text text;
+ private Text selectorText;
+
+ public DocumentResourceTypeDetailPage(SmooksFormEditor parentEditor,
+ EditingDomain domain) {
+ super(parentEditor, domain);
+ }
+
+ protected void createSectionContents(Composite parent) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ parent.setLayout(layout);
+ this.formToolKit.createLabel(parent, "Selector :");
+ selectorText = formToolKit.createText(parent, "");
+ selectorText.addModifyListener(new ModifyListener(){
+
+ public void modifyText(ModifyEvent e) {
+ if(!canFireChange) return;
+ resetSelector(selectorText.getText());
+ }
+
+ });
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ selectorText.setLayoutData(gd);
+
+ this.formToolKit.createLabel(parent, "Document Path:");
+ Composite fileCom = formToolKit.createComposite(parent);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fileCom.setLayoutData(gd);
+ fileCom.setLayout(layout);
+ text = formToolKit.createText(fileCom, "");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.grabExcessHorizontalSpace = true;
+ text.setLayoutData(gd);
+ text.addModifyListener(new ModifyListener(){
+ public void modifyText(ModifyEvent e) {
+ if(!canFireChange) return;
+ resetPath(text.getText());
+ }
+ });
+
+
+ Button browseButton = formToolKit.createButton(fileCom, "Browse...", SWT.NONE);
+ browseButton.addSelectionListener(new SelectionAdapter(){
+
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ browseFileSystem();
+ }
+
+ });
+ formToolKit.paintBordersFor(parent);
+ formToolKit.paintBordersFor(fileCom);
+ }
+
+ protected void resetSelector(String selector){
+ Command command = SetCommand.create(domain, resourceConfigList, SmooksPackage.eINSTANCE.getResourceConfigType_Selector(), selector);
+ domain.getCommandStack().execute(command);
+// resourceConfigList.getse
+ }
+
+ protected void browseFileSystem(){
+ IFile[] files = WorkspaceResourceDialog.openFileSelection(this.parentEditor.getSite()
+ .getShell(),
+ "", "", false, null, Collections.EMPTY_LIST);
+ // dialog.setInitialSelections(selectedResources);
+ if (files.length > 0) {
+ IFile file = files[0];
+ String s = file.getFullPath().toString();
+ text.setText(s);
+ return;
+ }
+ }
+
+ protected void resetPath(String path){
+ if(this.resourceConfigList != null){
+ ResourceType resource = resourceConfigList.getResource();
+ if(resource == null){
+ return;
+ }
+ Command command = SetCommand.create(domain, resource, SmooksPackage.eINSTANCE.getResourceType_Value(), path);
+ domain.getCommandStack().execute(command);
+ }
+ }
+
+ protected void initSectionUI() {
+ if(this.resourceConfigList != null){
+ String selector = resourceConfigList.getSelector();
+ if(selector != null) selectorText.setText(selector);
+ ResourceType resource = resourceConfigList.getResource();
+ if(resource != null){
+ String path = resource.getValue();
+ if(path == null) path = "";
+ text.setText(path);
+ }
+ }
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/DocumentResourceTypeDetailPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ResourceConfigWarrperFactory.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ResourceConfigWarrperFactory.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ResourceConfigWarrperFactory.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -13,8 +13,10 @@
import org.jboss.tools.smooks.model.ResourceConfigType;
import org.jboss.tools.smooks.model.ResourceType;
import org.jboss.tools.smooks.model.util.SmooksModelConstants;
+import org.jboss.tools.smooks.model.util.SmooksModelUtils;
import org.jboss.tools.smooks.ui.BeanPopulatorWarrper;
import org.jboss.tools.smooks.ui.DateTypeWarrper;
+import org.jboss.tools.smooks.ui.DocumentSelectionWarrper;
import org.jboss.tools.smooks.ui.ResourceConfigWarrper;
@@ -35,6 +37,10 @@
DateTypeWarrper warrper = new DateTypeWarrper(type);
return warrper;
}
+ if(SmooksModelUtils.isFilePathResourceConfig(type)){
+ DocumentSelectionWarrper warrper = new DocumentSelectionWarrper(type);
+ return warrper;
+ }
return null;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -13,9 +13,9 @@
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.command.BasicCommandStack;
import org.eclipse.emf.common.command.CommandStack;
@@ -117,9 +117,10 @@
}
}
- public void refreshNormalPage() {
+ public void refreshNormalPage(List resourceHidenConfigs) {
NormalSmooksModelPackage modelPackage = createSmooksModelPackage();
if (this.normalPage != null) {
+ modelPackage.setHidenSmooksElements(resourceHidenConfigs);
normalPage.setModelPackage(modelPackage);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -21,18 +21,15 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.ConnectionLayer;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EPackage.Registry;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.Resource.IOWrappedException;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.gef.DefaultEditDomain;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.KeyStroke;
@@ -107,17 +104,14 @@
import org.jboss.tools.smooks.analyzer.SmooksAnalyzerException;
import org.jboss.tools.smooks.analyzer.SmooksFileBuilder;
import org.jboss.tools.smooks.graphical.GraphInformations;
-import org.jboss.tools.smooks.graphical.GraphicalPackage;
import org.jboss.tools.smooks.graphical.MappingDataType;
import org.jboss.tools.smooks.graphical.Param;
import org.jboss.tools.smooks.graphical.Params;
import org.jboss.tools.smooks.graphical.util.GraphicalInformationSaver;
import org.jboss.tools.smooks.model.DocumentRoot;
-import org.jboss.tools.smooks.model.ResourceConfigType;
import org.jboss.tools.smooks.model.SmooksFactory;
import org.jboss.tools.smooks.model.SmooksResourceListType;
import org.jboss.tools.smooks.model.util.SmooksModelConstants;
-import org.jboss.tools.smooks.model.util.SmooksResourceFactoryImpl;
import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
import org.jboss.tools.smooks.ui.IViewerInitor;
import org.jboss.tools.smooks.ui.StructuredDataCreationWizardDailog;
@@ -226,12 +220,12 @@
list = SmooksFactory.eINSTANCE.createSmooksResourceListType();
doc.setSmooksResourceList(list);
}
- callParentRefillNormalModelInfor();
+
}
- private void callParentRefillNormalModelInfor() {
+ private void callParentRefillNormalModelInfor(List hidenResourceConfigs) {
SmooksFormEditor editor = (SmooksFormEditor) getEditor();
- editor.refreshNormalPage();
+ editor.refreshNormalPage(hidenResourceConfigs);
}
// protected void notifyParentEditorTransformNormal
@@ -242,7 +236,9 @@
try {
this.initTransformViewerModel((IEditorSite) getSite(),
getEditorInput());
- cleanMappingResourceConfig();
+ if (mappingResourceConfigList != null)
+ callParentRefillNormalModelInfor(mappingResourceConfigList
+ .getRelationgResourceConfigList());
} catch (IOWrappedException ex) {
MessageDialog.openWarning(getSite().getShell(), "Waring",
"Exceptions occurd during parsing Smooks file, no worries");
@@ -663,6 +659,7 @@
Exception exp = null;
try {
// generate smooks configuration file
+ this.cleanMappingResourceConfig();
InputStream stream = builder.generateSmooksFile(context, monitor);
IFile file = ((IFileEditorInput) this.getEditorInput()).getFile();
if (file.exists()) {
@@ -906,6 +903,12 @@
if (dialog.open() == org.eclipse.jface.dialogs.Dialog.OK) {
sourceDataTypeID = wizard.getSourceDataTypeID();
targetDataTypeID = wizard.getTargetDataTypeID();
+ this.getSmooksConfigurationFileGenerateContext()
+ .setSourceDataTypeID(sourceDataTypeID);
+ this.getSmooksConfigurationFileGenerateContext()
+ .setTargetDataTypeID(targetDataTypeID);
+ graphicalInformationSaver.doSave(new NullProgressMonitor(),
+ getSmooksConfigurationFileGenerateContext());
}
}
smooksResource = this.getSmooksResource();
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksNormalContentEditFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksNormalContentEditFormPage.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksNormalContentEditFormPage.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -12,9 +12,12 @@
import java.util.List;
-import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -26,8 +29,12 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.analyzer.NormalSmooksModelPackage;
-import org.jboss.tools.smooks.model.DocumentRoot;
-import org.jboss.tools.smooks.model.SmooksResourceListType;
+import org.jboss.tools.smooks.model.ParamType;
+import org.jboss.tools.smooks.model.ResourceConfigType;
+import org.jboss.tools.smooks.model.SmooksFactory;
+import org.jboss.tools.smooks.model.SmooksPackage;
+import org.jboss.tools.smooks.model.util.SmooksModelConstants;
+import org.jboss.tools.smooks.model.util.SmooksModelUtils;
import org.jboss.tools.smooks.utils.UIUtils;
/**
@@ -39,28 +46,41 @@
protected SmooksResourceConfigFormBlock resourceBlock = null;
+ protected ResourceConfigType transformType = null;
+
+ private Button saxButton;
+
+ private Button domButton;
+
+ private Button saxdomButton;
+
+ private EditingDomain domain;
+
+ private List hidenResourceConfigs;
+
public SmooksNormalContentEditFormPage(FormEditor editor, String id,
String title, NormalSmooksModelPackage modelPacakge) {
super(editor, id, title);
+ domain = ((SmooksFormEditor) editor).getEditingDomain();
+ this.createResourceConfigFormBlock();
this.setModelPackage(modelPacakge);
- this.createResourceConfigFormBlock();
}
public SmooksNormalContentEditFormPage(String id, String title,
NormalSmooksModelPackage modelPacakge) {
super(id, title);
- this.setModelPackage(modelPackage);
this.createResourceConfigFormBlock();
+ this.setModelPackage(modelPacakge);
}
-
- protected void createResourceConfigFormBlock(){
+
+ protected void createResourceConfigFormBlock() {
resourceBlock = new SmooksResourceConfigFormBlock();
resourceBlock.setDomain(getEditingDomain());
- resourceBlock.setParentEditor((SmooksFormEditor)this.getEditor());
+ resourceBlock.setParentEditor((SmooksFormEditor) this.getEditor());
}
-
- protected EditingDomain getEditingDomain(){
- return ((SmooksFormEditor)getEditor()).getEditingDomain();
+
+ protected EditingDomain getEditingDomain() {
+ return ((SmooksFormEditor) getEditor()).getEditingDomain();
}
@Override
@@ -75,10 +95,59 @@
createSmooksTypeGUI(rootMainControl, tool);
form.getBody().setLayout(gridLayout);
form.pack();
+ this.initTransformTypeResourceConfig();
+ resourceBlock.initViewers(transformType);
+ }
+
+ private ResourceConfigType createTransformType() {
+ ResourceConfigType transformType = SmooksFactory.eINSTANCE
+ .createResourceConfigType();
+ AddCommand.create(
+ domain,
+ modelPackage.getSmooksResourceList(),
+ SmooksPackage.eINSTANCE
+ .getSmooksResourceListType_AbstractResourceConfig(),
+ transformType).execute();
+ MoveCommand.create(domain, modelPackage.getSmooksResourceList(),
+ SmooksPackage.eINSTANCE
+ .getSmooksResourceListType_AbstractResourceConfig(),
+ transformType, 0);
+ transformType.setSelector(SmooksModelConstants.GLOBAL_PARAMETERS);
+ ParamType typeParam = SmooksFactory.eINSTANCE.createParamType();
+ typeParam.setName(SmooksModelConstants.STREAM_FILTER_TYPE);
+ transformType.getParam().add(typeParam);
- resourceBlock.initViewers();
+ return transformType;
}
+ protected void initTransformTypeResourceConfig() {
+ if (this.getModelPackage() != null) {
+ List list = modelPackage.getSmooksResourceList()
+ .getAbstractResourceConfig();
+ if (list != null && !list.isEmpty()) {
+ ResourceConfigType first = (ResourceConfigType) list.get(0);
+ if (SmooksModelUtils.isTransformTypeResourceConfig(first)) {
+ this.transformType = first;
+ }
+ }
+ if (transformType == null) {
+ transformType = createTransformType();
+ }
+ if (transformType != null) {
+ String type = SmooksModelUtils.getTransformType(transformType);
+ if (SmooksModelConstants.SAX.equals(type)) {
+ saxButton.setSelection(true);
+ }
+ if (SmooksModelConstants.DOM.equals(type)) {
+ domButton.setSelection(true);
+ }
+ if ("SAX/DOM".equals(type)) {
+ saxdomButton.setSelection(true);
+ }
+ }
+ }
+ }
+
protected void createSmooksTypeGUI(Composite mainComposite, FormToolkit tool) {
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
Section section = tool.createSection(mainComposite, Section.TITLE_BAR
@@ -97,13 +166,48 @@
layout.numColumns = 3;
typeSelectComposite.setLayout(layout);
- createTypeSelectRadioButton(typeSelectComposite, tool, "SAX")
- .setSelection(true);
- createTypeSelectRadioButton(typeSelectComposite, tool, "DOM");
- createTypeSelectRadioButton(typeSelectComposite, tool, "SAX/DOM");
+ saxButton = createTypeSelectRadioButton(typeSelectComposite, tool,
+ SmooksModelConstants.SAX);
+ domButton = createTypeSelectRadioButton(typeSelectComposite, tool,
+ SmooksModelConstants.DOM);
+ saxdomButton = createTypeSelectRadioButton(typeSelectComposite, tool,
+ SmooksModelConstants.SAX_DOM);
+ hookButtons();
+ }
+ private void setTransformType(String type) {
+ if (this.transformType != null) {
+ SmooksModelUtils.setTransformType(transformType, type);
+ ((SmooksFormEditor)getEditor()).fireEditorDirty(true);
+ }
}
+ protected void hookButtons() {
+ saxButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ setTransformType(SmooksModelConstants.SAX);
+ }
+
+ });
+
+ domButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ setTransformType(SmooksModelConstants.DOM);
+ }
+
+ });
+
+ saxdomButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ setTransformType(SmooksModelConstants.SAX_DOM);
+ }
+
+ });
+ }
+
private Button createTypeSelectRadioButton(Composite parent,
FormToolkit tool, String labelName) {
Button button = tool.createButton(parent, labelName, SWT.RADIO);
@@ -125,7 +229,7 @@
if (modelPackage == this.modelPackage)
return;
this.modelPackage = modelPackage;
- this.resourceBlock.setModelPackage(this.modelPackage);
+ if (resourceBlock != null)
+ this.resourceBlock.setModelPackage(this.modelPackage);
}
-
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksResourceConfigFormBlock.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksResourceConfigFormBlock.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksResourceConfigFormBlock.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -12,7 +12,6 @@
import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
@@ -27,6 +26,8 @@
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -46,8 +47,10 @@
import org.jboss.tools.smooks.analyzer.NormalSmooksModelPackage;
import org.jboss.tools.smooks.model.ResourceConfigType;
import org.jboss.tools.smooks.model.SmooksPackage;
+import org.jboss.tools.smooks.model.util.SmooksModelUtils;
import org.jboss.tools.smooks.ui.BeanPopulatorWarrper;
import org.jboss.tools.smooks.ui.DateTypeWarrper;
+import org.jboss.tools.smooks.ui.DocumentSelectionWarrper;
import org.jboss.tools.smooks.ui.ResourceConfigWarrper;
import org.jboss.tools.smooks.ui.gef.util.GraphicsConstants;
import org.jboss.tools.smooks.ui.wizards.NewResourceConfigFactory;
@@ -61,14 +64,16 @@
public class SmooksResourceConfigFormBlock extends MasterDetailsBlock implements
ISelectionChangedListener {
- TreeViewer dateTypeViewer;
+ protected TreeViewer dateTypeViewer;
- NormalSmooksModelPackage modelPackage = null;
+ protected NormalSmooksModelPackage modelPackage = null;
- SmooksFormEditor parentEditor;
+ protected ResourceConfigType transformType = null;
- IManagedForm managedForm;
+ protected SmooksFormEditor parentEditor;
+ protected IManagedForm managedForm;
+
protected EditingDomain domain;
private SectionPart sectionPart;
@@ -136,6 +141,10 @@
new BeanPopulatorDetailPage(getParentEditor(), getDomain()));
detailsPart.registerPage(DateTypeWarrper.class, new DateTypeDetailPage(
getParentEditor(), getDomain()));
+
+ detailsPart.registerPage(DocumentSelectionWarrper.class,
+ new DocumentResourceTypeDetailPage(getParentEditor(),
+ getDomain()));
}
protected void configDateTypeViewer() {
@@ -154,30 +163,48 @@
}
if (NormalSmooksModelBuilder
.isDateConfig((ResourceConfigType) element)) {
- return "Date Type : ";
+ return "Date Type";
}
- String s =((ResourceConfigType)element).getSelector();
- if(s == null) s= "<NULL>";
+ if (SmooksModelUtils
+ .isFilePathResourceConfig((ResourceConfigType) element)) {
+ String selector = ((ResourceConfigType) element)
+ .getSelector();
+ if (selector == null)
+ selector = "<NULL>";
+ return "Template File :" + selector;
+ }
+ String s = ((ResourceConfigType) element).getSelector();
+ if (s == null)
+ s = "<NULL>";
return "UnKnown ResourceConfig - " + s;
}
return super.getText(element);
}
});
+ // don't display the first ResourceConfig element;because it will be
+ // "show" with Smooks TransformData Type GUI
+ dateTypeViewer.setFilters(new ViewerFilter[] { new ViewerFilter() {
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+ if (element == transformType)
+ return false;
+ if(modelPackage != null){
+ List hidenList = modelPackage.getHidenSmooksElements();
+ for (Iterator iterator = hidenList.iterator(); iterator
+ .hasNext();) {
+ Object object = (Object) iterator.next();
+ if(object == element) return false;
+ }
+ }
+ return true;
+ }
+ } });
}
- public void initViewers() {
+ public void initViewers(ResourceConfigType transformType) {
+ this.transformType = transformType;
if (this.getModelPackage() != null) {
- List all = new Vector();
- List list = modelPackage.getBeanPopulatorResourceConfigList();
- if (list != null) {
- all.addAll(list);
- }
- List dl = modelPackage.getDateResourceConfigList();
- if (dl != null) {
- all.addAll(dl);
- }
-
dateTypeViewer.setInput(modelPackage.getSmooksResourceList()
.getAbstractResourceConfig());
}
@@ -275,7 +302,8 @@
.getSelection();
Object object = selection.getFirstElement();
int index = ((List) dateTypeViewer.getInput()).indexOf(object);
- if (index >= modelPackage.getSmooksResourceList().getAbstractResourceConfig().size()) {
+ if (index >= modelPackage.getSmooksResourceList()
+ .getAbstractResourceConfig().size()) {
return;
}
index++;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -46,8 +46,8 @@
*/
@Override
public boolean performFinish() {
- String sid = page.getSourceDataTypeID();
- String tid = page.getTargetDataTypeID();
+ String sid = page.getSourceID();
+ String tid = page.getTargetID();
if(sid == null || tid == null) return false;
this.sourceDataTypeID = sid;
this.targetDataTypeID = tid;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -13,7 +13,6 @@
import java.util.Iterator;
import java.util.List;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
@@ -41,12 +40,29 @@
protected CheckboxTableViewer source;
protected CheckboxTableViewer target;
+ private List sourceList;
+ private String sourceID = null;
+ private String targetID = null;
+
+
+
- public TypeIDSelectionWizardPage(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
+ public String getSourceID() {
+ return sourceID;
}
+ public void setSourceID(String sourceID) {
+ this.sourceID = sourceID;
+ }
+
+ public String getTargetID() {
+ return targetID;
+ }
+
+ public void setTargetID(String targetID) {
+ this.targetID = targetID;
+ }
+
public TypeIDSelectionWizardPage(String pageName) {
super(pageName);
}
@@ -62,10 +78,8 @@
gl.numColumns = 2;
gl.makeColumnsEqualWidth = true;
mainComposite.setLayout(gl);
- List<DataTypeID> sourceList = AnalyzerFactory.getInstance()
+ sourceList = AnalyzerFactory.getInstance()
.getRegistrySourceIDList();
- List<DataTypeID> targetList = AnalyzerFactory.getInstance()
- .getRegistryTargetIDList();
Label sl = new Label(mainComposite, SWT.NONE);
sl.setText("Source Data Type ID List : ");
@@ -79,20 +93,12 @@
target.getTable().setLayoutData(gd);
source.setInput(sourceList);
- target.setInput(targetList);
+ target.setInput(sourceList);
initViewer();
this.setControl(mainComposite);
}
- public String getSourceDataTypeID() {
- return getDataTypeID(source);
- }
-
- public String getTargetDataTypeID() {
- return getDataTypeID(target);
- }
-
protected String getDataTypeID(CheckboxTableViewer viewer) {
Object[] objs = viewer.getCheckedElements();
if (objs == null)
@@ -146,15 +152,23 @@
viewer.setChecked(event.getElement(), true);
fireEvent = true;
}
+
+ if(viewer == source){
+ setSourceID(getDataTypeID(source));
+ }
+
+ if(viewer == target){
+ setTargetID(getDataTypeID(target));
+ }
}
});
TableColumn nameColumn = new TableColumn(viewer.getTable(), SWT.NONE);
nameColumn.setWidth(100);
nameColumn.setText("Name");
- TableColumn idColumn = new TableColumn(viewer.getTable(), SWT.NONE);
- idColumn.setWidth(100);
- idColumn.setText("ID");
+// TableColumn idColumn = new TableColumn(viewer.getTable(), SWT.NONE);
+// idColumn.setWidth(100);
+// idColumn.setText("ID");
viewer.setContentProvider(new TypeIDContentProvider());
viewer.setLabelProvider(new TypeIDLabelProvider());
return viewer;
@@ -191,8 +205,8 @@
switch (columnIndex) {
case 0:
return ((DataTypeID) element).getName();
- case 1:
- return ((DataTypeID) element).getId();
+// case 1:
+// return ((DataTypeID) element).getId();
}
}
return "";
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigFactory.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigFactory.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/NewResourceConfigFactory.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -21,15 +21,16 @@
* Date : Sep 18, 2008
*/
public class NewResourceConfigFactory implements INewResourceConfigFactory {
-
+
private static NewResourceConfigFactory instance = null;
- private NewResourceConfigFactory(){
-
+ private NewResourceConfigFactory() {
+
}
-
+
public static synchronized NewResourceConfigFactory getInstance() {
- if(instance == null) instance = new NewResourceConfigFactory();
+ if (instance == null)
+ instance = new NewResourceConfigFactory();
return instance;
}
@@ -81,6 +82,18 @@
return config;
}
+
+ if (SmooksModelConstants.AT_DOCUMENT.equals(key.getId())) {
+ ResourceConfigType config = SmooksFactory.eINSTANCE
+ .createResourceConfigType();
+// config.setSelector(SmooksModelConstants.AT_DOCUMENT);
+ ResourceType resource = SmooksFactory.eINSTANCE
+ .createResourceType();
+ resource.setValue("/");
+ config.setResource(resource);
+
+ return config;
+ }
return null;
}
@@ -92,7 +105,11 @@
NewResourceConfigKey date = new NewResourceConfigKey();
date.setId(SmooksModelConstants.DATE_DECODER);
date.setName("Date Decoder");
- return new NewResourceConfigKey[] { bean, date };
+
+ NewResourceConfigKey documentFile = new NewResourceConfigKey();
+ documentFile.setId(SmooksModelConstants.AT_DOCUMENT);
+ documentFile.setName("Document");
+ return new NewResourceConfigKey[] { bean, date ,documentFile };
}
}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -0,0 +1,160 @@
+package org.jboss.tools.smooks.ui.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.operation.*;
+import java.lang.reflect.InvocationTargetException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import java.io.*;
+import org.eclipse.ui.*;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.tools.smooks.graphical.util.GraphicalInformationSaver;
+import org.jboss.tools.smooks.ui.editors.TypeIDSelectionWizardPage;
+import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
+
+/**
+ * This is a sample new wizard. Its role is to create a new file resource in the
+ * provided container. If the container resource (a folder or a project) is
+ * selected in the workspace when the wizard is opened, it will accept it as the
+ * target container. The wizard creates one file with the extension "smooks". If
+ * a sample multi-page editor (also available as a template) is registered for
+ * the same extension, it will be able to open it.
+ */
+
+public class SmooksConfigFileNewWizard extends Wizard implements INewWizard {
+ private SmooksConfigFileNewWizardPage page;
+ private ISelection selection;
+ private TypeIDSelectionWizardPage typeIDPage;
+
+ /**
+ * Constructor for SmooksConfigFileNewWizard.
+ */
+ public SmooksConfigFileNewWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * Adding the page to the wizard.
+ */
+
+ public void addPages() {
+ page = new SmooksConfigFileNewWizardPage(selection);
+ addPage(page);
+ typeIDPage = new TypeIDSelectionWizardPage("");
+ addPage(typeIDPage);
+ }
+
+ /**
+ * This method is called when 'Finish' button is pressed in the wizard. We
+ * will create an operation and run it using wizard as execution context.
+ */
+ public boolean performFinish() {
+ final String containerName = page.getContainerName();
+ final String fileName = page.getFileName();
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException {
+ try {
+ doFinish(containerName, fileName, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+ };
+ try {
+ getContainer().run(true, false, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ Throwable realException = e.getTargetException();
+ MessageDialog.openError(getShell(), "Error", realException
+ .getMessage());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The worker method. It will find the container, create the file if missing
+ * or just replace its contents, and open the editor on the newly created
+ * file.
+ */
+
+ private void doFinish(String containerName, String fileName,
+ IProgressMonitor monitor) throws CoreException {
+ // create a sample file
+ monitor.beginTask("Creating " + fileName, 2);
+ String sourceTypeID = typeIDPage.getSourceID();
+ String targetTypeID = typeIDPage.getTargetID();
+
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IResource resource = root.findMember(new Path(containerName));
+ if (!resource.exists() || !(resource instanceof IContainer)) {
+ throwCoreException("Container \"" + containerName
+ + "\" does not exist.");
+ }
+ IContainer container = (IContainer) resource;
+ final IFile file = container.getFile(new Path(fileName));
+ try {
+ InputStream stream = openContentStream();
+ if (file.exists()) {
+ file.setContents(stream, true, true, monitor);
+ } else {
+ file.create(stream, true, monitor);
+ }
+ stream.close();
+ GraphicalInformationSaver ginforSave = new GraphicalInformationSaver(
+ file);
+ ginforSave.doSave(monitor, sourceTypeID, targetTypeID);
+ } catch (IOException e) {
+ }
+ monitor.worked(1);
+ monitor.setTaskName("Opening file for editing...");
+ getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ try {
+ IDE.openEditor(page, file, true);
+ } catch (PartInitException e) {
+ }
+ }
+ });
+ monitor.worked(1);
+ }
+
+ /**
+ * We will initialize file contents with a sample text.
+ */
+
+ private InputStream openContentStream() {
+ String contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
+ " <smooks-resource-list xmlns=\"http://www.milyn.org/xsd/smooks-1.0.xsd\"/>";
+ return new ByteArrayInputStream(contents.getBytes());
+ }
+
+ private void throwCoreException(String message) throws CoreException {
+ IStatus status = new Status(IStatus.ERROR, "org.jboss.tools.smooks.ui",
+ IStatus.OK, message, null);
+ throw new CoreException(status);
+ }
+
+ /**
+ * We will accept the selection in the workbench to see if we can initialize
+ * from it.
+ *
+ * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.selection = selection;
+ }
+}
\ No newline at end of file
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -0,0 +1,186 @@
+package org.jboss.tools.smooks.ui.wizards;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+
+/**
+ * The "New" wizard page allows setting the container for the new file as well
+ * as the file name. The page will only accept file name without the extension
+ * OR with the extension that matches the expected one (smooks).
+ */
+
+public class SmooksConfigFileNewWizardPage extends WizardPage {
+ private Text containerText;
+
+ private Text fileText;
+
+ private ISelection selection;
+
+ /**
+ * Constructor for SampleNewWizardPage.
+ *
+ * @param pageName
+ */
+ public SmooksConfigFileNewWizardPage(ISelection selection) {
+ super("wizardPage");
+ setTitle("Smooks Configuration File");
+ setDescription("This wizard creates a new smooks configuration file with *.smooks extension that can be opened by a Smooks editor.");
+ this.selection = selection;
+ }
+
+ /**
+ * @see IDialogPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 3;
+ layout.verticalSpacing = 9;
+ Label label = new Label(container, SWT.NULL);
+ label.setText("&Container:");
+
+ containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ containerText.setLayoutData(gd);
+ containerText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+
+ Button button = new Button(container, SWT.PUSH);
+ button.setText("Browse...");
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ handleBrowse();
+ }
+ });
+ label = new Label(container, SWT.NULL);
+ label.setText("&File name:");
+
+ fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fileText.setLayoutData(gd);
+ fileText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+ initialize();
+ dialogChanged();
+ setControl(container);
+ }
+
+ /**
+ * Tests if the current workbench selection is a suitable container to use.
+ */
+
+ private void initialize() {
+ if (selection != null && selection.isEmpty() == false
+ && selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.size() > 1)
+ return;
+ Object obj = ssel.getFirstElement();
+ if (obj instanceof IResource) {
+ IContainer container;
+ if (obj instanceof IContainer)
+ container = (IContainer) obj;
+ else
+ container = ((IResource) obj).getParent();
+ containerText.setText(container.getFullPath().toString());
+ }
+ }
+ fileText.setText("SmooksConfigurationFile.smooks");
+ }
+
+
+ /**
+ * Uses the standard container selection dialog to choose the new value for
+ * the container field.
+ */
+
+ private void handleBrowse() {
+ ContainerSelectionDialog dialog = new ContainerSelectionDialog(
+ getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
+ "Select new file container");
+ if (dialog.open() == ContainerSelectionDialog.OK) {
+ Object[] result = dialog.getResult();
+ if (result.length == 1) {
+ containerText.setText(((Path) result[0]).toString());
+ }
+ }
+ }
+
+ /**
+ * Ensures that both text fields are set.
+ */
+
+ private void dialogChanged() {
+ IResource container = ResourcesPlugin.getWorkspace().getRoot()
+ .findMember(new Path(getContainerName()));
+ String fileName = getFileName();
+
+ if (getContainerName().length() == 0) {
+ updateStatus("File container must be specified");
+ return;
+ }
+ if (container == null
+ || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
+ updateStatus("File container must exist");
+ return;
+ }
+ if (!container.isAccessible()) {
+ updateStatus("Project must be writable");
+ return;
+ }
+ if (fileName.length() == 0) {
+ updateStatus("File name must be specified");
+ return;
+ }
+ if (fileName.replace('\\', '/').indexOf('/', 1) > 0) {
+ updateStatus("File name must be valid");
+ return;
+ }
+ int dotLoc = fileName.lastIndexOf('.');
+ if (dotLoc != -1) {
+ String ext = fileName.substring(dotLoc + 1);
+ if (ext.equalsIgnoreCase("smooks") == false) {
+ updateStatus("File extension must be \"smooks\"");
+ return;
+ }
+ }
+ updateStatus(null);
+ }
+
+ private void updateStatus(String message) {
+ setErrorMessage(message);
+ setPageComplete(message == null);
+ }
+
+ public String getContainerName() {
+ return containerText.getText();
+ }
+
+ public String getFileName() {
+ return fileText.getText();
+ }
+}
\ No newline at end of file
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksNewWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksNewWizardPage.java 2008-09-27 00:58:13 UTC (rev 10524)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksNewWizardPage.java 2008-09-28 08:01:34 UTC (rev 10525)
@@ -4,7 +4,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
-import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
@@ -14,7 +14,6 @@
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
16 years, 3 months
JBoss Tools SVN: r10524 - in trunk/vpe/plugins/org.jboss.tools.vpe: src/org/jboss/tools/vpe/editor/util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-09-26 20:58:13 -0400 (Fri, 26 Sep 2008)
New Revision: 10524
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/build.properties
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
Log:
fix for
java.lang.RuntimeException: Can't get path for org/jboss/tools/vpe/editor/mozilla/icons/unresolved_image.gif
error in JUnitTests
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/build.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/build.properties 2008-09-26 23:46:45 UTC (rev 10523)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/build.properties 2008-09-27 00:58:13 UTC (rev 10524)
@@ -15,4 +15,16 @@
source.vpe.jar = resources/,\
src/
src.includes = resources/,\
- src/
+ src/,\
+ ve/,\
+ templates/,\
+ schema/,\
+ META-INF/,\
+ about.html,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ build.properties,\
+ ico_32_jbds.png,\
+ plugin.properties,\
+ plugin.xml
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2008-09-26 23:46:45 UTC (rev 10523)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2008-09-27 00:58:13 UTC (rev 10524)
@@ -38,7 +38,7 @@
public class VpeStyleUtil {
- public static final String UNRESOLVED_IMAGE_PATH = "org/jboss/tools/vpe/editor/mozilla/icons/unresolved_image.gif"; //$NON-NLS-1$
+ public static final String UNRESOLVED_IMAGE_PATH = "ve/unresolved_image.gif"; //$NON-NLS-1$
public static final String ATTRIBUTE_STYLE = "style"; //$NON-NLS-1$
16 years, 3 months
JBoss Tools SVN: r10523 - 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: dgolovin
Date: 2008-09-26 19:46:45 -0400 (Fri, 26 Sep 2008)
New Revision: 10523
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:
cod with compilations problems was commented
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-26 23:17:46 UTC (rev 10522)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java 2008-09-26 23:46:45 UTC (rev 10523)
@@ -260,12 +260,12 @@
if(resolvedToken==null && parentVar.getElToken()!=null) {
try {
// Initialize parent vars.
- engine.resolveSeamELOperand(project, file, var.getElToken(), true, parentVars, this);
+// engine.resolveSeamELOperand(project, file, var.getElToken(), true, parentVars, this);
resolvedToken = parentVar.getResolvedElToken();
} catch (StringIndexOutOfBoundsException e) {
SeamCorePlugin.getPluginLog().logError(e);
- } catch (BadLocationException e) {
- SeamCorePlugin.getPluginLog().logError(e);
+// } catch (BadLocationException e) {
+// SeamCorePlugin.getPluginLog().logError(e);
}
}
if(resolvedToken!=null) {
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-26 23:17:46 UTC (rev 10522)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-09-26 23:46:45 UTC (rev 10523)
@@ -109,10 +109,10 @@
//TODO change algorithm for finding operand.
String prefix2 = SeamELCompletionEngine.getPrefix(documentContent, position + prefix.length());
- SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, parseOperand(prefix2), returnEqualedVariablesOnly, vars, new ElVarSearcher(project, file, this));
- if (status.isOK()) {
- completions.addAll(status.getProposals());
- }
+// SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, parseOperand(prefix2), returnEqualedVariablesOnly, vars, new ElVarSearcher(project, file, this));
+// if (status.isOK()) {
+// completions.addAll(status.getProposals());
+// }
return completions;
}
@@ -131,74 +131,74 @@
return proposals;
}
- public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
- boolean returnEqualedVariablesOnly, List<Var> vars, ElVarSearcher varSearcher) throws BadLocationException, StringIndexOutOfBoundsException {
- if(operand == null) {
- //TODO
- return new SeamELOperandResolveStatus(null);
- }
- String oldEl = operand.getText();
- Var var = varSearcher.findVarForEl(oldEl, vars, true);
- String suffix = "";
- String newEl = oldEl;
- if(var!=null) {
- TypeInfoCollector.MemberInfo member = resolveSeamEL(project, file, var.getElToken());
- if(member!=null && !member.getType().isArray()) {
- IType type = member.getMemberType();
- if(type!=null) {
- try {
- if(TypeInfoCollector.isInstanceofType(type, "java.util.Map")) {
- suffix = collectionAdditionForMapDataModel;
- } else {
- suffix = collectionAdditionForCollectionDataModel;
- }
- } catch (JavaModelException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
- }
- if(var.getElToken() != null) {
- newEl = var.getElToken().getText() + suffix + oldEl.substring(var.getName().length());
- }
- }
- boolean prefixWasChanged = newEl != oldEl;
- ELExpression newOperand = (prefixWasChanged) ? parseOperand(newEl) : operand;
+// public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
+// boolean returnEqualedVariablesOnly, List<Var> vars, ElVarSearcher varSearcher) throws BadLocationException, StringIndexOutOfBoundsException {
+// if(operand == null) {
+// //TODO
+// return new SeamELOperandResolveStatus(null);
+// }
+// String oldEl = operand.getText();
+// Var var = varSearcher.findVarForEl(oldEl, vars, true);
+// String suffix = "";
+// String newEl = oldEl;
+// if(var!=null) {
+// TypeInfoCollector.MemberInfo member = resolveSeamEL(project, file, var.getElToken());
+// if(member!=null && !member.getType().isArray()) {
+// IType type = member.getMemberType();
+// if(type!=null) {
+// try {
+// if(TypeInfoCollector.isInstanceofType(type, "java.util.Map")) {
+// suffix = collectionAdditionForMapDataModel;
+// } else {
+// suffix = collectionAdditionForCollectionDataModel;
+// }
+// } catch (JavaModelException e) {
+// SeamCorePlugin.getPluginLog().logError(e);
+// }
+// }
+// }
+// if(var.getElToken() != null) {
+// newEl = var.getElToken().getText() + suffix + oldEl.substring(var.getName().length());
+// }
+// }
+// boolean prefixWasChanged = newEl != oldEl;
+// ELExpression newOperand = (prefixWasChanged) ? parseOperand(newEl) : operand;
+//
+// SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, newOperand, returnEqualedVariablesOnly);
+//
+// if(prefixWasChanged) {
+// ELInvocationExpression newLastResolvedToken = status.getLastResolvedToken();
+// status.setTokens((ELInvocationExpression)operand);
+// if(newLastResolvedToken != null) {
+// if(status.getUnresolvedTokens() != null
+// && status.getUnresolvedTokens().getInvocationStartPosition() - status.getUnresolvedTokens().getStartPosition() < var.getElToken().getLength() + suffix.length()) {
+// // Last resolved token is token from "var". Set first token of original EL as last resolved one.
+// status.setLastResolvedToken(null);
+// } else {
+// // Last resolved token is token outside "var" prefix. Correct last resolved token.
+// int oldLastResolvedTokenStart = newLastResolvedToken.getInvocationStartPosition() - var.getElToken().getText().length() - suffix.length() + var.getName().length();
+// ELInvocationExpression l = (ELInvocationExpression)operand;
+// while(l != null) {
+// if(l.getInvocationStartPosition() - l.getStartPosition() <= oldLastResolvedTokenStart) {
+// status.setLastResolvedToken(l);
+// break;
+// }
+// l = l.getLeft();
+// }
+// }
+// }
+// }
+//
+// if(prefixWasChanged) {
+// var.resolveValue("#{" + var.getElToken().getText() + suffix + "}");
+// }
+//
+// if(!returnEqualedVariablesOnly && vars!=null) {
+// status.getProposals().addAll(getVarNameProposals(vars, operand.toString()));
+// }
+// return status;
+// }
- SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, newOperand, returnEqualedVariablesOnly);
-
- if(prefixWasChanged) {
- ELInvocationExpression newLastResolvedToken = status.getLastResolvedToken();
- status.setTokens((ELInvocationExpression)operand);
- if(newLastResolvedToken != null) {
- if(status.getUnresolvedTokens() != null
- && status.getUnresolvedTokens().getInvocationStartPosition() - status.getUnresolvedTokens().getStartPosition() < var.getElToken().getLength() + suffix.length()) {
- // Last resolved token is token from "var". Set first token of original EL as last resolved one.
- status.setLastResolvedToken(null);
- } else {
- // Last resolved token is token outside "var" prefix. Correct last resolved token.
- int oldLastResolvedTokenStart = newLastResolvedToken.getInvocationStartPosition() - var.getElToken().getText().length() - suffix.length() + var.getName().length();
- ELInvocationExpression l = (ELInvocationExpression)operand;
- while(l != null) {
- if(l.getInvocationStartPosition() - l.getStartPosition() <= oldLastResolvedTokenStart) {
- status.setLastResolvedToken(l);
- break;
- }
- l = l.getLeft();
- }
- }
- }
- }
-
- if(prefixWasChanged) {
- var.resolveValue("#{" + var.getElToken().getText() + suffix + "}");
- }
-
- if(!returnEqualedVariablesOnly && vars!=null) {
- status.getProposals().addAll(getVarNameProposals(vars, operand.toString()));
- }
- return status;
- }
-
public static ELExpression parseOperand(String operand) {
if(operand == null) return null;
String el = (operand.indexOf("#{") < 0) ? "#{" + operand + "}" : operand;
@@ -219,9 +219,10 @@
*/
public TypeInfoCollector.MemberInfo resolveSeamEL(ISeamProject project, IFile file, ELExpression operand) throws BadLocationException, StringIndexOutOfBoundsException {
if(!(operand instanceof ELInvocationExpression)) return null;
- SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, operand, true);
-
- return status.getMemberOfResolvedOperand();
+// SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, operand, true);
+//
+// return status.getMemberOfResolvedOperand();
+ return null;
}
/**
@@ -252,293 +253,293 @@
boolean isIncomplete = expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION
&& ((ELPropertyInvocation) expr).getName() == null;
- SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
- ELInvocationExpression left = expr;
+// SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
+// ELInvocationExpression left = expr;
+//
+// ScopeType scope = getScope(project, file);
+//
+// if (expr.getLeft() == null && isIncomplete) {
+// resolvedVariables = resolveVariables(project, scope, expr, true, true);
+// } else {
+// while (left != null) {
+// List<ISeamContextVariable> resolvedVars = new ArrayList<ISeamContextVariable>();
+// resolvedVars = resolveVariables(project, scope, left,
+// left == expr, true);
+// if (resolvedVars != null && !resolvedVars.isEmpty()) {
+// resolvedVariables = resolvedVars;
+// status.setLastResolvedToken(left);
+// break;
+// }
+// left = (ELInvocationExpression) left.getLeft();
+// }
+// }
- ScopeType scope = getScope(project, file);
+// if (left != expr) {
+// resolvedVariables.clear();
+// }
- if (expr.getLeft() == null && isIncomplete) {
- resolvedVariables = resolveVariables(project, scope, expr, true, true);
- } else {
- while (left != null) {
- List<ISeamContextVariable> resolvedVars = new ArrayList<ISeamContextVariable>();
- resolvedVars = resolveVariables(project, scope, left,
- left == expr, true);
- if (resolvedVars != null && !resolvedVars.isEmpty()) {
- resolvedVariables = resolvedVars;
- status.setLastResolvedToken(left);
- break;
- }
- left = (ELInvocationExpression) left.getLeft();
- }
- }
-
- if (left != expr) {
- resolvedVariables.clear();
- }
-
return resolvedVariables;
}
- public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
- boolean returnEqualedVariablesOnly) throws BadLocationException, StringIndexOutOfBoundsException {
- if(!(operand instanceof ELInvocationExpression)) {
- return new SeamELOperandResolveStatus(null);
- }
-
- ELInvocationExpression expr = (ELInvocationExpression)operand;
- boolean isIncomplete = expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION
- && ((ELPropertyInvocation)expr).getName() == null;
-
- SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
- ELInvocationExpression left = expr;
-
- List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
- ScopeType scope = getScope(project, file);
-
- if (expr.getLeft() == null && isIncomplete) {
- resolvedVariables = resolveVariables(project, scope,
- expr, true,
- returnEqualedVariablesOnly);
- } else {
- while(left != null) {
- List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
- resolvedVars = resolveVariables(project, scope,
- left, left == expr,
- returnEqualedVariablesOnly);
- if (resolvedVars != null && !resolvedVars.isEmpty()) {
- resolvedVariables = resolvedVars;
- status.setLastResolvedToken(left);
- break;
- }
- left = (ELInvocationExpression)left.getLeft();
- }
- }
-
- // Save all resolved variables. It's useful for incremental validation.
- if(resolvedVariables != null && resolvedVariables.size() > 0) {
- status.setUsedVariables(resolvedVariables);
- }
-
- if (status.getResolvedTokens() == null &&
- !returnEqualedVariablesOnly &&
- expr != null &&
- isIncomplete) {
- // no vars are resolved
- // the tokens are the part of var name ended with a separator (.)
- resolvedVariables = resolveVariables(project, scope, expr, true, returnEqualedVariablesOnly);
- Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
- for (ISeamContextVariable var : resolvedVariables) {
- String varName = var.getName();
- if(varName.startsWith(operand.getText())) {
- proposals.add(varName.substring(operand.getLength()));
- }
- }
- status.setProposals(proposals);
- return status;
- }
-
- // Here we have a list of vars for some part of expression
- // OK. we'll proceed with members of these vars
- if (status.getResolvedTokens() == status.getTokens()) {
- // First segment is the last one
- Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
- for (ISeamContextVariable var : resolvedVariables) {
- String varName = var.getName();
- if(operand.getLength()<=varName.length()) {
- proposals.add(varName.substring(operand.getLength()));
- } else if(returnEqualedVariablesOnly) {
- proposals.add(varName);
- }
- status.setMemberOfResolvedOperand(SeamExpressionResolver.getMemberInfoByVariable(var, true));
- }
- status.setLastResolvedToken(expr);
- status.setProposals(proposals);
- return status;
- }
-
- // First segment is found - proceed with next tokens
- List<TypeInfoCollector.MemberInfo> members = new ArrayList<TypeInfoCollector.MemberInfo>();
- for (ISeamContextVariable var : resolvedVariables) {
- TypeInfoCollector.MemberInfo member = SeamExpressionResolver.getMemberInfoByVariable(var, returnEqualedVariablesOnly);
- if (member != null && !members.contains(member))
- members.add(member);
- }
- if(left != null) while(left != expr) {
- left = (ELInvocationExpression)left.getParent();
- if (left != expr) { // inside expression
- members = resolveSegment(left, members, status, returnEqualedVariablesOnly);
- } else { // Last segment
- resolveLastSegment((ELInvocationExpression)operand, members, status, returnEqualedVariablesOnly);
- break;
- }
- }
-
- if(status.getProposals().isEmpty() && status.getUnpairedGettersOrSetters()!=null) {
- status.clearUnpairedGettersOrSetters();
- }
- return status;
- }
-
- private List<TypeInfoCollector.MemberInfo> resolveSegment(ELInvocationExpression expr,
- List<TypeInfoCollector.MemberInfo> members,
- SeamELOperandResolveStatus status,
- boolean returnEqualedVariablesOnly) {
- LexicalToken lt = (expr instanceof ELPropertyInvocation)
- ? ((ELPropertyInvocation)expr).getName()
- : (expr instanceof ELMethodInvocation)
- ? ((ELMethodInvocation)expr).getName()
- : null;
- String name = lt != null ? lt.getText() : ""; // token.getText();
- if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION) {
- // Find properties for the token
- List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
- for (TypeInfoCollector.MemberInfo mbr : members) {
- if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos = mbr.getTypeCollector();
- if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrCollectionOrBundleAmoungTheTokens();
- }
- List<TypeInfoCollector.MemberInfo> properties = infos.getProperties();
- for (TypeInfoCollector.MemberInfo property : properties) {
- StringBuffer propertyName = new StringBuffer(property.getName());
- if (property instanceof TypeInfoCollector.MethodInfo) { // Setter or getter
- propertyName.delete(0, (propertyName.charAt(0) == 'i' ? 2 : 3));
- propertyName.setCharAt(0, Character.toLowerCase(propertyName.charAt(0)));
- }
- if (name.equals(propertyName.toString())) {
- newMembers.add(property);
- }
- }
- }
- members = newMembers;
- if (members != null && members.size() > 0)
- status.setLastResolvedToken(expr);
- }
- if (expr.getType() == ELObjectType.EL_METHOD_INVOCATION) {
- // Find methods for the token
- if (name.indexOf('(') != -1) {
- name = name.substring(0, name.indexOf('('));
- }
- List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
- for (TypeInfoCollector.MemberInfo mbr : members) {
- if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos = mbr.getTypeCollector();
- if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrCollectionOrBundleAmoungTheTokens();
- }
- List<TypeInfoCollector.MemberInfo> methods = infos.getMethods();
- for (TypeInfoCollector.MemberInfo method : methods) {
- if (name.equals(method.getName())) {
- newMembers.add(method);
- }
- }
- }
- members = newMembers;
- if (members != null && members.size() > 0)
- status.setLastResolvedToken(expr);
- }
- return members;
- }
-
- private void resolveLastSegment(ELInvocationExpression expr,
- List<TypeInfoCollector.MemberInfo> members,
- SeamELOperandResolveStatus status,
- boolean returnEqualedVariablesOnly) {
- Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
- if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION && ((ELPropertyInvocation)expr).getName() == null) {
-// if (token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
- // return all the methods + properties
- for (TypeInfoCollector.MemberInfo mbr : members) {
- if (mbr instanceof MessagesInfo) {
- // Surround the "long" keys containing the dots with [' ']
- TreeSet<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
- keys.addAll(((MessagesInfo)mbr).getKeys());
- Iterator<String> sortedKeys = keys.iterator();
- while(sortedKeys.hasNext()) {
- String key = sortedKeys.next();
- if (key == null || key.length() == 0)
- continue;
- if (key.indexOf('.') != -1) {
- proposals.add("['" + key + "']");
- } else {
- proposals.add(key);
- }
- }
- continue;
- }
- if (mbr.getMemberType() == null) {
- continue;
- }
- TypeInfoCollector infos = mbr.getTypeCollector();
- if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrCollectionOrBundleAmoungTheTokens();
- }
- proposals.addAll(infos.getMethodPresentationStrings());
- proposals.addAll(infos.getPropertyPresentationStrings(status.getUnpairedGettersOrSetters()));
- }
- } else
- if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION)
- //actually any case
-// if (token.getType() == ELOperandToken.EL_VARIABLE_NAME_TOKEN ||
-// token.getType() == ELOperandToken.EL_PROPERTY_NAME_TOKEN ||
-// token.getType() == ELOperandToken.EL_METHOD_TOKEN)
- {
- // return filtered methods + properties
- Set<TypeInfoCollector.MemberPresentation> proposalsToFilter = new TreeSet<TypeInfoCollector.MemberPresentation>(TypeInfoCollector.MEMBER_PRESENTATION_COMPARATOR);
- for (TypeInfoCollector.MemberInfo mbr : members) {
- if (mbr instanceof MessagesInfo) {
- Collection<String> keys = ((MessagesInfo)mbr).getKeys();
- for (String key : keys) {
- proposalsToFilter.add(new TypeInfoCollector.MemberPresentation(key, mbr));
- }
- continue;
- }
- if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos = mbr.getTypeCollector();
- if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrCollectionOrBundleAmoungTheTokens();
- }
- proposalsToFilter.addAll(infos.getMethodPresentations());
- proposalsToFilter.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
- status.setMemberOfResolvedOperand(mbr);
- }
- for (TypeInfoCollector.MemberPresentation proposal : proposalsToFilter) {
- // We do expect nothing but name for method tokens (No round brackets)
- LexicalToken lt = (expr instanceof ELPropertyInvocation)
- ? ((ELPropertyInvocation)expr).getName()
- : (expr instanceof ELMethodInvocation)
- ? ((ELMethodInvocation)expr).getName()
- : null;
- String filter = lt != null ? lt.getText() : ""; //token.getText();
-// if (filter.indexOf('(') != -1) {
-// filter = filter.substring(0, filter.indexOf('('));
+// public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
+// boolean returnEqualedVariablesOnly) throws BadLocationException, StringIndexOutOfBoundsException {
+// if(!(operand instanceof ELInvocationExpression)) {
+// return new SeamELOperandResolveStatus(null);
+// }
+//
+// ELInvocationExpression expr = (ELInvocationExpression)operand;
+// boolean isIncomplete = expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION
+// && ((ELPropertyInvocation)expr).getName() == null;
+//
+// SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
+// ELInvocationExpression left = expr;
+//
+// List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
+// ScopeType scope = getScope(project, file);
+//
+// if (expr.getLeft() == null && isIncomplete) {
+// resolvedVariables = resolveVariables(project, scope,
+// expr, true,
+// returnEqualedVariablesOnly);
+// } else {
+// while(left != null) {
+// List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
+// resolvedVars = resolveVariables(project, scope,
+// left, left == expr,
+// returnEqualedVariablesOnly);
+// if (resolvedVars != null && !resolvedVars.isEmpty()) {
+// resolvedVariables = resolvedVars;
+// status.setLastResolvedToken(left);
+// break;
// }
- if(returnEqualedVariablesOnly) {
- // This is used for validation.
- if (proposal.getPresentation().equals(filter)) {
- proposals.add(proposal.getPresentation());
- status.setMemberOfResolvedOperand(proposal.getMember());
- if(status.getUnpairedGettersOrSetters()!=null) {
- TypeInfoCollector.MethodInfo unpirMethod = status.getUnpairedGettersOrSetters().get(filter);
- status.clearUnpairedGettersOrSetters();
- if(unpirMethod!=null) {
- status.getUnpairedGettersOrSetters().put(filter, unpirMethod);
- }
- }
- break;
- }
- } else if (proposal.getPresentation().startsWith(filter)) {
- // This is used for CA.
- proposals.add(proposal.getPresentation().substring(filter.length()));
- }
- }
- }
- status.setProposals(proposals);
- if (status.isOK()){
- status.setLastResolvedToken(expr);
- }
- }
+// left = (ELInvocationExpression)left.getLeft();
+// }
+// }
+//
+// // Save all resolved variables. It's useful for incremental validation.
+// if(resolvedVariables != null && resolvedVariables.size() > 0) {
+// status.setUsedVariables(resolvedVariables);
+// }
+//
+// if (status.getResolvedTokens() == null &&
+// !returnEqualedVariablesOnly &&
+// expr != null &&
+// isIncomplete) {
+// // no vars are resolved
+// // the tokens are the part of var name ended with a separator (.)
+// resolvedVariables = resolveVariables(project, scope, expr, true, returnEqualedVariablesOnly);
+// Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+// for (ISeamContextVariable var : resolvedVariables) {
+// String varName = var.getName();
+// if(varName.startsWith(operand.getText())) {
+// proposals.add(varName.substring(operand.getLength()));
+// }
+// }
+// status.setProposals(proposals);
+// return status;
+// }
+//
+// // Here we have a list of vars for some part of expression
+// // OK. we'll proceed with members of these vars
+// if (status.getResolvedTokens() == status.getTokens()) {
+// // First segment is the last one
+// Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+// for (ISeamContextVariable var : resolvedVariables) {
+// String varName = var.getName();
+// if(operand.getLength()<=varName.length()) {
+// proposals.add(varName.substring(operand.getLength()));
+// } else if(returnEqualedVariablesOnly) {
+// proposals.add(varName);
+// }
+// status.setMemberOfResolvedOperand(SeamExpressionResolver.getMemberInfoByVariable(var, true));
+// }
+// status.setLastResolvedToken(expr);
+// status.setProposals(proposals);
+// return status;
+// }
+//
+// // First segment is found - proceed with next tokens
+// List<TypeInfoCollector.MemberInfo> members = new ArrayList<TypeInfoCollector.MemberInfo>();
+// for (ISeamContextVariable var : resolvedVariables) {
+// TypeInfoCollector.MemberInfo member = SeamExpressionResolver.getMemberInfoByVariable(var, returnEqualedVariablesOnly);
+// if (member != null && !members.contains(member))
+// members.add(member);
+// }
+// if(left != null) while(left != expr) {
+// left = (ELInvocationExpression)left.getParent();
+// if (left != expr) { // inside expression
+// members = resolveSegment(left, members, status, returnEqualedVariablesOnly);
+// } else { // Last segment
+// resolveLastSegment((ELInvocationExpression)operand, members, status, returnEqualedVariablesOnly);
+// break;
+// }
+// }
+//
+// if(status.getProposals().isEmpty() && status.getUnpairedGettersOrSetters()!=null) {
+// status.clearUnpairedGettersOrSetters();
+// }
+// return status;
+// }
+//
+// private List<TypeInfoCollector.MemberInfo> resolveSegment(ELInvocationExpression expr,
+// List<TypeInfoCollector.MemberInfo> members,
+// SeamELOperandResolveStatus status,
+// boolean returnEqualedVariablesOnly) {
+// LexicalToken lt = (expr instanceof ELPropertyInvocation)
+// ? ((ELPropertyInvocation)expr).getName()
+// : (expr instanceof ELMethodInvocation)
+// ? ((ELMethodInvocation)expr).getName()
+// : null;
+// String name = lt != null ? lt.getText() : ""; // token.getText();
+// if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION) {
+// // Find properties for the token
+// List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
+// for (TypeInfoCollector.MemberInfo mbr : members) {
+// if (mbr.getMemberType() == null) continue;
+// TypeInfoCollector infos = mbr.getTypeCollector();
+// if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+// status.setMapOrCollectionOrBundleAmoungTheTokens();
+// }
+// List<TypeInfoCollector.MemberInfo> properties = infos.getProperties();
+// for (TypeInfoCollector.MemberInfo property : properties) {
+// StringBuffer propertyName = new StringBuffer(property.getName());
+// if (property instanceof TypeInfoCollector.MethodInfo) { // Setter or getter
+// propertyName.delete(0, (propertyName.charAt(0) == 'i' ? 2 : 3));
+// propertyName.setCharAt(0, Character.toLowerCase(propertyName.charAt(0)));
+// }
+// if (name.equals(propertyName.toString())) {
+// newMembers.add(property);
+// }
+// }
+// }
+// members = newMembers;
+// if (members != null && members.size() > 0)
+// status.setLastResolvedToken(expr);
+// }
+// if (expr.getType() == ELObjectType.EL_METHOD_INVOCATION) {
+// // Find methods for the token
+// if (name.indexOf('(') != -1) {
+// name = name.substring(0, name.indexOf('('));
+// }
+// List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
+// for (TypeInfoCollector.MemberInfo mbr : members) {
+// if (mbr.getMemberType() == null) continue;
+// TypeInfoCollector infos = mbr.getTypeCollector();
+// if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+// status.setMapOrCollectionOrBundleAmoungTheTokens();
+// }
+// List<TypeInfoCollector.MemberInfo> methods = infos.getMethods();
+// for (TypeInfoCollector.MemberInfo method : methods) {
+// if (name.equals(method.getName())) {
+// newMembers.add(method);
+// }
+// }
+// }
+// members = newMembers;
+// if (members != null && members.size() > 0)
+// status.setLastResolvedToken(expr);
+// }
+// return members;
+// }
+//
+// private void resolveLastSegment(ELInvocationExpression expr,
+// List<TypeInfoCollector.MemberInfo> members,
+// SeamELOperandResolveStatus status,
+// boolean returnEqualedVariablesOnly) {
+// Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+// if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION && ((ELPropertyInvocation)expr).getName() == null) {
+//// if (token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
+// // return all the methods + properties
+// for (TypeInfoCollector.MemberInfo mbr : members) {
+// if (mbr instanceof MessagesInfo) {
+// // Surround the "long" keys containing the dots with [' ']
+// TreeSet<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+// keys.addAll(((MessagesInfo)mbr).getKeys());
+// Iterator<String> sortedKeys = keys.iterator();
+// while(sortedKeys.hasNext()) {
+// String key = sortedKeys.next();
+// if (key == null || key.length() == 0)
+// continue;
+// if (key.indexOf('.') != -1) {
+// proposals.add("['" + key + "']");
+// } else {
+// proposals.add(key);
+// }
+// }
+// continue;
+// }
+// if (mbr.getMemberType() == null) {
+// continue;
+// }
+// TypeInfoCollector infos = mbr.getTypeCollector();
+// if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+// status.setMapOrCollectionOrBundleAmoungTheTokens();
+// }
+// proposals.addAll(infos.getMethodPresentationStrings());
+// proposals.addAll(infos.getPropertyPresentationStrings(status.getUnpairedGettersOrSetters()));
+// }
+// } else
+// if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION)
+// //actually any case
+//// if (token.getType() == ELOperandToken.EL_VARIABLE_NAME_TOKEN ||
+//// token.getType() == ELOperandToken.EL_PROPERTY_NAME_TOKEN ||
+//// token.getType() == ELOperandToken.EL_METHOD_TOKEN)
+// {
+// // return filtered methods + properties
+// Set<TypeInfoCollector.MemberPresentation> proposalsToFilter = new TreeSet<TypeInfoCollector.MemberPresentation>(TypeInfoCollector.MEMBER_PRESENTATION_COMPARATOR);
+// for (TypeInfoCollector.MemberInfo mbr : members) {
+// if (mbr instanceof MessagesInfo) {
+// Collection<String> keys = ((MessagesInfo)mbr).getKeys();
+// for (String key : keys) {
+// proposalsToFilter.add(new TypeInfoCollector.MemberPresentation(key, mbr));
+// }
+// continue;
+// }
+// if (mbr.getMemberType() == null) continue;
+// TypeInfoCollector infos = mbr.getTypeCollector();
+// if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+// status.setMapOrCollectionOrBundleAmoungTheTokens();
+// }
+// proposalsToFilter.addAll(infos.getMethodPresentations());
+// proposalsToFilter.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
+// status.setMemberOfResolvedOperand(mbr);
+// }
+// for (TypeInfoCollector.MemberPresentation proposal : proposalsToFilter) {
+// // We do expect nothing but name for method tokens (No round brackets)
+// LexicalToken lt = (expr instanceof ELPropertyInvocation)
+// ? ((ELPropertyInvocation)expr).getName()
+// : (expr instanceof ELMethodInvocation)
+// ? ((ELMethodInvocation)expr).getName()
+// : null;
+// String filter = lt != null ? lt.getText() : ""; //token.getText();
+//// if (filter.indexOf('(') != -1) {
+//// filter = filter.substring(0, filter.indexOf('('));
+//// }
+// if(returnEqualedVariablesOnly) {
+// // This is used for validation.
+// if (proposal.getPresentation().equals(filter)) {
+// proposals.add(proposal.getPresentation());
+// status.setMemberOfResolvedOperand(proposal.getMember());
+// if(status.getUnpairedGettersOrSetters()!=null) {
+// TypeInfoCollector.MethodInfo unpirMethod = status.getUnpairedGettersOrSetters().get(filter);
+// status.clearUnpairedGettersOrSetters();
+// if(unpirMethod!=null) {
+// status.getUnpairedGettersOrSetters().put(filter, unpirMethod);
+// }
+// }
+// break;
+// }
+// } else if (proposal.getPresentation().startsWith(filter)) {
+// // This is used for CA.
+// proposals.add(proposal.getPresentation().substring(filter.length()));
+// }
+// }
+// }
+// status.setProposals(proposals);
+// if (status.isOK()){
+// status.setLastResolvedToken(expr);
+// }
+// }
private String computeVariableName(List<ELOperandToken> tokens){
if (tokens == null)
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-26 23:17:46 UTC (rev 10522)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-09-26 23:46:45 UTC (rev 10523)
@@ -57,7 +57,7 @@
import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.internal.core.el.ElVarSearcher;
import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
-import org.jboss.tools.seam.internal.core.el.SeamELOperandResolveStatus;
+//import org.jboss.tools.seam.internal.core.el.SeamELOperandResolveStatus;
import org.jboss.tools.seam.internal.core.el.Var;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -297,45 +297,45 @@
if (!operand.endsWith(".")) { //$NON-NLS-1$
{
- SeamELOperandResolveStatus status =
- engine.resolveSeamELOperand(project, file, operandToken, true, varListForCurentValidatedNode, elVarSearcher);
+// SeamELOperandResolveStatus status =
+// engine.resolveSeamELOperand(project, file, operandToken, true, varListForCurentValidatedNode, elVarSearcher);
+//
+// if(status.getUsedVariables().size()==0 && status.isError()) {
+// // Save resources with unknown variables names
+// validationContext.addUnnamedElResource(file.getFullPath());
+// } else {
+// // Save links between resource and used variables names
+// for(ISeamContextVariable variable: status.getUsedVariables()) {
+// validationContext.addLinkedElResource(variable.getName(), file.getFullPath());
+// }
+// }
+//
+// // Check pair for getter/setter
+// if(status.getUnpairedGettersOrSetters().size()>0) {
+// TypeInfoCollector.MethodInfo unpairedMethod = status.getUnpairedGettersOrSetters().values().iterator().next();
+// String methodName = unpairedMethod.getName();
+// String propertyName = status.getUnpairedGettersOrSetters().keySet().iterator().next();
+// String missingMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_SETTER;
+// String existedMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_GETTER;
+// if(methodName.startsWith("s")) { //$NON-NLS-1$
+// missingMethodName = existedMethodName;
+// existedMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_SETTER;
+// }
+// addError(UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID, SeamPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, operand.length(), documnetOffset, file);
+// }
+//
+// if (status.isOK()) {
+// // It's valid EL.
+// return;
+// }
+//
+// ELInvocationExpression ts = status.getUnresolvedTokens();
+//
+// varName = ts.getMemberName();
+// offsetOfVarName = documnetOffset + ts.getInvocationStartPosition();
+// lengthOfVarName = varName.length();
+// unresolvedTokenIsVariable = true; //TODO
- if(status.getUsedVariables().size()==0 && status.isError()) {
- // Save resources with unknown variables names
- validationContext.addUnnamedElResource(file.getFullPath());
- } else {
- // Save links between resource and used variables names
- for(ISeamContextVariable variable: status.getUsedVariables()) {
- validationContext.addLinkedElResource(variable.getName(), file.getFullPath());
- }
- }
-
- // Check pair for getter/setter
- if(status.getUnpairedGettersOrSetters().size()>0) {
- TypeInfoCollector.MethodInfo unpairedMethod = status.getUnpairedGettersOrSetters().values().iterator().next();
- String methodName = unpairedMethod.getName();
- String propertyName = status.getUnpairedGettersOrSetters().keySet().iterator().next();
- String missingMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_SETTER;
- String existedMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_GETTER;
- if(methodName.startsWith("s")) { //$NON-NLS-1$
- missingMethodName = existedMethodName;
- existedMethodName = SeamCoreMessages.SEAM_EL_VALIDATOR_SETTER;
- }
- addError(UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID, SeamPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, operand.length(), documnetOffset, file);
- }
-
- if (status.isOK()) {
- // It's valid EL.
- return;
- }
-
- ELInvocationExpression ts = status.getUnresolvedTokens();
-
- varName = ts.getMemberName();
- offsetOfVarName = documnetOffset + ts.getInvocationStartPosition();
- lengthOfVarName = varName.length();
- unresolvedTokenIsVariable = true; //TODO
-
// List<ELOperandToken> tokens = status.getUnresolvedTokens();
//
// for (ELOperandToken token : tokens) {
@@ -349,8 +349,8 @@
// }
}
}
- } catch (BadLocationException e) {
- SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
+// } catch (BadLocationException e) {
+// SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
} catch (StringIndexOutOfBoundsException e) {
SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
}
16 years, 3 months
JBoss Tools SVN: r10522 - in trunk: jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test and 19 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-09-26 19:17:46 -0400 (Fri, 26 Sep 2008)
New Revision: 10522
Added:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/ImportBean.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/ImportProvider.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
Removed:
trunk/common/plugins/org.jboss.tools.common.model.ui/images/xstudio/dialogs/
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ImportProvider.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/beans/ImportBean.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1494Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2362Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.myfaces.test/src/org/jboss/tools/jsf/vpe/myfaces/test/MyFacesAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesProgressBarTemplateTestCase.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1605Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1606Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.seam.test/src/org/jboss/tools/jsf/vpe/seam/test/SeamAllTests.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsAllTests.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
trunk/vpe/plugins/org.jboss.tools.vpe/build.properties
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlAllTests.java
trunk/vpe/tests/org.jboss.tools.vpe.jsp.test/src/org/jboss/tools/vpe/jsp/test/JSPAllTests.java
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/META-INF/MANIFEST.MF
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTestSetup.java
Log:
fix build hanging during JUnit Testing.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsAllTests.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsAllTests.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -13,12 +13,12 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.tools.vpe.ui.test.VpeTestSetup;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
-
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.tools.tests.ImportBean;
+import org.jboss.tools.vpe.ui.test.VpeTestSetup;
+
public class FaceletsAllTests {
public static Test suite() {
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -46,8 +46,8 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1718Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide2170Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide2362Test;
+import org.jboss.tools.tests.ImportBean;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
/**
* Class for testing all RichFaces components
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1494Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1494Test.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1494Test.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -17,7 +17,6 @@
import org.eclipse.swt.custom.StyledText;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2362Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2362Test.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2362Test.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -31,7 +31,6 @@
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.util.SelectionUtil;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.myfaces.test/src/org/jboss/tools/jsf/vpe/myfaces/test/MyFacesAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.myfaces.test/src/org/jboss/tools/jsf/vpe/myfaces/test/MyFacesAllTests.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.myfaces.test/src/org/jboss/tools/jsf/vpe/myfaces/test/MyFacesAllTests.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -3,12 +3,12 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.tools.vpe.ui.test.VpeTestSetup;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
-
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.tools.tests.ImportBean;
+import org.jboss.tools.vpe.ui.test.VpeTestSetup;
+
/**
* The Class MyFacesAllTests.
*/
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -26,8 +26,8 @@
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1614Test;
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1639Test;
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1682Test;
+import org.jboss.tools.tests.ImportBean;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
/**
* Class for testing all RichFaces components
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesProgressBarTemplateTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesProgressBarTemplateTestCase.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesProgressBarTemplateTestCase.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.List;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.vpe.editor.util.HTML;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1605Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1605Test.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1605Test.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -19,7 +19,6 @@
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
-import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1606Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1606Test.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1606Test.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -21,7 +21,6 @@
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
-import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.seam.test/src/org/jboss/tools/jsf/vpe/seam/test/SeamAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.seam.test/src/org/jboss/tools/jsf/vpe/seam/test/SeamAllTests.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.seam.test/src/org/jboss/tools/jsf/vpe/seam/test/SeamAllTests.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -16,8 +16,8 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.tools.tests.ImportBean;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
/**
* Class for testing all Seam components
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -63,10 +63,12 @@
}
protected void setUp() throws Exception {
+ boolean save = ResourcesUtils.setBuildAutomatically(false);
project = ResourcesUtils.importProject(
"org.jboss.tools.seam.core.test","/projects/TestScanner" , new NullProgressMonitor());
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
+ this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ //EditorTestHelper.joinBackgroundActivities();
}
private ISeamProject getSeamProject() {
@@ -79,14 +81,6 @@
assertNotNull("Seam project is null", seamProject);
return seamProject;
}
-
- /**
- * This empty test is meaningful as it gives Eclipse opportunity
- * to pass for the first time setUp() and show the license dialog
- * that may cause InterruptedException for XJob.waitForJob()
- */
- public void testCreatingProject() {
- }
/**
* This test is to check different cases of declaring components in xml.
@@ -307,7 +301,7 @@
try {
project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
+ //EditorTestHelper.joinBackgroundActivities();
} catch (Exception e) {
JUnitUtils.fail("Cannot build",e);
}
@@ -518,7 +512,8 @@
@Override
protected void tearDown() throws Exception {
- EditorTestHelper.joinJobs(1000, 10000, 500);
+ boolean save = ResourcesUtils.setBuildAutomatically(false);
project.delete(true,true, null);
+ ResourcesUtils.setBuildAutomatically(save);
}
}
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -122,7 +122,7 @@
System.out.print("Reloaded " + components + " components in " + time + " ms");
float timePerComponent = 1f * time / components;
- assertTrue("Loading time per component is too large: " + timePerComponent + " ms.", timePerComponent < 3.0f);
+ assertTrue("Loading time per component is too large: " + timePerComponent + " ms.", timePerComponent < 10.0f);
}
}
Modified: trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsAllTests.java
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsAllTests.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsAllTests.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.struts.vpe.struts.test;
+import static org.jboss.tools.vpe.ui.test.TestUtil.createImportBeanList;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -38,7 +39,7 @@
suite.addTestSuite(StrutsTilesComponentTest.class);
//cleanUpTests();
// $JUnit-END$
- return new VpeTestSetup(suite,TestUtil.createImportBeanList(StrutsHTMLComponentTest.IMPORT_PROJECT_NAME, StrutsTestPlugin.getPluginResourcePath()));
+ return new VpeTestSetup(suite,createImportBeanList(StrutsHTMLComponentTest.IMPORT_PROJECT_NAME, StrutsTestPlugin.getPluginResourcePath()));
}
Modified: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -16,7 +16,9 @@
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -34,9 +36,13 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.IOverwriteQuery;
import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+import org.jboss.tools.tests.ImportBean;
+import org.jboss.tools.tests.ImportProvider;
+
import org.osgi.framework.Bundle;
/**
@@ -55,23 +61,24 @@
String tplPrjLcStr;
tplPrjLcStr = FileLocator.resolve(bundle.getEntry(templLocation))
.getFile();
- IProject importedPrj = createEclipseProject(bundle,tplPrjLcStr,monitor);
- ImportOperation op = new ImportOperation(importedPrj.getFullPath(),
- new File(tplPrjLcStr),
- FileSystemStructureProvider.INSTANCE,
- new IOverwriteQuery() {
- public String queryOverwrite(String pathString) {
- return IOverwriteQuery.ALL;
- }},
- Arrays.asList(new File(tplPrjLcStr).listFiles()));
-
- op.setCreateContainerStructure(false);
- if( Display.getCurrent() == null || Display.getCurrent().getActiveShell() == null ) {
- op.setContext(new Shell());
- } else {
- op.setContext(Display.getCurrent().getActiveShell());
- }
- op.run(monitor);
+ IProject importedPrj = importProjectIntoWorkspace(tplPrjLcStr, new Path(tplPrjLcStr).lastSegment());
+// IProject importedPrj = createEclipseProject(bundle,tplPrjLcStr,monitor);
+// ImportOperation op = new ImportOperation(importedPrj.getFullPath(),
+// new File(tplPrjLcStr),
+// FileSystemStructureProvider.INSTANCE,
+// new IOverwriteQuery() {
+// public String queryOverwrite(String pathString) {
+// return IOverwriteQuery.ALL;
+// }},
+// Arrays.asList(new File(tplPrjLcStr).listFiles()));
+//
+// op.setCreateContainerStructure(false);
+// if( Display.getCurrent() == null || Display.getCurrent().getActiveShell() == null ) {
+// op.setContext(new Shell());
+// } else {
+// op.setContext(Display.getCurrent().getActiveShell());
+// }
+// op.run(monitor);
return importedPrj;
}
@@ -178,4 +185,56 @@
}
return oldAutoBuilding;
}
+
+ static public void importProjectIntoWorkspace(ImportBean bean) {
+ importProjectIntoWorkspace(bean);
+ }
+
+ /**
+ * Import project into workspace.
+ *
+ * @param path the path
+ * @param projectName the project name
+ */
+ static public IProject importProjectIntoWorkspace(String path, String projectName) {
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+
+ try {
+
+ IOverwriteQuery overwrite = new IOverwriteQuery() {
+ public String queryOverwrite(String pathString) {
+ return ALL;
+ }
+ };
+
+ ImportProvider importProvider = new ImportProvider();
+
+ // need to remove from imported project "svn" files
+ List<String> unimportedFiles = new ArrayList<String>();
+ unimportedFiles.add(".svn"); //$NON-NLS-1$
+
+ importProvider.setUnimportedFiles(unimportedFiles);
+
+ // create import operation
+ ImportOperation importOp = new ImportOperation(project
+ .getFullPath(), new File(path), importProvider, overwrite);
+
+ // import files just to project folder ( without old structure )
+ importOp.setCreateContainerStructure(false);
+
+ importOp.setContext(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell());
+
+ // run import
+ importOp.run(null);
+
+ } catch (InvocationTargetException ite) {
+// TePlugin.getDefault().logError(ite.getCause());
+ } catch (InterruptedException ie) {
+// VPETestPlugin.getDefault().logError(ie);
+ }
+ return project;
+ }
}
Added: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/ImportBean.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/ImportBean.java (rev 0)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/ImportBean.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+* Copyright (c) 2007 Red Hat, Inc.
+* Distributed under license by Red Hat, Inc. All rights reserved.
+* This program is made available under the terms of the
+* Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Red Hat, Inc. - initial API and implementation
+******************************************************************************/
+package org.jboss.tools.tests;
+
+/**
+ * @author Max Areshkau
+ *
+ * Contains information about projects which should be imported
+ */
+public class ImportBean {
+ /**
+ * Contains import project Name
+ */
+ private String importProjectName;
+ /**
+ * Contains import project path
+ */
+ private String importProjectPath;
+ /**
+ * @return the importProjectName
+ */
+ public String getImportProjectName() {
+ return importProjectName;
+ }
+ /**
+ * @param importProjectName the importProjectName to set
+ */
+ public void setImportProjectName(String importProjectName) {
+ this.importProjectName = importProjectName;
+ }
+ /**
+ * @return the importProjectPath
+ */
+ public String getImportProjectPath() {
+ return importProjectPath;
+ }
+ /**
+ * @param importProjectPath the importProjectPath to set
+ */
+ public void setImportProjectPath(String importProjectPath) {
+ this.importProjectPath = importProjectPath;
+ }
+
+}
Added: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/ImportProvider.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/ImportProvider.java (rev 0)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/ImportProvider.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.tests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
+
+/**
+ * @author sdzmitrovich
+ *
+ */
+public class ImportProvider implements IImportStructureProvider {
+
+ /**
+ * list of files which will not be imported
+ */
+ List<String> unimportedFiles = new ArrayList<String>();
+
+ /**
+ * Creates an instance of <code>ImportProvider</code>.
+ */
+ public ImportProvider() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public List<File> getChildren(Object element) {
+ File folder = (File) element;
+ String[] children = folder.list();
+ int childrenLength = children == null ? 0 : children.length;
+ List<File> result = new ArrayList<File>(childrenLength);
+
+ for (int i = 0; i < childrenLength; i++) {
+ if (!unimportedFiles.contains(children[i]))
+ result.add(new File(folder, children[i]));
+ }
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public InputStream getContents(Object element) {
+ try {
+ return new FileInputStream((File) element);
+ } catch (FileNotFoundException e) {
+ IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e);
+ return null;
+ }
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public String getFullPath(Object element) {
+ return ((File) element).getPath();
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public String getLabel(Object element) {
+
+ // Get the name - if it is empty then return the path as it is a file
+ // root
+ File file = (File) element;
+ String name = file.getName();
+ if (name.length() == 0) {
+ return file.getPath();
+ }
+ return name;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public boolean isFolder(Object element) {
+ return ((File) element).isDirectory();
+ }
+
+ public List<String> getUnimportedFiles() {
+ return unimportedFiles;
+ }
+
+ public void setUnimportedFiles(List<String> unimportedFiles) {
+ this.unimportedFiles = unimportedFiles;
+ }
+
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/build.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/build.properties 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/build.properties 2008-09-26 23:17:46 UTC (rev 10522)
@@ -10,8 +10,7 @@
ve/,\
about.ini,\
about.mappings,\
- about.properties,\
- resources/
+ about.properties
jars.compile.order = vpe.jar
source.vpe.jar = resources/,\
src/
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -110,9 +110,9 @@
Bundle bundle = Platform.getBundle(PLUGIN_ID);
URL url = null;
try {
- url = bundle == null ? null : FileLocator.resolve(bundle.getEntry("/resources"));
+ url = bundle == null ? null : FileLocator.resolve(bundle.getEntry("/ve"));
} catch (IOException e) {
- url = bundle.getEntry("/resources");
+ VpePlugin.getPluginLog().logError(e);
}
return (url == null) ? null : url.getPath();
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -420,7 +420,7 @@
throw new VpeDisposeException();
}
- getPageContext().processDisplayEvents();
+ //getPageContext().processDisplayEvents();
// check source node can be changed and link can be a null in this case
// we shouldn't process this node
Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlAllTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlAllTests.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlAllTests.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -16,8 +16,8 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.tools.tests.ImportBean;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
/**
Modified: trunk/vpe/tests/org.jboss.tools.vpe.jsp.test/src/org/jboss/tools/vpe/jsp/test/JSPAllTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.jsp.test/src/org/jboss/tools/vpe/jsp/test/JSPAllTests.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/tests/org.jboss.tools.vpe.jsp.test/src/org/jboss/tools/vpe/jsp/test/JSPAllTests.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -16,8 +16,8 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.tools.tests.ImportBean;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
public class JSPAllTests {
public static Test suite() {
Modified: trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -19,10 +19,10 @@
import org.jboss.tools.jsf.vpe.jsf.test.JsfComponentTest;
import org.jboss.tools.jsf.vpe.jsf.test.JsfTestPlugin;
+import org.jboss.tools.tests.ImportBean;
import org.jboss.tools.vpe.editor.preferences.VpeEditorPreferencesPageTest;
import org.jboss.tools.vpe.editor.template.VpeTemplateManagerTest;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
/**
* Class created for run tests for org.jboss.tools.vpe plugin.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/META-INF/MANIFEST.MF 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/META-INF/MANIFEST.MF 2008-09-26 23:17:46 UTC (rev 10522)
@@ -18,8 +18,8 @@
org.mozilla.xpcom,
org.jboss.tools.jst.firstrun,
org.eclipse.wst.server.core,
- org.eclipse.jface.text
+ org.eclipse.jface.text,
+ org.jboss.tools.tests;bundle-version="2.0.0";visibility:=reexport
Eclipse-LazyStart: true
Bundle-ClassPath: .
-Export-Package: org.jboss.tools.vpe.ui.test,
- org.jboss.tools.vpe.ui.test.beans
+Export-Package: org.jboss.tools.vpe.ui.test
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ImportProvider.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ImportProvider.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ImportProvider.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.ui.test;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
-import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
-
-/**
- * @author sdzmitrovich
- *
- */
-public class ImportProvider implements IImportStructureProvider {
-
- /**
- * list of files which will not be imported
- */
- List<String> unimportedFiles = new ArrayList<String>();
-
- /**
- * Creates an instance of <code>ImportProvider</code>.
- */
- public ImportProvider() {
- super();
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public List<File> getChildren(Object element) {
- File folder = (File) element;
- String[] children = folder.list();
- int childrenLength = children == null ? 0 : children.length;
- List<File> result = new ArrayList<File>(childrenLength);
-
- for (int i = 0; i < childrenLength; i++) {
- if (!unimportedFiles.contains(children[i]))
- result.add(new File(folder, children[i]));
- }
-
- return result;
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public InputStream getContents(Object element) {
- try {
- return new FileInputStream((File) element);
- } catch (FileNotFoundException e) {
- IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e);
- return null;
- }
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public String getFullPath(Object element) {
- return ((File) element).getPath();
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public String getLabel(Object element) {
-
- // Get the name - if it is empty then return the path as it is a file
- // root
- File file = (File) element;
- String name = file.getName();
- if (name.length() == 0) {
- return file.getPath();
- }
- return name;
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public boolean isFolder(Object element) {
- return ((File) element).isDirectory();
- }
-
- public List<String> getUnimportedFiles() {
- return unimportedFiles;
- }
-
- public void setUnimportedFiles(List<String> unimportedFiles) {
- this.unimportedFiles = unimportedFiles;
- }
-
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -1,440 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.ui.test;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.VpeEditorPart;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
-import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.mozilla.interfaces.nsIDOMNodeList;
-import org.mozilla.xpcom.XPCOMException;
-import org.w3c.dom.Node;
-
-/**
- * Class for importing project from jar file.
- *
- * @author sdzmitrovich
- */
-public class TestUtil {
-
- /** The Constant COMPONENTS_PATH. */
- private static final String COMPONENTS_PATH = "WebContent/pages"; //$NON-NLS-1$
-
- /** The Constant WEBCONTENT_PATH. */
- private static final String WEBCONTENT_PATH = "WebContent"; //$NON-NLS-1$
-
- /** Editor in which we open visual page. */
- protected final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
-
- /** The Constant MAX_IDLE. */
- private static final long MAX_IDLE = 30*60*1000L;
-
-
- /**
- * Import project into workspace.
- *
- * @param path the path
- * @param projectName the project name
- */
- static void importProjectIntoWorkspace(String path, String projectName) {
-
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- projectName);
-
- try {
-
- IOverwriteQuery overwrite = new IOverwriteQuery() {
- public String queryOverwrite(String pathString) {
- return ALL;
- }
- };
-
- ImportProvider importProvider = new ImportProvider();
-
- // need to remove from imported project "svn" files
- List<String> unimportedFiles = new ArrayList<String>();
- unimportedFiles.add(".svn"); //$NON-NLS-1$
-
- importProvider.setUnimportedFiles(unimportedFiles);
-
- // create import operation
- ImportOperation importOp = new ImportOperation(project
- .getFullPath(), new File(path), importProvider, overwrite);
-
- // import files just to project folder ( without old structure )
- importOp.setCreateContainerStructure(false);
-
- importOp.setContext(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell());
-
- // run import
- importOp.run(null);
-
- } catch (InvocationTargetException ite) {
- VPETestPlugin.getDefault().logError(ite.getCause());
- } catch (InterruptedException ie) {
- VPETestPlugin.getDefault().logError(ie);
- }
- }
-
- /**
- * Gets the component path.
- *
- * @param componentPage the component page
- * @param projectName the project name
- *
- * @return the component path
- *
- * @throws CoreException the core exception
- */
- public static IResource getComponentPath(String componentPage,
- String projectName) throws CoreException {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- projectName);
- if (project != null) {
- return project.getFolder(COMPONENTS_PATH).findMember(componentPage);
-
- }
-
- return null;
- }
-
- /**
- * Gets the web content path.
- *
- * @param componentPage the component page
- * @param projectName the project name
- *
- * @return the web content path
- *
- * @throws CoreException the core exception
- */
- public static IResource getWebContentPath(String componentPage,
- String projectName) throws CoreException {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- projectName);
- if (project != null) {
- return project.getFolder(WEBCONTENT_PATH).findMember(componentPage);
- }
-
- return null;
- }
-
-
- /**
- * @param xmlScheme
- * @param xmlSchemesRoot
- * @return
- */
- public static File getXmlTestFile(String xmlTestPath, String xmlTestsRoot) {
- return new File(xmlTestsRoot + File.separator + xmlTestPath);
- }
-
- /**
- * Removes the project.
- *
- * @param projectName the project name
- *
- * @throws CoreException the core exception
- */
- static void removeProject(String projectName) throws CoreException {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- projectName);
- if (project != null) {
- project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
- new NullProgressMonitor());
- }
- }
-
- /**
- * Process UI input but do not return for the specified time interval.
- *
- * @param waitTimeMillis the number of milliseconds
- */
- public static void delay(long waitTimeMillis) {
- Display display = Display.getCurrent();
- if (display != null) {
- long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
- while (System.currentTimeMillis() < endTimeMillis) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- display.update();
- }
- // Otherwise, perform a simple sleep.
- else {
- try {
- Thread.sleep(waitTimeMillis);
- } catch (InterruptedException e) {
- // Ignored.
- }
- }
- }
-
- /**
- * Wait until all background tasks are complete.
- */
- public static void waitForJobs() {
- while (Job.getJobManager().currentJob() != null)
- delay(100);
- }
-
- /**
- * Wait for idle.
- */
- public static void waitForIdle() {
- long start = System.currentTimeMillis();
- while (!Job.getJobManager().isIdle()) {
- delay(500);
- if ( (System.currentTimeMillis()-start) > MAX_IDLE )
- throw new RuntimeException("A long running task detected"); //$NON-NLS-1$
- }
- }
-
- /**
- * find elements by name.
- *
- * @param node -
- * current node
- * @param name -
- * name element
- * @param elements -
- * list of found elements
- */
- static public void findElementsByName(nsIDOMNode node,
- List<nsIDOMNode> elements, String name) {
-
- // get children
- nsIDOMNodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- nsIDOMNode child = children.item(i);
-
- // if current child is required then add his to list
- if (name.equalsIgnoreCase((child.getNodeName()))) {
-
- elements.add(child);
-
- } else {
-
- findElementsByName(child, elements, name);
-
- }
- }
-
- }
-
- /**
- * find all elements by name.
- *
- * @param node -
- * current node
- * @param name -
- * name element
- * @param elements -
- * list of found elements
- */
- static public void findAllElementsByName(nsIDOMNode node,
- List<nsIDOMNode> elements, String name) {
-
- try {
- nsIDOMNodeList list = node.getChildNodes();
- if (node.getNodeName().equalsIgnoreCase(name)) {
- elements.add(node);
- }
- for (int i = 0; i < list.getLength(); i++) {
- findAllElementsByName(list.item(i), elements, name);
- }
- } catch (XPCOMException e) {
- // Ignore
- return;
- }
- }
-
- /**
- * Creates the import bean list.
- *
- * @param projectName the project name
- * @param resourcePath the resource path
- *
- * @return the list< import bean>
- */
- static public List<ImportBean> createImportBeanList(String projectName,
- String resourcePath) {
- List<ImportBean> projectToImport = new ArrayList<ImportBean>();
- projectToImport.add(createImportBean(projectName, resourcePath));
- return projectToImport;
- }
-
- /**
- * Creates the import bean.
- *
- * @param projectName the project name
- * @param resourcePath the resource path
- *
- * @return the import bean
- */
- static public ImportBean createImportBean(String projectName,
- String resourcePath) {
- ImportBean importBean = new ImportBean();
- importBean.setImportProjectName(projectName);
- importBean.setImportProjectPath(resourcePath);
- return importBean;
- }
-
- /**
- * Utility function which returns node mapping by source position(line and position in line).
- *
- * @param linePosition the line position
- * @param lineIndex the line index
- * @param itextViewer the itext viewer
- *
- * @return node for specified src position
- */
- @SuppressWarnings("restriction")
- public static Node getNodeMappingBySourcePosition(ITextViewer itextViewer, int lineIndex, int linePosition) {
- int offset = getLinePositionOffcet(itextViewer, lineIndex, linePosition);
- IndexedRegion treeNode = ContentAssistUtils.getNodeAt(itextViewer, offset);
- return (Node) treeNode;
- }
-
- /**
- * Utility function which is used to calculate offcet in document by line number and character position.
- *
- * @param linePosition the line position
- * @param textViewer the text viewer
- * @param lineIndex the line index
- *
- * @return offcet in document
- *
- * @throws IllegalArgumentException */
- public static final int getLinePositionOffcet(ITextViewer textViewer, int lineIndex, int linePosition) {
-
- int resultOffcet = 0;
-
- if(textViewer==null) {
-
- throw new IllegalArgumentException("Text viewer shouldn't be a null"); //$NON-NLS-1$
- }
- //lineIndex-1 becose calculating of line begibns in eclipse from one, but should be form zero
- resultOffcet=textViewer.getTextWidget().getOffsetAtLine(lineIndex-1);
- //here we get's tabs length
- //for more example you can see code org.eclipse.ui.texteditor.AbstractTextEditor@getCursorPosition() and class $PositionLabelValue
- int tabWidth = textViewer.getTextWidget().getTabs();
- int characterOffset=0;
- String currentString = textViewer.getTextWidget().getLine(lineIndex-1);
- int pos=1;
- for (int i= 0; (i < currentString.length())&&(pos<linePosition); i++) {
- if ('\t' == currentString.charAt(i)) {
-
- characterOffset += (tabWidth == 0 ? 0 : 1);
- pos+=tabWidth;
- }else{
- pos++;
- characterOffset++;
- }
- }
- resultOffcet+=characterOffset;
- if(textViewer.getTextWidget().getLineAtOffset(resultOffcet)!=(lineIndex-1)) {
-
- throw new IllegalArgumentException("Incorrect character position in line"); //$NON-NLS-1$
- }
- return resultOffcet;
- }
-
-
- /**
- * get xulrunner source page.
- *
- * @param part - JSPMultiPageEditor
- *
- * @return nsIDOMDocument
- */
- public static nsIDOMDocument getVpeVisualDocument(JSPMultiPageEditor part) {
-
- VpeEditorPart visualEditor = (VpeEditorPart) part.getVisualEditor();
-
- VpeController vpeController = visualEditor.getController();
-
- // get xulRunner editor
- XulRunnerEditor xulRunnerEditor = vpeController.getXulRunnerEditor();
-
- // get dom document
- nsIDOMDocument document = xulRunnerEditor.getDOMDocument();
-
- return document;
- }
-
- /**
- * Perform test for rich faces component.
- *
- * @param componentPage the component page
- *
- * @return the ns IDOM element
- *
- * @throws Throwable the throwable
- */
- public static nsIDOMElement performTestForRichFacesComponent(IFile componentPage) throws Throwable {
- nsIDOMElement rst = null;
- TestUtil.waitForJobs();
-
- // IFile file = (IFile)
- // TestUtil.getComponentPath(componentPage,getImportProjectName());
- IEditorInput input = new FileEditorInput(componentPage);
-
- TestUtil.waitForJobs();
- //
- JSPMultiPageEditor editor = (JSPMultiPageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
- input, EDITOR_ID, true);
-
- // get dom document
- nsIDOMDocument document = getVpeVisualDocument(editor);
- rst = document.getDocumentElement();
- // check that element is not null
- Assert.assertNotNull(rst);
- return rst;
- }
-
- /**
- * Fail.
- *
- * @param t the t
- */
- public static void fail(Throwable t){
- Assert.fail("Test case was fail "+t.getMessage()+":"+t);
- }
-}
Added: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -0,0 +1,409 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.test.util.ResourcesUtils;
+import org.jboss.tools.tests.ImportBean;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.VpeEditorPart;
+import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.xpcom.XPCOMException;
+import org.w3c.dom.Node;
+
+/**
+ * Class for importing project from jar file.
+ *
+ * @author sdzmitrovich
+ */
+public class TestUtil {
+
+ /** The Constant COMPONENTS_PATH. */
+ private static final String COMPONENTS_PATH = "WebContent/pages"; //$NON-NLS-1$
+
+ /** The Constant WEBCONTENT_PATH. */
+ private static final String WEBCONTENT_PATH = "WebContent"; //$NON-NLS-1$
+
+ /** Editor in which we open visual page. */
+ protected final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
+
+ /** The Constant MAX_IDLE. */
+ private static final long MAX_IDLE = 30*60*1000L;
+
+
+ /**
+ * @deprecated Use {@link ResourcesUtils#importProjectIntoWorkspace(ImportBean)} instead
+ */
+ static public void importProjectIntoWorkspace(ImportBean bean) {
+ ResourcesUtils.importProjectIntoWorkspace(bean);
+ }
+
+ /**
+ * Import project into workspace.
+ *
+ * @param path the path
+ * @param projectName the project name
+ * @deprecated Use {@link ResourcesUtils#importProjectIntoWorkspace(String,String)} instead
+ */
+ static public void importProjectIntoWorkspace(String path, String projectName) {
+ ResourcesUtils.importProjectIntoWorkspace(path, projectName);
+ }
+
+ /**
+ * Gets the component path.
+ *
+ * @param componentPage the component page
+ * @param projectName the project name
+ *
+ * @return the component path
+ *
+ * @throws CoreException the core exception
+ */
+ public static IResource getComponentPath(String componentPage,
+ String projectName) throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ if (project != null) {
+ return project.getFolder(COMPONENTS_PATH).findMember(componentPage);
+
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets the web content path.
+ *
+ * @param componentPage the component page
+ * @param projectName the project name
+ *
+ * @return the web content path
+ *
+ * @throws CoreException the core exception
+ */
+ public static IResource getWebContentPath(String componentPage,
+ String projectName) throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ if (project != null) {
+ return project.getFolder(WEBCONTENT_PATH).findMember(componentPage);
+ }
+
+ return null;
+ }
+
+
+ /**
+ * @param xmlScheme
+ * @param xmlSchemesRoot
+ * @return
+ */
+ public static File getXmlTestFile(String xmlTestPath, String xmlTestsRoot) {
+ return new File(xmlTestsRoot + File.separator + xmlTestPath);
+ }
+
+ /**
+ * Removes the project.
+ *
+ * @param projectName the project name
+ *
+ * @throws CoreException the core exception
+ */
+ static public void removeProject(String projectName) throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ if (project != null) {
+ project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
+ new NullProgressMonitor());
+ }
+ }
+
+ /**
+ * Process UI input but do not return for the specified time interval.
+ *
+ * @param waitTimeMillis the number of milliseconds
+ */
+ public static void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
+ }
+
+ /**
+ * Wait until all background tasks are complete.
+ */
+ public static void waitForJobs() {
+ while (Job.getJobManager().currentJob() != null)
+ delay(100);
+ }
+
+ /**
+ * Wait for idle.
+ */
+ public static void waitForIdle() {
+ long start = System.currentTimeMillis();
+ while (!Job.getJobManager().isIdle()) {
+ delay(500);
+ if ( (System.currentTimeMillis()-start) > MAX_IDLE )
+ throw new RuntimeException("A long running task detected"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * find elements by name.
+ *
+ * @param node -
+ * current node
+ * @param name -
+ * name element
+ * @param elements -
+ * list of found elements
+ */
+ static public void findElementsByName(nsIDOMNode node,
+ List<nsIDOMNode> elements, String name) {
+
+ // get children
+ nsIDOMNodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ nsIDOMNode child = children.item(i);
+
+ // if current child is required then add his to list
+ if (name.equalsIgnoreCase((child.getNodeName()))) {
+
+ elements.add(child);
+
+ } else {
+
+ findElementsByName(child, elements, name);
+
+ }
+ }
+
+ }
+
+ /**
+ * find all elements by name.
+ *
+ * @param node -
+ * current node
+ * @param name -
+ * name element
+ * @param elements -
+ * list of found elements
+ */
+ static public void findAllElementsByName(nsIDOMNode node,
+ List<nsIDOMNode> elements, String name) {
+
+ try {
+ nsIDOMNodeList list = node.getChildNodes();
+ if (node.getNodeName().equalsIgnoreCase(name)) {
+ elements.add(node);
+ }
+ for (int i = 0; i < list.getLength(); i++) {
+ findAllElementsByName(list.item(i), elements, name);
+ }
+ } catch (XPCOMException e) {
+ // Ignore
+ return;
+ }
+ }
+
+ /**
+ * Creates the import bean list.
+ *
+ * @param projectName the project name
+ * @param resourcePath the resource path
+ *
+ * @return the list< import bean>
+ */
+ static public List<ImportBean> createImportBeanList(String projectName,
+ String resourcePath) {
+ List<ImportBean> projectToImport = new ArrayList<ImportBean>();
+ projectToImport.add(createImportBean(projectName, resourcePath));
+ return projectToImport;
+ }
+
+ /**
+ * Creates the import bean.
+ *
+ * @param projectName the project name
+ * @param resourcePath the resource path
+ *
+ * @return the import bean
+ */
+ static public ImportBean createImportBean(String projectName,
+ String resourcePath) {
+ ImportBean importBean = new ImportBean();
+ importBean.setImportProjectName(projectName);
+ importBean.setImportProjectPath(resourcePath);
+ return importBean;
+ }
+
+ /**
+ * Utility function which returns node mapping by source position(line and position in line).
+ *
+ * @param linePosition the line position
+ * @param lineIndex the line index
+ * @param itextViewer the itext viewer
+ *
+ * @return node for specified src position
+ */
+ @SuppressWarnings("restriction")
+ public static Node getNodeMappingBySourcePosition(ITextViewer itextViewer, int lineIndex, int linePosition) {
+ int offset = getLinePositionOffcet(itextViewer, lineIndex, linePosition);
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt(itextViewer, offset);
+ return (Node) treeNode;
+ }
+
+ /**
+ * Utility function which is used to calculate offcet in document by line number and character position.
+ *
+ * @param linePosition the line position
+ * @param textViewer the text viewer
+ * @param lineIndex the line index
+ *
+ * @return offcet in document
+ *
+ * @throws IllegalArgumentException */
+ public static final int getLinePositionOffcet(ITextViewer textViewer, int lineIndex, int linePosition) {
+
+ int resultOffcet = 0;
+
+ if(textViewer==null) {
+
+ throw new IllegalArgumentException("Text viewer shouldn't be a null"); //$NON-NLS-1$
+ }
+ //lineIndex-1 becose calculating of line begibns in eclipse from one, but should be form zero
+ resultOffcet=textViewer.getTextWidget().getOffsetAtLine(lineIndex-1);
+ //here we get's tabs length
+ //for more example you can see code org.eclipse.ui.texteditor.AbstractTextEditor@getCursorPosition() and class $PositionLabelValue
+ int tabWidth = textViewer.getTextWidget().getTabs();
+ int characterOffset=0;
+ String currentString = textViewer.getTextWidget().getLine(lineIndex-1);
+ int pos=1;
+ for (int i= 0; (i < currentString.length())&&(pos<linePosition); i++) {
+ if ('\t' == currentString.charAt(i)) {
+
+ characterOffset += (tabWidth == 0 ? 0 : 1);
+ pos+=tabWidth;
+ }else{
+ pos++;
+ characterOffset++;
+ }
+ }
+ resultOffcet+=characterOffset;
+ if(textViewer.getTextWidget().getLineAtOffset(resultOffcet)!=(lineIndex-1)) {
+
+ throw new IllegalArgumentException("Incorrect character position in line"); //$NON-NLS-1$
+ }
+ return resultOffcet;
+ }
+
+
+ /**
+ * get xulrunner source page.
+ *
+ * @param part - JSPMultiPageEditor
+ *
+ * @return nsIDOMDocument
+ */
+ public static nsIDOMDocument getVpeVisualDocument(JSPMultiPageEditor part) {
+
+ VpeEditorPart visualEditor = (VpeEditorPart) part.getVisualEditor();
+
+ VpeController vpeController = visualEditor.getController();
+
+ // get xulRunner editor
+ XulRunnerEditor xulRunnerEditor = vpeController.getXulRunnerEditor();
+
+ // get dom document
+ nsIDOMDocument document = xulRunnerEditor.getDOMDocument();
+
+ return document;
+ }
+
+ /**
+ * Perform test for rich faces component.
+ *
+ * @param componentPage the component page
+ *
+ * @return the ns IDOM element
+ *
+ * @throws Throwable the throwable
+ */
+ public static nsIDOMElement performTestForRichFacesComponent(IFile componentPage) throws Throwable {
+ nsIDOMElement rst = null;
+ TestUtil.waitForJobs();
+
+ // IFile file = (IFile)
+ // TestUtil.getComponentPath(componentPage,getImportProjectName());
+ IEditorInput input = new FileEditorInput(componentPage);
+
+ TestUtil.waitForJobs();
+ //
+ JSPMultiPageEditor editor = (JSPMultiPageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
+ input, EDITOR_ID, true);
+
+ // get dom document
+ nsIDOMDocument document = getVpeVisualDocument(editor);
+ rst = document.getDocumentElement();
+ // check that element is not null
+ Assert.assertNotNull(rst);
+ return rst;
+ }
+
+ /**
+ * Fail.
+ *
+ * @param t the t
+ */
+ public static void fail(Throwable t){
+ Assert.fail("Test case was fail "+t.getMessage()+":"+t);
+ }
+}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -16,7 +16,6 @@
import junit.framework.TestCase;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
@@ -25,10 +24,8 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
import org.jboss.tools.common.model.util.ClassLoaderUtil;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTestSetup.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTestSetup.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTestSetup.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -13,12 +13,13 @@
import java.io.File;
import java.util.List;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.jboss.tools.vpe.ui.test.beans.ImportBean;
-
import junit.extensions.TestSetup;
import junit.framework.TestSuite;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.test.util.ResourcesUtils;
+import org.jboss.tools.tests.ImportBean;
+
/**
* @author Max Areshkau
*
@@ -46,7 +47,7 @@
super.setUp();
for (ImportBean importBean : getTestProjects()) {
if (ResourcesPlugin.getWorkspace().getRoot().findMember(importBean.getImportProjectName()) == null) {
- TestUtil.importProjectIntoWorkspace((importBean.getImportProjectPath()
+ ResourcesUtils.importProjectIntoWorkspace((importBean.getImportProjectPath()
+ File.separator+importBean.getImportProjectName()),importBean.getImportProjectName());
}
}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/beans/ImportBean.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/beans/ImportBean.java 2008-09-26 16:31:44 UTC (rev 10521)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/beans/ImportBean.java 2008-09-26 23:17:46 UTC (rev 10522)
@@ -1,52 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007 Red Hat, Inc.
-* Distributed under license by Red Hat, Inc. All rights reserved.
-* This program is made available under the terms of the
-* Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Red Hat, Inc. - initial API and implementation
-******************************************************************************/
-package org.jboss.tools.vpe.ui.test.beans;
-
-/**
- * @author Max Areshkau
- *
- * Contains information about projects which should be imported
- */
-public class ImportBean {
- /**
- * Contains import project Name
- */
- private String importProjectName;
- /**
- * Contains import project path
- */
- private String importProjectPath;
- /**
- * @return the importProjectName
- */
- public String getImportProjectName() {
- return importProjectName;
- }
- /**
- * @param importProjectName the importProjectName to set
- */
- public void setImportProjectName(String importProjectName) {
- this.importProjectName = importProjectName;
- }
- /**
- * @return the importProjectPath
- */
- public String getImportProjectPath() {
- return importProjectPath;
- }
- /**
- * @param importProjectPath the importProjectPath to set
- */
- public void setImportProjectPath(String importProjectPath) {
- this.importProjectPath = importProjectPath;
- }
-
-}
16 years, 3 months
JBoss Tools SVN: r10521 - documentation/trunk/movies/index/en.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-09-26 12:31:44 -0400 (Fri, 26 Sep 2008)
New Revision: 10521
Modified:
documentation/trunk/movies/index/en/master.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-426
movie group name is changed
Modified: documentation/trunk/movies/index/en/master.xml
===================================================================
--- documentation/trunk/movies/index/en/master.xml 2008-09-26 16:17:57 UTC (rev 10520)
+++ documentation/trunk/movies/index/en/master.xml 2008-09-26 16:31:44 UTC (rev 10521)
@@ -82,7 +82,7 @@
</itemizedlist>
<itemizedlist>
- <title>Server Manager Demos</title>
+ <title>Project Archives Demos</title>
<listitem>
<para>
<ulink url="demos/archiving/archiving.htm">Archiving</ulink>
16 years, 3 months
JBoss Tools SVN: r10520 - in trunk: vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-09-26 12:17:57 -0400 (Fri, 26 Sep 2008)
New Revision: 10520
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
Log:
=Junit erorrs fix
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java 2008-09-26 16:02:49 UTC (rev 10519)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java 2008-09-26 16:17:57 UTC (rev 10520)
@@ -12,7 +12,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContentAssistant;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-09-26 16:02:49 UTC (rev 10519)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-09-26 16:17:57 UTC (rev 10520)
@@ -524,7 +524,7 @@
}
// cause is to lock calls others events
- if (switcher
+ if (switcher!=null&&switcher
.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE))
try {
sourceSelectionChanged();
16 years, 3 months