JBoss Tools SVN: r15297 - in trunk/seam: plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-05-15 11:14:03 -0400 (Fri, 15 May 2009)
New Revision: 15297
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/components.xml
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4321 fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2009-05-15 15:07:03 UTC (rev 15296)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2009-05-15 15:14:03 UTC (rev 15297)
@@ -312,7 +312,7 @@
boolean unknownVariable = true;
boolean firstDuplicateVariableWasMarked = false;
for (ISeamContextVariable variable : variables) {
- if(variable instanceof ISeamFactory || variable instanceof ISeamComponent || variable instanceof IRole) {
+ if(variable instanceof ISeamFactory) {
if(variable!=factory && !markedDuplicateFactoryNames.contains(factoryName) &&
(factoryScope == variable.getScope() || factoryScope.getPriority()>variable.getScope().getPriority())) {
// Duplicate factory name. Mark it.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2009-05-15 15:07:03 UTC (rev 15296)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2009-05-15 15:14:03 UTC (rev 15297)
@@ -31,13 +31,13 @@
#Factories
UNKNOWN_FACTORY_NAME=Factory method "{0}" with a void return type must have an associated @Out/Databinder
+DUPLICATE_VARIABLE_NAME=Duplicate factory name: "{0}"
#Bijections
MULTIPLE_DATA_BINDER=@DataModelSelection and @DataModelSelectionIndex without name of the DataModel requires the only one @DataModel in the component
UNKNOWN_DATA_MODEL=Unknown @DataModel/@Out name: "{0}"
#Context variables
-DUPLICATE_VARIABLE_NAME=Duplicate variable name: "{0}"
UNKNOWN_VARIABLE_NAME=Unknown context variable name: "{0}"
#Seam Expression language
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2009-05-15 15:07:03 UTC (rev 15296)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2009-05-15 15:14:03 UTC (rev 15297)
@@ -124,6 +124,7 @@
//Section Factories
public static String SeamValidatorConfigurationBlock_section_factory;
+ public static String SeamValidatorConfigurationBlock_pb_duplicateVariableName_label;
public static String SeamValidatorConfigurationBlock_pb_unknownFactoryName_label;
//Section Bijections
@@ -133,7 +134,6 @@
//Section Context variables
public static String SeamValidatorConfigurationBlock_section_variable;
- public static String SeamValidatorConfigurationBlock_pb_duplicateVariableName_label;
public static String SeamValidatorConfigurationBlock_pb_unknownVariableName_label;
//Seam Expression language
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2009-05-15 15:07:03 UTC (rev 15296)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2009-05-15 15:14:03 UTC (rev 15297)
@@ -43,6 +43,7 @@
##Section Factories
SeamValidatorConfigurationBlock_section_factory=Factories
SeamValidatorConfigurationBlock_pb_unknownFactoryName_label=Unknown factory name:
+SeamValidatorConfigurationBlock_pb_duplicateVariableName_label=Duplicate factory name:
##Section Bijections
SeamValidatorConfigurationBlock_section_bijection=Bijections
@@ -51,7 +52,6 @@
##Section Context variables
SeamValidatorConfigurationBlock_section_variable=Context variables
-SeamValidatorConfigurationBlock_pb_duplicateVariableName_label=Duplicate variable name:
SeamValidatorConfigurationBlock_pb_unknownVariableName_label=Unknown variable name:
##Seam Expression language
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2009-05-15 15:07:03 UTC (rev 15296)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2009-05-15 15:14:03 UTC (rev 15297)
@@ -103,6 +103,7 @@
private static SectionDescription SECTION_FACTORY = new SectionDescription(
SeamPreferencesMessages.SeamValidatorConfigurationBlock_section_factory,
new String[][]{
+ {SeamPreferences.DUPLICATE_VARIABLE_NAME, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_duplicateVariableName_label},
{SeamPreferences.UNKNOWN_FACTORY_NAME, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_unknownFactoryName_label},
}
);
@@ -118,7 +119,6 @@
private static SectionDescription SECTION_VARIABLE = new SectionDescription(
SeamPreferencesMessages.SeamValidatorConfigurationBlock_section_variable,
new String[][]{
- {SeamPreferences.DUPLICATE_VARIABLE_NAME, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_duplicateVariableName_label},
{SeamPreferences.UNKNOWN_VARIABLE_NAME, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_unknownVariableName_label},
}
);
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/components.xml
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/components.xml 2009-05-15 15:07:03 UTC (rev 15296)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/components.xml 2009-05-15 15:14:03 UTC (rev 15297)
@@ -59,5 +59,6 @@
<security:identity authenticate-method="#{test.operate}"
security-rules="#{securityRules}"
remember-me="true"/>
-
+
+ <factory name="authenticator"/>
</components>
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2009-05-15 15:07:03 UTC (rev 15296)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2009-05-15 15:14:03 UTC (rev 15297)
@@ -636,15 +636,15 @@
String[] messages = getMarkersMessage(contextVariableTestFile);
- assertEquals("Not all problem markers 'Duplicate variable name' was found", 4, messages.length);
+ assertEquals("Not all problem markers 'Duplicate variable name' was found", 2, messages.length);
for(int i=0;i<4;i++)
assertEquals("Problem marker 'Duplicate variable name' not found", "Duplicate variable name: \"messageList\"", messages[i]);
int[] lineNumbers = getMarkersNumbersOfLine(contextVariableTestFile);
- for(int i=0;i<4;i++)
- assertTrue("Problem marker has wrong line number", (lineNumbers[i] == 16)||(lineNumbers[i] == 17)||(lineNumbers[i] == 36)||(lineNumbers[i] == 41));
+ for(int i=0;i<2;i++)
+ assertTrue("Problem marker has wrong line number", (lineNumbers[i] == 36)||(lineNumbers[i] == 41));
// Unknown variable name
System.out.println("Test - Unknown variable name");
15 years, 4 months
JBoss Tools SVN: r15296 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-05-15 11:07:03 -0400 (Fri, 15 May 2009)
New Revision: 15296
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3457
Raw code - without validation Next and Finish,
without wizard's descriptions...
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java 2009-05-15 15:07:03 UTC (rev 15296)
@@ -0,0 +1,133 @@
+package org.hibernate.eclipse.jdt.ui.wizards;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IParent;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.eclipse.jdt.internal.core.JarPackageFragmentRoot;
+import org.eclipse.jdt.ui.JavaElementLabelProvider;
+import org.eclipse.jdt.ui.StandardJavaElementContentProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+
+public class NewHibernateMappingElementsSelectionPage extends WizardPage {
+
+ // the current selection
+ private IStructuredSelection fCurrentSelection;
+
+ private TreeViewer fViewer;
+
+ private boolean fAllowMultiple = true;
+
+ private int fWidth = 50;
+
+ private int fHeight = 18;
+
+ public NewHibernateMappingElementsSelectionPage(IStructuredSelection selection) {
+ super("", "", null);
+ fCurrentSelection = selection;
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+ createTreeViewer(composite);
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(fWidth);
+ data.heightHint = convertHeightInCharsToPixels(fHeight);
+
+ Tree treeWidget = fViewer.getTree();
+ treeWidget.setLayoutData(data);
+ setControl(composite);
+ }
+
+ protected TreeViewer createTreeViewer(Composite composite) {
+ int style = SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
+ fViewer = new TreeViewer(new Tree(composite, style));
+ fViewer.setContentProvider(new StandardJavaElementContentProvider());
+ fViewer.setLabelProvider(new JavaElementLabelProvider());
+ fViewer.setFilters(getFilters());
+ fViewer.addSelectionChangedListener(getSelectionChangedListener());
+ fViewer.setInput(getInput());
+ fViewer.setSelection(fCurrentSelection, true);
+ return fViewer;
+ }
+
+ protected ViewerFilter[] getFilters(){
+ return new ViewerFilter[] { new ViewerFilter() {
+
+ public boolean hasCompilationUnits(IParent parent){
+ IJavaElement[] elements;
+ try {
+ elements = parent.getChildren();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i].getElementType() == IJavaElement.COMPILATION_UNIT){
+ return true;
+ } else if (elements[i] instanceof IParent
+ && !(elements[i] instanceof JarPackageFragmentRoot)){
+ if (hasCompilationUnits((IParent)elements[i])) {
+ return true;
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ return false;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+ if (element instanceof JarPackageFragmentRoot) {
+ return false;
+ } else if (element instanceof ICompilationUnit) {
+ return true;
+ } else if (element instanceof IParent) {
+ return hasCompilationUnits((IParent)element);
+ } else {
+ return false;
+ }
+ }
+
+ } };
+ }
+
+ protected Object getInput(){
+ return JavaCore.create( ResourcesPlugin.getWorkspace().getRoot() );
+ }
+
+ public IStructuredSelection getSelection(){
+ return fCurrentSelection;
+ }
+
+ protected ISelectionChangedListener getSelectionChangedListener() {
+ return new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ fCurrentSelection = (IStructuredSelection) event.getSelection();
+ updateStatus();
+ }
+ };
+ }
+
+ public void setAllowMultiple(boolean isAllowMultiple){
+ fAllowMultiple = isAllowMultiple;
+ }
+
+ protected void updateStatus() {
+ // TODO Auto-generated method stub
+ }
+}
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java 2009-05-15 15:05:25 UTC (rev 15295)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java 2009-05-15 15:07:03 UTC (rev 15296)
@@ -1,13 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.hibernate.eclipse.jdt.ui.wizards;
import java.util.ArrayList;
@@ -33,6 +33,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
@@ -46,19 +47,16 @@
*
*/
public class NewHibernateMappingFilePage extends WizardPage {
-
+
private TableViewer viewer;
-
- private Map<IJavaProject, Collection<EntityInfo>> project_infos;
/**
* @param pageName
*/
- protected NewHibernateMappingFilePage(Map<IJavaProject, Collection<EntityInfo>> project_infos) {
+ protected NewHibernateMappingFilePage() {
super("");
setTitle(HibernateConsoleMessages.NewHibernateMappingFilePage_hibernate_xml_mapping_file);
- setDescription(HibernateConsoleMessages.NewHibernateMappingFilePage_this_wizard_creates);
- this.project_infos = project_infos;
+ setDescription(HibernateConsoleMessages.NewHibernateMappingFilePage_this_wizard_creates);
}
public void createControl(Composite parent) {
@@ -69,100 +67,104 @@
sc.pack(false);
Composite container = new Composite(sc, SWT.NULL);
- sc.setContent(container);
+ sc.setContent(container);
- FillLayout layout = new FillLayout();
+ Layout layout = new FillLayout();
container.setLayout(layout);
-
+
Table table = new Table(container, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION );
table.setHeaderVisible(true);
table.setLinesVisible(true);
table.pack(false);
createTableColumns(table);
- viewer = createTableFilterViewer(table);
- viewer.setInput(project_infos);
-
+ viewer = createTableViewer(table);
+ viewer.setInput(null);
+
sc.setMinSize(container.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- setControl(sc);
+ setControl(container);
}
-
+
private void createTableColumns(Table table){
int coulmnIndex = 0;
TableColumn column = new TableColumn(table, SWT.CENTER, coulmnIndex++);
column.setText("!");
column.setWidth(20);
- column.setResizable(false);
-
- if (project_infos.keySet().size() > 1){
- column = new TableColumn(table, SWT.LEFT, coulmnIndex++);
- column.setText("Project name");
- column.setWidth(120);
- }
-
+ column.setResizable(false);
+
+ //if (project_infos.keySet().size() > 1){
column = new TableColumn(table, SWT.LEFT, coulmnIndex++);
+ column.setText("Project name");
+ column.setWidth(120);
+ //}
+
+ column = new TableColumn(table, SWT.LEFT, coulmnIndex++);
column.setText("Class name");
column.setWidth(150);
-
+
column = new TableColumn(table, SWT.LEFT, coulmnIndex++);
column.setText("File name");
column.setWidth(150);
}
-
- private TableViewer createTableFilterViewer(Table table) {
+
+ private TableViewer createTableViewer(Table table) {
TableViewer result = new TableViewer( table );
result.setUseHashlookup( true );
- if (project_infos.keySet().size() > 1){
- result.setColumnProperties( new String[] {"create", "project", //$NON-NLS-1$//$NON-NLS-2$
- "class", "file",} ); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
+ //if (project_infos.keySet().size() > 1){
+ result.setColumnProperties( new String[] {"create", "project", //$NON-NLS-1$//$NON-NLS-2$
+ "class", "file",} ); //$NON-NLS-1$ //$NON-NLS-2$
+ /*} else {
result.setColumnProperties( new String[] {"create", //$NON-NLS-1$
"class", "file",} ); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
+ }*/
CellEditor[] editors = new CellEditor[result.getColumnProperties().length];
editors[0] = new CheckboxCellEditor( result.getTable() );
editors[1] = new TextCellEditor( result.getTable() );
editors[2] = new TextCellEditor( result.getTable() );
- if (project_infos.keySet().size() > 1){
- editors[3] = new TextCellEditor( result.getTable() );
- }
+ //if (project_infos.keySet().size() > 1){
+ editors[3] = new TextCellEditor( result.getTable() );
+ //}
+
result.setCellEditors( editors );
result.setCellModifier( new TableCellModifier(result) );
result.setLabelProvider(new TableLableProvider(result));
result.setContentProvider( new TableContentProvider() );
return result;
}
-
+
+ public void setInput(Map<IJavaProject, Collection<EntityInfo>> project_infos){
+ viewer.setInput(project_infos);
+ }
+
private class TableLine {
-
+
public String projectName;
-
+
public String className;
-
+
public String fileName;
-
+
public Boolean isCreate = true;
-
+
public TableLine(String projectName, String className){
this(projectName, className, className + ".hbm.xml",true);
}
-
+
public TableLine(String projectName, String className, String fileName, boolean isCreate){
this.projectName = projectName;
this.className = className;
this.fileName = fileName;
this.isCreate = isCreate;
}
-
+
}
-
+
private class TableContentProvider implements IStructuredContentProvider {
- public Object[] getElements(Object inputElement) {
+ public Object[] getElements(Object inputElement) {
if (inputElement instanceof Map) {
- List<TableLine> result = new ArrayList<TableLine>();
+ List<TableLine> result = new ArrayList<TableLine>();
Map<IJavaProject, Collection<EntityInfo>> configs = (Map<IJavaProject, Collection<EntityInfo>>)inputElement;
for (Entry<IJavaProject, Collection<EntityInfo>> entry : configs.entrySet()) {
Iterator<EntityInfo> iter = entry.getValue().iterator();
@@ -170,35 +172,32 @@
EntityInfo ei = iter.next();
result.add(new TableLine(entry.getKey().getProject().getName(), ei.getName()));
}
- }
+ }
return result.toArray();
}
return new Object[0];
}
- public void dispose() { }
+ public void dispose() {}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // TODO Auto-generated method stub
-
- }
-
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { }
+
}
-
+
private class TableLableProvider extends LabelProvider implements ITableLabelProvider {
-
+
private final TableViewer tv;
public TableLableProvider(TableViewer tv) {
this.tv = tv;
}
-
+
public Image getColumnImage(Object element, int columnIndex) {
String property = (String) tv.getColumnProperties()[columnIndex];
if("create".equals(property)) {
TableLine tl = (TableLine) element;
String key = tl.isCreate ? null : ImageConstants.CLOSE ; // TODO: find a better image
- return EclipseImages.getImage(key);
+ return EclipseImages.getImage(key);
}
return null;
}
@@ -206,19 +205,21 @@
public String getColumnText(Object element, int columnIndex) {
String property = (String) tv.getColumnProperties()[columnIndex];
TableLine tl = (TableLine) element;
-
+
if ("class".equals(property)){
return tl.className;
} else if ("project".equals(property)){
return tl.projectName;
} else if ("file".equals(property)){
return tl.fileName;
- } else return "";
- }
+ } else {
+ return "";
+ }
+ }
}
-
+
private class TableCellModifier implements ICellModifier {
-
+
private final TableViewer tv;
public TableCellModifier(TableViewer tv) {
@@ -253,8 +254,8 @@
} else if ("create".equals(property)){
tl.isCreate = (Boolean)value;
}
-
+
tv.update(new Object[] { tl }, new String[] { property });
- }
+ }
}
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2009-05-15 15:05:25 UTC (rev 15295)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2009-05-15 15:07:03 UTC (rev 15296)
@@ -1,16 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.hibernate.eclipse.jdt.ui.wizards;
-import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -19,35 +19,32 @@
import java.util.Set;
import java.util.Map.Entry;
-import org.eclipse.core.internal.filebuffers.SynchronizableDocument;
import org.eclipse.core.internal.resources.File;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.internal.core.JavaElement;
import org.eclipse.jdt.internal.core.JavaElementInfo;
import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jdt.internal.core.PackageFragment;
import org.eclipse.jdt.internal.core.PackageFragmentRoot;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.dialogs.IPageChangingListener;
+import org.eclipse.jface.dialogs.PageChangingEvent;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ImageConstants;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.EclipseImages;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
@@ -60,32 +57,81 @@
* @author Dmitry Geraskov
*
*/
-public class NewHibernateMappingFileWizard extends Wizard implements INewWizard {
-
+public class NewHibernateMappingFileWizard extends Wizard implements INewWizard, IPageChangingListener{
+
/**
* Selected compilation units for startup processing,
* result of processing selection
*/
private Set<ICompilationUnit> selectionCU = new HashSet<ICompilationUnit>();
-
+
private Map<IJavaProject, Collection<EntityInfo>> project_infos = new HashMap<IJavaProject, Collection<EntityInfo>>();
-
+ private IStructuredSelection selection;
+
+ private NewHibernateMappingFilePage page2 = null;
+
+ private NewHibernateMappingElementsSelectionPage page1 = null;
+
public NewHibernateMappingFileWizard(){
setDefaultPageImageDescriptor(EclipseImages.getImageDescriptor(ImageConstants.NEW_WIZARD) );
+ setNeedsProgressMonitor(true);
}
-
+
@Override
public void addPages() {
super.addPages();
- addPage(new NewHibernateMappingFilePage(project_infos));
+ page1 = new NewHibernateMappingElementsSelectionPage(selection);
+ page1.setTitle( HibernateConsoleMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file );
+ page1.setDescription( HibernateConsoleMessages.NewHibernateMappingFileWizard_create_new_xml_mapping_file );
+ addPage(page1);
+ page2 = new NewHibernateMappingFilePage();
+ addPage(page2);
+ if (getContainer() instanceof WizardDialog) {
+ ((WizardDialog) getContainer()).addPageChangingListener(this);
+ } else {
+ throw new IllegalArgumentException("Must use WizardDialog implementation as WizardContainer");
+ }
}
-
+
+ public void handlePageChanging(PageChangingEvent event) {
+ if (event.getTargetPage() == page2){
+ selection = page1.getSelection();
+ try {
+ getContainer().run(false, false, new IRunnableWithProgress(){
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask("Find dependent compilation units", selection.size() + 1);
+ Iterator it = selection.iterator();
+ int done = 1;
+ while (it.hasNext()) {
+ Object obj = it.next();
+ processJavaElements(obj);
+ monitor.worked(done++);
+ Thread.currentThread();
+ Thread.sleep(1000);
+ }
+ initEntitiesInfo();
+ monitor.worked(1);
+ monitor.done();
+ }
+ });
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ page2.setInput(project_infos);
+ }
+ }
+
public void init(IWorkbench workbench, IStructuredSelection selection) {
- updateSelectedItems(selection);
- initEntitiesInfo();
+ this.selection = selection;
}
-
+
@Override
public boolean performFinish() {
Map<IJavaProject, Configuration> configs = createConfigurations();
@@ -95,13 +141,13 @@
IResource container;
try {
- container = entry.getKey().getPackageFragmentRoots().length > 0
- ? entry.getKey().getPackageFragmentRoots()[0].getResource()
- : entry.getKey().getResource();
-
- HibernateMappingExporter hce = new HibernateMappingExporter(config,
+ container = entry.getKey().getPackageFragmentRoots().length > 0
+ ? entry.getKey().getPackageFragmentRoots()[0].getResource()
+ : entry.getKey().getResource();
+
+ HibernateMappingExporter hce = new HibernateMappingExporter(config,
container.getLocation().toFile());
-
+
hce.setGlobalSettings(hmgs);
//hce.setForEach("entity");
//hce.setFilePattern(file.getName());
@@ -110,7 +156,7 @@
} catch (Exception e){
e.getCause().printStackTrace();
}
- container.refreshLocal(IResource.DEPTH_INFINITE, null);
+ container.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (JavaModelException e1) {
HibernateConsolePlugin.getDefault().log(e1);
} catch (CoreException e) {
@@ -121,8 +167,10 @@
}
protected void initEntitiesInfo(){
- if (selectionCU.size() == 0) return;
- AllEntitiesInfoCollector collector = new AllEntitiesInfoCollector();
+ if (selectionCU.size() == 0) {
+ return;
+ }
+ AllEntitiesInfoCollector collector = new AllEntitiesInfoCollector();
Iterator<ICompilationUnit> it = selectionCU.iterator();
Map<IJavaProject, Set<ICompilationUnit>> mapJP_CUSet =
@@ -138,10 +186,10 @@
set.add(cu);
}
Iterator<Map.Entry<IJavaProject, Set<ICompilationUnit>>>
- mapIt = mapJP_CUSet.entrySet().iterator();
+ mapIt = mapJP_CUSet.entrySet().iterator();
while (mapIt.hasNext()) {
Map.Entry<IJavaProject, Set<ICompilationUnit>>
- entry = mapIt.next();
+ entry = mapIt.next();
IJavaProject javaProject = entry.getKey();
Iterator<ICompilationUnit> setIt = entry.getValue().iterator();
collector.initCollector(javaProject);
@@ -155,78 +203,7 @@
}
}
-
- private Map<IJavaProject, Configuration> createConfigurations() {
- ConfigurationActor actor = new ConfigurationActor(selectionCU);
- Map<IJavaProject, Configuration> configs = actor.createConfigurations();
- return configs;
- }
- protected void updateSelectedItems(ISelection sel) {
- if (sel instanceof TextSelection) {
- String fullyQualifiedName = ""; //$NON-NLS-1$
- IDocument fDocument = null;
- SynchronizableDocument sDocument = null;
- org.eclipse.jdt.core.dom.CompilationUnit resultCU = null;
- Class clazz = sel.getClass();
- Field fd = null;
- try {
- fd = clazz.getDeclaredField("fDocument"); //$NON-NLS-1$
- } catch (NoSuchFieldException e) {
- // just ignore it!
- }
- if (fd != null) {
- try {
- fd.setAccessible(true);
- fDocument = (IDocument)fd.get(sel);
- if (fDocument instanceof SynchronizableDocument) {
- sDocument = (SynchronizableDocument)fDocument;
- }
- if (sDocument != null) {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setSource(sDocument.get().toCharArray());
- parser.setResolveBindings(false);
- resultCU = (org.eclipse.jdt.core.dom.CompilationUnit) parser.createAST(null);
- }
- if (resultCU != null && resultCU.types().size() > 0 ) {
- if (resultCU.getPackage() != null) {
- fullyQualifiedName = resultCU.getPackage().getName().getFullyQualifiedName() + "."; //$NON-NLS-1$
- }
- else {
- fullyQualifiedName = ""; //$NON-NLS-1$
- }
- Object tmp = resultCU.types().get(0);
- if (tmp instanceof AbstractTypeDeclaration) {
- fullyQualifiedName += ((AbstractTypeDeclaration)tmp).getName();
- }
- if (!(tmp instanceof TypeDeclaration)) {
- // ignore EnumDeclaration & AnnotationTypeDeclaration
- fullyQualifiedName = ""; //$NON-NLS-1$
- }
- }
- } catch (IllegalArgumentException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("IllegalArgumentException: ", e); //$NON-NLS-1$
- } catch (IllegalAccessException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("IllegalAccessException: ", e); //$NON-NLS-1$
- } catch (SecurityException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("SecurityException: ", e); //$NON-NLS-1$
- }
- }
- if (fullyQualifiedName.length() > 0) {
- ICompilationUnit cu = Utils.findCompilationUnit(fullyQualifiedName);
- selectionCU.add(cu);
- }
- }
- else if (sel instanceof TreeSelection) {
- TreeSelection treeSelection = (TreeSelection)sel;
- Iterator it = treeSelection.iterator();
- while (it.hasNext()) {
- Object obj = it.next();
- processJavaElements(obj);
- }
- }
- }
-
protected void processJavaElements(Object obj) {
if (obj instanceof ICompilationUnit) {
ICompilationUnit cu = (ICompilationUnit)obj;
@@ -239,8 +216,8 @@
ICompilationUnit[] cus = Utils.findCompilationUnits(javaProject,
file.getFullPath());
if (cus != null) {
- for (int i = 0; i < cus.length; i++) {
- selectionCU.add(cus[i]);
+ for (ICompilationUnit cu : cus) {
+ selectionCU.add(cu);
}
}
}
@@ -255,8 +232,8 @@
//HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
}
if (pfr != null) {
- for (int i = 0; i < pfr.length; i++) {
- processJavaElements(pfr[i]);
+ for (IPackageFragmentRoot element : pfr) {
+ processJavaElements(element);
}
}
}
@@ -270,13 +247,12 @@
//HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
}
if (cus != null) {
- for (int i = 0; i < cus.length; i++) {
- selectionCU.add(cus[i]);
+ for (ICompilationUnit cu : cus) {
+ selectionCU.add(cu);
}
}
}
else if (obj instanceof PackageFragmentRoot) {
- PackageFragmentRoot packageFragmentRoot = (PackageFragmentRoot)obj;
JavaElement javaElement = (JavaElement)obj;
JavaElementInfo javaElementInfo = null;
try {
@@ -287,8 +263,8 @@
}
if (javaElementInfo != null) {
IJavaElement[] je = javaElementInfo.getChildren();
- for (int i = 0; i < je.length; i++) {
- processJavaElements(je[i]);
+ for (IJavaElement element : je) {
+ processJavaElements(element);
}
}
}
@@ -299,4 +275,11 @@
}
}
+
+ protected Map<IJavaProject, Configuration> createConfigurations() {
+ ConfigurationActor actor = new ConfigurationActor(selectionCU);
+ Map<IJavaProject, Configuration> configs = actor.createConfigurations();
+ return configs;
+ }
+
}
15 years, 4 months
JBoss Tools SVN: r15295 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb: internal and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-05-15 11:05:25 -0400 (Fri, 15 May 2009)
New Revision: 15295
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbProjectFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ClassPathMonitor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbProjectFactory.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbProjectFactory.java 2009-05-15 14:41:11 UTC (rev 15294)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbProjectFactory.java 2009-05-15 15:05:25 UTC (rev 15295)
@@ -17,7 +17,7 @@
* @param resolve if true and results of last build have not been resolved they are loaded.
* @return
*/
- public static IKbProject getSeamProject(IProject project, boolean resolve) {
+ public static IKbProject getKbProject(IProject project, boolean resolve) {
if(project == null || !project.exists() || !project.isOpen()) return null;
try {
if(!project.hasNature(IKbProject.NATURE_ID)) return null;
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java 2009-05-15 14:41:11 UTC (rev 15294)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java 2009-05-15 15:05:25 UTC (rev 15295)
@@ -10,13 +10,24 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.internal;
+import java.io.IOException;
import java.util.Map;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.el.core.resolver.TypeInfoCollector;
+import org.jboss.tools.jst.web.WebModelPlugin;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.internal.scanner.IFileScanner;
+import org.jboss.tools.jst.web.kb.internal.scanner.LibraryScanner;
+import org.jboss.tools.jst.web.kb.internal.scanner.XMLScanner;
/**
*
@@ -26,10 +37,131 @@
public class KbBuilder extends IncrementalProjectBuilder {
public static String BUILDER_ID = WebKbPlugin.PLUGIN_ID + ".kbbuilder"; //$NON-NLS-1$
+ KbResourceVisitor resourceVisitor = null;
+
+ KbProject getKbProject() {
+ IProject p = getProject();
+ if(p == null) return null;
+ return (KbProject)KbProjectFactory.getKbProject(p, false);
+ }
+
+ KbResourceVisitor getResourceVisitor() {
+ if(resourceVisitor == null) {
+ KbProject p = getKbProject();
+ resourceVisitor = new KbResourceVisitor(p);
+ }
+ return resourceVisitor;
+ }
+
+ class SampleDeltaVisitor implements IResourceDeltaVisitor {
+ /*
+ * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
+ */
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ IResource resource = delta.getResource();
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED:
+ return getResourceVisitor().getVisitor().visit(resource);
+ case IResourceDelta.REMOVED:
+ KbProject p = getKbProject();
+ if(p != null) p.pathRemoved(resource.getFullPath());
+ break;
+ case IResourceDelta.CHANGED:
+ return getResourceVisitor().getVisitor().visit(resource);
+ }
+ //return true to continue visiting children.
+ return true;
+ }
+ }
+
+ /**
+ * @see org.eclipse.core.resource.InternalProjectBuilder#build(int,
+ * java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
+ */
protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
throws CoreException {
- // TODO Auto-generated method stub
+ KbProject sp = getKbProject();
+ if(sp == null) {
+ return null;
+ }
+
+ long begin = System.currentTimeMillis();
+
+ sp.postponeFiring();
+
+ try {
+
+ sp.resolveStorage(kind != FULL_BUILD);
+
+ if(sp.getClassPath().update()) {
+ sp.getClassPath().process();
+ } else if(sp.getClassPath().hasToUpdateProjectDependencies()) {
+ sp.getClassPath().validateProjectDependencies();
+ }
+
+ TypeInfoCollector.cleanCache();
+
+ if (kind == FULL_BUILD) {
+ fullBuild(monitor);
+ } else {
+ IResourceDelta delta = getDelta(getProject());
+ if (delta == null) {
+ fullBuild(monitor);
+ } else {
+ incrementalBuild(delta, monitor);
+ }
+ }
+ long end = System.currentTimeMillis();
+ sp.fullBuildTime += end - begin;
+ try {
+ sp.store();
+ } catch (IOException e) {
+ WebModelPlugin.getPluginLog().logError(e);
+ }
+
+// sp.postBuild();
+
+ } finally {
+ sp.fireChanges();
+ }
+
return null;
}
+ protected void fullBuild(final IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ getProject().accept(getResourceVisitor().getVisitor());
+ } catch (CoreException e) {
+ WebModelPlugin.getPluginLog().logError(e);
+ }
+ }
+
+ protected void incrementalBuild(IResourceDelta delta,
+ IProgressMonitor monitor) throws CoreException {
+ // the visitor does the work.
+ delta.accept(new SampleDeltaVisitor());
+ }
+
+ /**
+ * Access to xml scanner for test.
+ * @return
+ */
+ public static IFileScanner getXMLScanner() {
+ return new XMLScanner();
+ }
+
+ /**
+ * Access to library scanner for test.
+ * @return
+ */
+ public static IFileScanner getLibraryScanner() {
+ return new LibraryScanner();
+ }
+
+ protected void clean(IProgressMonitor monitor) throws CoreException {
+ KbProject sp = getKbProject();
+ if(sp != null) sp.clean();
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-15 14:41:11 UTC (rev 15294)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-15 15:05:25 UTC (rev 15295)
@@ -10,23 +10,35 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.internal;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.jst.web.WebModelPlugin;
import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
import org.jboss.tools.jst.web.kb.internal.scanner.ClassPathMonitor;
import org.jboss.tools.jst.web.kb.internal.scanner.LoadedDeclarations;
import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+import org.w3c.dom.Element;
/**
*
@@ -166,12 +178,239 @@
public void load() {
if(isStorageResolved) return;
isStorageResolved = true;
+
+ postponeFiring();
+
+ try {
+
+ boolean b = getClassPath().update();
+ if(b) {
+ getClassPath().validateProjectDependencies();
+ }
+ File file = getStorageFile();
+ Element root = null;
+ if(file != null && file.isFile()) {
+ root = XMLUtilities.getElement(file, null);
+ if(root != null) {
+ loadProjectDependencies(root);
+ if(XMLUtilities.getUniqueChild(root, "paths") != null) {
+ loadSourcePaths2(root);
+ }
+ }
+ }
+
+ if(b) {
+ getClassPath().process();
+ }
+
+ } finally {
+ fireChanges();
+ }
+
+ }
+
+ public void clean() {
+ File file = getStorageFile();
+ if(file != null && file.isFile()) {
+ file.delete();
+ }
+ classPath.clean();
+ postponeFiring();
+ IPath[] ps = sourcePaths2.keySet().toArray(new IPath[0]);
+ for (int i = 0; i < ps.length; i++) {
+ pathRemoved(ps[i]);
+ }
+ fireChanges();
+ }
- //TODO
+ public long fullBuildTime;
+ public List<Long> statistics;
+
+
+ /**
+ * Method testing how long it takes to load Seam model
+ * serialized previously.
+ * This approach makes sure, that all other services
+ * (JDT, XModel, etc) are already loaded at first start of
+ * Seam model, so that now it is more or less pure time
+ * to be computed.
+ *
+ * @return
+ */
+ public long reload() {
+ statistics = new ArrayList<Long>();
+ classPath = new ClassPathMonitor(this);
+ sourcePaths.clear();
+ sourcePaths2.clear();
+ isStorageResolved = false;
+ dependsOn.clear();
+ usedBy.clear();
+ libraries.clear();
+
+ long begin = System.currentTimeMillis();
+
+ classPath.init();
+ resolve();
+
+ long end = System.currentTimeMillis();
+ return end - begin;
}
/**
+ * Stores results of last build, so that on exit/enter Eclipse
+ * load them without rebuilding project
+ * @throws IOException
+ */
+ public void store() throws IOException {
+ File file = getStorageFile();
+ file.getParentFile().mkdirs();
+
+ Element root = XMLUtilities.createDocumentElement("seam-project"); //$NON-NLS-1$
+ storeProjectDependencies(root);
+
+// storeSourcePaths(root);
+ storeSourcePaths2(root);
+
+ XMLUtilities.serialize(root, file.getAbsolutePath());
+ }
+
+ /*
*
+ */
+ private File getStorageFile() {
+ IPath path = WebKbPlugin.getDefault().getStateLocation();
+ File file = new File(path.toFile(), "projects/" + project.getName()); //$NON-NLS-1$
+ return file;
+ }
+
+ public void clearStorage() {
+ File f = getStorageFile();
+ if(f != null && f.isFile()) f.delete();
+ }
+
+ /*
+ *
+ */
+ private void loadProjectDependencies(Element root) {
+ Element dependsOnElement = XMLUtilities.getUniqueChild(root, "depends-on-projects"); //$NON-NLS-1$
+ if(dependsOnElement != null) {
+ Element[] paths = XMLUtilities.getChildren(dependsOnElement, "project"); //$NON-NLS-1$
+ for (int i = 0; i < paths.length; i++) {
+ String p = paths[i].getAttribute("name"); //$NON-NLS-1$
+ if(p == null || p.trim().length() == 0) continue;
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(p);
+ if(project == null || !project.isAccessible()) continue;
+ KbProject sp = (KbProject)KbProjectFactory.getKbProject(project, false);
+ if(sp != null) {
+ dependsOn.add(sp);
+ sp.addDependentSeamProject(this);
+ }
+ }
+ }
+
+ Element usedElement = XMLUtilities.getUniqueChild(root, "used-by-projects"); //$NON-NLS-1$
+ if(usedElement != null) {
+ Element[] paths = XMLUtilities.getChildren(usedElement, "project"); //$NON-NLS-1$
+ for (int i = 0; i < paths.length; i++) {
+ String p = paths[i].getAttribute("name"); //$NON-NLS-1$
+ if(p == null || p.trim().length() == 0) continue;
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(p);
+ if(project == null || !project.isAccessible()) continue;
+ KbProject sp = (KbProject)KbProjectFactory.getKbProject(project, false);
+ if(sp != null) usedBy.add(sp);
+ }
+ }
+
+ }
+
+ private void loadSourcePaths2(Element root) {
+ Properties context = new Properties();
+ context.put("seamProject", this);
+ Element sourcePathsElement = XMLUtilities.getUniqueChild(root, "paths"); //$NON-NLS-1$
+ if(sourcePathsElement == null) return;
+ Element[] paths = XMLUtilities.getChildren(sourcePathsElement, "path"); //$NON-NLS-1$
+ if(paths != null) for (int i = 0; i < paths.length; i++) {
+ String p = paths[i].getAttribute("value"); //$NON-NLS-1$
+ if(p == null || p.trim().length() == 0) continue;
+ IPath path = new Path(p.trim());
+ if(sourcePaths2.containsKey(path)) continue;
+
+ if(!getClassPath().hasPath(path)) {
+ IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if(f == null || !f.exists() || !f.isSynchronized(IResource.DEPTH_ZERO)) continue;
+ }
+
+ //TODO
+
+ long t1 = System.currentTimeMillis();
+ LoadedDeclarations ds = new LoadedDeclarations();
+
+ Element libraries = XMLUtilities.getUniqueChild(paths[i], "libraries");
+ if(libraries != null) {
+
+ //TODO
+
+ }
+
+ getClassPath().pathLoaded(path);
+
+ registerComponents(ds, path);
+ long t2 = System.currentTimeMillis();
+ if(statistics != null) {
+ statistics.add(new Long(t2 - t1));
+ if(t2 - t1 > 30) {
+ System.out.println("--->" + statistics.size() + " " + (t2 - t1));
+ System.out.println("stop");
+ }
+ }
+ }
+ }
+
+ private void storeSourcePaths2(Element root) {
+ Properties context = new Properties();
+ Element sourcePathsElement = XMLUtilities.createElement(root, "paths"); //$NON-NLS-1$
+ for (IPath path : sourcePaths2.keySet()) {
+ IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if(f != null && f.exists() && f.getProject() != project) {
+ continue;
+ }
+ //TODO
+// context.put(SeamXMLConstants.ATTR_PATH, path);
+ LoadedDeclarations ds = sourcePaths2.get(path);
+ Element pathElement = XMLUtilities.createElement(sourcePathsElement, "path"); //$NON-NLS-1$
+ pathElement.setAttribute("value", path.toString()); //$NON-NLS-1$
+
+ List<ITagLibrary> fs = ds.getLibraries();
+ if(fs != null && !fs.isEmpty()) {
+ Element cse = XMLUtilities.createElement(pathElement, "factories"); //$NON-NLS-1$
+ for (ITagLibrary d: fs) {
+ //TODO
+// SeamObject o = (SeamObject)d;
+// o.toXML(cse, context);
+ }
+ }
+ }
+ }
+ /*
+ *
+ */
+ private void storeProjectDependencies(Element root) {
+ Element dependsOnElement = XMLUtilities.createElement(root, "depends-on-projects"); //$NON-NLS-1$
+ for (IKbProject p : dependsOn) {
+ if(!p.getProject().isAccessible()) continue;
+ Element pathElement = XMLUtilities.createElement(dependsOnElement, "project"); //$NON-NLS-1$
+ pathElement.setAttribute("name", p.getProject().getName()); //$NON-NLS-1$
+ }
+ Element usedElement = XMLUtilities.createElement(root, "used-by-projects"); //$NON-NLS-1$
+ for (IKbProject p : usedBy) {
+ if(!p.getProject().isAccessible()) continue;
+ Element pathElement = XMLUtilities.createElement(usedElement, "project"); //$NON-NLS-1$
+ pathElement.setAttribute("name", p.getProject().getName()); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
* @return
* @throws CloneNotSupportedException
*/
@@ -264,7 +503,14 @@
//TODO
}
+ public void postponeFiring() {
+ //TODO
+ }
+ public void fireChanges() {
+ //TODO
+ }
+
class LibraryStorage {
private Set<ITagLibrary> allFactories = new HashSet<ITagLibrary>();
private ITagLibrary[] allFactoriesArray = null;
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java 2009-05-15 15:05:25 UTC (rev 15295)
@@ -0,0 +1,149 @@
+package org.jboss.tools.jst.web.kb.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.internal.scanner.IFileScanner;
+import org.jboss.tools.jst.web.kb.internal.scanner.LoadedDeclarations;
+import org.jboss.tools.jst.web.kb.internal.scanner.ScannerException;
+import org.jboss.tools.jst.web.kb.internal.scanner.XMLScanner;
+import org.jboss.tools.jst.web.model.helpers.InnerModelHelper;
+
+public class KbResourceVisitor implements IResourceVisitor {
+ static IFileScanner[] FILE_SCANNERS = {
+ new XMLScanner(),
+ };
+
+ KbProject p;
+
+ IPath[] outs = new IPath[0];
+ IPath[] srcs = new IPath[0];
+ IPath webinf = null;
+
+ public KbResourceVisitor(KbProject p) {
+ this.p = p;
+
+ if(p.getProject() != null && p.getProject().isOpen()) {
+ getJavaSourceRoots(p.getProject());
+
+ XModel model = InnerModelHelper.createXModel(p.getProject());
+ if(model != null) {
+ XModelObject wio = FileSystemsHelper.getWebInf(model);
+ if(wio != null) {
+ IResource wir = (IResource)wio.getAdapter(IResource.class);
+ if(wir != null) {
+ webinf = wir.getFullPath();
+ }
+ }
+ }
+ }
+ }
+
+ public IResourceVisitor getVisitor() {
+ return this;
+ }
+
+ public boolean visit(IResource resource) {
+ if(resource instanceof IFile) {
+ IFile f = (IFile)resource;
+ for (int i = 0; i < outs.length; i++) {
+ if(outs[i].isPrefixOf(resource.getFullPath())) {
+ return false;
+ }
+ }
+ for (int i = 0; i < FILE_SCANNERS.length; i++) {
+ IFileScanner scanner = FILE_SCANNERS[i];
+ if(scanner.isRelevant(f)) {
+ long t = System.currentTimeMillis();
+ if(!scanner.isLikelyComponentSource(f)) {
+ p.pathRemoved(f.getFullPath());
+ return false;
+ }
+ LoadedDeclarations c = null;
+ try {
+ c = scanner.parse(f, p);
+ } catch (ScannerException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ if(c != null) componentsLoaded(c, f);
+ long dt = System.currentTimeMillis() - t;
+// timeUsed += dt;
+// System.out.println("Time=" + timeUsed);
+ }
+ }
+ }
+ if(resource instanceof IFolder) {
+ IPath path = resource.getFullPath();
+ for (int i = 0; i < outs.length; i++) {
+ if(outs[i].isPrefixOf(path)) {
+ return false;
+ }
+ }
+ for (int i = 0; i < srcs.length; i++) {
+ if(srcs[i].isPrefixOf(path) || path.isPrefixOf(srcs[i])) {
+ return true;
+ }
+ }
+ if(webinf != null) {
+ if(webinf.isPrefixOf(path) || path.isPrefixOf(webinf)) {
+ return true;
+ }
+ }
+ if(resource == resource.getProject()) {
+ return true;
+ }
+ return false;
+ }
+ //return true to continue visiting children.
+ return true;
+ }
+
+ void componentsLoaded(LoadedDeclarations c, IFile resource) {
+ if(c == null || c.getLibraries().size() == 0) return;
+ p.registerComponents(c, resource.getFullPath());
+ }
+
+ void getJavaSourceRoots(IProject project) {
+ IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
+ if(javaProject == null) return;
+ List<IPath> ps = new ArrayList<IPath>();
+ List<IPath> os = new ArrayList<IPath>();
+ try {
+ IPath output = javaProject.getOutputLocation();
+ if(output != null) os.add(output);
+ IClasspathEntry[] es = javaProject.getResolvedClasspath(true);
+ for (int i = 0; i < es.length; i++) {
+ if(es[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ IResource findMember = ModelPlugin.getWorkspace().getRoot().findMember(es[i].getPath());
+ if(findMember != null && findMember.exists()) {
+ ps.add(findMember.getFullPath());
+ }
+ IPath out = es[i].getOutputLocation();
+ if(out != null && !os.contains(out)) {
+ os.add(out);
+ }
+ }
+ }
+ srcs = ps.toArray(new IPath[0]);
+ outs = os.toArray(new IPath[0]);
+ } catch(CoreException ce) {
+ ModelPlugin.getPluginLog().logError("Error while locating java source roots for " + project, ce);
+ }
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ClassPathMonitor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ClassPathMonitor.java 2009-05-15 14:41:11 UTC (rev 15294)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ClassPathMonitor.java 2009-05-15 15:05:25 UTC (rev 15295)
@@ -261,7 +261,7 @@
if(es[i].getEntryKind() == IClasspathEntry.CPE_PROJECT) {
IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(es[i].getPath().lastSegment());
if(p == null || !p.isAccessible()) continue;
- IKbProject sp = KbProjectFactory.getSeamProject(p, false);
+ IKbProject sp = KbProjectFactory.getKbProject(p, false);
if(sp != null) list.add((KbProject)sp);
}
}
15 years, 4 months
JBoss Tools SVN: r15294 - trunk/jsf/plugins/org.jboss.tools.jsf/META-INF.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-05-15 10:41:11 -0400 (Fri, 15 May 2009)
New Revision: 15294
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2009-05-15 14:34:43 UTC (rev 15293)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2009-05-15 14:41:11 UTC (rev 15294)
@@ -29,6 +29,7 @@
org.jboss.tools.jsf.web.helpers.context,
org.jboss.tools.jsf.web.pattern
Require-Bundle: org.jboss.tools.jst.web;visibility:=reexport,
+ org.jboss.tools.jst.web.kb;visibility:=reexport,
org.eclipse.ui.ide,
org.eclipse.ui.views,
org.eclipse.jface.text,
15 years, 4 months
JBoss Tools SVN: r15291 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb: META-INF and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-05-15 10:23:50 -0400 (Fri, 15 May 2009)
New Revision: 15291
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IKbProject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbProjectFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ClassPathMonitor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/IFileScanner.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LibraryScanner.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LoadedDeclarations.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ScannerException.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.kb/build.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/ITagLibrary.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2009-05-15 14:19:46 UTC (rev 15290)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2009-05-15 14:23:50 UTC (rev 15291)
@@ -2,7 +2,9 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.jboss.tools.jst.web.kb;singleton:=true
+Bundle-Localization: plugin
Bundle-Version: 1.0.0
+Bundle-ClassPath: webKb.jar
Bundle-Activator: org.jboss.tools.jst.web.kb.WebKbPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@@ -13,4 +15,5 @@
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
Export-Package: org.jboss.tools.jst.web.kb,
+ org.jboss.tools.jst.web.kb.internal,
org.jboss.tools.jst.web.kb.taglib
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/build.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/build.properties 2009-05-15 14:19:46 UTC (rev 15290)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/build.properties 2009-05-15 14:23:50 UTC (rev 15291)
@@ -1,4 +1,5 @@
-bin.includes = META-INF/,\
+bin.includes = plugin.xml,\
+ META-INF/,\
plugin.properties,\
webKb.jar,\
about.html
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension
+ id="kbbuilder"
+ name="KB Builder"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ hasNature="false">
+ <run
+ class="org.jboss.tools.jst.web.kb.internal.KbBuilder">
+ </run>
+ </builder>
+ </extension>
+ <extension
+ id="kbnature"
+ name="KB Project Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.jboss.tools.jst.web.kb.internal.KbProject">
+ </run>
+ </runtime>
+ <builder
+ id="org.jboss.tools.jst.web.kb.kbbuilder">
+ </builder>
+ </extension>
+
+</plugin>
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IKbProject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IKbProject.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IKbProject.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb;
+
+import org.eclipse.core.resources.IProjectNature;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+
+/**
+ *
+ * @author V.Kabanovich
+ *
+ */
+public interface IKbProject extends IProjectNature {
+ public static String NATURE_ID = Activator.PLUGIN_ID + ".kbnature"; //$NON-NLS-1$
+
+ public ITagLibrary[] getTagLibraries();
+
+ public void resolve();
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IKbProject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbProjectFactory.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbProjectFactory.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbProjectFactory.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,40 @@
+package org.jboss.tools.jst.web.kb;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.jst.web.WebModelPlugin;
+
+public class KbProjectFactory {
+
+ /**
+ * Factory method creating seam project instance by project resource.
+ * Returns null if
+ * (1) project does not exist
+ * (2) project is closed
+ * (3) project has no seam nature
+ * (4) creating seam project failed.
+ * @param project
+ * @param resolve if true and results of last build have not been resolved they are loaded.
+ * @return
+ */
+ public static IKbProject getSeamProject(IProject project, boolean resolve) {
+ if(project == null || !project.exists() || !project.isOpen()) return null;
+ try {
+ if(!project.hasNature(IKbProject.NATURE_ID)) return null;
+ } catch (CoreException e) {
+ //ignore - all checks are done above
+ return null;
+ }
+
+ IKbProject kbProject;
+ try {
+ kbProject = (IKbProject)project.getNature(IKbProject.NATURE_ID);
+ if(resolve) kbProject.resolve();
+ return kbProject;
+ } catch (CoreException e) {
+ WebModelPlugin.getPluginLog().logError(e);
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbProjectFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal;
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.tools.jst.web.kb.Activator;
+
+/**
+ *
+ * @author V.Kabanovich
+ *
+ */
+public class KbBuilder extends IncrementalProjectBuilder {
+ public static String BUILDER_ID = Activator.PLUGIN_ID + ".kbbuilder"; //$NON-NLS-1$
+
+ protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
+ throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,344 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jst.web.WebModelPlugin;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.internal.scanner.ClassPathMonitor;
+import org.jboss.tools.jst.web.kb.internal.scanner.LoadedDeclarations;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+
+/**
+ *
+ * @author V.Kabanovich
+ *
+ */
+public class KbProject implements IKbProject {
+ IProject project;
+
+ ClassPathMonitor classPath = new ClassPathMonitor(this);
+
+ Set<IPath> sourcePaths = new HashSet<IPath>();
+
+ Map<IPath, LoadedDeclarations> sourcePaths2 = new HashMap<IPath, LoadedDeclarations>();
+
+ private boolean isStorageResolved = false;
+
+ Set<KbProject> dependsOn = new HashSet<KbProject>();
+
+ Set<KbProject> usedBy = new HashSet<KbProject>();
+
+ LibraryStorage libraries = new LibraryStorage();
+
+ public ITagLibrary[] getTagLibraries() {
+ return libraries.getAllFactoriesArray();
+ }
+
+ public void configure() throws CoreException {
+ addToBuildSpec(KbBuilder.BUILDER_ID);
+ }
+
+ public void deconfigure() throws CoreException {
+ removeFromBuildSpec(KbBuilder.BUILDER_ID);
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public IPath getSourcePath() {
+ return project == null ? null : project.getFullPath();
+ }
+
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ /**
+ *
+ * @param p
+ */
+ public void addSeamProject(KbProject p) {
+ if(dependsOn.contains(p)) return;
+ dependsOn.add(p);
+ p.addDependentSeamProject(this);
+ if(!p.isStorageResolved) {
+ p.resolve();
+ } else {
+ Map<IPath,LoadedDeclarations> map = null;
+ try {
+ map = p.getAllDeclarations();
+ } catch (CloneNotSupportedException e) {
+ WebModelPlugin.getPluginLog().logError(e);
+ }
+ for (IPath source : map.keySet()) {
+ LoadedDeclarations ds = map.get(source);
+ registerComponents(ds, source);
+ }
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Set<KbProject> getSeamProjects() {
+ return dependsOn;
+ }
+
+ /**
+ *
+ * @param p
+ */
+ public void addDependentSeamProject(KbProject p) {
+ usedBy.add(p);
+ }
+
+ /**
+ *
+ * @param p
+ */
+ public void removeSeamProject(KbProject p) {
+ if(!dependsOn.contains(p)) return;
+ p.usedBy.remove(this);
+ dependsOn.remove(p);
+ IPath[] ps = sourcePaths2.keySet().toArray(new IPath[0]);
+ for (int i = 0; i < ps.length; i++) {
+ IPath pth = ps[i];
+ if(p.getSourcePath().isPrefixOf(pth) || (p.isPathLoaded(pth) && !EclipseResourceUtil.isJar(pth.toString()))) {
+ pathRemoved(pth);
+ }
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ public ClassPathMonitor getClassPath() {
+ return classPath;
+ }
+
+ /**
+ *
+ * @param load
+ */
+ public void resolveStorage(boolean load) {
+ if(isStorageResolved) return;
+ if(load) {
+ load();
+ } else {
+ isStorageResolved = true;
+ }
+ }
+
+ /**
+ *
+ */
+ public void resolve() {
+ resolveStorage(true);
+ }
+
+ /**
+ * Loads results of last build, which are considered
+ * actual until next build.
+ */
+ public void load() {
+ if(isStorageResolved) return;
+ isStorageResolved = true;
+
+ //TODO
+ }
+
+ /**
+ *
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ Map<IPath, LoadedDeclarations> getAllDeclarations() throws CloneNotSupportedException {
+ Map<IPath, LoadedDeclarations> map = new HashMap<IPath, LoadedDeclarations>();
+ for (ITagLibrary f : getTagLibraries()) {
+ IPath p = f.getSourcePath();
+ if(p == null || EclipseResourceUtil.isJar(p.toString())) continue;
+ LoadedDeclarations ds = map.get(p);
+ if(ds == null) {
+ ds = new LoadedDeclarations();
+ map.put(p, ds);
+ }
+ ds.getLibraries().add(f.clone());
+ }
+ return map;
+ }
+
+ /**
+ *
+ * @param builderID
+ * @throws CoreException
+ */
+ protected void addToBuildSpec(String builderID) throws CoreException {
+ IProjectDescription description = getProject().getDescription();
+ ICommand command = null;
+ ICommand commands[] = description.getBuildSpec();
+ for (int i = 0; i < commands.length && command == null; ++i) {
+ if (commands[i].getBuilderName().equals(builderID))
+ command = commands[i];
+ }
+ if (command == null) {
+ command = description.newCommand();
+ command.setBuilderName(builderID);
+ ICommand[] oldCommands = description.getBuildSpec();
+ ICommand[] newCommands = new ICommand[oldCommands.length + 1];
+ System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length);
+ newCommands[oldCommands.length] = command;
+ description.setBuildSpec(newCommands);
+ getProject().setDescription(description, null);
+ }
+ }
+
+ static String EXTERNAL_TOOL_BUILDER = "org.eclipse.ui.externaltools.ExternalToolBuilder";
+ static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle";
+
+ /**
+ *
+ * @param builderID
+ * @throws CoreException
+ */
+ protected void removeFromBuildSpec(String builderID) throws CoreException {
+ IProjectDescription description = getProject().getDescription();
+ ICommand[] commands = description.getBuildSpec();
+ for (int i = 0; i < commands.length; ++i) {
+ String builderName = commands[i].getBuilderName();
+ if (!builderName.equals(builderID)) {
+ if(!builderName.equals(EXTERNAL_TOOL_BUILDER)) continue;
+ Object handle = commands[i].getArguments().get(LAUNCH_CONFIG_HANDLE);
+ if(handle == null || handle.toString().indexOf(builderID) < 0) continue;
+ }
+ ICommand[] newCommands = new ICommand[commands.length - 1];
+ System.arraycopy(commands, 0, newCommands, 0, i);
+ System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
+ description.setBuildSpec(newCommands);
+ getProject().setDescription(description, null);
+ return;
+ }
+ }
+
+ /**
+ * Package local method called by builder.
+ * @param component
+ * @param source
+ */
+ public void registerComponents(LoadedDeclarations ds, IPath source) {
+ //TODO
+ }
+
+ public boolean isPathLoaded(IPath source) {
+ return sourcePaths2.containsKey(source);
+ }
+
+
+ /**
+ * Package local method called by builder.
+ * @param source
+ */
+ public void pathRemoved(IPath source) {
+ //TODO
+ }
+
+
+ class LibraryStorage {
+ private Set<ITagLibrary> allFactories = new HashSet<ITagLibrary>();
+ private ITagLibrary[] allFactoriesArray = null;
+ Map<IPath, Set<ITagLibrary>> factoriesBySource = new HashMap<IPath, Set<ITagLibrary>>();
+
+ public void clear() {
+ synchronized(allFactories) {
+ allFactories.clear();
+ allFactoriesArray = null;
+ }
+ factoriesBySource.clear();
+ }
+
+ public ITagLibrary[] getAllFactoriesArray() {
+ ITagLibrary[] result = allFactoriesArray;
+ if(result == null) {
+ synchronized(allFactories) {
+ allFactoriesArray = allFactories.toArray(new ITagLibrary[0]);
+ result = allFactoriesArray;
+ }
+ }
+ return result;
+ }
+
+ public Set<ITagLibrary> getFactoriesBySource(IPath path) {
+ return factoriesBySource.get(path);
+ }
+
+ public void addFactory(ITagLibrary f) {
+ synchronized(allFactories) {
+ allFactories.add(f);
+ allFactoriesArray = null;
+ }
+ IPath path = f.getSourcePath();
+ if(path != null) {
+ Set<ITagLibrary> fs = factoriesBySource.get(path);
+ if(fs == null) {
+ fs = new HashSet<ITagLibrary>();
+ factoriesBySource.put(path, fs);
+ }
+ fs.add(f);
+ }
+ }
+
+ public void removeFactory(ITagLibrary f) {
+ synchronized(allFactories) {
+ allFactories.remove(f);
+ allFactoriesArray = null;
+ }
+ IPath path = f.getSourcePath();
+ if(path != null) {
+ Set<ITagLibrary> fs = factoriesBySource.get(path);
+ if(fs != null) {
+ fs.remove(f);
+ }
+ if(fs.isEmpty()) {
+ factoriesBySource.remove(fs);
+ }
+ }
+ }
+
+ public Set<ITagLibrary> removePath(IPath path) {
+ Set<ITagLibrary> fs = factoriesBySource.get(path);
+ if(fs == null) return null;
+ for (ITagLibrary f: fs) {
+ synchronized(allFactories) {
+ allFactories.remove(f);
+ allFactoriesArray = null;
+ }
+ }
+ factoriesBySource.remove(path);
+ return fs;
+ }
+
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ClassPathMonitor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ClassPathMonitor.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ClassPathMonitor.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,288 @@
+/*******************************************************************************
+ * 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.jst.web.kb.internal.scanner;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.impl.FileSystemsLoader;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.XModelObjectUtil;
+import org.jboss.tools.jst.web.WebModelPlugin;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.internal.KbProject;
+import org.jboss.tools.jst.web.model.helpers.InnerModelHelper;
+
+/**
+ * Monitors class path of project and loads seam components of it.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class ClassPathMonitor {
+ KbProject project;
+ XModel model = null;
+
+ List<String> paths = null;
+ Map<IPath, String> paths2 = new HashMap<IPath, String>();
+
+ Set<String> processedPaths = new HashSet<String>();
+
+ /**
+ * Creates instance of class path for seam project
+ * @param project
+ */
+ public ClassPathMonitor(KbProject project) {
+ this.project = project;
+ }
+
+ /**
+ * Returns seam project
+ * @return
+ */
+ public KbProject getProject() {
+ return project;
+ }
+
+ /**
+ * Initialization of inner model.
+ */
+ public void init() {
+ model = InnerModelHelper.createXModel(project.getProject());
+ }
+
+ static String[] SYSTEM_JARS = {"rt.jar", "jsse.jar", "jce.jar", "charsets.jar"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ static Set<String> SYSTEM_JAR_SET = new HashSet<String>();
+
+ static {
+ for (int i = 0; i < SYSTEM_JARS.length; i++) SYSTEM_JAR_SET.add(SYSTEM_JARS[i]);
+ }
+
+ /**
+ * Returns true if class path was up-to-date.
+ * Otherwise, updates inner model and disables class loader.
+ * @return
+ */
+ public boolean update() {
+ List<String> newPaths = null;
+ try {
+ newPaths = EclipseResourceUtil.getClassPath(project.getProject());
+ List<String> jre = EclipseResourceUtil.getJREClassPath(project.getProject());
+ if(jre != null) newPaths.removeAll(jre);
+ } catch (CoreException e) {
+ //TODO
+ WebModelPlugin.getDefault().logError(e);
+ } catch(IOException e) {
+ WebModelPlugin.getDefault().logError(e);
+ }
+ if(paths == null && newPaths == null) return false;
+ if((newPaths == null || paths == null) || (paths.size() != newPaths.size())) {
+ paths = newPaths;
+ } else {
+ boolean b = false;
+ for (int i = 0; i < paths.size() && !b; i++) {
+ if(!paths.get(i).equals(newPaths.get(i))) b = true;
+ }
+ if(!b) return false;
+ paths = newPaths;
+ }
+ createMap();
+ XModelObject object = model.getByPath("FileSystems"); //$NON-NLS-1$
+ XModelObject[] fs = object.getChildren("FileSystemJar"); //$NON-NLS-1$
+ Set<XModelObject> fss = new HashSet<XModelObject>();
+ for (int i = 0; i < fs.length; i++) fss.add(fs[i]);
+
+ for (int i = 0; i < paths.size(); i++) {
+ String path = paths.get(i);
+ if(!EclipseResourceUtil.isJar(path)) continue;
+ String fileName = new File(path).getName();
+ if(SYSTEM_JAR_SET.contains(fileName)) continue;
+ String jsname = "lib-" + fileName; //$NON-NLS-1$
+ XModelObject o = model.getByPath("FileSystems").getChildByPath(jsname); //$NON-NLS-1$
+ if(o != null) {
+ fss.remove(o);
+ } else {
+ o = object.getModel().createModelObject("FileSystemJar", null); //$NON-NLS-1$
+ o.setAttributeValue("name", jsname); //$NON-NLS-1$
+ o.setAttributeValue("location", path); //$NON-NLS-1$
+ o.set(FileSystemsLoader.IS_ADDED_TO_CLASSPATH, "true"); //$NON-NLS-1$
+ object.addChild(o);
+// object.setModified(true);
+ }
+ }
+
+ for (XModelObject o: fss) {
+ String path = XModelObjectUtil.expand(o.getAttributeValue("location"), o.getModel(), null); //$NON-NLS-1$
+ if("true".equals(o.get(FileSystemsLoader.IS_ADDED_TO_CLASSPATH))) { //$NON-NLS-1$
+ o.removeFromParent();
+ } else if(!new File(path).exists()) {
+ o.removeFromParent();
+ }
+ }
+
+ return true;
+ }
+
+ private void createMap() {
+ paths2.clear();
+ if(paths != null) {
+ for (String p : paths) {
+ paths2.put(new Path(p), p);
+ }
+ }
+ }
+
+ /**
+ * Loads seam components from items recently added to class path.
+ */
+ public void process() {
+ Iterator<String> it = processedPaths.iterator();
+ while(it.hasNext()) {
+ String p = it.next();
+ if(paths.contains(p)) continue;
+ project.pathRemoved(new Path(p));
+ it.remove();
+ }
+ for (int i = 0; i < paths.size(); i++) {
+ String p = paths.get(i);
+ if(processedPaths.contains(p)) continue;
+ processedPaths.add(p);
+
+ LibraryScanner scanner = new LibraryScanner();
+ scanner.setClassPath(this);
+
+ String fileName = new File(p).getName();
+ if(SYSTEM_JAR_SET.contains(fileName)) continue;
+ String jsname = "lib-" + fileName; //$NON-NLS-1$
+ XModelObject o = model.getByPath("FileSystems").getChildByPath(jsname); //$NON-NLS-1$
+ if(o == null) continue;
+
+ LoadedDeclarations c = null;
+ try {
+ if(scanner.isLikelyComponentSource(o)) {
+ c = scanner.parse(o, new Path(p), project);
+ }
+ } catch (ScannerException e) {
+ WebModelPlugin.getDefault().logError(e);
+ }
+ if(c == null) {
+ c = new LoadedDeclarations();
+ }
+ if(c != null) {
+ componentsLoaded(c, new Path(p));
+ }
+ }
+
+ validateProjectDependencies();
+ }
+
+ public void validateProjectDependencies() {
+ List<KbProject> ps = null;
+
+ try {
+ ps = getSeamProjects(project.getProject());
+ } catch (CoreException e) {
+ WebModelPlugin.getPluginLog().logError(e);
+ }
+ if(ps != null) {
+ Set<KbProject> set = project.getSeamProjects();
+ Set<KbProject> removable = new HashSet<KbProject>();
+ removable.addAll(set);
+ removable.removeAll(ps);
+ ps.removeAll(set);
+ for (KbProject p : ps) {
+ project.addSeamProject(p);
+ }
+ for (KbProject p : removable) {
+ project.removeSeamProject(p);
+ }
+ }
+ }
+
+ public boolean hasToUpdateProjectDependencies() {
+ List<KbProject> ps = null;
+
+ try {
+ ps = getSeamProjects(project.getProject());
+ } catch (CoreException e) {
+ WebModelPlugin.getPluginLog().logError(e);
+ }
+ if(ps != null) {
+ Set<KbProject> set = project.getSeamProjects();
+ Set<KbProject> removable = new HashSet<KbProject>();
+ removable.addAll(set);
+ removable.removeAll(ps);
+ ps.removeAll(set);
+ for (KbProject p : ps) {
+ return true;
+ }
+ for (KbProject p : removable) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void componentsLoaded(LoadedDeclarations c, IPath path) {
+ if(c == null) return;
+ project.registerComponents(c, path);
+ }
+
+ List<KbProject> getSeamProjects(IProject project) throws CoreException {
+ List<KbProject> list = new ArrayList<KbProject>();
+ IJavaProject javaProject = JavaCore.create(project);
+ IClasspathEntry[] es = javaProject.getResolvedClasspath(true);
+ for (int i = 0; i < es.length; i++) {
+ if(es[i].getEntryKind() == IClasspathEntry.CPE_PROJECT) {
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(es[i].getPath().lastSegment());
+ if(p == null || !p.isAccessible()) continue;
+ IKbProject sp = KbProjectFactory.getSeamProject(p, false);
+ if(sp != null) list.add((KbProject)sp);
+ }
+ }
+ return list;
+ }
+
+ public void pathLoaded(IPath path) {
+ String p = paths2.get(path);
+ if(p != null) {
+ processedPaths.add(p);
+ }
+ }
+
+ public boolean hasPath(IPath path) {
+ return paths2.get(path) != null;
+ }
+
+ public void clean() {
+ paths = null;
+ if(paths2 != null) paths2.clear();
+ processedPaths.clear();
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ClassPathMonitor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/IFileScanner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/IFileScanner.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/IFileScanner.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.jst.web.kb.internal.scanner;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.jst.web.kb.IKbProject;
+
+public interface IFileScanner {
+
+ /**
+ * First, the most trivial check by file mask.
+ * If it returns false, other scanners will be invoked.
+ * If it returns true, other scanners will NOT be invoked.
+ * @param resource
+ * @return
+ */
+ public boolean isRelevant(IFile resource);
+
+ /**
+ * Second, more detailed check of file content.
+ * @param f
+ * @return
+ */
+ public boolean isLikelyComponentSource(IFile f);
+
+ /**
+ * Loading components declared in resource.
+ * @param f
+ * @return
+ * @throws ScannerException
+ */
+ public LoadedDeclarations parse(IFile f, IKbProject sp) throws ScannerException;
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/IFileScanner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LibraryScanner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LibraryScanner.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LibraryScanner.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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.jst.web.kb.internal.scanner;
+
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IParent;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.impl.FileSystemsImpl;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.XModelObjectUtil;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.model.helpers.InnerModelHelper;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class LibraryScanner implements IFileScanner {
+ ClassPathMonitor classPath = null;
+
+ //Now it is absolute file on disk
+ IPath sourcePath = null;
+
+ public LibraryScanner() {}
+
+ public void setClassPath(ClassPathMonitor classPath) {
+ this.classPath = classPath;
+ }
+
+ public boolean isRelevant(IFile f) {
+ if(EclipseResourceUtil.isJar(f.getName())) return true;
+ return false;
+ }
+
+ public boolean isLikelyComponentSource(IFile f) {
+ XModel model = InnerModelHelper.createXModel(f.getProject());
+ if(model == null) return false;
+ XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
+ if(o == null) return false;
+ if(!o.getModelEntity().getName().equals("FileSystemJar")) { //$NON-NLS-1$
+ ((FileSystemsImpl)o.getModel().getByPath("FileSystems")).updateOverlapped(); //$NON-NLS-1$
+ o = EclipseResourceUtil.getObjectByResource(f);
+ if(o == null || !o.getModelEntity().getName().equals("FileSystemJar")) return false; //$NON-NLS-1$
+ }
+ return isLikelyComponentSource(o);
+ }
+
+ public LoadedDeclarations parse(IFile f, IKbProject sp) throws ScannerException {
+ XModel model = InnerModelHelper.createXModel(f.getProject());
+ if(model == null) return null;
+ XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
+ if(o == null) return null;
+ if(!o.getModelEntity().getName().equals("FileSystemJar")) { //$NON-NLS-1$
+ ((FileSystemsImpl)o.getModel().getByPath("FileSystems")).updateOverlapped(); //$NON-NLS-1$
+ o = EclipseResourceUtil.getObjectByResource(f);
+ if(o == null || !o.getModelEntity().getName().equals("FileSystemJar")) return null; //$NON-NLS-1$
+ }
+ return parse(o, f.getFullPath(), sp);
+ }
+
+ public boolean isLikelyComponentSource(XModelObject o) {
+ if(o == null) return false;
+ if(o.getChildByPath("seam.properties") != null) return true; //$NON-NLS-1$
+ if(o.getChildByPath("META-INF/seam.properties") != null) return true; //$NON-NLS-1$
+ if(o.getChildByPath("META-INF/components.xml") != null) return true; //$NON-NLS-1$
+ return false;
+ }
+
+ public LoadedDeclarations parse(XModelObject o, IPath path, IKbProject sp) throws ScannerException {
+ if(o == null) return null;
+ sourcePath = path;
+ XModelObject seamProperties = o.getChildByPath("META-INF/seam.properties"); //$NON-NLS-1$
+ if(seamProperties == null) seamProperties = o.getChildByPath("seam.properties"); //$NON-NLS-1$
+ XModelObject componentsXML = o.getChildByPath("META-INF/components.xml"); //$NON-NLS-1$
+ if(componentsXML == null && seamProperties == null) return null;
+
+ LoadedDeclarations ds = new LoadedDeclarations();
+
+ if(componentsXML != null) {
+ LoadedDeclarations ds1 = new XMLScanner().parse(componentsXML, path, sp);
+ if(ds1 != null) ds.add(ds1);
+ }
+
+ return ds;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LibraryScanner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LoadedDeclarations.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LoadedDeclarations.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LoadedDeclarations.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.jst.web.kb.internal.scanner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+
+/**
+ * This object keeps all declarations loaded from one source.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class LoadedDeclarations {
+ List<ITagLibrary> libraries = new ArrayList<ITagLibrary>();
+
+ public List<ITagLibrary> getLibraries() {
+ return libraries;
+ }
+
+ public void add(LoadedDeclarations ds) {
+ if(ds == null) return;
+ libraries.addAll(ds.libraries);
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LoadedDeclarations.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ScannerException.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ScannerException.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ScannerException.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.jst.web.kb.internal.scanner;
+
+public class ScannerException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public ScannerException() {
+ }
+
+ public ScannerException(Throwable cause) {
+ super(cause);
+ }
+
+ public ScannerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/ScannerException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * 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.jst.web.kb.internal.scanner;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.meta.XModelEntity;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.NamespaceMapping;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.model.helpers.InnerModelHelper;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class XMLScanner implements IFileScanner {
+
+ public XMLScanner() {}
+
+ /**
+ * Returns true if file is probable component source -
+ * has components.xml name or *.component.xml mask.
+ * @param resource
+ * @return
+ */
+ public boolean isRelevant(IFile resource) {
+ if(resource.getName().equals("components.xml")) return true; //$NON-NLS-1$
+ if(resource.getName().endsWith(".component.xml")) return true; //$NON-NLS-1$
+ return false;
+ }
+
+ /**
+ * This method should be called only if isRelevant returns true;
+ * Makes simple check if this java file contains annotation Name.
+ * @param resource
+ * @return
+ */
+ public boolean isLikelyComponentSource(IFile f) {
+ if(!f.isSynchronized(IFile.DEPTH_ZERO) || !f.exists()) return false;
+ XModel model = InnerModelHelper.createXModel(f.getProject());
+ if(model == null) return false;
+ XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
+ if(o == null) return false;
+ if(o.getModelEntity().getName().startsWith("FileSeamComponent")) return true; //$NON-NLS-1$
+ return false;
+ }
+
+ /**
+ * Returns list of components
+ * @param f
+ * @return
+ * @throws ScannerException
+ */
+ public LoadedDeclarations parse(IFile f, IKbProject sp) throws ScannerException {
+ XModel model = InnerModelHelper.createXModel(f.getProject());
+ if(model == null) return null;
+ XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
+ return parse(o, f.getFullPath(), sp);
+ }
+
+ static Set<String> INTERNAL_ATTRIBUTES = new HashSet<String>();
+
+ static {
+ INTERNAL_ATTRIBUTES.add("NAME"); //$NON-NLS-1$
+ INTERNAL_ATTRIBUTES.add("EXTENSION"); //$NON-NLS-1$
+ INTERNAL_ATTRIBUTES.add("#comment"); //$NON-NLS-1$
+ }
+
+ public LoadedDeclarations parse(XModelObject o, IPath source, IKbProject sp) {
+ if(o == null) return null;
+
+ if(o.getParent() instanceof FolderImpl) {
+ IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(source);
+ if(f != null && f.exists()) {
+ try {
+ ((FolderImpl)o.getParent()).updateChildFile(o, f.getLocation().toFile());
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ if(o.getParent() == null) {
+ boolean b = isLikelyComponentSource(f);
+ if(!b) return null;
+ o = EclipseResourceUtil.getObjectByResource(o.getModel(), f);
+ if(o == null) return null;
+ }
+ }
+ }
+
+ LoadedDeclarations ds = new LoadedDeclarations();
+ XModelObject[] os = o.getChildren();
+ for (int i = 0; i < os.length; i++) {
+ XModelEntity componentEntity = os[i].getModelEntity();
+ //TODO
+// if(os[i].getModelEntity().getName().startsWith("SeamFactory")) { //$NON-NLS-1$
+// SeamXmlFactory factory = new SeamXmlFactory();
+// factory.setId(os[i]);
+// factory.setSourcePath(source);
+// factory.setName(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.NAME));
+// factory.setValue(new XMLValueInfo(os[i], "value")); //$NON-NLS-1$
+// factory.setMethod(new XMLValueInfo(os[i], "method")); //$NON-NLS-1$
+// ds.getLibraries().add(factory);
+// }
+ }
+ return ds;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-05-15 14:19:46 UTC (rev 15290)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -17,6 +17,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
@@ -100,6 +101,14 @@
this.components = components;
}
+ public IPath getSourcePath() {
+ //TODO
+ if(resource != null) {
+ return resource.getFullPath();
+ }
+ return null;
+ }
+
/* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.taglib.TagLibrary#getResource()
*/
@@ -176,4 +185,11 @@
}
return proposals.toArray(new TextProposal[proposals.size()]);
}
+
+ public AbstractTagLib clone() throws CloneNotSupportedException {
+ AbstractTagLib t = (AbstractTagLib)super.clone();
+ t.components = new HashMap<String, IComponent>();
+ t.components.putAll(components);
+ return t;
+ }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/ITagLibrary.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/ITagLibrary.java 2009-05-15 14:19:46 UTC (rev 15290)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/ITagLibrary.java 2009-05-15 14:23:50 UTC (rev 15291)
@@ -11,6 +11,7 @@
package org.jboss.tools.jst.web.kb.taglib;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.IProposalProcessor;
@@ -21,6 +22,8 @@
*/
public interface ITagLibrary extends IProposalProcessor {
+ public IPath getSourcePath();
+
/**
* @return URI of the tag lib.
*/
@@ -54,4 +57,7 @@
* @return components
*/
public IComponent[] getComponents(KbQuery query, IPageContext context);
-}
\ No newline at end of file
+
+ public ITagLibrary clone() throws CloneNotSupportedException;
+
+}
15 years, 4 months
JBoss Tools SVN: r15290 - trunk/as/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-05-15 10:19:46 -0400 (Fri, 15 May 2009)
New Revision: 15290
Modified:
trunk/as/docs/reference/en/modules/perspective.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-671 - adding info on server polling to the 'Server editor' section;
Modified: trunk/as/docs/reference/en/modules/perspective.xml
===================================================================
--- trunk/as/docs/reference/en/modules/perspective.xml 2009-05-15 14:18:56 UTC (rev 15289)
+++ trunk/as/docs/reference/en/modules/perspective.xml 2009-05-15 14:19:46 UTC (rev 15290)
@@ -45,9 +45,9 @@
<section id="jbossserver_view_toolbar">
<title>JBoss Server View Toolbar</title>
<para>In the right top corner of the <property>JBoss Server View</property> there is a
- special toolbar which provides a quick access to starting a server (in the debug mode,
- run mode, or profile mode), restarting a server, stopping a server and a possibility to publish to a
- server.</para>
+ special toolbar which provides a quick access to starting a server (in the debug
+ mode, run mode, or profile mode), restarting a server, stopping a server and a
+ possibility to publish to a server.</para>
<figure>
<title>The JBoss Server View Toolbar</title>
@@ -74,7 +74,7 @@
</emphasis> button will republish any modules where it has determined the workspace
is out of sync with the server. It will attempt to do an incremental publish if it
turns out that the module in question is capable of doing one.</para>
-
+
</section>
<section id="jbossserver_view_structure">
@@ -728,13 +728,16 @@
</mediaobject>
</figure>
- <para>The settings related to <emphasis>
- <property>Publishing</property>
- </emphasis>, <emphasis>
- <property>Timeouts</property>
- </emphasis> or <emphasis>
- <property>Server Polling</property>
- </emphasis> can be also adjusted in the <property>Server editor</property>.</para>
+ <para>In the <property>Server editor</property> you are able to edit the timeouts and the server pollers to use.</para>
+
+ <note>
+ <title>Note:</title>
+ <para>By default, the Startup poller is set to JMX Poller (see the <emphasis>
+ <property>Server Polling</property></emphasis> section). If you change the Startup poller
+ to Timeout Poller (it may need in case, for example, you're using the minimal configuration for your server), this will do no polling at all and will only set the server
+ state to <emphasis>
+ <property>"Started"</property></emphasis> after your startup timeout is reached.</para>
+ </note>
<para id="com_line_arg"><property>Server editor</property> makes it also possible to
modify the server's launch configuration. It's just after clicking <emphasis>
@@ -774,10 +777,10 @@
on unaltered.</para>
</note>
- <para>Until 3.0.0.GA release of <property>JBoss Tools</property>, the servers classpath was readonly, but that caused
- problems for users wanting to add their own jars in the startup classpath. That is
- relevant if you need to patch the server, add a custom charset or other tweaks that
- require early access to the classpath.</para>
+ <para>Until 3.0.0.GA release of <property>JBoss Tools</property>, the servers classpath
+ was readonly, but that caused problems for users wanting to add their own jars in
+ the startup classpath. That is relevant if you need to patch the server, add a
+ custom charset or other tweaks that require early access to the classpath.</para>
<para>Now all servers have a custom 'server runtime classpath
container', which is there by default and point to the default jars in
@@ -794,11 +797,10 @@
</figure>
<para>If for some reason you have a launch configuration without this container, <emphasis>
- <property>Restore
- Default Entries</property></emphasis> should add it properly. Also, <emphasis>
- <property>Restore
- Default Entries</property></emphasis> will also remove any
- extra entries you added yourself.</para>
+ <property>Restore Default Entries</property>
+ </emphasis> should add it properly. Also, <emphasis>
+ <property>Restore Default Entries</property>
+ </emphasis> will also remove any extra entries you added yourself.</para>
</section>
<section>
15 years, 4 months
JBoss Tools SVN: r15289 - in trunk: jbpm/plugins/org.jboss.tools.flow.jpdl4.multipage and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2009-05-15 10:18:56 -0400 (Fri, 15 May 2009)
New Revision: 15289
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.doc.user/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.multipage/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jstl.test/
Log:
svn bin ignore
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.doc.user
___________________________________________________________________
Name: svn:ignore
+ bin
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.multipage
___________________________________________________________________
Name: svn:ignore
- bin
+ bin
bin
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jstl.test
___________________________________________________________________
Name: svn:ignore
- bin
+ bin
bin
15 years, 4 months
JBoss Tools SVN: r15288 - trunk/jsf/features/org.jboss.tools.richfaces.feature.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-05-15 09:28:33 -0400 (Fri, 15 May 2009)
New Revision: 15288
Modified:
trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
===================================================================
--- trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2009-05-15 13:26:43 UTC (rev 15287)
+++ trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2009-05-15 13:28:33 UTC (rev 15288)
@@ -354,6 +354,12 @@
version="0.0.0"/>
<plugin
+ id="org.jboss.tools.jst.web.kb"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
id="org.jboss.tools.jst.web.tiles"
download-size="0"
install-size="0"
15 years, 4 months
JBoss Tools SVN: r15287 - in trunk/jst: tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-05-15 09:26:43 -0400 (Fri, 15 May 2009)
New Revision: 15287
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2009-05-15 13:24:53 UTC (rev 15286)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2009-05-15 13:26:43 UTC (rev 15287)
@@ -6,9 +6,9 @@
Bundle-Activator: org.jboss.tools.jst.web.kb.WebKbPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.jboss.tools.jst.web;bundle-version="2.0.0",
- org.jboss.tools.common.el.core;bundle-version="2.0.0",
- org.eclipse.jface.text;bundle-version="3.5.0"
+ org.jboss.tools.jst.web,
+ org.jboss.tools.common.el.core,
+ org.eclipse.jface.text
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java 2009-05-15 13:24:53 UTC (rev 15286)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java 2009-05-15 13:26:43 UTC (rev 15287)
@@ -20,15 +20,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
-import org.jboss.tools.common.model.XJob;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.project.Watcher;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.test.util.TestProjectProvider;
15 years, 4 months