JBoss Tools SVN: r21055 - in trunk/jst/plugins/org.jboss.tools.jst.jsp: src/org/jboss/tools/jst/jsp/messages and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: yzhishko
Date: 2010-03-26 12:23:10 -0400 (Fri, 26 Mar 2010)
New Revision: 21055
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/images/cssdialog/down.gif
trunk/jst/plugins/org.jboss.tools.jst.jsp/images/cssdialog/up.gif
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDropAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectionEventManager.java
Removed:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragListener.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragListener.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectorEventManager.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSContainer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSJSPRecognizer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSRuleContainer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTableModel.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTreeModel.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorUtils.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSStyleSheetContainer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSTreeNode.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/ICSSClassSelectionChangedListener.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorFilter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableContentProvider.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableViewer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeContentProvider.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeLabelProvider.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeViewer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6067 - fixed. There are a lot of minor and unpleasant bugs with preview updating and buttons blinking were fixed, too.
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/cssdialog/down.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/cssdialog/down.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/cssdialog/up.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/cssdialog/up.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -118,4 +118,6 @@
public static String PROPERTY_VALUE_COLUMN;
public static String CSS_ADD_CSS_CLASS_TIP;
public static String CSS_REMOVE_CSS_CLASS_TIP;
+ public static String CSS_MOVE_UP_CSS_CLASS_TIP;
+ public static String CSS_MOVE_DOWN_CSS_CLASS_TIP;
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2010-03-26 16:23:10 UTC (rev 21055)
@@ -8,6 +8,8 @@
CSS_INVALID_STYLE_PROPERTY=Invalid Style class property has been entered.
CSS_ADD_CSS_CLASS_TIP=Add CSS class
CSS_REMOVE_CSS_CLASS_TIP=Remove CSS class
+CSS_MOVE_UP_CSS_CLASS_TIP=Move Up
+CSS_MOVE_DOWN_CSS_CLASS_TIP=Move Down
#CSS_SAVE_DIALOG_TITLE=Save CSS file
CSS_CLASS_DIALOG_FILE_LABEL=CSS file:
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -60,6 +60,8 @@
public static final String IMAGE_FONTLARGE_FILE_LOCATION = "images/cssdialog/font_large.gif"; //$NON-NLS-1$
public static final String IMAGE_LEFT_FILE_LOCATION = "images/cssdialog/left.gif"; //$NON-NLS-1$
public static final String IMAGE_RIGHT_FILE_LOCATION = "images/cssdialog/right.gif"; //$NON-NLS-1$
+ public static final String IMAGE_UP_FILE_LOCATION = "images/cssdialog/up.gif"; //$NON-NLS-1$
+ public static final String IMAGE_DOWN_FILE_LOCATION = "images/cssdialog/down.gif"; //$NON-NLS-1$
public static final String IMAGE_SAMPLE_FILE_LOCATION = "images/cssdialog/sample.gif"; //$NON-NLS-1$
public static final String IMAGE_STYLE_SHEET_LOCATION = "images/cssdialog/style_sheet.gif"; //$NON-NLS-1$
public static final String IMAGE_STYLE_CLASS_LOCATION = "images/cssdialog/style_class.gif"; //$NON-NLS-1$
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -13,15 +13,19 @@
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
+import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetAdapter;
@@ -39,8 +43,8 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
@@ -49,15 +53,18 @@
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTableDragListener;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTreeDragListener;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTableDragAdapter;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTableDropAdapter;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTreeDragAdapter;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSJSPRecognizer;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTableModel;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSClassSelectionChangedEvent;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSSelectorEventManager;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSSelectionEventManager;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.ICSSClassSelectionChangedListener;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorFilter;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
@@ -77,9 +84,12 @@
private static final int VIEWER_WIDTH = 175;
/** Existing font family */
- Composite buttonsContainer;
+ private Composite moveButtonsContainer;
+ private Composite tableButtonsContainer;
private Button rightButton;
private Button leftButton;
+ private Button upButton;
+ private Button downButton;
private String setClasses;
private CSSSelectorTreeViewer allCSSStyleClassViewer;
private CSSSelectorTableViewer selectedClassesTableViewer;
@@ -96,15 +106,6 @@
this.setClasses = setClasses;
this.styleAttributes = styleAttributes;
creatSelectorPart();
- addDisposeListener(new DisposeListener() {
-
- public void widgetDisposed(DisposeEvent e) {
- for (int i = 0; i < changedListeners.size(); i++) {
- removeCSSClassSelectionChangedListener(changedListeners
- .get(i));
- }
- }
- });
}
private void creatSelectorPart() {
@@ -139,11 +140,11 @@
Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
allCSSStyleClassViewer.addDragSupport(DND.DROP_MOVE, types,
- new CSSTreeDragListener(this, allCSSStyleClassViewer,
+ new CSSTreeDragAdapter(this, allCSSStyleClassViewer,
selectedClassesTableViewer));
selectedClassesTableViewer.addDragSupport(DND.DROP_MOVE, types,
- new CSSTableDragListener(this, allCSSStyleClassViewer,
+ new CSSTableDragAdapter(this, allCSSStyleClassViewer,
selectedClassesTableViewer));
allCSSStyleClassViewer.addDropSupport(DND.DROP_MOVE, types,
@@ -160,49 +161,21 @@
});
selectedClassesTableViewer.addDropSupport(DND.DROP_MOVE, types,
- new DropTargetAdapter() {
- @Override
- public void drop(DropTargetEvent event) {
- if (event.data == null
- || event.data
- .equals(CSSSelectorTableViewer.CSS_SELECTOR_TABLE_VIWER_ID)) {
- event.detail = DND.DROP_NONE;
- return;
- }
- }
- });
+ new CSSTableDropAdapter(this, allCSSStyleClassViewer,
+ selectedClassesTableViewer));
}
private void initListeners() {
- final Tree tree = allCSSStyleClassViewer.getTree();
allCSSStyleClassViewer
.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
- TreeItem[] selectedItems = tree.getSelection();
- if (selectedItems != null && selectedItems.length > 0) {
- TreeItem selectedItem = selectedItems[selectedItems.length - 1];
- CSSTreeNode treeNode = (CSSTreeNode) selectedItem
- .getData();
- if (!(treeNode.getCSSContainer() instanceof CSSRuleContainer)) {
- if (allCSSStyleClassViewer
- .getExpandedState(treeNode)) {
- allCSSStyleClassViewer.collapseToLevel(
- treeNode, 1);
- return;
- }
- allCSSStyleClassViewer.expandToLevel(treeNode,
- 1);
- return;
- }
- selectedClassesTableViewer.add(treeNode.toString());
- updateStyles();
- }
+ handleAddClass();
}
});
-
+
selectedClassesTableViewer
.addDoubleClickListener(new IDoubleClickListener() {
@@ -217,6 +190,12 @@
public void selectionChanged(
final SelectionChangedEvent event) {
+ if (!CSSSelectionEventManager.getInstance()
+ .isHandleSelection()) {
+ CSSSelectionEventManager.getInstance()
+ .setHandleSelection(true);
+ return;
+ }
if (!event.getSelection().isEmpty()) {
rightButton.setEnabled(true);
leftButton.setEnabled(false);
@@ -224,22 +203,36 @@
rightButton.setEnabled(false);
leftButton.setEnabled(false);
}
- Thread thread = new Thread("TreeSelectorWorker") { //$NON-NLS-1$
- @Override
+ selectedClassesTableViewer.getTable().deselectAll();
+ checkForTableMove(event);
+ if (event.getSelection().isEmpty()) {
+ return;
+ }
+ Display.getCurrent().asyncExec(new Runnable() {
+
public void run() {
- fireClassSelectionChanged(CSSSelectorEventManager
- .getInstance().createTreeSelectionChangedEvent(
- event, allCSSStyleClassViewer.getModel()));
+ fireClassSelectionChanged(CSSSelectionEventManager
+ .getInstance()
+ .createTreeSelectionChangedEvent(
+ event,
+ allCSSStyleClassViewer
+ .getModel()));
}
- };
- thread.start();
+ });
}
});
selectedClassesTableViewer
.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(final SelectionChangedEvent event) {
+ public void selectionChanged(
+ final SelectionChangedEvent event) {
+ if (!CSSSelectionEventManager.getInstance()
+ .isHandleSelection()) {
+ CSSSelectionEventManager.getInstance()
+ .setHandleSelection(true);
+ return;
+ }
if (!event.getSelection().isEmpty()) {
rightButton.setEnabled(false);
leftButton.setEnabled(true);
@@ -247,56 +240,114 @@
rightButton.setEnabled(false);
leftButton.setEnabled(false);
}
- Thread thread = new Thread("TableSelectorWorker") { //$NON-NLS-1$
- @Override
+ checkForTableMove(event);
+ allCSSStyleClassViewer.getTree().deselectAll();
+ if (event.getSelection().isEmpty()) {
+ return;
+ }
+ Display.getCurrent().asyncExec(new Runnable() {
+
public void run() {
- fireClassSelectionChanged(CSSSelectorEventManager
- .getInstance().createTableSelectionChangedEvent(
- event, allCSSStyleClassViewer.getModel()));
+ fireClassSelectionChanged(CSSSelectionEventManager
+ .getInstance()
+ .createTableSelectionChangedEvent(
+ event,
+ allCSSStyleClassViewer
+ .getModel()));
}
- };
- thread.start();
+ });
}
});
allCSSStyleClassViewer.getTree().addKeyListener(new KeyListener() {
-
+
public void keyReleased(KeyEvent e) {
if (SWT.ARROW_RIGHT == e.keyCode && SWT.ALT == e.stateMask) {
handleAddClass();
}
}
-
+
public void keyPressed(KeyEvent e) {
}
});
-
+
selectedClassesTableViewer.getTable().addKeyListener(new KeyListener() {
-
+
public void keyReleased(KeyEvent e) {
- if (SWT.ARROW_LEFT== e.keyCode && SWT.ALT == e.stateMask) {
+ if (SWT.ARROW_LEFT == e.keyCode && SWT.ALT == e.stateMask) {
handleRemoveClass();
}
}
-
+
public void keyPressed(KeyEvent e) {
}
});
-
+
rightButton.addSelectionListener(this);
leftButton.addSelectionListener(this);
+ upButton.addSelectionListener(this);
+ downButton.addSelectionListener(this);
}
+ private void checkForTableMove(SelectionChangedEvent event) {
+ if (event.getSelection().isEmpty()) {
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ return;
+ }
+ int[] selectionIndices = selectedClassesTableViewer.getTable()
+ .getSelectionIndices();
+ if (selectionIndices.length == 0) {
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ return;
+ }
+ if (!isSequencedIndices(selectionIndices)) {
+ upButton.setEnabled(true);
+ downButton.setEnabled(true);
+ } else {
+ if (selectionIndices[0] != 0
+ && (selectionIndices[selectionIndices.length - 1] != selectedClassesTableViewer
+ .getTable().getItemCount() - 1)) {
+ upButton.setEnabled(true);
+ downButton.setEnabled(true);
+ } else if (selectionIndices[0] != 0) {
+ downButton.setEnabled(false);
+ upButton.setEnabled(true);
+ } else if (selectionIndices[selectionIndices.length - 1] != selectedClassesTableViewer
+ .getTable().getItemCount() - 1) {
+ downButton.setEnabled(true);
+ upButton.setEnabled(false);
+ } else if (selectionIndices[0] == 0
+ && (selectionIndices[selectionIndices.length - 1] == selectedClassesTableViewer
+ .getTable().getItemCount() - 1)) {
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ }
+ }
+ }
+
+ private boolean isSequencedIndices(int[] indices) {
+ for (int i = 0; i < indices.length - 1; i++) {
+ if (indices[i + 1] - indices[i] != 1)
+ return false;
+ }
+ return true;
+ }
+
private void initControls() {
allCSSStyleClassViewer = new CSSSelectorTreeViewer(this, SWT.MULTI
| SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
filter = new CSSSelectorFilter();
allCSSStyleClassViewer.addFilter(filter);
- buttonsContainer = new Composite(this, SWT.NONE);
- rightButton = new Button(buttonsContainer, SWT.PUSH);
- leftButton = new Button(buttonsContainer, SWT.PUSH);
+ moveButtonsContainer = new Composite(this, SWT.NONE);
+ rightButton = new Button(moveButtonsContainer, SWT.PUSH);
+ leftButton = new Button(moveButtonsContainer, SWT.PUSH);
selectedClassesTableViewer = new CSSSelectorTableViewer(this, SWT.MULTI
| SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ tableButtonsContainer = new Composite(this, SWT.NONE);
+ upButton = new Button(tableButtonsContainer, SWT.PUSH);
+ downButton = new Button(tableButtonsContainer, SWT.PUSH);
rightButton.setToolTipText(JstUIMessages.CSS_ADD_CSS_CLASS_TIP);
ImageDescriptor rightDesc = JspEditorPlugin
.getImageDescriptor(Constants.IMAGE_RIGHT_FILE_LOCATION);
@@ -323,6 +374,32 @@
button.getImage().dispose();
}
});
+ upButton.setToolTipText(JstUIMessages.CSS_MOVE_UP_CSS_CLASS_TIP);
+
+ ImageDescriptor upDesc = JspEditorPlugin
+ .getImageDescriptor(Constants.IMAGE_UP_FILE_LOCATION);
+ Image upImage = upDesc.createImage();
+ upButton.setImage(upImage);
+ upButton.setEnabled(false);
+ upButton.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Button button = (Button) e.getSource();
+ button.getImage().dispose();
+ }
+ });
+ downButton.setToolTipText(JstUIMessages.CSS_MOVE_DOWN_CSS_CLASS_TIP);
+
+ ImageDescriptor downDesc = JspEditorPlugin
+ .getImageDescriptor(Constants.IMAGE_DOWN_FILE_LOCATION);
+ Image downImage = downDesc.createImage();
+ downButton.setImage(downImage);
+ downButton.setEnabled(false);
+ downButton.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Button button = (Button) e.getSource();
+ button.getImage().dispose();
+ }
+ });
}
private String[] parseSetClasses() {
@@ -345,23 +422,83 @@
handleRemoveClass();
} else if (ob.equals(rightButton)) {
handleAddClass();
+ } else if (ob.equals(upButton)) {
+ handleMoveUp();
+ } else if (ob.equals(downButton)) {
+ handleMoveDown();
} else if (ob.equals(allCSSStyleClassViewer.getTree())) {
- selectedClassesTableViewer.getTable().deselectAll();
- leftButton.setEnabled(false);
- rightButton.setEnabled(true);
+ selectedClassesTableViewer.setSelection(new StructuredSelection());
} else if (ob.equals(selectedClassesTableViewer.getTable())) {
- allCSSStyleClassViewer.getTree().deselectAll();
- rightButton.setEnabled(false);
- leftButton.setEnabled(true);
+ allCSSStyleClassViewer.setSelection(new StructuredSelection());
}
}
+ private void handleMoveDown() {
+ StructuredSelection selection = (StructuredSelection) selectedClassesTableViewer
+ .getSelection();
+ Object[] selectedItems = selection.toArray();
+ int[] selectedIndices = selectedClassesTableViewer.getTable()
+ .getSelectionIndices();
+ int itemsCount = selectedClassesTableViewer.getTable().getItemCount();
+ int selectionLength = selectedIndices.length;
+ for (int i = 0; i < selectionLength; i++) {
+ CSSSelectionEventManager.getInstance().setHandleSelection(false);
+ selectedClassesTableViewer.remove(selectedItems[selectionLength - 1 - i]);
+ if (selectedIndices[selectionLength - 1 - i] == itemsCount - 1) {
+ TableItem item = new TableItem(selectedClassesTableViewer
+ .getTable(), selectedClassesTableViewer.getTable()
+ .getStyle(), itemsCount - 1);
+ item.setData(selectedItems[selectionLength - 1 - i]);
+ itemsCount--;
+ } else {
+ TableItem item = new TableItem(selectedClassesTableViewer
+ .getTable(), selectedClassesTableViewer.getTable()
+ .getStyle(),
+ selectedIndices[selectionLength - 1 - i] + 1);
+ item.setData(selectedItems[selectionLength - 1 - i]);
+ }
+ }
+ selectedClassesTableViewer.refresh();
+ selectedClassesTableViewer.setSelection(new StructuredSelection(
+ selectedItems));
+ }
+
+ private void handleMoveUp() {
+ StructuredSelection selection = (StructuredSelection) selectedClassesTableViewer
+ .getSelection();
+ Object[] selectedItems = selection.toArray();
+ int[] selectedIndices = selectedClassesTableViewer.getTable()
+ .getSelectionIndices();
+ CSSSelectionEventManager.getInstance().setHandleSelection(false);
+ selectedClassesTableViewer.remove(selection.toArray());
+ for (int i = 0; i < selectedIndices.length; i++) {
+ if (selectedIndices[i] == i) {
+ TableItem item = new TableItem(selectedClassesTableViewer
+ .getTable(), selectedClassesTableViewer.getTable()
+ .getStyle(), i);
+ item.setData(selectedItems[i]);
+ } else {
+ TableItem item = new TableItem(selectedClassesTableViewer
+ .getTable(), selectedClassesTableViewer.getTable()
+ .getStyle(), selectedIndices[i] - 1);
+ item.setData(selectedItems[i]);
+ }
+ }
+ selectedClassesTableViewer.refresh();
+ selectedClassesTableViewer.setSelection(new StructuredSelection(
+ selectedItems));
+ }
+
public void widgetSelected(SelectionEvent e) {
Object ob = e.getSource();
if (ob.equals(leftButton)) {
handleRemoveClass();
} else if (ob.equals(rightButton)) {
handleAddClass();
+ } else if (ob.equals(upButton)) {
+ handleMoveUp();
+ } else if (ob.equals(downButton)) {
+ handleMoveDown();
}
}
@@ -369,32 +506,42 @@
TableItem[] selectedItems = selectedClassesTableViewer.getTable()
.getSelection();
if (selectedItems != null && selectedItems.length > 0) {
+ List<String> itemsToRemove = new ArrayList<String>(0);
for (int i = 0; i < selectedItems.length; i++) {
- selectedClassesTableViewer.remove(selectedItems[i].getData());
+ itemsToRemove.add(selectedItems[i].getData().toString());
}
+ selectedClassesTableViewer.remove(itemsToRemove.toArray());
updateStyles();
}
}
private void handleAddClass() {
+ Set<String> itemsToMove = new LinkedHashSet<String>(0);
TreeItem[] selectedItems = allCSSStyleClassViewer.getTree()
.getSelection();
if (selectedItems != null && selectedItems.length > 0) {
for (int i = 0; i < selectedItems.length; i++) {
TreeItem item = selectedItems[i];
- if (!(((CSSTreeNode) item.getData()).getCSSContainer() instanceof CSSRuleContainer)) {
- continue;
+ CSSContainer container = ((CSSTreeNode) item.getData())
+ .getCSSContainer();
+ CSSTreeNode treeNode = (CSSTreeNode) item.getData();
+ if ((container instanceof CSSStyleSheetContainer)) {
+ List<CSSTreeNode> children = treeNode.getChildren();
+ for (int j = 0; j < children.size(); j++) {
+ itemsToMove.add(children.get(j).toString());
+ }
+ } else if (container instanceof CSSRuleContainer) {
+ itemsToMove.add(treeNode.toString());
}
- selectedClassesTableViewer.add(((CSSTreeNode) item.getData())
- .toString());
}
+ selectedClassesTableViewer.add(itemsToMove.toArray());
updateStyles();
}
}
private void createLayout() {
final GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
+ gridLayout.numColumns = 4;
setLayout(gridLayout);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
setLayoutData(gridData);
@@ -409,9 +556,9 @@
gridData.widthHint = VIEWER_WIDTH;
selectedClassesTableViewer.getTable().setLayoutData(gridData);
- final GridLayout btmContGridLayout = new GridLayout();
- btmContGridLayout.numColumns = 1;
- buttonsContainer.setLayout(btmContGridLayout);
+ final GridLayout moveBtnContGridLayout = new GridLayout();
+ moveBtnContGridLayout.numColumns = 1;
+ moveButtonsContainer.setLayout(moveBtnContGridLayout);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
gridData.widthHint = BUTTOND_WIDTH;
@@ -421,6 +568,9 @@
gridData.widthHint = BUTTOND_WIDTH;
leftButton.setLayoutData(gridData);
+ final GridLayout tableBtnContGridLayout = new GridLayout();
+ tableBtnContGridLayout.numColumns = 1;
+ tableButtonsContainer.setLayout(tableBtnContGridLayout);
}
public void updateStyles() {
@@ -442,10 +592,8 @@
}
}
allCSSStyleClassViewer.refresh();
- allCSSStyleClassViewer.getTree().deselectAll();
- selectedClassesTableViewer.getTable().deselectAll();
- rightButton.setEnabled(false);
- leftButton.setEnabled(false);
+ allCSSStyleClassViewer.setSelection(new StructuredSelection());
+ selectedClassesTableViewer.setSelection(new StructuredSelection());
}
public String getCSSStyleClasses() {
@@ -492,10 +640,16 @@
return selectedItemsList.toArray(new String[0]);
}
- private void fireClassSelectionChanged(CSSClassSelectionChangedEvent event) {
- for (int i = 0; i < changedListeners.size(); i++) {
- changedListeners.get(i).classSelectionChanged(event);
- }
+ private void fireClassSelectionChanged(
+ final CSSClassSelectionChangedEvent event) {
+ SafeRunner.run(new SafeRunnable() {
+ public void run() throws Exception {
+ for (int i = 0; i < changedListeners.size(); i++) {
+ changedListeners.get(i).classSelectionChanged(event);
+ }
+ }
+ });
+
}
public synchronized void addCSSClassSelectionChangedListener(
@@ -508,4 +662,13 @@
changedListeners.remove(listener);
}
+ @Override
+ public void dispose() {
+ for (int i = 0; i < changedListeners.size(); i++) {
+ removeCSSClassSelectionChangedListener(changedListeners.get(i));
+ }
+ changedListeners = null;
+ super.dispose();
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -1,10 +1,14 @@
package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.IElementComparer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.wst.css.core.internal.modelhandler.CSSModelLoader;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
@@ -20,8 +24,9 @@
@SuppressWarnings("restriction")
public class CSSSelectorPreview extends Composite implements
- ICSSClassSelectionChangedListener {
+ ICSSClassSelectionChangedListener, IElementComparer {
+ private ISelection prevSelection;
private StructuredTextViewer viewer;
private ICSSModel model;
private ICSSStyleSheet styleSheet;
@@ -44,25 +49,34 @@
CSSModelLoader cssModelLoader = new CSSModelLoader();
IStructuredModel model = cssModelLoader.createModel();
this.model = (ICSSModel) model;
+ styleSheet = (ICSSStyleSheet) this.model.getDocument();
viewer.setDocument(model.getStructuredDocument());
viewer.setEditable(false);
}
public void classSelectionChanged(final CSSClassSelectionChangedEvent event) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- styleSheet = (ICSSStyleSheet) model.getDocument();
- CSSRuleContainer[] containers = event
- .getSelectedRuleContainers();
- if (containers.length != 0) {
- clearPreview();
- for (int i = 0; i < containers.length; i++) {
- appendRuleFromContainer(containers[i]);
- }
+ CSSRuleContainer[] containers = event.getSelectedRuleContainers();
+ if (containers.length != 0) {
+ List<CSSRuleContainer> ruleContainerList = new ArrayList<CSSRuleContainer>(0);
+ for (int i = 0; i < containers.length; i++) {
+ ruleContainerList.add(containers[i]);
+ }
+ ISelection newSelection = new StructuredSelection(ruleContainerList, this);
+ if (prevSelection == null) {
+ prevSelection = new StructuredSelection(ruleContainerList, this);
+ clearPreview();
+ for (int i = 0; i < containers.length; i++) {
+ appendRuleFromContainer(containers[i]);
}
}
- });
-
+ if (!prevSelection.equals(newSelection)) {
+ clearPreview();
+ for (int i = 0; i < containers.length; i++) {
+ appendRuleFromContainer(containers[i]);
+ }
+ prevSelection = newSelection;
+ }
+ }
}
private void appendRuleFromContainer(CSSRuleContainer container) {
@@ -81,4 +95,12 @@
}
}
+ public boolean equals(Object a, Object b) {
+ return a.equals(b);
+ }
+
+ public int hashCode(Object element) {
+ return 0;
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -94,5 +94,5 @@
private CSSSelectorPreview createPreviewComposite(Composite parent) {
return new CSSSelectorPreview(parent);
}
-
+
}
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragAdapter.java (from rev 21000, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragListener.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragAdapter.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragAdapter.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Tree;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("unused")
+public class CSSTableDragAdapter implements DragSourceListener {
+
+ private Table table;
+ private Tree tree;
+ private CSSSelectorPartComposite parent;
+ private TreeViewer treeViewer;
+ private TableViewer tableViewer;
+
+ public CSSTableDragAdapter(CSSSelectorPartComposite parent,
+ TreeViewer treeViewer, TableViewer tableViewer) {
+ this.table = tableViewer.getTable();
+ this.tree = treeViewer.getTree();
+ this.treeViewer = treeViewer;
+ this.tableViewer = tableViewer;
+ this.parent = parent;
+ }
+
+ public void dragStart(DragSourceEvent event) {
+ event.doit = table.getSelectionCount() > 0;
+ }
+
+ public void dragSetData(DragSourceEvent event) {
+ List<String> selectedItems = new ArrayList<String>(0);
+ TableItem[] selectedTableItems = table.getSelection();
+ if (selectedTableItems != null) {
+ for (int i = 0; i < selectedTableItems.length; i++) {
+ selectedItems.add(selectedTableItems[i].getData().toString());
+ }
+ }
+ event.data = CSSSelectorTableViewer.CSS_SELECTOR_TABLE_VIWER_ID;
+ }
+
+ public void dragFinished(DragSourceEvent event) {
+ if (event.detail == DND.DROP_MOVE) {
+ TableItem[] selectedTableItems = table.getSelection();
+ if (selectedTableItems != null && selectedTableItems.length > 0) {
+ for (int i = 0; i < selectedTableItems.length; i++) {
+ tableViewer.remove(selectedTableItems[i].getData());
+ }
+ }
+ parent.updateStyles();
+ }
+ }
+
+}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragListener.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragListener.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Tree;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-@SuppressWarnings("unused")
-public class CSSTableDragListener implements DragSourceListener {
-
- private Table table;
- private Tree tree;
- private CSSSelectorPartComposite parent;
- private TreeViewer treeViewer;
- private TableViewer tableViewer;
-
- public CSSTableDragListener (CSSSelectorPartComposite parent, TreeViewer treeViewer, TableViewer tableViewer){
- this.table = tableViewer.getTable();
- this.tree = treeViewer.getTree();
- this.treeViewer = treeViewer;
- this.tableViewer = tableViewer;
- this.parent = parent;
- }
-
- public void dragStart(DragSourceEvent event) {
- event.doit = table.getSelectionCount() > 0;
- }
-
- public void dragSetData(DragSourceEvent event) {
- List<String> selectedItems = new ArrayList<String>(0);
- TableItem[] selectedTableItems = table.getSelection();
- if (selectedTableItems != null) {
- for (int i = 0; i < selectedTableItems.length; i++) {
- selectedItems.add(selectedTableItems[i].getData()
- .toString());
- }
- }
- event.data = CSSSelectorTableViewer.CSS_SELECTOR_TABLE_VIWER_ID;
- }
-
- public void dragFinished(DragSourceEvent event) {
- if (event.detail == DND.DROP_MOVE) {
- TableItem[] selectedTableItems = table.getSelection();
- if (selectedTableItems != null && selectedTableItems.length > 0) {
- for (int i = 0; i < selectedTableItems.length; i++) {
- tableViewer.remove(selectedTableItems[i].getData());
- }
- }
- parent.updateStyles();
- }
- }
-
-}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDropAdapter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDropAdapter.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDropAdapter.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -0,0 +1,265 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
+
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.TreeItem;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSSelectionEventManager;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTreeViewer;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CSSTableDropAdapter extends DropTargetAdapter {
+
+ private TableViewer tableViewer;
+ private CSSSelectorPartComposite parent;
+ private TreeViewer treeViewer;
+
+ public CSSTableDropAdapter(CSSSelectorPartComposite parent,
+ TreeViewer treeViewer, TableViewer tableViewer) {
+ this.treeViewer = treeViewer;
+ this.tableViewer = tableViewer;
+ this.parent = parent;
+ }
+
+ @Override
+ public void drop(DropTargetEvent event) {
+ if (event.data == null) {
+ event.detail = DND.DROP_NONE;
+ } else if (event.data
+ .equals(CSSSelectorTableViewer.CSS_SELECTOR_TABLE_VIWER_ID)) {
+ handleTableSelectionMove(event);
+ event.detail = DND.DROP_NONE;
+ } else if (event.data
+ .equals(CSSSelectorTreeViewer.CSS_SELECTOR_TREE_VIWER_ID)) {
+ handleTreeSelectionMove(event);
+ event.detail = DND.DROP_NONE;
+ }
+ }
+
+ protected void handleTreeSelectionMove(DropTargetEvent event) {
+ Set<String> itemsToMove = new LinkedHashSet<String>(0);
+ TreeItem[] selectedItems = treeViewer.getTree().getSelection();
+ if (selectedItems != null && selectedItems.length > 0) {
+ for (int i = 0; i < selectedItems.length; i++) {
+ TreeItem item = selectedItems[i];
+ CSSContainer container = ((CSSTreeNode) item.getData())
+ .getCSSContainer();
+ CSSTreeNode treeNode = (CSSTreeNode) item.getData();
+ if ((container instanceof CSSStyleSheetContainer)) {
+ List<CSSTreeNode> children = treeNode.getChildren();
+ for (int j = 0; j < children.size(); j++) {
+ itemsToMove.add(((CSSTreeNode) children.get(j))
+ .toString());
+ }
+ } else if (container instanceof CSSRuleContainer) {
+ itemsToMove.add(treeNode.toString());
+ }
+ }
+ filterExistingItems(itemsToMove);
+ if (itemsToMove.size() != 0) {
+ if (event.item == null) {
+ handleEndInsertFromTree(itemsToMove, event);
+ } else {
+ handleMiddleInsertFromTree(itemsToMove, event);
+ }
+ parent.updateStyles();
+ }
+ }
+ }
+
+ protected void filterExistingItems(Set<String> itemsSet) {
+ Object[] items = itemsSet.toArray();
+ for (int i = 0; i < items.length; i++) {
+ if (isContain(items[i])) {
+ itemsSet.remove(items[i]);
+ }
+ }
+ }
+
+ private boolean isContain(Object element) {
+ TableItem[] items = tableViewer.getTable().getItems();
+ if (items != null) {
+ for (int i = 0; i < items.length; i++) {
+ if (element.equals(items[i].getData())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected void handleEndInsertFromTree(Set<String> itemsToMove,
+ DropTargetEvent event) {
+ tableViewer.add(itemsToMove.toArray(new String[0]));
+ tableViewer.getTable().setFocus();
+ tableViewer.setSelection(new StructuredSelection(itemsToMove
+ .toArray(new String[0])), true);
+ }
+
+ protected void handleMiddleInsertFromTree(Set<String> itemsToMove,
+ DropTargetEvent event) {
+ String[] selectedItems = itemsToMove.toArray(new String[0]);
+ TableItem item = (TableItem) event.item;
+ Point pt = Display.getCurrent().map(null, tableViewer.getTable(),
+ event.x, event.y);
+ Rectangle bounds = item.getBounds();
+ int itemIndex = getItemIndex(item);
+ if (pt.y < bounds.y + bounds.height / 2) {
+ for (int i = 0; i < selectedItems.length; i++) {
+ itemIndex = getItemIndex(item);
+ TableItem tableItem = new TableItem(tableViewer.getTable(),
+ tableViewer.getTable().getStyle(), itemIndex);
+ tableItem.setData(selectedItems[i]);
+ }
+ tableViewer.refresh();
+ tableViewer.setSelection(new StructuredSelection(selectedItems),
+ true);
+ } else if (pt.y >= bounds.y + bounds.height / 2) {
+ for (int i = 0; i < selectedItems.length; i++) {
+ itemIndex = getItemIndex(item);
+ itemIndex = itemIndex + i + 1;
+ if (itemIndex > tableViewer.getTable().getItemCount()) {
+ itemIndex = tableViewer.getTable().getItemCount();
+ }
+ TableItem tableItem = new TableItem(tableViewer.getTable(),
+ tableViewer.getTable().getStyle(), itemIndex);
+ tableItem.setData(selectedItems[i]);
+ }
+ tableViewer.refresh();
+ tableViewer.setSelection(new StructuredSelection(selectedItems),
+ true);
+ }
+ }
+
+ @Override
+ public void dragOver(DropTargetEvent event) {
+ event.feedback = DND.FEEDBACK_SCROLL;
+ if (event.item != null) {
+ TableItem item = (TableItem) event.item;
+ Point pt = Display.getCurrent().map(null, tableViewer.getTable(),
+ event.x, event.y);
+ Rectangle bounds = item.getBounds();
+ if (pt.y < bounds.y + bounds.height / 3) {
+ event.feedback |= DND.FEEDBACK_INSERT_BEFORE;
+ } else if (pt.y > bounds.y + 2 * bounds.height / 3) {
+ event.feedback |= DND.FEEDBACK_INSERT_AFTER;
+ } else {
+ event.feedback |= DND.FEEDBACK_SELECT;
+ }
+ }
+ }
+
+ protected void handleTableSelectionMove(DropTargetEvent event) {
+ if (event.item == null) {
+ handleTableEndInsert(event);
+ } else {
+ handleTableMiddleInsert(event);
+ }
+ }
+
+ private int getItemIndex(TableItem item) {
+ TableItem[] tableItems = tableViewer.getTable().getItems();
+ for (int i = 0; i < tableItems.length; i++) {
+ if (item.getData().equals(tableItems[i].getData())) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ protected void handleTableEndInsert(DropTargetEvent event) {
+ List<String> selectedCSSNames = getSelectedItems();
+ CSSSelectionEventManager.getInstance().setHandleSelection(false);
+ tableViewer.remove(selectedCSSNames.toArray(new String[0]));
+ tableViewer.add(selectedCSSNames.toArray(new String[0]));
+ tableViewer.setSelection(new StructuredSelection(selectedCSSNames),
+ true);
+ }
+
+ protected void handleTableMiddleInsert(DropTargetEvent event) {
+ TableItem item = (TableItem) event.item;
+ Point pt = Display.getCurrent().map(null, tableViewer.getTable(),
+ event.x, event.y);
+ Rectangle bounds = item.getBounds();
+ int itemIndex = getItemIndex(item);
+ List<String> selectedItems = getSelectedItems();
+ if (selectedItems.contains(item.getData().toString())) {
+ return;
+ }
+ if (pt.y < bounds.y + bounds.height / 3) {
+ for (int i = 0; i < selectedItems.size(); i++) {
+ CSSSelectionEventManager.getInstance().setHandleSelection(false);
+ tableViewer.remove(selectedItems.get(i));
+ itemIndex = getItemIndex(item);
+ TableItem tableItem = new TableItem(tableViewer.getTable(),
+ tableViewer.getTable().getStyle(), itemIndex);
+ tableItem.setData(selectedItems.get(i));
+ }
+ tableViewer.refresh();
+ tableViewer.setSelection(new StructuredSelection(selectedItems),
+ true);
+ } else if (pt.y > bounds.y + 2 * bounds.height / 3) {
+ for (int i = 0; i < selectedItems.size(); i++) {
+ CSSSelectionEventManager.getInstance().setHandleSelection(false);
+ tableViewer.remove(selectedItems.get(i));
+ itemIndex = getItemIndex(item);
+ itemIndex = itemIndex + i + 1;
+ if (itemIndex > tableViewer.getTable().getItemCount()) {
+ itemIndex = tableViewer.getTable().getItemCount();
+ }
+ TableItem tableItem = new TableItem(tableViewer.getTable(),
+ tableViewer.getTable().getStyle(), itemIndex);
+ tableItem.setData(selectedItems.get(i));
+ }
+ tableViewer.refresh();
+ tableViewer.setSelection(new StructuredSelection(selectedItems),
+ true);
+ }
+ }
+
+ private List<String> getSelectedItems() {
+ List<String> selectedNamesList = new ArrayList<String>(0);
+ TableItem[] selectedItems = tableViewer.getTable().getSelection();
+ if (selectedItems == null) {
+ return selectedNamesList;
+ }
+ for (int i = 0; i < selectedItems.length; i++) {
+ selectedNamesList.add(selectedItems[i].getData().toString());
+ }
+ return selectedNamesList;
+ }
+
+}
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragAdapter.java (from rev 21000, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragListener.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragAdapter.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragAdapter.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTreeViewer;
+import org.w3c.dom.css.CSSRule;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("unused")
+public class CSSTreeDragAdapter implements DragSourceListener {
+
+ private Table table;
+ private Tree tree;
+ private CSSSelectorPartComposite parent;
+ private TreeViewer treeViewer;
+ private TableViewer tableViewer;
+
+ public CSSTreeDragAdapter(CSSSelectorPartComposite parent,
+ TreeViewer treeViewer, TableViewer tableViewer) {
+ this.table = tableViewer.getTable();
+ this.tree = treeViewer.getTree();
+ this.treeViewer = treeViewer;
+ this.tableViewer = tableViewer;
+ this.parent = parent;
+ }
+
+ public void dragStart(DragSourceEvent event) {
+ event.doit = tree.getSelectionCount() > 0;
+ }
+
+ public void dragSetData(DragSourceEvent event) {
+ List<String> selectedItems = new ArrayList<String>(0);
+ TreeItem[] selectedTreeItems = tree.getSelection();
+ if (selectedTreeItems != null) {
+ for (int i = 0; i < selectedTreeItems.length; i++) {
+ selectedItems.add(selectedTreeItems[i].getData().toString());
+ }
+ }
+
+ event.data = CSSSelectorTreeViewer.CSS_SELECTOR_TREE_VIWER_ID;
+ }
+
+ public void dragFinished(DragSourceEvent event) {
+ if (event.detail == DND.DROP_MOVE) {
+ Set<CSSTreeNode> itemsToMove = new LinkedHashSet<CSSTreeNode>(0);
+ TreeItem[] selectedItems = treeViewer.getTree().getSelection();
+ if (selectedItems != null && selectedItems.length > 0) {
+ for (int i = 0; i < selectedItems.length; i++) {
+ TreeItem item = selectedItems[i];
+ CSSContainer container = ((CSSTreeNode) item.getData())
+ .getCSSContainer();
+ CSSTreeNode treeNode = (CSSTreeNode) item.getData();
+ if ((container instanceof CSSStyleSheetContainer)) {
+ List<CSSTreeNode> children = treeNode.getChildren();
+ for (int j = 0; j < children.size(); j++) {
+ itemsToMove.add(children.get(j));
+ }
+ } else if (container instanceof CSSRuleContainer) {
+ itemsToMove.add(treeNode);
+ }
+ }
+ for (Iterator<CSSTreeNode> iterator = itemsToMove.iterator(); iterator
+ .hasNext();) {
+ CSSTreeNode cssTreeNode = (CSSTreeNode) iterator.next();
+ tableViewer.add(cssTreeNode.toString());
+ }
+ parent.updateStyles();
+ }
+ }
+ }
+
+}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragListener.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragListener.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTreeViewer;
-import org.w3c.dom.css.CSSRule;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-@SuppressWarnings("unused")
-public class CSSTreeDragListener implements DragSourceListener {
-
- private Table table;
- private Tree tree;
- private CSSSelectorPartComposite parent;
- private TreeViewer treeViewer;
- private TableViewer tableViewer;
-
- public CSSTreeDragListener(CSSSelectorPartComposite parent,
- TreeViewer treeViewer, TableViewer tableViewer) {
- this.table = tableViewer.getTable();
- this.tree = treeViewer.getTree();
- this.treeViewer = treeViewer;
- this.tableViewer = tableViewer;
- this.parent = parent;
- }
-
- public void dragStart(DragSourceEvent event) {
- event.doit = tree.getSelectionCount() > 0;
- }
-
- public void dragSetData(DragSourceEvent event) {
- List<String> selectedItems = new ArrayList<String>(0);
- TreeItem[] selectedTreeItems = tree.getSelection();
- if (selectedTreeItems != null) {
- for (int i = 0; i < selectedTreeItems.length; i++) {
- selectedItems.add(selectedTreeItems[i].getData().toString());
- }
- }
-
- event.data = CSSSelectorTreeViewer.CSS_SELECTOR_TREE_VIWER_ID;
- }
-
- public void dragFinished(DragSourceEvent event) {
- if (event.detail == DND.DROP_MOVE) {
- List<String> selectedItems = new ArrayList<String>(0);
- TreeItem[] selectedTreeItems = tree.getSelection();
- if (selectedTreeItems != null) {
- for (int i = 0; i < selectedTreeItems.length; i++) {
- if (((CSSTreeNode) selectedTreeItems[i].getData())
- .getCSSContainer() instanceof CSSRuleContainer) {
- selectedItems.add(selectedTreeItems[i].getData()
- .toString());
- }
- }
- }
- for (int i = 0; i < selectedItems.size(); i++) {
- tableViewer.add(selectedItems.get(i));
- }
- parent.updateStyles();
- }
- }
-
-}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSContainer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSContainer.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSContainer.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -14,13 +14,13 @@
/**
*
* @author yzhishko
- *
+ *
*/
public abstract class CSSContainer {
private String styleSheetPath;
-
+
public CSSContainer(String styleSheetPath) {
this.setStyleSheetPath(styleSheetPath);
}
@@ -32,7 +32,7 @@
public String getStyleSheetPath() {
return styleSheetPath;
}
-
+
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -41,7 +41,7 @@
if (!(obj instanceof CSSContainer)) {
return false;
}
- return styleSheetPath.equals(((CSSContainer)obj).getStyleSheetPath());
+ return styleSheetPath.equals(((CSSContainer) obj).getStyleSheetPath());
}
-
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSJSPRecognizer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSJSPRecognizer.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSJSPRecognizer.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -33,14 +33,14 @@
/**
*
* @author yzhishko
- *
+ *
*/
@SuppressWarnings("restriction")
public class CSSJSPRecognizer {
private JSPMultiPageEditor jspMultiPageEditor;
-
+
public static final int OK = 0;
public static final int VOID_RESULT = 1;
private List<CSSStyleSheet> styleSheets;
@@ -51,7 +51,7 @@
public CSSJSPRecognizer(JSPMultiPageEditor jspMultiPageEditor) {
this.jspMultiPageEditor = jspMultiPageEditor;
}
-
+
private List<CSSRuleList> extractCSSRulesLists() {
ICSSContainerSupport cssContainerSupport = null;
ELContext context = PageContextFactory.createPageContext(getFile());
@@ -109,9 +109,8 @@
}
return cssRules.toArray(new CSSRule[0]);
}
-
- public Map<String, Map<String, String>> getCSSStyleMap(
- CSSRule[] cssRules) {
+
+ public Map<String, Map<String, String>> getCSSStyleMap(CSSRule[] cssRules) {
if (cssRules == null) {
return null;
}
@@ -120,26 +119,32 @@
for (int i = 0; i < cssRules.length; i++) {
ICSSStyleRule styleRule = (ICSSStyleRule) cssRules[i];
String styleClassSelector = styleRule.getSelectorText();
- String[] selectors = CSSSelectorUtils.parseSelectorName(styleClassSelector);
+ String[] selectors = CSSSelectorUtils
+ .parseSelectorName(styleClassSelector);
for (int j = 0; j < selectors.length; j++) {
String styleClassName = selectors[j];
ICSSNodeList cssNodeList = styleRule.getChildNodes();
if (cssNodeList == null) {
continue;
}
- Map<String, String> attrsMap = new LinkedHashMap<String, String>(0);
+ Map<String, String> attrsMap = new LinkedHashMap<String, String>(
+ 0);
for (int k = 0; k < cssNodeList.getLength(); k++) {
- ICSSStyleDeclaration styleDeclaration = (ICSSStyleDeclaration) cssNodeList.item(k);
+ ICSSStyleDeclaration styleDeclaration = (ICSSStyleDeclaration) cssNodeList
+ .item(k);
ICSSNodeList attrsList = styleDeclaration.getChildNodes();
if (attrsList == null) {
continue;
}
for (int l = 0; l < attrsList.getLength(); l++) {
- ICSSStyleDeclItem styleItem = (ICSSStyleDeclItem) attrsList.item(l);
- attrsMap.put(styleItem.getPropertyName(), styleItem.getCSSValueText());
+ ICSSStyleDeclItem styleItem = (ICSSStyleDeclItem) attrsList
+ .item(l);
+ attrsMap.put(styleItem.getPropertyName(), styleItem
+ .getCSSValueText());
}
}
- Map<String, String> attrsForCSSStyle = styleMap.get(styleClassName);
+ Map<String, String> attrsForCSSStyle = styleMap
+ .get(styleClassName);
if (attrsForCSSStyle == null) {
styleMap.put(styleClassName, attrsMap);
} else {
@@ -151,23 +156,25 @@
}
return styleMap;
}
-
- public CSSSelectorTreeModel getCssStyleClassTreeModel(CSSStyleSheetDescriptor[] cssSheets){
+
+ public CSSSelectorTreeModel getCssStyleClassTreeModel(
+ CSSStyleSheetDescriptor[] cssSheets) {
if (cssSheets != null) {
return new CSSSelectorTreeModel(cssSheets);
}
return null;
}
-
- public CSSSelectorTreeModel getCssStyleClassTreeModel(){
- return getCssStyleClassTreeModel(styleSheetDescriptors.toArray(new CSSStyleSheetDescriptor[0]));
+
+ public CSSSelectorTreeModel getCssStyleClassTreeModel() {
+ return getCssStyleClassTreeModel(styleSheetDescriptors
+ .toArray(new CSSStyleSheetDescriptor[0]));
}
-
+
public Map<String, Map<String, String>> getCSSStyleMap() {
return getCSSStyleMap(this.cssRules);
}
-
- public int parseCSS(){
+
+ public int parseCSS() {
this.cssRuleLists = extractCSSRulesLists();
this.cssRules = extractCSSRules(this.cssRuleLists);
if (cssRules != null && cssRules.length != 0) {
@@ -175,13 +182,13 @@
}
return VOID_RESULT;
}
-
+
public CSSStyleSheet[] getStyleSheets() {
return styleSheets.toArray(new CSSStyleSheet[0]);
}
-
+
public CSSRule[] getCssRules() {
return cssRules;
}
-
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSRuleContainer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSRuleContainer.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSRuleContainer.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -16,7 +16,7 @@
/**
*
* @author yzhishko
- *
+ *
*/
public class CSSRuleContainer extends CSSContainer {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTableModel.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTableModel.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTableModel.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -16,13 +16,13 @@
/**
*
* @author yzhishko
- *
+ *
*/
public class CSSSelectorTableModel {
private List<String> containerList = new ArrayList<String>(0);
-
+
public List<String> getContainerList() {
return containerList;
}
@@ -30,15 +30,13 @@
public CSSSelectorTableModel(String... classNames) {
initModel(classNames);
}
-
- private void initModel(String... classNames){
+
+ private void initModel(String... classNames) {
if (classNames != null) {
for (int i = 0; i < classNames.length; i++) {
containerList.add(classNames[i]);
}
}
}
-
-
-
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTreeModel.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTreeModel.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTreeModel.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -53,8 +53,8 @@
.getSelectorText());
for (int k = 0; k < selectors.length; k++) {
CSSTreeNode ruleNode = new CSSTreeNode(selectors[k]);
- ruleNode.setCSSContainer(new CSSRuleContainer(selectors[k], cssRule,
- cssStyleSheets[i].source));
+ ruleNode.setCSSContainer(new CSSRuleContainer(selectors[k],
+ cssRule, cssStyleSheets[i].source));
ruleNode.setStyleSheetSource(cssStyleSheets[i].source);
parentSheet.addChild(ruleNode);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorUtils.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorUtils.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorUtils.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -11,34 +11,52 @@
package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+import java.io.IOException;
+import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
+import org.eclipse.wst.css.core.internal.parser.CSSTokenizer;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
/**
*
* @author yzhishko
- *
+ *
*/
+@SuppressWarnings("restriction")
public class CSSSelectorUtils {
- private static String filterName(String className){
+ private static String filterName(String className) {
className = className.trim();
if (className.indexOf(' ') > -1) {
return null;
}
- if (className.indexOf('.')==className.lastIndexOf('.')) {
+ if (className.indexOf('.') == className.lastIndexOf('.')) {
if (className.indexOf('.') == 0) {
- return className.substring(className.indexOf('.')+1);
+ CSSTokenizer cssTokenizer = new CSSTokenizer(new StringReader(
+ className + "{}")); //$NON-NLS-1$
+ try {
+ while (!cssTokenizer.isEOF()) {
+ String token = cssTokenizer.primGetNextToken();
+ if ("undefined".equalsIgnoreCase(token)) { //$NON-NLS-1$
+ return null;
+ }
+ }
+ } catch (IOException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ return className.substring(className.indexOf('.') + 1);
}
}
return null;
}
-
- public static String[] parseSelectorName(String selectorText){
+
+ public static String[] parseSelectorName(String selectorText) {
List<String> selectors = new ArrayList<String>(0);
- StringTokenizer tokenizer = new StringTokenizer(selectorText, ",", false); //$NON-NLS-1$
+ StringTokenizer tokenizer = new StringTokenizer(selectorText,
+ ",", false); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
String selectorName = tokenizer.nextToken();
selectorName = filterName(selectorName);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSStyleSheetContainer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSStyleSheetContainer.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSStyleSheetContainer.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -16,7 +16,7 @@
/**
*
* @author yzhishko
- *
+ *
*/
public class CSSStyleSheetContainer extends CSSContainer {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSTreeNode.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSTreeNode.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSTreeNode.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -17,7 +17,7 @@
/**
*
* @author yzhishko
- *
+ *
*/
public class CSSTreeNode {
@@ -61,12 +61,13 @@
public CSSContainer getCSSContainer() {
return cssResource;
}
-
- public void setStyleSheetSource(String source){
+
+ public void setStyleSheetSource(String source) {
styleSheetSource = source;
}
-
- public String getStyleSheetSource(){
+
+ public String getStyleSheetSource() {
return styleSheetSource;
}
+
}
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectionEventManager.java (from rev 21000, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectorEventManager.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectionEventManager.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectionEventManager.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CSSSelectionEventManager {
+
+ private static CSSSelectionEventManager instance = new CSSSelectionEventManager();
+ private boolean handleSelection = true;
+
+ private CSSSelectionEventManager() {
+
+ }
+
+ public static CSSSelectionEventManager getInstance() {
+ return instance;
+ }
+
+ public CSSTreeSelectionChangedEvent createTreeSelectionChangedEvent(
+ SelectionChangedEvent event, CSSSelectorTreeModel model) {
+ return new CSSTreeSelectionChangedEvent(event.getSelectionProvider(),
+ event.getSelection(), model);
+ }
+
+ public CSSTableSelectionChangedEvent createTableSelectionChangedEvent(
+ SelectionChangedEvent event, CSSSelectorTreeModel model) {
+ return new CSSTableSelectionChangedEvent(event.getSelectionProvider(),
+ event.getSelection(), model);
+ }
+
+ public void setHandleSelection(boolean handleSelection) {
+ this.handleSelection = handleSelection;
+ }
+
+ public boolean isHandleSelection() {
+ return handleSelection;
+ }
+
+}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectorEventManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectorEventManager.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectorEventManager.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
-
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-public class CSSSelectorEventManager {
-
- private static CSSSelectorEventManager instance = new CSSSelectorEventManager();
-
- private CSSSelectorEventManager() {
-
- }
-
- public static CSSSelectorEventManager getInstance() {
- return instance;
- }
-
- public CSSTreeSelectionChangedEvent createTreeSelectionChangedEvent(
- SelectionChangedEvent event, CSSSelectorTreeModel model) {
- return new CSSTreeSelectionChangedEvent(event.getSelectionProvider(),
- event.getSelection(), model);
- }
-
- public CSSTableSelectionChangedEvent createTableSelectionChangedEvent(
- SelectionChangedEvent event, CSSSelectorTreeModel model) {
- return new CSSTableSelectionChangedEvent(event.getSelectionProvider(),
- event.getSelection(), model);
- }
-
-}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/ICSSClassSelectionChangedListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/ICSSClassSelectionChangedListener.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/ICSSClassSelectionChangedListener.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -14,11 +14,11 @@
/**
*
* @author yzhishko
- *
+ *
*/
public interface ICSSClassSelectionChangedListener {
void classSelectionChanged(CSSClassSelectionChangedEvent event);
-
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorFilter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorFilter.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorFilter.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -20,31 +20,31 @@
/**
*
* @author yzhishko
- *
+ *
*/
-public class CSSSelectorFilter extends ViewerFilter{
+public class CSSSelectorFilter extends ViewerFilter {
private Set<String> filterNames = new HashSet<String>(0);
-
+
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (filterNames.contains(((CSSTreeNode)element).toString())) {
+ if (filterNames.contains(((CSSTreeNode) element).toString())) {
return false;
}
return true;
}
-
- public void removeFilterName(String name){
+
+ public void removeFilterName(String name) {
filterNames.remove(name);
}
-
- public void addFilterName(String name){
+
+ public void addFilterName(String name) {
filterNames.add(name);
}
-
- public void removeAllFilters(){
+
+ public void removeAllFilters() {
filterNames.clear();
}
-
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableContentProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableContentProvider.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableContentProvider.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -19,22 +19,22 @@
/**
*
* @author yzhishko
- *
+ *
*/
-public class CSSSelectorTableContentProvider implements IListContentProvider{
+public class CSSSelectorTableContentProvider implements IListContentProvider {
@SuppressWarnings("unchecked")
public Object[] getElements(Object inputElement) {
- return ((List<String>)inputElement).toArray();
+ return ((List<String>) inputElement).toArray();
}
public void dispose() {
-
+
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
+
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableViewer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableViewer.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableViewer.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -13,10 +13,10 @@
import java.util.ArrayList;
import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TableItem;
@@ -27,36 +27,44 @@
/**
*
* @author yzhishko
- *
+ *
*/
-public class CSSSelectorTableViewer extends TableViewer{
+public class CSSSelectorTableViewer extends TableViewer {
public final static String CSS_SELECTOR_TABLE_VIWER_ID = "css_selector_table_viwer"; //$NON-NLS-1$
- private final static ImageDescriptor CSS_STYLE_CLASS_DESCR = JspEditorPlugin.getImageDescriptor(Constants.IMAGE_STYLE_CLASS_LOCATION);
+ private Image CSS_STYLE_CLASS_IMAGE = JspEditorPlugin.getImageDescriptor(
+ Constants.IMAGE_STYLE_CLASS_LOCATION).createImage();
private CSSSelectorTableModel model;
-
+
public CSSSelectorTableViewer(Composite parent, int style) {
super(parent, style);
setContentProvider(new CSSSelectorTableContentProvider());
- setLabelProvider(new LabelProvider(){
+ setLabelProvider(new LabelProvider() {
@Override
public Image getImage(Object element) {
- return CSS_STYLE_CLASS_DESCR.createImage();
+ return CSS_STYLE_CLASS_IMAGE;
}
});
+ getTable().addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ CSS_STYLE_CLASS_IMAGE.dispose();
+ CSS_STYLE_CLASS_IMAGE = null;
+ }
+ });
}
-
- public void setModel(CSSSelectorTableModel model){
+
+ public void setModel(CSSSelectorTableModel model) {
setInput(model.getContainerList());
this.model = model;
}
-
- public CSSSelectorTableModel getModel(){
+
+ public CSSSelectorTableModel getModel() {
return model;
}
-
+
@Override
public void add(Object element) {
if (element != null) {
@@ -66,7 +74,7 @@
}
super.add(element);
}
-
+
@Override
public void add(Object[] elements) {
List<Object> objects = new ArrayList<Object>(0);
@@ -79,8 +87,8 @@
}
super.add(objects.toArray());
}
-
- private boolean isContain(Object element){
+
+ private boolean isContain(Object element) {
TableItem[] items = getTable().getItems();
if (items != null) {
for (int i = 0; i < items.length; i++) {
@@ -91,5 +99,20 @@
}
return false;
}
-
+
+ @Override
+ public void refresh() {
+ if (model != null) {
+ model.getContainerList().clear();
+ TableItem[] tableItems = getTable().getItems();
+ if (tableItems != null) {
+ for (int i = 0; i < tableItems.length; i++) {
+ model.getContainerList().add(
+ tableItems[i].getData().toString());
+ }
+ }
+ }
+ super.refresh();
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeContentProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeContentProvider.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeContentProvider.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -18,25 +18,25 @@
/**
*
* @author yzhishko
- *
+ *
*/
public class CSSSelectorTreeContentProvider implements ITreeContentProvider {
public Object[] getChildren(Object parentElement) {
- return ((CSSTreeNode)parentElement).getChildren().toArray();
+ return ((CSSTreeNode) parentElement).getChildren().toArray();
}
public Object getParent(Object element) {
- return ((CSSTreeNode)element).getParent();
+ return ((CSSTreeNode) element).getParent();
}
public boolean hasChildren(Object element) {
- return ((CSSTreeNode)element).hasChildren();
+ return ((CSSTreeNode) element).hasChildren();
}
public Object[] getElements(Object inputElement) {
- return ((CSSTreeNode)inputElement).getChildren().toArray();
+ return ((CSSTreeNode) inputElement).getChildren().toArray();
}
public void dispose() {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeLabelProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeLabelProvider.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeLabelProvider.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -11,7 +11,6 @@
package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
@@ -23,23 +22,34 @@
/**
*
* @author yzhishko
- *
+ *
*/
public class CSSSelectorTreeLabelProvider extends LabelProvider {
- private final static ImageDescriptor CSS_STYLE_SHEET_DESCR = JspEditorPlugin.getImageDescriptor(Constants.IMAGE_STYLE_SHEET_LOCATION);
- private final static ImageDescriptor CSS_STYLE_CLASS_DESCR = JspEditorPlugin.getImageDescriptor(Constants.IMAGE_STYLE_CLASS_LOCATION);
-
+ private Image CSS_STYLE_SHEET_IMAGE = JspEditorPlugin.getImageDescriptor(
+ Constants.IMAGE_STYLE_SHEET_LOCATION).createImage();
+ private Image CSS_STYLE_CLASS_IMAGE = JspEditorPlugin.getImageDescriptor(
+ Constants.IMAGE_STYLE_CLASS_LOCATION).createImage();
+
@Override
public Image getImage(Object element) {
if (((CSSTreeNode) element).getCSSContainer() instanceof CSSStyleSheetContainer) {
- return CSS_STYLE_SHEET_DESCR.createImage();
+ return CSS_STYLE_SHEET_IMAGE;
}
if (((CSSTreeNode) element).getCSSContainer() instanceof CSSRuleContainer) {
- return CSS_STYLE_CLASS_DESCR.createImage();
+ return CSS_STYLE_CLASS_IMAGE;
}
return super.getImage(element);
}
-
+
+ @Override
+ public void dispose() {
+ CSS_STYLE_CLASS_IMAGE.dispose();
+ CSS_STYLE_SHEET_IMAGE.dispose();
+ CSS_STYLE_CLASS_IMAGE = null;
+ CSS_STYLE_SHEET_IMAGE = null;
+ super.dispose();
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeViewer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeViewer.java 2010-03-26 14:43:50 UTC (rev 21054)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeViewer.java 2010-03-26 16:23:10 UTC (rev 21055)
@@ -18,28 +18,28 @@
/**
*
* @author yzhishko
- *
+ *
*/
public class CSSSelectorTreeViewer extends TreeViewer {
public final static String CSS_SELECTOR_TREE_VIWER_ID = "css_selector_tree_viwer"; //$NON-NLS-1$
private CSSSelectorTreeModel model;
-
+
public CSSSelectorTreeViewer(Composite parent, int style) {
super(parent, style);
setContentProvider(new CSSSelectorTreeContentProvider());
setLabelProvider(new CSSSelectorTreeLabelProvider());
}
-
- public void setModel(CSSSelectorTreeModel model){
+
+ public void setModel(CSSSelectorTreeModel model) {
if (model != null) {
setInput(model.getInvisibleRoot());
this.model = model;
}
}
-
- public CSSSelectorTreeModel getModel(){
+
+ public CSSSelectorTreeModel getModel() {
return model;
}
14 years, 9 months
JBoss Tools SVN: r21054 - in trunk: jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580 and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2010-03-26 10:43:50 -0400 (Fri, 26 Mar 2010)
New Revision: 21054
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-2buttons.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-4buttons.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-4button.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-8button.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1682/JBIDE-1682-with-popup.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/pickList/pickList.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DraggablePattern.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5042
Enhance DnD support in VPE:
- Now new Drag&Drop button is rendered over draggable elements.
- JUnit tests have been fixed according to changes in UI.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-2buttons.xhtml
===================================================================
(Binary files differ)
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-4buttons.xhtml
===================================================================
(Binary files differ)
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-4button.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-4button.xhtml 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-4button.xhtml 2010-03-26 14:43:50 UTC (rev 21054)
@@ -10,7 +10,7 @@
</head>
<body>
-<rich:listShuttle sourceValue="#{person.source}"
+<rich:listShuttle id="testElement" sourceValue="#{person.source}"
targetValue="#{person.target}" var="items" targetListWidth="200"
sourceCaptionLabel="source label" targetCaptionLabel="target label"
orderControlsVerticalAlign="top" fastMoveControlsVisible="false"
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-8button.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-8button.xhtml 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-8button.xhtml 2010-03-26 14:43:50 UTC (rev 21054)
@@ -10,7 +10,7 @@
</head>
<body>
-<rich:listShuttle sourceValue="#{person.source}"
+<rich:listShuttle id="testElement" sourceValue="#{person.source}"
targetValue="#{person.target}" var="items" targetListWidth="200"
sourceCaptionLabel="source label" targetCaptionLabel="target label"
orderControlsVerticalAlign="top">
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml 2010-03-26 14:43:50 UTC (rev 21054)
@@ -16,6 +16,6 @@
<body>
<!-- Spacer component -->
-<rich:spacer width="720" height="50" styleClass="spacerStyle"/>
+<rich:spacer id="testElement" width="720" height="50" styleClass="spacerStyle"/>
</body>
</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1682/JBIDE-1682-with-popup.xhtml
===================================================================
(Binary files differ)
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/pickList/pickList.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/pickList/pickList.xhtml 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/pickList/pickList.xhtml 2010-03-26 14:43:50 UTC (rev 21054)
@@ -10,6 +10,6 @@
</head>
<body>
<!-- PickList -->
- <rich:pickList/>
+ <rich:pickList id="testElement"/>
</body>
</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -18,9 +18,14 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -31,6 +36,8 @@
* @author Eugene Stherbin
*/
public class RichFacesPickListTemplateTestCase extends VpeTest {
+ private static final String FILE_NAME = "components/pickList/pickList.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
/**
* The Constructor.
@@ -44,33 +51,45 @@
/**
* Test simple pick list.
*/
- public void testSimplePickList() {
- nsIDOMElement rst;
- try {
- rst = TestUtil.performTestForRichFacesComponent((IFile) TestUtil.getComponentPath("components/pickList/pickList.xhtml", //$NON-NLS-1$
- RichFacesAllTests.IMPORT_PROJECT_NAME));
+ public void testSimplePickList() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME,
+ RichFacesAllTests.IMPORT_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get dom document
+ nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
+ assertNotNull(document);
+
+ VpeController controller = TestUtil.getVpeController(part);
+
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
+ assertNotNull(element);
+
final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_TABLE);
+ TestUtil.findAllElementsByName(element, elements, HTML.TAG_TABLE);
assertEquals("Count of tables should be 3", 3, elements.size()); //$NON-NLS-1$
nsIDOMElement tableOne = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
assertEquals("Style class should be equals", "rich-list-picklist", tableOne.getAttribute(HTML.ATTR_CLASS)); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Style should be empty", "", tableOne.getAttribute(HTML.ATTR_STYLE)); //$NON-NLS-1$ //$NON-NLS-2$
elements.clear();
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_DIV);
- assertEquals("Count of divs should be 18", 18, elements.size()); //$NON-NLS-1$
+ TestUtil.findAllElementsByName(element, elements, HTML.TAG_DIV);
+ assertEquals("Count of divs should be 15", 15, elements.size()); //$NON-NLS-1$
elements.clear();
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_IMG);
- assertEquals("Count of divs should be 18", 4, elements.size()); //$NON-NLS-1$
-
- } catch (CoreException e) {
- TestUtil.fail(e);
- } catch (Throwable e) {
- TestUtil.fail(e);
- }
-
+ TestUtil.findAllElementsByName(element, elements, HTML.TAG_IMG);
+ assertEquals("Count of img should be 4", 4, elements.size()); //$NON-NLS-1$
}
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -8,6 +8,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.jsf.vpe.richfaces.test.RichFacesAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -19,6 +20,7 @@
private static final String TEST_PAGE_NAME_2BUTTONS = "JBIDE/1579/JBIDE-1579-2buttons.xhtml";
private static final String TEST_PAGE_NAME_4BUTTONS = "JBIDE/1579/JBIDE-1579-4buttons.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
public JBIDE1579Test(String name) {
super(name);
@@ -42,10 +44,9 @@
assertNotNull("Editor input is null", input);
// open and get editor
JSPMultiPageEditor part = openEditor(input);
+ VpeController controller = TestUtil.getVpeController(part);
- // get dom document
- nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
- nsIDOMElement element = document.getDocumentElement();
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
//check that element is not null
assertNotNull(element);
@@ -80,10 +81,9 @@
assertNotNull("Editor input is null", input);
// open and get editor
JSPMultiPageEditor part = openEditor(input);
+ VpeController controller = TestUtil.getVpeController(part);
- // get dom document
- nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
- nsIDOMElement element = document.getDocumentElement();
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
//check that element is not null
assertNotNull(element);
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -21,6 +21,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.jsf.vpe.richfaces.test.RichFacesAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -38,6 +39,7 @@
public static final String FILE_NAME1 = "JBIDE/1580/JBIDE-1580-8button.xhtml";
public static final String FILE_NAME2 = "JBIDE/1580/JBIDE-1580-4button.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
public Jbide1580Test(String name) {
super(name);
@@ -63,8 +65,9 @@
nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
assertNotNull(document);
- // get dom element
- nsIDOMElement element = document.getDocumentElement();
+ VpeController controller = TestUtil.getVpeController(part);
+
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
assertNotNull(element);
// get root node
@@ -105,8 +108,9 @@
nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
assertNotNull(document);
- // get dom element
- nsIDOMElement element = document.getDocumentElement();
+ VpeController controller = TestUtil.getVpeController(part);
+
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
assertNotNull(element);
// get root node
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -21,6 +21,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.jsf.vpe.richfaces.test.RichFacesAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -37,6 +38,7 @@
public class Jbide1639Test extends VpeTest {
public static final String FILE_NAME = "JBIDE/1639/JBIDE-1639.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
public Jbide1639Test(String name) {
super(name);
@@ -62,23 +64,11 @@
nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
assertNotNull(document);
- // get dom element
- nsIDOMElement element = document.getDocumentElement();
- assertNotNull(element);
+ VpeController controller = TestUtil.getVpeController(part);
- // get root node
- nsIDOMNode node = (nsIDOMNode) element
- .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+ nsIDOMElement img = findElementById(controller, TEST_ELEMENT_ID);
+ Assert.assertTrue(HTML.TAG_IMG.equalsIgnoreCase(img.getNodeName()));
- List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- // find "img" elements
- TestUtil.findElementsByName(node, elements, HTML.TAG_IMG);
-
- Assert.assertEquals(1, elements.size());
-
- nsIDOMNode img = elements.get(0);
-
nsIDOMNamedNodeMap attributes = img.getAttributes();
// "img" must have attributes
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -11,6 +11,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.jsf.vpe.richfaces.test.RichFacesAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -26,6 +27,7 @@
public static final String TEST_PAGE_WITH_POPUP = "JBIDE/1682/JBIDE-1682-with-popup.xhtml";
public static final String TEST_PAGE_WITHOUT_POPUP = "JBIDE/1682/JBIDE-1682-without-popup.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
public Jbide1682Test(String name) {
super(name);
@@ -50,9 +52,9 @@
// open and get editor
JSPMultiPageEditor part = openEditor(input);
- // get dom document
- nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
- nsIDOMElement element = document.getDocumentElement();
+ VpeController controller = TestUtil.getVpeController(part);
+
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
//check that element is not null
assertNotNull(element);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DraggablePattern.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DraggablePattern.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DraggablePattern.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -18,6 +18,7 @@
import org.mozilla.interfaces.nsIDOMCSSStyleDeclaration;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMElementCSSInlineStyle;
+import org.mozilla.interfaces.nsIDOMMouseEvent;
import org.mozilla.interfaces.nsIDOMNode;
/**
@@ -86,6 +87,12 @@
return new DragIcon(dragIconElement);
}
+ public boolean isDragIconClicked(nsIDOMMouseEvent mouseEvent) {
+ nsIDOMNode targetNode = (nsIDOMNode) mouseEvent.getTarget()
+ .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+ return getDragIcon().getElement().equals(targetNode);
+ }
+
public nsIDOMNode getNode() {
return node;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -105,18 +105,17 @@
public VpeDnD(VpeController vpeController, MozillaEditor mozillaEditor) {
this.vpeController = vpeController;
- this.draggablePattern = new DraggablePattern(mozillaEditor);
+ draggablePattern = new DraggablePattern(mozillaEditor);
}
public void dragGesture(nsIDOMEvent domEvent) {
- nsIDOMMouseEvent mouseEvent = (nsIDOMMouseEvent) domEvent
- .queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
nsIDOMElement selectedElement = vpeController.getXulRunnerEditor()
.getLastSelectedElement();
- boolean canDragFlag = isDraggable(selectedElement);
// start drag sessionvpe-element
- if (canDragFlag) {
- startDragSession(domEvent);
+ if (isDraggable(selectedElement)) {
+ startDragSession(selectedElement);
+ domEvent.stopPropagation();
+ domEvent.preventDefault();
}
}
@@ -148,28 +147,34 @@
}
vpeController.onRefresh();
}
-
+
public void selectionChanged() {
-
+ nsIDOMElement selectedElement = vpeController.getXulRunnerEditor()
+ .getLastSelectedElement();
+ if (isDraggable(selectedElement)) {
+ draggablePattern.showDragIcon(selectedElement);
+ } else {
+ draggablePattern.hideDragIcon();
+ }
}
+ public boolean isDragIconClicked(nsIDOMMouseEvent mouseEvent) {
+ return draggablePattern.isDragIconClicked(mouseEvent);
+ }
+
/**
* Starts drag session
* @param dragetElement
*/
- private void startDragSession(nsIDOMEvent domEvent) {
+ private void startDragSession(nsIDOMNode node) {
nsISupportsArray transArray = (nsISupportsArray) getComponentManager()
- .createInstanceByContractID(XPCOM.NS_SUPPORTSARRAY_CONTRACTID, null,
- nsISupportsArray.NS_ISUPPORTSARRAY_IID);
+ .createInstanceByContractID(XPCOM.NS_SUPPORTSARRAY_CONTRACTID, null,
+ nsISupportsArray.NS_ISUPPORTSARRAY_IID);
transArray.appendElement(createTransferable());
- getDragService().invokeDragSession((nsIDOMNode) domEvent.getTarget().queryInterface(nsIDOMNode.NS_IDOMNODE_IID), transArray, null,
+ getDragService().invokeDragSession(node, transArray, null,
nsIDragService.DRAGDROP_ACTION_MOVE
| nsIDragService.DRAGDROP_ACTION_COPY
| nsIDragService.DRAGDROP_ACTION_LINK);
-
- domEvent.stopPropagation();
- domEvent.preventDefault();
-
}
/**
@@ -896,7 +901,6 @@
}
return closestNode;
}
-
// this method is never used
// public VpeSourceInnerDropInfo canExternalDropMacro(XModelObject object, Node parentNode, int offset) {
// String tagname = vpeController.getTagName(object);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -98,7 +98,6 @@
import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
import org.jboss.tools.vpe.editor.mozilla.MozillaEventAdapter;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaContextMenuListener;
-import org.jboss.tools.vpe.editor.mozilla.listener.MozillaDndListener;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaKeyListener;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaMouseListener;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaResizeListener;
@@ -1195,13 +1194,7 @@
// drag gesture isn't generated in XR 1.9 for Linux Platforms,
// so we start it's manually
// mareshkau
- nsIDOMElement selectedElement = getXulRunnerEditor()
- .getLastSelectedElement();
- if (selectedElement != null
- && VpeVisualDomBuilder.inDragArea(
- XulRunnerVpeUtils.getElementBounds(
- selectedElement),
- VisualDomUtil.getMousePoint(mouseEvent))) {
+ if (vpeDnD.isDragIconClicked(mouseEvent)) {
vpeDnD.dragGesture(mouseEvent);
} else {
selectionManager.setSelection(mouseEvent);
@@ -1284,23 +1277,13 @@
}
public void mouseMove(nsIDOMMouseEvent mouseEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
- }
- try {
- nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
- if (visualNode != null) {
- // if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- // System.out.println("<<< mouseMove visualNode: "
- // + visualNode.getNodeName() + " (" + visualNode
- // + ")");
- // }
- visualBuilder.setMoveCursor(mouseEvent);
- }
- } finally {
- switcher.stopActiveEditor();
- }
+// nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
+// if (visualNode != null) {
+// if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
+// System.out.println("<<< mouseMove visualNode: "
+// + visualNode.getNodeName() + " (" + visualNode + ")");
+// }
+// }
}
public void keyPress(nsIDOMKeyEvent keyEvent) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -78,7 +78,6 @@
import org.mozilla.interfaces.nsIDOMEvent;
import org.mozilla.interfaces.nsIDOMEventTarget;
import org.mozilla.interfaces.nsIDOMHTMLDocument;
-import org.mozilla.interfaces.nsIDOMMouseEvent;
import org.mozilla.interfaces.nsIDOMNSEvent;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
@@ -2044,21 +2043,6 @@
}
}
- void setMoveCursor(nsIDOMMouseEvent mouseEvent) {
- nsIDOMElement selectedElement = xulRunnerEditor
- .getLastSelectedElement();
- if (selectedElement != null && canInnerDrag(selectedElement)
- && inDragArea(getNodeBounds(selectedElement), VisualDomUtil
- .getMousePoint(mouseEvent))) {
- // change cursor
- showMoveCursor(true);
- //if mouse in drag area, and left button is pressed than we should
- //start drag session manually.
- } else {
- // change cursor style to normal
- showMoveCursor(false);
- }
- }
public static boolean inDragArea(Rectangle dragArea, Point mousePoint) {
// TODO add drag and drop support
@@ -2067,19 +2051,6 @@
&& mousePoint.y < (dragArea.y + DRAG_AREA_HEIGHT);
}
- nsIDOMElement getDragElement(nsIDOMMouseEvent mouseEvent) {
-
- nsIDOMElement selectedElement = xulRunnerEditor
- .getLastSelectedElement();
- if (selectedElement != null && canInnerDrag(selectedElement)) {
- if (inDragArea(getNodeBounds(selectedElement), VisualDomUtil
- .getMousePoint(mouseEvent))) {
- return selectedElement;
- }
- }
- return null;
- }
-
public nsIDOMNode getOriginalTargetNode(nsIDOMEvent event) {
nsIDOMNode targetNode = VisualDomUtil.getTargetNode(event);
if (HTML.TAG_INPUT.equalsIgnoreCase(targetNode.getNodeName())) {
@@ -2346,4 +2317,35 @@
return span;
}
+
+// this method is never used
+// void setMoveCursor(nsIDOMMouseEvent mouseEvent) {
+// nsIDOMElement selectedElement = xulRunnerEditor
+// .getLastSelectedElement();
+// if (selectedElement != null && canInnerDrag(selectedElement)
+// && inDragArea(getNodeBounds(selectedElement), VisualDomUtil
+// .getMousePoint(mouseEvent))) {
+// // change cursor
+// showMoveCursor(true);
+// //if mouse in drag area, and left button is pressed than we should
+// //start drag session manually.
+// } else {
+// // change cursor style to normal
+// showMoveCursor(false);
+// }
+// }
+
+// this method is never used
+// nsIDOMElement getDragElement(nsIDOMMouseEvent mouseEvent) {
+//
+// nsIDOMElement selectedElement = xulRunnerEditor
+// .getLastSelectedElement();
+// if (selectedElement != null && canInnerDrag(selectedElement)) {
+// if (inDragArea(getNodeBounds(selectedElement), VisualDomUtil
+// .getMousePoint(mouseEvent))) {
+// return selectedElement;
+// }
+// }
+// return null;
+// }
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -284,27 +284,6 @@
*
* @param controller
* @param elementId
- * @return
- */
- protected nsIDOMElement findElementById(VpeController controller,
- String elementId) {
-
- Element sourceElement = findSourceElementById(controller, elementId);
-
- VpeNodeMapping nodeMapping = controller.getDomMapping().getNodeMapping(
- sourceElement);
-
- if (nodeMapping == null)
- return null;
-
- return (nsIDOMElement) nodeMapping.getVisualNode();
- }
-
- /**
- * find visual element by "id" entered in source part of vpe
- *
- * @param controller
- * @param elementId
* @param idle try element for some time period, for example when we need
* to wait for refresh job
* @return
@@ -340,22 +319,9 @@
}
/**
- * find source element by "id"
*
- * @param controller
- * @param elementId
* @return
*/
- protected Element findSourceElementById(VpeController controller,
- String elementId) {
-
- return getSourceDocument(controller).getElementById(elementId);
- }
-
- /**
- *
- * @return
- */
abstract protected String getTestProjectName();
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-03-26 14:42:18 UTC (rev 21053)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-03-26 14:43:50 UTC (rev 21054)
@@ -45,8 +45,10 @@
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
import org.jboss.tools.vpe.editor.util.SelectionUtil;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
+import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -375,4 +377,38 @@
final VpeController vpeController = TestUtil.getVpeController(part);
return vpeController;
}
+
+ /**
+ * find source element by "id"
+ *
+ * @param controller
+ * @param elementId
+ * @return
+ */
+ protected Element findSourceElementById(VpeController controller,
+ String elementId) {
+
+ return getSourceDocument(controller).getElementById(elementId);
+ }
+
+ /**
+ * find visual element by "id" entered in source part of vpe
+ *
+ * @param controller
+ * @param elementId
+ * @return
+ */
+ protected nsIDOMElement findElementById(VpeController controller,
+ String elementId) {
+
+ Element sourceElement = findSourceElementById(controller, elementId);
+
+ VpeNodeMapping nodeMapping = controller.getDomMapping().getNodeMapping(
+ sourceElement);
+
+ if (nodeMapping == null)
+ return null;
+
+ return (nsIDOMElement) nodeMapping.getVisualNode();
+ }
}
14 years, 9 months
JBoss Tools SVN: r21053 - trunk/documentation/guides/GettingStartedGuide/en-US.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2010-03-26 10:42:18 -0400 (Fri, 26 Mar 2010)
New Revision: 21053
Modified:
trunk/documentation/guides/GettingStartedGuide/en-US/manage.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-1080 - Unclear text in Getting Startet Guide documentation - fixed
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/manage.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/manage.xml 2010-03-26 11:38:45 UTC (rev 21052)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/manage.xml 2010-03-26 14:42:18 UTC (rev 21053)
@@ -18,7 +18,11 @@
<para><property>JBoss Developer Studio 3.0.0.GA</property> is shipped with <property>JBoss EAP 5
</property>. When you followed the default installation of <property>JBoss
Developer Studio</property>, you should already have a JBoss EAP 5 Server installed and
- defined. To run JBoss AS you need JDK 1.6.</para>
+ defined. To run JBoss AS you need preinstalled JDK 6.</para>
+ <note>
+ <title>Note:</title>
+ <para>You can leave <property>JDK 1.5</property> configuration for <property>JBDS</property> and set <property>JDK 6</property> as <property>JRE</property> only for <property>JBoss EAP Server</property>. For this you need on <emphasis><property>Windows > Preferences</property></emphasis> menu click <emphasis><property>Server > Runtime Enviroments</property></emphasis>. On the opened preference page you should select <property>JBoss EAP Runtime</property> and click <property>Edit</property>. In <property>Edit Server Runtime Enviroment</property> dialog you can configure <property>Jave Runtime Enviroment</property> by clicking <property>JRE</property> button. </para>
+ </note>
<section id="JBossbundled">
<?dbhtml filename="JBossbundled.html"?>
14 years, 9 months
JBoss Tools SVN: r21052 - in trunk/documentation/guides/GettingStartedGuide/en-US/images: rad_jsf_application and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2010-03-26 07:38:45 -0400 (Fri, 26 Mar 2010)
New Revision: 21052
Modified:
trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam18.png
trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam24.png
trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam46.png
trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam48.png
trunk/documentation/guides/GettingStartedGuide/en-US/images/rad_jsf_application/rad_jsf_application_18.png
Log:
https://jira.jboss.org/jira/browse/JBDS-980 - Getting Started Guide is updated
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam18.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam24.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam46.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam48.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/images/rad_jsf_application/rad_jsf_application_18.png
===================================================================
(Binary files differ)
14 years, 9 months
JBoss Tools SVN: r21051 - in trunk/as/docs/reference/en-US/images: perspective and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2010-03-26 07:11:37 -0400 (Fri, 26 Mar 2010)
New Revision: 21051
Modified:
trunk/as/docs/reference/en-US/images/modules/modules_3.png
trunk/as/docs/reference/en-US/images/modules/modules_4.png
trunk/as/docs/reference/en-US/images/perspective/dnd_toJBossServerView.png
trunk/as/docs/reference/en-US/images/perspective/filesets1.png
trunk/as/docs/reference/en-US/images/perspective/filesets3.png
trunk/as/docs/reference/en-US/images/perspective/filesets4.png
trunk/as/docs/reference/en-US/images/perspective/perspective_1.png
trunk/as/docs/reference/en-US/images/perspective/perspective_12.png
trunk/as/docs/reference/en-US/images/perspective/perspective_14.png
trunk/as/docs/reference/en-US/images/perspective/perspective_15.png
trunk/as/docs/reference/en-US/images/perspective/perspective_16.png
trunk/as/docs/reference/en-US/images/perspective/perspective_23b.png
trunk/as/docs/reference/en-US/images/perspective/perspective_23c.png
trunk/as/docs/reference/en-US/images/perspective/perspective_26.png
trunk/as/docs/reference/en-US/images/perspective/perspective_7.png
trunk/as/docs/reference/en-US/images/perspective/perspective_8.png
trunk/as/docs/reference/en-US/images/perspective/server_classpaths.png
trunk/as/docs/reference/en-US/images/quick_start/quick_start_1.png
trunk/as/docs/reference/en-US/images/quick_start/quick_start_5.png
trunk/as/docs/reference/en-US/images/tptp_support/tptp_support_1.png
Log:
https://jira.jboss.org/jira/browse/JBDS-1143 - Some screenshots was updated
Modified: trunk/as/docs/reference/en-US/images/modules/modules_3.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/modules/modules_4.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/dnd_toJBossServerView.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/filesets1.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/filesets3.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/filesets4.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_1.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_12.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_14.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_15.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_16.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_23b.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_23c.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_26.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_7.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/perspective_8.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/perspective/server_classpaths.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/quick_start/quick_start_1.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/quick_start/quick_start_5.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en-US/images/tptp_support/tptp_support_1.png
===================================================================
(Binary files differ)
14 years, 9 months
JBoss Tools SVN: r21050 - in trunk/xulrunner/features: org.mozilla.xulrunner.site and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-03-26 03:22:01 -0400 (Fri, 26 Mar 2010)
New Revision: 21050
Added:
trunk/xulrunner/features/org.mozilla.xpcom.feature/.project
trunk/xulrunner/features/org.mozilla.xpcom.feature/build.properties
trunk/xulrunner/features/org.mozilla.xpcom.feature/feature.xml
trunk/xulrunner/features/org.mozilla.xulrunner.site/.project
trunk/xulrunner/features/org.mozilla.xulrunner.site/README.txt
trunk/xulrunner/features/org.mozilla.xulrunner.site/site.xml
Log:
xulrunner features
Added: trunk/xulrunner/features/org.mozilla.xpcom.feature/.project
===================================================================
--- trunk/xulrunner/features/org.mozilla.xpcom.feature/.project (rev 0)
+++ trunk/xulrunner/features/org.mozilla.xpcom.feature/.project 2010-03-26 07:22:01 UTC (rev 21050)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.mozilla.xpcom.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/xulrunner/features/org.mozilla.xpcom.feature/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/xulrunner/features/org.mozilla.xpcom.feature/build.properties
===================================================================
--- trunk/xulrunner/features/org.mozilla.xpcom.feature/build.properties (rev 0)
+++ trunk/xulrunner/features/org.mozilla.xpcom.feature/build.properties 2010-03-26 07:22:01 UTC (rev 21050)
@@ -0,0 +1 @@
+bin.includes = feature.xml
Property changes on: trunk/xulrunner/features/org.mozilla.xpcom.feature/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/xulrunner/features/org.mozilla.xpcom.feature/feature.xml
===================================================================
--- trunk/xulrunner/features/org.mozilla.xpcom.feature/feature.xml (rev 0)
+++ trunk/xulrunner/features/org.mozilla.xpcom.feature/feature.xml 2010-03-26 07:22:01 UTC (rev 21050)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.mozilla.xpcom.feature"
+ label="XPCOM Feature"
+ version="1.9.1.2a"
+ provider-name="JBoss by Red Hat">
+
+ <description>
+ XPCOM Feature
+ </description>
+
+ <copyright>
+ (c) 2010 JBoss by Red Hat
+ </copyright>
+
+ <license>
+ EPL, what else?
+ </license>
+
+ <plugin
+ id="org.mozilla.xpcom"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Property changes on: trunk/xulrunner/features/org.mozilla.xpcom.feature/feature.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/xulrunner/features/org.mozilla.xulrunner.site/.project
===================================================================
--- trunk/xulrunner/features/org.mozilla.xulrunner.site/.project (rev 0)
+++ trunk/xulrunner/features/org.mozilla.xulrunner.site/.project 2010-03-26 07:22:01 UTC (rev 21050)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.mozilla.xulrunner.site</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.UpdateSiteBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.UpdateSiteNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/xulrunner/features/org.mozilla.xulrunner.site/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/xulrunner/features/org.mozilla.xulrunner.site/README.txt
===================================================================
--- trunk/xulrunner/features/org.mozilla.xulrunner.site/README.txt (rev 0)
+++ trunk/xulrunner/features/org.mozilla.xulrunner.site/README.txt 2010-03-26 07:22:01 UTC (rev 21050)
@@ -0,0 +1,17 @@
+To regen update site metadata:
+
+java -jar ~/eclipse/eclipse36/plugins/org.eclipse.equinox.launcher_1.1.0.v20091116.jar \
+-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
+-metadataRepository file:/home/nboldt/11/jbosstools-trunk/xulrunner/ \
+-artifactRepository file:/home/nboldt/11/jbosstools-trunk/xulrunner/ \
+-source /home/nboldt/11/jbosstools-trunk/xulrunner/ -configs "*.*.*" \
+-compress -publishArtifacts
+
+or
+
+java -jar ~/eclipse/eclipse36/plugins/org.eclipse.equinox.launcher_1.1.0.v20091116.jar \
+-application org.eclipse.equinox.p2.publisher.UpdateSitePublisher \
+-metadataRepository file:/home/nboldt/11/jbosstools-trunk/xulrunner/ \
+-artifactRepository file:/home/nboldt/11/jbosstools-trunk/xulrunner/ \
+-source /home/nboldt/11/jbosstools-trunk/xulrunner/features/org.mozilla.xulrunner.site -configs "*.*.*" \
+-compress -publishArtifacts
Property changes on: trunk/xulrunner/features/org.mozilla.xulrunner.site/README.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/xulrunner/features/org.mozilla.xulrunner.site/site.xml
===================================================================
--- trunk/xulrunner/features/org.mozilla.xulrunner.site/site.xml (rev 0)
+++ trunk/xulrunner/features/org.mozilla.xulrunner.site/site.xml 2010-03-26 07:22:01 UTC (rev 21050)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <feature url="features/org.mozilla.xpcom.feature_1.9.1.2a.jar" id="org.mozilla.xpcom.feature" version="1.9.1.2a"/>
+ <feature url="features/org.mozilla.xulrunner.feature_1.9.1.2.jar" id="org.mozilla.xulrunner.feature" version="1.9.1.2"/>
+</site>
Property changes on: trunk/xulrunner/features/org.mozilla.xulrunner.site/site.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 9 months
JBoss Tools SVN: r21049 - in trunk: xulrunner and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-03-26 03:20:20 -0400 (Fri, 26 Mar 2010)
New Revision: 21049
Added:
trunk/xulrunner/
trunk/xulrunner/features/
trunk/xulrunner/features/org.mozilla.xpcom.feature/
trunk/xulrunner/features/org.mozilla.xulrunner.feature/
trunk/xulrunner/features/org.mozilla.xulrunner.feature/.project
trunk/xulrunner/features/org.mozilla.xulrunner.feature/build.properties
trunk/xulrunner/features/org.mozilla.xulrunner.feature/feature.xml
trunk/xulrunner/features/org.mozilla.xulrunner.site/
trunk/xulrunner/plugins/
Log:
xulrunner features
Added: trunk/xulrunner/features/org.mozilla.xulrunner.feature/.project
===================================================================
--- trunk/xulrunner/features/org.mozilla.xulrunner.feature/.project (rev 0)
+++ trunk/xulrunner/features/org.mozilla.xulrunner.feature/.project 2010-03-26 07:20:20 UTC (rev 21049)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.mozilla.xulrunner.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/xulrunner/features/org.mozilla.xulrunner.feature/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/xulrunner/features/org.mozilla.xulrunner.feature/build.properties
===================================================================
--- trunk/xulrunner/features/org.mozilla.xulrunner.feature/build.properties (rev 0)
+++ trunk/xulrunner/features/org.mozilla.xulrunner.feature/build.properties 2010-03-26 07:20:20 UTC (rev 21049)
@@ -0,0 +1 @@
+bin.includes = feature.xml
Property changes on: trunk/xulrunner/features/org.mozilla.xulrunner.feature/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/xulrunner/features/org.mozilla.xulrunner.feature/feature.xml
===================================================================
--- trunk/xulrunner/features/org.mozilla.xulrunner.feature/feature.xml (rev 0)
+++ trunk/xulrunner/features/org.mozilla.xulrunner.feature/feature.xml 2010-03-26 07:20:20 UTC (rev 21049)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.mozilla.xulrunner.feature"
+ label="XulRunner Feature"
+ version="1.9.1.2"
+ provider-name="JBoss by Red Hat">
+
+ <description>
+ XulRunner Feature
+ </description>
+
+ <copyright>
+ (c) 2010 JBoss by Red Hat
+ </copyright>
+
+ <license>
+ EPL, what else?
+ </license>
+
+ <plugin
+ id="org.mozilla.xulrunner.win32.win32.x86"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.mozilla.xulrunner.gtk.linux.x86_64"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.mozilla.xulrunner.gtk.linux.x86"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.mozilla.xulrunner.cocoa.macosx"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.mozilla.xulrunner.carbon.macosx"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Property changes on: trunk/xulrunner/features/org.mozilla.xulrunner.feature/feature.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 9 months
JBoss Tools SVN: r21048 - in trunk/ws: plugins/org.jboss.tools.ws.creation.core/META-INF and 17 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-03-26 03:00:22 -0400 (Fri, 26 Mar 2010)
New Revision: 21048
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCorePlugin.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/JBossWSCreationUIPlugin.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSJava2WSDLConfigWidgetFactory.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSWSDL2JavaConfigWidgetFactory.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java
Removed:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/UIUtils.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AddApplicationXMLCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/ClasspathParser.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSPropertyPage.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSRuntimeConfigBlock.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceRuntime.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JBossWSUIPlugin.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSClientCommandTest.java
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSTopDownCommandTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.test/src/org/jboss/tools/ws/ui/test/preferences/JBossWSRuntimePreferencePageTest.java
Log:
JBIDE-6076: format the ws codes as a good style
Deleted: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.core.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.ws.internal.common.J2EEUtils;
-import org.eclipse.osgi.util.NLS;
-import org.jboss.tools.ws.core.messages.JBossWSCoreMessages;
-
-/**
- * @author Grid Qian
- */
-public class JBossWSCoreUtils {
-
- public static IPath pathToWebProjectContainer(String project) {
- IPath projectRoot = getProjectRoot(project);
- IPath currentDynamicWebProjectDir = J2EEUtils
- .getWebContentPath(getProjectName(project));
- IPath currentDynamicWebProjectDirWithoutProjectRoot = J2EEUtils
- .getWebContentPath(getProjectName(project))
- .removeFirstSegments(1).makeAbsolute();
- if (projectRoot.toOSString().contains(getWorkspace().toOSString())) {
- return getWorkspace().append(currentDynamicWebProjectDir);
- } else {
- return projectRoot
- .append(currentDynamicWebProjectDirWithoutProjectRoot);
- }
-
- }
-
- public static IPath getProjectRoot(String project) {
- String projectString = replaceEscapecharactors(project.toString());
- return ResourcesPlugin.getWorkspace().getRoot().getProject(
- getProjectNameFromFramewokNameString(projectString))
- .getLocation();
- }
-
- // Fix for the windows build not working
- private static String replaceEscapecharactors(String vulnarableString) {
- if (vulnarableString.indexOf("/") != -1) { //$NON-NLS-1$
- vulnarableString = vulnarableString.replace('/', File.separator
- .charAt(0));
- }
- return vulnarableString;
- }
-
- private static String getProjectNameFromFramewokNameString(
- String frameworkProjectString) {
- if (frameworkProjectString.indexOf(getSplitCharactor()) == -1) {
- return frameworkProjectString;
- } else {
- return frameworkProjectString.split(getSplitCharactors())[1];
- }
- }
-
- private static String getSplitCharactor() {
- // Windows check (because from inside wtp in return I received a hard
- // coded path)
- if (File.separatorChar == '\\') {
- return "\\"; //$NON-NLS-1$
- } else {
- return File.separator;
- }
- }
-
- private static String getSplitCharactors() {
- // Windows check (because from inside wtp in return I received a hard
- // coded path)
- if (File.separatorChar == '\\') {
- return "\\" + File.separator; //$NON-NLS-1$
- } else {
- return File.separator;
- }
- }
-
- public static IPath getWorkspace() {
- return ResourcesPlugin.getWorkspace().getRoot().getLocation();
- }
-
- public static IWorkspaceRoot getWorkspaceRoot() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
- public static IProject getProjectName(String project) {
- String projectString = replaceEscapecharactors(project.toString());
- return ResourcesPlugin.getWorkspace().getRoot().getProject(
- getProjectNameFromFramewokNameString(projectString));
- }
-
- public static IStatus copy(IPath sourcePath, IPath targetPath) {
-
- IStatus status = Status.OK_STATUS;
- File sourceDir = sourcePath.toFile();
- File[] children = sourceDir.listFiles();
-
- FileInputStream finStream = null;
- for (int i = 0; i < children.length; i++) {
- if (children[i].isFile()) {
- try {
- finStream = new FileInputStream(children[i]);
- } catch (FileNotFoundException e) {
- status = StatusUtils.errorStatus(NLS.bind(
- JBossWSCoreMessages.Error_Copy, new String[] { e
- .getLocalizedMessage() }), e);
- }
- try {
- makeFile(getWorkspaceRoot().getContainerForLocation(
- targetPath), children[i].getName(), finStream);
- } catch (CoreException e) {
- status = StatusUtils.errorStatus(NLS.bind(
- JBossWSCoreMessages.Error_Copy, new String[] { e
- .getLocalizedMessage() }), e);
- }
- } else {
- try {
- IFolder temp = makeFolder(getWorkspaceRoot()
- .getContainerForLocation(targetPath), children[i]
- .getName());
- copy(sourcePath.append(children[i].getName()), temp
- .getLocation());
- } catch (CoreException e) {
- status = StatusUtils.errorStatus(NLS.bind(
- JBossWSCoreMessages.Error_Copy, new String[] { e
- .getLocalizedMessage() }), e);
- }
- }
- }
- return status;
- }
-
- private static IFolder makeFolder(IContainer parent, String folderName)
- throws CoreException {
- IResource child = parent.findMember(folderName);
- if (child == null) {
- IFolder folder = parent.getFolder(new Path(folderName));
- try {
- folder.create(true, true, null);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return folder;
- } else {
- if (child.getType() == IResource.FOLDER) {
- return (IFolder) child;
- } else {
- throw new CoreException(new Status(IStatus.ERROR,
- "ResourceUtils", 0, NLS.bind(JBossWSCoreMessages.Error_JBossWSCoreUtils_ResourceNotFolder, //$NON-NLS-1$
- new Object[] { parent.getFullPath().append(
- folderName).toString() }), null));
- }
- }
-
- }
-
- private static IFile makeFile(IContainer parent, String fileName,
- InputStream inputStream) throws CoreException {
- IResource child = parent.findMember(fileName);
-
- if (child != null) {
- if (child.getType() == IResource.FILE) {
-
- // We have permission to overwrite so check if file is read-only
- if (child.getResourceAttributes() != null
- && child.getResourceAttributes().isReadOnly()) {
- IFile[] files = new IFile[1];
- files[0] = (IFile) child;
- }
-
- // Change the contents of the existing file.
- IFile file = parent.getFile(new Path(fileName));
- file.setContents(inputStream, true, true, null);
-
- return file;
-
- } else {
- throw new CoreException(new Status(IStatus.ERROR,
- "ResourceUtils", 0, NLS.bind(JBossWSCoreMessages.Error_JBossWSCoreUtils_ResourceNotFile, //$NON-NLS-1$
- new Object[] { parent.getFullPath().append(
- fileName) }), null));
- }
- } else {
- // Create a new file.
- IFile file = parent.getFile(new Path(fileName));
- file.create(inputStream, true, null);
-
- return file;
- }
- }
-
-
-
-
-}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2010-03-26 07:00:22 UTC (rev 21048)
@@ -3,7 +3,7 @@
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.jboss.tools.ws.creation.core;singleton:=true
Bundle-Version: 1.0.0
-Bundle-Activator: org.jboss.tools.ws.creation.core.JBossWSCreationCore
+Bundle-Activator: org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin
Bundle-Vendor: %Bundle-Vendor.0
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Deleted: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,50 +0,0 @@
-package org.jboss.tools.ws.creation.core;
-
-import org.jboss.tools.common.log.BaseUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class JBossWSCreationCore extends BaseUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.core"; //$NON-NLS-1$
-
- // The shared instance
- private static JBossWSCreationCore plugin;
-
- /**
- * The constructor
- */
- public JBossWSCreationCore() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static JBossWSCreationCore getDefault() {
- return plugin;
- }
-
-}
Copied: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCorePlugin.java (from rev 20822, trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCorePlugin.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCorePlugin.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -0,0 +1,50 @@
+package org.jboss.tools.ws.creation.core;
+
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class JBossWSCreationCorePlugin extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.core"; //$NON-NLS-1$
+
+ // The shared instance
+ private static JBossWSCreationCorePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public JBossWSCreationCorePlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static JBossWSCreationCorePlugin getDefault() {
+ return plugin;
+ }
+
+}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -27,7 +27,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -109,9 +109,9 @@
if (exitValue != 0) {
- JBossWSCreationCore.getDefault().logError(
+ JBossWSCreationCorePlugin.getDefault().logError(
errorResult.toString());
- JBossWSCreationCore.getDefault().logError(
+ JBossWSCreationCorePlugin.getDefault().logError(
inputResult.toString());
// there is no way to know if the failure of invoking is because of failure of
@@ -128,7 +128,7 @@
} else {
if (resultInput != null
&& resultInput.indexOf("[ERROR]") >= 0) { //$NON-NLS-1$
- JBossWSCreationCore.getDefault()
+ JBossWSCreationCorePlugin.getDefault()
.logWarning(resultInput);
IStatus errorStatus = StatusUtils
.warningStatus(resultInput);
@@ -140,14 +140,14 @@
}
} catch (InterruptedException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e);
} catch (CoreException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
// unable to get runtime location
return e.getStatus();
} catch (Exception e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e);
}
@@ -240,7 +240,7 @@
monitor);
} catch (CoreException e) {
e.printStackTrace();
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AddApplicationXMLCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AddApplicationXMLCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AddApplicationXMLCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -28,6 +28,7 @@
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
/**
* @author Grid Qian
@@ -70,29 +71,11 @@
// we are looking for this recursively because though application.xml
// is always in META-INF, it's not always in "earcontent" since the
// earcontent folder name can be custom
- File file = findFileByPath(APPLICATION_XML, pro.getLocation().toOSString());
+ File file = JBossWSCreationUtils.findFileByPath(APPLICATION_XML, pro.getLocation().toOSString());
if(file == null){
return false;
}
return true;
}
-
- private static File findFileByPath(String name, String path) {
- File ret = null;
- File folder = new File(path);
- if (folder.isDirectory()) {
- File[] files = folder.listFiles();
- for (File file : files) {
- ret = findFileByPath(name, file.getAbsolutePath());
- if (ret != null) {
- break;
- }
- }
- } else {
- if (name.equals(folder.getName())) {
- ret = folder;
- }
- }
- return ret;
- }
+
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -36,7 +36,7 @@
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -71,7 +71,7 @@
project = JBossWSCreationUtils.getJavaProjectByName(model
.getWebProjectName());
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
@@ -101,7 +101,7 @@
null);
clientCls.save(null, true);
} catch (Exception e1) {
- JBossWSCreationCore.getDefault().logError(e1);
+ JBossWSCreationCorePlugin.getDefault().logError(e1);
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
@@ -126,7 +126,7 @@
clientClsType.createMethod(sb.toString(), null, true, null);
clientCls.save(null, true);
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
@@ -314,7 +314,7 @@
}
}
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
return units;
}
@@ -393,7 +393,7 @@
wrapperCls.save(null, true);
return wrapperCls;
} catch (Exception e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return null;
}
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -52,7 +52,7 @@
import org.eclipse.text.edits.TextEdit;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -106,13 +106,13 @@
.errorStatus(
JBossWSCreationCoreMessages.Error_Message_Failed_to_Generate_Implementation,
e);
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
} catch (BadLocationException e) {
status = StatusUtils
.errorStatus(
JBossWSCreationCoreMessages.Error_Message_Failed_to_Generate_Implementation,
e);
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
return status;
}
@@ -127,11 +127,11 @@
return tem;
}
+ @SuppressWarnings("unchecked")
protected void generateImplClass(String portTypeName/* , IFile implJavaFile */)
throws CoreException, BadLocationException {
CompilationUnit portTypeCU = getCompilationUnitForInterface(portTypeName);
- List<ImportDeclaration> imports = getImportsWithoutJaxwsAnnotation(portTypeCU);
IPackageFragment pack = getImplPakcage();
@@ -255,6 +255,7 @@
return model.getCustomPackage() + "." + portTypeName; //$NON-NLS-1$
}
+ @SuppressWarnings("unchecked")
private void addImportsToImplementationClass(CompilationUnit implCU,
CompilationUnit portTypeCU, String portTypeName) {
List<ImportDeclaration> imports = getImportsWithoutJaxwsAnnotation(portTypeCU);
@@ -291,6 +292,7 @@
/*
* create web service annotation
*/
+ @SuppressWarnings("unchecked")
protected NormalAnnotation createAnnotation(AST ast, String name,
String serviceName, String endpoint) {
NormalAnnotation ann = ast.newNormalAnnotation();
@@ -319,6 +321,7 @@
return member;
}
+ @SuppressWarnings("unchecked")
protected MethodDeclaration createMethodForImplClass(AST ast,
MethodDeclaration inMethod) {
@@ -390,6 +393,7 @@
return md;
}
+ @SuppressWarnings("unchecked")
private Type copyTypeFromOtherASTNode(AST ast, Type type) {
if (type instanceof PrimitiveType) {
return ast.newPrimitiveType(((PrimitiveType) type)
@@ -425,6 +429,7 @@
return null;
}
+ @SuppressWarnings("unchecked")
protected List<ImportDeclaration> getImportsWithoutJaxwsAnnotation(
CompilationUnit cu) {
List<ImportDeclaration> importList = new ArrayList<ImportDeclaration>();
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -20,12 +20,11 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.jboss.tools.ws.core.utils.StatusUtils;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.ws.internal.wsrt.IWebService;
import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -34,6 +33,7 @@
/**
* @author Grid Qian
*/
+@SuppressWarnings("restriction")
public class InitialClientCommand extends AbstractDataModelOperation {
private ServiceModel model;
private IWebServiceClient wsClient;
@@ -81,7 +81,7 @@
model.setServiceList(reader.getServiceList());
model.setPortTypeList(reader.getPortTypeList());
} catch (WSDLException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e.getLocalizedMessage(), e);
}
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,7 +1,5 @@
package org.jboss.tools.ws.creation.core.commands;
-import java.io.File;
-
import javax.wsdl.WSDLException;
import org.eclipse.core.commands.ExecutionException;
@@ -11,17 +9,17 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.jboss.tools.ws.core.utils.StatusUtils;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.ws.internal.wsrt.IWebService;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
-import org.jboss.tools.ws.core.JBossWSCorePlugin;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
import org.jboss.tools.ws.creation.core.utils.WSDLPropertyReader;
+@SuppressWarnings("restriction")
public class InitialCommand extends AbstractDataModelOperation {
private ServiceModel model;
@@ -61,7 +59,7 @@
model.setPortTypeList(reader.getPortTypeList());
} catch (WSDLException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e.getLocalizedMessage(), e);
}
} else {
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -31,6 +31,7 @@
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.data.ServletDescriptor;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -101,7 +102,7 @@
for (int i = 0; i < theServlets.size(); i++) {
org.eclipse.jst.j2ee.webapplication.Servlet aServlet = (org.eclipse.jst.j2ee.webapplication.Servlet) theServlets
.get(i);
- if (aServlet.getServletName().equals(servletDescriptor._name)) {
+ if (aServlet.getServletName().equals(servletDescriptor.getName())) {
status = StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -110,9 +111,9 @@
for (int i = 0; i < theServletMapplings.size(); i++) {
org.eclipse.jst.j2ee.webapplication.ServletMapping aServletMapping = (org.eclipse.jst.j2ee.webapplication.ServletMapping) theServletMapplings
.get(i);
- if (aServletMapping.getName().equals(servletDescriptor._name)
+ if (aServletMapping.getName().equals(servletDescriptor.getName())
|| aServletMapping.getUrlPattern().equals(
- servletDescriptor._mappings)) {
+ servletDescriptor.getMappings())) {
status = StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -123,18 +124,18 @@
org.eclipse.jst.j2ee.webapplication.ServletType servletType = factory
.createServletType();
servlet.setWebType(servletType);
- servlet.setServletName(servletDescriptor._name);
- servletType.setClassName(servletDescriptor._className);
- if (servletDescriptor._displayName != null) {
- servlet.setDisplayName(servletDescriptor._displayName);
+ servlet.setServletName(servletDescriptor.getName());
+ servletType.setClassName(servletDescriptor.getClassName());
+ if (servletDescriptor.getDisplayName() != null) {
+ servlet.setDisplayName(servletDescriptor.getDisplayName());
}
webapp.getServlets().add(servlet);
- if (servletDescriptor._mappings != null) {
+ if (servletDescriptor.getMappings() != null) {
org.eclipse.jst.j2ee.webapplication.ServletMapping servletMapping = factory
.createServletMapping();
servletMapping.setServlet(servlet);
- servletMapping.setUrlPattern(servletDescriptor._mappings);
+ servletMapping.setUrlPattern(servletDescriptor.getMappings());
webapp.getServletMappings().add(servletMapping);
}
}
@@ -149,10 +150,10 @@
servletName = servletName.substring(0, servletName.length() - 4);
}
ServletDescriptor sd = new ServletDescriptor();
- sd._name = servletName;
- sd._displayName = sd._name;
- sd._className = clsName;
- sd._mappings = JBossWSCreationCoreMessages.Separator_Java + sd._name;
+ sd.setName(servletName);
+ sd.setDisplayName(sd.getName());
+ sd.setClassName(clsName);
+ sd.setMappings(JBossWSCreationCoreMessages.Separator_Java + sd.getName());
return sd;
}
@@ -163,7 +164,7 @@
for (int i = 0; i < theServlets.size(); i++) {
Servlet aServlet = (Servlet) theServlets.get(i);
- if (aServlet.getServletName().equals(servletDescriptor._name)) {
+ if (aServlet.getServletName().equals(servletDescriptor.getName())) {
status = StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -174,7 +175,7 @@
ServletMapping aServletMapping = (ServletMapping) theServletMapplings
.get(i);
if (aServletMapping.getServletName()
- .equals(servletDescriptor._name)) {
+ .equals(servletDescriptor.getName())) {
status = StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -182,7 +183,7 @@
if (list != null) {
for (int j = 0; j < list.size(); j++) {
UrlPatternType url = (UrlPatternType) list.get(j);
- if (url.getValue().equals(servletDescriptor._mappings)) {
+ if (url.getValue().equals(servletDescriptor.getMappings())) {
status = StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -192,31 +193,23 @@
WebFactory factory = WebFactory.eINSTANCE;
Servlet servlet = factory.createServlet();
- servlet.setServletName(servletDescriptor._name);
- servlet.setServletClass(servletDescriptor._className);
- if (servletDescriptor._displayName != null) {
+ servlet.setServletName(servletDescriptor.getName());
+ servlet.setServletClass(servletDescriptor.getClassName());
+ if (servletDescriptor.getDisplayName() != null) {
DisplayName displayNameObj = JavaeeFactory.eINSTANCE
.createDisplayName();
- displayNameObj.setValue(servletDescriptor._displayName);
+ displayNameObj.setValue(servletDescriptor.getDisplayName());
servlet.getDisplayNames().add(displayNameObj);
}
webapp.getServlets().add(servlet);
- if (servletDescriptor._mappings != null) {
+ if (servletDescriptor.getMappings() != null) {
ServletMapping servletMapping = factory.createServletMapping();
servletMapping.setServletName(servlet.getServletName());
UrlPatternType url = JavaeeFactory.eINSTANCE.createUrlPatternType();
- url.setValue(servletDescriptor._mappings);
+ url.setValue(servletDescriptor.getMappings());
servletMapping.getUrlPatterns().add(url);
webapp.getServletMappings().add(servletMapping);
}
}
-
- public class ServletDescriptor {
- String _name;
- String _className;
- String _displayName;
- String _mappings;
- }
-
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -24,7 +24,7 @@
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeClassPathInitializer.JBossWSRuntimeClasspathContainer;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -56,7 +56,7 @@
project = JBossWSCreationUtils.getJavaProjectByName(model
.getWebProjectName());
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
status = removeClassPath(project);
@@ -76,7 +76,7 @@
}
}
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
return status;
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -14,7 +14,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -37,7 +37,7 @@
project = JBossWSCreationUtils.getJavaProjectByName(model
.getWebProjectName());
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
@@ -93,7 +93,7 @@
wrapperCls.save(null, true);
return wrapperCls;
} catch (Exception e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return null;
}
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -21,7 +21,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -66,7 +66,7 @@
new String[] { implClass, project }));
}
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(NLS.bind(
JBossWSCreationCoreMessages.Error_No_Class, new String[] {
implClass, project }));
Copied: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java (from rev 20822, trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.creation.core.data;
+
+public class ServletDescriptor {
+ private String _name;
+ private String _className;
+ private String _displayName;
+ private String _mappings;
+
+ public ServletDescriptor() {
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public String getClassName() {
+ return _className;
+ }
+
+ public void setClassName(String className) {
+ _className = className;
+ }
+
+ public String getDisplayName() {
+ return _displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ _displayName = displayName;
+ }
+
+ public String getMappings() {
+ return _mappings;
+ }
+
+ public void setMappings(String mappings) {
+ _mappings = mappings;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/ClasspathParser.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/ClasspathParser.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/ClasspathParser.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -25,6 +25,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+@SuppressWarnings("restriction")
public class ClasspathParser {
private static ClasspathParser instance;
@@ -53,7 +54,6 @@
return classpath.toString();
}
- @SuppressWarnings("restriction")
private String[] getClasspath(IProject project, boolean isDependent) {
String[] cClasspath = new String[0];
ArrayList<String> projectClasspath = new ArrayList<String>();
@@ -143,7 +143,6 @@
// Need to get all components in the project. If there's a EAR component, get the
// utility Jars
- @SuppressWarnings("restriction")
private String[] getUtilityJarClasspath(IProject project) {
String[] utilityJarString = new String[0];
String[] cClasspath = new String[0];
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -53,12 +53,10 @@
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.tools.ws.core.JBossWSCorePlugin;
import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
import org.jboss.tools.ws.core.facet.delegate.JBossWSFacetInstallDataModelProvider;
-import org.jboss.tools.ws.core.messages.JBossWSCoreMessages;
import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
@@ -95,10 +93,6 @@
return false;
}
- public static IPath getWorkspace() {
- return ResourcesPlugin.getWorkspace().getRoot().getLocation();
- }
-
public static IProject getProjectByName(String project) {
String projectString = replaceEscapecharactors(project);
return ResourcesPlugin.getWorkspace().getRoot().getProject(
@@ -112,37 +106,6 @@
.getLocation();
}
- public static String pathToWebProjectContainer(String project) {
- IPath projectRoot = getProjectRoot(project);
- IPath currentDynamicWebProjectDir = getWebContentRootPath(getProjectByName(project));
- IPath currentDynamicWebProjectDirWithoutProjectRoot = getWebContentRootPath(
- getProjectByName(project)).removeFirstSegments(1)
- .makeAbsolute();
- if (projectRoot.toOSString().contains(getWorkspace().toOSString())) {
- return getWorkspace().append(currentDynamicWebProjectDir)
- .toOSString();
- } else {
- return projectRoot.append(
- currentDynamicWebProjectDirWithoutProjectRoot).toOSString();
- }
-
- }
-
- public static String pathToWebProjectContainerWEBINF(String project) {
- IPath projectRoot = getProjectRoot(project);
- IPath webContainerWEBINFDir = getWebContentRootPath(
- getProjectByName(project)).append(WEBINF);
- IPath webContainerWEBINFDirWithoutProjectRoot = getWebContentRootPath(
- getProjectByName(project)).append(WEBINF)
- .removeFirstSegments(1).makeAbsolute();
- if (projectRoot.toOSString().contains(getWorkspace().toOSString())) {
- return getWorkspace().append(webContainerWEBINFDir).toOSString();
- } else {
- return projectRoot.append(webContainerWEBINFDirWithoutProjectRoot)
- .toOSString();
- }
- }
-
private static String replaceEscapecharactors(String vulnarableString) {
if (vulnarableString.indexOf("/") != -1) { //$NON-NLS-1$
vulnarableString = vulnarableString.replace('/', File.separator
@@ -286,15 +249,6 @@
}
}
- public static boolean validateJBossWSLocation() {
- String location = JBossWSCorePlugin.getDefault().getPreferenceStore()
- .getString(JBossWSCoreMessages.WS_Location);
- if (location == null || location.equals("")) { //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
public static String getJBossWSRuntimeLocation(IProject project)
throws CoreException {
@@ -482,5 +436,24 @@
}
return path;
}
+
+ public static File findFileByPath(String name, String path) {
+ File ret = null;
+ File folder = new File(path);
+ if (folder.isDirectory()) {
+ File[] files = folder.listFiles();
+ for (File file : files) {
+ ret = findFileByPath(name, file.getAbsolutePath());
+ if (ret != null) {
+ break;
+ }
+ }
+ } else {
+ if (name.equals(folder.getName())) {
+ ret = folder;
+ }
+ }
+ return ret;
+ }
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -4,7 +4,7 @@
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
-* This is free software; you can redistribute it and/or modify it
+ * This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
@@ -37,10 +37,6 @@
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
-
-
-
-
public class WSDLPropertyReader {
private Definition definition = null;
@@ -54,84 +50,80 @@
definition = reader.readWSDL(filepath);
}
-
/**
* get the default package derived by the targetNamespace
*/
- public String packageFromTargetNamespace(){
-
- String packageName = definition.getTargetNamespace();
+ public String packageFromTargetNamespace() {
+
+ String packageName = definition.getTargetNamespace();
String returnPkg = getPackageNameFromNamespce(packageName);
-
+
return returnPkg;
-
-
+
}
- private static String getPackageNameFromNamespce(String namespace) {
+ private static String getPackageNameFromNamespce(String namespace) {
- String hostname = null;
- String path = ""; //$NON-NLS-1$
+ String hostname = null;
+ String path = ""; //$NON-NLS-1$
- try {
- java.net.URL url = new java.net.URL(namespace);
+ try {
+ java.net.URL url = new java.net.URL(namespace);
- hostname = url.getHost();
- path = url.getPath();
- } catch (MalformedURLException e) {
- if (namespace.indexOf(":") > -1) { //$NON-NLS-1$
- hostname = namespace.substring(namespace.indexOf(":") + 1); //$NON-NLS-1$
+ hostname = url.getHost();
+ path = url.getPath();
+ } catch (MalformedURLException e) {
+ if (namespace.indexOf(":") > -1) { //$NON-NLS-1$
+ hostname = namespace.substring(namespace.indexOf(":") + 1); //$NON-NLS-1$
- while (hostname.startsWith("/")) { //$NON-NLS-1$
- hostname = hostname.substring(1);
- }
+ while (hostname.startsWith("/")) { //$NON-NLS-1$
+ hostname = hostname.substring(1);
+ }
- if (hostname.indexOf("/") > -1) { //$NON-NLS-1$
- hostname = hostname.substring(0, hostname.indexOf("/")); //$NON-NLS-1$
- }
- } else {
- hostname = namespace.replace('/','.');
- }
- }
+ if (hostname.indexOf("/") > -1) { //$NON-NLS-1$
+ hostname = hostname.substring(0, hostname.indexOf("/")); //$NON-NLS-1$
+ }
+ } else {
+ hostname = namespace.replace('/', '.');
+ }
+ }
- if (hostname == null || hostname.length() == 0) {
- return null;
- }
+ if (hostname == null || hostname.length() == 0) {
+ return null;
+ }
- hostname = hostname.replace('-', '_');
- path = path.replace('-', '_');
+ hostname = hostname.replace('-', '_');
+ path = path.replace('-', '_');
- path = path.replace(':', '_');
+ path = path.replace(':', '_');
-
- if ((path.length() > 0) && (path.charAt(path.length() - 1) == '/')) {
- path = path.substring(0, path.length() - 1);
- }
+ if ((path.length() > 0) && (path.charAt(path.length() - 1) == '/')) {
+ path = path.substring(0, path.length() - 1);
+ }
-
- StringTokenizer st = new StringTokenizer(hostname, ".:"); //$NON-NLS-1$
- String[] nodes = new String[st.countTokens()];
+ StringTokenizer st = new StringTokenizer(hostname, ".:"); //$NON-NLS-1$
+ String[] nodes = new String[st.countTokens()];
- for (int i = 0; i < nodes.length; ++i) {
- nodes[i] = st.nextToken();
- }
+ for (int i = 0; i < nodes.length; ++i) {
+ nodes[i] = st.nextToken();
+ }
- StringBuffer sb = new StringBuffer(namespace.length());
+ StringBuffer sb = new StringBuffer(namespace.length());
- for (int i = nodes.length - 1; i >= 0; --i) {
- appendToPackage(sb, nodes[i], (i == nodes.length - 1));
- }
+ for (int i = nodes.length - 1; i >= 0; --i) {
+ appendToPackage(sb, nodes[i], (i == nodes.length - 1));
+ }
- StringTokenizer st2 = new StringTokenizer(path, "/"); //$NON-NLS-1$
+ StringTokenizer st2 = new StringTokenizer(path, "/"); //$NON-NLS-1$
- while (st2.hasMoreTokens()) {
- appendToPackage(sb, st2.nextToken(), false);
- }
-
- return sb.toString().toLowerCase();
- }
+ while (st2.hasMoreTokens()) {
+ appendToPackage(sb, st2.nextToken(), false);
+ }
- private static void appendToPackage(StringBuffer sb, String nodeName,
+ return sb.toString().toLowerCase();
+ }
+
+ private static void appendToPackage(StringBuffer sb, String nodeName,
boolean firstNode) {
if (JBossWSCreationUtils.isJavaKeyword(nodeName)) {
@@ -160,15 +152,15 @@
sb.append(nodeName);
}
-
-
+
/**
* Returns a list of service names the names are local parts
*
* @return
*/
- public List<String> getServiceList() {
-
+ @SuppressWarnings("unchecked")
+ public List<String> getServiceList() {
+
List<String> returnList = new ArrayList<String>();
Service service;
@@ -177,28 +169,29 @@
if (serviceMap != null && !serviceMap.isEmpty()) {
Iterator<Service> serviceIterator = serviceMap.values().iterator();
while (serviceIterator.hasNext()) {
-
service = (Service) serviceIterator.next();
returnList.add(service.getQName().getLocalPart());
}
}
return returnList;
}
-
+
/**
* Returns a list of service names the names are local parts
*
* @return
*/
- public List<String> getPortTypeList() {
-
+ @SuppressWarnings("unchecked")
+ public List<String> getPortTypeList() {
+
List<String> returnList = new ArrayList<String>();
PortType portType;
Map portTypeMap = definition.getPortTypes();
if (portTypeMap != null && !portTypeMap.isEmpty()) {
- Iterator<Service> portTypeIterator = portTypeMap.values().iterator();
+ Iterator<Service> portTypeIterator = portTypeMap.values()
+ .iterator();
while (portTypeIterator.hasNext()) {
portType = (PortType) portTypeIterator.next();
@@ -213,6 +206,7 @@
*
* @return
*/
+ @SuppressWarnings("unchecked")
public List<String> getPortNameList(QName serviceName) {
List<String> returnList = new ArrayList<String>();
@@ -231,8 +225,5 @@
}
return returnList;
}
-
-
}
-
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF 2010-03-26 07:00:22 UTC (rev 21048)
@@ -4,7 +4,7 @@
Bundle-Localization: plugin
Bundle-SymbolicName: org.jboss.tools.ws.creation.ui;singleton:=true
Bundle-Version: 1.0.0
-Bundle-Activator: org.jboss.tools.ws.creation.ui.CreationUIPlugin
+Bundle-Activator: org.jboss.tools.ws.creation.ui.JBossWSCreationUIPlugin
Bundle-Vendor: %PLUGIN_PROVIDER
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml 2010-03-26 07:00:22 UTC (rev 21048)
@@ -4,7 +4,7 @@
<extension
point="org.eclipse.wst.command.env.ui.widgetRegistry">
<widgetFactory
- class="org.jboss.tools.ws.creation.ui.wsrt.JBossWSConfigWidgetFactory"
+ class="org.jboss.tools.ws.creation.ui.wsrt.JBossWSWSDL2JavaConfigWidgetFactory"
id="JBossWSWSDL2JavaConfig"
insertBeforeCommandId="org.jboss.tools.ws.creation.core.commands.BindingFilesValidationCommand">
</widgetFactory>
@@ -40,14 +40,14 @@
runtimeId="org.jboss.tools.ws.creation.jbossWebServiceRT"
class="org.jboss.tools.ws.creation.ui.wsrt.JBossWebServiceRuntime">
- <required-facet-version facet="jst.web" version="2.3" allow-newer="true" />
+ <required-facet-version facet="jst.java" version="1.4" allow-newer="true" />
</clientRuntime>
</extension>
<extension
point="org.eclipse.wst.command.env.ui.widgetRegistry">
<widgetFactory
- class="org.jboss.tools.ws.creation.ui.wsrt.JBossWSProviderInvokeConfigWidgetFactory"
+ class="org.jboss.tools.ws.creation.ui.wsrt.JBossWSJava2WSDLConfigWidgetFactory"
id="JBossWSProviderInvokeConfig"
insertBeforeCommandId="org.jboss.tools.ws.creation.core.commands.Java2WSCommand">
</widgetFactory>
Deleted: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,50 +0,0 @@
-package org.jboss.tools.ws.creation.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class CreationUIPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static CreationUIPlugin plugin;
-
- /**
- * The constructor
- */
- public CreationUIPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static CreationUIPlugin getDefault() {
- return plugin;
- }
-
-}
Copied: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/JBossWSCreationUIPlugin.java (from rev 20924, trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/JBossWSCreationUIPlugin.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/JBossWSCreationUIPlugin.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -0,0 +1,50 @@
+package org.jboss.tools.ws.creation.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class JBossWSCreationUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static JBossWSCreationUIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public JBossWSCreationUIPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static JBossWSCreationUIPlugin getDefault() {
+ return plugin;
+ }
+
+}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,4 +1,8 @@
-JBossWSConfigWidgetFactory_Description=Please input the appropriate option for the code generation
-JBossWSConfigWidgetFactory_Title=JBoss Web Service Code Generation Configuration
-JBossWSProviderInvokeConfigWidgetFactory_Description=Please input the appropriate option for the code generation
-JBossWSProviderInvokeConfigWidgetFactory_Title=JBoss Web Service Code Generation Configuration
+# START NON-TRANSLATABLE
+JBossWS_WebServiceDataModel=WebServiceDataModel
+# END NON-TRANSLATABLE
+
+JBossWSWSDL2JavaConfigWidgetFactory_Description=Please input the appropriate option for the code generation
+JBossWSWSDL2JavaConfigWidgetFactory_Title=JBoss Web Service Code Generation Configuration
+JBossWSJava2WSDLConfigWidgetFactory_Description=Please input the appropriate option for the code generation
+JBossWSJava2WSDLConfigWidgetFactory_Title=JBoss Web Service Code Generation Configuration
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -7,11 +7,14 @@
private JBossWSCreationUIMessages() {
}
- public static String JBossWSConfigWidgetFactory_Description;
- public static String JBossWSConfigWidgetFactory_Title;
- public static String JBossWSProviderInvokeConfigWidgetFactory_Description;
- public static String JBossWSProviderInvokeConfigWidgetFactory_Title;
+ public static String JBossWS_WebServiceDataModel;
+
+ public static String JBossWSWSDL2JavaConfigWidgetFactory_Description;
+ public static String JBossWSWSDL2JavaConfigWidgetFactory_Title;
+ public static String JBossWSJava2WSDLConfigWidgetFactory_Description;
+ public static String JBossWSJava2WSDLConfigWidgetFactory_Title;
+
static {
NLS.initializeMessages(BUNDLE_NAME, JBossWSCreationUIMessages.class);
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSPropertyPage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSPropertyPage.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSPropertyPage.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -8,8 +8,6 @@
import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.ws.core.command.JBossWSClassPathCommand;
import org.jboss.tools.ws.core.command.UninstallJBossWSClassPathCommand;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSRuntimeConfigBlock.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSRuntimeConfigBlock.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSRuntimeConfigBlock.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -37,10 +37,11 @@
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
import org.jboss.tools.ws.core.facet.delegate.JBossWSFacetInstallDataModelProvider;
+import org.jboss.tools.ws.core.messages.JBossWSCoreMessages;
import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
-import org.jboss.tools.ws.creation.ui.CreationUIPlugin;
-import org.jboss.tools.ws.ui.preferences.JBossRuntimeListFieldEditor;
+import org.jboss.tools.ws.creation.ui.JBossWSCreationUIPlugin;
+import org.jboss.tools.ws.ui.preferences.JBossWSRuntimeListFieldEditor;
public class JBossWSRuntimeConfigBlock {
@@ -203,7 +204,7 @@
try {
duplicateMsg = getDuplicateJars(jbws.getName());
} catch (JavaModelException e1) {
- CreationUIPlugin.getDefault().getLog().log(
+ JBossWSCreationUIPlugin.getDefault().getLog().log(
StatusUtils.errorStatus(e1));
}
if ("".equals(duplicateMsg)) { //$NON-NLS-1$
@@ -308,7 +309,7 @@
List<JBossWSRuntime> exists = new ArrayList<JBossWSRuntime>(Arrays.asList(JBossWSRuntimeManager.getInstance().getRuntimes()));
List<JBossWSRuntime> added = new ArrayList<JBossWSRuntime>();
- JBossRuntimeListFieldEditor.JBossWSRuntimeNewWizard newRtwizard = new JBossRuntimeListFieldEditor.JBossWSRuntimeNewWizard(
+ JBossWSRuntimeListFieldEditor.JBossWSRuntimeNewWizard newRtwizard = new JBossWSRuntimeListFieldEditor.JBossWSRuntimeNewWizard(
exists, added) {
public boolean performFinish() {
JBossWSRuntime rt = getRuntime();
@@ -340,7 +341,7 @@
try {
duplicateMsg = getDuplicateJars(cmbRuntimes.getText());
} catch (JavaModelException e1) {
- CreationUIPlugin.getDefault().getLog().log(StatusUtils.errorStatus(e1));
+ JBossWSCreationUIPlugin.getDefault().getLog().log(StatusUtils.errorStatus(e1));
}
if(!duplicateMsg.equals("")){ //$NON-NLS-1$
setErrorMessage(MessageFormat
@@ -409,7 +410,7 @@
IClasspathEntry[] entries = javaProject.getRawClasspath();
for(IClasspathEntry entry: entries){
if(entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER){
- if("JBossWS_Runtime".equals(entry.getPath().segment(0))){ //$NON-NLS-1$
+ if(JBossWSCoreMessages.JBossWS_Runtime_Lib.equals(entry.getPath().segment(0))){
continue;
}
IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), javaProject);
Deleted: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,228 +0,0 @@
-package org.jboss.tools.ws.creation.ui.widgets;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
-import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
-import org.jboss.tools.ws.core.utils.JBossWSCoreUtils;
-import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
-import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
-
-public class CodeGenConfigWidget extends SimpleWidgetDataContributor {
-
- private ServiceModel model;
-
- public ServiceModel getModel() {
- return model;
- }
-
- public void setModel(ServiceModel model) {
- this.model = model;
- }
-
- private Button btnRemove;
- private Button btnUpdateWebxml;
- private Button btnGenDefaultImpl;
- private Button btnExtension;
-
- public CodeGenConfigWidget(ServiceModel model) {
- this.model = model;
- }
-
- public WidgetDataEvents addControls(Composite parent,
- Listener statusListener) {
-
- Composite configCom = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- configCom.setLayout(layout);
- configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // custom package name
- Label lblCustomPakage = new Label(configCom, SWT.NONE);
- lblCustomPakage
- .setText(JBossWSCreationCoreMessages.Label_Custom_Package_Name);
- final Text txtCustomPkgName = new Text(configCom, SWT.BORDER);
- txtCustomPkgName.setText(model.getCustomPackage());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- txtCustomPkgName.setLayoutData(gd);
- txtCustomPkgName.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- model.setCustomPackage(txtCustomPkgName.getText());
- }
- });
-
- // target
- new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_JaxWS_Target);
- final Combo cbSpec = new Combo(configCom, SWT.BORDER | SWT.READ_ONLY);
- cbSpec.add(JBossWSCreationCoreMessages.Value_Target_0, 0);
- cbSpec.add(JBossWSCreationCoreMessages.Value_Target_1, 1);
- if (JBossWSCreationCoreMessages.Value_Target_0
- .equals(model.getTarget())) {
- cbSpec.select(0);
- } else {
- cbSpec.select(1);
- }
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- cbSpec.setLayoutData(gd);
- cbSpec.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- model.setTarget(cbSpec.getText());
- }
- });
-
- // catalog file
- new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_Catalog_File);
- final Text txtCatlog = new Text(configCom, SWT.BORDER);
- txtCatlog.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Button btnCatlog = new Button(configCom, SWT.NONE);
- btnCatlog
- .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
- btnCatlog.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- String fileLocation = new FileDialog(Display.getCurrent()
- .getActiveShell(), SWT.NONE).open();
- txtCatlog.setText(fileLocation);
- model.setCatalog(fileLocation);
- }
- });
-
- // binding files
- new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_Binding_File);
-
- final List bindingList = new List(configCom, SWT.BORDER
- | SWT.SCROLL_LINE | SWT.V_SCROLL | SWT.H_SCROLL);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = Display.getCurrent().getActiveShell().getBounds().height / 4;
- gd.verticalSpan = 3;
- bindingList.setLayoutData(gd);
- loadBindingFiles(bindingList);
- bindingList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (bindingList.getSelectionIndex() >= 0) {
- btnRemove.setEnabled(true);
- } else {
- btnRemove.setEnabled(false);
- }
- }
- });
-
- Button btnSelect = new Button(configCom, SWT.NONE);
- btnSelect
- .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
- btnSelect.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
-
- String fileLocation = new FileDialog(Display.getCurrent()
- .getActiveShell(), SWT.NONE).open();
- if (fileLocation != null
- && !model.getBindingFiles().contains(fileLocation)) {
- bindingList.add(fileLocation);
- model.addBindingFile(fileLocation);
- }
-
- }
- });
-
- new Label(configCom, SWT.NONE);
- btnRemove = new Button(configCom, SWT.NONE);
- btnRemove.setEnabled(false);
- btnRemove.setText(JBossWSCreationCoreMessages.Label_Button_Text_Remove);
- btnRemove.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.getBindingFiles().remove(bindingList.getSelectionIndex());
- bindingList.remove(bindingList.getSelectionIndex());
- if (bindingList.getSelectionIndex() == -1) {
- btnRemove.setEnabled(false);
- }
- }
- });
-
- btnExtension = new Button(configCom, SWT.CHECK);
- gd = new GridData();
- gd.horizontalSpan = 3;
- btnExtension.setLayoutData(gd);
- btnExtension.setText(JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
- btnExtension.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.setEnableSOAP12(btnExtension
- .getSelection());
- }
- });
-
- if (model.getWsScenario() != WebServiceScenario.CLIENT) {
- btnGenDefaultImpl = new Button(configCom, SWT.CHECK);
- gd = new GridData();
- gd.horizontalSpan = 3;
- btnGenDefaultImpl.setLayoutData(gd);
- btnGenDefaultImpl
- .setText(JBossWSCreationCoreMessages.Label_Generate_Impelemtation);
- btnGenDefaultImpl.setSelection(true);
- btnGenDefaultImpl.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.setGenerateImplementatoin(btnGenDefaultImpl
- .getSelection());
- btnUpdateWebxml
- .setEnabled(btnGenDefaultImpl.getSelection());
- if (!btnGenDefaultImpl.getSelection()) {
- model.setUpdateWebxml(false);
- } else {
- model.setUpdateWebxml(btnUpdateWebxml.getSelection());
- }
- }
- });
-
- btnUpdateWebxml = new Button(configCom, SWT.CHECK);
- gd = new GridData();
- gd.horizontalSpan = 3;
- btnUpdateWebxml.setLayoutData(gd);
- btnUpdateWebxml
- .setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
- btnUpdateWebxml.setSelection(true);
- btnUpdateWebxml.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.setUpdateWebxml(btnUpdateWebxml.getSelection());
- }
- });
- }
-
- //enable enable soap12 checkbox if the target jbossws runtime is less than 3.0
- updateExtensionButtonStatus();
-
- return this;
- }
-
- private void updateExtensionButtonStatus(){
- btnExtension.setEnabled(JBossWSCreationUtils.supportSOAP12(model.getWebProjectName()));
- }
-
- private void loadBindingFiles(List bindingList) {
- for (String fileLocation : model.getBindingFiles()) {
- bindingList.add(fileLocation);
- }
- }
-}
Copied: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java (from rev 20822, trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.creation.ui.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
+
+/**
+ * @author Grid Qian
+ */
+@SuppressWarnings("restriction")
+public class Java2WSDLCodeGenConfigWidget extends
+ SimpleWidgetDataContributor {
+
+ private ServiceModel model;
+ private Button btnUpdateWebxml;
+
+ public Java2WSDLCodeGenConfigWidget(ServiceModel model) {
+ this.model = model;
+ model.setGenWSDL(false);
+ }
+
+ public WidgetDataEvents addControls(Composite parent,
+ Listener statusListener) {
+
+ Composite configCom = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ configCom.setLayout(layout);
+ configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ final Button wsdlGen = new Button(configCom, SWT.CHECK | SWT.NONE);
+ GridData wsdlGenData = new GridData();
+ wsdlGenData.horizontalSpan = 2;
+ wsdlGen.setLayoutData(wsdlGenData);
+ wsdlGen.setText(JBossWSCreationCoreMessages.Label_Generate_WSDL);
+ wsdlGen.setSelection(false);
+ wsdlGen.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ model.setGenWSDL(wsdlGen.getSelection());
+
+ }
+
+ });
+
+ btnUpdateWebxml = new Button(configCom, SWT.CHECK);
+ btnUpdateWebxml.setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
+ btnUpdateWebxml.setSelection(true);
+ btnUpdateWebxml.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ model.setUpdateWebxml(btnUpdateWebxml.getSelection());
+ }
+ });
+ return this;
+ }
+}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.creation.ui.widgets;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
-import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
-
-/**
- * @author Grid Qian
- */
-public class ProviderInvokeCodeGenConfigWidget extends
- SimpleWidgetDataContributor {
-
- private ServiceModel model;
- private Button btnUpdateWebxml;
-
- public ProviderInvokeCodeGenConfigWidget(ServiceModel model) {
- this.model = model;
- model.setGenWSDL(false);
- }
-
- public WidgetDataEvents addControls(Composite parent,
- Listener statusListener) {
-
- Composite configCom = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- configCom.setLayout(layout);
- configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- final Button wsdlGen = new Button(configCom, SWT.CHECK | SWT.NONE);
- GridData wsdlGenData = new GridData();
- wsdlGenData.horizontalSpan = 2;
- wsdlGen.setLayoutData(wsdlGenData);
- wsdlGen.setText(JBossWSCreationCoreMessages.Label_Generate_WSDL);
- wsdlGen.setSelection(false);
- wsdlGen.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- model.setGenWSDL(wsdlGen.getSelection());
-
- }
-
- });
-
- btnUpdateWebxml = new Button(configCom, SWT.CHECK);
- btnUpdateWebxml.setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
- btnUpdateWebxml.setSelection(true);
- btnUpdateWebxml.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- model.setUpdateWebxml(btnUpdateWebxml.getSelection());
- }
- });
- return this;
- }
-}
Copied: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java (from rev 20822, trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -0,0 +1,226 @@
+package org.jboss.tools.ws.creation.ui.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
+import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
+
+@SuppressWarnings("restriction")
+public class WSDL2JavaCodeGenConfigWidget extends SimpleWidgetDataContributor {
+
+ private ServiceModel model;
+
+ public ServiceModel getModel() {
+ return model;
+ }
+
+ public void setModel(ServiceModel model) {
+ this.model = model;
+ }
+
+ private Button btnRemove;
+ private Button btnUpdateWebxml;
+ private Button btnGenDefaultImpl;
+ private Button btnExtension;
+
+ public WSDL2JavaCodeGenConfigWidget(ServiceModel model) {
+ this.model = model;
+ }
+
+ public WidgetDataEvents addControls(Composite parent,
+ Listener statusListener) {
+
+ Composite configCom = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(3, false);
+ configCom.setLayout(layout);
+ configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // custom package name
+ Label lblCustomPakage = new Label(configCom, SWT.NONE);
+ lblCustomPakage
+ .setText(JBossWSCreationCoreMessages.Label_Custom_Package_Name);
+ final Text txtCustomPkgName = new Text(configCom, SWT.BORDER);
+ txtCustomPkgName.setText(model.getCustomPackage());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ txtCustomPkgName.setLayoutData(gd);
+ txtCustomPkgName.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ model.setCustomPackage(txtCustomPkgName.getText());
+ }
+ });
+
+ // target
+ new Label(configCom, SWT.NONE)
+ .setText(JBossWSCreationCoreMessages.Label_JaxWS_Target);
+ final Combo cbSpec = new Combo(configCom, SWT.BORDER | SWT.READ_ONLY);
+ cbSpec.add(JBossWSCreationCoreMessages.Value_Target_0, 0);
+ cbSpec.add(JBossWSCreationCoreMessages.Value_Target_1, 1);
+ if (JBossWSCreationCoreMessages.Value_Target_0
+ .equals(model.getTarget())) {
+ cbSpec.select(0);
+ } else {
+ cbSpec.select(1);
+ }
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ cbSpec.setLayoutData(gd);
+ cbSpec.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ model.setTarget(cbSpec.getText());
+ }
+ });
+
+ // catalog file
+ new Label(configCom, SWT.NONE)
+ .setText(JBossWSCreationCoreMessages.Label_Catalog_File);
+ final Text txtCatlog = new Text(configCom, SWT.BORDER);
+ txtCatlog.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Button btnCatlog = new Button(configCom, SWT.NONE);
+ btnCatlog
+ .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
+ btnCatlog.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ String fileLocation = new FileDialog(Display.getCurrent()
+ .getActiveShell(), SWT.NONE).open();
+ txtCatlog.setText(fileLocation);
+ model.setCatalog(fileLocation);
+ }
+ });
+
+ // binding files
+ new Label(configCom, SWT.NONE)
+ .setText(JBossWSCreationCoreMessages.Label_Binding_File);
+
+ final List bindingList = new List(configCom, SWT.BORDER
+ | SWT.SCROLL_LINE | SWT.V_SCROLL | SWT.H_SCROLL);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = Display.getCurrent().getActiveShell().getBounds().height / 4;
+ gd.verticalSpan = 3;
+ bindingList.setLayoutData(gd);
+ loadBindingFiles(bindingList);
+ bindingList.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ if (bindingList.getSelectionIndex() >= 0) {
+ btnRemove.setEnabled(true);
+ } else {
+ btnRemove.setEnabled(false);
+ }
+ }
+ });
+
+ Button btnSelect = new Button(configCom, SWT.NONE);
+ btnSelect
+ .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
+ btnSelect.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+
+ String fileLocation = new FileDialog(Display.getCurrent()
+ .getActiveShell(), SWT.NONE).open();
+ if (fileLocation != null
+ && !model.getBindingFiles().contains(fileLocation)) {
+ bindingList.add(fileLocation);
+ model.addBindingFile(fileLocation);
+ }
+
+ }
+ });
+
+ new Label(configCom, SWT.NONE);
+ btnRemove = new Button(configCom, SWT.NONE);
+ btnRemove.setEnabled(false);
+ btnRemove.setText(JBossWSCreationCoreMessages.Label_Button_Text_Remove);
+ btnRemove.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.getBindingFiles().remove(bindingList.getSelectionIndex());
+ bindingList.remove(bindingList.getSelectionIndex());
+ if (bindingList.getSelectionIndex() == -1) {
+ btnRemove.setEnabled(false);
+ }
+ }
+ });
+
+ btnExtension = new Button(configCom, SWT.CHECK);
+ gd = new GridData();
+ gd.horizontalSpan = 3;
+ btnExtension.setLayoutData(gd);
+ btnExtension.setText(JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
+ btnExtension.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.setEnableSOAP12(btnExtension
+ .getSelection());
+ }
+ });
+
+ if (model.getWsScenario() != WebServiceScenario.CLIENT) {
+ btnGenDefaultImpl = new Button(configCom, SWT.CHECK);
+ gd = new GridData();
+ gd.horizontalSpan = 3;
+ btnGenDefaultImpl.setLayoutData(gd);
+ btnGenDefaultImpl
+ .setText(JBossWSCreationCoreMessages.Label_Generate_Impelemtation);
+ btnGenDefaultImpl.setSelection(true);
+ btnGenDefaultImpl.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.setGenerateImplementatoin(btnGenDefaultImpl
+ .getSelection());
+ btnUpdateWebxml
+ .setEnabled(btnGenDefaultImpl.getSelection());
+ if (!btnGenDefaultImpl.getSelection()) {
+ model.setUpdateWebxml(false);
+ } else {
+ model.setUpdateWebxml(btnUpdateWebxml.getSelection());
+ }
+ }
+ });
+
+ btnUpdateWebxml = new Button(configCom, SWT.CHECK);
+ gd = new GridData();
+ gd.horizontalSpan = 3;
+ btnUpdateWebxml.setLayoutData(gd);
+ btnUpdateWebxml
+ .setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
+ btnUpdateWebxml.setSelection(true);
+ btnUpdateWebxml.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.setUpdateWebxml(btnUpdateWebxml.getSelection());
+ }
+ });
+ }
+
+ //enable enable soap12 checkbox if the target jbossws runtime is less than 3.0
+ updateExtensionButtonStatus();
+
+ return this;
+ }
+
+ private void updateExtensionButtonStatus(){
+ btnExtension.setEnabled(JBossWSCreationUtils.supportSOAP12(model.getWebProjectName()));
+ }
+
+ private void loadBindingFiles(List bindingList) {
+ for (String fileLocation : model.getBindingFiles()) {
+ bindingList.add(fileLocation);
+ }
+ }
+}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,82 +0,0 @@
-package org.jboss.tools.ws.creation.ui.wsrt;
-
-import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry;
-import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributorFactory;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor;
-import org.jboss.tools.ws.creation.core.commands.InitialClientCommand;
-import org.jboss.tools.ws.creation.core.commands.InitialCommand;
-import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
-import org.jboss.tools.ws.creation.ui.widgets.CodeGenConfigWidget;
-
-public class JBossWSConfigWidgetFactory implements
- INamedWidgetContributorFactory {
-
- private SimpleWidgetContributor servicesXMLSelectWidgetContrib;
- private ServiceModel model;
- private CodeGenConfigWidget servicesXMLSelectWidget;
-
- public JBossWSConfigWidgetFactory() {
- }
-
- public INamedWidgetContributor getFirstNamedWidget() {
- if (servicesXMLSelectWidgetContrib == null)
- init();
- return servicesXMLSelectWidgetContrib;
- }
-
- public INamedWidgetContributor getNextNamedWidget(
- INamedWidgetContributor widgetContributor) {
- if (servicesXMLSelectWidgetContrib == null)
- init();
- INamedWidgetContributor nextWidgetContrib = null;
- return nextWidgetContrib;
- }
-
- public void registerDataMappings(DataMappingRegistry dataRegistry) {
- // Map the data model from the defaulting command to this widget
- // factory.
- // The framework will actually to the call to getWebServiceDataModel in
- // the ExampleDefaultingCommand class and then call the
- // setWebServiceDataModel
- // method in this class.
- dataRegistry.addMapping(InitialCommand.class, "WebServiceDataModel", //$NON-NLS-1$
- JBossWSConfigWidgetFactory.class);
- dataRegistry.addMapping(InitialClientCommand.class,
- "WebServiceDataModel", JBossWSConfigWidgetFactory.class); //$NON-NLS-1$
- }
-
- public void setWebServiceDataModel(ServiceModel model) {
- this.model = model;
- if (servicesXMLSelectWidget != null) {
- servicesXMLSelectWidget.setModel(model);
- }
- }
-
- private void init() {
-
- servicesXMLSelectWidget = new CodeGenConfigWidget(model);
- servicesXMLSelectWidgetContrib = createWidgetContributor(
- JBossWSCreationUIMessages.JBossWSConfigWidgetFactory_Title,
- JBossWSCreationUIMessages.JBossWSConfigWidgetFactory_Description,
- servicesXMLSelectWidget);
- }
-
- private SimpleWidgetContributor createWidgetContributor(String title,
- String description, final WidgetDataContributor contributor) {
- SimpleWidgetContributor widgetContrib = new SimpleWidgetContributor();
- widgetContrib.setTitle(title);
- widgetContrib.setDescription(description);
- widgetContrib.setFactory(new WidgetContributorFactory() {
- public WidgetContributor create() {
- return contributor;
- }
- });
- return widgetContrib;
- }
-
-}
Copied: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSJava2WSDLConfigWidgetFactory.java (from rev 20924, trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSJava2WSDLConfigWidgetFactory.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSJava2WSDLConfigWidgetFactory.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.creation.ui.wsrt;
+
+import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry;
+import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor;
+import org.jboss.tools.ws.creation.core.commands.InitialCommand;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
+import org.jboss.tools.ws.creation.ui.widgets.Java2WSDLCodeGenConfigWidget;
+
+/**
+ * @author Grid Qian
+ */
+@SuppressWarnings("restriction")
+public class JBossWSJava2WSDLConfigWidgetFactory implements
+ INamedWidgetContributorFactory {
+
+ private SimpleWidgetContributor servicesXMLSelectWidgetContrib;
+ private ServiceModel model;
+
+ public JBossWSJava2WSDLConfigWidgetFactory() {
+ }
+
+ public INamedWidgetContributor getFirstNamedWidget() {
+ if (servicesXMLSelectWidgetContrib == null)
+ init();
+ return servicesXMLSelectWidgetContrib;
+ }
+
+ public INamedWidgetContributor getNextNamedWidget(
+ INamedWidgetContributor widgetContributor) {
+ if (servicesXMLSelectWidgetContrib == null)
+ init();
+ INamedWidgetContributor nextWidgetContrib = null;
+ return nextWidgetContrib;
+ }
+
+ public void registerDataMappings(DataMappingRegistry dataRegistry) {
+ // Map the data model from the defaulting command to this widget
+ // factory.
+ // The framework will actually to the call to getWebServiceDataModel in
+ // the ExampleDefaultingCommand class and then call the
+ // setWebServiceDataModel
+ // method in this class.
+ dataRegistry.addMapping(InitialCommand.class, JBossWSCreationUIMessages.JBossWS_WebServiceDataModel,
+ JBossWSJava2WSDLConfigWidgetFactory.class);
+ }
+
+ public void setWebServiceDataModel(ServiceModel model) {
+ this.model = model;
+ }
+
+ private void init() {
+ // Pages of JBossWS Java2WSDL
+ Java2WSDLCodeGenConfigWidget java2WSDLWidget = new Java2WSDLCodeGenConfigWidget(
+ model);
+ servicesXMLSelectWidgetContrib = createWidgetContributor(
+ JBossWSCreationUIMessages.JBossWSJava2WSDLConfigWidgetFactory_Title,
+ JBossWSCreationUIMessages.JBossWSJava2WSDLConfigWidgetFactory_Description,
+ java2WSDLWidget);
+ }
+
+ private SimpleWidgetContributor createWidgetContributor(String title,
+ String description, final WidgetDataContributor contributor) {
+ SimpleWidgetContributor widgetContrib = new SimpleWidgetContributor();
+ widgetContrib.setTitle(title);
+ widgetContrib.setDescription(description);
+ widgetContrib.setFactory(new WidgetContributorFactory() {
+ public WidgetContributor create() {
+ return contributor;
+ }
+ });
+ return widgetContrib;
+ }
+
+}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.creation.ui.wsrt;
-
-import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry;
-import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributorFactory;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor;
-import org.jboss.tools.ws.creation.core.commands.InitialCommand;
-import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
-import org.jboss.tools.ws.creation.ui.widgets.ProviderInvokeCodeGenConfigWidget;
-
-/**
- * @author Grid Qian
- */
-public class JBossWSProviderInvokeConfigWidgetFactory implements
- INamedWidgetContributorFactory {
-
- private SimpleWidgetContributor servicesXMLSelectWidgetContrib;
- private ServiceModel model;
-
- public JBossWSProviderInvokeConfigWidgetFactory() {
- }
-
- public INamedWidgetContributor getFirstNamedWidget() {
- if (servicesXMLSelectWidgetContrib == null)
- init();
- return servicesXMLSelectWidgetContrib;
- }
-
- public INamedWidgetContributor getNextNamedWidget(
- INamedWidgetContributor widgetContributor) {
- if (servicesXMLSelectWidgetContrib == null)
- init();
- INamedWidgetContributor nextWidgetContrib = null;
- return nextWidgetContrib;
- }
-
- public void registerDataMappings(DataMappingRegistry dataRegistry) {
- // Map the data model from the defaulting command to this widget
- // factory.
- // The framework will actually to the call to getWebServiceDataModel in
- // the ExampleDefaultingCommand class and then call the
- // setWebServiceDataModel
- // method in this class.
- dataRegistry.addMapping(InitialCommand.class, "WebServiceDataModel", //$NON-NLS-1$
- JBossWSProviderInvokeConfigWidgetFactory.class);
- }
-
- public void setWebServiceDataModel(ServiceModel model) {
- this.model = model;
- }
-
- private void init() {
- // Pages of JBossWS Java2WSDL
- ProviderInvokeCodeGenConfigWidget java2WSDLWidget = new ProviderInvokeCodeGenConfigWidget(
- model);
- servicesXMLSelectWidgetContrib = createWidgetContributor(
- JBossWSCreationUIMessages.JBossWSProviderInvokeConfigWidgetFactory_Title,
- JBossWSCreationUIMessages.JBossWSProviderInvokeConfigWidgetFactory_Description,
- java2WSDLWidget);
- }
-
- private SimpleWidgetContributor createWidgetContributor(String title,
- String description, final WidgetDataContributor contributor) {
- SimpleWidgetContributor widgetContrib = new SimpleWidgetContributor();
- widgetContrib.setTitle(title);
- widgetContrib.setDescription(description);
- widgetContrib.setFactory(new WidgetContributorFactory() {
- public WidgetContributor create() {
- return contributor;
- }
- });
- return widgetContrib;
- }
-
-}
Copied: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSWSDL2JavaConfigWidgetFactory.java (from rev 20924, trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSWSDL2JavaConfigWidgetFactory.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSWSDL2JavaConfigWidgetFactory.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -0,0 +1,80 @@
+package org.jboss.tools.ws.creation.ui.wsrt;
+
+import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry;
+import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor;
+import org.jboss.tools.ws.creation.core.commands.InitialClientCommand;
+import org.jboss.tools.ws.creation.core.commands.InitialCommand;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
+import org.jboss.tools.ws.creation.ui.widgets.WSDL2JavaCodeGenConfigWidget;
+
+@SuppressWarnings("restriction")
+public class JBossWSWSDL2JavaConfigWidgetFactory implements
+ INamedWidgetContributorFactory {
+
+ private SimpleWidgetContributor servicesXMLSelectWidgetContrib;
+ private ServiceModel model;
+ private WSDL2JavaCodeGenConfigWidget servicesXMLSelectWidget;
+
+ public JBossWSWSDL2JavaConfigWidgetFactory() {
+ }
+
+ public INamedWidgetContributor getFirstNamedWidget() {
+ if (servicesXMLSelectWidgetContrib == null)
+ init();
+ return servicesXMLSelectWidgetContrib;
+ }
+
+ public INamedWidgetContributor getNextNamedWidget(
+ INamedWidgetContributor widgetContributor) {
+ if (servicesXMLSelectWidgetContrib == null)
+ init();
+ INamedWidgetContributor nextWidgetContrib = null;
+ return nextWidgetContrib;
+ }
+
+ public void registerDataMappings(DataMappingRegistry dataRegistry) {
+ // Map the data model from the defaulting command to this widget
+ // factory.
+ // The framework will actually to the call to getWebServiceDataModel in
+ // the ExampleDefaultingCommand class and then call the
+ // setWebServiceDataModel
+ // method in this class.
+ dataRegistry.addMapping(InitialCommand.class, JBossWSCreationUIMessages.JBossWS_WebServiceDataModel,JBossWSWSDL2JavaConfigWidgetFactory.class);
+ dataRegistry.addMapping(InitialClientCommand.class,JBossWSCreationUIMessages.JBossWS_WebServiceDataModel, JBossWSWSDL2JavaConfigWidgetFactory.class);
+ }
+
+ public void setWebServiceDataModel(ServiceModel model) {
+ this.model = model;
+ if (servicesXMLSelectWidget != null) {
+ servicesXMLSelectWidget.setModel(model);
+ }
+ }
+
+ private void init() {
+ servicesXMLSelectWidget = new WSDL2JavaCodeGenConfigWidget(model);
+ servicesXMLSelectWidgetContrib = createWidgetContributor(
+ JBossWSCreationUIMessages.JBossWSWSDL2JavaConfigWidgetFactory_Title,
+ JBossWSCreationUIMessages.JBossWSWSDL2JavaConfigWidgetFactory_Description,
+ servicesXMLSelectWidget);
+ }
+
+ private SimpleWidgetContributor createWidgetContributor(String title,
+ String description, final WidgetDataContributor contributor) {
+ SimpleWidgetContributor widgetContrib = new SimpleWidgetContributor();
+ widgetContrib.setTitle(title);
+ widgetContrib.setDescription(description);
+ widgetContrib.setFactory(new WidgetContributorFactory() {
+ public WidgetContributor create() {
+ return contributor;
+ }
+ });
+ return widgetContrib;
+ }
+
+}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -55,12 +55,11 @@
return null;
}
- @SuppressWarnings({ "unchecked" })
@Override
public ICommandFactory develop(IEnvironment env, IContext ctx,
ISelection sel, String project, String earProject) {
- Vector commands = new Vector();
+ Vector<AbstractDataModelOperation> commands = new Vector<AbstractDataModelOperation>();
ServiceModel model = new ServiceModel();
model.setWebProjectName(project);
if (ctx.getScenario().getValue() == WebServiceScenario.TOPDOWN) {
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -17,11 +17,10 @@
import org.eclipse.wst.command.internal.env.core.SimpleCommandFactory;
import org.eclipse.wst.common.environment.IEnvironment;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.ws.internal.wsrt.AbstractWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.IContext;
import org.eclipse.wst.ws.internal.wsrt.ISelection;
-import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo;
-import org.eclipse.wst.ws.internal.wsrt.AbstractWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
import org.jboss.tools.ws.creation.core.commands.BindingFilesValidationCommand;
import org.jboss.tools.ws.creation.core.commands.ClientSampleCreationCommand;
@@ -33,7 +32,7 @@
/**
* @author Grid Qian
*/
-@SuppressWarnings({ "restriction", "unused" })
+@SuppressWarnings({ "restriction"})
public class JBossWebServiceClient extends AbstractWebServiceClient {
public JBossWebServiceClient(WebServiceClientInfo info) {
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceRuntime.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceRuntime.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceRuntime.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -6,6 +6,7 @@
import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo;
import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo;
+@SuppressWarnings("restriction")
public class JBossWebServiceRuntime extends AbstractWebServiceRuntime{
@Override
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JBossWSUIPlugin.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JBossWSUIPlugin.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JBossWSUIPlugin.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -11,10 +11,8 @@
package org.jboss.tools.ws.ui;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
import org.osgi.framework.BundleContext;
@@ -67,28 +65,8 @@
path = "icons/" + path; //$NON-NLS-1$
return AbstractUIPlugin.imageDescriptorFromPlugin("org.jboss.tools.ws.ui", path); //$NON-NLS-1$
}
-
- public static boolean isDebugEnabled() {
- return plugin.isDebugging();
- }
- public static void log(String msg) {
- if(isDebugEnabled()) plugin.getLog().log(new Status(Status.INFO, PLUGIN_ID, Status.OK, msg, null));
- }
-
- public static void log(IStatus status) {
- if(isDebugEnabled() || !status.isOK()) plugin.getLog().log(status);
- }
-
- public static void log(String message, Throwable exception) {
- plugin.getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, message, exception));
- }
-
public static void log(Throwable ex) {
plugin.getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, JBossWSUIMessages.JBossWS_UI_PLUGIN_NO_MESSAGES, ex));
}
-
- public static Shell getShell() {
- return plugin.getWorkbench().getActiveWorkbenchWindow().getShell();
- }
}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,1097 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.osgi.util.NLS;
-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.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.Button;
-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.TableColumn;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.jboss.tools.common.ui.widget.editor.BaseFieldEditor;
-import org.jboss.tools.common.ui.widget.editor.ButtonFieldEditor;
-import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
-import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-import org.jboss.tools.ws.ui.utils.UIUtils;
-import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
-import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
-
-/**
- * @author Grid Qian
- */
-public class JBossRuntimeListFieldEditor extends BaseFieldEditor {
-
- // ------------------------------------------------------------------------
- // Layout parameters
- // ------------------------------------------------------------------------
-
- static final int GL_COLUMNS = 2;
- static final int GL_HINT_HEIGHT = 200;
- static final int TC_DEFAULT_WIDTH = 21;
- static final int TC_NAME_WIDTH = 100;
- static final int TC_VERSION_WIDTH = 50;
- static final int TC_PATH_WIDTH = 100;
-
- // ------------------------------------------------------------------------
- // Field declarations
- // ------------------------------------------------------------------------
-
- private CheckboxTableViewer tableView = null;
-
- private Composite root = null;
-
- private ActionPanel actionPanel;
-
- private Map<JBossWSRuntime, JBossWSRuntime> changed = new HashMap<JBossWSRuntime, JBossWSRuntime>();
-
- private JBossWSRuntime checkedElement = new JBossWSRuntime();
-
- private List<JBossWSRuntime> added = new ArrayList<JBossWSRuntime>();
-
- private List<JBossWSRuntime> removed = new ArrayList<JBossWSRuntime>();
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Control for editing jbossWSRuntime list
- *
- * @param name
- * String
- * @param label
- * String
- * @param defaultValue
- * Object
- */
- public JBossRuntimeListFieldEditor(String name, String label,
- Object defaultValue) {
- super(name, label, defaultValue);
- }
-
- /**
- * TBD
- *
- * @return JBossWSRuntime;
- */
- public JBossWSRuntime getDefaultJBossWSRuntime() {
- return checkedElement;
- }
-
- public void setDefaultJBossWSRuntime(JBossWSRuntime rt) {
- checkedElement = rt;
- }
-
- /**
- * TBD
- *
- * @return List<JBossWSRuntime>
- */
- public List<JBossWSRuntime> getAddedJBossWSRuntimes() {
- return added;
- }
-
- /**
- * TBD
- *
- * @return List<JBossWSRuntime>
- */
- public Map<JBossWSRuntime, JBossWSRuntime> getChangedJBossWSRuntimes() {
- return changed;
- }
-
- /**
- * TBD
- *
- * @return List<JBossWSRuntime>
- */
- public List<JBossWSRuntime> getRemoved() {
- return removed;
- }
-
- /**
- * TBD
- *
- * @param composite
- * Object - instance of Composite
- * @return Object[]
- */
- @Override
- public Object[] getEditorControls(Object composite) {
-
- root = new Composite((Composite) composite, SWT.NONE);
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- root.setLayoutData(gd);
-
- root.setLayout(new FormLayout());
- createTableView();
- createActionBar();
-
- FormData tableData = new FormData();
- tableData.left = new FormAttachment(0, 5);
- tableData.right = new FormAttachment(actionPanel, -5);
- tableData.top = new FormAttachment(0, 5);
- tableData.bottom = new FormAttachment(100, -5);
- tableView.getControl().setLayoutData(tableData);
-
- FormData actionsData = new FormData();
- actionsData.top = new FormAttachment(0, 5);
- actionsData.bottom = new FormAttachment(100, -5);
- actionsData.right = new FormAttachment(100, -5);
- actionPanel.setLayoutData(actionsData);
- return new Control[] { root };
- }
-
- @SuppressWarnings("unchecked")
- protected void createTableView() {
- tableView = CheckboxTableViewer.newCheckList(root, SWT.V_SCROLL
- | SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
-
- TableColumn tc1 = new TableColumn(tableView.getTable(), SWT.CENTER);
- tc1.setWidth(TC_DEFAULT_WIDTH);
- tc1.setResizable(false);
-
- TableColumn tc2 = new TableColumn(tableView.getTable(), SWT.LEFT);
- tc2.setWidth(TC_NAME_WIDTH);
- tc2.setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name);
-
- TableColumn tc3 = new TableColumn(tableView.getTable(), SWT.LEFT);
- tc3.setWidth(TC_VERSION_WIDTH);
- tc3
- .setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version);
-
- TableColumn tc4 = new TableColumn(tableView.getTable(), SWT.LEFT);
- tc4.setWidth(TC_PATH_WIDTH);
- tc4.setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Path);
-
- tableView.setContentProvider(new IStructuredContentProvider() {
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof List) {
- return ((List<JBossWSRuntime>) inputElement).toArray();
- } else {
- throw new IllegalArgumentException(
- JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List);
- }
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- viewer.refresh();
- }
- });
-
- tableView.setLabelProvider(new ITableLabelProvider() {
-
- private static final int TC_DEFAULT_NUMBER = 0;
- private static final int TC_NAME_NUMBER = 1;
- private static final int TC_VERSION_NUMBER = 2;
- private static final int TC_PATH_NUMBER = 3;
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- JBossWSRuntime rt = (JBossWSRuntime) element;
- if (columnIndex == TC_DEFAULT_NUMBER) {
- return ""; //$NON-NLS-1$
- }
- if (columnIndex == TC_NAME_NUMBER) {
- return rt.getName();
- }
- if (columnIndex == TC_VERSION_NUMBER) {
- return rt.getVersion().toString();
- }
- if (columnIndex == TC_PATH_NUMBER) {
- return rt.getHomeDir();
- }
- return ""; //$NON-NLS-1$
- }
- });
-
- tableView.setInput(getValue());
- tableView.getTable().setLinesVisible(true);
- tableView.getTable().setHeaderVisible(true);
- tableView.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- JBossWSRuntime selRt = (JBossWSRuntime) event.getElement();
- if (event.getChecked()) {
- JBossWSRuntime deselRt = null;
- Object[] selRts = tableView.getCheckedElements();
-
- for (int i = 0; i < selRts.length; i++) {
- JBossWSRuntime rt = (JBossWSRuntime) selRts[i];
- if (rt != selRt) {
- deselRt = rt;
- break;
- }
- }
-
- if (deselRt != null) {
- Object[] newChecked = new Object[selRts.length - 1];
- checkedElement = null;
- int i = 0;
- for (Object object : selRts) {
- JBossWSRuntime rt = (JBossWSRuntime) object;
- if (rt == selRt) {
- newChecked[i] = rt;
- checkedElement = rt;
- i++;
- }
- }
- tableView.setCheckedElements(newChecked);
- } else {
- checkedElement = (JBossWSRuntime) event.getElement();
- }
- } else {
- if (checkedElement == selRt) {
- checkedElement = null;
- }
- }
- pcs.firePropertyChange(getName(), null, getValue());
- }
- });
-
- for (JBossWSRuntime rt : (List<JBossWSRuntime>) getValue()) {
- if (rt.isDefault()) {
- tableView.setChecked(rt, true);
- checkedElement = rt;
- }
- }
- }
-
- protected void createActionBar() {
- actionPanel = new ActionPanel(root, new BaseAction[] { new AddAction(),
- new EditAction(), new RemoveAction() });
- tableView.addSelectionChangedListener(actionPanel);
- }
-
- /**
- * Checks all runtimes and set default one if user did not do it.
- */
- @SuppressWarnings("unchecked")
- private void setDefaultRuntime() {
- List<JBossWSRuntime> runtimes = (List<JBossWSRuntime>) getValue();
- boolean checked = false;
- for (JBossWSRuntime jbossWSRuntime : runtimes) {
- if (checkedElement == jbossWSRuntime) {
- checked = true;
- tableView.setChecked(checkedElement, true);
- break;
- }
- }
- if (!checked && runtimes.size() > 0) {
- if (tableView.getCheckedElements() == null
- || tableView.getCheckedElements().length == 0) {
- tableView.setChecked(runtimes.get(0), true);
- checkedElement = runtimes.get(0);
- }
- }
-
- }
-
- /**
- * Return array of Controls that forms and editor
- *
- * @return Control[]
- */
- @Override
- public Object[] getEditorControls() {
- return new Control[] { root };
- }
-
- /**
- * Return number of controls in editor
- *
- * @return int
- */
- @Override
- public int getNumberOfControls() {
- return 1;
- }
-
- /**
- * Fill wizard page with editors
- *
- * @param parent
- * Composite - parent composite
- */
- @Override
- public void doFillIntoGrid(Object parent) {
- Assert.isTrue(parent instanceof Composite,
- JBossWSUIMessages.Error_JBossWS_Basic_Editor_Composite);
- Assert.isTrue(((Composite) parent).getLayout() instanceof GridLayout,
- JBossWSUIMessages.Error_JBossWS_Basic_Editor_Support);
- Composite aComposite = (Composite) parent;
- getEditorControls(aComposite);
- GridLayout gl = (GridLayout) ((Composite) parent).getLayout();
-
- GridData gd = new GridData();
- gd.horizontalSpan = gl.numColumns;
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = GridData.FILL;
-
- ((Control) getEditorControls()[0]).setLayoutData(gd);
- }
-
- /**
- * Wizard page for editing JBossWS Runtime parameters
- *
- */
- public static class JBossWSRuntimeWizardPage extends WizardPage implements
- PropertyChangeListener {
-
- private static final String SRT_NAME = "name"; //$NON-NLS-1$
- private static final String SRT_VERSION = "version"; //$NON-NLS-1$
- private static final String SRT_HOMEDIR = "homeDir"; //$NON-NLS-1$
-
- private static final int GL_PARENT_COLUMNS = 1;
- private static final int GL_CONTENT_COLUMNS = 3;
-
- List<JBossWSRuntime> value = null;
-
- IFieldEditor name = IFieldEditorFactory.INSTANCE.createTextEditor(SRT_NAME,
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name2, ""); //$NON-NLS-1$
-
- IFieldEditor version = IFieldEditorFactory.INSTANCE.createComboEditor(SRT_VERSION,
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version,getWSFacetVersions(), ""); //$NON-NLS-1$
-
- IFieldEditor homeDir = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
- SRT_HOMEDIR,
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Home_Folder,
- ""); //$NON-NLS-1$
-
- JBossWSRuntime current = null;
-
- IFieldEditor jars = null;
-
- public JBossWSRuntimeWizardPage(List<JBossWSRuntime> editedList) {
- super(
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
-
- setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Create_A_Runtime);
- setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime);
- value = editedList;
- }
-
- /**
- * Create Wizard page content
- *
- * @param parent
- * Composite - parent composite
- */
- public void createControl(Composite parent) {
- parent.setLayout(new GridLayout(GL_PARENT_COLUMNS, false));
- GridData dg = new GridData();
- dg.horizontalAlignment = GridData.FILL;
- dg.grabExcessHorizontalSpace = true;
- Composite root = new Composite(parent, SWT.NONE);
- root.setLayoutData(dg);
- GridLayout gl = new GridLayout(GL_CONTENT_COLUMNS, false);
- root.setLayout(gl);
- name.doFillIntoGrid(root);
- name.addPropertyChangeListener(this);
- version.doFillIntoGrid(root);
- version.addPropertyChangeListener(this);
- homeDir.doFillIntoGrid(root);
- homeDir.addPropertyChangeListener(this);
-
- jars = new JBossWSLibraryListFieldEditor("", "", current); //$NON-NLS-1$ //$NON-NLS-2$
- jars.doFillIntoGrid(root);
- jars.addPropertyChangeListener(this);
- setPageComplete(false);
- setControl(root);
- }
-
- /**
- * Process evt: setup default values based on JBossWS Home folder and
- * validate user input
- *
- * @param evt
- * PropertyChangeEvent describes changes in wizard
- */
- public void propertyChange(java.beans.PropertyChangeEvent evt) {
- if ("homeDir".equals(evt.getPropertyName())) { //$NON-NLS-1$
- if (name.getValueAsString() == null
- || "".equals(name.getValueAsString().trim()) //$NON-NLS-1$
- || this.getErrorMessage() != null) {
- String homeDirName = homeDir.getValueAsString();
- if (homeDirName != null && !"".equals(homeDirName.trim())) { //$NON-NLS-1$
- File folder = new File(homeDirName);
- homeDirName = folder.getName();
- }
- name.setValue(homeDirName);
- }
- }
-
- if (name.getValueAsString() == null || "".equals(//$NON-NLS-1$
- name.getValueAsString().toString().trim())) {
- setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Name_Cannot_Be_Empty);
- setPageComplete(false);
- return;
- }
-
- if (!name.getValueAsString().matches(
- "[a-zA-Z_][a-zA-Z0-9_\\-\\. ]*")) { //$NON-NLS-1$
- setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct);
- setPageComplete(false);
- return;
- }
- for (JBossWSRuntime rt : value) {
- if (current != null && current.getName().equals(rt.getName())) {
- continue;
- }
- if (rt.getName().equals(name.getValueAsString())) {
- setErrorMessage(
- NLS.bind(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime_Already_Exists,
- name.getValueAsString()));
- setPageComplete(false);
- return;
- }
- }
-
- JBossWSRuntime jarJbws = (JBossWSRuntime) jars.getValue();
- if (current != null
- && current.getName().equals(name.getValueAsString())
- && current.getHomeDir().equals(homeDir.getValueAsString())
- && current.getVersion().equals(version.getValueAsString())
- && current.isUserConfigClasspath() == jarJbws
- .isUserConfigClasspath()
- && (!jarJbws.isUserConfigClasspath() || hasSameLibraies(
- current.getLibraries(), jarJbws.getLibraries()))) {
-
- setErrorMessage(null);
- setPageComplete(false);
- return;
- }
-
- if (jarJbws.isUserConfigClasspath()
- && jarJbws.getLibraries().size() == 0) {
- setErrorMessage(JBossWSUIMessages.JBossRuntimeListFieldEditor_ErrorMessageAtLeastOneJar);
- setPageComplete(false);
- return;
- }
-
- if (homeDir.getValueAsString() == null
- || "".equals(homeDir.getValueAsString().trim())) { //$NON-NLS-1$
- setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty);
- setPageComplete(false);
- return;
- }
-
- if (!runtimeExist(homeDir.getValueAsString())) {
- setErrorMessage(JBossWSUIMessages.Error_JBossWS_Label_Runtime_Load);
- setPageComplete(false);
- return;
- }
-
- setErrorMessage(null);
- setPageComplete(true);
- }
-
- private boolean hasSameLibraies(List<String> lib1, List<String> lib2) {
- if (lib1.size() != lib2.size())
- return false;
- for (String jar : lib1) {
- if (!lib2.contains(jar))
- return false;
- }
-
- return true;
- }
-
- /*
- * get facet version.
- */
- private List<String> getWSFacetVersions(){
- List<String> versions = new ArrayList<String>();
- IProjectFacet wsFacet = ProjectFacetsManager.getProjectFacet("jbossws.core"); //$NON-NLS-1$
- for(IProjectFacetVersion version: wsFacet.getVersions()){
- versions.add(version.getVersionString());
- }
-
- return versions;
- }
-
- /**
- * Return JBossWS Runtime instance initialized by user input
- *
- * @return JBossWSRuntime instance
- */
- public JBossWSRuntime getRuntime() {
- JBossWSRuntime newRt = new JBossWSRuntime();
- newRt.setName(name.getValueAsString());
- newRt.setVersion(version.getValueAsString());
- newRt.setHomeDir(homeDir.getValueAsString());
- JBossWSRuntime rt = (JBossWSRuntime) jars.getValue();
- newRt.setLibraries(rt.getLibraries());
- newRt.setUserConfigClasspath(rt.isUserConfigClasspath());
- return newRt;
- }
-
- public ButtonFieldEditor.ButtonPressedAction createSelectFolderAction(
- String buttonName) {
- return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
- @Override
- public void run() {
- DirectoryDialog dialog = new DirectoryDialog(Display
- .getCurrent().getActiveShell());
- dialog.setFilterPath(getFieldEditor().getValueAsString());
- dialog
- .setMessage(JBossWSUIMessages.JBossWS_SWT_Field_Editor_Factory_Select_Home_Folder);
- dialog.setFilterPath(getFieldEditor().getValueAsString());
- String directory = dialog.open();
- if (directory != null) {
- getFieldEditor().setValue(directory);
- }
- }
- };
- }
-
- private boolean runtimeExist(String path) {
-
- File jbosswsHomeDir = new File(path);
- if (!jbosswsHomeDir.isDirectory())
- return false;
- String[] newNode = { JBossWSUIMessages.Bin,
- JBossWSUIMessages.Command };
- String jbosswsBinPath = UIUtils.addNodesToPath(jbosswsHomeDir
- .getAbsolutePath(), newNode);
- if (new File(jbosswsBinPath).isFile()
- && new File(UIUtils.addAnotherNodeToPath(jbosswsHomeDir
- .getAbsolutePath(), JBossWSUIMessages.Client))
- .isDirectory()
- && new File(UIUtils
- .addNodesToPath(jbosswsHomeDir.getAbsolutePath(),
- new String[] { JBossWSUIMessages.Lib,
- JBossWSUIMessages.Endorsed }))
- .isDirectory()) {
- return true;
- }
- return false;
- }
- }
-
- /**
- * Wizard collect information and creates new JBossWSRuntime instances.
- *
- */
- public static class JBossWSRuntimeNewWizard extends Wizard {
-
- JBossWSRuntimeWizardPage page1 = null;
- List<JBossWSRuntime> added = null;
- List<JBossWSRuntime> value = null;
-
- public JBossWSRuntimeNewWizard(List<JBossWSRuntime> exist,
- List<JBossWSRuntime> added) {
- super();
- setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
- page1 = new JBossWSRuntimeWizardPage(exist);
- addPage(page1);
- this.value = exist;
- this.added = added;
- }
-
- /**
- * Do finish steps
- *
- * @return boolean
- */
- @Override
- public boolean performFinish() {
- JBossWSRuntime rt = page1.getRuntime();
- added.add(rt);
- value.add(rt);
-
- return true;
- }
-
- protected JBossWSRuntime getRuntime() {
- return page1.getRuntime();
- }
-
- }
-
- /**
- * Wizard for editing JBossWS Runtime parameters: name and path to home
- * folder
- *
- */
- public static class JBossWSRuntimeEditWizard extends Wizard {
- JBossWSRuntimeWizardPage page1 = null;
- List<JBossWSRuntime> added = null;
- Map<JBossWSRuntime, JBossWSRuntime> changed = null;
- List<JBossWSRuntime> value = null;
- JBossWSRuntime source = null;
-
- /**
- * Constructor with almost all initialization parameters
- *
- * @param existing
- * List<JBossWSRuntime> - edited list of JBossWS
- * Runtimes
- * @param source
- * JBossWSRuntime - edited JBossWS Runtime
- * @param added
- * List<JBossWSRuntime> - TBD
- * @param changed
- * List<JBossWSRuntime> - TBD
- */
- public JBossWSRuntimeEditWizard(List<JBossWSRuntime> existing,
- JBossWSRuntime source, List<JBossWSRuntime> added,
- Map<JBossWSRuntime, JBossWSRuntime> changed) {
- super();
- setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
- page1 = new JBossWSRuntimeWizardPage(existing);
- page1
- .setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Modify_Runtime);
- page1
- .setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
- addPage(page1);
- this.value = existing;
- this.added = added;
- this.changed = changed;
- this.source = source;
- page1.name.setValue(source.getName());
- page1.version.setValue(source.getVersion());
- page1.homeDir.setValue(source.getHomeDir());
- page1.current = source;
- }
-
- /**
- * Perform operations to finish editing JBossWS Runtime parameters
- *
- * @return boolean - always true
- */
- @Override
- public boolean performFinish() {
- JBossWSRuntime rt = page1.getRuntime();
-
- if (added.contains(source) || changed.containsKey(source)) {
- source.setName(rt.getName());
- source.setHomeDir(rt.getHomeDir());
- source.setVersion(rt.getVersion());
- source.setUserConfigClasspath(rt.isUserConfigClasspath());
- source.setLibraries(rt.getLibraries());
- } else {
- changed.put(rt, source);
- if (source.isDefault()) {
- rt.setDefault(true);
- }
- int i = value.indexOf(source);
- if (i >= 0) {
- value.set(i, rt);
-
- } else {
- value.remove(source);
- value.add(rt);
- }
- }
- return true;
- }
- }
-
- /**
- * Composite that holds list of BaseActions and presents them as column of
- * buttons
- *
- */
- public static class ActionPanel extends Composite implements
- ISelectionChangedListener {
-
- private BaseAction[] actions = null;
-
- /**
- * Constructor creates panel with style, grid layout and buttons
- * represented the actions
- *
- * @param parent
- * Composite
- * @param style
- * int
- * @param actions
- * BaseAction[]
- */
- public ActionPanel(Composite parent, int style, BaseAction[] actions) {
- super(parent, style);
- this.actions = actions;
- setLayout(new GridLayout(1, false));
- for (BaseAction action : this.actions) {
- new ActionButton(this, SWT.PUSH, action);
- }
- }
-
- /**
- * Constructor creates panel with default style, grid layout and buttons
- * represented the actions
- *
- * @param parent
- * Composite
- * @param actions
- * BaseAction[]
- */
- public ActionPanel(Composite parent, BaseAction[] actions) {
- this(parent, SWT.NONE, actions);
- }
-
- /**
- * Listen to the selection changes and update actions state
- * (enable/disable)
- *
- * @param event
- * SelectionChangeEvent
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- for (BaseAction action : actions) {
- action.setSelection(event.getSelection());
- }
- }
- }
-
- /**
- * Class represents an BaseAction as SWT button control and runs action when
- * button is prtessed
- *
- */
- public static class ActionButton implements IPropertyChangeListener {
-
- private Button button;
- private BaseAction action;
-
- /**
- * Create Button control with parent control and style that represents
- * action
- *
- * @param parent
- * Composite
- * @param style
- * int
- * @param action
- * BaseAction
- */
- public ActionButton(Composite parent, int style, BaseAction action) {
- this.button = new Button(parent, style);
- this.action = action;
-
- GridData gd = new GridData(GridData.FILL_HORIZONTAL,
- GridData.CENTER, false, false);
-
- gd.horizontalAlignment = GridData.FILL;
- gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
- this.button.setLayoutData(gd);
- this.action.addPropertyChangeListener(this);
- this.button.setText(action.getText());
- this.button.setEnabled(action.isEnabled());
- this.button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- ActionButton.this.action.run();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- }
-
- /**
- * Return SWT button control that calls provided action
- *
- * @return Control - button swt control
- */
- public Control getControl() {
- return button;
- }
-
- /**
- * Update enabled/disabled button state
- *
- * @param event
- * PropertyChangeEvent
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IAction.ENABLED)) {
- button.setEnabled(((Boolean) event.getNewValue())
- .booleanValue());
- }
- }
- }
-
- /**
- * Action that changes state enable/disable based on current table selection
- *
- */
- public abstract class BaseAction extends Action {
-
- JBossWSRuntime[] runtimes = new JBossWSRuntime[0];
-
- /**
- * Constructor creates action with provided name
- *
- * @param name
- * String - action name
- */
- public BaseAction(String name) {
- super(name);
- updateEnablement();
- }
-
- /**
- * Set current selection
- *
- * @param selection
- * ISelection - selected items
- */
- public void setSelection(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- List<JBossWSRuntime> rts = new ArrayList<JBossWSRuntime>();
- for (Object rt : ((IStructuredSelection) selection).toArray()) {
- rts.add((JBossWSRuntime) rt);
- }
- runtimes = rts.toArray(new JBossWSRuntime[] {});
- } else {
- runtimes = new JBossWSRuntime[0];
- }
- updateEnablement();
- }
-
- protected abstract void updateEnablement();
- }
-
- /**
- * Action that invokes New JBossWS Runtime Dialog
- *
- */
- public class AddAction extends BaseAction {
-
- /**
- * Constructor create Add action with default name
- */
- public AddAction() {
- super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionAdd);
- // This action is always available
- setEnabled(true);
- }
-
- /**
- * Do nothing, because Add action should be always available
- */
- @Override
- protected void updateEnablement() {
- // Add button is always available
- }
-
- /**
- * Invoke New JBossWS Runtime Dialog
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @SuppressWarnings("unchecked")
- @Override
- public void run() {
- Wizard wiz = new JBossWSRuntimeNewWizard(
- (List<JBossWSRuntime>) getValue(), added);
- WizardDialog dialog = new WizardDialog(Display.getCurrent()
- .getActiveShell(), wiz);
- dialog.open();
- tableView.refresh();
- setDefaultRuntime();
- }
- }
-
- /**
- * Action starts an editing selected JBossWS Runtime in Edit JBossWS Runtime
- * dialog
- *
- */
- public class EditAction extends BaseAction {
-
- /**
- * Create EditAction with default name
- *
- * @param text
- */
- public EditAction() {
- super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionEdit);
- }
-
- /**
- * Edit action is enabled when the only JBossWS Runtime is selected
- */
- @Override
- protected void updateEnablement() {
- // available when the only JBossWSRuntime is selected
- setEnabled(runtimes.length == 1);
- }
-
- /**
- * Start editing selected JBossWS Runtime in Edit JBossWS Runtime Wizard
- * Dialog
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @SuppressWarnings("unchecked")
- @Override
- public void run() {
- JBossWSRuntime selected = runtimes[0];
- Wizard wiz = new JBossWSRuntimeEditWizard(
- (List<JBossWSRuntime>) getValue(), runtimes[0], added,
- changed);
- WizardDialog dialog = new WizardDialog(Display.getCurrent()
- .getActiveShell(), wiz);
- dialog.open();
- tableView.refresh();
- JBossWSRuntime c = null;
- if (changed.containsValue(selected)) {
- c = findChangedRuntime(selected);
- if (c != null) {
- tableView.setSelection(new StructuredSelection(c));
- }
- }
- if (c != null && c.isDefault()) {
- checkedElement = c;
- }
- setDefaultRuntime();
- }
-
- private JBossWSRuntime findChangedRuntime(JBossWSRuntime source) {
- for (JBossWSRuntime r : changed.keySet()) {
- if (source == changed.get(r)) {
- return r;
- }
- }
- return null;
- }
- }
-
- /**
- * Action deletes all selected JBossWS Runtimes. A warning message is shown
- * for used JBossWS Runtimes
- *
- */
- public class RemoveAction extends BaseAction {
-
- /**
- * Create DeleteAction action with default name
- */
- public RemoveAction() {
- super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionRemove);
- }
-
- @Override
- protected void updateEnablement() {
- setEnabled(runtimes.length > 0);
- }
-
- /**
- * Remove all selected JBossWS Runtimes one by one
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- for (JBossWSRuntime rt : runtimes) {
- removeRuntime(rt);
- }
- tableView.refresh();
- setDefaultRuntime();
- }
-
- @SuppressWarnings("unchecked")
- private void removeRuntime(JBossWSRuntime r) {
- boolean used = JBossWSRuntimeManager.isRuntimeUsed(r.getName());
- String title = JBossWSUIMessages.JBossWS_Runtime_Delete_Confirm_Title;
- String message = (used) ? NLS.bind(
- JBossWSUIMessages.JBossWS_Runtime_Delete_Used_Confirm, r
- .getName()) : NLS.bind(
- JBossWSUIMessages.JBossWS_Runtime_Delete_Not_Used_Confirm,
- r.getName());
- boolean b = MessageDialog.openConfirm(tableView.getControl()
- .getShell(), title, message);
- if (b) {
- if (changed.containsKey(r)) {
- r = changed.remove(r);
- }
- removed.add(r);
- if (added.contains(r)) {
- added.remove(r);
- }
- ((List) getValue()).remove(r);
- }
- if (checkedElement == r) {
- checkedElement = null;
- }
- }
- }
-}
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -133,7 +133,8 @@
createCheckButton(root);
jarGroup = new Group(root, SWT.NONE);
- jarGroup.setText(JBossWSUIMessages.JBossWSLibraryListFieldEditor_LIBRARY_JARS);
+ jarGroup
+ .setText(JBossWSUIMessages.JBossWSLibraryListFieldEditor_LIBRARY_JARS);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
Copied: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java (from rev 20923, trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -0,0 +1,1102 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+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.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.Button;
+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.TableColumn;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.common.ui.widget.editor.BaseFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.ButtonFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.jboss.tools.ws.ui.utils.JBossWSUIUtils;
+import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
+import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
+
+/**
+ * @author Grid Qian
+ */
+public class JBossWSRuntimeListFieldEditor extends BaseFieldEditor {
+
+ // ------------------------------------------------------------------------
+ // Layout parameters
+ // ------------------------------------------------------------------------
+
+ static final int GL_COLUMNS = 2;
+ static final int GL_HINT_HEIGHT = 200;
+ static final int TC_DEFAULT_WIDTH = 21;
+ static final int TC_NAME_WIDTH = 100;
+ static final int TC_VERSION_WIDTH = 50;
+ static final int TC_PATH_WIDTH = 100;
+
+ // ------------------------------------------------------------------------
+ // Field declarations
+ // ------------------------------------------------------------------------
+
+ private CheckboxTableViewer tableView = null;
+
+ private Composite root = null;
+
+ private ActionPanel actionPanel;
+
+ private Map<JBossWSRuntime, JBossWSRuntime> changed = new HashMap<JBossWSRuntime, JBossWSRuntime>();
+
+ private JBossWSRuntime checkedElement = new JBossWSRuntime();
+
+ private List<JBossWSRuntime> added = new ArrayList<JBossWSRuntime>();
+
+ private List<JBossWSRuntime> removed = new ArrayList<JBossWSRuntime>();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Control for editing jbossWSRuntime list
+ *
+ * @param name
+ * String
+ * @param label
+ * String
+ * @param defaultValue
+ * Object
+ */
+ public JBossWSRuntimeListFieldEditor(String name, String label,
+ Object defaultValue) {
+ super(name, label, defaultValue);
+ }
+
+ /**
+ * TBD
+ *
+ * @return JBossWSRuntime;
+ */
+ public JBossWSRuntime getDefaultJBossWSRuntime() {
+ return checkedElement;
+ }
+
+ public void setDefaultJBossWSRuntime(JBossWSRuntime rt) {
+ checkedElement = rt;
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JBossWSRuntime>
+ */
+ public List<JBossWSRuntime> getAddedJBossWSRuntimes() {
+ return added;
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JBossWSRuntime>
+ */
+ public Map<JBossWSRuntime, JBossWSRuntime> getChangedJBossWSRuntimes() {
+ return changed;
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JBossWSRuntime>
+ */
+ public List<JBossWSRuntime> getRemoved() {
+ return removed;
+ }
+
+ /**
+ * TBD
+ *
+ * @param composite
+ * Object - instance of Composite
+ * @return Object[]
+ */
+ @Override
+ public Object[] getEditorControls(Object composite) {
+
+ root = new Composite((Composite) composite, SWT.NONE);
+ GridData gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ root.setLayoutData(gd);
+
+ root.setLayout(new FormLayout());
+ createTableView();
+ createActionBar();
+
+ FormData tableData = new FormData();
+ tableData.left = new FormAttachment(0, 5);
+ tableData.right = new FormAttachment(actionPanel, -5);
+ tableData.top = new FormAttachment(0, 5);
+ tableData.bottom = new FormAttachment(100, -5);
+ tableView.getControl().setLayoutData(tableData);
+
+ FormData actionsData = new FormData();
+ actionsData.top = new FormAttachment(0, 5);
+ actionsData.bottom = new FormAttachment(100, -5);
+ actionsData.right = new FormAttachment(100, -5);
+ actionPanel.setLayoutData(actionsData);
+ return new Control[] { root };
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void createTableView() {
+ tableView = CheckboxTableViewer.newCheckList(root, SWT.V_SCROLL
+ | SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
+
+ TableColumn tc1 = new TableColumn(tableView.getTable(), SWT.CENTER);
+ tc1.setWidth(TC_DEFAULT_WIDTH);
+ tc1.setResizable(false);
+
+ TableColumn tc2 = new TableColumn(tableView.getTable(), SWT.LEFT);
+ tc2.setWidth(TC_NAME_WIDTH);
+ tc2.setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name);
+
+ TableColumn tc3 = new TableColumn(tableView.getTable(), SWT.LEFT);
+ tc3.setWidth(TC_VERSION_WIDTH);
+ tc3
+ .setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version);
+
+ TableColumn tc4 = new TableColumn(tableView.getTable(), SWT.LEFT);
+ tc4.setWidth(TC_PATH_WIDTH);
+ tc4.setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Path);
+
+ tableView.setContentProvider(new IStructuredContentProvider() {
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List) {
+ return ((List<JBossWSRuntime>) inputElement).toArray();
+ } else {
+ throw new IllegalArgumentException(
+ JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List);
+ }
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+ viewer.refresh();
+ }
+ });
+
+ tableView.setLabelProvider(new ITableLabelProvider() {
+
+ private static final int TC_DEFAULT_NUMBER = 0;
+ private static final int TC_NAME_NUMBER = 1;
+ private static final int TC_VERSION_NUMBER = 2;
+ private static final int TC_PATH_NUMBER = 3;
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ JBossWSRuntime rt = (JBossWSRuntime) element;
+ if (columnIndex == TC_DEFAULT_NUMBER) {
+ return ""; //$NON-NLS-1$
+ }
+ if (columnIndex == TC_NAME_NUMBER) {
+ return rt.getName();
+ }
+ if (columnIndex == TC_VERSION_NUMBER) {
+ return rt.getVersion().toString();
+ }
+ if (columnIndex == TC_PATH_NUMBER) {
+ return rt.getHomeDir();
+ }
+ return ""; //$NON-NLS-1$
+ }
+ });
+
+ tableView.setInput(getValue());
+ tableView.getTable().setLinesVisible(true);
+ tableView.getTable().setHeaderVisible(true);
+ tableView.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ JBossWSRuntime selRt = (JBossWSRuntime) event.getElement();
+ if (event.getChecked()) {
+ JBossWSRuntime deselRt = null;
+ Object[] selRts = tableView.getCheckedElements();
+
+ for (int i = 0; i < selRts.length; i++) {
+ JBossWSRuntime rt = (JBossWSRuntime) selRts[i];
+ if (rt != selRt) {
+ deselRt = rt;
+ break;
+ }
+ }
+
+ if (deselRt != null) {
+ Object[] newChecked = new Object[selRts.length - 1];
+ checkedElement = null;
+ int i = 0;
+ for (Object object : selRts) {
+ JBossWSRuntime rt = (JBossWSRuntime) object;
+ if (rt == selRt) {
+ newChecked[i] = rt;
+ checkedElement = rt;
+ i++;
+ }
+ }
+ tableView.setCheckedElements(newChecked);
+ } else {
+ checkedElement = (JBossWSRuntime) event.getElement();
+ }
+ } else {
+ if (checkedElement == selRt) {
+ checkedElement = null;
+ }
+ }
+ pcs.firePropertyChange(getName(), null, getValue());
+ }
+ });
+
+ for (JBossWSRuntime rt : (List<JBossWSRuntime>) getValue()) {
+ if (rt.isDefault()) {
+ tableView.setChecked(rt, true);
+ checkedElement = rt;
+ }
+ }
+ }
+
+ protected void createActionBar() {
+ actionPanel = new ActionPanel(root, new BaseAction[] { new AddAction(),
+ new EditAction(), new RemoveAction() });
+ tableView.addSelectionChangedListener(actionPanel);
+ }
+
+ /**
+ * Checks all runtimes and set default one if user did not do it.
+ */
+ @SuppressWarnings("unchecked")
+ private void setDefaultRuntime() {
+ List<JBossWSRuntime> runtimes = (List<JBossWSRuntime>) getValue();
+ boolean checked = false;
+ for (JBossWSRuntime jbossWSRuntime : runtimes) {
+ if (checkedElement == jbossWSRuntime) {
+ checked = true;
+ tableView.setChecked(checkedElement, true);
+ break;
+ }
+ }
+ if (!checked && runtimes.size() > 0) {
+ if (tableView.getCheckedElements() == null
+ || tableView.getCheckedElements().length == 0) {
+ tableView.setChecked(runtimes.get(0), true);
+ checkedElement = runtimes.get(0);
+ }
+ }
+
+ }
+
+ /**
+ * Return array of Controls that forms and editor
+ *
+ * @return Control[]
+ */
+ @Override
+ public Object[] getEditorControls() {
+ return new Control[] { root };
+ }
+
+ /**
+ * Return number of controls in editor
+ *
+ * @return int
+ */
+ @Override
+ public int getNumberOfControls() {
+ return 1;
+ }
+
+ /**
+ * Fill wizard page with editors
+ *
+ * @param parent
+ * Composite - parent composite
+ */
+ @Override
+ public void doFillIntoGrid(Object parent) {
+ Assert.isTrue(parent instanceof Composite,
+ JBossWSUIMessages.Error_JBossWS_Basic_Editor_Composite);
+ Assert.isTrue(((Composite) parent).getLayout() instanceof GridLayout,
+ JBossWSUIMessages.Error_JBossWS_Basic_Editor_Support);
+ Composite aComposite = (Composite) parent;
+ getEditorControls(aComposite);
+ GridLayout gl = (GridLayout) ((Composite) parent).getLayout();
+
+ GridData gd = new GridData();
+ gd.horizontalSpan = gl.numColumns;
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = GridData.FILL;
+
+ ((Control) getEditorControls()[0]).setLayoutData(gd);
+ }
+
+ /**
+ * Wizard page for editing JBossWS Runtime parameters
+ *
+ */
+ public static class JBossWSRuntimeWizardPage extends WizardPage implements
+ PropertyChangeListener {
+
+ private static final String SRT_NAME = "name"; //$NON-NLS-1$
+ private static final String SRT_VERSION = "version"; //$NON-NLS-1$
+ private static final String SRT_HOMEDIR = "homeDir"; //$NON-NLS-1$
+
+ private static final int GL_PARENT_COLUMNS = 1;
+ private static final int GL_CONTENT_COLUMNS = 3;
+
+ List<JBossWSRuntime> value = null;
+
+ IFieldEditor name = IFieldEditorFactory.INSTANCE.createTextEditor(
+ SRT_NAME,
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name2, ""); //$NON-NLS-1$
+
+ IFieldEditor version = IFieldEditorFactory.INSTANCE.createComboEditor(
+ SRT_VERSION,
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version,
+ getWSFacetVersions(), ""); //$NON-NLS-1$
+
+ IFieldEditor homeDir = IFieldEditorFactory.INSTANCE
+ .createBrowseFolderEditor(
+ SRT_HOMEDIR,
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Home_Folder,
+ ""); //$NON-NLS-1$
+
+ JBossWSRuntime current = null;
+
+ IFieldEditor jars = null;
+
+ public JBossWSRuntimeWizardPage(List<JBossWSRuntime> editedList) {
+ super(
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
+ setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Create_A_Runtime);
+ setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime);
+ value = editedList;
+ }
+
+ /**
+ * Create Wizard page content
+ *
+ * @param parent
+ * Composite - parent composite
+ */
+ public void createControl(Composite parent) {
+ parent.setLayout(new GridLayout(GL_PARENT_COLUMNS, false));
+ GridData dg = new GridData();
+ dg.horizontalAlignment = GridData.FILL;
+ dg.grabExcessHorizontalSpace = true;
+ Composite root = new Composite(parent, SWT.NONE);
+ root.setLayoutData(dg);
+ GridLayout gl = new GridLayout(GL_CONTENT_COLUMNS, false);
+ root.setLayout(gl);
+ name.doFillIntoGrid(root);
+ name.addPropertyChangeListener(this);
+ version.doFillIntoGrid(root);
+ version.addPropertyChangeListener(this);
+ homeDir.doFillIntoGrid(root);
+ homeDir.addPropertyChangeListener(this);
+
+ jars = new JBossWSLibraryListFieldEditor("", "", current); //$NON-NLS-1$ //$NON-NLS-2$
+ jars.doFillIntoGrid(root);
+ jars.addPropertyChangeListener(this);
+ setPageComplete(false);
+ setControl(root);
+ }
+
+ /**
+ * Process evt: setup default values based on JBossWS Home folder and
+ * validate user input
+ *
+ * @param evt
+ * PropertyChangeEvent describes changes in wizard
+ */
+ public void propertyChange(java.beans.PropertyChangeEvent evt) {
+ if ("homeDir".equals(evt.getPropertyName())) { //$NON-NLS-1$
+ if (name.getValueAsString() == null
+ || "".equals(name.getValueAsString().trim()) //$NON-NLS-1$
+ || this.getErrorMessage() != null) {
+ String homeDirName = homeDir.getValueAsString();
+ if (homeDirName != null && !"".equals(homeDirName.trim())) { //$NON-NLS-1$
+ File folder = new File(homeDirName);
+ homeDirName = folder.getName();
+ }
+ name.setValue(homeDirName);
+ }
+ }
+
+ if (name.getValueAsString() == null || "".equals(//$NON-NLS-1$
+ name.getValueAsString().toString().trim())) {
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Name_Cannot_Be_Empty);
+ setPageComplete(false);
+ return;
+ }
+
+ if (!name.getValueAsString().matches(
+ "[a-zA-Z_][a-zA-Z0-9_\\-\\. ]*")) { //$NON-NLS-1$
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct);
+ setPageComplete(false);
+ return;
+ }
+ for (JBossWSRuntime rt : value) {
+ if (current != null && current.getName().equals(rt.getName())) {
+ continue;
+ }
+ if (rt.getName().equals(name.getValueAsString())) {
+ setErrorMessage(NLS
+ .bind(
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime_Already_Exists,
+ name.getValueAsString()));
+ setPageComplete(false);
+ return;
+ }
+ }
+
+ JBossWSRuntime jarJbws = (JBossWSRuntime) jars.getValue();
+ if (current != null
+ && current.getName().equals(name.getValueAsString())
+ && current.getHomeDir().equals(homeDir.getValueAsString())
+ && current.getVersion().equals(version.getValueAsString())
+ && current.isUserConfigClasspath() == jarJbws
+ .isUserConfigClasspath()
+ && (!jarJbws.isUserConfigClasspath() || hasSameLibraies(
+ current.getLibraries(), jarJbws.getLibraries()))) {
+
+ setErrorMessage(null);
+ setPageComplete(false);
+ return;
+ }
+
+ if (jarJbws.isUserConfigClasspath()
+ && jarJbws.getLibraries().size() == 0) {
+ setErrorMessage(JBossWSUIMessages.JBossRuntimeListFieldEditor_ErrorMessageAtLeastOneJar);
+ setPageComplete(false);
+ return;
+ }
+
+ if (homeDir.getValueAsString() == null
+ || "".equals(homeDir.getValueAsString().trim())) { //$NON-NLS-1$
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty);
+ setPageComplete(false);
+ return;
+ }
+
+ if (!runtimeExist(homeDir.getValueAsString())) {
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_Label_Runtime_Load);
+ setPageComplete(false);
+ return;
+ }
+
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+
+ private boolean hasSameLibraies(List<String> lib1, List<String> lib2) {
+ if (lib1.size() != lib2.size())
+ return false;
+ for (String jar : lib1) {
+ if (!lib2.contains(jar))
+ return false;
+ }
+
+ return true;
+ }
+
+ /*
+ * get facet version.
+ */
+ private List<String> getWSFacetVersions() {
+ List<String> versions = new ArrayList<String>();
+ IProjectFacet wsFacet = ProjectFacetsManager
+ .getProjectFacet("jbossws.core"); //$NON-NLS-1$
+ for (IProjectFacetVersion version : wsFacet.getVersions()) {
+ versions.add(version.getVersionString());
+ }
+
+ return versions;
+ }
+
+ /**
+ * Return JBossWS Runtime instance initialized by user input
+ *
+ * @return JBossWSRuntime instance
+ */
+ public JBossWSRuntime getRuntime() {
+ JBossWSRuntime newRt = new JBossWSRuntime();
+ newRt.setName(name.getValueAsString());
+ newRt.setVersion(version.getValueAsString());
+ newRt.setHomeDir(homeDir.getValueAsString());
+ JBossWSRuntime rt = (JBossWSRuntime) jars.getValue();
+ newRt.setLibraries(rt.getLibraries());
+ newRt.setUserConfigClasspath(rt.isUserConfigClasspath());
+ return newRt;
+ }
+
+ public ButtonFieldEditor.ButtonPressedAction createSelectFolderAction(
+ String buttonName) {
+ return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
+ @Override
+ public void run() {
+ DirectoryDialog dialog = new DirectoryDialog(Display
+ .getCurrent().getActiveShell());
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ dialog
+ .setMessage(JBossWSUIMessages.JBossWS_SWT_Field_Editor_Factory_Select_Home_Folder);
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ String directory = dialog.open();
+ if (directory != null) {
+ getFieldEditor().setValue(directory);
+ }
+ }
+ };
+ }
+
+ private boolean runtimeExist(String path) {
+
+ File jbosswsHomeDir = new File(path);
+ if (!jbosswsHomeDir.isDirectory())
+ return false;
+ String[] newNode = { JBossWSUIMessages.Bin,
+ JBossWSUIMessages.Command };
+ String jbosswsBinPath = JBossWSUIUtils.addNodesToPath(
+ jbosswsHomeDir.getAbsolutePath(), newNode);
+ if (new File(jbosswsBinPath).isFile()
+ && new File(JBossWSUIUtils.addAnotherNodeToPath(
+ jbosswsHomeDir.getAbsolutePath(),
+ JBossWSUIMessages.Client)).isDirectory()
+ && new File(JBossWSUIUtils
+ .addNodesToPath(jbosswsHomeDir.getAbsolutePath(),
+ new String[] { JBossWSUIMessages.Lib,
+ JBossWSUIMessages.Endorsed }))
+ .isDirectory()) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Wizard collect information and creates new JBossWSRuntime instances.
+ *
+ */
+ public static class JBossWSRuntimeNewWizard extends Wizard {
+
+ JBossWSRuntimeWizardPage page1 = null;
+ List<JBossWSRuntime> added = null;
+ List<JBossWSRuntime> value = null;
+
+ public JBossWSRuntimeNewWizard(List<JBossWSRuntime> exist,
+ List<JBossWSRuntime> added) {
+ super();
+ setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
+ page1 = new JBossWSRuntimeWizardPage(exist);
+ addPage(page1);
+ this.value = exist;
+ this.added = added;
+ }
+
+ /**
+ * Do finish steps
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean performFinish() {
+ JBossWSRuntime rt = page1.getRuntime();
+ added.add(rt);
+ value.add(rt);
+
+ return true;
+ }
+
+ protected JBossWSRuntime getRuntime() {
+ return page1.getRuntime();
+ }
+
+ }
+
+ /**
+ * Wizard for editing JBossWS Runtime parameters: name and path to home
+ * folder
+ *
+ */
+ public static class JBossWSRuntimeEditWizard extends Wizard {
+ JBossWSRuntimeWizardPage page1 = null;
+ List<JBossWSRuntime> added = null;
+ Map<JBossWSRuntime, JBossWSRuntime> changed = null;
+ List<JBossWSRuntime> value = null;
+ JBossWSRuntime source = null;
+
+ /**
+ * Constructor with almost all initialization parameters
+ *
+ * @param existing
+ * List<JBossWSRuntime> - edited list of JBossWS
+ * Runtimes
+ * @param source
+ * JBossWSRuntime - edited JBossWS Runtime
+ * @param added
+ * List<JBossWSRuntime> - TBD
+ * @param changed
+ * List<JBossWSRuntime> - TBD
+ */
+ public JBossWSRuntimeEditWizard(List<JBossWSRuntime> existing,
+ JBossWSRuntime source, List<JBossWSRuntime> added,
+ Map<JBossWSRuntime, JBossWSRuntime> changed) {
+ super();
+ setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
+ page1 = new JBossWSRuntimeWizardPage(existing);
+ page1
+ .setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Modify_Runtime);
+ page1
+ .setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
+ addPage(page1);
+ this.value = existing;
+ this.added = added;
+ this.changed = changed;
+ this.source = source;
+ page1.name.setValue(source.getName());
+ page1.version.setValue(source.getVersion());
+ page1.homeDir.setValue(source.getHomeDir());
+ page1.current = source;
+ }
+
+ /**
+ * Perform operations to finish editing JBossWS Runtime parameters
+ *
+ * @return boolean - always true
+ */
+ @Override
+ public boolean performFinish() {
+ JBossWSRuntime rt = page1.getRuntime();
+
+ if (added.contains(source) || changed.containsKey(source)) {
+ source.setName(rt.getName());
+ source.setHomeDir(rt.getHomeDir());
+ source.setVersion(rt.getVersion());
+ source.setUserConfigClasspath(rt.isUserConfigClasspath());
+ source.setLibraries(rt.getLibraries());
+ } else {
+ changed.put(rt, source);
+ if (source.isDefault()) {
+ rt.setDefault(true);
+ }
+ int i = value.indexOf(source);
+ if (i >= 0) {
+ value.set(i, rt);
+
+ } else {
+ value.remove(source);
+ value.add(rt);
+ }
+ }
+ return true;
+ }
+ }
+
+ /**
+ * Composite that holds list of BaseActions and presents them as column of
+ * buttons
+ *
+ */
+ public static class ActionPanel extends Composite implements
+ ISelectionChangedListener {
+
+ private BaseAction[] actions = null;
+
+ /**
+ * Constructor creates panel with style, grid layout and buttons
+ * represented the actions
+ *
+ * @param parent
+ * Composite
+ * @param style
+ * int
+ * @param actions
+ * BaseAction[]
+ */
+ public ActionPanel(Composite parent, int style, BaseAction[] actions) {
+ super(parent, style);
+ this.actions = actions;
+ setLayout(new GridLayout(1, false));
+ for (BaseAction action : this.actions) {
+ new ActionButton(this, SWT.PUSH, action);
+ }
+ }
+
+ /**
+ * Constructor creates panel with default style, grid layout and buttons
+ * represented the actions
+ *
+ * @param parent
+ * Composite
+ * @param actions
+ * BaseAction[]
+ */
+ public ActionPanel(Composite parent, BaseAction[] actions) {
+ this(parent, SWT.NONE, actions);
+ }
+
+ /**
+ * Listen to the selection changes and update actions state
+ * (enable/disable)
+ *
+ * @param event
+ * SelectionChangeEvent
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ for (BaseAction action : actions) {
+ action.setSelection(event.getSelection());
+ }
+ }
+ }
+
+ /**
+ * Class represents an BaseAction as SWT button control and runs action when
+ * button is prtessed
+ *
+ */
+ public static class ActionButton implements IPropertyChangeListener {
+
+ private Button button;
+ private BaseAction action;
+
+ /**
+ * Create Button control with parent control and style that represents
+ * action
+ *
+ * @param parent
+ * Composite
+ * @param style
+ * int
+ * @param action
+ * BaseAction
+ */
+ public ActionButton(Composite parent, int style, BaseAction action) {
+ this.button = new Button(parent, style);
+ this.action = action;
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL,
+ GridData.CENTER, false, false);
+
+ gd.horizontalAlignment = GridData.FILL;
+ gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
+ this.button.setLayoutData(gd);
+ this.action.addPropertyChangeListener(this);
+ this.button.setText(action.getText());
+ this.button.setEnabled(action.isEnabled());
+ this.button.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ ActionButton.this.action.run();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ }
+
+ /**
+ * Return SWT button control that calls provided action
+ *
+ * @return Control - button swt control
+ */
+ public Control getControl() {
+ return button;
+ }
+
+ /**
+ * Update enabled/disabled button state
+ *
+ * @param event
+ * PropertyChangeEvent
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(IAction.ENABLED)) {
+ button.setEnabled(((Boolean) event.getNewValue())
+ .booleanValue());
+ }
+ }
+ }
+
+ /**
+ * Action that changes state enable/disable based on current table selection
+ *
+ */
+ public abstract class BaseAction extends Action {
+
+ JBossWSRuntime[] runtimes = new JBossWSRuntime[0];
+
+ /**
+ * Constructor creates action with provided name
+ *
+ * @param name
+ * String - action name
+ */
+ public BaseAction(String name) {
+ super(name);
+ updateEnablement();
+ }
+
+ /**
+ * Set current selection
+ *
+ * @param selection
+ * ISelection - selected items
+ */
+ public void setSelection(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ List<JBossWSRuntime> rts = new ArrayList<JBossWSRuntime>();
+ for (Object rt : ((IStructuredSelection) selection).toArray()) {
+ rts.add((JBossWSRuntime) rt);
+ }
+ runtimes = rts.toArray(new JBossWSRuntime[] {});
+ } else {
+ runtimes = new JBossWSRuntime[0];
+ }
+ updateEnablement();
+ }
+
+ protected abstract void updateEnablement();
+ }
+
+ /**
+ * Action that invokes New JBossWS Runtime Dialog
+ *
+ */
+ public class AddAction extends BaseAction {
+
+ /**
+ * Constructor create Add action with default name
+ */
+ public AddAction() {
+ super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionAdd);
+ // This action is always available
+ setEnabled(true);
+ }
+
+ /**
+ * Do nothing, because Add action should be always available
+ */
+ @Override
+ protected void updateEnablement() {
+ // Add button is always available
+ }
+
+ /**
+ * Invoke New JBossWS Runtime Dialog
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void run() {
+ Wizard wiz = new JBossWSRuntimeNewWizard(
+ (List<JBossWSRuntime>) getValue(), added);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), wiz);
+ dialog.open();
+ tableView.refresh();
+ setDefaultRuntime();
+ }
+ }
+
+ /**
+ * Action starts an editing selected JBossWS Runtime in Edit JBossWS Runtime
+ * dialog
+ *
+ */
+ public class EditAction extends BaseAction {
+
+ /**
+ * Create EditAction with default name
+ *
+ * @param text
+ */
+ public EditAction() {
+ super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionEdit);
+ }
+
+ /**
+ * Edit action is enabled when the only JBossWS Runtime is selected
+ */
+ @Override
+ protected void updateEnablement() {
+ // available when the only JBossWSRuntime is selected
+ setEnabled(runtimes.length == 1);
+ }
+
+ /**
+ * Start editing selected JBossWS Runtime in Edit JBossWS Runtime Wizard
+ * Dialog
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void run() {
+ JBossWSRuntime selected = runtimes[0];
+ Wizard wiz = new JBossWSRuntimeEditWizard(
+ (List<JBossWSRuntime>) getValue(), runtimes[0], added,
+ changed);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), wiz);
+ dialog.open();
+ tableView.refresh();
+ JBossWSRuntime c = null;
+ if (changed.containsValue(selected)) {
+ c = findChangedRuntime(selected);
+ if (c != null) {
+ tableView.setSelection(new StructuredSelection(c));
+ }
+ }
+ if (c != null && c.isDefault()) {
+ checkedElement = c;
+ }
+ setDefaultRuntime();
+ }
+
+ private JBossWSRuntime findChangedRuntime(JBossWSRuntime source) {
+ for (JBossWSRuntime r : changed.keySet()) {
+ if (source == changed.get(r)) {
+ return r;
+ }
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Action deletes all selected JBossWS Runtimes. A warning message is shown
+ * for used JBossWS Runtimes
+ *
+ */
+ public class RemoveAction extends BaseAction {
+
+ /**
+ * Create DeleteAction action with default name
+ */
+ public RemoveAction() {
+ super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionRemove);
+ }
+
+ @Override
+ protected void updateEnablement() {
+ setEnabled(runtimes.length > 0);
+ }
+
+ /**
+ * Remove all selected JBossWS Runtimes one by one
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ for (JBossWSRuntime rt : runtimes) {
+ removeRuntime(rt);
+ }
+ tableView.refresh();
+ setDefaultRuntime();
+ }
+
+ @SuppressWarnings("unchecked")
+ private void removeRuntime(JBossWSRuntime r) {
+ boolean used = JBossWSRuntimeManager.isRuntimeUsed(r.getName());
+ String title = JBossWSUIMessages.JBossWS_Runtime_Delete_Confirm_Title;
+ String message = (used) ? NLS.bind(
+ JBossWSUIMessages.JBossWS_Runtime_Delete_Used_Confirm, r
+ .getName()) : NLS.bind(
+ JBossWSUIMessages.JBossWS_Runtime_Delete_Not_Used_Confirm,
+ r.getName());
+ boolean b = MessageDialog.openConfirm(tableView.getControl()
+ .getShell(), title, message);
+ if (b) {
+ if (changed.containsKey(r)) {
+ r = changed.remove(r);
+ }
+ removed.add(r);
+ if (added.contains(r)) {
+ added.remove(r);
+ }
+ ((List) getValue()).remove(r);
+ }
+ if (checkedElement == r) {
+ checkedElement = null;
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -39,7 +39,7 @@
private static final int COLUMNS = 3;
- JBossRuntimeListFieldEditor jbossWSRuntimes = new JBossRuntimeListFieldEditor(
+ JBossWSRuntimeListFieldEditor jbossWSRuntimes = new JBossWSRuntimeListFieldEditor(
"rtlist", JBossWSUIMessages.JBossWS_Preference_Page_Runtimes, new ArrayList<JBossWSRuntime>(Arrays.asList(JBossWSRuntimeManager.getInstance().getRuntimes()))); //$NON-NLS-1$
/**
@@ -77,7 +77,7 @@
jbossWSRuntimes.getRemoved().clear();
JBossWSRuntime defaultRuntime = jbossWSRuntimes
.getDefaultJBossWSRuntime();
-
+
// reset default runtime
for (JBossWSRuntime jbossWSRuntime : JBossWSRuntimeManager
.getInstance().getRuntimes()) {
@@ -87,7 +87,7 @@
if (defaultRuntime != null) {
defaultRuntime.setDefault(true);
}
-
+
jbossWSRuntimes.setDefaultJBossWSRuntime(null);
Map<JBossWSRuntime, JBossWSRuntime> changed = jbossWSRuntimes
.getChangedJBossWSRuntimes();
@@ -129,7 +129,7 @@
return super.performOk();
}
- public JBossRuntimeListFieldEditor getJBossWSRuntimes() {
+ public JBossWSRuntimeListFieldEditor getJBossWSRuntimes() {
return jbossWSRuntimes;
}
}
Copied: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java (from rev 20822, trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/UIUtils.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.utils;
+
+import java.io.File;
+
+/**
+ * @author Grid Qian
+ */
+public class JBossWSUIUtils {
+
+ public static String addAnotherNodeToPath(String currentPath, String newNode) {
+ return currentPath + File.separator + newNode;
+ }
+
+ public static String addNodesToPath(String currentPath, String[] newNode) {
+ String returnPath = currentPath;
+ for (int i = 0; i < newNode.length; i++) {
+ returnPath = returnPath + File.separator + newNode[i];
+ }
+ return returnPath;
+ }
+
+}
\ No newline at end of file
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/UIUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/UIUtils.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/UIUtils.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,523 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.utils;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-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.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-/**
- * @author Grid Qian
- */
-public class UIUtils {
- /**
- * A default padding value for horizontalResize().
- */
- public final static int DEFAULT_PADDING = 35;
-
- String infoPopid_;
-
- public UIUtils(String infoPopid) {
- infoPopid_ = infoPopid;
- }
-
- public Button createRadioButton(Composite parent, String labelName,
- String tooltip, String infopop) {
- return createButton(SWT.RADIO, parent, labelName, tooltip, infopop);
- }
-
- public Button createCheckbox(Composite parent, String labelName,
- String tooltip, String infopop) {
- return createButton(SWT.CHECK, parent, labelName, tooltip, infopop);
- }
-
- public Button createPushButton(Composite parent, String labelName,
- String tooltip, String infopop) {
- return createButton(SWT.NONE, parent, labelName, tooltip, infopop);
- }
-
- public Button createButton(int kind, Composite parent, String labelName,
- String tooltip, String infopop) {
- Button button = new Button(parent, kind);
-
- tooltip = tooltip == null ? labelName : tooltip;
- button.setText(labelName);
- button.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(button,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return button;
- }
-
- public Combo createCombo(Composite parent, String labelName,
- String tooltip, String infopop, int style) {
- tooltip = tooltip == null ? labelName : tooltip;
-
- if (labelName != null) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(labelName);
- label.setToolTipText(tooltip);
- }
-
- Combo combo = new Combo(parent, style);
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
-
- combo.setLayoutData(griddata);
- combo.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return combo;
- }
-
- public Text createText(Composite parent, String labelName, String tooltip,
- String infopop, int style) {
- tooltip = tooltip == null ? labelName : tooltip;
-
- if (labelName != null) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(labelName);
- label.setToolTipText(tooltip);
- }
-
- Text text = new Text(parent, style);
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
-
- text.setLayoutData(griddata);
- text.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(text,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return text;
- }
-
- public Composite createComposite(Composite parent, int columns) {
- return createComposite(parent, columns, -1, -1);
- }
-
- public Composite createComposite(Composite parent, int columns,
- int marginHeight, int marginWidth) {
- Composite composite = new Composite(parent, SWT.NONE);
-
- GridLayout gridlayout = new GridLayout();
- gridlayout.numColumns = columns;
-
- if (marginHeight >= 0)
- gridlayout.marginHeight = marginHeight;
- if (marginWidth >= 0)
- gridlayout.marginWidth = marginWidth;
-
- composite.setLayout(gridlayout);
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- composite.setLayoutData(griddata);
-
- return composite;
-
- }
-
- public Group createGroup(Composite parent, String groupName,
- String tooltip, String infopop) {
- return createGroup(parent, groupName, tooltip, infopop, 1, -1, -1);
- }
-
- public Group createGroup(Composite parent, String groupName,
- String tooltip, String infopop, int columns, int marginHeight,
- int marginWidth) {
- Group newGroup = new Group(parent, SWT.NONE);
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- GridLayout gridlayout = new GridLayout();
-
- gridlayout.numColumns = columns;
-
- if (marginHeight >= 0)
- gridlayout.marginHeight = marginHeight;
- if (marginWidth >= 0)
- gridlayout.marginWidth = marginWidth;
-
- tooltip = tooltip == null ? groupName : tooltip;
- newGroup.setLayout(gridlayout);
- newGroup.setText(groupName);
- newGroup.setLayoutData(griddata);
- newGroup.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(newGroup,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return newGroup;
- }
-
- public Tree createTree(Composite parent, String tooltip, String infopop,
- int style) {
-
- tooltip = tooltip == null ? "" : tooltip; //$NON-NLS-1$
-
- Tree tree = new Tree(parent, style);
-
- tree.setLayoutData(createFillAll());
- tree.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(tree,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return tree;
-
- }
-
- public Table createTable(Composite parent, String tooltip, String infopop,
- int style) {
-
- tooltip = tooltip == null ? "" : tooltip; //$NON-NLS-1$
-
- Table table = new Table(parent, style);
-
- // table.setLayoutData( createFillAll() );
- table.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(table,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return table;
-
- }
-
- public Label createHorizontalSeparator(Composite parent, int spacing) {
- Composite composite = createComposite(parent, 1, spacing, -1);
-
- Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
-
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- separator.setLayoutData(griddata);
-
- return separator;
- }
-
- public GridData createFillAll() {
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL
- | GridData.GRAB_VERTICAL);
- return data;
- }
-
- public void createInfoPop(Control ctrl, String infopop) {
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(ctrl,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
- }
-
- /**
- * Resizes the width of the target composite so that it is as wide as the
- * reference composite plus a padding value.
- *
- * @param target
- * The composite to resize.
- * @param reference
- * The reference composite
- * @param padding
- * The padding value
- */
- public void horizontalResize(Composite target, Composite reference,
- int padding) {
-
- Point originalSize = target.getSize();
- Point referenceSize = reference.getSize();
-
- padding = padding >= 0 ? padding : DEFAULT_PADDING;
-
- if (referenceSize.x + padding > originalSize.x)
- target.setSize(referenceSize.x + padding, originalSize.y);
- }
-
- public static void writePropertyToFile(File file,String key, String value) throws IOException {
- Writer out = new BufferedWriter(new OutputStreamWriter(
- new FileOutputStream(file), "8859_1")); //$NON-NLS-1$
- out.write(key+"="+value+"\n"); //$NON-NLS-1$ //$NON-NLS-2$
- out.close();
- }
-
- // file util
- public static void copyFile(String src, String dest) {
- InputStream is = null;
- FileOutputStream fos = null;
-
- try
- {
- is = new FileInputStream(src);
- fos = new FileOutputStream(dest);
- int c = 0;
- byte[] array = new byte[1024];
- while ((c = is.read(array)) >= 0){
- fos.write(array, 0, c);
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- finally {
- try {
- fos.close();
- is.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- public static File createFileAndParentDirectories(String fileName) throws Exception {
- File file = new File(fileName);
- File parent = file.getParentFile();
- if (!parent.exists()){
- parent.mkdirs();
- }
- file.createNewFile();
- return file;
- }
-
- public static boolean deleteDir(File dir) {
- if (dir.isDirectory()) {
- String[] children = dir.list();
- for (int i=0; i<children.length; i++) {
- boolean success = deleteDir(new File(dir, children[i]));
- if (!success) {
- return false;
- }
- }
- }
- return dir.delete();
- }
-
- public static void deleteDirectories(File dir) {
- File[] children = dir.listFiles();
- for (int i = 0; i < children.length; i++){
- if (children[i].list() != null && children[i].list().length > 0){
- deleteDirectories(children[i]);
- }
- else{
- children[i].delete();
- }
- }
- dir.delete();
- }
-
- public static void deleteDirectories(String dir) {
- File directory = new File(dir);
- deleteDirectories(directory);
- }
-
- public static void createTargetFile(String sourceFileName, String targetFileName)
- throws Exception {
- createTargetFile(sourceFileName, targetFileName, false);
- }
-
- public static void createTargetFile(String sourceFileName, String targetFileName,
- boolean overwrite) throws Exception{
- File idealResultFile = new File(targetFileName);
- if (overwrite || !idealResultFile.exists())
- {
- createFileAndParentDirectories(targetFileName);
- copyFile(sourceFileName, targetFileName);
- }
- }
-
- public static boolean createDirectory(String directory){
- // Create a directory; all ancestor directories must exist
- boolean success = (new File(directory)).mkdir();
- if (!success) {
- // Directory creation failed
- }
- return success;
- }
-
- public static boolean createDirectorys(String directory){
- // Create a directory; all ancestor directories must exist
- boolean success = (new File(directory)).mkdirs();
- if (!success) {
- // Directory creation failed
- }
- return success;
- }
-
- //Copies all files under srcDir to dstDir.
- // If dstDir does not exist, it will be created.
- public static void copyDirectory(File srcDir, File dstDir) throws IOException {
- if (srcDir.isDirectory()) {
- if (!dstDir.exists()) {
- dstDir.mkdir();
- }
-
- String[] children = srcDir.list();
- for (int i=0; i<children.length; i++) {
- copyDirectory(new File(srcDir, children[i]),
- new File(dstDir, children[i]));
- }
- } else {
- copy(srcDir, dstDir);
- }
- }
-
- //Copies src file to dst file.
- // If the dst file does not exist, it is created
- public static void copy(File src, File dst) throws IOException {
- InputStream in = new FileInputStream(src);
- OutputStream out = new FileOutputStream(dst);
-
- // Transfer bytes from in to out
- byte[] buf = new byte[1024];
- int len;
- while ((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
- in.close();
- out.close();
- }
-
- public static String addAnotherNodeToPath(String currentPath, String newNode) {
- return currentPath + File.separator + newNode;
- }
-
- public static String addNodesToPath(String currentPath, String[] newNode) {
- String returnPath=currentPath;
- for (int i = 0; i < newNode.length; i++) {
- returnPath = returnPath + File.separator + newNode[i];
- }
- return returnPath;
- }
-
- public static String addNodesToPath(StringBuffer currentPath, String[] pathNodes) {
- for (int i = 0; i < pathNodes.length; i++){
- currentPath.append(File.separator);
- currentPath.append(pathNodes[i]);
- }
- return currentPath.toString();
- }
-
- public static String addNodesToURL(String currentPath, String[] newNode) {
- String returnPath=currentPath;
- for (int i = 0; i < newNode.length; i++) {
- returnPath = returnPath + "/" + newNode[i]; //$NON-NLS-1$
- }
- return returnPath;
- }
-
- /**
- * Get the list of file with a prefix of <code>fileNamePrefix</code> & an extension of
- * <code>extension</code>
- *
- * @param sourceDir The directory in which to search the files
- * @param fileNamePrefix The prefix to look for
- * @param extension The extension to look for
- * @return The list of file with a prefix of <code>fileNamePrefix</code> & an extension of
- * <code>extension</code>
- */
- public static File[] getMatchingFiles(String sourceDir, String fileNamePrefix, String extension) {
- List<File> fileList = new ArrayList<File>();
- File libDir = new File(sourceDir);
- String libDirPath = libDir.getAbsolutePath();
- String[] items = libDir.list();
- if (items != null) {
- for (int i = 0; i < items.length; i++) {
- String item = items[i];
- if (fileNamePrefix != null && extension != null) {
- if (item.startsWith(fileNamePrefix) && item.endsWith(extension)) {
- fileList.add(new File(libDirPath + File.separator + item));
- }
- } else if (fileNamePrefix == null && extension != null) {
- if (item.endsWith(extension)) {
- fileList.add(new File(libDirPath + File.separator + item));
- }
- } else if (fileNamePrefix != null && extension == null) {
- if (item.startsWith(fileNamePrefix)) {
- fileList.add(new File(libDirPath + File.separator + item));
- }
- } else {
- fileList.add(new File(libDirPath + File.separator + item));
- }
- }
- return (File[]) fileList.toArray(new File[fileList.size()]);
- }
- return new File[0];
- }
-
- /**
- * Filter out files inside a <code>sourceDir</code> with matching <codefileNamePrefix></code>
- * and <code>extension</code>
- * @param sourceDir The directory to filter the files
- * @param fileNamePrefix The filtering filename prefix
- * @param extension The filtering file extension
- */
- public static void filterOutRestrictedFiles(String sourceDir, String fileNamePrefix, String extension){
- File[] resultedMatchingFiles = getMatchingFiles(sourceDir, fileNamePrefix, extension);
- for (int i = 0; i < resultedMatchingFiles.length; i++) {
- File matchingFilePath = new File(resultedMatchingFiles[i].getAbsolutePath());
- matchingFilePath.delete();
- }
- }
-
-
- public static IPath getWebContentRootPath(IProject project) {
- if (project == null)
- return null;
-
- if (!ModuleCoreNature.isFlexibleProject(project))
- return null;
-
- IPath path = null;
- IVirtualComponent component = ComponentCore.createComponent(project);
- if (component != null && component.exists()) {
- path = component.getRootFolder().getWorkspaceRelativePath();
- }
- return path;
- }
-
-}
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -125,17 +125,17 @@
return composite;
}
- private String updateDefaultName () {
+ private String updateDefaultName() {
ServiceModel model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
String currentName = wizard.getClassName();
if (wizard.getProject() == null) {
return currentName;
- }
- else {
+ } else {
boolean isDynamicWebProject = false;
try {
- if (wizard.getProject().getNature("org.eclipse.wst.common.project.facet.core.nature") != null) { //$NON-NLS-1$
+ if (wizard.getProject().getNature(
+ "org.eclipse.wst.common.project.facet.core.nature") != null) { //$NON-NLS-1$
isDynamicWebProject = true;
}
} catch (CoreException e) {
@@ -146,33 +146,35 @@
}
}
String testName = currentName;
- IStatus status = JBossWSGenerateWizardValidator.isWSClassValid(testName, wizard.getProject());
+ IStatus status = JBossWSGenerateWizardValidator.isWSClassValid(
+ testName, wizard.getProject());
int i = 1;
while (status != null) {
testName = currentName + i;
wizard.setClassName(testName);
model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
- status = JBossWSGenerateWizardValidator.isWSClassValid(testName, wizard.getProject());
+ status = JBossWSGenerateWizardValidator.isWSClassValid(testName,
+ wizard.getProject());
i++;
}
return testName;
}
-
+
protected boolean validate() {
ServiceModel model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
- IStatus status = JBossWSGenerateWizardValidator.isWSClassValid(model.getCustomClassName(), wizard.getProject());
+ IStatus status = JBossWSGenerateWizardValidator.isWSClassValid(model
+ .getCustomClassName(), wizard.getProject());
if (status != null) {
setMessage(status.getMessage(), DialogPage.ERROR);
return false;
- }
- else {
+ } else {
setMessage(null);
return true;
}
}
-
+
protected void refresh() {
className.setText(updateDefaultName());
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -53,21 +53,23 @@
public void createControl(Composite parent) {
Composite composite = createDialogArea(parent);
this.wizard = (JBossWSGenerateWizard) this.getWizard();
-
- Group group = new Group (composite, SWT.NONE);
- group.setText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Project_Group);
+
+ Group group = new Group(composite, SWT.NONE);
+ group
+ .setText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Project_Group);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
group.setLayout(new GridLayout(2, false));
group.setLayoutData(gd);
-
+
projects = new Combo(group, SWT.BORDER | SWT.DROP_DOWN);
- projects.setToolTipText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Project_Group_Tooltip);
+ projects
+ .setToolTipText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Project_Group_Tooltip);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
projects.setLayoutData(gd);
refreshProjectList(wizard.getServiceModel().getWebProjectName());
-
+
projects.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
wizard.setProject(projects.getText());
@@ -76,14 +78,15 @@
bHasChanged = true;
setPageComplete(isPageComplete());
}
-
+
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
-
- Group group2 = new Group (composite, SWT.NONE);
- group2.setText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Web_Service_Group);
+
+ Group group2 = new Group(composite, SWT.NONE);
+ group2
+ .setText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Web_Service_Group);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
group2.setLayout(new GridLayout(2, false));
@@ -130,11 +133,11 @@
}
});
-
+
setControl(composite);
}
- private void refreshProjectList ( String projectName ) {
+ private void refreshProjectList(String projectName) {
String[] projectNames = getProjects();
boolean foundInitialProject = false;
projects.removeAll();
@@ -144,10 +147,10 @@
foundInitialProject = true;
}
}
- if (foundInitialProject)
+ if (foundInitialProject)
projects.setText(projectName);
}
-
+
public IWizardPage getNextPage() {
wizard.setServiceName(name.getText());
return super.getNextPage();
@@ -171,14 +174,16 @@
public boolean isPageComplete() {
return validate();
}
-
- private String updateDefaultName () {
+
+ private String updateDefaultName() {
ServiceModel model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
String currentName = wizard.getServiceName();
IStatus status = JBossWSGenerateWizardValidator.isWSNameValid();
try {
- if (status.getSeverity() == IStatus.ERROR && !JavaEEProjectUtilities.isDynamicWebProject(wizard.getProject())) {
+ if (status.getSeverity() == IStatus.ERROR
+ && !JavaEEProjectUtilities.isDynamicWebProject(wizard
+ .getProject())) {
return currentName;
}
} catch (NullPointerException npe) {
@@ -196,7 +201,7 @@
}
return testName;
}
-
+
private boolean validate() {
ServiceModel model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
@@ -207,25 +212,26 @@
if (status != null) {
setErrorMessage(status.getMessage());
return false;
- }
- else {
+ } else {
setErrorMessage(null);
return true;
}
}
-
+
private String[] getProjects() {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
+ .getProjects();
ArrayList<String> dynamicProjects = new ArrayList<String>();
for (int i = 0; i < projects.length; i++) {
- boolean isDynamicWebProject = JavaEEProjectUtilities.isDynamicWebProject(projects[i]);
+ boolean isDynamicWebProject = JavaEEProjectUtilities
+ .isDynamicWebProject(projects[i]);
if (isDynamicWebProject) {
dynamicProjects.add(projects[i].getName());
}
}
return dynamicProjects.toArray(new String[dynamicProjects.size()]);
}
-
+
protected boolean hasChanged() {
return bHasChanged;
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -29,9 +29,9 @@
import org.jboss.tools.ws.creation.core.commands.MergeWebXMLCommand;
import org.jboss.tools.ws.creation.core.commands.ServiceSampleCreationCommand;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
import org.jboss.tools.ws.ui.JBossWSUIPlugin;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-import org.jboss.tools.ws.ui.utils.UIUtils;
public class JBossWSGenerateWizard extends Wizard implements INewWizard {
@@ -82,7 +82,7 @@
model.setUpdateWebxml(true);
model.setCustomPackage(getPackageName());
- File file = findFileByPath(getClassName() + JAVA, project
+ File file = JBossWSCreationUtils.findFileByPath(getClassName() + JAVA, project
.getLocation().toOSString());
if (file != null) {
MessageDialog
@@ -138,7 +138,7 @@
if (project != null
&& JavaEEProjectUtilities.isDynamicWebProject(project)) {
webFile = project.getParent().getFolder(
- UIUtils.getWebContentRootPath(project).append(WEBINF))
+ JBossWSCreationUtils.getWebContentRootPath(project).append(WEBINF))
.getFile(WEB);
}
hasInited = true;
@@ -165,25 +165,6 @@
return super.canFinish();
}
- private File findFileByPath(String name, String path) {
- File ret = null;
- File folder = new File(path);
- if (folder.isDirectory()) {
- File[] files = folder.listFiles();
- for (File file : files) {
- ret = findFileByPath(name, file.getAbsolutePath());
- if (ret != null) {
- break;
- }
- }
- } else {
- if (name.equals(folder.getName())) {
- ret = folder;
- }
- }
- return ret;
- }
-
public String getServiceName() {
return serviceName;
}
@@ -261,7 +242,7 @@
if (project != null
&& JavaEEProjectUtilities.isDynamicWebProject(project)) {
webFile = project.getParent().getFolder(
- UIUtils.getWebContentRootPath(project).append(WEBINF))
+ JBossWSCreationUtils.getWebContentRootPath(project).append(WEBINF))
.getFile(WEB);
}
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -23,59 +23,61 @@
import org.eclipse.jst.javaee.web.WebApp;
import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.data.ServletDescriptor;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
public class JBossWSGenerateWizardValidator {
-
+
private static ServiceModel model;
private static ServletDescriptor[] descriptors;
-
+
private static String JAVA = ".java"; //$NON-NLS-1$
- public static void setServiceModel ( ServiceModel inModel ) {
+ public static void setServiceModel(ServiceModel inModel) {
model = inModel;
descriptors = new ServletDescriptor[model.getServiceClasses().size()];
- List<String> serviceClasses = model.getServiceClasses();
- for (int i = 0; i < serviceClasses.size(); i++) {
- descriptors[i] = getServletDescriptor(serviceClasses.get(i));
- }
+ List<String> serviceClasses = model.getServiceClasses();
+ for (int i = 0; i < serviceClasses.size(); i++) {
+ descriptors[i] = getServletDescriptor(serviceClasses.get(i));
+ }
}
public static IStatus isWSNameValid() {
if (model.getWebProjectName() == null) {
- return StatusUtils.errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
- }
- else {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
+ } else {
try {
- ModelProviderManager
- .getModelProvider(JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName()));
+ ModelProviderManager.getModelProvider(JBossWSCreationUtils
+ .getProjectByName(model.getWebProjectName()));
} catch (IllegalArgumentException iae) {
- // ignore
model.setWebProjectName(null);
- return StatusUtils.errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
}
}
final IModelProvider provider = ModelProviderManager
- .getModelProvider(JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName()));
+ .getModelProvider(JBossWSCreationUtils.getProjectByName(model
+ .getWebProjectName()));
Object object = provider.getModelObject();
if (object instanceof WebApp) {
WebApp webApp = (WebApp) object;
if (model != null) {
for (int i = 0; i < descriptors.length; i++) {
- if (descriptors[i].getName().trim().length() == 0 ) {
- return StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ServiceName_Empty);
+ if (descriptors[i].getName().trim().length() == 0) {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ServiceName_Empty);
}
List<?> theServlets = webApp.getServlets();
for (int j = 0; j < theServlets.size(); j++) {
- Servlet aServlet = (Servlet) theServlets
- .get(j);
- if (aServlet.getServletName().equals(descriptors[i].getName())) {
- return StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
+ Servlet aServlet = (Servlet) theServlets.get(j);
+ if (aServlet.getServletName().equals(
+ descriptors[i].getName())) {
+ return StatusUtils
+ .errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
}
}
List<?> theServletMappings = webApp.getServletMappings();
@@ -84,10 +86,14 @@
.get(j);
List<?> urlPatterns = aServletMapping.getUrlPatterns();
for (int k = 0; k < urlPatterns.size(); k++) {
- UrlPatternType upt = (UrlPatternType) urlPatterns.get(k);
- if (aServletMapping.getServletName().equals(descriptors[i].getName()) ||
- upt.getValue().equals(descriptors[i].getMappings())) {
- return StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
+ UrlPatternType upt = (UrlPatternType) urlPatterns
+ .get(k);
+ if (aServletMapping.getServletName().equals(
+ descriptors[i].getName())
+ || upt.getValue().equals(
+ descriptors[i].getMappings())) {
+ return StatusUtils
+ .errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
}
}
}
@@ -97,25 +103,26 @@
}
return null;
}
-
+
public static IStatus isWSClassValid(String className, IProject project) {
if (model.getCustomPackage().trim().length() == 0) {
// empty package name
- return StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
- }
- else if (model.getCustomClassName().trim().length() == 0 ) {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ } else if (model.getCustomClassName().trim().length() == 0) {
// empty class name
- return StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
- }
- else if (project == null) {
- return StatusUtils.errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
- }
- else {
- File file = findFileByPath(className + JAVA, project
- .getLocation().toOSString());
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ } else if (project == null) {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
+ } else {
+ File file = JBossWSCreationUtils.findFileByPath(className + JAVA,
+ project.getLocation().toOSString());
if (file != null) {
// class already exists
- return StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
}
}
return null;
@@ -134,26 +141,9 @@
sd.setName(servletName);
sd.setDisplayName(sd.getName());
sd.setClassName(clsName);
- sd.setMappings(JBossWSCreationCoreMessages.Separator_Java + sd.getDisplayName());
+ sd.setMappings(JBossWSCreationCoreMessages.Separator_Java
+ + sd.getDisplayName());
return sd;
}
- private static File findFileByPath(String name, String path) {
- File ret = null;
- File folder = new File(path);
- if (folder.isDirectory()) {
- File[] files = folder.listFiles();
- for (File file : files) {
- ret = findFileByPath(name, file.getAbsolutePath());
- if (ret != null) {
- break;
- }
- }
- } else {
- if (name.equals(folder.getName())) {
- ret = folder;
- }
- }
- return ret;
- }
}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.ws.ui.wizards;
-
-public class ServletDescriptor {
- private String _name;
- private String _className;
- private String _displayName;
- private String _mappings;
-
- public ServletDescriptor() {
- }
-
- public String getName() {
- return _name;
- }
-
- public void setName(String name) {
- _name = name;
- }
-
- public String getClassName() {
- return _className;
- }
-
- public void setClassName(String className) {
- _className = className;
- }
-
- public String getDisplayName() {
- return _displayName;
- }
-
- public void setDisplayName(String displayName) {
- _displayName = displayName;
- }
-
- public String getMappings() {
- return _mappings;
- }
-
- public void setMappings(String mappings) {
- _mappings = mappings;
- }
-
-}
\ No newline at end of file
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -65,6 +65,7 @@
import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
+@SuppressWarnings("restriction")
public abstract class AbstractJBossWSCommandTest extends TestCase {
public static final IVMInstall VM_INSTALL = JavaRuntime
.getDefaultVMInstall();
@@ -417,13 +418,13 @@
}
protected class ServerStateListener implements IServerListener {
- private ArrayList stateChanges;
+ private ArrayList<Integer> stateChanges;
public ServerStateListener() {
- this.stateChanges = new ArrayList();
+ this.stateChanges = new ArrayList<Integer>();
}
- public ArrayList getStateChanges() {
+ public ArrayList<Integer> getStateChanges() {
return stateChanges;
}
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSClientCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSClientCommandTest.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSClientCommandTest.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -24,8 +24,6 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
@@ -34,7 +32,7 @@
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeClassPathInitializer.JBossWSRuntimeClasspathContainer;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
import org.jboss.tools.ws.core.facet.delegate.JBossWSFacetInstallDataModelProvider;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.commands.ClientSampleCreationCommand;
import org.jboss.tools.ws.creation.core.commands.InitialClientCommand;
import org.jboss.tools.ws.creation.core.commands.RemoveClientJarsCommand;
@@ -45,9 +43,9 @@
/**
* @author Grid Qian
*/
+@SuppressWarnings("restriction")
public class JBossWSClientCommandTest extends AbstractJBossWSCommandTest {
- protected static final String JBOSSWS_HOME_DEFAULT = "/home/grid/Software/jboss-4.2.2.GA";
private static final String RuntimeName;
private static final boolean isDeployed;
@@ -159,7 +157,7 @@
}
}
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
}
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -59,11 +59,11 @@
/**
* @author Grid Qian
*/
+@SuppressWarnings("restriction")
public class JBossWSJavaFirstCommandTest extends AbstractJBossWSCommandTest {
protected static final IWorkspace ws = ResourcesPlugin.getWorkspace();
protected static final IWorkbench wb = PlatformUI.getWorkbench();
- protected static final String JBOSSWS_HOME_DEFAULT = "D:\\softinstall\\jboss-4.2.3GA\\jboss-4.2.3.GA";
private static final String RuntimeName;
private static final boolean isDeployed;
private IProject clientProject;
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSTopDownCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSTopDownCommandTest.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSTopDownCommandTest.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -49,6 +49,7 @@
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.ui.wsrt.JBossWebService;
+@SuppressWarnings("restriction")
public class JBossWSTopDownCommandTest extends AbstractJBossWSCommandTest {
protected static final IWorkspace ws = ResourcesPlugin.getWorkspace();
protected static final IWorkbench wb = PlatformUI.getWorkbench();
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.test/src/org/jboss/tools/ws/ui/test/preferences/JBossWSRuntimePreferencePageTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.test/src/org/jboss/tools/ws/ui/test/preferences/JBossWSRuntimePreferencePageTest.java 2010-03-26 05:52:52 UTC (rev 21047)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.test/src/org/jboss/tools/ws/ui/test/preferences/JBossWSRuntimePreferencePageTest.java 2010-03-26 07:00:22 UTC (rev 21048)
@@ -24,7 +24,7 @@
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeListConverter;
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
import org.jboss.tools.ws.core.messages.JBossWSCoreMessages;
-import org.jboss.tools.ws.ui.preferences.JBossRuntimeListFieldEditor;
+import org.jboss.tools.ws.ui.preferences.JBossWSRuntimeListFieldEditor;
import org.jboss.tools.ws.ui.preferences.JBossWSRuntimePreferencePage;
import junit.framework.TestCase;
@@ -69,7 +69,7 @@
Object object = openPreferencepage(prefDialog);
String runtime = getRuntimeList();
selectedPage = (JBossWSRuntimePreferencePage) object;
- JBossRuntimeListFieldEditor jbossWSRuntimes = selectedPage
+ JBossWSRuntimeListFieldEditor jbossWSRuntimes = selectedPage
.getJBossWSRuntimes();
if (runtime.equals("")) {
assertTrue(
@@ -104,7 +104,7 @@
Object object = openPreferencepage(prefDialog);
String runtime = getRuntimeList();
selectedPage = (JBossWSRuntimePreferencePage) object;
- JBossRuntimeListFieldEditor jbossWSRuntimes = selectedPage
+ JBossWSRuntimeListFieldEditor jbossWSRuntimes = selectedPage
.getJBossWSRuntimes();
assertTrue("The preference store for jboss ws runtime is wrong",
!runtime.equals(""));
14 years, 9 months
JBoss Tools SVN: r21047 - trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2010-03-26 01:52:52 -0400 (Fri, 26 Mar 2010)
New Revision: 21047
Added:
trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectAllTests.java
Log:
JBIDE-5572 : Add unit tests for ESB
Added: trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectAllTests.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectAllTests.java (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectAllTests.java 2010-03-26 05:52:52 UTC (rev 21047)
@@ -0,0 +1,15 @@
+
+package org.jboss.tools.esb.project.core.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class ESBProjectAllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test ESB Project Core");
+ suite.addTestSuite(ESBProjectDeploymentTest.class);
+ return suite;
+ }
+
+}
14 years, 9 months
JBoss Tools SVN: r21046 - trunk/documentation/guides/Beginners_Guide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2010-03-25 21:42:27 -0400 (Thu, 25 Mar 2010)
New Revision: 21046
Modified:
trunk/documentation/guides/Beginners_Guide/en-US/Feedback.xml
Log:
updated
Modified: trunk/documentation/guides/Beginners_Guide/en-US/Feedback.xml
===================================================================
--- trunk/documentation/guides/Beginners_Guide/en-US/Feedback.xml 2010-03-26 01:41:49 UTC (rev 21045)
+++ trunk/documentation/guides/Beginners_Guide/en-US/Feedback.xml 2010-03-26 01:42:27 UTC (rev 21046)
@@ -7,10 +7,10 @@
<secondary>contact information for this manual</secondary>
</indexterm>
<para>
- If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in JIRA against JBoss Developer Studio: <ulink url="https://jira.jboss.org/jira/browse/JBDS">https://jira.jboss.org/jira/browse/JBDS</ulink>
+ If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in JIRA against JBoss Developer Studio: <ulink url="https://jira.jboss.org/jira/secure/CreateIssue.jspa?pid=12310500&issu...">https://jira.jboss.org/jira/secure/CreateIssue.jspa?pid=12310500&issu...</ulink>
</para>
<para>
- When submitting a bug report, be sure to mention the manual's name.
+ When submitting a bug report, be sure to mention the manual's name and to select the "documentation" component.
</para>
<para>
If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.
14 years, 9 months