JBoss Tools SVN: r10913 - trunk/seam/docs/reference/en/images/crud_database_application.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-10-17 06:23:44 -0400 (Fri, 17 Oct 2008)
New Revision: 10913
Modified:
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_02.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_03.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_04.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_06.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_07.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_09.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_10.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_11.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_12.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_13.png
Log:
https://jira.jboss.org/jira/browse/JBDS-446 - retaking and replacing the screenshots;
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_02.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_03.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_04.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_06.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_07.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_09.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_10.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_11.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_12.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_13.png
===================================================================
(Binary files differ)
16 years, 2 months
JBoss Tools SVN: r10910 - in trunk/smooks/plugins: org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-10-17 05:55:10 -0400 (Fri, 17 Oct 2008)
New Revision: 10910
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/icons/full/obj16/blank.gif
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/DesignTimeAnalyzeResult.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IMappingAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/SmooksUIActivator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/modelparser/SmooksConfigurationFileGenerateContext.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/SmooksGraphConstants.java
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.xml2java/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
Log:
JBIDE-2867
Add notify information GUI above the graphical panel
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.java2xml/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -19,6 +19,7 @@
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.jboss.tools.smooks.analyzer.AbstractAnalyzer;
+import org.jboss.tools.smooks.analyzer.DesignTimeAnalyzeResult;
import org.jboss.tools.smooks.analyzer.MappingResourceConfigList;
import org.jboss.tools.smooks.analyzer.SmooksAnalyzerException;
import org.jboss.tools.smooks.javabean.model.JavaBeanModel;
@@ -62,7 +63,7 @@
return;
}
- GraphRootModel rootModel = context.getDataMappingRootModel();
+ GraphRootModel rootModel = context.getGraphicalRootModel();
List<SourceModel> sourceModelList = rootModel.loadSourceModelList();
List<TargetModel> targetModelList = rootModel.loadTargetModelList();
@@ -173,4 +174,10 @@
return "${" + name + "}";
}
+ public DesignTimeAnalyzeResult analyzeGraphModel(
+ SmooksConfigurationFileGenerateContext context) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -33,6 +33,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.smooks.analyzer.DesignTimeAnalyzeResult;
import org.jboss.tools.smooks.analyzer.IMappingAnalyzer;
import org.jboss.tools.smooks.analyzer.ISourceModelAnalyzer;
import org.jboss.tools.smooks.analyzer.ITargetModelAnalyzer;
@@ -356,6 +357,50 @@
}
+ private DesignTimeAnalyzeResult checkOtherNodeConnected(
+ SmooksConfigurationFileGenerateContext context) {
+ GraphRootModel root = context.getGraphicalRootModel();
+ List sourceList = root.loadSourceModelList();
+ List targetList = root.loadTargetModelList();
+ StringBuffer buffer = new StringBuffer();
+ for (Iterator iterator = targetList.iterator(); iterator.hasNext();) {
+ AbstractStructuredDataModel targetm = (AbstractStructuredDataModel) iterator
+ .next();
+ if (targetm instanceof IConnectableModel) {
+ if (((IConnectableModel) targetm).getModelTargetConnections()
+ .isEmpty()) {
+ continue;
+ }
+
+ JavaBeanModel javaModel = (JavaBeanModel) targetm
+ .getReferenceEntityModel();
+ JavaBeanModel parent = javaModel.getParent();
+ if (parent != null) {
+ AbstractStructuredDataModel pgm = UIUtils.findGraphModel(
+ root, parent);
+ if (pgm != null && pgm instanceof IConnectableModel) {
+ if (((IConnectableModel) pgm)
+ .getModelTargetConnections().isEmpty()) {
+ buffer
+ .append("The parent of Java node \""
+ + javaModel.getName()
+ + "\" : \""
+ + parent.getName()
+ + "\" doesn't be connected by any source node!\n");
+ }
+ }
+ }
+ }
+ }
+ String result = buffer.toString();
+ if ("".equals(result)) {
+ return null;
+ }
+ DesignTimeAnalyzeResult dr = new DesignTimeAnalyzeResult();
+ dr.setErrorMessage(result);
+ return dr;
+ }
+
/**
* If root node don't connect , it will ask user to connect them .
*
@@ -363,7 +408,7 @@
*/
private void checkRootNodeConnected(
SmooksConfigurationFileGenerateContext context) {
- GraphRootModel root = context.getDataMappingRootModel();
+ GraphRootModel root = context.getGraphicalRootModel();
List sourceList = root.loadSourceModelList();
List targetList = root.loadTargetModelList();
@@ -424,7 +469,7 @@
.openQuestion(
displayParent,
"Connection Question",
- "The root models don't be connected , maybe it will make some errors with the generation config file contents.\nDo you wan to connect them?");
+ "The root models don't be connected , it will make some errors with the generation config file contents.\nDo you wan to connect them?");
if (connectAuto) {
// connect root model
LineConnectionModel connectionModel = new LineConnectionModel();
@@ -448,22 +493,21 @@
public void analyzeMappingGraphModel(
SmooksConfigurationFileGenerateContext context)
throws SmooksAnalyzerException {
- GraphRootModel root = context.getDataMappingRootModel();
- checkRootNodeConnected(context);
+ GraphRootModel root = context.getGraphicalRootModel();
this.analyzeGraphicalModel(root, context.getGeneratorResourceList());
}
public MappingResourceConfigList analyzeMappingSmooksModel(
SmooksResourceListType listType, Object sourceObject,
Object targetObject) {
- if(sourceObject instanceof List){
- if(!((List)sourceObject).isEmpty()){
- sourceObject = (JavaBeanModel) ((List)sourceObject).get(0);
+ if (sourceObject instanceof List) {
+ if (!((List) sourceObject).isEmpty()) {
+ sourceObject = (JavaBeanModel) ((List) sourceObject).get(0);
}
}
- if(targetObject instanceof List){
- if(!((List)targetObject).isEmpty()){
- targetObject = (JavaBeanModel) ((List)targetObject).get(0);
+ if (targetObject instanceof List) {
+ if (!((List) targetObject).isEmpty()) {
+ targetObject = (JavaBeanModel) ((List) targetObject).get(0);
}
}
if (!(sourceObject instanceof JavaBeanModel)
@@ -659,7 +703,8 @@
current, classLoader);
}
List list = new ArrayList();
- if(model != null) list.add(model);
+ if (model != null)
+ list.add(model);
return list;
}
@@ -957,4 +1002,10 @@
}
return null;
}
+
+ public DesignTimeAnalyzeResult analyzeGraphModel(
+ SmooksConfigurationFileGenerateContext context) {
+ checkRootNodeConnected(context);
+ return checkOtherNodeConnected(context);
+ }
}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/icons/full/obj16/blank.gif
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/icons/full/obj16/blank.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/DesignTimeAnalyzeResult.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/DesignTimeAnalyzeResult.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/DesignTimeAnalyzeResult.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.analyzer;
+
+/**
+ * @author dart
+ *
+ */
+public class DesignTimeAnalyzeResult {
+ public String errorMessage;
+ public String warningMessage;
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+ public String getWarningMessage() {
+ return warningMessage;
+ }
+ public void setWarningMessage(String warningMessage) {
+ this.warningMessage = warningMessage;
+ }
+
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/DesignTimeAnalyzeResult.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IMappingAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IMappingAnalyzer.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IMappingAnalyzer.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -26,4 +26,6 @@
public MappingResourceConfigList analyzeMappingSmooksModel(
SmooksResourceListType listType,Object sourceObject,Object targetObject);
+ public DesignTimeAnalyzeResult analyzeGraphModel(SmooksConfigurationFileGenerateContext context);
+
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/SmooksUIActivator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/SmooksUIActivator.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/SmooksUIActivator.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -45,6 +45,7 @@
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
super.initializeImageRegistry(reg);
+ reg.put(SmooksGraphConstants.IMAGE_EMPTY, getImageDescriptor(SmooksGraphConstants.IMAGE_PATH_BLANK));
reg.put(SmooksGraphConstants.IMAGE_ERROR, getImageDescriptor(SmooksGraphConstants.IMAGE_PATH_ERROR));
reg.put(SmooksGraphConstants.IMAGE_WARNING, getImageDescriptor(SmooksGraphConstants.IMAGE_PATH_WARNING));
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -95,6 +95,7 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.analyzer.AnalyzerFactory;
+import org.jboss.tools.smooks.analyzer.DesignTimeAnalyzeResult;
import org.jboss.tools.smooks.analyzer.IMappingAnalyzer;
import org.jboss.tools.smooks.analyzer.ISourceModelAnalyzer;
import org.jboss.tools.smooks.analyzer.ITargetModelAnalyzer;
@@ -114,7 +115,9 @@
import org.jboss.tools.smooks.model.util.SmooksModelConstants;
import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
import org.jboss.tools.smooks.ui.IViewerInitor;
+import org.jboss.tools.smooks.ui.SmooksUIActivator;
import org.jboss.tools.smooks.ui.StructuredDataCreationWizardDailog;
+import org.jboss.tools.smooks.ui.ViewerInitorStore;
import org.jboss.tools.smooks.ui.gef.editparts.SmooksEditPartFactory;
import org.jboss.tools.smooks.ui.gef.model.AbstractStructuredDataModel;
import org.jboss.tools.smooks.ui.gef.model.GraphRootModel;
@@ -128,6 +131,7 @@
import org.jboss.tools.smooks.ui.gef.util.GraphicsConstants;
import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
import org.jboss.tools.smooks.ui.wizards.TransformDataSelectionWizard;
+import org.jboss.tools.smooks.utils.SmooksGraphConstants;
import org.jboss.tools.smooks.utils.UIUtils;
/**
@@ -164,6 +168,9 @@
private ISelection selection;
protected MappingResourceConfigList mappingResourceConfigList;
protected AdapterFactoryEditingDomain editingDomain;
+ private Label notifyLabel;
+ private boolean canSaveFile = true;
+ private Label imageLabel;
public ISelection getSelection() {
return selection;
@@ -268,6 +275,20 @@
mappingMainComposite.setLayout(gly);
section.setClient(mappingMainComposite);
+ Composite notifyComposite = toolkit
+ .createComposite(mappingMainComposite);
+ GridData ngd = new GridData(GridData.FILL_HORIZONTAL);
+ ngd.horizontalSpan = 3;
+ GridLayout ngl = new GridLayout();
+ ngl.numColumns = 2;
+ notifyComposite.setLayout(ngl);
+ notifyComposite.setLayoutData(ngd);
+ imageLabel = toolkit.createLabel(notifyComposite, "");
+ imageLabel.setImage(SmooksUIActivator.getDefault().getImageRegistry()
+ .get(SmooksGraphConstants.IMAGE_EMPTY));
+ notifyLabel = toolkit.createLabel(notifyComposite, "" );
+ GridData nlgd = new GridData(GridData.FILL_HORIZONTAL);
+ notifyLabel.setLayoutData(nlgd);
GridData sgd = new GridData(GridData.FILL_BOTH);
section.setLayoutData(sgd);
{
@@ -648,6 +669,16 @@
*/
@Override
public void doSave(IProgressMonitor monitor) {
+ if (!canSaveFile) {
+ boolean cleanError = MessageDialog
+ .openQuestion(
+ getSite().getShell(),
+ "Clean all the errors please",
+ "There occurs some errors on the graphical design , please clean all errors .\n" +
+ "Click \"Yes\" to return . If you don't care that , click \"No\" to save file.");
+ if (cleanError)
+ return;
+ }
SmooksFileBuilder builder = this.getSmooksFileBuilder();
builder.setSmooksResource(this.smooksResource);
SmooksConfigurationFileGenerateContext context = this
@@ -756,6 +787,7 @@
public void commandStackChanged(EventObject event) {
commandStackChanged = true;
+ analyzeDesignGraph();
updateSelectionActions();
getManagedForm().dirtyStateChanged();
}
@@ -901,8 +933,10 @@
if (dialog.open() == org.eclipse.jface.dialogs.Dialog.OK) {
sourceDataTypeID = wizard.getSourceDataTypeID();
targetDataTypeID = wizard.getTargetDataTypeID();
- sourceTreeViewerInputModel = wizard.getSourceTreeViewerInputContents();
- targetTreeViewerInputModel = wizard.getTargetTreeViewerInputContents();
+ sourceTreeViewerInputModel = wizard
+ .getSourceTreeViewerInputContents();
+ targetTreeViewerInputModel = wizard
+ .getTargetTreeViewerInputContents();
this.getSmooksConfigurationFileGenerateContext()
.setSourceDataTypeID(sourceDataTypeID);
this.getSmooksConfigurationFileGenerateContext()
@@ -956,9 +990,9 @@
if (input instanceof SmooksFileEditorInput) {
this.sourceTreeViewerInputModel = ((SmooksFileEditorInput) input)
.getSourceTreeViewerInputContents();
-
+
this.targetTreeViewerInputModel = ((SmooksFileEditorInput) input)
- .getTargetTreeViewerInputContents();
+ .getTargetTreeViewerInputContents();
}
// }
@@ -976,9 +1010,13 @@
}
/**
- * It's a very important method <p>
- * If call the method , there will open the data selection wizard to allow user select new data , <p>
+ * It's a very important method
+ * <p>
+ * If call the method , there will open the data selection wizard to allow
+ * user select new data ,
+ * <p>
* when user select the new data , the connections will be removed.
+ *
* @param viewer
*/
protected void showCreationWizard(TreeViewer viewer) {
@@ -1210,10 +1248,63 @@
public void commandStackChanged(EventObject event) {
commandStackChanged = true;
+ analyzeDesignGraph();
updateSelectionActions();
getManagedForm().dirtyStateChanged();
}
+ protected void setErrorMessage(String errorMessage) {
+ imageLabel.setImage(SmooksUIActivator.getDefault().getImageRegistry().get(SmooksGraphConstants.IMAGE_EMPTY));
+ notifyLabel.setText("");
+ canSaveFile = true;
+ if (errorMessage != null) {
+ imageLabel.setImage(SmooksUIActivator.getDefault()
+ .getImageRegistry().get(SmooksGraphConstants.IMAGE_ERROR));
+ notifyLabel.setText(errorMessage);
+ canSaveFile = false;
+ }
+ }
+
+ protected void setWarningMessage(String warningMessage) {
+ imageLabel.setImage(SmooksUIActivator.getDefault().getImageRegistry().get(SmooksGraphConstants.IMAGE_EMPTY));
+ notifyLabel.setText("");
+ if (warningMessage != null) {
+ imageLabel
+ .setImage(SmooksUIActivator.getDefault().getImageRegistry()
+ .get(SmooksGraphConstants.IMAGE_WARNING));
+ notifyLabel.setText(warningMessage);
+ }
+ }
+
+ protected void analyzeDesignGraph() {
+ try {
+ IMappingAnalyzer analyzer = AnalyzerFactory.getInstance()
+ .getMappingAnalyzer(sourceDataTypeID, targetDataTypeID);
+ SmooksConfigurationFileGenerateContext context = this
+ .createContext();
+ this.initSmooksConfigurationFileGenerateContext(context);
+ DesignTimeAnalyzeResult result = analyzer
+ .analyzeGraphModel(context);
+ if (result != null) {
+ String errorMessage = result.getErrorMessage();
+ String warningMessage = result.getWarningMessage();
+
+ if (errorMessage != null) {
+ setErrorMessage(errorMessage);
+ return;
+ }
+
+ if (warningMessage != null) {
+ setWarningMessage(warningMessage);
+ return;
+ }
+ }
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
/**
* @return the editingDomain
*/
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -58,8 +58,8 @@
if(sid == null || tid == null) return false;
this.sourceDataTypeID = sid;
this.targetDataTypeID = tid;
- setSourceTreeViewerInputContents(page.getSourceTreeViewerInputContents());
- setTargetTreeViewerInputContents(page.getTargetTreeViewerInputContents());
+// setSourceTreeViewerInputContents(page.getSourceTreeViewerInputContents());
+// setTargetTreeViewerInputContents(page.getTargetTreeViewerInputContents());
return true;
}
public Object getSourceTreeViewerInputContents() {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -327,6 +327,8 @@
if (wizard instanceof TypeIDSelectionWizard) {
String s = ((TypeIDSelectionWizard) wizard).getSourceDataTypeID();
String t = ((TypeIDSelectionWizard) wizard).getTargetDataTypeID();
+ this.setSourceID(s);
+ this.setTargetID(t);
if (initViewerCheckState(s, source)) {
source.getTable().setEnabled(false);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/modelparser/SmooksConfigurationFileGenerateContext.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/modelparser/SmooksConfigurationFileGenerateContext.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/modelparser/SmooksConfigurationFileGenerateContext.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -68,7 +68,7 @@
/**
* @return the dataMappingRootModel
*/
- public GraphRootModel getDataMappingRootModel() {
+ public GraphRootModel getGraphicalRootModel() {
return dataMappingRootModel;
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/SmooksGraphConstants.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/SmooksGraphConstants.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/SmooksGraphConstants.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -5,14 +5,18 @@
/**
* @author root
- *
+ *
*/
public class SmooksGraphConstants {
public static final String IMAGE_PATH_ERROR = "icons/full/obj16/error_obj.gif";
-
+
public static final String IMAGE_PATH_WARNING = "icons/full/obj16/warning_obj.gif";
-
+
+ public static final String IMAGE_PATH_BLANK = "icons/full/obj16/blank.gif";
+
public static final String IMAGE_WARNING = IMAGE_PATH_WARNING;
-
+
public static final String IMAGE_ERROR = IMAGE_PATH_ERROR;
+
+ public static final String IMAGE_EMPTY = IMAGE_PATH_BLANK;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -6,6 +6,7 @@
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.jboss.tools.smooks.analyzer.AbstractAnalyzer;
+import org.jboss.tools.smooks.analyzer.DesignTimeAnalyzeResult;
import org.jboss.tools.smooks.analyzer.MappingResourceConfigList;
import org.jboss.tools.smooks.analyzer.SmooksAnalyzerException;
import org.jboss.tools.smooks.model.SmooksResourceListType;
@@ -45,4 +46,10 @@
return null;
}
+ public DesignTimeAnalyzeResult analyzeGraphModel(
+ SmooksConfigurationFileGenerateContext context) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.xml2java/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.xml2java/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-10-17 07:27:04 UTC (rev 10909)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.xml2java/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-10-17 09:55:10 UTC (rev 10910)
@@ -18,6 +18,7 @@
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.jboss.tools.smooks.analyzer.AbstractAnalyzer;
+import org.jboss.tools.smooks.analyzer.DesignTimeAnalyzeResult;
import org.jboss.tools.smooks.analyzer.MappingModel;
import org.jboss.tools.smooks.analyzer.MappingResourceConfigList;
import org.jboss.tools.smooks.analyzer.SmooksAnalyzerException;
@@ -58,7 +59,7 @@
throws SmooksAnalyzerException {
SmooksResourceListType listType = context.getSmooksResourceListModel();
- GraphRootModel rootModel = context.getDataMappingRootModel();
+ GraphRootModel rootModel = context.getGraphicalRootModel();
List children = rootModel.getChildren();
for (Iterator iterator = children.iterator(); iterator.hasNext();) {
TreeItemRelationModel dataModel = (TreeItemRelationModel) iterator
@@ -144,7 +145,7 @@
boolean isComplex = true;
JavaBeanModel child = (JavaBeanModel) iterator.next();
AbstractStructuredDataModel graphModel = UIUtils.findGraphModel(
- context.getDataMappingRootModel(), child);
+ context.getGraphicalRootModel(), child);
LineConnectionModel connection = UIUtils
.getFirstTargetModelViaConnection(graphModel);
if (connection == null)
@@ -383,4 +384,10 @@
return null;
}
+ public DesignTimeAnalyzeResult analyzeGraphModel(
+ SmooksConfigurationFileGenerateContext context) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
16 years, 2 months
JBoss Tools SVN: r10909 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test: src/org/jboss/tools/jsf/vpe/richfaces/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-10-17 03:27:04 -0400 (Fri, 17 Oct 2008)
New Revision: 10909
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dragSupport.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropSupport.xhtml
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2810,
junit test for rich:dragSupport and rich:dropSupport was added.
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dragSupport.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dragSupport.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropSupport.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dropSupport.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2008-10-17 06:21:15 UTC (rev 10908)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2008-10-17 07:27:04 UTC (rev 10909)
@@ -116,11 +116,11 @@
}
public void testDragSupport() throws Throwable {
- assertTrue("it is necessary to add a body of the test ", false);//$NON-NLS-1$
+ performInvisibleTagTest("components/dragSupport.xhtml", "dragSupport"); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testDropSupport() throws Throwable {
- assertTrue("it is necessary to add a body of the test ", false);//$NON-NLS-1$
+ performInvisibleTagTest("components/dropSupport.xhtml", "dropSupport"); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testDragListener() throws Throwable {
16 years, 2 months
JBoss Tools SVN: r10908 - in trunk/common: plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-17 02:21:15 -0400 (Fri, 17 Oct 2008)
New Revision: 10908
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
Log:
increase coverage and fix errors in ExtensionPlugin
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java 2008-10-17 03:01:17 UTC (rev 10907)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java 2008-10-17 06:21:15 UTC (rev 10908)
@@ -16,6 +16,7 @@
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
+import org.osgi.framework.BundleContext;
/**
@@ -35,6 +36,7 @@
*/
public ExtensionsPlugin() {
super();
+ plugin = this;
}
/**
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java 2008-10-17 03:01:17 UTC (rev 10907)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java 2008-10-17 06:21:15 UTC (rev 10908)
@@ -15,10 +15,10 @@
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.IEditorWrapper;
import org.jboss.tools.common.text.ext.IMultiPageEditor;
@@ -37,7 +37,7 @@
public static StructuredTextEditor getStructuredTextEditor (IEditorPart editorPart) {
IEditorPart activeEditorPart = editorPart;
if (activeEditorPart == null) {
- IWorkbenchPage workbenchPage = ExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
activeEditorPart = workbenchPage.getActiveEditor();
}
if (activeEditorPart instanceof IMultiPageEditor) {
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld 2008-10-17 06:21:15 UTC (rev 10908)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+
+<taglib>
+ <tlib-version>1.0</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>test</short-name>
+ <uri>http://org.jboss.org/tests</uri>
+ <description>
+ Test tld to test attribute name open-on
+ </description>
+
+ <validator>
+ <validator-class>
+ com.sun.faces.taglib.jsf_core.CoreValidator
+ </validator-class>
+ <description>
+ verify hiperlink to the class
+ </description>
+ </validator>
+
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+
+ <tag>
+ <name>actionListener</name>
+ <tag-class>com.sun.faces.taglib.jsf_core.ActionListenerTag</tag-class>
+ <tei-class>com.sun.faces.taglib.FacesTagExtraInfo</tei-class>
+ <body-content>empty</body-content>
+
+ <variable>
+ <name-from-attribute>attr1</name-from-attribute>
+ </variable>
+
+ <attribute>
+ <name>attr1</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-17 03:01:17 UTC (rev 10907)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-17 06:21:15 UTC (rev 10908)
@@ -509,5 +509,28 @@
String fileName = editor.getEditorInput().getName();
assertTrue("html_basic.tld".equals(fileName));
}
-
+
+ public static final String TLD_ATTRIBUTE_NAME_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld";
+
+ public void testTldAttributeNameOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(TLD_ATTRIBUTE_NAME_TEST_FILE);
+ assertTrue(editor instanceof DefaultMultipageEditor);
+ DefaultMultipageEditor tldEditor = (DefaultMultipageEditor) editor;
+ tldEditor.selectPageByName("Source");
+ ISourceViewer viewer = tldEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new FindReplaceDocumentAdapter(tldEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "attr1", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ ITextSelection selection = (ITextSelection)viewer.getSelectionProvider().getSelection();
+ assertEquals("<name>", selection.getText());
+ }
}
16 years, 2 months
JBoss Tools SVN: r10907 - trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-10-16 23:01:17 -0400 (Thu, 16 Oct 2008)
New Revision: 10907
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/NewJavaBeanStrucutredDataWizard.java
Log:
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/NewJavaBeanStrucutredDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/NewJavaBeanStrucutredDataWizard.java 2008-10-17 02:43:26 UTC (rev 10906)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/NewJavaBeanStrucutredDataWizard.java 2008-10-17 03:01:17 UTC (rev 10907)
@@ -16,6 +16,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.core.JavaProject;
@@ -95,6 +96,14 @@
IProject project = ((IResource)obj).getProject();
this.project = JavaCore.create(project);
}
+
+ if(project == null){
+ if(obj instanceof IAdaptable){
+ IResource relateResource =(IResource) ((IAdaptable)obj).getAdapter(IResource.class);
+ IProject project = relateResource.getProject();
+ this.project = JavaCore.create(project);
+ }
+ }
}
}
}
16 years, 2 months
JBoss Tools SVN: r10906 - trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-10-16 22:43:26 -0400 (Thu, 16 Oct 2008)
New Revision: 10906
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
Log:
JBIDE-2917
the input source/target object instance can't be known by the Analyzer.I have fixed that.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-17 01:51:18 UTC (rev 10905)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-17 02:43:26 UTC (rev 10906)
@@ -456,6 +456,16 @@
public MappingResourceConfigList analyzeMappingSmooksModel(
SmooksResourceListType listType, Object sourceObject,
Object targetObject) {
+ if(sourceObject instanceof List){
+ if(!((List)sourceObject).isEmpty()){
+ sourceObject = (JavaBeanModel) ((List)sourceObject).get(0);
+ }
+ }
+ if(targetObject instanceof List){
+ if(!((List)targetObject).isEmpty()){
+ targetObject = (JavaBeanModel) ((List)targetObject).get(0);
+ }
+ }
if (!(sourceObject instanceof JavaBeanModel)
|| !(targetObject instanceof JavaBeanModel)) {
return MappingResourceConfigList.createEmptyList();
16 years, 2 months
JBoss Tools SVN: r10905 - in trunk/common: plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-16 21:51:18 -0400 (Thu, 16 Oct 2008)
New Revision: 10905
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/faceletsHiperlinkTests.xhtml
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspXmlFormatTests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/templates/
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/templates/common.xhtml
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.classpath
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/styleHyperlinkTests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
Log:
tests for common.text.ext
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java 2008-10-17 00:04:13 UTC (rev 10904)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java 2008-10-17 01:51:18 UTC (rev 10905)
@@ -10,11 +10,6 @@
******************************************************************************/
package org.jboss.tools.common.text.ext;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
@@ -32,8 +27,6 @@
public class ExtensionsPlugin extends BaseUIPlugin implements IAdaptable {
//The shared instance.
private static ExtensionsPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
public static final String PLUGIN_ID = "org.jboss.tools.common.text.ext";
@@ -42,62 +35,15 @@
*/
public ExtensionsPlugin() {
super();
- plugin = this;
- try {
- resourceBundle= ResourceBundle.getBundle("org.jboss.tools.common.text.ext.ExtensionsPlugin");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
}
/**
- * The constructor.
- */
- public ExtensionsPlugin(IPluginDescriptor descriptor) {
- super();
- plugin = this;
- try {
- resourceBundle= ResourceBundle.getBundle("org.jboss.tools.common.text.ext.ExtensionsPlugin");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- /**
* Returns the shared instance.
*/
public static ExtensionsPlugin getDefault() {
return plugin;
}
- /**
- * Returns the workspace instance.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle= ExtensionsPlugin.getDefault().getResourceBundle();
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
-
public Object getAdapter(Class adapter) {
if (adapter == IHyperlinkDetector.class) {
return HyperlinkDetector.getInstance();
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java 2008-10-17 00:04:13 UTC (rev 10904)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java 2008-10-17 01:51:18 UTC (rev 10905)
@@ -14,6 +14,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
@@ -233,7 +234,7 @@
protected IEditorInput createEditorInput(String fileString) {
String jarName = fileString.substring(0,fileString.indexOf("!"));
- IFile[] fs = ExtensionsPlugin.getDefault().getWorkspace().getRoot().findFilesForLocation(new Path(jarName));
+ IFile[] fs = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(jarName));
if(fs == null || fs.length == 0) return null;
IProject p = fs[0].getProject();
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java 2008-10-17 00:04:13 UTC (rev 10904)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java 2008-10-17 01:51:18 UTC (rev 10905)
@@ -17,6 +17,7 @@
import org.eclipse.core.resources.IFile;
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.jdt.core.IJavaElement;
@@ -157,7 +158,7 @@
IStorageEditorInput moeInput = (IStorageEditorInput)editorInput;
IPath p = moeInput.getStorage().getFullPath();
String s0 = p.segment(0);
- project = ExtensionsPlugin.getWorkspace().getRoot().getProject(s0);
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(s0);
}
} else {
project = documentFile.getProject();
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java 2008-10-17 00:04:13 UTC (rev 10904)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java 2008-10-17 01:51:18 UTC (rev 10905)
@@ -16,6 +16,7 @@
import org.eclipse.core.resources.IFile;
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.jdt.core.IJavaElement;
@@ -182,7 +183,7 @@
IStorageEditorInput moeInput = (IStorageEditorInput)editorInput;
IPath p = moeInput.getStorage().getFullPath();
String s0 = p.segment(0);
- project = ExtensionsPlugin.getWorkspace().getRoot().getProject(s0);
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(s0);
}
} else {
project = documentFile.getProject();
Modified: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.classpath
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.classpath 2008-10-17 00:04:13 UTC (rev 10904)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.classpath 2008-10-17 01:51:18 UTC (rev 10905)
@@ -3,7 +3,7 @@
<classpathentry kind="src" path="JavaSource"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
- <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.preview.runtimeTarget/J2EE Preview"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-1.5.0-sun-1.5.0.15"/>
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0"/>
<classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
</classpath>
Modified: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp 2008-10-17 00:04:13 UTC (rev 10904)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp 2008-10-17 01:51:18 UTC (rev 10905)
@@ -2,4 +2,12 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<jsp:useBean id="b1" class="org.jboss.tools.test.TestBean1"></jsp:useBean>
<jsp:getProperty property="property1" name="b1"/>
+<jsp:setProperty property="property2" name="b1"/>
+<html>
+ <head>
+ <link rel="" >
+ </head>
+
+<a href="classHyperlinkTests.jsp">test</a>
+
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/faceletsHiperlinkTests.xhtml
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/faceletsHiperlinkTests.xhtml (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/faceletsHiperlinkTests.xhtml 2008-10-17 01:51:18 UTC (rev 10905)
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core">
+
+ <f:loadBundle basename="resources" var="msg" />
+
+ <ui:composition template="/templates/common.xhtml">
+
+ <ui:define name="pageTitle">Input User Name</ui:define>
+
+ <ui:define name="pageHeader">Facelets Hello Application</ui:define>
+
+ <ui:define name="body">
+ <h:message showSummary="true" showDetail="false" style="color: red; font-weight: bold;" for="name" />
+ <form jsfc="h:form" id="helloForm">
+ ${msg.prompt}
+ <input label="Name" jsfc="h:inputText" required="true" id="name" value="#{person.name}" />
+ <input type="submit" jsfc="h:commandButton" id="submit"
+ action="greeting" value="Say Hello" />
+ </form>
+
+ </ui:define>
+ </ui:composition>
+</html>
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/faceletsHiperlinkTests.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspXmlFormatTests.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspXmlFormatTests.jsp (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspXmlFormatTests.jsp 2008-10-17 01:51:18 UTC (rev 10905)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" version="2.0">
+ <jsp:directive.page language="java"
+ contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" />
+ <jsp:text>
+ <![CDATA[ <?xml version="1.0" encoding="ISO-8859-1" ?> ]]>
+ </jsp:text>
+ <jsp:text>
+ <![CDATA[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ]]>
+ </jsp:text>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+ <title>Insert title here</title>
+ </head>
+ <body>
+ <f:view>
+
+ </f:view>
+ </body>
+</html>
+</jsp:root>
\ No newline at end of file
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspXmlFormatTests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/styleHyperlinkTests.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/styleHyperlinkTests.jsp 2008-10-17 00:04:13 UTC (rev 10904)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/styleHyperlinkTests.jsp 2008-10-17 01:51:18 UTC (rev 10905)
@@ -4,7 +4,7 @@
<html>
<head>
<title>Input User Name Page</title>
- <link href="stylesheet/style15.css" rel="stylesheet" type="text/css" />
+ <link href="stylesheet/style15.css" rel="stylesheet" type="text/css" />
<link href="stylesheet/style14.css" rel="stylesheet" type="text/css" />
<link href="stylesheet/style13.css" rel="stylesheet" type="text/css" />
<link href="stylesheet/style12.css" rel="stylesheet" type="text/css" />
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/templates/common.xhtml
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/templates/common.xhtml (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/templates/common.xhtml 2008-10-17 01:51:18 UTC (rev 10905)
@@ -0,0 +1,65 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <f:loadBundle basename="resources" var="msg" />
+ <head>
+ <title><ui:insert name="pageTitle">Page Title</ui:insert></title>
+ <style type="text/css">
+ body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+ }
+ .header {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 18px;
+ }
+ .bottom {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9px;
+ text-align: center;
+ vertical-align: middle;
+ color: #8E969D;
+ }
+ </style>
+ </head>
+
+<body bgcolor="#ffffff">
+<table style="border:1px solid #CAD6E0" align="center" cellpadding="0" cellspacing="0" border="0" width="400">
+<tbody>
+
+ <tr>
+ <td class="header" height="42" align="center" valign="middle" width="100%" bgcolor="#E4EBEB">
+ <ui:insert name="pageHeader">Page Header</ui:insert>
+ </td>
+ </tr>
+ <tr>
+ <td height="1" width="100%" bgcolor="#CAD6E0"></td>
+ </tr>
+
+ <tr>
+ <td width="100%" colspan="2">
+ <table width="100%" style="height:150px" align="left" cellpadding="0" cellspacing="0" border="0">
+ <tbody>
+ <tr>
+ <td align="center" width="100%" valign="middle">
+
+ <ui:insert name="body">Page Body</ui:insert>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" valign="bottom" height="1" width="100%" bgcolor="#CAD6E0"></td>
+ </tr>
+</tbody>
+</table>
+</body>
+
+</html>
\ No newline at end of file
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/templates/common.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-17 00:04:13 UTC (rev 10904)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-17 01:51:18 UTC (rev 10905)
@@ -366,6 +366,27 @@
assertTrue("TestBean1.java".equals(fileName));
}
+ public void testSetBeanPropertyOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(USE_BEAN_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "property2", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("TestBean1.java".equals(fileName));
+ }
+
public static final String FORWARD_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/forwardHiperlinkTests.jsp";
@@ -441,4 +462,52 @@
assertTrue("includeHiperlinkPage1Tests.jsp".equals(fileName));
}
+ public static final String FACELETS_XHTML_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/faceletsHiperlinkTests.xhtml";
+
+
+ public void testJspXmlElementNameOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(FACELETS_XHTML_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "message", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("html_basic.tld".equals(fileName));
+ }
+
+ public static final String JSP_XMLNS_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/jspXmlFormatTests.jsp";
+
+
+ public void testJspXmlnsNameOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(FACELETS_XHTML_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "http://java.sun.com/jsf/html", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("html_basic.tld".equals(fileName));
+ }
+
}
16 years, 3 months
JBoss Tools SVN: r10904 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-10-16 20:04:13 -0400 (Thu, 16 Oct 2008)
New Revision: 10904
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/icons/cview16/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/icons/cview16/server_perspective.gif
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/icons/cview16/servers_view.gif
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerActionProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerContentProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerDecorator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerLabelProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServersView.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogActionProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogContentProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogLabelProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/XPathProvider.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathCategory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathFileResult.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
Pushing in newest changes before branch. This should give some beta view for the users to play with.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathCategory.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathCategory.java 2008-10-16 18:17:33 UTC (rev 10903)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathCategory.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -22,6 +22,7 @@
package org.jboss.ide.eclipse.as.core.extensions.descriptors;
import java.util.HashMap;
+import java.util.Iterator;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
@@ -43,7 +44,8 @@
}
public String getName() { return this.name; }
-
+ public IServer getServer() { return this.server; }
+
public boolean queriesLoaded() {
return children != null;
}
@@ -77,6 +79,10 @@
children.remove(query.getName());
}
+ public boolean isLoaded() {
+ return children == null ? false : true;
+ }
+
/*
* Save these queries to its server object
*/
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathFileResult.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathFileResult.java 2008-10-16 18:17:33 UTC (rev 10903)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathFileResult.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -64,13 +64,17 @@
Iterator<Node> i = nodeList.iterator();
int z = 0;
while(i.hasNext()) {
- childList.add(new XPathResultNode(i.next(), query.getAttribute(), z++));
+ childList.add(new XPathResultNode(i.next(), query.getAttribute(), z++, this));
}
children = childList.toArray(new XPathResultNode[childList.size()]);
}
return children;
}
+ public boolean isLoaded() {
+ return children == null ? false : true;
+ }
+
/* A class representing an actual result node / element in the document */
public class XPathResultNode {
protected Node node;
@@ -79,13 +83,19 @@
protected int index;
protected Object val;
protected boolean dirty;
- public XPathResultNode(Node node, String attribute, int index) {
+ protected XPathFileResult file;
+ public XPathResultNode(Node node, String attribute, int index, XPathFileResult file) {
this.node = node;
this.attribute = attribute;
this.index = index;
this.hasAttribute = attribute == null || attribute.equals("") ? false : true;
+ this.file = file;
}
+ public XPathFileResult getFile() {
+ return file;
+ }
+
public int getIndex() {
return index;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2008-10-16 18:17:33 UTC (rev 10903)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -149,6 +149,7 @@
}
};
FileUtil.touch(filter, deployPath.toFile(), true);
+ publishState = IServer.PUBLISH_STATE_NONE;
return null;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2008-10-16 18:17:33 UTC (rev 10903)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2008-10-17 00:04:13 UTC (rev 10904)
@@ -41,7 +41,8 @@
org.eclipse.core.variables,
org.eclipse.search,
org.apache.ant,
- org.jboss.ide.eclipse.as.core
+ org.jboss.ide.eclipse.as.core,
+ org.eclipse.ui.navigator;bundle-version="3.3.100"
Eclipse-LazyStart: true
Export-Package: org.jboss.ide.eclipse.as.ui,
org.jboss.ide.eclipse.as.ui.dialogs,
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/icons/cview16/server_perspective.gif
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/icons/cview16/server_perspective.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/icons/cview16/servers_view.gif
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/icons/cview16/servers_view.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerActionProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerActionProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerActionProvider.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -0,0 +1,297 @@
+package org.eclipse.wst.server.ui.internal.view.servers.provisional;
+
+import java.util.Iterator;
+
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.bindings.TriggerSequence;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.keys.IBindingService;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerPort;
+import org.eclipse.wst.server.core.model.ServerDelegate;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
+import org.eclipse.wst.server.ui.internal.Trace;
+import org.eclipse.wst.server.ui.internal.actions.NewServerWizardAction;
+import org.eclipse.wst.server.ui.internal.view.servers.CopyAction;
+import org.eclipse.wst.server.ui.internal.view.servers.DeleteAction;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleSloshAction;
+import org.eclipse.wst.server.ui.internal.view.servers.MonitorServerPortAction;
+import org.eclipse.wst.server.ui.internal.view.servers.OpenAction;
+import org.eclipse.wst.server.ui.internal.view.servers.PasteAction;
+import org.eclipse.wst.server.ui.internal.view.servers.PropertiesAction;
+import org.eclipse.wst.server.ui.internal.view.servers.PublishAction;
+import org.eclipse.wst.server.ui.internal.view.servers.PublishCleanAction;
+import org.eclipse.wst.server.ui.internal.view.servers.RemoveModuleAction;
+import org.eclipse.wst.server.ui.internal.view.servers.RenameAction;
+import org.eclipse.wst.server.ui.internal.view.servers.RestartModuleAction;
+import org.eclipse.wst.server.ui.internal.view.servers.ShowInConsoleAction;
+import org.eclipse.wst.server.ui.internal.view.servers.ShowInDebugAction;
+import org.eclipse.wst.server.ui.internal.view.servers.StartAction;
+import org.eclipse.wst.server.ui.internal.view.servers.StartModuleAction;
+import org.eclipse.wst.server.ui.internal.view.servers.StopAction;
+import org.eclipse.wst.server.ui.internal.view.servers.StopModuleAction;
+
+public class ServerActionProvider extends CommonActionProvider {
+ private ICommonActionExtensionSite actionSite;
+ private Clipboard clipboard;
+ public ServerActionProvider() {
+ super();
+ }
+
+ public void init(ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ this.actionSite = aSite;
+ ICommonViewerSite site = aSite.getViewSite();
+ if( site instanceof ICommonViewerWorkbenchSite ) {
+ StructuredViewer v = aSite.getStructuredViewer();
+ if( v instanceof CommonViewer ) {
+ CommonViewer cv = (CommonViewer)v;
+ ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite)site;
+ addListeners(cv);
+ makeServerActions(cv, wsSite.getSelectionProvider());
+ }
+ }
+ }
+
+
+ // actions on a server
+ protected Action[] actions;
+ protected Action actionModifyModules;
+ protected Action openAction, showInConsoleAction, showInDebugAction, propertiesAction, monitorPropertiesAction;
+ protected Action copyAction, pasteAction, deleteAction, renameAction;
+ protected Action noneAction = new Action(Messages.dialogMonitorNone) {
+ // dummy action
+ };
+
+ private void addListeners(CommonViewer tableViewer) {
+ tableViewer.addOpenListener(new IOpenListener() {
+ public void open(OpenEvent event) {
+ try {
+ IStructuredSelection sel = (IStructuredSelection) event.getSelection();
+ Object data = sel.getFirstElement();
+ if (!(data instanceof IServer))
+ return;
+ IServer server = (IServer) data;
+ ServerUIPlugin.editServer(server);
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Could not open server", e);
+ }
+ }
+ });
+ }
+
+ private void makeServerActions(CommonViewer tableViewer, ISelectionProvider provider) {
+ clipboard = new Clipboard(tableViewer.getTree().getDisplay());
+ Shell shell = tableViewer.getTree().getShell();
+
+ actions = new Action[6];
+ // create the start actions
+ actions[0] = new StartAction(shell, provider, ILaunchManager.DEBUG_MODE);
+ actions[1] = new StartAction(shell, provider, ILaunchManager.RUN_MODE);
+ actions[2] = new StartAction(shell, provider, ILaunchManager.PROFILE_MODE);
+
+ // create the stop action
+ actions[3] = new StopAction(shell, provider);
+
+ // create the publish actions
+ actions[4] = new PublishAction(shell, provider);
+ actions[5] = new PublishCleanAction(shell, provider);
+
+ // create the open action
+ openAction = new OpenAction(provider);
+
+// // create copy, paste, and delete actions
+ pasteAction = new PasteAction(shell, provider, clipboard);
+ copyAction = new CopyAction(provider, clipboard, pasteAction);
+ deleteAction = new DeleteAction(shell, provider);
+ renameAction = new RenameAction(shell, tableViewer, provider);
+
+ // create the other actions
+ actionModifyModules = new ModuleSloshAction(shell, provider);
+ showInConsoleAction = new ShowInConsoleAction(provider);
+ showInDebugAction = new ShowInDebugAction(provider);
+
+ // create the properties action
+ propertiesAction = new PropertiesAction(shell, provider);
+ monitorPropertiesAction = new PropertiesAction(shell, "org.eclipse.wst.server.ui.properties.monitor", provider);
+ }
+
+ public void fillActionBars(IActionBars actionBars) {
+ actionBars.setGlobalActionHandler("org.eclipse.wst.server.debug", actions[0]);
+ actionBars.setGlobalActionHandler("org.eclipse.wst.server.run", actions[1]);
+ actionBars.setGlobalActionHandler("org.eclipse.wst.server.stop", actions[3]);
+ actionBars.setGlobalActionHandler("org.eclipse.wst.server.publish", actions[4]);
+ actionBars.setGlobalActionHandler("org.eclipse.ui.navigator.Open", openAction);
+ actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
+ actionBars.updateActionBars();
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
+ actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
+ actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
+
+ IContributionManager cm = actionBars.getToolBarManager();
+ cm.removeAll();
+
+ for (int i = 0; i < actions.length - 1; i++)
+ cm.add(actions[i]);
+ }
+
+ private static void fillNewContextMenu(Shell shell, ISelection selection, IMenuManager menu) {
+ IAction newServerAction = new NewServerWizardAction();
+ newServerAction.setText(Messages.actionNewServer);
+ menu.add(newServerAction);
+ }
+
+ public void fillContextMenu(IMenuManager menu) {
+ ICommonViewerSite site = actionSite.getViewSite();
+ IStructuredSelection selection = null;
+ Shell shell = actionSite.getViewSite().getShell();
+ if( site instanceof ICommonViewerWorkbenchSite ) {
+ ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite)site;
+ selection = (IStructuredSelection) wsSite.getSelectionProvider().getSelection();
+ }
+
+ IServer server = null;
+ IModule[] module = null;
+ if (selection != null && !selection.isEmpty()) {
+ Iterator iterator = selection.iterator();
+ Object obj = iterator.next();
+ if (obj instanceof IServer)
+ server = (IServer) obj;
+ if (obj instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) obj;
+ server = ms.server;
+ module = ms.module;
+ }
+ if (iterator.hasNext()) {
+ server = null;
+ module = null;
+ }
+ }
+
+ // new action
+ MenuManager newMenu = new MenuManager(Messages.actionNew);
+ fillNewContextMenu(null, selection, newMenu);
+ menu.add(newMenu);
+
+ // open action
+ if (server != null && module == null) {
+ menu.add(openAction);
+
+ String text = Messages.actionShowIn;
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ final IBindingService bindingService = (IBindingService) workbench
+ .getAdapter(IBindingService.class);
+ final TriggerSequence[] activeBindings = bindingService
+ .getActiveBindingsFor("org.eclipse.ui.navigate.showInQuickMenu");
+ if (activeBindings.length > 0) {
+ text += "\t" + activeBindings[0].format();
+ }
+
+ MenuManager showInMenu = new MenuManager(text);
+ showInMenu.add(showInConsoleAction);
+ showInMenu.add(showInDebugAction);
+ //IActionBars actionBars = getViewSite().getActionBars();
+ //actionBars.setGlobalActionHandler("group.show", showInMenu);
+ menu.add(showInMenu);
+ menu.add(new Separator());
+ } else
+ menu.add(new Separator());
+
+ if (server != null) {
+ if (module == null) {
+ menu.add(copyAction);
+ menu.add(pasteAction);
+ menu.add(deleteAction);
+ menu.add(renameAction);
+ } else if (module.length == 1)
+ menu.add(new RemoveModuleAction(shell, server, module[0]));
+ menu.add(new Separator());
+ }
+
+ if (server != null && module == null) {
+ // server actions
+ for (int i = 0; i < actions.length; i++)
+ menu.add(actions[i]);
+
+ menu.add(new Separator());
+ menu.add(actionModifyModules);
+
+ // monitor
+ if (server.getServerType() != null) {
+ final MenuManager menuManager = new MenuManager(Messages.actionMonitor);
+
+ final IServer server2 = server;
+ final Shell shell2 = shell;
+ menuManager.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ menuManager.removeAll();
+ if (server2.getAdapter(ServerDelegate.class) != null) {
+ ServerPort[] ports = server2.getServerPorts(null);
+ if (ports != null) {
+ int size = ports.length;
+ for (int i = 0; i < size; i++) {
+ if (!ports[i].isAdvanced())
+ menuManager.add(new MonitorServerPortAction(shell2, server2, ports[i]));
+ }
+ }
+ }
+
+ if (menuManager.isEmpty())
+ menuManager.add(noneAction);
+
+ menuManager.add(new Separator());
+ menuManager.add(monitorPropertiesAction);
+ }
+ });
+
+ // add an initial menu item so that the menu appears correctly
+ noneAction.setEnabled(false);
+ menuManager.add(noneAction);
+ menu.add(menuManager);
+ }
+ }
+
+ if (server != null && module != null) {
+ menu.add(new Separator());
+ menu.add(new StartModuleAction(server, module));
+ menu.add(new StopModuleAction(server, module));
+ menu.add(new RestartModuleAction(server, module));
+ }
+
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end"));
+
+ if (server != null) {
+ menu.add(new Separator());
+ menu.add(propertiesAction);
+ }
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerContentProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerContentProvider.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -0,0 +1,331 @@
+package org.eclipse.wst.server.ui.internal.view.servers.provisional;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IPublishListener;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerLifecycleListener;
+import org.eclipse.wst.server.core.IServerListener;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerEvent;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.core.internal.UpdateServerJob;
+import org.eclipse.wst.server.core.util.PublishAdapter;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.Trace;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
+import org.eclipse.wst.server.ui.internal.viewers.BaseContentProvider;
+
+public class ServerContentProvider extends BaseContentProvider implements ITreeContentProvider {
+ public static Object INITIALIZING = new Object();
+ protected IServerLifecycleListener serverResourceListener;
+ protected IPublishListener publishListener;
+ protected IServerListener serverListener;
+
+ // servers that are currently publishing and starting
+ protected static Set<String> publishing = new HashSet<String>(4);
+ protected static Set<String> starting = new HashSet<String>(4);
+ protected boolean animationActive = false;
+ protected boolean stopAnimation = false;
+ protected boolean initialized = false;
+
+
+ private StructuredViewer viewer;
+
+ public ServerContentProvider() {
+ addListeners();
+ }
+
+ public Object[] getElements(Object element) {
+ if( !initialized ) {
+ deferInitialization();
+ return new Object[] {INITIALIZING};
+ }
+
+ List<IServer> list = new ArrayList<IServer>();
+ IServer[] servers = ServerCore.getServers();
+ if (servers != null) {
+ int size = servers.length;
+ for (int i = 0; i < size; i++) {
+ if (!((Server)servers[i]).isPrivate())
+ list.add(servers[i]);
+ }
+ }
+ return list.toArray();
+ }
+
+ public Object[] getChildren(Object element) {
+ if (element instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) element;
+ try {
+ IModule[] children = ms.server.getChildModules(ms.module, null);
+ int size = children.length;
+ ModuleServer[] ms2 = new ModuleServer[size];
+ for (int i = 0; i < size; i++) {
+ int size2 = ms.module.length;
+ IModule[] module = new IModule[size2 + 1];
+ System.arraycopy(ms.module, 0, module, 0, size2);
+ module[size2] = children[i];
+ ms2[i] = new ModuleServer(ms.server, module);
+ }
+ return ms2;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ IServer server = (IServer) element;
+ IModule[] modules = server.getModules();
+ int size = modules.length;
+ ModuleServer[] ms = new ModuleServer[size];
+ for (int i = 0; i < size; i++) {
+ ms[i] = new ModuleServer(server, new IModule[] { modules[i] });
+ }
+ return ms;
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) element;
+ return ms.server;
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if (element instanceof ModuleServer) {
+ // Check if the module server has child modules.
+ ModuleServer curModuleServer = (ModuleServer)element;
+ IServer curServer = curModuleServer.server;
+ IModule[] curModule = curModuleServer.module;
+ if (curServer != null && curModule != null) {
+ IModule[] curChildModule = curServer.getChildModules(curModule, null);
+ if (curChildModule != null && curChildModule.length > 0)
+ return true;
+
+ return false;
+ }
+
+ return false;
+ }
+ if( element instanceof IServer ) {
+ return ((IServer) element).getModules().length > 0;
+ }
+ return false;
+ }
+
+ public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
+ viewer = (StructuredViewer) aViewer;
+ }
+
+ public void dispose() {
+ // do nothing
+ }
+
+
+
+ // Listeners and refreshing the viewer
+ protected void addListeners() {
+ serverResourceListener = new IServerLifecycleListener() {
+ public void serverAdded(IServer server) {
+ refreshServer(null);
+ server.addServerListener(serverListener);
+ ((Server) server).addPublishListener(publishListener);
+ }
+ public void serverChanged(IServer server) {
+ refreshServer(server);
+ }
+ public void serverRemoved(IServer server) {
+ refreshServer(null);
+ server.removeServerListener(serverListener);
+ ((Server) server).removePublishListener(publishListener);
+ }
+ };
+ ServerCore.addServerLifecycleListener(serverResourceListener);
+
+ publishListener = new PublishAdapter() {
+ public void publishStarted(IServer server) {
+ handlePublishChange(server, true);
+ }
+
+ public void publishFinished(IServer server, IStatus status) {
+ handlePublishChange(server, false);
+ }
+ };
+
+ serverListener = new IServerListener() {
+ public void serverChanged(ServerEvent event) {
+ if (event == null)
+ return;
+
+ int eventKind = event.getKind();
+ IServer server = event.getServer();
+ if ((eventKind & ServerEvent.SERVER_CHANGE) != 0) {
+ // server change event
+ if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
+ refreshServer(server, true);
+ int state = event.getState();
+ String id = server.getId();
+ if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING) {
+ boolean startThread = false;
+ synchronized (starting) {
+ if (!starting.contains(id)) {
+ if (starting.isEmpty())
+ startThread = true;
+ starting.add(id);
+ }
+ }
+ if (startThread)
+ startThread();
+ } else {
+ boolean stopThread = false;
+ synchronized (starting) {
+ if (starting.contains(id)) {
+ starting.remove(id);
+ if (starting.isEmpty())
+ stopThread = true;
+ }
+ }
+ if (stopThread)
+ stopThread();
+ }
+ } else
+ refreshServer(server);
+ } else if ((eventKind & ServerEvent.MODULE_CHANGE) != 0) {
+ // module change event
+ if ((eventKind & ServerEvent.STATE_CHANGE) != 0 || (eventKind & ServerEvent.PUBLISH_STATE_CHANGE) != 0) {
+ refreshServer(server);
+ }
+ }
+ }
+ };
+
+ // add listeners to servers
+ IServer[] servers = ServerCore.getServers();
+ if (servers != null) {
+ int size = servers.length;
+ for (int i = 0; i < size; i++) {
+ servers[i].addServerListener(serverListener);
+ ((Server) servers[i]).addPublishListener(publishListener);
+ }
+ }
+ }
+
+ protected void deferInitialization() {
+ Job job = new Job(Messages.jobInitializingServersView) {
+ public IStatus run(IProgressMonitor monitor) {
+ IServer[] servers = ServerCore.getServers();
+ int size = servers.length;
+ for (int i = 0; i < size; i++) {
+ ((Server)servers[i]).getAllModules().iterator();
+ }
+
+ for (int i = 0; i < size; i++) {
+ IServer server = servers[i];
+ if (server.getServerType() != null && server.getServerState() == IServer.STATE_UNKNOWN) {
+ UpdateServerJob job2 = new UpdateServerJob(server);
+ job2.schedule();
+ }
+ }
+ initialized = true;
+ refreshServer(null);
+ return Status.OK_STATUS;
+ }
+ };
+
+ job.setSystem(true);
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
+
+ protected void refreshServer(final IServer server) {
+ refreshServer(server, false);
+ }
+ protected void refreshServer(final IServer server, final boolean resetSelection) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ if( viewer != null && !viewer.getControl().isDisposed()) {
+ viewer.refresh(server);
+ if( resetSelection ) {
+ ISelection sel = viewer.getSelection();
+ viewer.setSelection(sel);
+ }
+ ServerDecorator.getDefault().redecorate(server);
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ });
+ }
+
+ protected void handlePublishChange(IServer server, boolean isPublishing) {
+ String serverId = server.getId();
+ if (isPublishing)
+ publishing.add(serverId);
+ else
+ publishing.remove(serverId);
+
+ refreshServer(server);
+ }
+
+
+ protected void startThread() {
+ if (animationActive)
+ return;
+
+ stopAnimation = false;
+
+ final Display display = viewer == null ? Display.getDefault() : viewer.getControl().getDisplay();
+ final int SLEEP = 200;
+ final Runnable[] animator = new Runnable[1];
+ animator[0] = new Runnable() {
+ public void run() {
+ if (!stopAnimation) {
+ try {
+ int size = 0;
+ String[] servers;
+ synchronized (starting) {
+ size = starting.size();
+ servers = new String[size];
+ starting.toArray(servers);
+ }
+
+ for (int i = 0; i < size; i++) {
+ IServer server = ServerCore.findServer(servers[i]);
+ if (server != null ) {
+ ServerDecorator.animate();
+ refreshServer(server);
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.FINEST, "Error in Servers view animation", e);
+ }
+ display.timerExec(SLEEP, animator[0]);
+ }
+ }
+ };
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ display.timerExec(SLEEP, animator[0]);
+ }
+ });
+ }
+
+ protected void stopThread() {
+ stopAnimation = true;
+ }}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerDecorator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerDecorator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerDecorator.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -0,0 +1,196 @@
+package org.eclipse.wst.server.ui.internal.view.servers.provisional;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILightweightLabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.server.ui.internal.ImageResource;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
+import org.eclipse.wst.server.ui.internal.provisional.UIDecoratorManager;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
+
+public class ServerDecorator extends LabelProvider implements ILightweightLabelDecorator {
+
+ public static final String[] syncState = new String[] {
+ Messages.viewSyncOkay,
+ Messages.viewSyncRestart,
+ Messages.viewSyncPublish,
+ Messages.viewSyncRestartPublish,
+ Messages.viewSyncPublishing};
+
+ public static final String[] syncStateUnmanaged = new String[] {
+ Messages.viewSyncOkay2,
+ Messages.viewSyncRestart2,
+ Messages.viewSyncPublish2,
+ Messages.viewSyncRestartPublish2,
+ Messages.viewSyncPublishing2};
+
+ public static final String[] modulePublishState = new String[] {
+ "",
+ Messages.viewSyncOkay,
+ Messages.viewSyncPublish,
+ Messages.viewSyncPublish};
+
+ private static ServerDecorator instance;
+ public static ServerDecorator getDefault() {
+ return instance;
+ }
+
+ private static int count = 0;
+ public static void animate() {
+ count = (count + 1)%3;
+ }
+ public static int getCount() {
+ return count;
+ }
+
+ public ServerDecorator() {
+ instance = this;
+ }
+
+ public void decorate(Object element, IDecoration decoration) {
+ if( element instanceof IServer ) {
+ String state = getServerStateLabel((IServer)element);
+ String status = getServerStatusLabel((IServer)element);
+ decoration.addSuffix(combine(state, status));
+ } else if( element instanceof ModuleServer ) {
+ String state = getModuleStateText((ModuleServer)element);
+ String status = getModuleStatusText((ModuleServer)element);
+ decoration.addSuffix(combine(state, status));
+ }
+ }
+
+ protected String combine(String state, String status) {
+ if(isEmpty(state) && isEmpty(status))
+ return "";
+ if( isEmpty(state))
+ return " [" + status + "]";
+ if( isEmpty(status))
+ return " [" + state + "]";
+ return " [" + state + ", " + status + "]";
+ }
+
+ protected boolean isEmpty(String s) {
+ return (s == null || "".equals(s));
+ }
+
+ public void redecorate(IServer server) {
+ fireLabelProviderChanged(new LabelProviderChangedEvent(this));
+ }
+
+
+
+ /*
+ * Utility methods
+ */
+ public static Image getServerImage(IServer server) {
+ return server == null ? null :
+ server.getServerType() == null ? null :
+ ImageResource.getImage(server.getServerType().getId());
+ }
+
+ public static String getServerStateLabel(IServer server) {
+ return server == null ? null :
+ server.getServerType() == null ? null :
+ getStateLabel(server.getServerType(), server.getServerState(), server.getMode());
+ }
+
+ public static String getStateLabel(IServerType serverType, int state, String mode) {
+ return serverType == null ? null :
+ UIDecoratorManager.getUIDecorator(serverType).getStateLabel(state, mode, count);
+ }
+
+ public static String getServerStatusLabel(IServer server) {
+ IStatus status = ((Server) server).getServerStatus();
+ if (status != null)
+ return status.getMessage();
+
+ if (server.getServerType() == null)
+ return "";
+
+ if (server.getServerState() == IServer.STATE_UNKNOWN)
+ return "";
+
+ String serverId = server.getId();
+ if (ServerContentProvider.publishing.contains(serverId))
+ return ServerDecorator.syncState[4];
+
+ // republish
+ int i = 0;
+ if (server.shouldPublish()) {
+ if (((Server)server).isPublishUnknown())
+ return "";
+ i += 2;
+ }
+
+ if (server.shouldRestart())
+ i = 1;
+
+ return syncState[i];
+ }
+
+ public static Image getServerStateImage(IServer server) {
+ return server == null ? null :
+ getStateImage(server.getServerType(), server.getServerState(), server.getMode());
+ }
+
+ public static Image getStateImage(IServerType serverType, int state, String mode) {
+ return serverType == null ? null :
+ UIDecoratorManager.getUIDecorator(serverType).getStateImage(state, mode, getCount());
+ }
+
+ public static String getModuleText(ModuleServer ms ) {
+ if (ms == null || ms.module == null)
+ return "";
+ int size = ms.module.length;
+ return ms.module[size - 1].getName();
+ }
+
+ public static Image getModuleImage(ModuleServer ms) {
+ if( ms != null ) {
+ ILabelProvider labelProvider = ServerUICore.getLabelProvider();
+ Image image = labelProvider.getImage(ms.module[ms.module.length - 1]);
+ labelProvider.dispose();
+ return image;
+ }
+ return null;
+ }
+
+ public static String getModuleStateText(ModuleServer ms) {
+ return "";
+ }
+
+ public static String getModuleStatusText(ModuleServer ms) {
+ if( ms != null && ms.server != null && ms.module != null ) {
+ IStatus status = ((Server) ms.server).getModuleStatus(ms.module);
+ if (status != null)
+ return status.getMessage();
+
+ return modulePublishState[ms.server.getModulePublishState(ms.module)];
+ }
+ return "";
+ }
+
+ public static Image getModuleStatusImage(ModuleServer ms) {
+ IStatus status = ((Server) ms.server).getModuleStatus(ms.module);
+ if (status != null) {
+ ISharedImages sharedImages = ServerUIPlugin.getInstance().getWorkbench().getSharedImages();
+ if (status.getSeverity() == IStatus.ERROR)
+ return sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ else if (status.getSeverity() == IStatus.WARNING)
+ return sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ else if (status.getSeverity() == IStatus.INFO)
+ return sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
+ }
+ return null;
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerLabelProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerLabelProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServerLabelProvider.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.ui.internal.view.servers.provisional;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.server.ui.internal.ImageResource;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
+/**
+ * Server table label provider.
+ */
+public class ServerLabelProvider extends LabelProvider {
+
+ /**
+ * ServerTableLabelProvider constructor comment.
+ */
+ public ServerLabelProvider() {
+ super();
+ }
+
+ public String getText(Object element) {
+ if (element instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) element;
+ if (ms.module == null)
+ return "";
+ int size = ms.module.length;
+ String name = ms.module[size - 1].getName();
+ return name;
+ }
+
+ if( element instanceof IServer ) {
+ IServer server = (IServer) element;
+ return notNull(server.getName());
+ }
+
+ if( element == ServerContentProvider.INITIALIZING)
+ return Messages.viewInitializing;
+
+ return "-";
+ }
+ public Image getImage(Object element) {
+ Image image = null;
+ if (element instanceof ModuleServer) {
+ ModuleServer ms = (ModuleServer) element;
+ ILabelProvider labelProvider = ServerUICore.getLabelProvider();
+ image = labelProvider.getImage(ms.module[ms.module.length - 1]);
+ labelProvider.dispose();
+ } else if( element instanceof IServer ) {
+ IServer server = (IServer) element;
+ if (server.getServerType() != null) {
+ image = ImageResource.getImage(server.getServerType().getId());
+ }
+ }
+ return image;
+ }
+
+ protected String notNull(String s) {
+ if (s == null)
+ return "";
+ return s;
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+}
\ No newline at end of file
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServersView.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServersView.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/ServersView.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.ui.internal.view.servers.provisional;
+
+import org.eclipse.ui.navigator.CommonNavigator;
+/**
+ * A view of servers, their modules, and status.
+ */
+public class ServersView extends CommonNavigator {
+ /**
+ * ServersView constructor comment.
+ */
+ public ServersView() {
+ super();
+ }
+}
\ No newline at end of file
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogActionProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogActionProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogActionProvider.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -0,0 +1,72 @@
+package org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.ServerEventModel;
+import org.jboss.ide.eclipse.as.ui.dialogs.ShowStackTraceDialog;
+
+public class EventLogActionProvider extends CommonActionProvider {
+ private Action clearLogAction;
+ private Action showStackTraceAction;
+ private ICommonActionExtensionSite actionSite;
+ public EventLogActionProvider() {
+ super();
+ }
+
+ public void init(ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ this.actionSite = aSite;
+ createActions();
+ }
+ public void fillContextMenu(IMenuManager menu) {
+ ICommonViewerSite site = actionSite.getViewSite();
+ IStructuredSelection selection = null;
+ if( site instanceof ICommonViewerWorkbenchSite ) {
+ ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite)site;
+ selection = (IStructuredSelection) wsSite.getSelectionProvider().getSelection();
+ Object first = selection.getFirstElement();
+ if( first != null && first instanceof ServerEventModel) {
+ menu.add(clearLogAction);
+ }
+ if( first != null && first instanceof EventLogTreeItem &&
+ (((EventLogTreeItem)first).getEventClass().equals(EventLogModel.EVENT_TYPE_EXCEPTION) ||
+ ((EventLogTreeItem)first).getSpecificType().equals(EventLogModel.EVENT_TYPE_EXCEPTION))) {
+ menu.add(showStackTraceAction);
+ }
+ }
+ }
+
+
+ protected void createActions() {
+ clearLogAction = new Action() {
+ public void run() {
+ IStructuredSelection selection = (IStructuredSelection)actionSite.getStructuredViewer().getSelection();
+ if(selection.getFirstElement() != null && selection.getFirstElement() instanceof ServerEventModel) {
+ ((ServerEventModel)selection.getFirstElement()).clearEvents();
+ actionSite.getStructuredViewer().refresh(((ServerEventModel)selection.getFirstElement()));
+ }
+ }
+ };
+ clearLogAction.setText("Clear Event Log");
+
+ showStackTraceAction = new Action() {
+ public void run() {
+ IStructuredSelection selection = (IStructuredSelection)actionSite.getStructuredViewer().getSelection();
+ if( selection.getFirstElement() != null && selection.getFirstElement() instanceof EventLogTreeItem ) {
+ EventLogTreeItem item = (EventLogTreeItem)selection.getFirstElement();
+ ShowStackTraceDialog dialog = new ShowStackTraceDialog(new Shell(), item);
+ dialog.open();
+ }
+ }
+ };
+ showStackTraceAction.setText("See Exception Details");
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogContentProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogContentProvider.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -0,0 +1,165 @@
+package org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogRoot;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.IEventLogListener;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.ServerEventModel;
+import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+
+public class EventLogContentProvider implements ITreeContentProvider {
+ public static final String SHOW_TIMESTAMP = "org.jboss.ide.eclipse.as.ui.views.server.providers.EventLogViewProvider.showTimestamp";
+ public static final String GROUP_BY_CATEGORY = "org.jboss.ide.eclipse.as.ui.views.server.providers.EventLogViewProvider.groupByCategory";
+ public static final String EVENT_ON_TOP = "org.jboss.ide.eclipse.as.ui.views.server.providers.EventLogViewProvider.eventOnTop";
+ public static final int NEWEST_ON_TOP = 1;
+ public static final int OLDEST_ON_TOP = 2;
+ public static final int _TRUE_ = 1;
+ public static final int _FALSE_ = 2;
+
+ private Viewer viewer;
+
+ public EventLogContentProvider() {
+ EventLogModel.enableLogging();
+ EventLogModel.getDefault().addListener(new IEventLogListener() {
+ public void eventModelChanged(String serverId,
+ EventLogTreeItem changed) {
+ if( viewer instanceof StructuredViewer ) {
+ final Object o = changed.getEventRoot();
+ if( o instanceof EventLogRoot) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ((StructuredViewer)viewer).refresh(((EventLogRoot)o).getModel());
+ }
+ });
+ }
+ }
+ }
+ });
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if( parentElement instanceof IServer && parentElement != null ) {
+ return new Object[] { EventLogModel.getModel((IServer)parentElement)};
+ }
+ if( parentElement instanceof ServerEventModel) {
+ ServerEventModel s = ((ServerEventModel)parentElement);
+ boolean categorize = getCategorize();
+ if( categorize )
+ return getRootCategories(s);
+ Object[] ret = s.getRoot().getChildren();
+ if( getSortOrder()) {
+ List<Object> l = Arrays.asList(ret);
+ Collections.reverse(l);
+ return l.toArray();
+ }
+ return ret;
+ }
+
+ if( parentElement instanceof MajorEventType ) {
+ // get children only of this type
+ String serverId = ((MajorEventType)parentElement).getServer();
+ SimpleTreeItem[] children = EventLogModel.getModel(serverId).getRoot().getChildren();
+ ArrayList<SimpleTreeItem> items = new ArrayList<SimpleTreeItem>();
+ for( int i = 0; i < children.length; i++ ) {
+ if( children[i] instanceof EventLogTreeItem ) {
+ String type = ((EventLogTreeItem)children[i]).getEventClass();
+ if( type != null && type.equals(((MajorEventType)parentElement).getId()))
+ items.add(children[i]);
+ }
+ }
+
+ if( getSortOrder() ) Collections.reverse(items);
+
+ return items.toArray(new Object[items.size()]);
+ }
+
+ // just return the object's kids
+ if( parentElement instanceof EventLogTreeItem ) {
+ return ((EventLogTreeItem)parentElement).getChildren();
+ }
+ return new Object[0];
+ }
+
+ public static class MajorEventType {
+ private String id;
+ private String serverId;
+ public MajorEventType(String serverId, String id) {
+ this.id = id;
+ this.serverId = serverId;
+ }
+ public String getId() {
+ return id;
+ }
+ public String getServer() { return serverId; }
+ public String toString() { return id; }
+ public boolean equals(Object o) {
+ return o instanceof MajorEventType &&
+ ((MajorEventType)o).getId().equals(id) &&
+ ((MajorEventType)o).getServer().equals(serverId);
+ }
+ }
+
+ protected Object[] getRootCategories(ServerEventModel model) {
+ EventLogRoot root = model.getRoot();
+ ArrayList<String> list = new ArrayList<String>();
+ ArrayList<MajorEventType> majorTypes = new ArrayList<MajorEventType>();
+ SimpleTreeItem[] children = root.getChildren();
+ for( int i = 0; i < children.length; i++ ) {
+ if( children[i] instanceof EventLogTreeItem ) {
+ String type = ((EventLogTreeItem)children[i]).getEventClass();
+ if( !list.contains(type)) {
+ list.add(type);
+ majorTypes.add(new MajorEventType(model.getId(), type));
+ }
+ }
+ }
+ return majorTypes.toArray(new MajorEventType[majorTypes.size()]);
+ }
+
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0 ? true : false;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return null;
+ }
+
+ public void dispose() {
+ EventLogModel.disableLogging();
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ this.viewer = viewer;
+ }
+
+ protected boolean getSortOrder() {
+ Preferences store = JBossServerUIPlugin.getDefault().getPluginPreferences();
+ int showTimestamp = store.getInt(EVENT_ON_TOP);
+ if( showTimestamp == OLDEST_ON_TOP) return false;
+ return true;
+ }
+ protected boolean getCategorize() {
+ Preferences store = JBossServerUIPlugin.getDefault().getPluginPreferences();
+ int showTimestamp = store.getInt(GROUP_BY_CATEGORY);
+ if( showTimestamp == _TRUE_ ) return true;
+ if( showTimestamp == _FALSE_) return false;
+ return false; // default
+ }
+}
\ No newline at end of file
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogLabelProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogLabelProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/EventLogLabelProvider.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -0,0 +1,147 @@
+package org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions;
+
+import java.util.Date;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.EventLogContentProvider.MajorEventType;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.ServerEventModel;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+import org.jboss.ide.eclipse.as.ui.views.server.extensions.IEventLogLabelProvider;
+import org.jboss.ide.eclipse.as.ui.views.server.extensions.ServerViewProvider;
+
+public class EventLogLabelProvider extends LabelProvider {
+
+ public static final String SHOW_TIMESTAMP = "org.jboss.ide.eclipse.as.ui.views.server.providers.EventLogViewProvider.showTimestamp";
+ public static final int _TRUE_ = 1;
+ public static final int _FALSE_ = 2;
+ private static HashMap<String, String> majorTypeToName = new HashMap<String, String>();
+
+ static {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(JBossServerUIPlugin.PLUGIN_ID, "EventLogMajorType");
+ for( int i = 0; i < cf.length; i++ ) {
+ String type = cf[i].getAttribute("typeId");
+ String name = cf[i].getAttribute("name");
+ majorTypeToName.put(type, name);
+ }
+ }
+
+ private Image rootImage;
+ public EventLogLabelProvider() {
+ super();
+ ImageDescriptor des = ImageDescriptor.createFromURL(JBossServerUIPlugin.getDefault().getBundle().getEntry("icons/info_obj.gif"));
+ rootImage = des.createImage();
+ }
+ public void dispose() {
+ super.dispose();
+ rootImage.dispose();
+ }
+
+ private IEventLogLabelProvider[] labelProviderDelegates = null;
+ public Image getImage(Object element) {
+ if( labelProviderDelegates == null )
+ loadLabelProviderDelegates();
+
+ if( element instanceof ServerEventModel ) {
+ return rootImage;
+ }
+
+ if( !(element instanceof EventLogTreeItem))
+ return null;
+
+ EventLogTreeItem item = (EventLogTreeItem)element;
+ for( int i = 0; i < labelProviderDelegates.length; i++ ) {
+ if( labelProviderDelegates[i] != null
+ && labelProviderDelegates[i].supports(item.getSpecificType())) {
+ Image image = labelProviderDelegates[i].getImage((EventLogTreeItem)element);
+ if( image != null ) return image;
+ }
+ }
+
+ return null;
+ }
+
+ public String getText(Object element) {
+ if( element == null ) return "ERROR: Unknown String type";
+
+ if( element instanceof ServerEventModel ) {
+ return "Event Log";
+ }
+
+
+ String suffix = getShowTimestamp() ? createTimestamp(element) : "";
+ if( labelProviderDelegates == null )
+ loadLabelProviderDelegates();
+
+ if( element instanceof ServerViewProvider ) {
+ return ((ServerViewProvider)element).getName();
+ }
+
+ if( !(element instanceof EventLogTreeItem)) {
+ if( element instanceof MajorEventType ) {
+ String val = majorTypeToName.get(((MajorEventType)element).getId());
+ if( val != null ) return val;
+ }
+ return element.toString();
+ }
+ EventLogTreeItem item = (EventLogTreeItem)element;
+
+ for( int i = 0; i < labelProviderDelegates.length; i++ ) {
+ if( labelProviderDelegates[i] != null
+ && labelProviderDelegates[i].supports(item.getSpecificType())) {
+ String text = labelProviderDelegates[i].getText((EventLogTreeItem)element);
+ if( text != null ) return text + suffix;
+ }
+ }
+
+ return element == null ? "" : element.toString() + suffix;
+ }
+
+ public void loadLabelProviderDelegates() {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(JBossServerUIPlugin.PLUGIN_ID, "EventLogLabelProvider");
+ labelProviderDelegates = new IEventLogLabelProvider[elements.length];
+ for( int i = 0; i < elements.length; i++ ) {
+ try {
+ labelProviderDelegates[i] = (IEventLogLabelProvider)elements[i].createExecutableExtension("class");
+ } catch( CoreException ce ) {
+ JBossServerUIPlugin.log("Error loading Event Log Label Provider Delegate", ce);
+ }
+ }
+ }
+ protected boolean getShowTimestamp() {
+ Preferences store = JBossServerUIPlugin.getDefault().getPluginPreferences();
+ int showTimestamp = store.getInt(SHOW_TIMESTAMP);
+ if( showTimestamp == _TRUE_ ) return true;
+ if( showTimestamp == _FALSE_) return false;
+ return false; // default
+ }
+
+ protected String createTimestamp(Object element) {
+ if( element instanceof EventLogTreeItem ) {
+ Long v = (Long) ((EventLogTreeItem)element).getProperty(EventLogTreeItem.DATE);
+ if( v == null ) return "";
+
+ double date = v.doubleValue();
+ double now = new Date().getTime();
+ int seconds = (int) (( now - date) / 1000);
+ int minutes = seconds / 60;
+ int hours = minutes / 60;
+ minutes -= (hours * 60);
+ String minString = minutes + "m ago";
+ if( hours == 0 )
+ return " (" + minString + ")";
+ return " (" + hours + "h " + minString + ")";
+ }
+ return "";
+ }
+}
\ No newline at end of file
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/XPathProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/XPathProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/eclipse/wst/server/ui/internal/view/servers/provisional/extensions/XPathProvider.java 2008-10-17 00:04:13 UTC (rev 10904)
@@ -0,0 +1,457 @@
+package org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILightweightLabelDecorator;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.XPathProvider.XPathTreeContentProvider.ServerWrapper;
+import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathCategory;
+import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathFileResult;
+import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathModel;
+import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathQuery;
+import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathFileResult.XPathResultNode;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+import org.jboss.ide.eclipse.as.ui.Messages;
+import org.jboss.ide.eclipse.as.ui.dialogs.XPathDialogs;
+import org.jboss.ide.eclipse.as.ui.dialogs.XPathDialogs.XPathCategoryDialog;
+import org.jboss.ide.eclipse.as.ui.dialogs.XPathDialogs.XPathDialog;
+
+public class XPathProvider {
+ public static class XPathTreeContentProvider implements
+ ITreeContentProvider {
+
+ public static class DelayProxy {}
+ public static final DelayProxy LOADING = new DelayProxy();
+
+ private Viewer viewer;
+ private ArrayList<XPathCategory> loading = new ArrayList<XPathCategory>();
+
+ public class ServerWrapper {
+ public IServer server;
+
+ public ServerWrapper(IServer server) {
+ this.server = server;
+ }
+ public int hashCode() {
+ return server.getId().hashCode();
+ }
+ public boolean equals(Object other) {
+ return other instanceof ServerWrapper &&
+ ((ServerWrapper)other).server.getId().equals(server.getId());
+ }
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement == null)
+ return new Object[] {};
+ if (parentElement instanceof IServer) {
+ return new Object[] { new ServerWrapper((IServer) parentElement) };
+ }
+
+ if (parentElement instanceof ServerWrapper) {
+ return XPathModel.getDefault().getCategories(
+ ((ServerWrapper) parentElement).server);
+ }
+
+ if( parentElement instanceof XPathCategory) {
+ if( ((XPathCategory)parentElement).isLoaded())
+ return ((XPathCategory)parentElement).getQueries();
+
+ if( !loading.contains((XPathCategory)parentElement))
+ launchLoad((XPathCategory)parentElement);
+
+ return new Object[] { LOADING };
+ }
+
+ // we're the named element (JNDI)
+ if( parentElement instanceof XPathQuery) {
+ if( XPathProvider.getResultNodes((XPathQuery)parentElement).length == 1 ) {
+ return new Object[0];
+ } else {
+ return ((XPathQuery)parentElement).getResults();
+ }
+ }
+
+ // we're a file node (blah.xml)
+ if( parentElement instanceof XPathFileResult ) {
+ if( ((XPathFileResult)parentElement).getChildren().length == 1 )
+ return new Object[0];
+ return ((XPathFileResult)parentElement).getChildren();
+ }
+
+ if( parentElement instanceof XPathResultNode ) {
+ return new Object[0];
+ }
+
+
+ return new Object[0];
+ }
+
+
+ protected void launchLoad(final XPathCategory cat) {
+ new Job("Loading XPaths") {
+ protected IStatus run(IProgressMonitor monitor) {
+ loading.add(cat);
+ XPathQuery[] queries = cat.getQueries();
+ XPathFileResult[] results;
+ for( int i = 0; i < queries.length; i++ ) {
+ results = queries[i].getResults();
+ for( int j = 0; j < results.length; j++ ) {
+ results[j].getChildren();
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ loading.remove(cat);
+ ((StructuredViewer)viewer).refresh(cat.getServer());
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ }.schedule(200);
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0 ? true : false;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return new Object[0];
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ this.viewer = viewer;
+ }
+ }
+
+ public static class XPathTreeLabelProvider extends LabelProvider {
+ private Image rootImage;
+ public XPathTreeLabelProvider() {
+ super();
+ ImageDescriptor des = ImageDescriptor.createFromURL(JBossServerUIPlugin.getDefault().getBundle().getEntry("icons/XMLFile.gif"));
+ rootImage = des.createImage();
+ }
+
+ public Image getImage(Object element) {
+ if( element instanceof ServerWrapper )
+ return rootImage;
+
+ if (element instanceof XPathCategory)
+ return PlatformUI.getWorkbench().getSharedImages().getImage(
+ ISharedImages.IMG_OBJ_FOLDER);
+
+ return null;
+ }
+
+ public String getText(Object element) {
+ if( element instanceof ServerWrapper )
+ return "XML Configuration";
+ if( element == XPathTreeContentProvider.LOADING )
+ return "Loading...";
+
+ if (element instanceof XPathCategory)
+ return ((XPathCategory) element).getName();
+
+ if( element instanceof XPathQuery )
+ return ((XPathQuery)element).getName();
+
+ if( element instanceof XPathFileResult )
+ return ((XPathFileResult)element).getFileLocation();
+
+ return "";
+ }
+
+ public XPathResultNode[] getResultNodes(XPathQuery query) {
+ ArrayList<XPathResultNode> l = new ArrayList<XPathResultNode>();
+ XPathFileResult[] files = query.getResults();
+ for( int i = 0; i < files.length; i++ ) {
+ l.addAll(Arrays.asList(files[i].getChildren()));
+ }
+ return l.toArray(new XPathResultNode[l.size()]);
+ }
+ }
+
+ public static class XMLActionProvider extends CommonActionProvider {
+
+ private ICommonActionExtensionSite actionSite;
+ public Action newXPathCategoryAction, deleteXPathCategoryAction,
+ newXPathAction, editXPathAction, deleteXPathAction,
+ editFileAction;
+ private Object selectedNode;
+
+ public void init(ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ this.actionSite = aSite;
+ createActions();
+ }
+
+ public void createActions() {
+ newXPathCategoryAction = new Action() {
+ public void run() {
+ XPathCategoryDialog d = new XPathCategoryDialog(Display
+ .getCurrent().getActiveShell(), getServer());
+ if (d.open() == Window.OK) {
+ XPathModel.getDefault()
+ .addCategory(getServer(), d.getText());
+ XPathModel.getDefault().save(getServer());
+ refreshViewer();
+ }
+ }
+ };
+ newXPathCategoryAction.setText("New Category");
+
+ deleteXPathCategoryAction = new Action() {
+ public void run() {
+ int style = SWT.APPLICATION_MODAL | SWT.YES | SWT.NO;
+ MessageBox messageBox = new MessageBox(Display.getCurrent()
+ .getActiveShell(), style);
+ messageBox.setText(Messages.DescriptorXPathRemoveCategory
+ + "?");
+ messageBox
+ .setMessage(Messages.DescriptorXPathRemoveCategoryDesc);
+ if (messageBox.open() == SWT.YES) {
+ XPathModel.getDefault().removeCategory(getServer(),
+ ((XPathCategory)selectedNode).getName());
+ XPathModel.getDefault().save(getServer());
+ refreshViewer();
+ }
+ }
+ };
+ deleteXPathCategoryAction
+ .setText(Messages.DescriptorXPathRemoveCategory);
+
+ newXPathAction = new Action() {
+ public void run() {
+ XPathCategory category = (XPathCategory)selectedNode;
+ if (category != null) {
+ String categoryName = category.getName();
+ XPathDialog d = new XPathDialog(Display.getCurrent()
+ .getActiveShell(), getServer(), categoryName);
+ if (d.open() == Window.OK) {
+ XPathCategory[] categoryList = XPathModel
+ .getDefault().getCategories(getServer());
+ XPathCategory categoryItem = null;
+ for (int i = 0; i < categoryList.length; i++) {
+ if (categoryList[i].getName().equals(
+ category.getName()))
+ categoryItem = categoryList[i];
+ }
+ if (categoryItem != null) {
+ XPathQuery query = new XPathQuery(d.getName(),
+ XPathDialogs.getConfigFolder(getServer()),
+ null, d.getXpath(), d.getAttribute());
+ categoryItem.addQuery(query);
+ XPathModel.getDefault().save(getServer());
+ refreshViewer();
+ }
+ }
+ }
+ }
+ };
+ newXPathAction.setText(Messages.DescriptorXPathNewXPath);
+
+ editXPathAction = new Action() {
+ public void run() {
+ Object o = selectedNode;
+ if (o != null && o instanceof XPathQuery) {
+ XPathQuery original = (XPathQuery) o;
+ XPathCategory category = original.getCategory();
+
+ XPathDialog d = new XPathDialog(Display.getCurrent()
+ .getActiveShell(), getServer(), category.getName(),
+ original.getName());
+ d.setAttribute(original.getAttribute());
+ d.setXpath(original.getXpathPattern());
+
+ if (d.open() == Window.OK) {
+ original.setAttribute(d.getAttribute());
+ original.setXpathPattern(d.getXpath());
+ original.setName(d.getName());
+ category.save();
+ refreshViewer();
+ }
+ }
+ }
+ };
+ editXPathAction.setText(Messages.DescriptorXPathEditXPath);
+
+ deleteXPathAction = new Action() {
+ public void run() {
+ Object o = selectedNode;
+ if (o instanceof XPathQuery) {
+ XPathCategory cat = ((XPathQuery) o).getCategory();
+ cat.removeQuery((XPathQuery) o);
+ cat.save();
+ refreshViewer();
+ }
+ }
+ };
+ deleteXPathAction.setText(Messages.DescriptorXPathDeleteXPath);
+
+ editFileAction = new Action() {
+ public void run() {
+ try {
+ Object o = selectedNode;
+ Path p = null;
+ if (o instanceof XPathQuery
+ && ((XPathQuery) o).getResults().length == 1) {
+ o = (XPathFileResult) ((XPathQuery) o).getResults()[0];
+ }
+ if (o instanceof XPathFileResult) {
+ p = new Path(((XPathFileResult) o)
+ .getFileLocation());
+ } else if (o instanceof XPathResultNode) {
+ p = new Path(((XPathResultNode) o)
+ .getFileLocation());
+ }
+ if (p != null) {
+
+ IFileStore fileStore = EFS.getLocalFileSystem()
+ .getStore(p.removeLastSegments(1));
+ fileStore = fileStore.getChild(p.lastSegment());
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = wb
+ .getActiveWorkbenchWindow();
+ IWorkbenchPage page = win.getActivePage();
+
+ if (!fileStore.fetchInfo().isDirectory()
+ && fileStore.fetchInfo().exists()) {
+ try {
+ IDE.openEditorOnFileStore(page, fileStore);
+ } catch (PartInitException e) {
+ }
+ }
+ }
+ } catch (Exception exc) {
+ JBossServerUIPlugin.log(
+ "Error running edit file action", exc);
+ }
+ }
+ };
+ editFileAction.setText("Edit File");
+ }
+
+ public void fillContextMenu(IMenuManager menu) {
+ ICommonViewerSite site = actionSite.getViewSite();
+ IStructuredSelection selection = null;
+ if (site instanceof ICommonViewerWorkbenchSite) {
+ ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site;
+ selection = (IStructuredSelection) wsSite
+ .getSelectionProvider().getSelection();
+ Object first = selection.getFirstElement();
+ if( first == null )
+ return;
+
+ if (first instanceof ServerWrapper) {
+ menu.add(newXPathCategoryAction);
+ menu.add(new Separator());
+ return;
+ }
+
+ if (first instanceof XPathCategory) {
+
+ menu.add(newXPathAction);
+ menu.add(deleteXPathCategoryAction);
+ menu.add(new Separator());
+ return;
+ }
+
+ if( first instanceof XPathQuery) {
+ selectedNode = first;
+ menu.add(newXPathAction);
+ menu.add(editXPathAction);
+ menu.add(deleteXPathAction);
+ }
+ if( (first instanceof XPathResultNode || first instanceof XPathFileResult ) ||
+ (first instanceof XPathQuery && ((XPathQuery)first).getResults().length == 1)) {
+ menu.add(editFileAction);
+ }
+ }
+ }
+
+ protected void refreshViewer() {
+ actionSite.getStructuredViewer().refresh();
+ }
+
+ protected IServer getServer() {
+ Object o = selectedNode;
+ if( o instanceof ServerWrapper) return ((ServerWrapper)o).server;
+ if( o instanceof XPathCategory) return ((XPathCategory)o).getServer();
+ if( o instanceof XPathQuery) return ((XPathQuery)o).getCategory().getServer();
+ if( o instanceof XPathFileResult) return ((XPathFileResult)o).getQuery().getCategory().getServer();
+ if( o instanceof XPathResultNode) return ((XPathResultNode)o).getFile().getQuery().getCategory().getServer();
+ return null;
+ }
+ }
+
+
+ public static class XMLDecorator extends LabelProvider implements ILightweightLabelDecorator {
+ public void decorate(Object element, IDecoration decoration) {
+ if( element instanceof XPathQuery) {
+ XPathResultNode[] nodes = getResultNodes((XPathQuery)element);
+ if(nodes.length == 1 ) {
+ decoration.addSuffix(" " + nodes[0].getText());
+ }
+ return;
+ }
+
+ // we're a file node (blah.xml)
+ if( element instanceof XPathFileResult ) {
+ XPathResultNode[] nodes = ((XPathFileResult)element).getChildren();
+ if( nodes.length == 1 )
+ decoration.addSuffix(" " + nodes[0].getText());
+ }
+ }
+ }
+
+ public static XPathResultNode[] getResultNodes(XPathQuery query) {
+ ArrayList<XPathResultNode> l = new ArrayList<XPathResultNode>();
+ XPathFileResult[] files = query.getResults();
+ for( int i = 0; i < files.length; i++ ) {
+ l.addAll(Arrays.asList(files[i].getChildren()));
+ }
+ return l.toArray(new XPathResultNode[l.size()]);
+ }
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2008-10-16 18:17:33 UTC (rev 10903)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2008-10-17 00:04:13 UTC (rev 10904)
@@ -209,7 +209,7 @@
typeId="org.jboss.ide.eclipse.as.core.runtime.server.polling.MajorType"/>
<MajorType
name="Publish Events"
- typeId="org.jboss.ide.eclipse.as.core.publishers.MajorType"/>
+ typeId="org.jboss.ide.eclipse.as.core.publishers.Events.MajorType"/>
</extension>
<extension
point="org.eclipse.wst.server.ui.editorPageSections">
@@ -324,4 +324,199 @@
</extension>
+
+<!-- Provisional stuff to be contributed to Webtools -->
+
+ <extension point="org.eclipse.ui.views">
+ <view
+ id="org.eclipse.wst.server.ui.ServersViewProvisional"
+ name="JBoss Servers View 2 (beta)"
+ category="org.eclipse.wst.server.ui"
+ class="org.eclipse.wst.server.ui.internal.view.servers.provisional.ServersView"
+ icon="icons/jboss.gif"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.decorators">
+ <decorator
+ class="org.eclipse.wst.server.ui.internal.view.servers.provisional.ServerDecorator"
+ icon="icons/obj16/server.gif"
+ id="org.eclipse.wst.server.ui.navigatorDecorator"
+ label="Server State Decorator"
+ lightweight="true"
+ location="BOTTOM_RIGHT">
+ <enablement>
+ <or>
+ <objectClass
+ name="org.eclipse.wst.server.core.IServer">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.wst.server.ui.internal.view.servers.ModuleServer">
+ </objectClass>
+ </or>
+ </enablement>
+ </decorator>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ activeByDefault="true"
+ contentProvider="org.eclipse.wst.server.ui.internal.view.servers.provisional.ServerContentProvider"
+ icon="icons/cview16/servers_view.gif"
+ id="org.eclipse.wst.server.ui.ServersView.content.root"
+ labelProvider="org.eclipse.wst.server.ui.internal.view.servers.provisional.ServerLabelProvider"
+ name="Servers View Default Content"
+ priority="highest">
+ <triggerPoints>
+ <instanceof
+ value="org.eclipse.wst.server.core.internal.ServerPlugin">
+ </instanceof>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof
+ value="org.eclipse.wst.server.core.IServer">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.wst.server.ui.internal.view.servers.ModuleServer">
+ </instanceof>
+ </or></possibleChildren>
+ <actionProvider
+ class="org.eclipse.wst.server.ui.internal.view.servers.provisional.ServerActionProvider"
+ id="org.eclipse.wst.server.ui.internal.view.servers.provisional.ServerActionProvider"
+ priority="highest">
+ </actionProvider>
+ </navigatorContent>
+ </extension>
+ <extension
+ point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding
+ viewerId="org.eclipse.wst.server.ui.ServersViewProvisional">
+ <includes>
+ <contentExtension
+ isRoot="true"
+ pattern="org.eclipse.wst.server.ui.ServersView.content.root">
+ </contentExtension>
+ </includes>
+ </viewerContentBinding>
+ </extension>
+
+
+
+ <!-- Extensions to new Server View -->
+
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ id="org.jboss.ide.eclipse.as.ui.extensions.eventLog"
+ activeByDefault="true"
+ icon="icons/info_obj.gif"
+ contentProvider="org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.EventLogContentProvider"
+ labelProvider="org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.EventLogLabelProvider"
+ name="JBoss Server Event Log"
+ priority="normal">
+ <triggerPoints>
+ <instanceof
+ value="org.eclipse.wst.server.core.IServer">
+ </instanceof>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof
+ value="org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel$EventLogTreeItem">
+ </instanceof>
+ <instanceof
+ value="org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel$ServerEventModel">
+ </instanceof>
+ </or></possibleChildren>
+ <actionProvider
+ class="org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.EventLogActionProvider"
+ id="org.jboss.ide.eclipse.as.ui.extensions.eventLog.actions"
+ priority="highest">
+ </actionProvider>
+ </navigatorContent>
+ <navigatorContent
+ activeByDefault="true"
+ contentProvider="org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.XPathProvider$XPathTreeContentProvider"
+ icon="icons/XMLFile.gif"
+ id="org.jboss.ide.eclipse.as.ui.extensions.xml"
+ labelProvider="org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.XPathProvider$XPathTreeLabelProvider"
+ name="XML Configuration"
+ priority="normal">
+ <triggerPoints>
+ <instanceof
+ value="org.eclipse.wst.server.core.IServer">
+ </instanceof>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof
+ value="org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.XPathProvider$XPathTreeContentProvider$ServerWrapper">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.XPathProvider$XPathTreeContentProvider$DelayProxy">
+ </instanceof>
+ <instanceof
+ value="org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathCategory">
+ </instanceof>
+ <instanceof
+ value="org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathQuery">
+ </instanceof>
+ <instanceof
+ value="org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathFileResult">
+ </instanceof>
+ <instanceof
+ value="org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathFileResult$XPathResultNode">
+ </instanceof></or>
+ </possibleChildren>
+ <actionProvider
+ class="org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.XPathProvider$XMLActionProvider"
+ id="org.jboss.ide.eclipse.as.ui.extensions.eventLog.actions"
+ priority="highest">
+ </actionProvider>
+ </navigatorContent>
+ </extension>
+ <extension
+ point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding
+ viewerId="org.eclipse.wst.server.ui.ServersViewProvisional">
+ <includes>
+ <contentExtension
+ isRoot="false"
+ pattern="org.jboss.ide.eclipse.as.ui.extensions.eventLog">
+ </contentExtension>
+ <contentExtension
+ isRoot="false"
+ pattern="org.jboss.ide.eclipse.as.ui.extensions.xml">
+ </contentExtension>
+ </includes>
+ </viewerContentBinding>
+ </extension>
+
+
+
+ <!-- Decorator for xpaths / xml-->
+ <extension point="org.eclipse.ui.decorators">
+ <decorator
+ class="org.eclipse.wst.server.ui.internal.view.servers.provisional.extensions.XPathProvider$XMLDecorator"
+ id="org.jboss.ide.eclipse.as.ui.extensions.xml.decorator"
+ label="JBoss Server XML Configuration Decorator"
+ lightweight="true"
+ location="BOTTOM_RIGHT">
+ <enablement>
+ <or>
+ <objectClass name="org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathQuery"/>
+ <objectClass
+ name="org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathFileResult">
+ </objectClass>
+ <objectClass
+ name="org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathFileResult$XPathResultNode">
+ </objectClass>
+ </or>
+ </enablement>
+ </decorator>
+ </extension>
+
+
+
</plugin>
16 years, 3 months