Author: rob.stryker(a)jboss.com
Date: 2009-07-22 21:16:12 -0400 (Wed, 22 Jul 2009)
New Revision: 16745
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/proposals/internal/ConvertNodeToXPathDialogOutlineMenuItemProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/proposals/internal/ConvertNodeToXPathDialogProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ChangePortDialog.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ConvertNodeToXPathDialog.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/XPathDialogs.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/XPathActionProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
Log:
JBIDE-4307
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-07-22
21:11:08 UTC (rev 16744)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-07-23
01:16:12 UTC (rev 16745)
@@ -137,6 +137,8 @@
public static String XPathName;
public static String XPathPattern;
+ public static String XPathFilePattern;
+ public static String XPathRootDir;
public static String XPathActionProvider_EditFileAction;
public static String XPathActionProvider_ErrorRunningAction;
public static String XPathActionProvider_NewCategoryAction;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-07-22
21:11:08 UTC (rev 16744)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-07-23
01:16:12 UTC (rev 16745)
@@ -107,6 +107,8 @@
XPathColumnAttributeVals=Value
XPathName=Name\:
XPathPattern=XPath Pattern\:
+XPathFilePattern=File Pattern\:
+XPathRootDir=Root Directory\:
XPathActionProvider_EditFileAction=Edit File
XPathActionProvider_ErrorRunningAction=Error running edit file action
XPathActionProvider_NewCategoryAction=New Category
@@ -118,9 +120,7 @@
XPathDialogs_PreviewButton=Preview
XPathDialogs_SelectServer=Please Select a Server
XPathDialogs_ServerLabel=Server:
-XPathDialogs_XPathDescriptionLabel=An XPath is a way to find a specific XML element
inside an xml file. \n\
-This dialog will help you create one. These XPaths' values can then be modified\n\
-by using the JBoss Servers View with the Properties View.
+XPathDialogs_XPathDescriptionLabel=An XPath is a way to find a specific XML element
inside an xml file. This dialog will help you create one.
XPathTreeContentProvider_JobName=Loading XPaths
XPathTreeLabelProvider_LoadingLabel=Loading...
XPathTreeLabelProvider_MatchIndexLabel=Match {0}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ChangePortDialog.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ChangePortDialog.java 2009-07-22
21:11:08 UTC (rev 16744)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ChangePortDialog.java 2009-07-23
01:16:12 UTC (rev 16745)
@@ -147,10 +147,7 @@
XPathCategory category = currentQuery.getCategory();
XPathDialog d = new XPathDialog(Display.getCurrent().getActiveShell(),
- info.server, category.getName(), currentQuery.getName());
- d.setAttribute(currentQuery.getAttribute());
- d.setXpath(currentQuery.getXpathPattern());
-
+ info.server, currentQuery);
if( d.open() == Window.OK ) {
currentQuery.setAttribute(d.getAttribute());
currentQuery.setXpathPattern(d.getXpath());
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ConvertNodeToXPathDialog.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ConvertNodeToXPathDialog.java 2009-07-22
21:11:08 UTC (rev 16744)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ConvertNodeToXPathDialog.java 2009-07-23
01:16:12 UTC (rev 16745)
@@ -21,41 +21,9 @@
*/
package org.jboss.ide.eclipse.as.ui.dialogs;
-import java.util.ArrayList;
-
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.xml.core.internal.document.AttrImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathCategory;
-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.ui.Messages;
import org.jboss.ide.eclipse.as.ui.dialogs.XPathDialogs.XPathDialog;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
@@ -64,234 +32,238 @@
* @author rob.stryker(a)jboss.com
*/
-// TODO FIX ME!
+// TODO This class is very broken and needs to be removed for now
public class ConvertNodeToXPathDialog extends XPathDialog {
- private Node node;
- private ArrayList keyRows;
-
- private static final String NO_ATTRIBUTE = "NONE"; //$NON-NLS-1$
-
- protected ConvertNodeToXPathDialog(Shell parentShell, Node node, String attributeName)
{
- super(parentShell);
- this.node = node;
- setAttribute(attributeName == null ? "" : attributeName); //$NON-NLS-1$
- }
-
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- shell.setText(Messages.XPathNewXpath);
- shell.setBounds(shell.getLocation().x, shell.getLocation().y, 550, 550);
- }
- protected Control createDialogArea(Composite parent) {
- Control c = super.createDialogArea(parent);
- refreshXPath();
- return c;
+ public ConvertNodeToXPathDialog(Shell parentShell, IServer server) {
+ super(parentShell, server);
}
-
- protected Composite createMiddleComposite(Composite c) {
- Composite middleComposite = new Composite(c, SWT.NONE);
- middleComposite.setLayout(new FormLayout());
-
- Composite gridComposite = super.createMiddleComposite(middleComposite);
- FormData gridData = new FormData();
- gridData.left = new FormAttachment(0,5);
- gridData.right = new FormAttachment(100, -5);
- gridData.top = new FormAttachment(0,5);
- gridComposite.setLayoutData(gridData);
-
- // now add my stuff?
- Composite keyComposite = createKeyComposite(middleComposite);
- FormData keyData = new FormData();
- keyData.left = new FormAttachment(0,5);
- keyData.right = new FormAttachment(100,-5);
- keyData.top = new FormAttachment(gridComposite, 5);
- keyComposite.setLayoutData(keyData);
-
- return middleComposite;
- }
-
- protected Composite createKeyComposite(Composite parent) {
- Group main = new Group(parent, SWT.NONE);
- main.setLayout(new GridLayout(2, false));
- keyRows = new ArrayList();
- Node localNode = node;
- String pathText = ""; //$NON-NLS-1$
- while( localNode != null && !(localNode instanceof IDOMDocument)) {
- if( !localNode.getNodeName().equals("#text")) { //$NON-NLS-1$
- keyRows.add(0, new NameComboPair(main, localNode));
- }
- localNode = localNode.getParentNode();
- }
-
- for( int i = 0; i < keyRows.size(); i++ ) {
- ((NameComboPair)keyRows.get(i)).create();
- }
-
- main.setText(Messages.ConvertNodeToXPathDialog_KeyedAttributes);
-
-
- // The very last row should not key off the same attribute name that they wish to
change
- final NameComboPair lastRow = (NameComboPair)keyRows.get(keyRows.size()-1);
- lastRow.combo.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- checkErrors();
- }
- });
-
- return main;
- }
- protected ArrayList getErrors() {
- ArrayList errors = super.getErrors();
- NameComboPair pair = (NameComboPair)keyRows.get(keyRows.size()-1);
- String val = pair.combo.getItem(pair.combo.getSelectionIndex());
- if(attribute != null && val.startsWith(attribute + "=")) {
//$NON-NLS-1$
- errors.add(Messages.ConvertNodeToXPathDialog_ErrorMessage);
- }
- return errors;
- }
-
-
- public void refreshXPath() {
- String finalString = ""; //$NON-NLS-1$
- for( int i = 0; i < keyRows.size(); i++ ) {
- finalString += ((NameComboPair)keyRows.get(i)).toString();
- }
- setXpath(finalString);
- previewPressed();
- }
-
- protected class NameComboPair {
- private Node node;
- private Composite parent;
- private Label label;
- private Combo combo;
- public NameComboPair(Composite parent, Node node) {
- this.node = node;
- this.parent = parent;
- }
- public void create() {
- label = new Label(parent, SWT.NONE);
- label.setText(node.getNodeName());
- combo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
-
- // fill the combo
- NamedNodeMap map = node.getAttributes();
- ArrayList list = new ArrayList();
- list.add(NO_ATTRIBUTE);
- int selectedIndex = 0;
- for( int i = 0; i < map.getLength(); i++ ) {
- Node attr = map.item(i);
- if( attr instanceof AttrImpl ) {
- AttrImpl impl = ((AttrImpl)attr);
- list.add(impl.getName() + "='" + impl.getValue() + "'");
//$NON-NLS-1$ //$NON-NLS-2$
- if( impl.getName().equals("name") &&
!attribute.equals("name")) //$NON-NLS-1$ //$NON-NLS-2$
- selectedIndex = i+1;
- }
- }
-
- combo.setItems((String[]) list.toArray(new String[list.size()]));
- combo.select(selectedIndex);
-
-
- // selection listener
- combo.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- refreshXPath();
- }
- });
- }
-
- public String toString() {
- String ret = "/" + node.getNodeName(); //$NON-NLS-1$
- String comboSelection = combo.getItem(combo.getSelectionIndex());
- if( !comboSelection.equals(NO_ATTRIBUTE))
- ret += "[@" + comboSelection + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- return ret;
- }
- }
-
-
-
- public static class OpenXPathDialogProposal implements ICompletionProposal,
ICompletionProposalExtension2 {
- private Node node;
- private String attributeName;
- public OpenXPathDialogProposal(Node node, String attributeName ) {
- this.node = node;
- this.attributeName = attributeName;
- }
- public void apply(IDocument document) {
- }
-
- public String getAdditionalProposalInfo() {
- return null;
- }
-
- public IContextInformation getContextInformation() {
- return null;
- }
-
- public String getDisplayString() {
- return Messages.ConvertNodeToXPathDialog_DisplayString;
- }
-
- public Image getImage() {
- return null;
- }
-
- public Point getSelection(IDocument document) {
- return null;
- }
-
- public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
- new ConvertNodeRunnable(node, attributeName).run();
- }
-
- public void selected(ITextViewer viewer, boolean smartToggle) {
- }
-
- public void unselected(ITextViewer viewer) {
- }
-
- public boolean validate(IDocument document, int offset, DocumentEvent event) {
- return false;
- }
-
- }
-
- public static class ConvertNodeRunnable implements Runnable {
-
- private String attributeName;
- private Node node;
- public ConvertNodeRunnable(Node n, String att) {
- attributeName = att;
- node = n;
- }
-
- public void run() {
- ConvertNodeToXPathDialog d = new ConvertNodeToXPathDialog(new Shell(), node,
attributeName);
- int result = -1;
- try {
- result = d.open();
- } catch(Exception e) {e.printStackTrace(); }
- if( result == Window.OK) {
- IServer s = d.getServer();
- String category = d.getCategory();
- XPathCategory cat = XPathModel.getDefault().getCategory(s, category);
- if( cat == null ) {
- cat = XPathModel.getDefault().addCategory(s, category);
- }
- XPathQuery q = new XPathQuery(d.getName(), XPathDialogs.getConfigFolder(s), null,
d.getXpath(), d.getAttribute());
- cat.addQuery(q);
- cat.save();
- }
- }
- }
+// private Node node;
+// private ArrayList keyRows;
+//
+// private static final String NO_ATTRIBUTE = "NONE"; //$NON-NLS-1$
+//
+// protected ConvertNodeToXPathDialog(Shell parentShell, Node node, String attributeName)
{
+// super(parentShell);
+// this.node = node;
+// setAttribute(attributeName == null ? "" : attributeName); //$NON-NLS-1$
+// }
+//
+// protected void configureShell(Shell shell) {
+// super.configureShell(shell);
+// setShellStyle(getShellStyle() | SWT.RESIZE);
+// shell.setText(Messages.XPathNewXpath);
+// shell.setBounds(shell.getLocation().x, shell.getLocation().y, 550, 550);
+// }
+//
+// protected Control createDialogArea(Composite parent) {
+// Control c = super.createDialogArea(parent);
+// refreshXPath();
+// return c;
+// }
+//
+// protected Composite createMiddleComposite(Composite c) {
+// Composite middleComposite = new Composite(c, SWT.NONE);
+// middleComposite.setLayout(new FormLayout());
+//
+// Composite gridComposite = super.createMiddleComposite(middleComposite);
+// FormData gridData = new FormData();
+// gridData.left = new FormAttachment(0,5);
+// gridData.right = new FormAttachment(100, -5);
+// gridData.top = new FormAttachment(0,5);
+// gridComposite.setLayoutData(gridData);
+//
+// // now add my stuff?
+// Composite keyComposite = createKeyComposite(middleComposite);
+// FormData keyData = new FormData();
+// keyData.left = new FormAttachment(0,5);
+// keyData.right = new FormAttachment(100,-5);
+// keyData.top = new FormAttachment(gridComposite, 5);
+// keyComposite.setLayoutData(keyData);
+//
+// return middleComposite;
+// }
+//
+// protected Composite createKeyComposite(Composite parent) {
+// Group main = new Group(parent, SWT.NONE);
+// main.setLayout(new GridLayout(2, false));
+// keyRows = new ArrayList();
+// Node localNode = node;
+// String pathText = ""; //$NON-NLS-1$
+// while( localNode != null && !(localNode instanceof IDOMDocument)) {
+// if( !localNode.getNodeName().equals("#text")) { //$NON-NLS-1$
+// keyRows.add(0, new NameComboPair(main, localNode));
+// }
+// localNode = localNode.getParentNode();
+// }
+//
+// for( int i = 0; i < keyRows.size(); i++ ) {
+// ((NameComboPair)keyRows.get(i)).create();
+// }
+//
+// main.setText(Messages.ConvertNodeToXPathDialog_KeyedAttributes);
+//
+//
+// // The very last row should not key off the same attribute name that they wish to
change
+// final NameComboPair lastRow = (NameComboPair)keyRows.get(keyRows.size()-1);
+// lastRow.combo.addSelectionListener(new SelectionListener() {
+// public void widgetDefaultSelected(SelectionEvent e) {
+// }
+// public void widgetSelected(SelectionEvent e) {
+// checkErrors();
+// }
+// });
+//
+// return main;
+// }
+// protected ArrayList getErrors() {
+// ArrayList errors = super.getErrors();
+// NameComboPair pair = (NameComboPair)keyRows.get(keyRows.size()-1);
+// String val = pair.combo.getItem(pair.combo.getSelectionIndex());
+// if(attribute != null && val.startsWith(attribute + "=")) {
//$NON-NLS-1$
+// errors.add(Messages.ConvertNodeToXPathDialog_ErrorMessage);
+// }
+// return errors;
+// }
+//
+//
+// public void refreshXPath() {
+// String finalString = ""; //$NON-NLS-1$
+// for( int i = 0; i < keyRows.size(); i++ ) {
+// finalString += ((NameComboPair)keyRows.get(i)).toString();
+// }
+// setXpath(finalString);
+// previewPressed();
+// }
+//
+// protected class NameComboPair {
+// private Node node;
+// private Composite parent;
+// private Label label;
+// private Combo combo;
+// public NameComboPair(Composite parent, Node node) {
+// this.node = node;
+// this.parent = parent;
+// }
+// public void create() {
+// label = new Label(parent, SWT.NONE);
+// label.setText(node.getNodeName());
+// combo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+// label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+// combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+//
+// // fill the combo
+// NamedNodeMap map = node.getAttributes();
+// ArrayList list = new ArrayList();
+// list.add(NO_ATTRIBUTE);
+// int selectedIndex = 0;
+// for( int i = 0; i < map.getLength(); i++ ) {
+// Node attr = map.item(i);
+// if( attr instanceof AttrImpl ) {
+// AttrImpl impl = ((AttrImpl)attr);
+// list.add(impl.getName() + "='" + impl.getValue() +
"'"); //$NON-NLS-1$ //$NON-NLS-2$
+// if( impl.getName().equals("name") &&
!attribute.equals("name")) //$NON-NLS-1$ //$NON-NLS-2$
+// selectedIndex = i+1;
+// }
+// }
+//
+// combo.setItems((String[]) list.toArray(new String[list.size()]));
+// combo.select(selectedIndex);
+//
+//
+// // selection listener
+// combo.addSelectionListener(new SelectionListener() {
+// public void widgetDefaultSelected(SelectionEvent e) {
+// }
+// public void widgetSelected(SelectionEvent e) {
+// refreshXPath();
+// }
+// });
+// }
+//
+// public String toString() {
+// String ret = "/" + node.getNodeName(); //$NON-NLS-1$
+// String comboSelection = combo.getItem(combo.getSelectionIndex());
+// if( !comboSelection.equals(NO_ATTRIBUTE))
+// ret += "[@" + comboSelection + "]"; //$NON-NLS-1$
//$NON-NLS-2$
+// return ret;
+// }
+// }
+//
+//
+//
+// public static class OpenXPathDialogProposal implements ICompletionProposal,
ICompletionProposalExtension2 {
+// private Node node;
+// private String attributeName;
+// public OpenXPathDialogProposal(Node node, String attributeName ) {
+// this.node = node;
+// this.attributeName = attributeName;
+// }
+// public void apply(IDocument document) {
+// }
+//
+// public String getAdditionalProposalInfo() {
+// return null;
+// }
+//
+// public IContextInformation getContextInformation() {
+// return null;
+// }
+//
+// public String getDisplayString() {
+// return Messages.ConvertNodeToXPathDialog_DisplayString;
+// }
+//
+// public Image getImage() {
+// return null;
+// }
+//
+// public Point getSelection(IDocument document) {
+// return null;
+// }
+//
+// public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
+// new ConvertNodeRunnable(node, attributeName).run();
+// }
+//
+// public void selected(ITextViewer viewer, boolean smartToggle) {
+// }
+//
+// public void unselected(ITextViewer viewer) {
+// }
+//
+// public boolean validate(IDocument document, int offset, DocumentEvent event) {
+// return false;
+// }
+//
+// }
+//
+// public static class ConvertNodeRunnable implements Runnable {
+//
+// private String attributeName;
+// private Node node;
+// public ConvertNodeRunnable(Node n, String att) {
+// attributeName = att;
+// node = n;
+// }
+//
+// public void run() {
+// ConvertNodeToXPathDialog d = new ConvertNodeToXPathDialog(new Shell(), node,
attributeName);
+// int result = -1;
+// try {
+// result = d.open();
+// } catch(Exception e) {e.printStackTrace(); }
+// if( result == Window.OK) {
+// IServer s = d.getServer();
+// String category = d.getCategory();
+// XPathCategory cat = XPathModel.getDefault().getCategory(s, category);
+// if( cat == null ) {
+// cat = XPathModel.getDefault().addCategory(s, category);
+// }
+// XPathQuery q = new XPathQuery(d.getName(), XPathDialogs.getConfigFolder(s), null,
d.getXpath(), d.getAttribute());
+// cat.addQuery(q);
+// cat.save();
+// }
+// }
+// }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/XPathDialogs.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/XPathDialogs.java 2009-07-22
21:11:08 UTC (rev 16744)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/XPathDialogs.java 2009-07-23
01:16:12 UTC (rev 16745)
@@ -27,11 +27,15 @@
import java.util.HashMap;
import java.util.TreeSet;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
@@ -54,19 +58,17 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
import org.jboss.ide.eclipse.as.core.extensions.descriptors.XMLDocumentRepository;
import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathCategory;
import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathFileResult;
@@ -74,7 +76,7 @@
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.core.server.internal.JBossServer;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -162,20 +164,21 @@
}
}
- public static class XPathDialog extends Dialog {
+ public static class XPathDialog extends TitleAreaDialog {
- protected Label errorImage, errorLabel, descriptionLabel;
- protected Text nameText, xpathText, attributeText;
- protected Combo categoryCombo, serverCombo;
- protected Label nameLabel, serverLabel, categoryLabel, xpathLabel, attributeLabel;
- protected Button previewButton;
+ protected Text nameText, baseDirText, filesetText,
+ xpathText, attributeText;
+ protected Label nameLabel, baseDirLabel, filesetLabel,
+ xpathLabel, attributeLabel;
+ protected Button previewButton, rootDirBrowse;
protected XPathProposalProvider proposalProvider;
protected IServer server;
- protected String name, xpath, attribute, category;
+ protected String name, rootDir, filePattern, xpath, attribute;
protected String originalName = null;
protected XPathQuery original = null;
+ protected XPathCategory category;
protected int previewId = 48879;
protected Tree previewTree;
@@ -184,29 +187,30 @@
protected Composite main;
protected XMLDocumentRepository repository;
- public XPathDialog(Shell parentShell) {
- this(parentShell, null);
- }
public XPathDialog(Shell parentShell, IServer server) {
this(parentShell, server, null);
}
- public XPathDialog(Shell parentShell, IServer server, String categoryName) {
- this(parentShell, server, categoryName, null);
- }
-
- public XPathDialog(Shell parentShell, IServer server, String categoryName, String
originalName) {
+ public XPathDialog(Shell parentShell, IServer server, XPathQuery original) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
- this.category = categoryName;
this.server = server;
- this.originalName = this.name = originalName;
repository = new XMLDocumentRepository(XMLDocumentRepository.getDefault());
+ if( original != null ) {
+ this.originalName = this.name = original.getName();
+ this.filePattern = original.getFilePattern();
+ this.rootDir = original.getBaseDir();
+ this.category = original.getCategory();
+ this.xpath = original.getXpathPattern();
+ }
+ if( this.xpath == null ) this.xpath = "//server/mbean"; //$NON-NLS-1$
+ if( this.filePattern == null ) this.filePattern = "**/*.xml"; //$NON-NLS-1$
+ if( this.rootDir == null ) this.rootDir = ""; //$NON-NLS-1$
}
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(Messages.XPathNewXpath);
- shell.setBounds(shell.getLocation().x, shell.getLocation().y, 550, 400);
+ shell.setBounds(shell.getLocation().x, shell.getLocation().y, 550, 500);
}
protected int getShellStyle() {
int ret = super.getShellStyle();
@@ -224,14 +228,17 @@
protected Control createDialogArea(Composite parent) {
- main = (Composite)super.createDialogArea(parent);
+ setTitle(Messages.XPathNewXpath);
+ Composite main = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
+ main.setLayoutData(new GridData(GridData.FILL_BOTH));
main.setLayout(new FormLayout());
layoutWidgets(main);
- fillCombos();
if( name != null ) nameText.setText(name);
if( attribute != null ) attributeText.setText(attribute);
if( xpath != null ) xpathText.setText(xpath);
-
+ if( filePattern != null ) filesetText.setText(filePattern);
+ if( rootDir != null ) baseDirText.setText(rootDir);
+
proposalProvider = new XPathProposalProvider(repository);
if( server != null )
proposalProvider.setPath(getConfigFolder(server));
@@ -251,21 +258,6 @@
return main;
}
- protected void fillCombos() {
- if( serverCombo != null ) {
- IServer servers[] = ServerConverter.getJBossServersAsIServers();
- String[] names = new String[servers.length];
- for( int i = 0; i < servers.length; i++ ) {
- names[i] = servers[i].getName();
- }
- serverCombo.setItems(names);
- }
-
- if( categoryCombo != null ) {
- refreshCategoryCombo();
- }
- }
-
protected void addListeners() {
nameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -283,7 +275,23 @@
xpath = xpathText.getText();
}
});
-
+ baseDirText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ rootDir = baseDirText.getText();
+ }
+ });
+ filesetText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ filePattern = filesetText.getText();
+ }
+ });
+ rootDirBrowse.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ browsePressed();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
previewButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
@@ -291,42 +299,6 @@
previewPressed();
}
});
-
-
- if( serverCombo != null ) {
- serverCombo.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- int index = serverCombo.getSelectionIndex();
- String val = serverCombo.getItem(index);
- IServer[] list = ServerCore.getServers();
- for( int i = 0; i < list.length; i++ ) {
- if( list[i].getName().equals(val)) {
- setServer(list[i]);
- return;
- }
- }
- }
- });
- }
-
- if( categoryCombo != null ) {
- categoryCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- category = categoryCombo.getText();
- checkErrors();
- }
- });
- categoryCombo.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- category = categoryCombo.getText();
- checkErrors();
- }
- });
- }
}
@@ -346,7 +318,6 @@
ArrayList<String> list = new ArrayList<String>();
String serverError = getServerError(); if( serverError != null )
list.add(serverError);
String nameError = getNameError(); if( nameError != null ) list.add(nameError);
- String categoryError = getCategoryError(); if( categoryError != null )
list.add(categoryError);
return list;
}
@@ -355,42 +326,21 @@
return null;
}
- protected String getCategoryError() {
- if( "".equals(category)) { //$NON-NLS-1$
- return Messages.XPathDialogs_BlankCategoryError;
- }
- return null;
- }
-
protected void setError(String message) {
- if( message == null ) {
- errorImage.setVisible(false);
- errorLabel.setVisible(false);
- errorLabel.setText(""); //$NON-NLS-1$
- } else {
- errorImage.setVisible(true);
- errorLabel.setVisible(true);
- errorLabel.setText(message);
- }
+ if( message == null )
+ setMessage(Messages.XPathDialogs_XPathDescriptionLabel);
+ else
+ setMessage(message, IMessageProvider.ERROR);
}
protected String getNameError() {
if( nameText.getText().equals("")) { //$NON-NLS-1$
return Messages.XPathNameEmpty;
}
- if( server == null ) return null;
- XPathCategory[] categories = XPathModel.getDefault().getCategories(server);
- XPathCategory category = null;
- for( int i = 0; i < categories.length; i++ ) {
- if( categories[i].getName().equals(this.category))
- category = categories[i];
- }
if( category != null ) {
XPathQuery[] queries = category.getQueries();
- boolean found = false;
for( int i = 0; i < queries.length; i++ ) {
if(nameText.getText().equals( ((XPathQuery)queries[i]).getName())) {
-
if( originalName == null || !nameText.getText().equals(originalName))
return Messages.XPathNameInUse;
}
@@ -399,25 +349,26 @@
return null;
}
-
- protected void setServer(IServer s) {
- server = s;
- proposalProvider.setPath(getConfigFolder(s));
- refreshCategoryCombo();
- checkErrors();
- }
-
- protected void refreshCategoryCombo() {
- if( server != null ) {
- XPathCategory[] categories = XPathModel.getDefault().getCategories(server);
- String[] categoryNames = new String[categories.length];
- for( int i = 0; i < categories.length; i++ ) {
- categoryNames[i] = (String)categories[i].getName();
+ protected void browsePressed() {
+ DirectoryDialog d = new DirectoryDialog(rootDirBrowse.getShell());
+ String folder = rootDir;
+ if( !new Path(rootDir).isAbsolute())
+ folder = server.getRuntime().getLocation().append(rootDir).toString();
+ d.setFilterPath(folder);
+ String result = d.open();
+ if( result != null ) {
+ IPath result2 = new Path(result);
+ IRuntime rt = server.getRuntime();
+ if( result2.isAbsolute() && rt != null) {
+ if(rt.getLocation().isPrefixOf(result2)) {
+ int size = rt.getLocation().toOSString().length();
+ result2 = new Path(result2.toOSString().substring(size)).makeRelative();
+ }
}
- categoryCombo.setItems(categoryNames);
+ rootDir = result2.toString();
+ baseDirText.setText(rootDir);
}
}
-
protected void previewPressed() {
if( server == null ) {
checkErrors();
@@ -426,9 +377,15 @@
final String xpText = xpathText.getText();
final String attText = attributeText.getText();
+ final String filePattern = filesetText.getText();
+ String directory = baseDirText.getText();
+ if( !new Path(directory).isAbsolute()) {
+ directory = server.getRuntime().getLocation().append(directory).toString();
+ }
+ final String directory2 = directory;
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
- XPathQuery tmp = new XPathQuery("", getConfigFolder(server), null, xpText,
attText); //$NON-NLS-1$
+ XPathQuery tmp = new XPathQuery("", directory2, filePattern, xpText,
attText); //$NON-NLS-1$
tmp.setRepository(repository);
final ArrayList<XPathFileResult> list = new
ArrayList<XPathFileResult>();
list.addAll(Arrays.asList(tmp.getResults()));
@@ -436,9 +393,7 @@
public void run() {
previewTreeViewer.setInput(list);
if( list.size() == 0 ) {
- errorImage.setVisible(true);
- errorLabel.setText(Messages.XPathDialogs_NoElementsMatched);
- errorLabel.setVisible(true);
+ setError(Messages.XPathDialogs_NoElementsMatched);
previewTreeViewer.getTree().setEnabled(false);
} else {
previewTreeViewer.getTree().setEnabled(true);
@@ -456,15 +411,6 @@
}
}
protected void layoutWidgets(Composite c) {
- // create widgets
- descriptionLabel = new Label(c, SWT.WRAP);
- descriptionLabel.setText(Messages.XPathDialogs_XPathDescriptionLabel);
- descriptionLabel.setVisible(true);
- errorLabel = new Label(c, SWT.NONE);
- errorImage = new Label(c, SWT.NONE);
- errorImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
-
-
Composite middleComposite = createMiddleComposite(c);
@@ -484,35 +430,12 @@
previewTreeViewer = new TreeViewer(previewTree);
c.layout();
- int pixel = Math.max(Math.max(nameLabel.getSize().x, xpathLabel.getSize().x),
attributeLabel.getSize().x);
- pixel += 5;
- // Lay them out
- FormData descriptionData = new FormData();
- descriptionData.left = new FormAttachment(0, 5);
- descriptionData.right = new FormAttachment(100, -5);
- descriptionData.top = new FormAttachment(0,5);
- descriptionLabel.setLayoutData(descriptionData);
- FormData errorData = new FormData();
- errorData.left = new FormAttachment(errorImage,5);
- errorData.top = new FormAttachment(descriptionLabel,5);
- errorData.right = new FormAttachment(0,300);
- errorLabel.setLayoutData(errorData);
- errorLabel.setVisible(false);
-
- FormData errorImageData = new FormData();
- errorImageData.left = new FormAttachment(0,5);
- errorImageData.top = new FormAttachment(descriptionLabel,5);
- errorImage.setLayoutData(errorImageData);
- errorImage.setVisible(false);
-
-
-
FormData middleCompositeData = new FormData();
middleCompositeData.left = new FormAttachment(0,5);
middleCompositeData.right = new FormAttachment(100, -5);
- middleCompositeData.top = new FormAttachment(errorLabel, 5);
+ middleCompositeData.top = new FormAttachment(0, 5);
middleComposite.setLayoutData(middleCompositeData);
// Tree layout data
@@ -577,21 +500,28 @@
gridComposite.setLayout(new GridLayout(2, false));
nameLabel = new Label(gridComposite, SWT.NONE);
- nameText= new Text(gridComposite, SWT.BORDER);
+ nameText = new Text(gridComposite, SWT.BORDER);
nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
- if( server == null ) {
- serverLabel = new Label(gridComposite, SWT.NONE);
- serverCombo = new Combo(gridComposite, SWT.BORDER | SWT.READ_ONLY);
- serverCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
- }
-
- if( category == null ) {
- categoryLabel = new Label(gridComposite, SWT.NONE);
- categoryCombo = new Combo(gridComposite, SWT.BORDER);
- categoryCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
- }
-
+ baseDirLabel = new Label(gridComposite, SWT.NONE);
+ Composite baseDirTextAndButton = new Composite(gridComposite, SWT.NONE);
+ baseDirTextAndButton.setLayout(new FormLayout());
+ baseDirTextAndButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ baseDirText = new Text(baseDirTextAndButton, SWT.BORDER);
+ rootDirBrowse = new Button(baseDirTextAndButton, SWT.PUSH);
+ rootDirBrowse.setText(Messages.browse);
+ FormData d = new FormData();
+ d.right = new FormAttachment(100,-5);
+ rootDirBrowse.setLayoutData(d);
+ d = new FormData();
+ d.left = new FormAttachment(0,0);
+ d.right = new FormAttachment(rootDirBrowse, -5);
+ baseDirText.setLayoutData(d);
+
+ filesetLabel = new Label(gridComposite, SWT.NONE);
+ filesetText = new Text(gridComposite, SWT.BORDER);
+ filesetText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+
xpathLabel = new Label(gridComposite, SWT.NONE);
xpathText = new Text(gridComposite, SWT.BORDER);
xpathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
@@ -602,10 +532,10 @@
// set some text
nameLabel.setText(Messages.XPathName);
- if( serverLabel != null ) serverLabel.setText(Messages.XPathDialogs_ServerLabel);
- if( categoryLabel != null )
categoryLabel.setText(Messages.XPathDialogs_CategoryLabel);
xpathLabel.setText(Messages.XPathPattern);
attributeLabel.setText(Messages.XPathAttribute);
+ filesetLabel.setText(Messages.XPathFilePattern);
+ baseDirLabel.setText(Messages.XPathRootDir);
return gridComposite;
}
@@ -620,31 +550,12 @@
public String getXpath() {
return xpath;
}
-
- public String getCategory() {
- return category;
+ public String getBaseDir() {
+ return rootDir;
}
- public IServer getServer() {
- return server;
+ public String getFilePattern() {
+ return filePattern;
}
-
- public void setAttribute(String attribute) {
- this.attribute = attribute;
- if( attributeText != null && !attributeText.isDisposed())
- attributeText.setText(this.attribute);
- }
-
- public void setName(String name) {
- this.name = name;
- if( nameText != null && !nameText.isDisposed())
- nameText.setText(this.name);
- }
-
- public void setXpath(String xpath) {
- this.xpath = xpath;
- if( xpathText != null && !xpathText.isDisposed())
- xpathText.setText(this.xpath);
- }
}
public static class XPathAttributeProposalProvider extends XPathProposalProvider {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/XPathActionProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/XPathActionProvider.java 2009-07-22
21:11:08 UTC (rev 16744)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/XPathActionProvider.java 2009-07-23
01:16:12 UTC (rev 16745)
@@ -108,7 +108,7 @@
if (category != null) {
String categoryName = category.getName();
XPathDialog d = new XPathDialog(Display.getCurrent()
- .getActiveShell(), getServer(), categoryName);
+ .getActiveShell(), getServer(), null);
if (d.open() == Window.OK) {
XPathCategory[] categoryList = XPathModel.getDefault()
.getCategories(getServer());
@@ -140,15 +140,14 @@
XPathCategory category = original.getCategory();
XPathDialog d = new XPathDialog(Display.getCurrent()
- .getActiveShell(), getServer(), category.getName(),
- original.getName());
- d.setAttribute(original.getAttribute());
- d.setXpath(original.getXpathPattern());
+ .getActiveShell(), getServer(), original);
if (d.open() == Window.OK) {
original.setAttribute(d.getAttribute());
original.setXpathPattern(d.getXpath());
original.setName(d.getName());
+ original.setBaseDir(d.getBaseDir());
+ original.setFilePattern(d.getFilePattern());
category.save();
refreshViewer();
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2009-07-22
21:11:08 UTC (rev 16744)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2009-07-23
01:16:12 UTC (rev 16745)
@@ -67,6 +67,11 @@
private Label homeValLabel, jreValLabel, configValLabel, configLocValLabel;
private Group runtimeGroup;
+
+ public JBossServerWizardFragment() {
+ super();
+ }
+
public Composite createComposite(Composite parent, IWizardHandle handle) {
this.handle = handle;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/proposals/internal/ConvertNodeToXPathDialogOutlineMenuItemProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/proposals/internal/ConvertNodeToXPathDialogOutlineMenuItemProvider.java 2009-07-22
21:11:08 UTC (rev 16744)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/proposals/internal/ConvertNodeToXPathDialogOutlineMenuItemProvider.java 2009-07-23
01:16:12 UTC (rev 16745)
@@ -26,13 +26,13 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.wst.xml.core.internal.document.AttrImpl;
-import org.jboss.ide.eclipse.as.ui.dialogs.ConvertNodeToXPathDialog.ConvertNodeRunnable;
import org.jboss.ide.eclipse.as.ui.mbeans.Messages;
import
org.jboss.ide.eclipse.as.ui.mbeans.editors.proposals.IServiceXMLOutlineActionProvider;
import org.w3c.dom.Node;
/**
- *
+ * This class is also non-functional
+ * pending a better solution
* @author rob.stryker(a)jboss.com
*/
public class ConvertNodeToXPathDialogOutlineMenuItemProvider implements
@@ -54,12 +54,12 @@
final String attName2 = attName;
Action temp = new Action() {
public void run() {
- new ConvertNodeRunnable(n2, attName2).run();
+ //new ConvertNodeRunnable(n2, attName2).run();
}
};
temp.setText(Messages.ConvertNodeToXPathDialogOutlineMenuItemProvider_AddToXPathsAction);
temp.setDescription(Messages.ConvertNodeToXPathDialogOutlineMenuItemProvider_AddToXPathsDescription);
- manager.add(temp);
+ //manager.add(temp);
}
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/proposals/internal/ConvertNodeToXPathDialogProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/proposals/internal/ConvertNodeToXPathDialogProvider.java 2009-07-22
21:11:08 UTC (rev 16744)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/editors/proposals/internal/ConvertNodeToXPathDialogProvider.java 2009-07-23
01:16:12 UTC (rev 16745)
@@ -26,13 +26,14 @@
import org.eclipse.wst.xml.core.internal.document.AttrImpl;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentAssistProcessor;
-import
org.jboss.ide.eclipse.as.ui.dialogs.ConvertNodeToXPathDialog.OpenXPathDialogProposal;
import
org.jboss.ide.eclipse.as.ui.mbeans.editors.proposals.IServiceXMLQuickFixProposalProvider;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
/**
*
+ * The functionality for this is being removed for now
+ * until a cleaner solution can be come up with
* @author rob.stryker(a)jboss.com
*/
public class ConvertNodeToXPathDialogProvider extends XMLContentAssistProcessor
@@ -42,12 +43,12 @@
return computeCompletionProposals(viewer, offset);
}
- protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
- Node n = contentAssistRequest.getNode();
- String name = n.getNodeName();
- String attName =
((AttrImpl)n.getAttributes().getNamedItem(contentAssistRequest.getText())).getName();
- contentAssistRequest.addProposal(createProposal(n, attName));
- }
+// protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
+// Node n = contentAssistRequest.getNode();
+// String name = n.getNodeName();
+// String attName =
((AttrImpl)n.getAttributes().getNamedItem(contentAssistRequest.getText())).getName();
+// contentAssistRequest.addProposal(createProposal(n, attName));
+// }
protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
String elementName = contentAssistRequest.getNode().getNodeName();
@@ -72,20 +73,20 @@
}
}
if( found ) {
- contentAssistRequest.addProposal(createProposal(contentAssistRequest.getNode(),
attribute.getName()));
+ //contentAssistRequest.addProposal(createProposal(contentAssistRequest.getNode(),
attribute.getName()));
}
}
protected void addEmptyDocumentProposals(ContentAssistRequest contentAssistRequest) {
}
- protected void addTagInsertionProposals(ContentAssistRequest contentAssistRequest, int
childPosition) {
- contentAssistRequest.addProposal(createProposal(contentAssistRequest.getNode(),
null));
- }
+// protected void addTagInsertionProposals(ContentAssistRequest contentAssistRequest, int
childPosition) {
+// contentAssistRequest.addProposal(createProposal(contentAssistRequest.getNode(),
null));
+// }
- protected ICompletionProposal createProposal(Node node, String attributeName) {
- return new OpenXPathDialogProposal(node, attributeName);
- }
+// protected ICompletionProposal createProposal(Node node, String attributeName) {
+// return new OpenXPathDialogProposal(node, attributeName);
+// }
}