Author: scabanovich
Date: 2011-03-25 14:39:23 -0400 (Fri, 25 Mar 2011)
New Revision: 30044
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/META-INF/MANIFEST.MF
Log:
JBIDE-8629
https://issues.jboss.org/browse/JBIDE-8629
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/META-INF/MANIFEST.MF 2011-03-25
18:38:12 UTC (rev 30043)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/META-INF/MANIFEST.MF 2011-03-25
18:39:23 UTC (rev 30044)
@@ -4,14 +4,17 @@
Bundle-Name: %pluginName
Bundle-Activator: org.jboss.tools.vpe.ui.palette.PalettePlugin
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.jboss.tools.vpe.ui.palette
+Bundle-SymbolicName: org.jboss.tools.vpe.ui.palette;singleton:=true
Bundle-Localization: plugin
-Export-Package: org.jboss.tools.vpe.ui.palette,org.jboss.tools.vpe.ui.palette.model
+Export-Package: org.jboss.tools.vpe.ui.palette,
+ org.jboss.tools.vpe.ui.palette.model,
+ org.jboss.tools.vpe.ui.palette.wizard
Require-Bundle: org.eclipse.ui.ide,
org.eclipse.jface.text,
org.eclipse.ui,
org.eclipse.gef,
org.jboss.tools.common.model.ui,
- org.jboss.tools.jst.jsp
+ org.jboss.tools.jst.web,
+ org.jboss.tools.jst.jsp
Bundle-Version: 3.2.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Added: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml
(rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml 2011-03-25 18:39:23 UTC
(rev 30044)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension point="org.jboss.tools.common.model.classes">
+ <xclass id="org.jboss.tools.vpe.ui.palette.wizard.ImportTLDPage"
+ class="org.jboss.tools.vpe.ui.palette.wizard.ImportTLDPage"/>
+ </extension>
+</plugin>
+
\ No newline at end of file
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/plugin.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java 2011-03-25
18:39:23 UTC (rev 30044)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.vpe.ui.palette.wizard;
+
+import java.beans.PropertyChangeEvent;
+
+import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
+import org.jboss.tools.common.model.ui.wizards.special.SpecialWizardStep;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.jst.web.tld.URIConstants;
+import org.jboss.tools.jst.web.tld.model.handlers.ImportTLDToPaletteSupport;
+
+public class ImportTLDPage extends SpecialWizardStep {
+ protected ParentGroupComponent parentGroupComponent = new ParentGroupComponent();
+ protected Composite stepControl2;
+ ImportTLDToPaletteSupport importSupport;
+
+ public ImportTLDPage() {
+ parentGroupComponent.setListener(this);
+ }
+
+ public void setSupport(SpecialWizardSupport support, int i) {
+ super.setSupport(support, i);
+ importSupport = (ImportTLDToPaletteSupport)support;
+ parentGroupComponent.setItems((String[])support.getProperties().get("groups"));
//$NON-NLS-1$
+ parentGroupComponent.setInitialItem(support.getProperties().getProperty("parent
group")); //$NON-NLS-1$
+ }
+
+ public Control createControl(Composite parent) {
+ stepControl2 = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ stepControl2.setLayout(layout);
+ stepControl2.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ stepControl = attributes.createControl(stepControl2);
+ stepControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ String focusAttr = support.getFocusAttribute(id);
+ if(focusAttr != null && attributes.getFieldEditorByName(focusAttr) != null) {
+ attributes.getFieldEditorByName(focusAttr).setFocus();
+ }
+
+ Control pgc = parentGroupComponent.createControl(stepControl2);
+ pgc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ updateFieldEnablement();
+
+ return stepControl2;
+ }
+
+ public void updateFieldEnablement() {
+ super.updateFieldEnablement();
+ parentGroupComponent.updateFieldEnablement();
+ }
+
+ boolean isAdjusting = false;
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if(isAdjusting) return;
+ isAdjusting = true;
+ isDataChanged = true;
+ attributes.store();
+ parentGroupComponent.store(support.getProperties());
+ validate();
+ if(event != null && event.getSource() ==
attributes.getPropertyEditorAdapterByName("tld")) { //$NON-NLS-1$
+// String path = (String)event.getNewValue();
+ boolean locked =
((DefaultValueAdapter)attributes.getPropertyEditorAdapterByName("tld")).isStoreLocked();
//$NON-NLS-1$
+ if(!locked) {
+ importSupport.onPathModified();
+ String[] as = {"name", URIConstants.DEFAULT_PREFIX,
URIConstants.LIBRARY_URI}; //$NON-NLS-1$
+ for (int i = 0; i < as.length; i++)
+ attributes.getPropertyEditorAdapterByName(as[i]).setValue(support.getAttributeValue(0,
as[i]));
+ validate();
+ }
+ }
+ updateFieldEnablement();
+ isAdjusting = false;
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ImportTLDPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java 2011-03-25
18:39:23 UTC (rev 30044)
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.vpe.ui.palette.wizard;
+
+import java.util.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
+
+public class ParentGroupComponent {
+ Composite composite;
+ Button addToExisting;
+ CCombo existingGroup;
+ Button createNewGroup;
+ Text newGroup;
+ ImportTLDPage listener;
+ String[] items = new String[0];
+ String initialItem = null;
+ boolean isAdjusting = false;
+
+ public void setListener(ImportTLDPage listener) {
+ this.listener = listener;
+ }
+
+ public void setItems(String[] items) {
+ this.items = items;
+ if(existingGroup != null && !existingGroup.isDisposed()) {
+ existingGroup.setItems(items);
+ }
+ }
+
+ public void setInitialItem(String item) {
+ initialItem = item;
+ if(initialItem != null && existingGroup != null &&
!existingGroup.isDisposed()) {
+ existingGroup.setText(item);
+ }
+ }
+
+ public Control createControl(Composite parent) {
+ Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 5;
+ group.setLayout(layout);
+ Composite c = new Composite(group, SWT.NONE);
+ layout = new GridLayout(2, false);
+ c.setLayout(layout);
+ c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ addToExisting = new Button(c, SWT.RADIO);
+ GridData gd = new GridData();
+ addToExisting.setText(WebUIMessages.ADD_TO_EXISTING_GROUP);
+ addToExisting.setLayoutData(gd);
+ addToExisting.setSelection(true);
+ addToExisting.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ isAdjusting = true;
+ createNewGroup.setSelection(!addToExisting.getSelection());
+ isAdjusting = false;
+ fire();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ existingGroup = new CCombo(c, SWT.READ_ONLY | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ existingGroup.setLayoutData(gd);
+ existingGroup.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
+ existingGroup.setItems(items);
+ if(initialItem != null) existingGroup.setText(initialItem);
+ existingGroup.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ fire();
+ }
+ });
+
+ createNewGroup = new Button(c, SWT.RADIO);
+ createNewGroup.setText(WebUIMessages.CREATE_NEW_GROUP);
+ gd = new GridData();
+ createNewGroup.setLayoutData(gd);
+ createNewGroup.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ isAdjusting = true;
+ addToExisting.setSelection(!createNewGroup.getSelection());
+ isAdjusting = false;
+ fire();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ newGroup = new Text(c, SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ newGroup.setLayoutData(gd);
+ newGroup.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ fire();
+ }
+ });
+ composite = group;
+ return composite;
+ }
+
+ protected void fire() {
+ if(!isAdjusting && listener != null) listener.propertyChange(null);
+ }
+
+ public void updateFieldEnablement() {
+ if(addToExisting == null || addToExisting.isDisposed()) return;
+ boolean existing = addToExisting.getSelection();
+ newGroup.setEnabled(!existing);
+ existingGroup.setEnabled(existing);
+ }
+
+ public void store(Properties p) {
+ p.setProperty("parent group", getValue()); //$NON-NLS-1$
+ }
+
+ public String getValue() {
+ if(addToExisting == null || addToExisting.isDisposed()) return "";
//$NON-NLS-1$
+ boolean existing = addToExisting.getSelection();
+ String s = (existing) ? existingGroup.getText() : newGroup.getText();
+ return (s == null) ? "" : s; //$NON-NLS-1$
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/wizard/ParentGroupComponent.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain