[jbosstools-commits] JBoss Tools SVN: r44051 - in trunk/common/plugins/org.jboss.tools.common.ui: icons and 3 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 26 13:16:06 EDT 2012


Author: scabanovich
Date: 2012-09-26 13:16:06 -0400 (Wed, 26 Sep 2012)
New Revision: 44051

Added:
   trunk/common/plugins/org.jboss.tools.common.ui/icons/service.png
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java
Modified:
   trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties
Log:
JBIDE-9443
https://issues.jboss.org/browse/JBIDE-9443
New Service Provider wizard.


Added: trunk/common/plugins/org.jboss.tools.common.ui/icons/service.png
===================================================================
(Binary files differ)


Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/icons/service.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml	2012-09-26 16:52:52 UTC (rev 44050)
+++ trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml	2012-09-26 17:16:06 UTC (rev 44051)
@@ -51,4 +51,23 @@
          label="Base Java Hover">
    </hover>
 </extension>
+
+   <extension point="org.eclipse.ui.newWizards">
+     <wizard 
+         category="org.eclipse.jdt.ui.java" 
+         class="org.jboss.tools.common.ui.wizard.service.NewServiceCreationWizard" 
+         icon="platform:/plugin/org.jboss.tools.common.ui/icons/service.png"
+         id="org.jboss.tools.common.ui.wizard.service.NewServiceCreationWizard" 
+         name="Service Provider" 
+         project="false">
+         <description>
+            Create a Service Provider Type
+         </description>
+         <!--keywordReference
+               id="xxx">
+         </keywordReference-->
+      </wizard>
+   
+   </extension>
+
 </plugin>

Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java	2012-09-26 16:52:52 UTC (rev 44050)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java	2012-09-26 17:16:06 UTC (rev 44051)
@@ -83,6 +83,16 @@
 	public static String ADD_SUPPRESS_WARNINGS_PROJECT;
 	public static String ADD_SUPPRESS_WARNINGS_WORKSPACE;
 	public static String ADD_SUPPRESS_WARNINGS_DISABLE;
+	
+	public static String NEW_SERVICE_WIZARD_TITLE;
+	public static String NEW_SERVICE_WIZARD_INTERFACES_LABEL;
+	public static String NEW_SERVICE_WIZARD_DESCRIPTION;
+	public static String NEW_SERVICE_WIZARD_PAGE_NAME;
+	public static String NEW_SERVICE_WIZARD_SERVICE_TYPE_EMPTY;
+	public static String NEW_SERVICE_WIZARD_SERVICE_TYPE_NOT_EXISTS;
+	public static String NEW_SERVICE_WIZARD_SERVICE_TYPE_FINAL;
+	public static String NEW_SERVICE_WIZARD_SERVICE_TYPE_CONCRETE;
+	public static String NEW_SERVICE_WIZARD_SELECT_SERVICE_TYPE_TITLE;
 
 	static {
 		NLS.initializeMessages(BUNDLE_NAME, CommonUIMessages.class);

Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties	2012-09-26 16:52:52 UTC (rev 44050)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties	2012-09-26 17:16:06 UTC (rev 44051)
@@ -41,4 +41,15 @@
 ADD_SUPPRESS_WARNINGS_CANCEL=Cancel
 ADD_SUPPRESS_WARNINGS_PROJECT=Project
 ADD_SUPPRESS_WARNINGS_WORKSPACE=Workspace
-ADD_SUPPRESS_WARNINGS_DISABLE=Disable
\ No newline at end of file
+ADD_SUPPRESS_WARNINGS_DISABLE=Disable
+
+NEW_SERVICE_WIZARD_TITLE=New Service Provider Class
+NEW_SERVICE_WIZARD_INTERFACES_LABEL=Service Type:
+NEW_SERVICE_WIZARD_DESCRIPTION=Create a new Service Provider Java class.
+NEW_SERVICE_WIZARD_PAGE_NAME=Service Provider Type
+NEW_SERVICE_WIZARD_SERVICE_TYPE_EMPTY=Please select service type.
+NEW_SERVICE_WIZARD_SERVICE_TYPE_NOT_EXISTS=Type {0} does not exist.
+NEW_SERVICE_WIZARD_SERVICE_TYPE_FINAL=Service type cannot be final.
+NEW_SERVICE_WIZARD_SERVICE_TYPE_CONCRETE=Non-abstract service type is discouraged.
+NEW_SERVICE_WIZARD_SELECT_SERVICE_TYPE_TITLE=Select Service Type
+

Added: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java	2012-09-26 17:16:06 UTC (rev 44051)
@@ -0,0 +1,144 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 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.common.ui.wizard.service;
+
+import java.io.ByteArrayInputStream;
+
+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.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.internal.ui.wizards.NewElementWizard;
+import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
+import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
+import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.ui.CommonUIMessages;
+import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.util.FileUtil;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class NewServiceCreationWizard extends NewElementWizard {
+	protected NewTypeWizardPage fPage;
+
+	public NewServiceCreationWizard() {
+		setWindowTitle(CommonUIMessages.NEW_SERVICE_WIZARD_TITLE);
+	}
+
+	/*
+	 * @see Wizard#createPages
+	 */
+	public void addPages() {
+		super.addPages();
+		if (fPage == null) {
+			fPage = new  NewServiceWizardPage();
+			((NewClassWizardPage)fPage).init(getSelection());
+			//init page
+		}
+		addPage(fPage);
+	}
+
+	/*(non-Javadoc)
+	 * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#canRunForked()
+	 */
+	protected boolean canRunForked() {
+		return !fPage.isEnclosingTypeSelected();
+	}
+
+	public boolean performFinish() {
+		boolean res = super.performFinish();
+		if(res && ((NewServiceWizardPage)fPage).isToBeRegisteredInMetaInf()) {
+			try {
+				registerService();
+			} catch (CoreException e) {
+				CommonUIPlugin.getDefault().logError(e);
+			}
+		}
+		if (res) {
+			IResource resource= fPage.getModifiedResource();
+			if (resource != null) {
+				selectAndReveal(resource);
+				openResource((IFile) resource);
+			}
+		}
+		return res;
+	}
+
+	private void registerService() throws CoreException {
+		String typeName = fPage.getCreatedType().getFullyQualifiedName();
+		String serviceType = ((NewServiceWizardPage)fPage).getServiceRawType();
+		IContainer f = getServiceFolder();
+		if(f != null) {
+			IFile file = f.getFile(new Path(serviceType));
+			if(file.exists()) {
+				String content = FileUtil.readStream(file);
+				if(content.length() > 0 && !content.endsWith("\n")) { //$NON-NLS-1$
+					content += "\n"; //$NON-NLS-1$
+				}
+				content += typeName;
+				file.setContents(new ByteArrayInputStream(content.getBytes()), true, true, new NullProgressMonitor());
+			} else {
+				String content = typeName;
+				file.create(new ByteArrayInputStream(content.getBytes()), true, new NullProgressMonitor());
+			}	
+		}
+	}
+
+	static final String META_INF_FOLDER_NAME = "META-INF"; //$NON-NLS-1$
+	static final String SERVICES_FOLDER_NAME = "services"; //$NON-NLS-1$
+
+	private IFolder getServiceFolder() throws CoreException {
+		IContainer m = getMetaInf();
+		if(m != null) {
+			IFolder ss = m.getFolder(new Path(SERVICES_FOLDER_NAME));
+			if(!ss.exists()) {
+				ss.create(true, true, new NullProgressMonitor());
+			}
+			return ss;
+		}
+		return null;
+	}
+
+	private IContainer getMetaInf() throws CoreException {
+		IProject project = fPage.getCreatedType().getResource().getProject();
+		IResource[] rs = EclipseUtil.getJavaSourceRoots(project);
+		if(rs == null || rs.length == 0) {
+			return null;
+		}
+		for (IResource r: rs) {
+			IFolder f = ((IContainer)r).getFolder(new Path(META_INF_FOLDER_NAME));
+			if(f.exists()) return f;
+		}
+		IFolder f = ((IContainer)rs[0]).getFolder(new Path(META_INF_FOLDER_NAME));
+		f.create(true, true, new NullProgressMonitor());
+		return f;
+	}
+
+	@Override
+	protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
+		fPage.createType(monitor); // use the full progress monitor
+	}
+
+	@Override
+	public IJavaElement getCreatedElement() {
+		return fPage.getCreatedType();
+	}
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java	2012-09-26 17:16:06 UTC (rev 44051)
@@ -0,0 +1,345 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 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.common.ui.wizard.service;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
+import org.eclipse.jdt.internal.ui.dialogs.OpenTypeSelectionDialog;
+import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogFieldGroup;
+import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
+import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.ui.CommonUIMessages;
+import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.ui.IValidator;
+import org.jboss.tools.common.ui.widget.editor.ButtonFieldEditor.ButtonPressedAction;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.SwtFieldEditorFactory;
+import org.jboss.tools.common.util.EclipseJavaUtil;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ * 
+ */
+public class NewServiceWizardPage extends NewClassWizardPage {
+	String defaultTypeName = null;
+
+	protected StatusInfo interfaceNameStatus = new StatusInfo();
+
+	IFieldEditor interfaceField;
+
+	public NewServiceWizardPage() {
+		setTitle(CommonUIMessages.NEW_SERVICE_WIZARD_PAGE_NAME);
+		setDescription(CommonUIMessages.NEW_SERVICE_WIZARD_DESCRIPTION);
+//		setImageDescriptor(CDIImages.getImageDescriptor(CDIImages.CDI_CLASS_IMAGE));
+	}
+
+	public void init(IStructuredSelection selection) {
+		super.init(selection);
+		defaultTypeName = null;
+		if (selection != null && !selection.isEmpty()) {
+			Object o = selection.iterator().next();
+			IType type = null;
+			if (o instanceof IType) {
+				type = (IType) o;
+			} else if (o instanceof ICompilationUnit) {
+				ICompilationUnit cu = (ICompilationUnit) o;
+				try {
+					IType[] ts = cu.getTypes();
+					if (ts != null && ts.length > 0)
+						type = ts[0];
+				} catch (JavaModelException e) {
+					CommonUIPlugin.getDefault().logError(e);
+				}
+
+			}
+			boolean isInterface = false;
+			try {
+				isInterface = type != null && type.isInterface();
+			} catch (JavaModelException e) {
+				CommonUIPlugin.getDefault().logError(e);
+			}
+			if (isInterface) {
+				ArrayList<String> interfacesNames = new ArrayList<String>();
+				String name = "";
+				try {
+					name = type.getFullyQualifiedParameterizedName();
+				} catch (JavaModelException e) {
+					name = type.getFullyQualifiedName();
+				}
+				interfacesNames.add(name);
+				setSuperInterfaces(interfacesNames, true);
+				superInterfacesChanged();
+				setDefaultTypeName(name);
+			}
+		}
+		setModifiers(getModifiers(), true);
+		try {
+			Field f = NewTypeWizardPage.class.getDeclaredField("fOtherMdfButtons");
+			if(f != null) {
+				f.setAccessible(true);
+				SelectionButtonDialogFieldGroup g = (SelectionButtonDialogFieldGroup)f.get(this);
+				g.enableSelectionButton(0, false);
+			}
+		} catch (Exception e) {
+			CommonUIPlugin.getDefault().logError(e);
+		}
+		doStatusUpdate();
+	}
+
+	void setDefaultTypeName(String interfaceName) {
+		int d = interfaceName.lastIndexOf('.');
+		int b = interfaceName.indexOf('<');
+		if (b < 0)
+			b = interfaceName.length();
+		String elementName = interfaceName.substring(d + 1, b);
+		String typeName = elementName + "Service";
+//		typeName += interfaceName.substring(b);
+
+		String currentTypeName = getTypeName();
+		boolean isDefault = currentTypeName == null || currentTypeName.length() == 0 || currentTypeName.equals(defaultTypeName);
+		if(isDefault)  {
+			setTypeName(typeName, true);
+			typeNameChanged();
+		}
+		defaultTypeName = typeName;
+	}
+
+	public void createControl(Composite parent) {
+		initializeDialogUnits(parent);
+
+		Composite composite = new Composite(parent, SWT.NONE);
+		composite.setFont(parent.getFont());
+
+		int nColumns = 4;
+
+		GridLayout layout = new GridLayout();
+		layout.numColumns = nColumns;
+		composite.setLayout(layout);
+
+		// pick & choose the wanted UI components
+
+		createContainerControls(composite, nColumns);
+		createPackageControls(composite, nColumns);
+		// createEnclosingTypeControls(composite, nColumns);
+
+		createSeparator(composite, nColumns);
+
+		createTypeNameControls(composite, nColumns);
+		createModifierControls(composite, nColumns);
+
+		// createSuperClassControls(composite, nColumns);
+		// createSuperInterfacesControls(composite, nColumns);
+
+		// createMethodStubSelectionControls(composite, nColumns);
+
+		createCustomFields(composite);
+
+		createCommentControls(composite, nColumns);
+		enableCommentControl(true);
+
+		setControl(composite);
+
+		Dialog.applyDialogFont(composite);
+		PlatformUI.getWorkbench().getHelpSystem()
+				.setHelp(composite, IJavaHelpContextIds.NEW_CLASS_WIZARD_PAGE);
+
+		onInterfaceChange();
+		doStatusUpdate();
+	}
+
+	protected void createTypeMembers(IType newType,
+			final ImportsManager imports, IProgressMonitor monitor)
+			throws CoreException {
+		createInheritedMethods(newType, true, true, imports,
+				new SubProgressMonitor(monitor, 1));
+	}
+
+	protected void createCustomFields(Composite composite) {
+		createInterfaceField(composite);
+	}
+
+	protected void createInterfaceField(Composite composite) {
+		interfaceField = SwtFieldEditorFactory.INSTANCE.createButtonFieldEditor("Interface", 
+			CommonUIMessages.NEW_SERVICE_WIZARD_INTERFACES_LABEL, "", 
+			new ButtonPressedAction(CommonUIMessages.SWT_FIELD_EDITOR_FACTORY_BROWS) {
+				public void run() {
+					OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog(getShell(), false, getContainer(),
+							getJavaProject() != null
+							? SearchEngine.createJavaSearchScope(new IJavaProject[] {getJavaProject()})
+							: SearchEngine.createJavaSearchScope(new IJavaProject[0]), 
+							IJavaSearchConstants.CLASS_AND_INTERFACE);
+					dialog.setTitle(CommonUIMessages.NEW_SERVICE_WIZARD_SELECT_SERVICE_TYPE_TITLE);
+					if(dialog.open() == IDialogConstants.OK_ID) {
+						Object[] os = dialog.getResult();
+						if(os != null && os.length == 1) {
+							IType t = (IType)os[0];
+							interfaceField.setValue(t.getFullyQualifiedName());
+						}
+					}
+				}
+		    }, 
+			new IValidator() {
+				@Override
+				public Map<String, IStatus> validate(Object value, Object context) {
+					return null;
+				}
+			});
+		interfaceField.doFillIntoGrid(composite);
+		interfaceField.addPropertyChangeListener(new PropertyChangeListener() {
+			public void propertyChange(PropertyChangeEvent evt) {
+				onInterfaceChange();
+			}
+		});
+	}
+
+	protected void onInterfaceChange() {
+		interfaceNameStatus = new StatusInfo();
+		String q = interfaceField == null ? "" : interfaceField.getValue().toString().trim();
+		
+		boolean isInterface = false, isClass = false;
+
+		if(getJavaProject() != null && q.length() > 0) {
+			String qRaw = q;
+			if(qRaw.indexOf('<') > 0) {
+				qRaw = qRaw.substring(0, qRaw.indexOf('<'));
+			}
+			try {
+				IType t = EclipseJavaUtil.findType(getJavaProject(), qRaw);
+				if(t != null) {
+					isInterface = t.isInterface();
+					isClass = !t.isInterface();
+					if(Flags.isFinal(t.getFlags())) {
+						interfaceNameStatus.setError(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_FINAL);
+					} else if(isClass && !Flags.isAbstract(t.getFlags())) {
+						interfaceNameStatus.setWarning(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_CONCRETE);
+					}
+				} else {
+					isInterface = true;
+					interfaceNameStatus.setError(NLS.bind(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_NOT_EXISTS, q));
+				}
+			} catch (JavaModelException e) {
+				CommonUIPlugin.getDefault().logError(e);
+				interfaceNameStatus.setError(NLS.bind(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_NOT_EXISTS, q));
+			}
+		}
+		if(q.length() == 0) {
+			interfaceNameStatus.setError(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_EMPTY);
+		}
+		if(isInterface) {
+			List<String> is = new ArrayList<String>();
+			if(q.length() > 0) is.add(q.trim());
+			setSuperInterfaces(is, true);
+			setSuperClass("", true);
+		} else if(isClass) {
+			setSuperInterfaces(new ArrayList<String>(), true);
+			setSuperClass(q, true);
+		}
+		
+		doStatusUpdate();
+	}
+
+	@Override
+	protected IStatus superInterfacesChanged() {
+		List list = getSuperInterfaces();
+		if(list != null && !list.isEmpty()) {
+			setDefaultTypeName(list.get(0).toString());
+		}
+		StatusInfo result = (StatusInfo) super.superInterfacesChanged();
+		return result;
+	}
+
+	@Override
+	protected IStatus superClassChanged() {
+		String n = getSuperClass();
+		if(n != null && n.length() > 0 && !n.endsWith("Object")) {
+			setDefaultTypeName(n);
+		}
+		StatusInfo result = (StatusInfo) super.superClassChanged();
+		return result;
+	}
+
+	private void doStatusUpdate() {
+		// status of all used components
+		IStatus[] status = new IStatus[] {
+				fContainerStatus,
+				isEnclosingTypeSelected() ? fEnclosingTypeStatus
+						: fPackageStatus, fTypeNameStatus, fModifierStatus,
+				fSuperClassStatus, fSuperInterfacesStatus };
+
+		// the mode severe status will be displayed and the OK button
+		// enabled/disabled.
+		updateStatus(status);
+	}
+
+	protected void updateStatus(IStatus[] status) {
+		if(!CommonUIMessages.NEW_SERVICE_WIZARD_DESCRIPTION.equals(getDescription())) {
+			setDescription(CommonUIMessages.NEW_SERVICE_WIZARD_DESCRIPTION);
+		}
+		IStatus[] ns = new IStatus[status.length + 1];
+		System.arraycopy(status, 0, ns, 0, status.length);
+		ns[status.length] = interfaceNameStatus;
+		status = ns;
+		updateStatus(StatusUtil.getMostSevere(status));
+	}
+	
+	public boolean isToBeRegisteredInMetaInf() {
+		return true;
+	}
+
+	@Override
+	public void setVisible(boolean visible) {
+		if(!getControl().isVisible() && visible && fSuperInterfacesStatus.matches(IStatus.ERROR) && !fTypeNameStatus.matches(IStatus.ERROR)) {
+			setDescription(fSuperInterfacesStatus.getMessage());
+		}
+		super.setVisible(visible);
+	}
+
+	protected String getSuperInterfacesLabel() {
+		return CommonUIMessages.NEW_SERVICE_WIZARD_INTERFACES_LABEL;
+	}
+
+	public String getServiceRawType() {
+		return (interfaceField == null) ? "" : toRawTypeName(interfaceField.getValueAsString());
+	}
+
+	private static String toRawTypeName(String typeName) {
+		return typeName.indexOf('<') >= 0 ? typeName.substring(0, typeName.indexOf('<')) : typeName;
+	}
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list