JBoss Tools SVN: r9751 - workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-08-16 04:36:34 -0400 (Sat, 16 Aug 2008)
New Revision: 9751
Added:
workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XSDStructuredDataWizardPage.java
Removed:
workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java
Log:
change the name of java file
Modified: workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java 2008-08-16 08:32:29 UTC (rev 9750)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java 2008-08-16 08:36:34 UTC (rev 9751)
@@ -18,7 +18,7 @@
*/
public class XMLStructuredDataWizard extends Wizard implements
IStrucutredDataCreationWizard {
- XMLStructuredDataWizardPage page = null;
+ XSDStructuredDataWizardPage page = null;
Object xsdElement = null;
/**
*
@@ -30,7 +30,7 @@
@Override
public void addPages() {
if(page == null){
- page = new XMLStructuredDataWizardPage("XML");
+ page = new XSDStructuredDataWizardPage("XML");
}
this.addPage(page);
}
@@ -42,7 +42,7 @@
*/
@Override
public boolean performFinish() {
- xsdElement = this.page.getReturnRootElementDec();
+ xsdElement = this.page.getReturnValue();
return true;
}
Deleted: workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java 2008-08-16 08:32:29 UTC (rev 9750)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java 2008-08-16 08:36:34 UTC (rev 9751)
@@ -1,387 +0,0 @@
-/**
- *
- */
-package org.jboss.tools.smooks.xml.ui;
-
-import java.io.IOException;
-import java.util.Collections;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDResourceFactoryImpl;
-import org.jboss.tools.smooks.xml.model.XMLStructuredModelContentProvider;
-import org.jboss.tools.smooks.xml.model.XMLStructuredModelLabelProvider;
-
-/**
- *
- * @author Dart Peng Date : 2008-8-13
- */
-public class XMLStructuredDataWizardPage extends WizardPage implements
- SelectionListener {
-
- private Text xmlFileText;
- private Text xsdFileText;
- private Button xmlButton;
- private Button xsdButton;
- private Composite fileTextComposite;
- private Composite xsdfileTextComposite;
- private CheckboxTableViewer tableViewer = null;
- private Button xsdFileSystemBrowseButton;
- protected Button xmlFileSystemBrowseButton;
-
- public XMLStructuredDataWizardPage(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- // TODO Auto-generated constructor stub
- }
-
- public XMLStructuredDataWizardPage(String pageName) {
- super(pageName);
- // TODO Auto-generated constructor stub
- }
-
- public Object getReturnRootElementDec(){
- return this.tableViewer.getInput();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl(Composite parent) {
-
- Composite mainComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- mainComposite.setLayout(layout);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- mainComposite.setLayoutData(gd);
-
- xmlButton = new Button(mainComposite, SWT.RADIO);
- xmlButton.setText("Select a XML file");
-
- Composite xmlComposite = this
- .createXMLFileSelectionComposite(mainComposite);
-
- Label sp = new Label(mainComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- sp.setLayoutData(gd);
-
- xsdButton = new Button(mainComposite, SWT.RADIO);
- xsdButton.setText("Select a XSD file");
-
- Composite xsdComposite = this
- .createXSDFileSelectionComposite(mainComposite);
-
- // init the panel status (XSD file selection composite is disabled)
- xsdButton.setSelection(true);
-
- setCompositeChildrenEnabled(xmlComposite, false);
-
- // registe the listener for controls
- hookBrowseButtonSelectionAdapter();
- hookFileTextModifyListener();
- hookRadioButtonSelectionAdapter();
- this.setControl(mainComposite);
- }
-
- protected Composite createXMLFileSelectionComposite(Composite parent) {
- Composite xmlComposite = new Composite(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- xmlComposite.setLayoutData(gd);
- GridLayout xmlLayout = new GridLayout();
- xmlLayout.numColumns = 2;
- xmlLayout.marginWidth = 0;
- xmlComposite.setLayout(xmlLayout);
-
- Composite browseXMLComposite = new Composite(xmlComposite, SWT.NONE);
-
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- browseXMLComposite.setLayoutData(gd);
-
- GridLayout bg1 = new GridLayout();
- bg1.numColumns = 2;
- bg1.marginHeight = 0;
- bg1.marginWidth = 0;
- bg1.makeColumnsEqualWidth = false;
- browseXMLComposite.setLayout(bg1);
-
- xmlFileSystemBrowseButton = new Button(browseXMLComposite, SWT.NONE);
- xmlFileSystemBrowseButton.setText("Browse File System...");
-
- final Button xmlWorkspaceBrowseButton = new Button(browseXMLComposite,
- SWT.NONE);
- xmlWorkspaceBrowseButton.setText("Browse workspace file..");
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment = GridData.END;
- gd.grabExcessHorizontalSpace = true;
- xmlWorkspaceBrowseButton.setLayoutData(gd);
-
- gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- xmlFileSystemBrowseButton.setLayoutData(gd);
-
- Label fileLanel = new Label(xmlComposite, SWT.NONE);
- fileLanel.setText("XML File Path :");
- fileTextComposite = new Composite(xmlComposite, SWT.NONE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.grabExcessHorizontalSpace = true;
- fileTextComposite.setLayoutData(gd);
- GridLayout tgl = new GridLayout();
- tgl.marginWidth = 0;
- tgl.marginHeight = 0;
- tgl.numColumns = 2;
- fileTextComposite.setLayout(tgl);
-
- xmlFileText = new Text(fileTextComposite, SWT.BORDER);
-
- gd = new GridData(GridData.FILL_HORIZONTAL);
- xmlFileText.setLayoutData(gd);
- gd.grabExcessHorizontalSpace = true;
-
- return xmlComposite;
- }
-
- protected void hookFileTextModifyListener() {
- final ModifyListener modifyListener = new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- changeWizardPageStatus();
- }
- };
- xmlFileText.addModifyListener(modifyListener);
- xsdFileText.addModifyListener(modifyListener);
- }
-
- protected void hookRadioButtonSelectionAdapter() {
- xmlButton.addSelectionListener(this);
- xsdButton.addSelectionListener(this);
- }
-
- protected void hookBrowseButtonSelectionAdapter() {
- SelectionAdapter browseButtonSelectionAdapter = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- Text relationT = null;
- if (e.getSource() == xmlFileSystemBrowseButton) {
- relationT = xmlFileText;
- }
- if (e.getSource() == xsdFileSystemBrowseButton) {
- relationT = xsdFileText;
- }
- openFileSelection(relationT);
- }
- };
- xmlFileSystemBrowseButton
- .addSelectionListener(browseButtonSelectionAdapter);
- xsdFileSystemBrowseButton
- .addSelectionListener(browseButtonSelectionAdapter);
- }
-
- protected Composite createXSDFileSelectionComposite(Composite parent) {
- Composite xsdComposite = new Composite(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- xsdComposite.setLayoutData(gd);
- GridLayout xsdLayout = new GridLayout();
- xsdLayout.numColumns = 2;
- xsdLayout.marginWidth = 0;
- xsdComposite.setLayout(xsdLayout);
-
- Composite browseButtonComposite = new Composite(xsdComposite, SWT.NONE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- browseButtonComposite.setLayoutData(gd);
-
- GridLayout bg = new GridLayout();
- bg.numColumns = 2;
- bg.marginHeight = 0;
- bg.marginWidth = 0;
- bg.makeColumnsEqualWidth = false;
- browseButtonComposite.setLayout(bg);
-
- xsdFileSystemBrowseButton = new Button(browseButtonComposite, SWT.NONE);
- xsdFileSystemBrowseButton.setText("Browse File System...");
-
- final Button xsdWorkspaceBrowseButton = new Button(
- browseButtonComposite, SWT.NONE);
- xsdWorkspaceBrowseButton.setText("Browse workspace file..");
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment = GridData.END;
- gd.grabExcessHorizontalSpace = true;
- xsdWorkspaceBrowseButton.setLayoutData(gd);
-
- gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- xsdFileSystemBrowseButton.setLayoutData(gd);
-
- Label nfileLanel = new Label(xsdComposite, SWT.NONE);
- nfileLanel.setText("XSD File Path :");
- xsdfileTextComposite = new Composite(xsdComposite, SWT.NONE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.grabExcessHorizontalSpace = true;
- xsdfileTextComposite.setLayoutData(gd);
- GridLayout xsdtgl = new GridLayout();
- xsdtgl.marginWidth = 0;
- xsdtgl.marginHeight = 0;
- xsdtgl.numColumns = 2;
- xsdfileTextComposite.setLayout(xsdtgl);
-
- xsdFileText = new Text(xsdfileTextComposite, SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- xsdFileText.setLayoutData(gd);
- gd.grabExcessHorizontalSpace = true;
-
- final Button loadXSDButton = new Button(xsdfileTextComposite, SWT.NONE);
- loadXSDButton.setText("Load");
- loadXSDButton.addSelectionListener(new SelectionAdapter(){
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- Resource resource = new XSDResourceFactoryImpl().createResource(URI
- .createFileURI(xsdFileText.getText()));
- try {
- resource.load(Collections.EMPTY_MAP);
- XSDSchema schema = (XSDSchema) resource.getContents().get(0);
- tableViewer.setInput(schema);
- changeWizardPageStatus();
- } catch (IOException e1) {
- //ignore
- }
- }
-
- });
-
- tableViewer = CheckboxTableViewer.newCheckList(xsdComposite,
- SWT.FULL_SELECTION | SWT.BORDER);
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 200;
- gd.horizontalSpan = 2;
- tableViewer.getControl().setLayoutData(gd);
-
- initTableViewer();
-
- return xsdComposite;
- }
-
- protected void initTableViewer() {
- tableViewer.addCheckStateListener(new ICheckStateListener() {
- boolean flag = true;
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (flag) {
- Object checkObject = event.getElement();
- boolean check = event.getChecked();
- flag = false;
- tableViewer.setAllChecked(false);
- tableViewer.setChecked(checkObject, check);
- flag = true;
- changeWizardPageStatus();
- }
- }
- });
- tableViewer.setContentProvider(new XMLStructuredModelContentProvider());
- tableViewer.setLabelProvider(new XMLStructuredModelLabelProvider());
- }
-
- protected void setCompositeChildrenEnabled(Composite composite,
- boolean enabled) {
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- Control child = children[i];
- if (child instanceof Text) {
- child.setEnabled(enabled);
- }
- if (child instanceof Button) {
- child.setEnabled(enabled);
- }
- if (child instanceof Composite) {
- setCompositeChildrenEnabled((Composite) child, enabled);
- }
- }
- }
-
- protected void openFileSelection(Text relationText) {
- FileDialog dialog = new FileDialog(this.getShell());
- String path = dialog.open();
- if (path != null) {
- relationText.setText(path);
- } else {
- relationText.setText("");
- }
- }
-
- protected void changeWizardPageStatus() {
- String text = null;
- if (xmlButton.getSelection()) {
- text = xmlFileText.getText();
- }
- if (xsdButton.getSelection()) {
- text = xsdFileText.getText();
- }
- String error = null;
- if (text == null || "".equals(text))
- error = "Please Select a file";
- if (xsdButton.getSelection()) {
- if (this.tableViewer.getCheckedElements() == null)
- error = "please select one root element";
- else {
- if (this.tableViewer.getCheckedElements().length == 0) {
- error = "please select one root element";
- }
- }
- }
- this.setErrorMessage(error);
- this.setPageComplete(error == null);
-
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setCompositeChildrenEnabled(fileTextComposite.getParent(), xmlButton
- .getSelection());
- setCompositeChildrenEnabled(xsdfileTextComposite.getParent(), xsdButton
- .getSelection());
- changeWizardPageStatus();
- }
-
- public CheckboxTableViewer getTableViewer() {
- return tableViewer;
- }
-
- public void setTableViewer(CheckboxTableViewer tableViewer) {
- this.tableViewer = tableViewer;
- }
-
-}
Copied: workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XSDStructuredDataWizardPage.java (from rev 9749, workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java)
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XSDStructuredDataWizardPage.java (rev 0)
+++ workspace/dart/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XSDStructuredDataWizardPage.java 2008-08-16 08:36:34 UTC (rev 9751)
@@ -0,0 +1,317 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.xml.ui;
+
+import java.util.Collections;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDResourceFactoryImpl;
+import org.jboss.tools.smooks.xml.model.XMLStructuredModelContentProvider;
+import org.jboss.tools.smooks.xml.model.XMLStructuredModelLabelProvider;
+
+/**
+ *
+ * @author Dart Peng Date : 2008-8-13
+ */
+public class XSDStructuredDataWizardPage extends WizardPage implements
+ SelectionListener {
+
+ protected Object returnObject = null;
+ protected Text fileText;
+ protected Composite fileTextComposite;
+ protected CheckboxTableViewer tableViewer = null;
+ protected Button fileSystemBrowseButton;
+ protected boolean reasourceLoaded = false;
+ private Button workspaceBrowseButton;
+
+ public XSDStructuredDataWizardPage(String pageName, String title,
+ ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ // TODO Auto-generated constructor stub
+ }
+
+ public XSDStructuredDataWizardPage(String pageName) {
+ super(pageName);
+ // TODO Auto-generated constructor stub
+ }
+
+ public Object getReturnValue() {
+ return returnObject;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+
+ Composite mainComposite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ mainComposite.setLayout(layout);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.grabExcessHorizontalSpace = true;
+ gd.grabExcessVerticalSpace = true;
+ mainComposite.setLayoutData(gd);
+
+ // xmlButton = new Button(mainComposite, SWT.RADIO);
+ // xmlButton.setText("Select a XML file");
+ //
+ // Composite xmlComposite = this
+ // .createXMLFileSelectionComposite(mainComposite);
+ //
+ // Label sp = new Label(mainComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // sp.setLayoutData(gd);
+ //
+ // xsdButton = new Button(mainComposite, SWT.RADIO);
+ // xsdButton.setText("Select a XSD file");
+
+ Composite xsdComposite = this
+ .createFileSelectionComposite(mainComposite);
+
+ // init the panel status (XSD file selection composite is disabled)
+ // xsdButton.setSelection(true);
+ //
+ // setCompositeChildrenEnabled(xmlComposite, false);
+
+ // registe the listener for controls
+ hookBrowseButtonSelectionAdapter();
+ hookFileTextModifyListener();
+ hookRadioButtonSelectionAdapter();
+ this.setControl(mainComposite);
+ }
+
+ protected void hookFileTextModifyListener() {
+ final ModifyListener modifyListener = new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ changeWizardPageStatus();
+ }
+ };
+ // xmlFileText.addModifyListener(modifyListener);
+ fileText.addModifyListener(modifyListener);
+ }
+
+ protected void hookRadioButtonSelectionAdapter() {
+ // xsdButton.addSelectionListener(this);
+ }
+
+ protected void hookBrowseButtonSelectionAdapter() {
+ SelectionAdapter browseButtonSelectionAdapter = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Text relationT = null;
+ // if (e.getSource() == xmlFileSystemBrowseButton) {
+ // relationT = xmlFileText;
+ // }
+ if (e.getSource() == fileSystemBrowseButton) {
+ relationT = fileText;
+ }
+ openFileSelection(relationT);
+ }
+ };
+ // xmlFileSystemBrowseButton
+ // .addSelectionListener(browseButtonSelectionAdapter);
+ fileSystemBrowseButton
+ .addSelectionListener(browseButtonSelectionAdapter);
+ }
+
+ protected Composite createFileSelectionComposite(Composite parent) {
+ Composite xsdComposite = new Composite(parent, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ xsdComposite.setLayoutData(gd);
+ GridLayout xsdLayout = new GridLayout();
+ xsdLayout.numColumns = 2;
+ xsdLayout.marginWidth = 0;
+ xsdComposite.setLayout(xsdLayout);
+
+ Composite browseButtonComposite = new Composite(xsdComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ browseButtonComposite.setLayoutData(gd);
+
+ GridLayout bg = new GridLayout();
+ bg.numColumns = 2;
+ bg.marginHeight = 0;
+ bg.marginWidth = 0;
+ bg.makeColumnsEqualWidth = false;
+ browseButtonComposite.setLayout(bg);
+
+ fileSystemBrowseButton = new Button(browseButtonComposite, SWT.NONE);
+ fileSystemBrowseButton.setText("Browse File System...");
+
+ workspaceBrowseButton = new Button(
+ browseButtonComposite, SWT.NONE);
+ workspaceBrowseButton.setText("Browse workspace file..");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.END;
+ gd.grabExcessHorizontalSpace = true;
+ workspaceBrowseButton.setLayoutData(gd);
+
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = true;
+ fileSystemBrowseButton.setLayoutData(gd);
+
+ Label nfileLanel = new Label(xsdComposite, SWT.NONE);
+ nfileLanel.setText("XSD File Path :");
+ fileTextComposite = new Composite(xsdComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.grabExcessHorizontalSpace = true;
+ fileTextComposite.setLayoutData(gd);
+ GridLayout xsdtgl = new GridLayout();
+ xsdtgl.marginWidth = 0;
+ xsdtgl.marginHeight = 0;
+ xsdtgl.numColumns = 1;
+ fileTextComposite.setLayout(xsdtgl);
+
+ fileText = new Text(fileTextComposite, SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fileText.setLayoutData(gd);
+ gd.grabExcessHorizontalSpace = true;
+
+ final Button loadXSDButton = new Button(fileTextComposite, SWT.NONE);
+ loadXSDButton.setText("Load");
+ loadXSDButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ reasourceLoaded = false;
+ try {
+ returnObject = loadedTheObject(fileText.getText());
+ reasourceLoaded = true;
+ } catch (Throwable e2) {
+ // ignore
+ e2.printStackTrace();
+ }
+ changeWizardPageStatus();
+ }
+
+ });
+
+ // tableViewer = CheckboxTableViewer.newCheckList(xsdComposite,
+ // SWT.FULL_SELECTION | SWT.BORDER);
+ // gd = new GridData(GridData.FILL_BOTH);
+ // gd.heightHint = 200;
+ // gd.horizontalSpan = 2;
+ // tableViewer.getControl().setLayoutData(gd);
+ //
+ // initTableViewer();
+
+ return xsdComposite;
+ }
+
+ protected Object loadedTheObject(String path) throws Exception {
+ Resource resource = new XSDResourceFactoryImpl().createResource(URI
+ .createFileURI(path));
+ resource.load(Collections.EMPTY_MAP);
+ XSDSchema schema = (XSDSchema) resource.getContents().get(0);
+ return schema;
+ }
+
+ protected void initTableViewer() {
+ tableViewer.addCheckStateListener(new ICheckStateListener() {
+ boolean flag = true;
+
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (flag) {
+ Object checkObject = event.getElement();
+ boolean check = event.getChecked();
+ flag = false;
+ tableViewer.setAllChecked(false);
+ tableViewer.setChecked(checkObject, check);
+ flag = true;
+ changeWizardPageStatus();
+ }
+ }
+ });
+ tableViewer.setContentProvider(new XMLStructuredModelContentProvider());
+ tableViewer.setLabelProvider(new XMLStructuredModelLabelProvider());
+ }
+
+ protected void setCompositeChildrenEnabled(Composite composite,
+ boolean enabled) {
+ Control[] children = composite.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if (child instanceof Text) {
+ child.setEnabled(enabled);
+ }
+ if (child instanceof Button) {
+ child.setEnabled(enabled);
+ }
+ if (child instanceof Composite) {
+ setCompositeChildrenEnabled((Composite) child, enabled);
+ }
+ }
+ }
+
+ protected void openFileSelection(Text relationText) {
+ FileDialog dialog = new FileDialog(this.getShell());
+ String path = dialog.open();
+ if (path != null) {
+ relationText.setText(path);
+ } else {
+ relationText.setText("");
+ }
+ }
+
+ protected void changeWizardPageStatus() {
+ String text = this.fileText.getText();
+ String error = null;
+ if (text == null || "".equals(text))
+ error = "Please Select a file";
+ if (!reasourceLoaded) {
+ error = "Resource must be loaded";
+ }
+ this.setErrorMessage(error);
+ this.setPageComplete(error == null);
+
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ changeWizardPageStatus();
+ }
+
+ public CheckboxTableViewer getTableViewer() {
+ return tableViewer;
+ }
+
+ public void setTableViewer(CheckboxTableViewer tableViewer) {
+ this.tableViewer = tableViewer;
+ }
+
+}
17 years, 8 months
JBoss Tools SVN: r9750 - workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-08-16 04:32:29 -0400 (Sat, 16 Aug 2008)
New Revision: 9750
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/BaseViewerInitor.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/ViewerInitorStore.java
Log:
Fix a bug -- the wizard and wizard page instance IS NOT STATELESS
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/BaseViewerInitor.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/BaseViewerInitor.java 2008-08-16 00:01:00 UTC (rev 9749)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/BaseViewerInitor.java 2008-08-16 08:32:29 UTC (rev 9750)
@@ -10,20 +10,21 @@
******************************************************************************/
package org.jboss.tools.smooks.ui;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.jboss.tools.smooks.utils.UIUtils;
/**
* @author Dart Peng
* @Date Aug 6, 2008
*/
public class BaseViewerInitor implements IViewerInitor {
- protected ILabelProvider labelProvider = null;
- protected ITreeContentProvider treeContentProvider = null;
- protected IStrucutredDataCreationWizard structuredDataLoadWizard = null;
protected String typeID = null;
protected String name = "nonamed";
protected String wizardIconPath = null;
+ IConfigurationElement configurationElement = null;
/**
* @return the name
@@ -44,32 +45,33 @@
* @return the treeContentProvider
*/
public ITreeContentProvider getTreeContentProvider() {
- return treeContentProvider;
+ try {
+ return (ITreeContentProvider) configurationElement
+ .createExecutableExtension(UIUtils.EXTENTION_POINT_ATTRIBUTE_CONTENT_PROVIDER);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ return null;
+ }
}
/**
* @param treeContentProvider
* the treeContentProvider to set
*/
- public void setTreeContentProvider(ITreeContentProvider treeContentProvider) {
- this.treeContentProvider = treeContentProvider;
- }
/**
* @return the structuredDataLoadWizard
*/
public IStrucutredDataCreationWizard getStructuredDataLoadWizard() {
- return structuredDataLoadWizard;
+ try {
+ return ((IStrucutredDataCreationWizard) configurationElement
+ .createExecutableExtension(UIUtils.EXTENTION_POINT_ATTRIBUTE_CREATION_WIZARD));
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return null;
}
- /**
- * @param structuredDataLoadWizard
- * the structuredDataLoadWizard to set
- */
- public void setStructuredDataLoadWizard(
- IStrucutredDataCreationWizard structuredDataLoadWizard) {
- this.structuredDataLoadWizard = structuredDataLoadWizard;
- }
/**
* @return the typeID
@@ -90,16 +92,17 @@
* @return the labelProvider
*/
public ILabelProvider getLabelProvider() {
- return labelProvider;
+ try {
+ return (ILabelProvider) configurationElement
+ .createExecutableExtension(UIUtils.EXTENTION_POINT_ATTRIBUTE_LABEL_PROVIDER);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
}
- /**
- * @param labelProvider
- * the labelProvider to set
- */
- public void setLabelProvider(ILabelProvider labelProvider) {
- this.labelProvider = labelProvider;
- }
/**
* @return the wizardIconPath
@@ -115,4 +118,13 @@
public void setWizardIconPath(String wizardIconPath) {
this.wizardIconPath = wizardIconPath;
}
+
+ public IConfigurationElement getConfigurationElement() {
+ return configurationElement;
+ }
+
+ public void setConfigurationElement(
+ IConfigurationElement configurationElement) {
+ this.configurationElement = configurationElement;
+ }
}
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/ViewerInitorStore.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/ViewerInitorStore.java 2008-08-16 00:01:00 UTC (rev 9749)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/ViewerInitorStore.java 2008-08-16 08:32:29 UTC (rev 9750)
@@ -89,40 +89,37 @@
return initorMap;
}
- protected ILabelProvider createLabelProvider(BaseViewerInitor initor,
- IConfigurationElement element) {
- try {
- initor
- .setLabelProvider((ILabelProvider) element
- .createExecutableExtension(UIUtils.EXTENTION_POINT_ATTRIBUTE_LABEL_PROVIDER));
- } catch (CoreException e) {
- // ignore
- }
- return initor.getLabelProvider();
- }
+// protected ILabelProvider createLabelProvider(BaseViewerInitor initor,
+// IConfigurationElement element) {
+// try {
+// initor
+// .setLabelProvider();
+// } catch (CoreException e) {
+// // ignore
+// }
+// return initor.getLabelProvider();
+// }
+//
+// protected ILabelProvider createTreeContentProvider(BaseViewerInitor initor,
+// IConfigurationElement element) {
+// try {
+// initor
+// .setTreeContentProvider();
+// } catch (CoreException e) {// ignore
+// }
+// return initor.getLabelProvider();
+// }
+//
+// protected ILabelProvider createCreationWizard(BaseViewerInitor initor,
+// IConfigurationElement element) {
+// try {
+// initor
+// .setStructuredDataLoadWizard);
+// } catch (CoreException e) {// ignore
+// }
+// return initor.getLabelProvider();
+// }
- protected ILabelProvider createTreeContentProvider(BaseViewerInitor initor,
- IConfigurationElement element) {
- try {
- initor
- .setTreeContentProvider((ITreeContentProvider) element
- .createExecutableExtension(UIUtils.EXTENTION_POINT_ATTRIBUTE_CONTENT_PROVIDER));
- } catch (CoreException e) {// ignore
- }
- return initor.getLabelProvider();
- }
-
- protected ILabelProvider createCreationWizard(BaseViewerInitor initor,
- IConfigurationElement element) {
- try {
- initor
- .setStructuredDataLoadWizard((IStrucutredDataCreationWizard) element
- .createExecutableExtension(UIUtils.EXTENTION_POINT_ATTRIBUTE_CREATION_WIZARD));
- } catch (CoreException e) {// ignore
- }
- return initor.getLabelProvider();
- }
-
protected HashMap<String, IViewerInitor> createNewInitorMap() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint ep = registry
@@ -151,12 +148,7 @@
initor.setTypeID(typeID);
- createLabelProvider(initor, element);
-
- createTreeContentProvider(initor, element);
-
- createCreationWizard(initor, element);
-
+ initor.setConfigurationElement(element);
map.put(typeID, initor);
}
if (!map.isEmpty()) {
17 years, 8 months
JBoss Tools SVN: r9749 - tags/jbosstools-3.0.0.Alpha1.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-08-15 20:01:00 -0400 (Fri, 15 Aug 2008)
New Revision: 9749
Added:
tags/jbosstools-3.0.0.Alpha1/core/
Log:
now tagging
Copied: tags/jbosstools-3.0.0.Alpha1/core (from rev 9748, trunk/core)
17 years, 8 months
JBoss Tools SVN: r9747 - tags/jbosstools-3.0.0.Alpha1/core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-08-15 19:57:46 -0400 (Fri, 15 Aug 2008)
New Revision: 9747
Added:
tags/jbosstools-3.0.0.Alpha1/core/core/
Log:
retagging for release
Copied: tags/jbosstools-3.0.0.Alpha1/core/core (from rev 9746, trunk/core)
17 years, 8 months
JBoss Tools SVN: r9746 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.ui: src/main/org/jboss/ide/eclipse/archives/ui/providers and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-08-15 19:11:06 -0400 (Fri, 15 Aug 2008)
New Revision: 9746
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java
Log:
/JBIDE-2618
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-08-15 22:39:02 UTC (rev 9745)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-08-15 23:11:06 UTC (rev 9746)
@@ -171,9 +171,12 @@
<instanceof
value="org.jboss.ide.eclipse.archives.core.model.IArchiveNode">
</instanceof>
- <count
- value="0">
- </count>
+ <adapt
+ type="java.util.Collection">
+ <count
+ value="0">
+ </count>
+ </adapt>
</or>
</enablement>
</actionProvider>
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java 2008-08-15 22:39:02 UTC (rev 9745)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java 2008-08-15 23:11:06 UTC (rev 9746)
@@ -38,6 +38,7 @@
import org.jboss.ide.eclipse.archives.ui.NodeContribution;
import org.jboss.ide.eclipse.archives.ui.actions.NewArchiveAction;
import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.WrappedProject;
+import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesCommonView;
import org.jboss.ide.eclipse.archives.ui.wizards.FilesetWizard;
import org.jboss.ide.eclipse.archives.ui.wizards.NewJARWizard;
@@ -111,7 +112,7 @@
manager.add(deleteAction);
addContextMenuContributions(node, manager);
}
- } else {
+ } else if( ProjectArchivesCommonView.getInstance().getCurrentProject() != null ){
manager.add(newPackageManager);
}
}
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java 2008-08-15 22:39:02 UTC (rev 9745)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java 2008-08-15 23:11:06 UTC (rev 9746)
@@ -16,6 +16,8 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelListener;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
+import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesCommonView;
public class ArchivesContentProviderDelegate implements ITreeContentProvider, IArchiveModelListener {
@@ -96,7 +98,9 @@
Iterator<Viewer> it = viewersInUse.iterator();
while(it.hasNext()) {
Viewer next = ((Viewer)it.next());
- if( next instanceof StructuredViewer)
+ if( shouldRefreshProject(next))
+ ((StructuredViewer)next).refresh(dp.project);
+ else if( next instanceof StructuredViewer)
((StructuredViewer)next).refresh(dp.wProject);
else
next.refresh();
@@ -109,6 +113,13 @@
job.schedule();
}
+ protected boolean shouldRefreshProject(Viewer viewer) {
+ if( viewer == ProjectArchivesCommonView.getInstance().getCommonViewer() &&
+ !PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_PROJECT_ROOT))
+ return true;
+ return false;
+ }
+
public Object getParent(Object element) {
return null;
}
@@ -118,6 +129,10 @@
return getChildren(element).length > 0;
if( element instanceof IResource )
return ArchivesModel.instance().canReregister(((IResource)element).getLocation());
+ if( element == ArchivesRootContentProvider.NO_PROJECT)
+ return false;
+ if( element instanceof DelayProxy)
+ return false;
return true;
}
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2008-08-15 22:39:02 UTC (rev 9745)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2008-08-15 23:11:06 UTC (rev 9746)
@@ -77,6 +77,8 @@
}
private String internalGetText(Object element) {
+ if( element == ArchivesRootContentProvider.NO_PROJECT)
+ return "Please select a project";
if( element instanceof WrappedProject ) {
switch(((WrappedProject)element).getType()) {
case WrappedProject.NAME:
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java 2008-08-15 22:39:02 UTC (rev 9745)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java 2008-08-15 23:11:06 UTC (rev 9746)
@@ -11,6 +11,8 @@
import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesCommonView;
public class ArchivesRootContentProvider implements ITreeContentProvider {
+ public static final Object NO_PROJECT = new Object();
+
private ArchivesContentProviderDelegate delegate;
public ArchivesRootContentProvider() {
delegate = ArchivesContentProviderDelegate.getDefault();
@@ -29,6 +31,7 @@
}
public Object[] getElements(Object inputElement) {
+ IProject cp = ProjectArchivesCommonView.getInstance().getCurrentProject();
if( showProjectRoot() ) {
if( showAllProjects() ) {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
@@ -39,11 +42,12 @@
}
return wrap((IProject[]) tmp.toArray(new IProject[tmp.size()]));
}
- IProject cp = ProjectArchivesCommonView.getInstance().getCurrentProject();
if( cp != null )
return wrap(new IProject[]{cp});
+ } else if( cp != null ){
+ return getChildren(new WrappedProject(cp, WrappedProject.NAME));
}
- return new Object[]{};
+ return new Object[]{NO_PROJECT};
}
protected Object[] wrap(IProject[] objs) {
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java 2008-08-15 22:39:02 UTC (rev 9745)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java 2008-08-15 23:11:06 UTC (rev 9746)
@@ -20,6 +20,8 @@
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.ui.PackagesUIPlugin;
+import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.WrappedProject;
+import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesCommonView;
import org.jboss.ide.eclipse.archives.ui.wizards.pages.ArchiveInfoWizardPage;
public abstract class AbstractArchiveWizard extends WizardWithNotification implements INewWizard {
@@ -123,10 +125,17 @@
project = ((IContainer)selected).getProject();
initialDestinationPath = ((IContainer)selected).getFullPath().toString();
isPathWorkspaceRelative = true;
- } else if( project != null ){
+ } else if(selected instanceof WrappedProject) {
+ project = ((WrappedProject)selected).getElement();
initialDestinationPath = project.getFullPath().toString();
isPathWorkspaceRelative = true;
- }
+ } else {
+ project = ProjectArchivesCommonView.getInstance().getCurrentProject();
+ if( project != null ) {
+ initialDestinationPath = project.getFullPath().toString();
+ isPathWorkspaceRelative = true;
+ }
+ }
setNeedsProgressMonitor(true);
}
17 years, 8 months
JBoss Tools SVN: r9745 - tags/jbosstools-3.0.0.Alpha1.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-08-15 18:39:02 -0400 (Fri, 15 Aug 2008)
New Revision: 9745
Added:
tags/jbosstools-3.0.0.Alpha1/hibernatetools/
Log:
retag hibernatetools component
Copied: tags/jbosstools-3.0.0.Alpha1/hibernatetools (from rev 9744, trunk/hibernatetools)
17 years, 8 months
JBoss Tools SVN: r9743 - in trunk/seam/plugins/org.jboss.tools.seam.pages.xml: resources/meta and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-08-15 10:32:45 -0400 (Fri, 15 Aug 2008)
New Revision: 9743
Added:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/CreateVirtualHandler.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
Log:
JBIDE-2612
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-08-15 14:32:29 UTC (rev 9742)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-08-15 14:32:45 UTC (rev 9743)
@@ -77,6 +77,8 @@
class="org.jboss.tools.seam.pages.xml.model.handlers.DeletePageItemHandler"/>
<xclass id="org.jboss.tools.seam.pages.xml.model.handlers.GoToNodeNandler"
class="org.jboss.tools.seam.pages.xml.model.handlers.GoToNodeNandler"/>
+ <xclass id="org.jboss.tools.seam.pages.xml.model.handlers.CreateVirtualHandler"
+ class="org.jboss.tools.seam.pages.xml.model.handlers.CreateVirtualHandler"/>
<xclass id="org.jboss.tools.seam.pages.xml.model.handlers.AddViewSupport"
class="org.jboss.tools.seam.pages.xml.model.handlers.AddViewSupport"/>
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-08-15 14:32:29 UTC (rev 9742)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-08-15 14:32:45 UTC (rev 9743)
@@ -3144,17 +3144,14 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
- <XModelEntity
- ImplementingClass=""
- XMLSUBPATH="" name="SeamPagesDiagramItemOutputVirtual_ActionList">
+ <XModelEntity name="SeamPagesDiagramItemOutputVirtual_ActionList">
<XChildrenEntities/>
<XEntityRenderer>
<ICONS>
<ICON info="main.jsf.process-item-output" type="main"/>
</ICONS>
</XEntityRenderer>
- <XModelAttributes>
- </XModelAttributes>
+ <XModelAttributes/>
<XActionItem kind="list">
<XActionItem
HandlerClassName="org.jboss.tools.jsf.model.handlers.AutolayoutTransitionHandler"
@@ -3181,6 +3178,46 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
+ <XModelEntity name="SeamPagesDiagramItemVirtual_ActionList">
+ <XChildrenEntities/>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.seam-pages.page" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes/>
+ <XActionItem kind="list">
+ <XActionItem ICON="action.empty" displayName="New" kind="list" name="CreateActions">
+ <XActionItem
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.CreateVirtualHandler"
+ ICON="action.new.jsf.case" displayName="Create This Element..."
+ kind="action" name="Create"/>
+ </XActionItem>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.OpenPageHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open"
+ displayName="Open Page" kind="action" name="OpenPage"/>
+ <XActionItem kind="list" name="EditActions">
+ <XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
+ PROPERTIES="support=org.jboss.tools.seam.pages.xml.model.handlers.RenameViewSupport"
+ displayName="Rename..." kind="action" name="Rename">
+ <EntityData EntityName="SeamPageRename">
+ <AttributeData AttributeName="view id" Mandatory="no"/>
+ <AttributeData AttributeName="rename file" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
+ <XActionItem HIDE="always"
+ HandlerClassName="org.jboss.tools.jsf.model.handlers.HiddenLinksHandler"
+ ICON="action.empty" displayName="Show/Hide Links" kind="action" name="Links"/>
+ <XActionItem HIDE="disabled"
+ HandlerClassName="org.jboss.tools.seam.pages.xml.model.handlers.GoToNodeNandler"
+ ICON="action.empty"
+ PROPERTIES="help=SeamItem_SelectNode;wizard=org.jboss.tools.seam.ui.pages.editor.wizard.SelectItemWizard"
+ displayName="Go To Node" kind="action" name="GoTo"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
<XEntityExtension name="FileFolder">
<XChildrenEntities>
<XChildEntity name="FileSeamPages12"/>
Added: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/CreateVirtualHandler.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/CreateVirtualHandler.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/CreateVirtualHandler.java 2008-08-15 14:32:45 UTC (rev 9743)
@@ -0,0 +1,32 @@
+package org.jboss.tools.seam.pages.xml.model.handlers;
+
+import java.util.Properties;
+
+import org.jboss.tools.common.meta.action.impl.AbstractHandler;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesDiagramStructureHelper;
+
+public class CreateVirtualHandler extends AbstractHandler {
+
+ public CreateVirtualHandler() {}
+
+ public boolean isEnabled(XModelObject object) {
+ return object != null && object.isActive();
+ }
+
+ public void executeHandler(XModelObject object, Properties prop) throws XModelException {
+ XModelObject f = SeamPagesDiagramStructureHelper.getInstance().getParentFile(object);
+ if(f == null) return;
+ XModelObject pages = f.getChildByPath(SeamPagesConstants.FOLDER_PAGES);
+ if(pages == null) return;
+ String path = object.getAttributeValue(SeamPagesConstants.ATTR_PATH);
+ //TODO handle EL case
+ XModelObject page = AddViewSupport.addPage(pages, path);
+ if(page != null) {
+ page.setModified(true);
+ }
+ }
+
+}
17 years, 8 months
JBoss Tools SVN: r9742 - trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-08-15 10:32:29 -0400 (Fri, 15 Aug 2008)
New Revision: 9742
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java
Log:
JBIDE-2612
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java 2008-08-15 13:05:47 UTC (rev 9741)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesContextMenuProvider.java 2008-08-15 14:32:29 UTC (rev 9742)
@@ -70,10 +70,14 @@
XModelObject object = SelectionUtil.getTarget(ss.getFirstElement());
if(object != null) {
String entityName = object.getModelEntity().getName();
- if(object.getModelEntity().getName().equals(SeamPagesConstants.ENT_DIAGRAM_ITEM_OUTPUT)
+ if(entityName.equals(SeamPagesConstants.ENT_DIAGRAM_ITEM_OUTPUT)
&& object instanceof ReferenceObject && ((ReferenceObject)object).getReference() == null) {
entityName = "SeamPagesDiagramItemOutputVirtual_ActionList";
}
+ else if(entityName.equals(SeamPagesConstants.ENT_DIAGRAM_ITEM)
+ && object instanceof ReferenceObject && ((ReferenceObject)object).getReference() == null) {
+ entityName = "SeamPagesDiagramItemVirtual_ActionList";
+ }
PagesDiagramEditPart part = (PagesDiagramEditPart)getViewer().getRootEditPart().getChildren().get(0);
Properties p = new Properties();
if(lastDownEvent != null) {
17 years, 8 months