diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui')
65 files changed, 0 insertions, 10885 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/JSFUITraceOptions.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/JSFUITraceOptions.java deleted file mode 100644 index 14c3eab02..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/JSFUITraceOptions.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.jst.jsf.ui.internal; - -import org.eclipse.osgi.framework.debug.FrameworkDebugOptions; -import org.eclipse.osgi.service.debug.DebugOptions; - -/** - * Defines that standard runtime trace options for debugging. See .options file - * for definitions. - * - * @author cbateman - * - */ -public final class JSFUITraceOptions -{ - /** - * True if debug tracing is enabled. Other tracing cannot be enabled unless - * this is enabled. - */ - public static final boolean ENABLED; - - /** - * True if development mode for meta-data generation is enabled - */ - public static final boolean TRACE_METADATAGEN; - - private static final String KEY_DEBUG_ENABLED = "/debug"; - private static final String KEY_DESIGNTIME = "/metadatagen"; - - - static - { - final DebugOptions debugOptions = FrameworkDebugOptions.getDefault(); - - ENABLED = debugOptions != null - && debugOptions.getBooleanOption(JSFUiPlugin.PLUGIN_ID - + KEY_DEBUG_ENABLED, false); - - if (ENABLED) - { - TRACE_METADATAGEN = debugOptions.getBooleanOption( - JSFUiPlugin.PLUGIN_ID + KEY_DESIGNTIME, false); - } - else - { - TRACE_METADATAGEN = false; - } - } - - /** - * @param message - */ - public static void log(final String message) - { - System.out.println(message); - } - - /** - * @param msg A short label placed before the trace of t to show the source - * @param t - */ - public static void log(final String msg, final Throwable t) - { - System.out.printf("%s: Exception Trace:\n\n",msg); - t.printStackTrace(System.out); - System.out.print("\n\n\n"); - } - - private JSFUITraceOptions() - { - // no instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/JSFUiPlugin.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/JSFUiPlugin.java deleted file mode 100644 index e55185ee3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/JSFUiPlugin.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Gerry Kessler - initial API and implementation - * Ian Trimble - added logging methods - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * JSF UI plugin. - * - * @author Gerry Kessler - Oracle, Ian Trimble - Oracle - */ -public class JSFUiPlugin extends AbstractUIPlugin { - - /** - * The plugin id - */ - public static final String PLUGIN_ID = "org.eclipse.jst.jsf.ui"; //$NON-NLS-1$ - //The shared instance. - private static JSFUiPlugin plugin; - - /** - * The constructor. - */ - public JSFUiPlugin() { - plugin = this; - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - } - - /** - * Returns the shared instance. - * @return the default plugin instance - */ - public static JSFUiPlugin getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given - * plug-in relative path. - * - * @param path the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - path = "icons/" + path; //$NON-NLS-1$ - return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.jst.jsf.ui", path); //$NON-NLS-1$ - } - - /** - * Returns a shared image for the given name - * <p> - * Note: Images returned from this method will be automitically disposed of - * when this plug-in shuts down. Callers must not dispose of these images - * themselves. - * </p> - * - * @param name - * the image name found in /icons (with extension) - * @return the image, null on error or not found. - */ - public Image getImage(String name) { - if (name == null) { - return null; - } - - ImageRegistry images = getImageRegistry(); - Image image = images.get(name); - if (image == null) { - try { - final URL pluginBase= getBundle().getEntry("/");; - ImageDescriptor id = ImageDescriptor.createFromURL(new URL( - pluginBase, "icons/" + name)); - images.put(name, id); - - image = images.get(name); - } catch (MalformedURLException ee) { - // log.CommonPlugin.image.error=Image {0} not found. - //.error("log.msg", "log.CommonPlugin.image.error", name, ee); - log(IStatus.ERROR, "Loading image", ee); - } - } - return image; - } - /** - * @return the plugin id - */ - public String getPluginID() { - return PLUGIN_ID; - } - - /** - * Logs using the default ILog implementation provided by getLog(). - * - * @param severity Severity (IStatus constant) of log entry - * @param message Human-readable message describing log entry - * @param ex Throwable instance (can be null) - */ - public static void log(int severity, String message, Throwable ex) { - getDefault().getLog().log(new Status(severity, PLUGIN_ID, IStatus.OK, message, ex)); - } - - /** - * Logs using the default ILog implementation provided by getLog(). - * - * @param severity Severity (IStatus constant) of log entry - * @param message Human-readable message describing log entry - */ - public static void log(int severity, String message) { - log(severity, message, null); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/Messages.java deleted file mode 100644 index 1fd9d71ee..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/Messages.java +++ /dev/null @@ -1,331 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Gerry Kessler - initial API and implementation - * Ian Trimble - changed to work correctly with org.eclipse.osgi.util.NLS - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * String resource handler. - * - * @author Gerry Kessler - Oracle, Ian Trimble - Oracle - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.ui.internal.messages"; //$NON-NLS-1$ - - static { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_JSFImplementationLibrariesFrame; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_JSFComponentLibrariesFrame; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_title; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_description; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_JSFImplLabel; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_Add1; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_Add2; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_DeployJarsLabel; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_JSFConfigLabel; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_JSFServletNameLabel; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_JSFServletClassNameLabel; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_JSFURLMappingLabel; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_PatternDialogTitle; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_PatternDialogDesc; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_Remove; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_PatternEmptyMsg; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_PatternSpecifiedMsg; - /** - * see messages.properties - */ - public static String JSFFacetInstallPage_ErrorNoWebAppDataModel; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_DEFAULT_IMPL_DESC; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_DefinedJSFLibraries; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_IMPL_DESC; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_MISSING_DESC; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_New; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_Edit; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_Remove; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_CannotRemovePluginProvidedTitle; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_CannotRemovePluginProvidedMessage; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_MakeDefault; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_Description; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_CannotModifyPluginProvidedTitle; - /** - * see messages.properties - */ - public static String JSFLibrariesPreferencePage_CannotModifyPluginProvidedMessage; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_Add; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_AddAll; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_ImplementationLibrary; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_NewComponentLibrary; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_NullProject; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_DeployJAR; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_Remove; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_RemoveAll; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_TH_Deploy; - /** - * see messages.properties - */ - public static String JSFLibraryConfigControl_TH_LibraryName; - - - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_PageName; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_Title; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_Description; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_WarningNoJSFFacet; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_JSFLibraries; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_Add; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_Edit; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_ErrorInitializing; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_ImplAlreadyPresent; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_SelectOneImpl; - /** - * see messages.properties - */ - public static String JSFLibraryContainerWizardPage_EditLibrary_DescriptionText; - /** - * see messages.properties - */ - public static String JSFLibraryPropertyPage_No_JSF_Facet_Installed; - /** - * see messages.properties - */ - public static String JSFLibraryPropertyPage_No_JSF_Implementation_Lib_Selected; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_DESCRIPTION; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_CreateJSFLibrary; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_EditJSFLibrary; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_JSFLibrary; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_JSFLibraryWizard_DontShowThisAgain_CheckBoxLabel; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_LibraryName; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_VersionSupported; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_LibraryJars; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_DeployJars; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_Add; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_Remove; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_ExtJarFileDialogTitle; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_ValidateNoJars; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_ValidateNoLibraryName; - /** - * see messages.properties - */ - public static String JSFLibraryWizard_ValidateExistingLibraryName; - - /** - * Title set on the el validation preference panel - */ - public static String JSFValidationPreferencePage_ELPrefPanel_Title; - /** - * Title set on the checkbox that enables/disables build validation for EL - */ - public static String JSFValidationPreferencePage_ELPrefPanel_BuildValidationCheckBoxTitle; - /** - * Title set on the checkbox that enables/disables incremental (as you type) - * validation for EL - */ - public static String JSFValidationPreferencePage_ELPrefPanel_IncrementalValidationCheckBoxTitle; - - /** - * see messages.properties - */ - public static String JSFLibraryEditControl_ImplVersion_UNKNOWN; - - /** - * see messages.properties - */ - public static String JSFPreferences_RootPage_Description; - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryContainerWizardPage.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryContainerWizardPage.java deleted file mode 100644 index c8468c2f7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryContainerWizardPage.java +++ /dev/null @@ -1,558 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.classpath; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.ui.wizards.IClasspathContainerPage; -import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension; -import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension2; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -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.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryConfigurationHelper; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.jst.jsf.ui.internal.Messages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -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.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; -import org.eclipse.ui.PlatformUI; - -/** - * Provides a classpath container wizard page for JSF Libraries. - * - * @author Gerry Kessler - Oracle - * @deprecated - */ -public class JSFLibraryContainerWizardPage extends WizardPage implements - IClasspathContainerPage, IClasspathContainerPageExtension, IClasspathContainerPageExtension2{ - - private CheckboxTableViewer lv; - private JSFLibrariesTableViewerAdapter lvAdapter; - private JSFLibrariesListLabelProvider lvLabelProvider; - - private boolean isJSFProject = false; - private IClasspathEntry containerEntry; - private IClasspathEntry[] currentEntries; - private Map _currentLibs; - private JSFLibrary currentLib; - - private IProject _iproject; - - /** - * Zero arg constructor - */ - public JSFLibraryContainerWizardPage(){ - super(Messages.JSFLibraryContainerWizardPage_PageName); - setTitle(Messages.JSFLibraryContainerWizardPage_Title); - setDescription(Messages.JSFLibraryContainerWizardPage_Description); - // TODO: Replace with a custom image. - setImageDescriptor( JSFUiPlugin.getImageDescriptor("full/wizban/addlibrary_wiz.gif")); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension#initialize(org.eclipse.jdt.core.IJavaProject, org.eclipse.jdt.core.IClasspathEntry[]) - */ - public void initialize(IJavaProject project, IClasspathEntry[] currentEntries_) { - this.currentEntries = currentEntries_; - - _iproject = project.getProject(); - this.isJSFProject = JSFAppConfigUtils.isValidJSFProject(_iproject); - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.ui.wizards.IClasspathContainerPage#finish() - */ - public boolean finish() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension2#getNewContainers() - */ - public IClasspathEntry[] getNewContainers() { - IPath cp = new Path(JSFLibraryConfigurationHelper.JSF_LIBRARY_CP_CONTAINER_ID); - List res = new ArrayList(); - Object[] items = lv.getCheckedElements(); - for (int i=0;i<items.length;i++){ - JSFLibrary jsfLib = (JSFLibrary)items[i]; - if (getSelectedJSFLibariesForProject().get(jsfLib.getID()) == null){ - IPath path = cp.append(new Path(jsfLib.getID())); - IClasspathEntry entry = JavaCore.newContainerEntry(path); - // need to update wtp dependency in j2ee mod dependency ui - res.add(entry); - } - } - return (IClasspathEntry[])res.toArray(new IClasspathEntry[]{}); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.WizardPage#isPageComplete() - */ - public boolean isPageComplete() { - if (!isJSFProject) { - return false; - } - if (isEditReference() && ! selectionHasChanged()) - return false; - - return isValid(); - } - - private boolean isValid() { - return isCheckedItems() && getErrorMessage() == null; - } - - //to be used to know whether the selected library has changed when in "edit" mode - private boolean selectionHasChanged() { - JSFLibrary lib = getCurrentLibrarySelection(); - if (lib == null) - return false; - - return (getJSFLibraryForEdit(containerEntry) != lib) ; - - } - - private JSFLibrary getCurrentLibrarySelection() { - JSFLibrary lib = null; - StructuredSelection ssel = (StructuredSelection)lv.getSelection(); - if (ssel != null && !ssel.isEmpty()){ - lib = (JSFLibrary)ssel.getFirstElement(); - } - return lib; - } - - private boolean isCheckedItems() { - return lv.getCheckedElements().length > 0; - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.ui.wizards.IClasspathContainerPage#getSelection() - */ - public IClasspathEntry getSelection() { - IClasspathEntry entry = null; - if (isEditReference()){ - if (lv.getCheckedElements().length == 0) - return containerEntry; - - JSFLibrary lib = (JSFLibrary)lv.getCheckedElements()[0]; - if (lib != null){ - if (lib == getJSFLibraryForEdit(containerEntry)) - { - return containerEntry; - } - IPath path = new Path(JSFLibraryConfigurationHelper.JSF_LIBRARY_CP_CONTAINER_ID).append(new Path(lib.getID())); - entry = JavaCore.newContainerEntry(path, containerEntry.getAccessRules(), containerEntry.getExtraAttributes(),containerEntry.isExported()); - } - } - return entry; - - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.ui.wizards.IClasspathContainerPage#setSelection(org.eclipse.jdt.core.IClasspathEntry) - */ - public void setSelection(IClasspathEntry containerEntry) { - //this is signalling that this is an "edit" - this.containerEntry = containerEntry; - } - - public void createControl(Composite parent) { - //Build UI to display JSF Lib components from registry - Composite c = new Composite(parent, SWT.NONE); - c.setLayout(new GridLayout(2, false)); - c.setLayoutData(new GridData(GridData.FILL_BOTH)); - - //disable wizard if this is not a valid JSF project - if (!isJSFProject){ - Label warning = new Label(c , SWT.NONE); - warning.setText(Messages.JSFLibraryContainerWizardPage_WarningNoJSFFacet); - setControl(c); - return; - } - - Label lblViewer = new Label(c, SWT.NONE); - lblViewer.setText(Messages.JSFLibraryContainerWizardPage_JSFLibraries); - GridData gd1 = new GridData(GridData.BEGINNING); - gd1.horizontalSpan = 2; - lblViewer.setLayoutData(gd1); - - lv = createTableViewer(c); - lv.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - lvAdapter = new JSFLibrariesTableViewerAdapter(); - lvLabelProvider = new JSFLibrariesListLabelProvider(); - lv.setContentProvider(lvAdapter); - lv.setLabelProvider(lvLabelProvider); - lv.addSelectionChangedListener(lvAdapter); - lv.addDoubleClickListener(lvAdapter); - lv.setComparator(lvAdapter); - - Composite buttons = new Composite(c, SWT.NONE); - buttons.setLayout(new GridLayout(1, false)); - buttons.setLayoutData(new GridData(GridData.FILL_VERTICAL)); - - final Button addButton = new Button(buttons, SWT.NONE); - addButton.setText(Messages.JSFLibraryContainerWizardPage_Add); - addButton.setLayoutData(new GridData(GridData.END | GridData.VERTICAL_ALIGN_BEGINNING)); - addButton.addSelectionListener(new SelectionAdapter(){ - public void widgetSelected(SelectionEvent e){ - openJSFLibraryWizard(null); - } - }); - - final Button editButton = new Button(buttons, SWT.NONE); - editButton.setText(Messages.JSFLibraryContainerWizardPage_Edit); - editButton.setLayoutData(new GridData(GridData.END | GridData.VERTICAL_ALIGN_BEGINNING)); - editButton.addSelectionListener(new SelectionAdapter(){ - public void widgetSelected(SelectionEvent e){ - StructuredSelection sel = (StructuredSelection)lv.getSelection(); - if ((sel == null || sel.isEmpty()) && containerEntry != null){ - JSFLibrary jsfLib = getJSFLibraryForEdit(containerEntry); - sel = new StructuredSelection(jsfLib); - } - openJSFLibraryWizard(sel); - } - - }); - editButton.setVisible(false); - lv.addSelectionChangedListener(new ISelectionChangedListener(){ - public void selectionChanged(SelectionChangedEvent event) { - setEditButton(event.getSelection()); - } - - private void setEditButton(final ISelection selection) { - IStructuredSelection sel = (IStructuredSelection)selection; - editButton.setVisible(sel.size()==1); - if (sel.size() == 1){ - JSFLibrary lib = (JSFLibrary)sel.getFirstElement(); - boolean pp = lib instanceof PluginProvidedJSFLibrary; - editButton.setEnabled(! pp); - if (isEditReference()){ - lv.setAllChecked(false); - lv.setChecked(lib, true); - } - } - - } - }); - setControl(c); - - if (isEditReference()){ - JSFLibrary lib = getJSFLibraryForEdit(containerEntry); - lv.setInput(getAllUnselectedJSFLibrariesExceptReferencedLib(lib)); - selectAndCheckCurrentLib(lib); - setDescription(Messages.JSFLibraryContainerWizardPage_EditLibrary_DescriptionText); - } - else { - lv.setInput(getAllJSFLibraries()); - lv.setCheckedElements(getSelectedJSFLibariesForProject().values().toArray(new Object[0])); - } - } - - private void selectAndCheckCurrentLib(final JSFLibrary lib) { - if (lib != null){ - StructuredSelection ssel = new StructuredSelection(lib); - lv.setSelection(ssel); - lv.setChecked(lib, true); - } - } - - private Object getAllUnselectedJSFLibrariesExceptReferencedLib(JSFLibrary referenceLib) { - List allLibs = getAllJSFLibraries(); - Collection selLibs = getSelectedJSFLibariesForProject().values(); - for (Iterator it=selLibs.iterator();it.hasNext();){ - JSFLibrary aLib = (JSFLibrary)it.next(); - int i= allLibs.indexOf(aLib); - //remove from allLibs unless it is the selected reference - if (i >= 0 && ((referenceLib == null) || (aLib != null && ! aLib.getID().equals(referenceLib.getID())))){ - allLibs.remove(i); - } - } - return allLibs; - } - - private List getJSFLibraryEntries(IClasspathEntry[] entries) { - List jsfLibs = new ArrayList(); - for (int i=0;i<entries.length;i++){ - IClasspathEntry entry = entries[i]; - if (JSFLibraryConfigurationHelper.isJSFLibraryContainer(entry)){ - JSFLibrary lib = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry(). getJSFLibraryByID(getLibraryId(entry)); - if (lib != null){ - jsfLibs.add(lib); - } - } - } - - return jsfLibs; - } - - private String getLibraryId(IClasspathEntry entry) { - return entry.getPath().segment(1); - } - - private void openJSFLibraryWizard(IStructuredSelection element){ - IWorkbenchWizard wizard = new JSFLibraryWizard(); - IWorkbench wb = PlatformUI.getWorkbench(); - wizard.init(wb, element); - WizardDialog dialog = new WizardDialog(wb.getActiveWorkbenchWindow().getShell(), wizard); - int ret = dialog.open(); - if (ret == Window.OK){ - //FIXME: select returned object - if (containerEntry == null){ - lv.setInput(getAllJSFLibraries()); - } - else { - lv.setInput(getAllUnselectedJSFLibrariesExceptReferencedLib(getJSFLibraryForEdit(containerEntry))); - lv.refresh(true); - } - lv.refresh(); - } - } - - private CheckboxTableViewer createTableViewer(Composite parent) { - Table table= new Table(parent, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - table.setFont(parent.getFont()); - CheckboxTableViewer tableViewer= new CheckboxTableViewer(table); - tableViewer.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent e) { - if (! isEditReference()){ - //ensure that existing CP entries cannot be unchecked - if (getSelectedJSFLibariesForProject().get(((JSFLibrary)e.getElement()).getID()) != null){ - if (containerEntry == null) - e.getCheckable().setChecked(e.getElement(), true); - else - lv.setAllChecked(true); - } - } - else { - //select only one - lv.setAllChecked(false); - lv.setChecked(e.getElement(), true); - if (isEditReference()) - lv.setSelection(new StructuredSelection(e.getElement())); - } - validate(); - } - }); - return tableViewer; - } - - private Map getSelectedJSFLibariesForProject(){ - if (_currentLibs == null){ - List allLibs = getAllJSFLibraries(); - List curLibs = getJSFLibraryEntries(currentEntries); - _currentLibs = new HashMap(curLibs.size()); - for (Iterator it=curLibs.iterator();it.hasNext();){ - JSFLibrary lib = (JSFLibrary)it.next(); - int index = getIndex(allLibs, lib); - if (index >=0) - _currentLibs.put(lib.getID(), allLibs.get(index)); - } - - } - return _currentLibs; - } - - private List getAllJSFLibraries() { - List allLibs = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getAllJSFLibraries(); - - return allLibs; - } - - - private JSFLibrary getJSFLibraryForEdit( - IClasspathEntry containerEntry_) { - if (currentLib == null){ - String id = getLibraryId(containerEntry_); - currentLib = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibraryByID(id); - } - return currentLib; - - } - - private int getIndex(List libs, JSFLibrary lib) { - for (int i=0;i<libs.size();i++){ - if (lib.getID().equals(((JSFLibrary)libs.get(i)).getID())) - return i; - } - return -1; - } - - private class JSFLibrariesTableViewerAdapter extends ViewerComparator implements IStructuredContentProvider, ISelectionChangedListener, IDoubleClickListener { - - private Object input; - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - input = newInput; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - public void dispose() { - // do nothing - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - public Object[] getElements(Object inputElement) { - return ((List)input).toArray(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) - */ - public void selectionChanged(SelectionChangedEvent event) { - if (isEditReference()){ - setPageComplete(isPageComplete()); - } - - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) - */ - public void doubleClick(DoubleClickEvent event) { - doDoubleClick(event); - } - - public int compare(Viewer viewer, Object e1, Object e2) { - JSFLibrary lib1 = (JSFLibrary)e1; - JSFLibrary lib2 = (JSFLibrary)e2; - - //sort first by in selection already and then by name - boolean lib1Sel = getSelectedJSFLibariesForProject().get(lib1.getID())!=null; - boolean lib2Sel = getSelectedJSFLibariesForProject().get(lib2.getID())!= null; - - if ((lib1Sel && lib2Sel) || (!lib1Sel && !lib2Sel) ){ - return getComparator().compare(lib1.getLabel(), lib2.getLabel()); - } - else if (lib1Sel) - return -1; - else - return 1; - } - } - - private static class JSFLibrariesListLabelProvider implements ILabelProvider{ - Image libImg; - public Image getImage(Object element) { - if (libImg == null){ - ImageDescriptor libImgDesc = JSFUiPlugin.getImageDescriptor("obj16/library_obj.gif"); //$NON-NLS-1$ - libImg = libImgDesc.createImage(); - } - return libImg; - } - - public String getText(Object element) { - if (element instanceof JSFLibrary) { - JSFLibrary lib = (JSFLibrary)element; - if (lib.isImplementation()) { - return lib.getLabel() + " " + Messages.JSFLibrariesPreferencePage_IMPL_DESC; //$NON-NLS-1$ - } - return lib.getLabel(); - } - return null; - } - - public void dispose() { - if (libImg != null) - libImg.dispose(); - } - - public void addListener(ILabelProviderListener listener) { - // no listener support - } - - public boolean isLabelProperty(Object element, String property) { - return false; - } - - public void removeListener(ILabelProviderListener listener) { - // no listener support - } - } - - private void validate() { - setErrorMessage(null); - int implChosenCount = implSelectedCount(); - if (implChosenCount>1){ - setErrorMessage(Messages.JSFLibraryContainerWizardPage_ImplAlreadyPresent); - } - setPageComplete(isPageComplete()); - } - - - private boolean isEditReference() { - return (containerEntry != null); - } - - private int implSelectedCount() { - int count = 0; - for (int i=0;i<lv.getCheckedElements().length;i++){ - JSFLibrary lib = (JSFLibrary)lv.getCheckedElements()[i]; - if (lib.isImplementation()) - count++; - } - return count; - } - - private void doDoubleClick(DoubleClickEvent event) { - StructuredSelection ssel = (StructuredSelection)event.getSelection(); - if (ssel != null && - (! ((JSFLibrary)ssel.getFirstElement() instanceof PluginProvidedJSFLibrary))) - openJSFLibraryWizard((IStructuredSelection)event.getSelection()); - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryEditControl.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryEditControl.java deleted file mode 100644 index 5b456c2c0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryEditControl.java +++ /dev/null @@ -1,465 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.classpath; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.jst.jsf.ui.internal.Messages; -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.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -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.FileDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * Common control for adding JSF library instances - * @deprecated - */ -public class JSFLibraryEditControl extends Composite implements ModifyListener, SelectionListener -{ - private Text txtName; - private Label lblName; - private CCombo cboVersions; - private Label lblVersions; - private Button chkDeploy; - private Composite btnBar; - private Button btnAdd; - private Button btnRemove; - private TableViewer jars; - - private boolean initing = false; - - private JSFLibrary workingCopyLibrary; - - private String validationMsg; - private Set _listeners; - private int _isNew = -1;//use isNew() method.. not this variable directly - - /** - * @param workingCopyLibrary working copy of the JSF library - * @param parent parent SWT control - */ - public JSFLibraryEditControl(JSFLibrary workingCopyLibrary, Composite parent){ - super(parent, SWT.NONE); - this.workingCopyLibrary = workingCopyLibrary; - _listeners = new HashSet(1); - createControl(parent); - } - - /** - * @param listener - */ - public void addValidationListener(JSFLibraryValidationListener listener){ - removeValidationListener(listener); - _listeners.add(listener); - } - - /** - * @param listener - */ - public void removeValidationListener(JSFLibraryValidationListener listener){ - _listeners.remove(listener); - } - - /** - * @param parent - */ - public void createControl(Composite parent) { - initing = true; - -// this = new Composite(parent, SWT.NONE); - this.setLayout(new GridLayout(2, false)); - this.setLayoutData(new GridData(GridData.FILL_BOTH)); - - lblName = new Label(this, SWT.NONE); - lblName.setText(Messages.JSFLibraryWizard_LibraryName); - lblName.setLayoutData(new GridData(GridData.BEGINNING)); - - txtName = new Text(this, SWT.BORDER); - txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - txtName.addModifyListener(this); - - lblVersions = new Label(this, SWT.NONE); - lblVersions.setText(Messages.JSFLibraryWizard_VersionSupported); - - cboVersions = new CCombo(this, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); - cboVersions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - cboVersions.addModifyListener(this); - - Group jarsComp = new Group(this, SWT.NONE); - jarsComp.setText(Messages.JSFLibraryWizard_LibraryJars); - GridLayout gl1 = new GridLayout(2, false); - jarsComp.setLayout(gl1); - GridData gd2 = new GridData(GridData.FILL_HORIZONTAL - | GridData.FILL_VERTICAL); - gd2.horizontalSpan = 2; - jarsComp.setLayoutData(gd2); - - createJarsViewer(jarsComp); - - createButtons(jarsComp); - - chkDeploy = new Button(this, SWT.CHECK); - chkDeploy.setText(Messages.JSFLibraryWizard_DeployJars); - GridData gd4 = new GridData(); - gd4.horizontalSpan = 2; - chkDeploy.setLayoutData(gd4); -// chkDeploy.addSelectionListener(this); - chkDeploy.setVisible(false); - - loadVersions(); - - if (!isNew()) { - txtName.setText(workingCopyLibrary.getName()); - if (workingCopyLibrary.getJSFVersion().getName().equals(JSFVersion.UNKNOWN_LITERAL.getName())) { - cboVersions.setText(Messages.JSFLibraryEditControl_ImplVersion_UNKNOWN); - } else { - cboVersions.setText(workingCopyLibrary.getJSFVersion().getName()); - } - chkDeploy.setSelection(workingCopyLibrary.isDeployed()); - } - jars.setInput(workingCopyLibrary); - - initing = false; - - txtName.setFocus(); - } - - private void createJarsViewer(Group jarsComp) { - jars = new TableViewer(jarsComp, SWT.BORDER | SWT.MULTI); - jars.setContentProvider(new IStructuredContentProvider() { - public Object[] getElements(Object inputElement) { - if (inputElement instanceof JSFLibrary) - return ((JSFLibrary) inputElement).getArchiveFiles() - .toArray(); - return new Object[0]; - } - - public void dispose() { - // do nothing - } - - public void inputChanged(Viewer viewer, Object oldInput, - Object newInput) { - // won't happen - } - }); - jars.setLabelProvider(new ILabelProvider() { - private Image jarImg = null; - public Image getImage(Object element) { - if (jarImg == null){ - ImageDescriptor desc = JSFUiPlugin.getImageDescriptor("obj16/jar_obj.gif"); //$NON-NLS-1$ - jarImg = desc.createImage(); - } - return jarImg; - } - - public String getText(Object element) { - StringBuffer labelBuf = new StringBuffer(); - if (element instanceof ArchiveFile) { - ArchiveFile archive = (ArchiveFile) element; - labelBuf.append(archive.getName()); - if (!archive.exists()) - labelBuf.append(Messages.JSFLibrariesPreferencePage_MISSING_DESC); - labelBuf.append(" - ").append(archive.getPath()); //$NON-NLS-1$ - } - return labelBuf.toString(); - } - - public void addListener(ILabelProviderListener listener) { - // no listeners supported - } - - public void dispose() { - if (jarImg != null) - jarImg.dispose(); - } - - public boolean isLabelProperty(Object element, String property) { - return false; - } - - public void removeListener(ILabelProviderListener listener) { - // no listeners supported - } - }); - - jars.addSelectionChangedListener(new ISelectionChangedListener(){ - public void selectionChanged(SelectionChangedEvent event){ - updateButtons(); - } - }); - - GridData gd = new GridData(GridData.FILL_BOTH); -// gd.widthHint = convertWidthInCharsToPixels(30); -// gd.heightHint = convertHeightInCharsToPixels(10); - jars.getControl().setLayoutData(gd); - } - - private void updateButtons() { - btnRemove.setEnabled(!((StructuredSelection)jars.getSelection()).isEmpty()); - // getButton(IDialogConstants.OK_ID).setEnabled(modified); - } - - private void createButtons(Composite c) { - btnBar = new Composite(c, SWT.NONE); - GridLayout gl = new GridLayout(1, false); - gl.marginHeight = 0; - gl.marginTop = 0; - gl.marginWidth = 0; - btnBar.setLayout(gl); - btnBar.setLayoutData(new GridData(GridData.END)); - - btnAdd = new Button(btnBar, SWT.NONE); - btnAdd.setText(Messages.JSFLibraryWizard_Add); - btnAdd.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_BEGINNING)); - btnAdd.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - String cur = null; - String[] chosenJars = openExtJarFileDialog(cur); - if (chosenJars != null) { - for (int i = 0; i < chosenJars.length; i++) { - String jar = chosenJars[i]; - if (!workingCopyLibrary.containsArchiveFile(jar)) { - ArchiveFile archive = JSFLibraryRegistryFactory.eINSTANCE - .createArchiveFile(); - archive.setSourceLocation(jar); - archive.setRelativeDestLocation("WEB-INF/lib"); //$NON-NLS-1$ - workingCopyLibrary.getArchiveFiles().add(archive); - } - } - jars.refresh(); - validate(); - } - } - }); - - btnRemove = new Button(btnBar, SWT.NONE); - btnRemove.setEnabled(false); - btnRemove.setText(Messages.JSFLibraryWizard_Remove); - btnRemove.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_BEGINNING)); - btnRemove.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - if (jars.getSelection() instanceof StructuredSelection){ - StructuredSelection objs = (StructuredSelection)jars.getSelection(); - if (objs != null){ - Iterator it = objs.iterator(); - while (it.hasNext()){ - Object obj = it.next(); - ArchiveFile jar = (ArchiveFile)obj; - workingCopyLibrary.getArchiveFiles().remove(jar); - } - } - jars.refresh(); - validate(); - } - } - }); - } - - private void loadVersions() { - cboVersions.removeAll(); - Iterator it = JSFVersion.VALUES.iterator(); - while (it.hasNext()) { - JSFVersion ver = (JSFVersion) it.next(); - if (ver.getName().equals(JSFVersion.UNKNOWN_LITERAL.getName())) { - cboVersions.add(Messages.JSFLibraryEditControl_ImplVersion_UNKNOWN); - } else { - cboVersions.add(ver.getName()); - } - } - } - - private String[] openExtJarFileDialog(String existing) { - String title = Messages.JSFLibraryWizard_ExtJarFileDialogTitle; - - FileDialog dialog = new FileDialog(getShell(), - existing == null ? SWT.MULTI : SWT.SINGLE); - dialog.setText(title); - dialog.setFilterExtensions(new String[] { "*.jar;*.zip" }); //$NON-NLS-1$ - // FIXME: remember and use last path chosen?? - String filterPath = ResourcesPlugin.getWorkspace().getRoot() - .getFullPath().toString(); - dialog.setFilterPath(filterPath); - // if (existing != null) { - // dialog.setFileName(existing.getPath().lastSegment()); - // } - - String res = dialog.open(); - if (res == null) { - return null; - } - String[] fileNames = dialog.getFileNames(); - String[] elems = new String[fileNames.length]; - IPath file = new Path(res); - IPath apath = file.removeLastSegments(1); - for (int i = 0; i < fileNames.length; i++) { - elems[i] = apath.append(fileNames[i]).toString(); - } - return elems; - } - - public void modifyText(ModifyEvent e) { - validate(); - updateButtons(); - } - - private void fireValidateEvent(final JSFLibraryValidationEvent jSFLibraryValidationEvent) { - new Runnable(){ - public void run() { - for (Iterator it=_listeners.iterator();it.hasNext();){ - JSFLibraryValidationListener listener = (JSFLibraryValidationListener)it.next(); - listener.notifyValidation(jSFLibraryValidationEvent); - } - } - }.run(); - } - - - public void widgetSelected(SelectionEvent e) { - validate(); - updateButtons(); - } - - public void widgetDefaultSelected(SelectionEvent e) { - // no handling for default selection - } - - private void validate() { - if (initing) - return; - validationMsg = null; -// setPageComplete(true); - if (!validateName() || !validateJars() || !validateVersion()) { -// setPageComplete(false); - } - fireValidateEvent(new JSFLibraryValidationEvent(validationMsg)); - } - - private boolean validateJars() { - if (workingCopyLibrary.getArchiveFiles().isEmpty()) { - validationMsg = Messages.JSFLibraryWizard_ValidateNoJars; - return false; - } - return true; - } - - private boolean validateVersion() { - //FIXME: why isn't selection indesx correct??? - // if (cboVersions.getSelectionIndex() < 0) { - // setErrorMessage("Choose the maximum JSF version supported if known."); - // return false; - // } - return true; - } - - private boolean validateName() { - if (txtName.getText() == null - || txtName.getText().trim().equals("")) { //$NON-NLS-1$ - validationMsg = Messages.JSFLibraryWizard_ValidateNoLibraryName; - return false; - } - String aName = txtName.getText().trim(); - if (isNew() || (!isNew() && !getCurrentLibraryName().equals(aName))) { - if (isNameInRegistry(JSFLibraryRegistryUtil.getInstance() - .getJSFLibraryRegistry().getAllJSFLibraries(), aName)) { - validationMsg = Messages.JSFLibraryWizard_ValidateExistingLibraryName; - return false; - } - } - return true; - } - - private boolean isNew() { - if (_isNew == -1){ - _isNew = workingCopyLibrary.getName() == null ? 1 : 0; - } - return _isNew == 1; - } - - private String getCurrentLibraryName() { - return workingCopyLibrary.getName(); - } - - private boolean isNameInRegistry(Collection c, String name) { - Iterator it = c.iterator(); - while (it.hasNext()) { - JSFLibrary lib = (JSFLibrary) it.next(); - if (lib.getName().equals(name)) { - return true; - } - } - return false; - } - - /** - * @return the trimmed name of the user input for jsf library name - */ - public String getJSFLibraryName() { - return txtName.getText().trim(); - } - - - /** - * @return the value of the user input for the isDeployed checkbox - */ - public boolean getIsDeployed() { - return chkDeploy.getSelection(); - } - - - /** - * @return the jsf version selected in the version dropping - */ - public JSFVersion getJSFVersion() { - if (cboVersions.getSelectionIndex() >= 0) { - JSFVersion ver = (JSFVersion) JSFVersion.VALUES.get(cboVersions - .getSelectionIndex()); - return ver; - } - return JSFVersion.UNKNOWN_LITERAL; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryValidationEvent.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryValidationEvent.java deleted file mode 100644 index 71855c585..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryValidationEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.classpath; - -import org.eclipse.core.runtime.IStatus; - -/** - * Validation event used by JSFLibraryControl to notify containers of updates - * @deprecated - */ -public class JSFLibraryValidationEvent { - private String msg; - private int severity; - - /** - * Constructor - * @param msg - * @param severity - IStatus int value - */ - public JSFLibraryValidationEvent(String msg, int severity) { - this.msg = msg; - this.severity = severity; - } - - /** - * Constructs event with severity of IStatus.ERROR - * @param msg - */ - public JSFLibraryValidationEvent(String msg) { - this(msg, IStatus.ERROR); - } - - /** - * @return validation message - */ - public String getMessage(){ - return msg; - } - - /** - * @return IStatus int value - */ - public int getSeverity(){ - return severity; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryValidationListener.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryValidationListener.java deleted file mode 100644 index 8dd1a4f10..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryValidationListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.classpath; - -/** - * Listeners of {@link JSFLibraryValidationEvent}s should implement - * @deprecated - */ -public interface JSFLibraryValidationListener { - /** - * Callback - * @param e - */ - public void notifyValidation(JSFLibraryValidationEvent e); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryWizard.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryWizard.java deleted file mode 100644 index 81d0e2e11..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/JSFLibraryWizard.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.classpath; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.jst.jsf.ui.internal.Messages; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; - -/** - * Dialog for creating or editing a JSF Library or Implementation. - * <br> - * If the selection passed in init is not null then the item will be edit mode. - * - * @author Gerry Kessler - Oracle - * @deprecated - */ -public class JSFLibraryWizard extends Wizard implements INewWizard { - - private JSFLibraryEditControl jsfLibraryEditControl; - - private boolean isNew = false; - private boolean modified = false; - - private JSFLibrary curLibrary; - private JSFLibrary workingCopyLibrary; - - private JSFLibraryWizardPage page; - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) - { - if (selection != null - && selection.getFirstElement() instanceof JSFLibrary) { - curLibrary = (JSFLibrary) selection.getFirstElement(); - workingCopyLibrary = curLibrary.getWorkingCopy(); - } else { - isNew = true; - workingCopyLibrary = JSFLibraryRegistryFactory.eINSTANCE.createJSFLibrary(); - } - setWindowTitle(isNew ? Messages.JSFLibraryWizard_CreateJSFLibrary : Messages.JSFLibraryWizard_EditJSFLibrary); - } - - /** - * Updates the JSF Library instance with the values from the working copy and - * persists the registry. - * - * If editing a library reference, referencing java models will be updated. - * - * @see org.eclipse.jface.wizard.Wizard#performFinish() - */ - public boolean performFinish() - { - final String name = jsfLibraryEditControl.getJSFLibraryName(); - final boolean isDeployed = jsfLibraryEditControl.getIsDeployed(); - final JSFVersion version = jsfLibraryEditControl.getJSFVersion(); - - workingCopyLibrary.setName(name); - workingCopyLibrary.setDeployed(isDeployed); - workingCopyLibrary.setJSFVersion(version); - - final String originalID = curLibrary != null ? curLibrary.getID() :workingCopyLibrary.getID(); - - if (isNew){ - JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().addJSFLibrary(workingCopyLibrary); - } - else { - curLibrary.updateValues(workingCopyLibrary); - try { - JSFLibraryRegistryUtil.rebindClasspathContainerEntries(originalID, workingCopyLibrary.getID(), null); - } catch (JavaModelException e) { - JSFUiPlugin.log(IStatus.ERROR, "Exception while updating JSF Library containers", e); //$NON-NLS-1$ - } - } - JSFLibraryRegistryUtil.getInstance().saveJSFLibraryRegistry(); - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ - public void addPages() { - page = new JSFLibraryWizardPage(Messages.JSFLibraryWizard_JSFLibrary); - super.addPage(page); - page.setWizard(this); - } - - /** - * @return the JSFLibrary being modified by this wizard - */ - public JSFLibrary getJSFLibrary() { - return workingCopyLibrary; - } - - private class JSFLibraryWizardPage extends WizardPage { - - /** - * @param pageName - */ - protected JSFLibraryWizardPage(String pageName) { - super(pageName); - setDescription(Messages.JSFLibraryWizard_DESCRIPTION); - setTitle(Messages.JSFLibraryWizard_JSFLibrary); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.WizardPage#isPageComplete() - */ - public boolean isPageComplete() { - if (modified == false) { - return false; - } - return super.isPageComplete(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - initializeDialogUnits(parent); - - jsfLibraryEditControl = new JSFLibraryEditControl(workingCopyLibrary, parent); - jsfLibraryEditControl.setLayout(new GridLayout(2, false)); - jsfLibraryEditControl.setLayoutData(new GridData(GridData.FILL_BOTH)); - - jsfLibraryEditControl.addValidationListener(new JSFLibraryValidationListener(){ - public void notifyValidation(JSFLibraryValidationEvent e) { - setErrorMessage(e.getMessage()); - modified = true; - setPageComplete(getErrorMessage()==null); - } - }); - - setControl(jsfLibraryEditControl); - setPageComplete(false); - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/WarningMessageDialog.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/WarningMessageDialog.java deleted file mode 100644 index ff08f6b7d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/WarningMessageDialog.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.classpath; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleAdapter; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * Customized warning dialog for JSF Library Upgrade warnings. - * - * @author cbateman - * @deprecated - */ -class WarningMessageDialog extends MessageDialog -{ - private Text _messageLabel; - - /** - * @param parent - * @param title - * @param message - * @return true if the user hit OK - * - * Overriden to set the default button to CANCEL and use this dialog. - */ - public static boolean openConfirm(Shell parent, String title, String message) { - MessageDialog dialog = new WarningMessageDialog(parent, title, null, // accept - // the - // default - // window - // icon - message, QUESTION, new String[] { IDialogConstants.OK_LABEL, - IDialogConstants.CANCEL_LABEL }, 1); // CANCEL is the - // default - return dialog.open() == 0; - } - - WarningMessageDialog(Shell parentShell, String dialogTitle, - Image dialogTitleImage, String dialogMessage, int dialogImageType, - String[] dialogButtonLabels, int defaultIndex) { - super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, - dialogImageType, dialogButtonLabels, defaultIndex); - } - - @Override - protected Control createMessageArea(Composite composite) - { - // create composite - // create image - Image image = getImage(); - if (image != null) { - imageLabel = new Label(composite, SWT.NULL); - image.setBackground(imageLabel.getBackground()); - imageLabel.setImage(image); - addAccessibleListeners(imageLabel, image); - GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING) - .applyTo(imageLabel); - } - // create message - if (message != null) { - _messageLabel = new Text(composite, getMessageLabelStyle()|SWT.READ_ONLY); - _messageLabel.setText(message); - GridDataFactory - .fillDefaults() - .align(SWT.FILL, SWT.BEGINNING) - .grab(true, false) - .hint( - convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), - SWT.DEFAULT).applyTo(_messageLabel); - } - return composite; - } - - /** - * NOTE: copied from IconAndMessageDialog - * Add an accessible listener to the label if it can be inferred from the - * image. - * - * @param label - * @param image - */ - private void addAccessibleListeners(Label label, final Image image) { - label.getAccessible().addAccessibleListener(new AccessibleAdapter() { - public void getName(AccessibleEvent event) { - final String accessibleMessage = getAccessibleMessageFor(image); - if (accessibleMessage == null) { - return; - } - event.result = accessibleMessage; - } - }); - } - - /** - * NOTE: copied from IconAndMessageDialog - * @param image - * @return an accesible string - */ - private String getAccessibleMessageFor(Image image) { - if (image.equals(getErrorImage())) { - return JFaceResources.getString("error");//$NON-NLS-1$ - } - - if (image.equals(getWarningImage())) { - return JFaceResources.getString("warning");//$NON-NLS-1$ - } - - if (image.equals(getInfoImage())) { - return JFaceResources.getString("info");//$NON-NLS-1$ - } - - if (image.equals(getQuestionImage())) { - return JFaceResources.getString("question"); //$NON-NLS-1$ - } - - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/WarningMessageDialogWithToggle.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/WarningMessageDialogWithToggle.java deleted file mode 100644 index f86700bfc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/classpath/WarningMessageDialogWithToggle.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.classpath; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleAdapter; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * Customized warning dialog for JSF Library Upgrade warnings. - * - * @author cbateman - * @deprecated - */ -class WarningMessageDialogWithToggle extends MessageDialogWithToggle -{ - private Text _messageLabel; - - /** - * @param parent - * @param title - * @param message - * @param toggleMessage - * @param toggleState - * @param store - * @param key - * @return the dialog. - * - * Overriden to make default button CANCEL and use this dialog - */ - public static MessageDialogWithToggle openOkCancelConfirm(Shell parent, - String title, String message, String toggleMessage, - boolean toggleState, IPreferenceStore store, String key) { - MessageDialogWithToggle dialog = new WarningMessageDialogWithToggle(parent, - title, null, // accept the default window icon - message, QUESTION, new String[] { IDialogConstants.OK_LABEL, - IDialogConstants.CANCEL_LABEL }, 1, // CANCEL is the default - toggleMessage, toggleState); - dialog.open(); - return dialog; - } - - WarningMessageDialogWithToggle(Shell parentShell, String dialogTitle, - Image image, String message, int dialogImageType, - String[] dialogButtonLabels, int defaultIndex, - String toggleMessage, boolean toggleState) { - super(parentShell, dialogTitle, image, message, dialogImageType, - dialogButtonLabels, defaultIndex, toggleMessage, toggleState); - } - - @Override - protected Control createMessageArea(Composite composite) - { - // create composite - // create image - Image image = getImage(); - if (image != null) { - imageLabel = new Label(composite, SWT.NULL); - image.setBackground(imageLabel.getBackground()); - imageLabel.setImage(image); - addAccessibleListeners(imageLabel, image); - GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING) - .applyTo(imageLabel); - } - // create message - if (message != null) { - _messageLabel = new Text(composite, getMessageLabelStyle()|SWT.READ_ONLY); - _messageLabel.setText(message); - GridDataFactory - .fillDefaults() - .align(SWT.FILL, SWT.BEGINNING) - .grab(true, false) - .hint( - convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), - SWT.DEFAULT).applyTo(_messageLabel); - } - return composite; - } - - /** - * NOTE: copied from IconAndMessageDialog - * Add an accessible listener to the label if it can be inferred from the - * image. - * - * @param label - * @param image - */ - private void addAccessibleListeners(Label label, final Image image) { - label.getAccessible().addAccessibleListener(new AccessibleAdapter() { - public void getName(AccessibleEvent event) { - final String accessibleMessage = getAccessibleMessageFor(image); - if (accessibleMessage == null) { - return; - } - event.result = accessibleMessage; - } - }); - } - - /** - * NOTE: copied from IconAndMessageDialog - * @param image - * @return an accesible string - */ - private String getAccessibleMessageFor(Image image) { - if (image.equals(getErrorImage())) { - return JFaceResources.getString("error");//$NON-NLS-1$ - } - - if (image.equals(getWarningImage())) { - return JFaceResources.getString("warning");//$NON-NLS-1$ - } - - if (image.equals(getInfoImage())) { - return JFaceResources.getString("info");//$NON-NLS-1$ - } - - if (image.equals(getQuestionImage())) { - return JFaceResources.getString("question"); //$NON-NLS-1$ - } - - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/Messages.java deleted file mode 100644 index 30e0e9eed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/Messages.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.common; - -import org.eclipse.osgi.util.NLS; - -/** - * @author cbateman - * - */ -public class Messages extends NLS -{ - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.ui.internal.common.messages"; //$NON-NLS-1$ - /** - * see messages.properties - */ - public static String ViewObjectPresenter_ComponentClass; - /** - * see messages.properties - */ - public static String ViewObjectPresenter_ComponentFamily; - /** - * see messages.properties - */ - public static String ViewObjectPresenter_ComponentType; - /** - * see messages.properties - */ - public static String ViewObjectPresenter_RenderType; - static - { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() - { - // no instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/MetadataTagImageManager.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/MetadataTagImageManager.java deleted file mode 100644 index 86f7f78cb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/MetadataTagImageManager.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.common; - -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IImageDescriptorProvider; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.swt.graphics.Image; - -/** - * @author cbateman - * - */ -public class MetadataTagImageManager -{ - private static final String TRAIT_ICON_SMALL = "small-icon"; - - private static final String TRAIT_ICON_LARGE = "large-icon"; - - /** - * @param project - * @param tagId - * @return small image using metadata. May be null. - */ - public Image getSmallIconImage(final IProject project, final TagIdentifier tagId) - { - return getSmallIconImage(project, tagId.getUri(), tagId.getTagName()); - } - - /** - * Returns small image using metadata and may be null. Caller should NOT - * dispose the image, but should call TagImageManager's dispose(image) - * - * @param project - * @param nsUri - * @param tagName - * @return small image using metadata. May be null. - */ - public Image getSmallIconImage(final IProject project, final String nsUri, - final String tagName) - { - Image image = null; - final Model model = getModel(project, nsUri); - if (model != null) - { - final ImageDescriptor imgDesc = getIconImageDescriptor(model, - tagName, true); - image = getOrCreateImage(imgDesc); - } - - return image; - } - - private Image getOrCreateImage(final ImageDescriptor imgDesc) - { - Image image = null; - if (imgDesc != null) - { - image = JSFUiPlugin.getDefault().getImageRegistry().get( - imgDesc.toString()); - if (image == null) - { - image = imgDesc.createImage(); - JSFUiPlugin.getDefault().getImageRegistry().put( - imgDesc.toString(), image); - } - else if (image.isDisposed()) - { // should not occur, but handling just in case - JSFUiPlugin.getDefault().getImageRegistry().remove( - imgDesc.toString()); - image = imgDesc.createImage(); - JSFUiPlugin.getDefault().getImageRegistry().put( - imgDesc.toString(), image); - } - } - return image; - } - - private Model getModel(final IProject project, final String nsUri) - { - final ITaglibDomainMetaDataModelContext modelContext = TaglibDomainMetaDataQueryHelper - .createMetaDataModelContext(project, nsUri); - final Model model = TaglibDomainMetaDataQueryHelper - .getModel(modelContext); - // no caching at this time so there is no need to listen to model - // notifications - // if (model != null && !hasAdapter(model)) - // addAdapter(model); - return model; - } - - private ImageDescriptor getIconImageDescriptor(final Model model, - final String tagName, final boolean small) - { - ImageDescriptor icon = null; - - // use palette infos if available - final Trait trait = TaglibDomainMetaDataQueryHelper.getTrait(model, - "paletteInfos"); - if (trait != null) - { - final PaletteInfos tags = (PaletteInfos) trait.getValue(); - for (final Iterator it = tags.getInfos().iterator(); it.hasNext();) - { - final PaletteInfo tag = (PaletteInfo) it.next(); - if (tag.getId().equalsIgnoreCase(tagName)) - { - final IMetaDataSourceModelProvider sourceProvider = ((Trait) tag - .eContainer().eContainer()) - .getSourceModelProvider(); - if (small) - { - icon = getImageDescriptorFromString(sourceProvider, tag - .getSmallIcon()); - } - else - { - icon = getImageDescriptorFromString(sourceProvider, tag - .getLargeIcon()); - } - - break; - } - } - } - else - { - for (final Iterator it = model.getChildEntities().iterator(); it - .hasNext();) - { - final Entity tagAsEntity = (Entity) it.next(); - if (tagAsEntity.getId().equalsIgnoreCase(tagName)) - { - if (small) - { - icon = getImageDescriptorFromTagTraitValueAsString( - tagAsEntity, TRAIT_ICON_SMALL, ImageDescriptor - .getMissingImageDescriptor()); - } - else - { - icon = getImageDescriptorFromTagTraitValueAsString( - tagAsEntity, TRAIT_ICON_LARGE, ImageDescriptor - .getMissingImageDescriptor()); - } - - break; - } - } - - } - - return icon; - } - - private ImageDescriptor getImageDescriptorFromString( - IMetaDataSourceModelProvider sourceModelProvider, String imgDesc) - { - ImageDescriptor image = null; - IImageDescriptorProvider imageProvider = (IImageDescriptorProvider) sourceModelProvider - .getAdapter(IImageDescriptorProvider.class); - if (imageProvider != null) - { - image = imageProvider.getImageDescriptor(imgDesc); - } - return image; - } - - private ImageDescriptor getImageDescriptorFromTagTraitValueAsString( - Entity entity, String key, ImageDescriptor defaultValue) - { - Trait t = TaglibDomainMetaDataQueryHelper.getTrait(entity, key); - if (t != null) - { - String imgDesc = TraitValueHelper.getValueAsString(t); - return getImageDescriptorFromString(t.getSourceModelProvider(), - imgDesc); - } - return defaultValue; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/ViewObjectPresenter.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/ViewObjectPresenter.java deleted file mode 100644 index fc469c1d8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/ViewObjectPresenter.java +++ /dev/null @@ -1,247 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.common; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jst.jsf.common.runtime.internal.model.IDesigntimeAdapter; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; - -/** - * Generates UI form text strings for certain view objects. - * - * @author cbateman - * - */ -public final class ViewObjectPresenter -{ - /** - * @param typeInfo - * @return a presentation string containing all the summary information for - * a typeInfo. Excludes interfaces and superclasses. - */ - public static String present(final ComponentTypeInfo typeInfo) - { - final String formatText = "<form>%s</form>"; //$NON-NLS-1$ - final String componentType = typeInfo.getComponentType(); - final String componentFamily = typeInfo.getComponentFamily(); - final String renderType = typeInfo.getRenderFamily(); - final String componentClass = typeInfo.getClassName(); - final List<TitleValuePair> values = new ArrayList<TitleValuePair>(); - - values.add(new TitleValuePair(Messages.ViewObjectPresenter_ComponentType, - componentType == null ? "" //$NON-NLS-2$ - : componentType)); - values.add(new TitleValuePair(Messages.ViewObjectPresenter_ComponentClass, - componentClass == null ? "" //$NON-NLS-2$ - : componentClass)); - values.add(new TitleValuePair(Messages.ViewObjectPresenter_ComponentFamily, - componentFamily == null ? "" //$NON-NLS-2$ - : componentFamily)); - values.add(new TitleValuePair(Messages.ViewObjectPresenter_RenderType, - renderType == null ? "" : renderType)); //$NON-NLS-2$ - return String.format(formatText, ViewObjectPresenter.createLines(values)); - } - - /** - * @param compInfo - * @param typeInfo - * @return a presentation string containing all the interfaces in compInfo - * including adapters. - */ - public static String presentCompInterfaces(final ComponentTypeInfo typeInfo, final ComponentInfo compInfo) - { - final Set<String> interfaces = new HashSet<String>(); - - interfaces.addAll(Arrays.asList(typeInfo.getInterfaces())); - - if (compInfo != null) - { - for (final Map.Entry entry : (Set<Map.Entry>) compInfo.getAllAdapters() - .entrySet()) - { - final Object infObject = entry.getValue(); - if (infObject instanceof IDesigntimeAdapter) - { - interfaces.addAll(Arrays.asList(((IDesigntimeAdapter)infObject).getInterfaces())); - } - } - } - final List<String> sortedInterfaceNames = new ArrayList<String>( - interfaces); - Collections.sort(sortedInterfaceNames); - - String text = ""; - for (final String name : sortedInterfaceNames) - { - text += ViewObjectPresenter.createLine(null, name); - } - return String.format("<form>%s</form>", text); - } - - /** - * @param values - * @return a grouping of createLine style lines using the key/value pairs in - * values for the title and value. - */ - public static String createLines(final List<TitleValuePair> values) - { - String lines = ""; //$NON-NLS-1$ - for (final TitleValuePair valueEntry : values) - { - final String title = valueEntry.getTitle(); - final String value = valueEntry.getValue(); - - lines += createLine(title, value); - } - return lines; - } - - /** - * @param title - * may be null - * @param value - * @return a single paragraphed line containing value with title preceding - * in bold if not null - */ - public static String createLine(final String title, final String value) - { - if (title == null) - { - return String.format("<p>%s</p>", value); //$NON-NLS-1$ - } - return String.format("<p><b>%s</b>: %s</p>", title, value); //$NON-NLS-1$ - } - - /** - * A title/value pair. Title may be null. Comparable canonically based title - * (ascending). - * - * @author cbateman - * - */ - public final static class TitleValuePair implements - Comparable<TitleValuePair> - { - private final String _title; - private final String _value; - - /** - * @param title - * @param value - */ - public TitleValuePair(String title, String value) - { - super(); - if (value == null) - { - throw new IllegalArgumentException("Value must not be null"); - } - - _title = title; - _value = value; - } - - /** - * @return the title - */ - protected final String getTitle() - { - return _title; - } - - /** - * @return the value - */ - protected final String getValue() - { - return _value; - } - - public int compareTo(TitleValuePair other) - { - if (this == other) - { - return 0; - } - - if (other == null) - { - return 1; - } - - if (_title == null) - { - return other.getTitle() == null ? 0 : 1; - } - else if (other.getTitle() == null) - { - // _title is not null - return 1; - } - - return _title.compareTo(other.getTitle()); - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - - if (obj instanceof TitleValuePair) - { - - final TitleValuePair other = (TitleValuePair) obj; - final String otherValue = other.getValue(); - - if (!otherValue.equals(_value)) - { - return false; - } - - final String otherTitle = other.getTitle(); - if (_title == null) - { - return otherTitle == null; - } - else if (otherTitle == null) - { - return _title == null; - } - return _title.equals(otherTitle); - } - return false; - } - - @Override - public int hashCode() - { - return getTitle().hashCode(); - } - - - } - - private ViewObjectPresenter() - { - // no instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/messages.properties deleted file mode 100644 index 6afee6828..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/common/messages.properties +++ /dev/null @@ -1,14 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2008 Oracle Corporation and others. -# All rights reserved. This program and the accompanying materials -# are 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: -# Oracle Corporation - initial API and implementation -############################################################################### -ViewObjectPresenter_ComponentClass=Component Class -ViewObjectPresenter_ComponentFamily=Component Family -ViewObjectPresenter_ComponentType=Component Type -ViewObjectPresenter_RenderType=Render Type diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentInstanceDetailsForm.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentInstanceDetailsForm.java deleted file mode 100644 index c629e5a20..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentInstanceDetailsForm.java +++ /dev/null @@ -1,227 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.component; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jdt.core.Signature; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo.ComponentBeanProperty; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ComponentDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.FacetDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorDecorator; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm; -import org.eclipse.jst.jsf.ui.internal.common.ViewObjectPresenter; -import org.eclipse.jst.jsf.ui.internal.common.ViewObjectPresenter.TitleValuePair; -import org.eclipse.swt.widgets.Composite; - -/** - * Detail section for a component instance. - * - * @author cbateman - * - */ -/* package */class ComponentInstanceDetailsForm extends - AbstractXMLSectionsDetailsForm -{ - - private static final String COMPONENT_SECTION_KEY = "componentSection"; - private final static String COMPONENT_TYPE_SECTION_KEY = "componentTypeSection"; - private static final String COMPONENT_INTERFACES_KEY = "componentInterfacesSection"; - private static final String COMPONENT_DECORATORS_KEY = "componentDecorators"; - private static final String COMPONENT_PROPERTIES_KEY = "componentProperties"; - private final LabelProvider _labelProvider = new MyLabelProvider(); - - private XMLTextSection _componentTypeSection; - private XMLTextSection _componentSection; - private XMLTextSection _componentInterfacesSection; - private XMLTextSection _componentDecoratorsSection; - private XMLTextSection _componentPropertiesSection; - - @Override - protected void doUpdateSelection(final Object newSelection) - { - if (newSelection instanceof ComponentInfo) - { - final ComponentInfo compInfo = (ComponentInfo) newSelection; - updateComponentSection(compInfo); - updateComponentDecoratorsSection(compInfo); - updateComponentPropertiesSection(compInfo); - final ComponentTypeInfo typeInfo = compInfo.getComponentTypeInfo(); - if (typeInfo != null) - { - updateComponentTypeSection(typeInfo); - updateComponentInterfacesSection(compInfo, typeInfo); - } - } - } - - private void updateComponentSection(final ComponentInfo compInfo) - { - final String formatText = "<form>%s</form>"; - final String className = compInfo.getComponentTypeInfo().getClassName(); - final String id = compInfo.getId(); - final ComponentInfo parent = compInfo.getParent(); - final List<TitleValuePair> values = new ArrayList<TitleValuePair>(); - values.add(new TitleValuePair("Name", className != null ? Signature - .getSimpleName(className) : "")); - values.add(new TitleValuePair("Id", id != null ? id : "<i>none</i>")); - values.add(new TitleValuePair("Parent Id", (parent != null && parent - .getId() != null) ? parent.getId() : "<i>none</i>")); - - _componentSection.setText(String.format(formatText, ViewObjectPresenter - .createLines(values)), true, false); - _componentSection.refresh(); - } - - private void updateComponentTypeSection(final ComponentTypeInfo typeInfo) - { - _componentTypeSection.setText(ViewObjectPresenter.present(typeInfo), - true, false); - _componentTypeSection.refresh(); - } - - private void updateComponentInterfacesSection(final ComponentInfo compInfo, - final ComponentTypeInfo typeInfo) - { - _componentInterfacesSection.setText(ViewObjectPresenter - .presentCompInterfaces(typeInfo, compInfo), true, false); - _componentInterfacesSection.refresh(); - } - - private void updateComponentDecoratorsSection(final ComponentInfo compInfo) - { - List<TitleValuePair> decoratorLines = new ArrayList<TitleValuePair>(); - String text = ""; - for (final ComponentDecorator decorator : (List<ComponentDecorator>) compInfo - .getAllDecorators()) - { - String labelText = _labelProvider.getText(decorator); - - if (labelText != null) - { - //text += ViewObjectPresenter.createLine(null, labelText); - decoratorLines.add(new TitleValuePair(null, labelText)); - } - } - Collections.sort(decoratorLines); - text = ViewObjectPresenter.createLines(decoratorLines); - _componentDecoratorsSection.setText(String.format("<form>%s</form>", - text), true, false); - _componentDecoratorsSection.refresh(); - } - - private void updateComponentPropertiesSection(final ComponentInfo compInfo) - { - List<TitleValuePair> propertyLines = new ArrayList<TitleValuePair>(); - String text = ""; - Set<String> propNames = compInfo.getAttributeNames(); - - for (final String propName : propNames) - { - final ComponentBeanProperty propValue = compInfo - .getAttribute(propName); - if (propValue != null) - { - Object value = propValue.getValue(); - if (value != null) - { - propertyLines.add(new TitleValuePair(propName, value.toString())); - } - } - } - Collections.sort(propertyLines); - text = ViewObjectPresenter.createLines(propertyLines); - _componentPropertiesSection.setText(String.format("<form>%s</form>", - text), true, false); - _componentPropertiesSection.refresh(); - - } - - @Override - protected Map<? extends Object, XMLTextSection> createXMLTextSections( - final Composite parent) - { - final Map<String, XMLTextSection> sections = new HashMap<String, XMLTextSection>(); - _componentSection = new XMLTextSection(getToolkit(), parent, - "Instance Info"); - sections.put(COMPONENT_SECTION_KEY, _componentSection); - - _componentTypeSection = new XMLTextSection(getToolkit(), parent, - "Type Info Information"); - sections.put(COMPONENT_TYPE_SECTION_KEY, _componentTypeSection); - - _componentInterfacesSection = new XMLTextSection(getToolkit(), parent, - "Interfaces"); - sections.put(COMPONENT_INTERFACES_KEY, _componentInterfacesSection); - - _componentDecoratorsSection = new XMLTextSection(getToolkit(), parent, - "Decorators"); - sections.put(COMPONENT_DECORATORS_KEY, _componentDecoratorsSection); - - _componentPropertiesSection = new XMLTextSection(getToolkit(), parent, - "Properties"); - sections.put(COMPONENT_PROPERTIES_KEY, _componentPropertiesSection); - - return sections; - } - - @Override - protected Set<XMLTextSection> getInitiallyExpanded( - final Map<Object, XMLTextSection> sections) - { - return Collections.singleton(_componentSection); - } - - private static class MyLabelProvider extends LabelProvider - { - @Override - public String getText(Object element) - { - if (element instanceof ComponentDecorator) - { - if (element instanceof ConverterDecorator) - { - final ConverterDecorator converter = (ConverterDecorator) element; - return "Converter: id=\"" - + converter.getTypeInfo().getConverterId() - + "\", converter-class=" - + converter.getTypeInfo().getClassName(); - } - else if (element instanceof ValidatorDecorator) - { - final ValidatorDecorator validator = (ValidatorDecorator) element; - return "Validator: id=\"" - + validator.getTypeInfo().getValidatorId() - + "\", validator-class=" - + validator.getTypeInfo().getClassName(); - } - else if (element instanceof FacetDecorator) - { - final FacetDecorator decorator = (FacetDecorator) element; - return "Facet: " + decorator.getName() + ", component=" - + decorator.getDecorates().getId(); - } - } - - return null; - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentMasterDetailBlock.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentMasterDetailBlock.java deleted file mode 100644 index 4c846c883..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentMasterDetailBlock.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.component; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractDetailsForm; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterDetailBlock; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterForm; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/*package*/ class ComponentMasterDetailBlock extends AbstractMasterDetailBlock -{ - private final DTJSFViewModel _model; - private AbstractXMLSectionsDetailsForm _componentInstanceDetailsForm; - - public ComponentMasterDetailBlock(final DTJSFViewModel model) - { - _model = model; - } - - @Override - protected List<AbstractDetailsForm> createDetailPages() - { - final List<AbstractDetailsForm> pages = - new ArrayList<AbstractDetailsForm>(); - - _componentInstanceDetailsForm = new ComponentInstanceDetailsForm(); - pages.add(_componentInstanceDetailsForm); - - return pages; - } - - @Override - protected AbstractMasterForm createMasterPart(final FormToolkit toolkit) - { - return new ComponentMasterForm(toolkit, _model); - } - - @Override - protected AbstractXMLSectionsDetailsForm doSelectPage(final Object forModel) - { - if (forModel instanceof ComponentInfo) - { - return _componentInstanceDetailsForm; - } - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentMasterForm.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentMasterForm.java deleted file mode 100644 index 40828ad33..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentMasterForm.java +++ /dev/null @@ -1,306 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.component; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.viewers.IInputProvider; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.Decorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorDecorator; -import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterForm; -import org.eclipse.jst.jsf.common.ui.internal.utils.JSFSharedImages; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService.ElementData; -import org.eclipse.jst.jsf.ui.internal.common.MetadataTagImageManager; -import org.eclipse.jst.jsf.ui.internal.component.ComponentTreeViewProvider.TreePlaceHolder; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/*package*/class ComponentMasterForm extends AbstractMasterForm -{ - private final DTJSFViewModel _model; - private TreeViewer _treeViewer; - private Action _refreshAction; - - protected ComponentMasterForm(final FormToolkit toolkit, - final DTJSFViewModel model) - { - super(toolkit); - _model = model; - } - - @Override - public Control createClientArea(final Composite parent) - { - final Tree tree = getToolkit().createTree(parent, - SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); - tree.setLayoutData(gridData); - - _treeViewer = new TreeViewer(tree); - _treeViewer.getTree().setLayoutData(gridData); - _treeViewer.setContentProvider(new ComponentTreeViewProvider()); - _treeViewer.setLabelProvider(new TreeViewLabelProvider(_treeViewer)); - _treeViewer.setSorter(new ComponentTreeSorter()); - _treeViewer.addSelectionChangedListener(new ISelectionChangedListener() - { - public void selectionChanged(final SelectionChangedEvent event) - { - getListener().selectionChanged(event); - } - - }); - - _model.init(new Runnable() - { - public void run() - { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() - { - public void run() - { - final Object[] expanded = _treeViewer - .getExpandedElements(); - _treeViewer.refresh(); - _treeViewer.setExpandedElements(expanded); - } - }); - } - }); - - _treeViewer.setInput(_model); - - makeActions(); - return tree; - } - - @Override - protected void contributeActions(final IToolBarManager formManager, - final IToolBarManager localManager) - { - // contribute to local tool bar - localManager.add(_refreshAction); - localManager.update(false); - } - - private void makeActions() - { - _refreshAction = new Action() - { - @Override - public void run() - { - _model.update(); - } - }; - _refreshAction.setText("Refresh View"); - _refreshAction.setToolTipText("Refresh View"); - _refreshAction.setImageDescriptor(JSFUICommonPlugin.getDefault() - .getImageDescriptor("refresh_nav_16.gif")); - } - - @Override - protected void contributeToHeadArea(final FormToolkit toolkit, - final Composite container) - { - final Text label = new Text(container - , SWT.READ_ONLY | SWT.SINGLE | SWT.LEFT); - - String viewId = _model.getViewId(); - viewId = viewId == null ? "<unknown>" : viewId; - label.setText("View: " + viewId + " (Project: " - + _model.getProject().getName() + ")"); - } - - private static class TreeViewLabelProvider extends LabelProvider - { - private final IInputProvider _inputProvider; - private final MetadataTagImageManager _metadataIconManager; - - /** - * @param inputProvider - */ - private TreeViewLabelProvider(final IInputProvider inputProvider) - { - super(); - _inputProvider = inputProvider; - _metadataIconManager = new MetadataTagImageManager(); - } - - @Override - public String getText(final Object obj) - { - if (obj instanceof ComponentInfo) - { - String text = ""; - final ComponentInfo compInfo = (ComponentInfo) obj; - String className = compInfo.getComponentTypeInfo() - .getClassName(); - final int dotIdx = className.lastIndexOf('.'); - if (dotIdx > -1 && dotIdx + 1 < className.length()) - { - className = className.substring(dotIdx + 1); - } - text = className; - - final String id = compInfo.getId(); - - if (id != null) - { - text += " (id=" + id + ")"; - } - return text; - } - else if (obj instanceof TreePlaceHolder) - { - return "Calculating view..."; - } - return obj.toString(); - } - - @Override - public Image getImage(final Object obj) - { - Image image = null; - if (obj instanceof ViewObject) - { - final XMLViewObjectMappingService mappingService = getMappingService(); - - if (mappingService != null) - { - final ElementData elementData = mappingService - .findElementData((ViewObject) obj); - - if (elementData != null) - { - final TagIdentifier tagId = elementData.getTagId(); - final DTJSFViewModel model = getModel(); - if (model != null) - { - image = _metadataIconManager.getSmallIconImage( - model.getProject(), tagId); - } - } - } - if (image == null) - { - image = getDefaultImage((ViewObject) obj); - } - } - else if (obj instanceof TreePlaceHolder) - { - return JSFUICommonPlugin.getDefault().getImage("configs.gif"); - } - if (image == null) - { - final String imageKey = ISharedImages.IMG_OBJ_ELEMENT; - image = PlatformUI.getWorkbench().getSharedImages().getImage( - imageKey); - } - - return image; - } - - private XMLViewObjectMappingService getMappingService() - { - final DTJSFViewModel model = getModel(); - - if (model != null) - { - final DTUIViewRoot root = model.getRoot(); - - if (root != null) - { - return (XMLViewObjectMappingService) root.getServices() - .getAdapter(XMLViewObjectMappingService.class); - } - } - return null; - } - - private DTJSFViewModel getModel() - { - final Object input = _inputProvider.getInput(); - - if (input instanceof DTJSFViewModel) - { - return (DTJSFViewModel) input; - } - return null; - } - - private Image getDefaultImage(final ViewObject obj) - { - if (obj instanceof DTUIViewRoot) - { - return JSFUICommonPlugin.getDefault().getImage( - JSFSharedImages.GENERIC_VIEWROOT_IMG); - } - if (obj instanceof ComponentInfo) - { - return JSFUICommonPlugin.getDefault().getImage( - JSFSharedImages.GENERIC_OBJECT_IMG); - } - else if (obj instanceof ConverterDecorator) - { - return JSFUICommonPlugin.getDefault().getImage( - JSFSharedImages.GENERIC_CONVERTER_IMG); - } - else if (obj instanceof ValidatorDecorator) - { - return JSFUICommonPlugin.getDefault().getImage( - JSFSharedImages.GENERIC_VALIDATOR_IMG); - } - return JSFUICommonPlugin.getDefault().getImage( - JSFSharedImages.DEFAULT_PALETTE_TAG_IMG); - } - } - - private static class ComponentTreeSorter extends ViewerSorter - { - @Override - public int compare(final Viewer viewer, final Object e1, final Object e2) - { - return 0; - } - - @Override - public int category(final Object element) - { - // sort decorators first into their own category - if (element instanceof Decorator) - { - return 0; - } - return 1; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentTreeView.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentTreeView.java deleted file mode 100644 index 8596a1cb6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentTreeView.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.component; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin; -import org.eclipse.jst.jsf.common.ui.internal.utils.JSFSharedImages; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ResolverUtil; -import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.forms.widgets.Form; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.part.IPage; -import org.eclipse.ui.part.MessagePage; -import org.eclipse.ui.part.Page; -import org.eclipse.ui.part.PageBook; -import org.eclipse.ui.part.PageBookView; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * A basic page-based view, similar to outline, that shows the design-time - * component tree for a JSF view definition. - */ - -public class ComponentTreeView extends PageBookView -{ - - private FormToolkit _toolkit; - - @Override - public void init(IViewSite site) throws PartInitException - { - super.init(site); - setTitleImage(JSFUICommonPlugin.getDefault().getImage(JSFSharedImages.GENERIC_VIEWROOT_IMG)); - } - - @Override - protected IPage createDefaultPage(final PageBook book) - { - final MessagePage page = new MessagePage(); - initPage(page); - page.createControl(book); - page.setMessage("Nothing to display"); - return page; - } - - @Override - protected PageRec doCreatePage(final IWorkbenchPart part) - { - _toolkit = new FormToolkit(getPageBook().getDisplay()); - final ComponentPage page = new ComponentPage(getDocumentFromPart(part), - _toolkit); - initPage(page); - page.createControl(getPageBook()); - return new PageRec(part, page); - } - - @Override - protected void doDestroyPage(final IWorkbenchPart part, - final PageRec pageRecord) - { - pageRecord.page.dispose(); - pageRecord.dispose(); - } - - private IDocument getDocumentFromPart(final IWorkbenchPart part) - { - return (IDocument) part.getAdapter(IDocument.class); - } - - /** - * The view shows the palette associated with the active editor. - * - * @see PageBookView#getBootstrapPart() - */ - @Override - protected IWorkbenchPart getBootstrapPart() - { - final IWorkbenchPage page = getSite().getPage(); - if (page != null) - { - return page.getActiveEditor(); - } - return null; - } - - @Override - protected boolean isImportant(final IWorkbenchPart part) - { - final IDocument document = getDocumentFromPart(part); - - if (document != null) - { - final IFile file = ResolverUtil.getFileForDocument(document); - - if (file != null) - { - final DesignTimeApplicationManager manager = DesignTimeApplicationManager - .getInstance(file.getProject()); - - if (manager != null) - { - return manager.hasDTFacesContext(file); - } - } - } - - // fall through, then no, not important. - return false; - } - - private static class ComponentPage extends Page - { - private final IDocument _document; - private final FormToolkit _toolkit; - private ComponentMasterDetailBlock _masterDetailBlock; - private Form _form; - private DTJSFViewModel _model; - - public ComponentPage(final IDocument document, final FormToolkit toolkit) - { - _document = document; - _toolkit = toolkit; - } - - @Override - public void createControl(final Composite parent) - { - _model = new DTJSFViewModel( - (IStructuredDocument) _document); - - _form = _toolkit.createForm(parent); - _form.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - _masterDetailBlock = new ComponentMasterDetailBlock(_model); - _masterDetailBlock.createContent(_toolkit, _form); - } - - @Override - public void dispose() - { - super.dispose(); - _model.dispose(); - } - - @Override - public Control getControl() - { - return _form; - } - - @Override - public void setFocus() - { - // do nothing - } - - - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentTreeViewProvider.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentTreeViewProvider.java deleted file mode 100644 index c1bec1078..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/ComponentTreeViewProvider.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.component; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot; - -/** - * A tree view adapter for a design time component tree rooted at a design time - * view root. - * - * @author cbateman - * - */ -/* package */class ComponentTreeViewProvider implements - IStructuredContentProvider, ITreeContentProvider -{ - private final static Object[] NO_CHILDREN = new Object[0]; - - public Object[] getElements(final Object inputElement) - { - if (inputElement instanceof DTJSFViewModel) - { - final DTUIViewRoot root = ((DTJSFViewModel) inputElement).getRoot(); - - if (root != null) - { - return new Object[] - { root }; - } - return new Object[] {new TreePlaceHolder()}; - } - return NO_CHILDREN; - } - - public void dispose() - { - // nothing to dispose - } - - public void inputChanged(final Viewer viewer, final Object oldInput, - final Object newInput) - { - // do nothing - } - - public Object[] getChildren(final Object parentElement) - { - if (parentElement instanceof ComponentInfo) - { - final List<Object> children = new ArrayList<Object>(); - children.addAll(((ComponentInfo) parentElement).getChildren()); -// children.addAll(((ComponentInfo) parentElement).getAllDecorators()); - return children.toArray(); - } - return NO_CHILDREN; - } - - public Object getParent(final Object element) - { - if (element instanceof ComponentInfo) - { - return ((ComponentInfo)element).getParent(); - } - // no parent - return null; - } - - public boolean hasChildren(final Object element) - { - return getChildren(element).length > 0; - } - - static final class TreePlaceHolder - { - // place holder object used when recalculation is in progress - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/DTJSFViewModel.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/DTJSFViewModel.java deleted file mode 100644 index 1202c7c59..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/component/DTJSFViewModel.java +++ /dev/null @@ -1,255 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.component; - -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.designtime.DTAppManagerUtil; -import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler; -import org.eclipse.jst.jsf.designtime.internal.view.IViewRootHandle; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessEvent; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessListener; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * The top-level input model for a design time component tree - * - * @author cbateman - * - */ -/* package */class DTJSFViewModel -{ - private final IStructuredDocument _document; - private final IProject _project; - private final IFile _file; - private final IStructuredDocumentContext _context; - private final AtomicBoolean _alreadyUpdating = new AtomicBoolean( - false); - private Runnable _runnable; - private final IViewRootHandle _viewRootHandle; - private StalenessListener _stalenessListener; - - /** - * @param document - * @throws IllegalArgumentException - * if document cannot be used to initialize a component tree. - */ - public DTJSFViewModel(final IStructuredDocument document) - { - _document = document; - _context = IStructuredDocumentContextFactory.INSTANCE.getContext( - _document, -1); - - final IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(_context); - - if (resolver == null) - { - throw new IllegalArgumentException(); - } - - _project = resolver.getProject(); - _file = (IFile) resolver.getResource(); - - if (_project == null || _file == null) - { - throw new IllegalArgumentException(); - } - - final DTFacesContext facesContext = getFacesContext(); - _viewRootHandle = facesContext.getViewRootHandle(); - } - - /** - * Acquire and initialize the component tree root for the document - * - * @param runnable - */ - public void init(final Runnable runnable) - { - _runnable = runnable; - _viewRootHandle.addListener(getOrCreateListener()); - } - - public void dispose() - { - if (_stalenessListener != null) - { - _viewRootHandle.removeListener(_stalenessListener); - } - - synchronized(this) - { - _runnable = null; - } - } - - /** - * @return the structured document that this view model was created for. - */ - public final IStructuredDocument getDocument() - { - return _document; - } - - public final IProject getProject() - { - return _project; - } - - public final String getViewId() - { - final DTFacesContext facesContext = getFacesContext(); - final IDTViewHandler viewHandler = DTAppManagerUtil - .getViewHandler(_project); - if (facesContext != null && viewHandler != null) - { - return viewHandler.getViewId(facesContext, _file); - } - return null; - } - - private DTFacesContext getFacesContext() - { - final DesignTimeApplicationManager manager = DesignTimeApplicationManager - .getInstance(_project); - - if (manager != null) - { - return manager.getFacesContext(_file); - } - return null; - } - - public void update() - { - final DTFacesContext facesContext = getFacesContext(); - - if (facesContext != null) - { - // latch the alreadyRunning flag; job will unset to false - if (_alreadyUpdating.compareAndSet(false, true)) - { - final Job job = new UpdateRootAndRefreshJob(_viewRootHandle); - - job.addJobChangeListener(new JobChangeAdapter() - { - @Override - public void done(final IJobChangeEvent event) - { - // always reset the updating flag - _alreadyUpdating.set(false); - if (event.getResult().isOK()) - { - synchronized(DTJSFViewModel.this) - { - if (_runnable != null) - { - _runnable.run(); - } - } - } - } - }); - - job.schedule(); - } - } - } - - /** - * @return the design time view root or null - */ - public DTUIViewRoot getRoot() - { - final DTFacesContext facesContext = getFacesContext(); - - if (facesContext != null) - { - final DTUIViewRoot viewRoot = _viewRootHandle.getCachedViewRoot(); - - // if our copy is uninit or null, kick off an update - if (viewRoot == null || viewRoot.isStale()) - { - update(); - } - - return viewRoot; - } - return null; - } - - private StalenessListener getOrCreateListener() - { - if (_stalenessListener == null) - { - _stalenessListener = new StalenessListener() - { - @Override - protected void stalenessChanged(StalenessEvent event) - { - switch (event.getChangeType()) - { - case VIEW_DEFN_CHANGED: - case PROJECT_CLEANED: - { - update(); - } - case VIEW_DEFN_DELETED: - case VIEW_DEFN_PROJECT_CLOSED: - { - DTUIViewRoot root = _viewRootHandle - .getCachedViewRoot(); - if (root != null) - { - root.removeListener(_stalenessListener); - } - } - } - } - }; - } - return _stalenessListener; - } - - private static class UpdateRootAndRefreshJob extends Job - { - private final IViewRootHandle _viewRootHandle; - - public UpdateRootAndRefreshJob(final IViewRootHandle viewRootHandle) - { - super("Updating view root"); - _viewRootHandle = viewRootHandle; - } - - @Override - protected IStatus run(final IProgressMonitor monitor) - { - _viewRootHandle.updateViewRoot(); - return Status.OK_STATUS; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/contentassist/JSFContentAssistProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/contentassist/JSFContentAssistProcessor.java deleted file mode 100644 index a786371a1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/contentassist/JSFContentAssistProcessor.java +++ /dev/null @@ -1,296 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.ui.internal.contentassist; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.jface.text.contentassist.IContextInformationValidator; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.IStructuredDocumentContextResolverFactory2; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.metadataprocessors.MetaDataEnabledProcessingFactory; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery; -import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; -import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants; -import org.eclipse.wst.xml.ui.internal.taginfo.MarkupTagInfoProvider; -import org.osgi.framework.Bundle; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * The content assist processor for non-EL attribute values. - * - * @author Gerry Kessler - Oracle - * - */ -public class JSFContentAssistProcessor implements IContentAssistProcessor { - private ITextRegionContextResolver resolver; - private ITaglibContextResolver tlResolver; - private String defaultAdditionalInfo; - - private String defaultIconPath = "/icons/attr_val.gif"; //$NON-NLS-1$ - - private ImageDescriptor defaultAttrValImgDesc; - - private MarkupTagInfoProvider fInfoProvider; - - /** - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, - * int) - */ - public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, - int documentPosition) { - List proposals = new ArrayList(); - IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE - .getContext(viewer, documentPosition); - - if (context != null) { - resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getTextRegionResolver(context); - - if (resolver != null) { - final String regionType = resolver.getRegionType(); - - if (regionType != null - && regionType.equals(DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE)) { - - tlResolver = IStructuredDocumentContextResolverFactory2.INSTANCE - .getTaglibContextResolverFromDelegates(context); - - if (tlResolver != null) { - - Attr attr = getAttribute(context); - if (attr != null) { - Node tagElement = attr.getOwnerElement(); - if (tagElement != null) { - String uri = tlResolver.getTagURIForNodeName(tagElement); - if (uri != null) { - proposals = createProposals(context, uri, tagElement, attr); - } - } - } - } - } - } - } - - return (ICompletionProposal[]) proposals - .toArray(new ICompletionProposal[0]); - } - - private String getDefaultAdditionalInfo(Node tagElement, Attr attr) { - if (defaultAdditionalInfo == null){ - CMElementDeclaration elementNode = getCMElementDeclaration(tagElement); - if (elementNode != null){ - CMAttributeDeclaration attrNode = getCMAttributeDeclaration(elementNode, attr); - if (attrNode != null) - defaultAdditionalInfo = getInfoProvider().getInfo(attrNode); - } - } - return defaultAdditionalInfo; - } - - private CMElementDeclaration getCMElementDeclaration(Node node) { - CMElementDeclaration result = null; - if (node.getNodeType() == Node.ELEMENT_NODE) { - ModelQuery modelQuery = ModelQueryUtil.getModelQuery(node.getOwnerDocument()); - if (modelQuery != null) - result = modelQuery.getCMElementDeclaration((Element) node); - } - return result; - } - - private CMAttributeDeclaration getCMAttributeDeclaration(CMElementDeclaration tagElement, Attr attr) { - CMNamedNodeMap attrs = tagElement.getAttributes(); - for (Iterator it = attrs.iterator();it.hasNext();){ - CMAttributeDeclaration CMAttr = (CMAttributeDeclaration)it.next(); - if (CMAttr.getAttrName().equals(attr.getName())) - return CMAttr; - } - return null; - } - - private MarkupTagInfoProvider getInfoProvider() { - if (fInfoProvider == null) { - fInfoProvider = new MarkupTagInfoProvider(); - } - return fInfoProvider; - } - - private List createProposals(IStructuredDocumentContext context, String uri, Node tagElement, Attr attr) { - List ret = new ArrayList(); - List processors = MetaDataEnabledProcessingFactory.getInstance() - .getAttributeValueRuntimeTypeFeatureProcessors( - IPossibleValues.class, context, uri, - tagElement.getLocalName(), attr.getLocalName()); - - if (processors != null) { - for (int i = 0; i < processors.size(); i++) { - IPossibleValues p = (IPossibleValues) processors.get(i); - ret.addAll(createProposals(p, tagElement, attr)); - } - } - return ret; - } - - private List createProposals(IPossibleValues p, Node tagElement, Attr attr) { - List ret = new ArrayList(); - defaultAdditionalInfo = null; - Iterator it = p.getPossibleValues().iterator(); - while (it.hasNext()) { - IPossibleValue val = (IPossibleValue) it.next(); - if (val != null){ //just in case... - ICompletionProposal proposal = new CustomCompletionProposal( - val.getValue(), //replacement text - getReplacementOffset(), //replacementOffset - getReplacementLength(), //replacementLength - getCursorPosition(val), //cursor pos - getImage(val), //image - val.getDisplayValue(), //display value - null, //IContextInformation - getAdditionalInfo(val,tagElement,attr), //addditional info - XMLRelevanceConstants.R_JSP_ATTRIBUTE_VALUE, //relevance - true); //updateReplace - - ret.add(proposal); - } - } - return ret; - } - - - private String getAdditionalInfo(IPossibleValue val, Node tagElement, Attr attr) { - if (val.getAdditionalInformation() != null) - return val.getAdditionalInformation(); - - return getDefaultAdditionalInfo(tagElement, attr); - } - - private int getReplacementLength() { - return resolver.getRegionText().length() - 2; - } - - private int getCursorPosition(IPossibleValue val) { - //Something changed in 1.5RC2 CustomCompletionProposal - //it appears that the cursor position is now relative to where it is currently - //rather than relative to document - - //return getReplacementOffset() + val.getValue().length(); - return val.getValue().length(); - } - - private int getReplacementOffset() { - return resolver.getStartOffset() + 1; - } - - private Image getImage(IPossibleValue val) { - ImageDescriptor icon = val.getIcon(); - if (icon == null || icon.equals("")){ //$NON-NLS-1$ - return getDefaultAttributeValueImage(); - } - - return getOrCreateImage(icon); - } - - private Image getOrCreateImage(ImageDescriptor icon) { - if (icon == null) - return null; - - Image img = JSFUiPlugin.getDefault().getImageRegistry().get(icon.toString()); - if (img == null){ - try { - img = icon.createImage(); - JSFUiPlugin.getDefault().getImageRegistry().put(icon.toString(), img); - } catch (RuntimeException e) { - // empty block; C.B: handle exception? - } - } - return img; - } - - private Image getDefaultAttributeValueImage() { - if (defaultAttrValImgDesc == null){ - Bundle bundle = Platform.getBundle(JSFUiPlugin.PLUGIN_ID); - URL url= FileLocator.find(bundle,new Path(defaultIconPath ), null); - defaultAttrValImgDesc = ImageDescriptor.createFromURL(url); - } - return getOrCreateImage(defaultAttrValImgDesc); - } - - private Attr getAttribute(IStructuredDocumentContext context) { - final IDOMContextResolver domResolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getDOMContextResolver(context); - - if (domResolver != null) { - final Node curNode = domResolver.getNode(); - - if (curNode instanceof Attr) { - return (Attr) curNode; - } - } - return null; - - } - - public IContextInformation[] computeContextInformation(ITextViewer viewer, - int offset) { - // no context info - return null; - } - - public char[] getCompletionProposalAutoActivationCharacters() { - // auto activate when user hits a '.' - return new char[] { '.' }; - } - - public char[] getContextInformationAutoActivationCharacters() { - // no auto-activation for context info - return null; - } - - public String getErrorMessage() { - // don't flag errors - return null; - } - - public IContextInformationValidator getContextInformationValidator() { - // don't validate context information - return null; - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/contentassist/el/JSFELContentAssistProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/contentassist/el/JSFELContentAssistProcessor.java deleted file mode 100644 index 6bf74bbc6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/contentassist/el/JSFELContentAssistProcessor.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.ui.internal.contentassist.el; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.jface.text.contentassist.IContextInformationValidator; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.core.internal.contentassist.el.ContentAssistParser; -import org.eclipse.jst.jsf.core.internal.contentassist.el.ContentAssistStrategy; -import org.eclipse.jst.jsf.designtime.DTAppManagerUtil; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter.DTELExpression; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.wst.xml.ui.internal.contentassist.ProposalComparator; - -/** - * The content assist processor for JSF EL partitions on attribute values. - * - * @author cbateman - * - */ -public class JSFELContentAssistProcessor implements IContentAssistProcessor -{ - /** - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, - * int) - */ - public ICompletionProposal[] computeCompletionProposals( - final ITextViewer viewer, final int documentPosition) - { - final List<ICompletionProposal> proposals = - new ArrayList<ICompletionProposal>(); - final IStructuredDocumentContext context = - IStructuredDocumentContextFactory.INSTANCE.getContext(viewer, - documentPosition); - if (context != null) - { - final XMLViewDefnAdapter viewAdapter = - DTAppManagerUtil.getXMLViewDefnAdapter(context); - - if (viewAdapter != null) - { - try - { - final DTELExpression elExpression = - viewAdapter.getELExpression(context); - - if (elExpression != null) - { - final ContentAssistStrategy strategy = - ContentAssistParser.getPrefix(documentPosition - - elExpression.getDocumentContext() - .getDocumentPosition() + 1, - elExpression.getText().trim()); - - if (strategy != null) - { - proposals.addAll(strategy.getProposals(context)); - } - Collections.sort(proposals, new ProposalComparator()); - } - } - catch (ViewHandlerException e) - { - JSFUiPlugin.log(IStatus.ERROR, "During el resolution", e); - } - } - } - - return proposals.toArray(new ICompletionProposal[0]); - } - - public IContextInformation[] computeContextInformation( - final ITextViewer viewer, final int offset) - { - // no context info - return null; - } - - public char[] getCompletionProposalAutoActivationCharacters() - { - // auto activate when user hits a '.' - return new char[] - { '.' }; - } - - public char[] getContextInformationAutoActivationCharacters() - { - // no auto-activation for context info - return null; - } - - public String getErrorMessage() - { - // don't flag errors - return null; - } - - public IContextInformationValidator getContextInformationValidator() - { - // don't validate context information - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/IJSFImplLibraryCreationListener.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/IJSFImplLibraryCreationListener.java deleted file mode 100644 index d579d520d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/IJSFImplLibraryCreationListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Justin Chen - development check in - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jsflibraryconfig; - -/** - * Listener interface when a new JSF implementation library is created. - * - * @author Justin Chen - Oracle - * @deprecated - */ -public interface IJSFImplLibraryCreationListener extends java.util.EventListener { - /** - * Ok button is pressed in JSF Library dialog. - * - * @param event - */ - public void okClicked(JSFImplLibraryCreationEvent event); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFImplLibraryCreationEvent.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFImplLibraryCreationEvent.java deleted file mode 100644 index 524e4591b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFImplLibraryCreationEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Justin Chen - development check in - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jsflibraryconfig; - -import java.util.EventObject; - -/** - * JSF Implementation library creation event. - * - * @author Justin Chen - Oracle - * @deprecated - */ -public class JSFImplLibraryCreationEvent extends EventObject { - - private static final long serialVersionUID = 6390319185522362453L; - private boolean isLibCreated; - - /** - * @param source - * @param okClicked - */ - public JSFImplLibraryCreationEvent(Object source, boolean okClicked) { - super(source); - this.isLibCreated = okClicked; - } - - /** - * Ok button pressed. - * - * @return boolean - */ - public boolean isLibraryCreated() { - return isLibCreated; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFLibraryConfigControl.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFLibraryConfigControl.java deleted file mode 100644 index b3bd76746..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFLibraryConfigControl.java +++ /dev/null @@ -1,690 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Justin Chen - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jsflibraryconfig; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.EventObject; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.Vector; - -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.util.SafeRunnable; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryConfigDialogSettingData; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryConfigModel; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryInternalReference; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.project.facet.IJSFFacetInstallDataModelProperties; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.jst.jsf.ui.internal.Messages; -import org.eclipse.jst.jsf.ui.internal.classpath.JSFLibraryWizard; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -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.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper; - -/** - * A custom control used in wizard and property pages. - * - * @author Justin Chen - * @deprecated - */ -public class JSFLibraryConfigControl extends Composite { - - final static private int COLUMN_DEPLOY = 0; - final static private int COLUMN_LIB_NAME = 1; - - private JSFLibraryConfigModel workingCopyModel = null; - - private CheckboxTableViewer ctvSelCompLib; - private TreeViewer tvCompLib; - private TreeViewerAdapter tvAdapter; - private TreeLabelProvider tvLabelProvider; - private Button btnAddAll; - private Button btnRemoveAll; - - private Vector newJSFLibCreatedListeners = new Vector(); - private Set _changeListeners; - private boolean _initing; - private IDataModel model; - - /** - * @param listener - */ - public void addOkClickedListener(IJSFImplLibraryCreationListener listener) { - newJSFLibCreatedListeners.addElement(listener); - } - /** - * @param listener - */ - public void removeOkClickedListener(IJSFImplLibraryCreationListener listener) { - newJSFLibCreatedListeners.removeElement(listener); - } - - /** - * @param listener - */ - public void addChangeListener(JSFLibraryConfigControlChangeListener listener){ - getChangeListeners().add(listener); - } - - /** - * @param listener - */ - public void removeChangeListener(JSFLibraryConfigControlChangeListener listener){ - if (getChangeListeners().contains(listener)) - getChangeListeners().remove(listener); - } - - private Set getChangeListeners() { - if (_changeListeners == null){ - _changeListeners = new HashSet(); - } - return _changeListeners; - } - - private void fireChangedEvent(final EventObject e){ - if (_initing) return; - SafeRunnable.run(new ISafeRunnable(){ - public void handleException(Throwable exception) { - // TODO: should we perhaps do something here? - JSFUiPlugin.log(IStatus.ERROR, exception.getLocalizedMessage()); - } - public void run() throws Exception { - for (Iterator it=getChangeListeners().iterator();it.hasNext();){ - ((JSFLibraryConfigControlChangeListener)it.next()).changed(new JSFLibraryConfigControlChangeEvent(e)); - } - } - }); - } - - /** - * Create the composite - * @param parent - * @param style - */ - public JSFLibraryConfigControl(Composite parent, int style) { - super(parent, style); - _initing = true; - createControls(); - } - - /** - * set control values from provided model. - * - * @param source - */ - public void loadControlValuesFromModel(JSFLibraryConfigDialogSettingData source) { - if (source != null) { - // never read persistentModel = source; - workingCopyModel = JSFLibraryConfigModel.JSFLibraryConfigModelFactory.createInstance(source); - initializeControlValues(); - _initing = false; - } else { - JSFUiPlugin.log(IStatus.ERROR, Messages.JSFLibraryConfigControl_NullProject); - } - - } - - /* (non-Javadoc) - * @see org.eclipse.swt.widgets.Widget#dispose() - */ - public void dispose() { - super.dispose(); - } - - /** - * Return a list of selected JSF Component Libraries. - * Otherwise, return an empty list. - * - * @return a list of selected JSF Component Libraries - */ - public List getSelectedJSFLibComponents() { - return workingCopyModel.getCurrentJSFComponentLibrarySelection(); - } - - /** - * - * @return JSFLibraryConfigModelAdapter - */ - public JSFLibraryConfigModel getWorkingModel() { - return workingCopyModel; - } - - private void initializeControlValues() { - loadJSFCompList(); - - JSFLibraryInternalReference savedCompLib = null; - JSFLibraryInternalReference selected = null; - //Iterator it = persistentModel.getJSFComponentLibraries().iterator(); - Iterator it = workingCopyModel.getJSFComponentLibraries().iterator(); - while (it.hasNext()) { - savedCompLib = (JSFLibraryInternalReference) it.next(); - selected = JSFLibraryRegistryUtil.getInstance().getJSFLibraryReferencebyID(savedCompLib.getID()); - if (selected != null) { - ctvSelCompLib.setChecked(selected, selected.isCheckedToBeDeployed()); - } - } - - setCompListModelProperty(); - - redraw(); - } - - private void loadJSFCompList() { - tvCompLib.setInput(workingCopyModel.getJSFComponentLibraries()); - ctvSelCompLib.setInput(workingCopyModel.getJSFComponentLibraries()); - } - - private void createCompLibControls(Composite parent) { - final Composite cmpCompLibs = new Composite(parent, SWT.NONE); - final GridLayout gridLayoutCompLibs = new GridLayout(); - gridLayoutCompLibs.numColumns = 4; - gridLayoutCompLibs.marginWidth = 0; - gridLayoutCompLibs.marginHeight = 0; - cmpCompLibs.setLayout(gridLayoutCompLibs); - GridData gdComp = new GridData(); - gdComp.horizontalAlignment = SWT.FILL; - gdComp.grabExcessHorizontalSpace = true; - cmpCompLibs.setLayoutData(gdComp); - - tvCompLib = new TreeViewer(cmpCompLibs, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - tvAdapter = new TreeViewerAdapter(); - tvLabelProvider = new TreeLabelProvider(); - tvCompLib.setContentProvider(tvAdapter); - tvCompLib.setLabelProvider(tvLabelProvider); - tvCompLib.addDoubleClickListener(new IDoubleClickListener(){ - public void doubleClick(DoubleClickEvent event) { - resetComponentLibSelection((StructuredSelection)event.getSelection(), - tvCompLib, - ctvSelCompLib, - true); - fireChangedEvent(event); - } - }); - tvCompLib.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - tvCompLib.addFilter(new TreeViewerFilter()); - - final Composite composite_buttons = new Composite(cmpCompLibs, SWT.NONE); - composite_buttons.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); - composite_buttons.setLayout(new GridLayout()); - - final Composite composite_Single = new Composite(composite_buttons, SWT.None); - composite_Single.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - final GridLayout gl_Single = new GridLayout(); - gl_Single.marginHeight = 4; - composite_Single.setLayout(new GridLayout()); - - final Button btnAdd = new Button(composite_Single, SWT.NONE); - btnAdd.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - btnAdd.setText(Messages.JSFLibraryConfigControl_Add); - btnAdd.setEnabled(false); - - final Button btnRemove = new Button(composite_Single, SWT.NONE); - btnRemove.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - btnRemove.setText(Messages.JSFLibraryConfigControl_Remove); - btnRemove.setEnabled(false); - - final Composite composite_All = new Composite(composite_buttons, SWT.None); - composite_All.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - final GridLayout gl_All = new GridLayout(); - gl_Single.marginHeight = 4; - composite_All.setLayout(gl_All); - - btnAddAll = new Button(composite_All, SWT.NONE); - btnAddAll.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - btnAddAll.setText(Messages.JSFLibraryConfigControl_AddAll); - - btnRemoveAll = new Button(composite_All, SWT.NONE); - btnRemoveAll.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - btnRemoveAll.setText(Messages.JSFLibraryConfigControl_RemoveAll); - - final Composite composite_New = new Composite(composite_buttons, SWT.None); - composite_New.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - final GridLayout gl_New = new GridLayout(); - gl_Single.marginHeight = 4; - composite_New.setLayout(gl_New); - - final Button btnNewCompLib = new Button(composite_New, SWT.NONE); - btnNewCompLib.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - btnNewCompLib.setText(Messages.JSFLibraryConfigControl_NewComponentLibrary); - btnNewCompLib.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - JSFLibraryWizard wizard = new JSFLibraryWizard(); - IWorkbench wb = PlatformUI.getWorkbench(); - wizard.init(wb, null); - WizardDialog dialog = new WizardDialog(wb - .getActiveWorkbenchWindow().getShell(), wizard); - int ret = dialog.open(); - if (ret == Window.OK) { - JSFLibraryInternalReference lib = new JSFLibraryInternalReference( - wizard.getJSFLibrary(), - true, - true); - JSFLibraryRegistryUtil.getInstance().addJSFLibrary(lib); - workingCopyModel.getJSFComponentLibraries().add(lib); - - loadJSFCompList(); - setCompListModelProperty(); - ctvSelCompLib.setChecked(lib, true); - } - } - }); - - ctvSelCompLib = CheckboxTableViewer.newCheckList(cmpCompLibs, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER); - ctvSelCompLib.addFilter(new CheckedTableViewerFilter()); - final Table table = ctvSelCompLib.getTable(); - table.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); - table.setHeaderVisible(true); - final TableColumn tcDeploy = new TableColumn(table, SWT.LEFT); - tcDeploy.setWidth(50); - tcDeploy.setText(Messages.JSFLibraryConfigControl_TH_Deploy); - tcDeploy.setToolTipText(Messages.JSFLibraryConfigControl_DeployJAR); - final TableColumn tcLibName = new TableColumn(table, SWT.LEFT); - tcLibName.setWidth(150); - tcLibName.setText(Messages.JSFLibraryConfigControl_TH_LibraryName); - - //ctvSelCompLib.setCellModifier(new CellModifierCTVSelCompLib()); - ctvSelCompLib.setSorter(new SelectedCompLibCTVSorter()); - ctvSelCompLib.setLabelProvider(new SelectedCompLibCTVLabelProvider()); - ctvSelCompLib.setContentProvider(new CompLibCTVContentProvider()); - ctvSelCompLib.addDoubleClickListener(new IDoubleClickListener(){ - public void doubleClick(DoubleClickEvent event) { - resetComponentLibSelection((StructuredSelection)event.getSelection(), - tvCompLib, - ctvSelCompLib, - false); - fireChangedEvent(event); - } - }); - ctvSelCompLib.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - JSFLibraryInternalReference changedItem = (JSFLibraryInternalReference) event.getElement(); - boolean isChecked4Deploy = event.getChecked(); - - List list = workingCopyModel.getJSFComponentLibraries(); - Iterator it = list.iterator(); - JSFLibraryInternalReference crtjsflib = null; - while (it.hasNext()) { - crtjsflib = (JSFLibraryInternalReference) it.next(); - if (crtjsflib.getID().equals(changedItem.getID())) { - crtjsflib.setToBeDeployed(isChecked4Deploy); - fireChangedEvent(event); - break; - } - } - } - }); - - btnAdd.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - resetComponentLibSelection((StructuredSelection)tvCompLib.getSelection(), - tvCompLib, - ctvSelCompLib, - true); - fireChangedEvent(e); - } - }); - - btnAddAll.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - resetCompontLibSelectionAll(tvCompLib, ctvSelCompLib, true); - fireChangedEvent(e); - } - }); - btnRemove.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - resetComponentLibSelection((StructuredSelection)ctvSelCompLib.getSelection(), - tvCompLib, - ctvSelCompLib, - false); - fireChangedEvent(e); - } - }); - - btnRemoveAll.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - resetCompontLibSelectionAll(tvCompLib, ctvSelCompLib, false); - fireChangedEvent(e); - } - }); - - tvCompLib.addSelectionChangedListener(new ISelectionChangedListener(){ - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection sel= (StructuredSelection)event.getSelection(); - btnAdd.setEnabled(!sel.isEmpty() && sel.getFirstElement() instanceof JSFLibraryInternalReference); - btnAddAll.setEnabled(tvCompLib.getTree().getItemCount() > 0); - } - }); - - ctvSelCompLib.addSelectionChangedListener(new ISelectionChangedListener(){ - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection sel= (StructuredSelection)event.getSelection(); - btnRemove.setEnabled(!sel.isEmpty()); - btnRemoveAll.setEnabled(ctvSelCompLib.getTable().getItemCount() > 0); - } - }); - - } - private void createControls() { - setRedraw(true); - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 1; - gridLayout.marginLeft = 0; - gridLayout.marginRight = 0; - gridLayout.marginWidth = 0; - gridLayout.marginTop = 0; - this.setLayout(gridLayout); - - createCompLibControls(this); - } - - /* - * Event handling helper methods - */ - - // Set selected item to the given state on model and update viewers. - private void resetComponentLibSelection(StructuredSelection item, - TreeViewer srcViewer, - CheckboxTableViewer destViewer, - boolean state) { - if (item != null && !item.isEmpty()) { - List selected = new ArrayList(item.size()); - for (Iterator sel=item.iterator();sel.hasNext();){ - JSFLibraryInternalReference jsfLibDctr = (JSFLibraryInternalReference)sel.next(); - selected.add(jsfLibDctr); - List list = workingCopyModel.getJSFComponentLibraries(); - Iterator it = list.iterator(); - JSFLibraryInternalReference crtjsfLibDctr = null; - while(it.hasNext()) { - crtjsfLibDctr = (JSFLibraryInternalReference)it.next(); - if (crtjsfLibDctr.getID().equals(jsfLibDctr.getID())) { - crtjsfLibDctr.setToBeDeployed(state); - crtjsfLibDctr.setSelected(state); - } - } - } - - loadJSFCompList(); - - srcViewer.refresh(); - destViewer.refresh(); - for (Iterator it=selected.iterator();it.hasNext();){ - destViewer.setChecked(it.next(), state); - } - - setCompListModelProperty(); - } - } - - // Reset all component library from given state to model and update viewers. - private void resetCompontLibSelectionAll(TreeViewer srcViewer, - CheckboxTableViewer destViewer, - boolean state) { - - List list = workingCopyModel.getJSFComponentLibraries(); - Iterator it = list.iterator(); - JSFLibraryInternalReference jsfLibDctr; - while(it.hasNext()) { - jsfLibDctr = (JSFLibraryInternalReference)it.next(); - jsfLibDctr.setSelected(state); - jsfLibDctr.setToBeDeployed(state); - } - - loadJSFCompList(); - - srcViewer.refresh(); - destViewer.refresh(); - destViewer.setAllChecked(state); - - btnAddAll.setEnabled(! state); - btnRemoveAll.setEnabled(state); - - setCompListModelProperty(); - } - - //synchHelper is not able to track changes to data elements in tableviewer... manual set of property - private void setCompListModelProperty() { - TableItem[] tableItems = ctvSelCompLib.getTable().getItems(); - List compLibs = new ArrayList(tableItems.length); - for (int i=0;i<tableItems.length;i++){ - compLibs.add(tableItems[i].getData()); - } - JSFLibraryInternalReference[] libs = (JSFLibraryInternalReference[])compLibs.toArray(new JSFLibraryInternalReference[0]); - model.setProperty(IJSFFacetInstallDataModelProperties.COMPONENT_LIBRARIES, libs); - } - - - /** - * Configure the JSFLibraryConfigControl elements to used the containers synchHelper - * @param synchHelper - */ - public void setSynchHelper(DataModelSynchHelper synchHelper) { - model = synchHelper.getDataModel(); - } - - /** - * Inner Classes for filtering. - * - */ - private static class CheckedTableViewerFilter extends ViewerFilter { - public boolean select(Viewer viewer, Object parentElement, Object element) { - if (element instanceof JSFLibraryInternalReference) { - return ((JSFLibraryInternalReference)element).isSelected(); - } - return false; - } - } - private static class TreeViewerFilter extends ViewerFilter { - - public boolean select(Viewer viewer, Object parentElement, Object element) { - if (element instanceof JSFLibraryInternalReference) { - return !((JSFLibraryInternalReference)element).isSelected(); - } - return true; - } - } - - private static class CompLibCTVContentProvider implements IStructuredContentProvider { - private List jsfComplLibs = new ArrayList(0); - - public Object[] getElements(Object inputElement) { - return jsfComplLibs.toArray(); - } - public void dispose() { - // do nothing - } - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - if (newInput == null) { - jsfComplLibs = Collections.EMPTY_LIST; - } else { - jsfComplLibs = (List)newInput; - } - } - } - // Label Provider - private static class SelectedCompLibCTVLabelProvider extends LabelProvider implements ITableLabelProvider { - public String getColumnText(Object element, int columnIndex) { - if (element instanceof JSFLibraryInternalReference){ - - switch(columnIndex) { - case COLUMN_DEPLOY: - return " "; //$NON-NLS-1$ - case COLUMN_LIB_NAME: - return ((JSFLibraryInternalReference)element).getLabel(); - } - } - return ""; //$NON-NLS-1$ - - } - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - } - // Sorter - private static class SelectedCompLibCTVSorter extends ViewerSorter { - public int compare(Viewer viewer, Object e1, Object e2) { - if (e1 instanceof JSFLibraryInternalReference && - e2 instanceof JSFLibraryInternalReference) { - JSFLibraryInternalReference item1 = (JSFLibraryInternalReference)e1; - JSFLibraryInternalReference item2 = (JSFLibraryInternalReference)e2; - return item1.getLabel().compareToIgnoreCase(item2.getLabel()); - } - return 0; - } - } - - /* - * Content provider Adapter for TreeViewer - */ - private class TreeViewerAdapter implements ITreeContentProvider { - private final Object[] NO_ELEMENTS= new Object[0]; - - // ------- ITreeContentProvider Interface ------------ - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // will never happen - } - - public void dispose() { - // do nothing - } - - public Object[] getElements(Object obj) { - return workingCopyModel.getJSFComponentLibraries().toArray(); - } - - public Object[] getChildren(Object element) { - if (element instanceof JSFLibraryInternalReference) { - return ((JSFLibraryInternalReference)element).getArchiveFiles().toArray(); - } - return NO_ELEMENTS; - } - - public Object getParent(Object element) { - return null; - } - - public boolean hasChildren(Object element) { - if (element instanceof JSFLibraryInternalReference) { - return true; - } - return false; - } - - } - - private static class TreeLabelProvider implements ILabelProvider { - private final Image libImg; - private final Image jarImg; - - TreeLabelProvider() - { - ImageDescriptor jarImgDesc = JSFUiPlugin.getImageDescriptor("obj16/jar_obj.gif"); //$NON-NLS-1$ - jarImg = jarImgDesc.createImage(); - ImageDescriptor libImgDesc = JSFUiPlugin.getImageDescriptor("obj16/library_obj.gif"); //$NON-NLS-1$ - libImg = libImgDesc.createImage(); - } - - public Image getImage(Object element) { - if (element instanceof JSFLibraryInternalReference) - { - return libImg; - } - return jarImg; - } - - public String getText(Object element) { - StringBuffer labelBuf = new StringBuffer(); - if (element instanceof JSFLibraryInternalReference) { - JSFLibraryInternalReference libWrapper = (JSFLibraryInternalReference)element; - JSFLibrary lib = libWrapper.getLibrary(); - labelBuf.append(lib.getLabel()); - if (lib.isImplementation()) { - labelBuf.append(" "); //$NON-NLS-1$ - if (lib == JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getDefaultImplementation()) { - labelBuf.append(Messages.JSFLibrariesPreferencePage_DEFAULT_IMPL_DESC); - } else { - labelBuf.append(Messages.JSFLibrariesPreferencePage_IMPL_DESC); - } - } - } - if (element instanceof ArchiveFile) { - ArchiveFile jar = (ArchiveFile)element; - labelBuf.append(jar.getName()); - if (!jar.exists()) - labelBuf.append(Messages.JSFLibrariesPreferencePage_MISSING_DESC); - labelBuf.append(" - ").append(((ArchiveFile)element).getSourceLocation()); //$NON-NLS-1$ - } - return labelBuf.toString(); - } - - public void addListener(ILabelProviderListener listener) { - // not handling listeners - } - - public void dispose() { - if (libImg != null){ - libImg.dispose(); - } - if (jarImg != null){ - jarImg.dispose(); - } - } - - public boolean isLabelProperty(Object element, String property) { - return false; - } - - public void removeListener(ILabelProviderListener listener) { - // not handling listeners - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFLibraryConfigControlChangeEvent.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFLibraryConfigControlChangeEvent.java deleted file mode 100644 index 3ebbb691e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFLibraryConfigControlChangeEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jsflibraryconfig; - -import java.util.EventObject; - -/** - * Event that something has changed in the JSFLibraryConfigControl - * @deprecated - */ -public class JSFLibraryConfigControlChangeEvent { - private EventObject event; - - /** - * Constructor - * @param ev - */ - public JSFLibraryConfigControlChangeEvent(EventObject ev){ - this.event = ev; - } - - /** - * @return java.util.EventObject - */ - public EventObject getEvent(){ - return event; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFLibraryConfigControlChangeListener.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFLibraryConfigControlChangeListener.java deleted file mode 100644 index 6cf386aed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jsflibraryconfig/JSFLibraryConfigControlChangeListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jsflibraryconfig; - - -/** - * Interface to be implemented to listen to changes in the JSFLibraryConfigControl object - * @deprecated - */ -public interface JSFLibraryConfigControlChangeListener { - /** - * Callback method - * @param e - */ - public void changed(JSFLibraryConfigControlChangeEvent e); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/BeanSuffixHyperlink.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/BeanSuffixHyperlink.java deleted file mode 100644 index 798503fd4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/BeanSuffixHyperlink.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jspeditor; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.hyperlink.IHyperlink; -import org.eclipse.jst.jsf.common.util.JDTBeanProperty; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.internal.impl.JavaUtil; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.ui.IEditorPart; - -/** - * Hyperlink for IBeanPropertySymbol and IBeanMethodSymbol el symbols. This Class only exists - * in order to defer determining the (access) method to link to until user actually clicks - * on the link, since determining takes too long. - */ -class BeanSuffixHyperlink implements IHyperlink,ITestHyperlink { - private final IRegion _fRegion; - private final ISymbol _symbol; - - /** - * Creates a BeanSuffixHyperlink for a symbol - * @param region - the region of the hyperlink - * @param symbol - */ - public BeanSuffixHyperlink(final IRegion region, final ISymbol symbol) { - _fRegion = region; - _symbol = symbol; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkRegion() - */ - public IRegion getHyperlinkRegion() { - return _fRegion; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#getTypeLabel() - */ - public String getTypeLabel() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkText() - */ - public String getHyperlinkText() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#open() - */ - public void open() { - final IJavaElement element = determineJavaElement(); - if (element != null) { - try { - final IEditorPart editor = JavaUI.openInEditor(element); - if (editor != null) { - JavaUI.revealInEditor(editor, element); - } - } - catch (final Exception e) { - JSFUiPlugin.log(IStatus.WARNING, e.getMessage(), e); - } - } - } - - public IJavaElement determineJavaElement() { - if (_symbol instanceof IBeanPropertySymbol) { - return determinePropertyElement((IBeanPropertySymbol) _symbol); - } - if (_symbol instanceof IBeanMethodSymbol) { - return JavaUtil.findCorrespondingMethod((IBeanMethodSymbol) _symbol); - } - return null; - } - - private IMethod determinePropertyElement(final IBeanPropertySymbol propertySymbol) { - final JDTBeanProperty property = JavaUtil.findCorrespondingJDTProperty(propertySymbol); - if (property != null) { - if (property.getGetter() != null) { - return property.getGetter(); - } - if (property.getSetter() != null) { - return property.getSetter(); - } - } - return null; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/ELHyperlinkDetector.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/ELHyperlinkDetector.java deleted file mode 100644 index 8201802ac..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/ELHyperlinkDetector.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jspeditor; - -import org.eclipse.jdt.core.IType; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.Region; -import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector; -import org.eclipse.jface.text.hyperlink.IHyperlink; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.core.internal.contentassist.el.SymbolInfo; - -/** - * This HyperlinkDetector creates hyperlinks for symbols in JSF EL expressions - * inside jsp files. - */ -public class ELHyperlinkDetector extends AbstractHyperlinkDetector { - - public final IHyperlink[] detectHyperlinks(final ITextViewer textViewer, - final IRegion region, final boolean canShowMultipleHyperlinks) { - final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE - .getContext(textViewer, region.getOffset()); - return detectHyperlinks(context, region); - } - - /** - * Broken out for testing. - * @param context - * @param region - * @return the hyperlinks - */ - protected IHyperlink[] detectHyperlinks( - final IStructuredDocumentContext context, final IRegion region) { - final Region elRegion = JSPSourceUtil.findELRegion(context); - if (elRegion != null) { - final SymbolInfo symbolInfo = JSPSourceUtil.determineSymbolInfo( - context, elRegion, region.getOffset()); - if (symbolInfo != null) { - IHyperlink link = null; - final Region linkRegion = new Region(symbolInfo - .getRelativeRegion().getOffset() - + elRegion.getOffset(), symbolInfo.getRelativeRegion() - .getLength()); - final ISymbol symbol = symbolInfo.getSymbol(); - if (symbol instanceof IBeanInstanceSymbol) { - link = createBeanInstanceLink(linkRegion, - (IBeanInstanceSymbol) symbol); - } else if (symbol instanceof IBeanPropertySymbol) { - link = createBeanPropertyLink(linkRegion, - (IBeanPropertySymbol) symbol); - } else if (symbol instanceof IBeanMethodSymbol) { - link = createMethodLink(linkRegion, - (IBeanMethodSymbol) symbol); - } - if (link != null) { - return new IHyperlink[] { link }; - } - } - } - return null; - } - - private IHyperlink createBeanInstanceLink(final Region region, - final IBeanInstanceSymbol symbol) { - if (symbol.isTypeResolved()) { - final IType type = symbol.getJavaTypeDescriptor().getType(); - return new JavaElementHyperlink(region, type); - } - return null; - } - - private IHyperlink createBeanPropertyLink(final Region region, - final IBeanPropertySymbol symbol) { - // defer calculation of access method until user click on link (takes - // too long otherwise): - return new BeanSuffixHyperlink(region, symbol); - } - - private IHyperlink createMethodLink(final Region region, - final IBeanMethodSymbol symbol) { - // defer calculation of access method until user click on link (takes - // too long otherwise): - return new BeanSuffixHyperlink(region, symbol); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/ITestHyperlink.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/ITestHyperlink.java deleted file mode 100644 index 9fc86e7d6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/ITestHyperlink.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jspeditor; - -import org.eclipse.jdt.core.IJavaElement; - -/** - * Test-only interface. Not for normal use. - * - * @author cbateman - * - */ -public interface ITestHyperlink { - /** - * @return the java element for symbol2 or null if none. - */ - public IJavaElement determineJavaElement(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/JSFELHover.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/JSFELHover.java deleted file mode 100644 index 639cee731..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/JSFELHover.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jspeditor; - -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITextHover; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.Region; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.context.symbol.IDescribedInDetail; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.core.internal.contentassist.el.SymbolInfo; - -/** This class creates hovers for ISymbols in an el expression that have a detailedDescription. - */ -public class JSFELHover implements ITextHover { - - private ISymbol hoveredSymbol = null; - - public final String getHoverInfo(final ITextViewer textViewer, final IRegion hoverRegion) { - return getHoverInfo(); - } - - /** - * For testing - * - * @return the hover info - */ - protected String getHoverInfo() - { - // hoveredSymbol set by getHoverRegion, which is called first - if (hoveredSymbol instanceof IDescribedInDetail) { - return ((IDescribedInDetail) hoveredSymbol).getDetailedDescription(); - } - return null; - } - - public final IRegion getHoverRegion(final ITextViewer textViewer, final int documentPosition) { - final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE.getContext(textViewer, - documentPosition); - return getHoverRegion(context, documentPosition); - } - - /** - * For testing - * - * @param context - * @param documentPosition - * @return the hover region - */ - protected IRegion getHoverRegion(final IStructuredDocumentContext context, final int documentPosition) - { - hoveredSymbol = null; - final Region elRegion = JSPSourceUtil.findELRegion(context); - if (elRegion != null) { - final SymbolInfo symbolInfo = JSPSourceUtil.determineSymbolInfo(context, elRegion, documentPosition); - if (symbolInfo == null) { - return null; - } - final Region relativeRegion = symbolInfo.getRelativeRegion(); - final Region symbolRegion = new Region(elRegion.getOffset() - + relativeRegion.getOffset(), relativeRegion.getLength()); - hoveredSymbol = symbolInfo.getSymbol(); - return symbolRegion; - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/JSPSourceUtil.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/JSPSourceUtil.java deleted file mode 100644 index 654f42fa1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/JSPSourceUtil.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jspeditor; - -import org.eclipse.jface.text.Region; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.core.internal.contentassist.el.ContentAssistParser; -import org.eclipse.jst.jsf.core.internal.contentassist.el.SymbolInfo; -import org.eclipse.jst.jsf.designtime.DTAppManagerUtil; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter.DTELExpression; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; - -/** - * Utility class to access EL symbols in jsp file. - */ -public final class JSPSourceUtil -{ - - private JSPSourceUtil() - { - // utility class, no instances. - } - - /** - * Find the Region - * - * @param context - - * the IStructuredDocumentContext - * @return region of el expression, null if context doesn't point to an el - * expression - */ - public static Region findELRegion(final IStructuredDocumentContext context) - { - if (context != null) - { - final DTELExpression expression = getELExpression(context); - if (expression != null) - { - final ITextRegionContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getTextRegionResolver(expression.getDocumentContext()); - - if (resolver != null) - { - final String regionType = resolver.getRegionType(); - - if (regionType != null) - { - - if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) - { - return new Region(expression.getDocumentContext() - .getDocumentPosition(), expression - .getText().length()); - } - else if (resolver.matchesRelative(new String[] - { DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE })) - { - return new Region(resolver.getStartOffset(), - resolver.getLength()); - } - } - } - } - } - return null; - } - - /** - * Determines symbol and symbol region at a given document position - * - * @param context - - * the IStructuredDocumentContext - * @param elRegion - - * the region of the el expression to consider - * @param documentPosition - - * the document position to get the symbol for - * @return SymbolInfo - */ - public static SymbolInfo determineSymbolInfo( - final IStructuredDocumentContext context, final Region elRegion, - final int documentPosition) - { - if (context != null && elRegion != null) - { - final DTELExpression elExpression = getELExpression(context); - - final String elText = elExpression.getText().trim(); -// context.getStructuredDocument().get( -// elRegion.getOffset(), elRegion.getLength()); - final SymbolInfo symbolInfo = - ContentAssistParser.getSymbolInfo(context, - documentPosition - elRegion.getOffset() + 1, - elText); - return symbolInfo; - } - return null; - } - - private static DTELExpression getELExpression( - final IStructuredDocumentContext context) - { - final XMLViewDefnAdapter adapter = DTAppManagerUtil - .getXMLViewDefnAdapter(context); - DTELExpression expression = null; - if (adapter != null) - { - try - { - expression = adapter.getELExpression(context); - } - catch (ViewHandlerException e) - { - expression = null; - } - } - return expression; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/JavaElementHyperlink.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/JavaElementHyperlink.java deleted file mode 100644 index 7d77ce805..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/jspeditor/JavaElementHyperlink.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.jspeditor; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.hyperlink.IHyperlink; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.ui.IEditorPart; - -/** - * Hyperlink for a IJavaElement to the corresponding java source - */ -class JavaElementHyperlink implements IHyperlink, ITestHyperlink { - private final IRegion fRegion; - private final IJavaElement fElement; - - /**Creates a new hyperlink for a given IJavaElement - * @param region - region of the hyperlink - * @param element - hyperlink links to the source of <code>element</code> - */ - public JavaElementHyperlink(final IRegion region, final IJavaElement element) { - fRegion = region; - fElement = element; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkRegion() - */ - public IRegion getHyperlinkRegion() { - return fRegion; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#getTypeLabel() - */ - public String getTypeLabel() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkText() - */ - public String getHyperlinkText() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#open() - */ - public void open() { - try { - final IEditorPart editor = JavaUI.openInEditor(fElement); - if (editor != null) { - JavaUI.revealInEditor(editor, fElement); - } - } - catch (final Exception e) { - JSFUiPlugin.log(IStatus.WARNING, e.getMessage(), e); - } - } - - public IJavaElement determineJavaElement() { - return fElement; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/messages.properties deleted file mode 100644 index ba5b6e2fe..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/messages.properties +++ /dev/null @@ -1,91 +0,0 @@ -############################################################################### -# Copyright (c) 2005 Oracle Corporation. -# All rights reserved. This program and the accompanying materials -# are 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: -# Gerry Kessler - initial API and implementation -# Ian Trimble - change key names for use with org.eclipse.osgi.util.NLS -############################################################################### -JSFFacetInstallPage_title=JSF Capabilities -JSFFacetInstallPage_description=Add JSF capabilities to this Web Project -JSFFacetInstallPage_JSFImplLabel=JSF &Implementation: -JSFFacetInstallPage_Add1=A&dd... -JSFFacetInstallPage_Add2=&Add... -JSFFacetInstallPage_DeployJarsLabel=&Deploy jars to WEB-INF/lib -JSFFacetInstallPage_JSFConfigLabel=JSF &Configuration File: -JSFFacetInstallPage_JSFServletNameLabel=JSF &Servlet Name: -JSFFacetInstallPage_JSFServletClassNameLabel=JSF Servlet C&lassname: -JSFFacetInstallPage_JSFURLMappingLabel=&URL Mapping Patterns: -JSFFacetInstallPage_JSFImplementationLibrariesFrame=JSF Implementation Library -JSFFacetInstallPage_JSFComponentLibrariesFrame=Component Libraries -JSFFacetInstallPage_PatternDialogTitle=Specify URL Pattern -JSFFacetInstallPage_PatternDialogDesc=URL Pattern -JSFFacetInstallPage_Remove=&Remove -JSFFacetInstallPage_PatternEmptyMsg=Pattern must not be empty -JSFFacetInstallPage_PatternSpecifiedMsg=Pattern is already specified -JSFFacetInstallPage_ErrorNoWebAppDataModel=Unable to locate WebApp datamodel - -JSFLibrariesPreferencePage_DefinedJSFLibraries=Defined JSF Libraries: -JSFLibrariesPreferencePage_DEFAULT_IMPL_DESC=[implementation - default] -JSFLibrariesPreferencePage_New=New... -JSFLibrariesPreferencePage_Edit=Edit... -JSFLibrariesPreferencePage_Remove=Remove -JSFLibrariesPreferencePage_CannotRemovePluginProvidedTitle=Cannot Remove -JSFLibrariesPreferencePage_CannotRemovePluginProvidedMessage=Plugin provided libraries cannot be removed from the registry -JSFLibrariesPreferencePage_MakeDefault=Make Default -JSFLibrariesPreferencePage_MISSING_DESC=[missing] -JSFLibrariesPreferencePage_Description=JSF Libraries contain jars with JSF components and tag libraries. Some JSF Libraries can be specially marked as implementations so that the WebApp can be executed. -JSFLibrariesPreferencePage_IMPL_DESC=[implementation] -JSFLibrariesPreferencePage_CannotModifyPluginProvidedTitle=Cannot Modify -JSFLibraryPropertyPage_No_JSF_Implementation_Lib_Selected=No JSF implementation library selected. -JSFLibrariesPreferencePage_CannotModifyPluginProvidedMessage=Plugin provided libraries cannot be edited - -JSFLibraryContainerWizardPage_PageName=Add JSF Library -JSFLibraryContainerWizardPage_Title=JSF Library -JSFLibraryContainerWizardPage_Description=Select JavaServer Face Libraries to add to the classpath -JSFLibraryContainerWizardPage_WarningNoJSFFacet=JavaServer Face Libraries can only be configured for Dynamic Web projects with the JSF facet installed. -JSFLibraryContainerWizardPage_JSFLibraries=JSF Libraries: -JSFLibraryContainerWizardPage_Add=Add... -JSFLibraryWizard_JSFLibraryWizard_DontShowThisAgain_CheckBoxLabel=Do not show this message again (affects all listed projects) -JSFLibraryContainerWizardPage_EditLibrary_DescriptionText=Select JSF Library for this reference to use. Choose 'Edit...' to modify contents of the selected library. -JSFLibraryContainerWizardPage_Edit=Edit... -JSFLibraryContainerWizardPage_ImplAlreadyPresent=An implementation has already been chosen. Please remove before adding different one -JSFLibraryContainerWizardPage_ErrorInitializing=Error during initialization -JSFLibraryContainerWizardPage_SelectOneImpl=Choose only one implementation - -JSFLibraryWizard_DESCRIPTION=Create a library of jars that make up a JSF component library. -JSFLibraryWizard_CreateJSFLibrary=Create JSF Library -JSFLibraryWizard_EditJSFLibrary=Edit JSF Library -JSFLibraryWizard_JSFLibrary=JSF Library -JSFLibraryWizard_LibraryName=Library &Name: -JSFLibraryWizard_VersionSupported=&Version Supported: -JSFLibraryWizard_LibraryJars=Library &Jars -JSFLibraryWizard_DeployJars=&Deploy Jars -JSFLibraryWizard_Add=&Add... -JSFLibraryWizard_Remove=&Remove -JSFLibraryWizard_ExtJarFileDialogTitle=Browse for Jars/Zips -JSFLibraryWizard_ValidateNoJars=The library must contain at least one jar. -JSFLibraryWizard_ValidateNoLibraryName=A library name must be supplied. -JSFLibraryWizard_ValidateExistingLibraryName=A library or implementation by this name already exists. -JSFLibraryConfigControl_ImplementationLibrary=Implementation Library -JSFLibraryPropertyPage_No_JSF_Facet_Installed=JSF Facet not installed. -JSFLibraryConfigControl_DeployJAR=Deploy jars to WEB-INF/lib -JSFLibraryConfigControl_Add=\ \ > -JSFLibraryConfigControl_Remove=\ \ < -JSFLibraryConfigControl_AddAll=\ \ >> -JSFLibraryConfigControl_RemoveAll=\ \ << -JSFLibraryConfigControl_NewComponentLibrary=New... -JSFLibraryConfigControl_TH_Deploy=Deploy -JSFLibraryConfigControl_NullProject=No project specified. -JSFLibraryConfigControl_TH_LibraryName=Library Name - -JSFValidationPreferencePage_ELPrefPanel_Title=Expression Language (EL) Validation -JSFValidationPreferencePage_ELPrefPanel_BuildValidationCheckBoxTitle=Validate EL on &Build/Run Validation -JSFValidationPreferencePage_ELPrefPanel_IncrementalValidationCheckBoxTitle= Validate EL as &you type (may be slow on some pages) - -JSFLibraryEditControl_ImplVersion_UNKNOWN=UNKNOWN - -JSFPreferences_RootPage_Description=Expand the tree to edit preferences for a specific feature.
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/EmptyRootPreferencePage.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/EmptyRootPreferencePage.java deleted file mode 100644 index d269dd275..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/EmptyRootPreferencePage.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * Oracle - adapted for JSF tooling - * - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.preferences; - -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jst.jsf.ui.internal.Messages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -/** - * The empty pref page used as the root of all other JSF feature preference pages - * under the Web&XML top-level pref page - * - * @author cbateman - * - */ -public class EmptyRootPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - - private Composite createComposite(Composite parent, int numColumns) { - noDefaultAndApplyButton(); - - Composite composite = new Composite(parent, SWT.NULL); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(GridData.FILL); - data.horizontalIndent = 0; - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - - return composite; - } - - protected Control createContents(Composite parent) { - Composite composite = createScrolledComposite(parent); - - String description = Messages.JSFPreferences_RootPage_Description; - Text text = new Text(composite, SWT.READ_ONLY); - // some themes on GTK have different background colors for Text and Labels - text.setBackground(composite.getBackground()); - text.setText(description); - - setSize(composite); - return composite; - } - - private Composite createScrolledComposite(Composite parent) { - // create scrollbars for this parent when needed - final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); - sc1.setLayoutData(new GridData(GridData.FILL_BOTH)); - Composite composite = createComposite(sc1, 1); - sc1.setContent(composite); - - // not calling setSize for composite will result in a blank composite, - // so calling it here initially - // setSize actually needs to be called after all controls are created, - // so scrolledComposite - // has correct minSize - setSize(composite); - return composite; - } - - public void init(IWorkbench workbench) { - // do nothing - } - - private void setSize(Composite composite) { - if (composite != null) { - // Note: The font is set here in anticipation that the class inheriting - // this base class may add widgets to the dialog. setSize - // is assumed to be called just before we go live. - applyDialogFont(composite); - Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); - composite.setSize(minSize); - // set scrollbar composite's min size so page is expandable but - // has scrollbars when needed - if (composite.getParent() instanceof ScrolledComposite) { - ScrolledComposite sc1 = (ScrolledComposite) composite.getParent(); - sc1.setMinSize(minSize); - sc1.setExpandHorizontal(true); - sc1.setExpandVertical(true); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/JSPTagRegistryPreferencePage.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/JSPTagRegistryPreferencePage.java deleted file mode 100644 index c0cc32379..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/JSPTagRegistryPreferencePage.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.preferences; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.jsf.common.internal.policy.OrderedListProvider; -import org.eclipse.jst.jsf.common.internal.policy.OrderedListProvider.OrderableObject; -import org.eclipse.jst.jsf.common.ui.internal.preferences.StrategyOrderingPanel; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory; -import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory.TagRegistryFactoryException; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.TLDRegistryManager; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.TLDRegistryPreferences; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.TLDRegistryPreferences.StrategyIdentifier; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -/** - * Preferences for the JSP tag registry. - * - * @author cbateman - * - */ -public class JSPTagRegistryPreferencePage extends PreferencePage implements - IWorkbenchPreferencePage -{ - private final TLDRegistryPreferences _tldRegistryPreferences; - private StrategyOrderingPanel _panel; - private OrderedListProvider _provider; - - /** - * Default constructor: required by the preference page - */ - public JSPTagRegistryPreferencePage() - { - _tldRegistryPreferences = new TLDRegistryPreferences( - getPreferenceStore()); - _tldRegistryPreferences.load(); - } - - @Override - protected Control createContents(final Composite parent) - { - _provider = _tldRegistryPreferences.getOrderedListProvider(); - _panel = new StrategyOrderingPanel( - _provider, - new MyLabelProvider(), - Messages.JSPTagRegistryPreferencePage_PanelDescription); - final Control contents = _panel.createContents(parent); - _panel.refresh(); - return contents; - } - - public void init(final IWorkbench workbench) - { - // do nothing - } - - protected void performApply() - { - if (_tldRegistryPreferences.isDirty()) - { - final MessageDialogWithToggle dialog = - MessageDialogWithToggle.openOkCancelConfirm(getShell(), - Messages.JSPTagRegistryPreferencePage_0, - Messages.JSPTagRegistryPreferencePage_1, - Messages.JSPTagRegistryPreferencePage_2, false, null, null); - - if (dialog.getReturnCode() == Window.OK) - { - _tldRegistryPreferences.commit(getPreferenceStore()); - final TagRegistryFactory myRegistryFactory = new TLDRegistryManager.MyRegistryFactory(); - for (final IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) - { - if (project.isAccessible() - && myRegistryFactory.isInstance(project)) - { - try - { - final ITagRegistry tagRegistry = - myRegistryFactory.createTagRegistry(project); - tagRegistry.refresh(null, dialog.getToggleState()); - } - catch (TagRegistryFactoryException e) - { - JSFUiPlugin.log(IStatus.ERROR, "Error getting JSP tag registry on project: "+project.getName(), e); //$NON-NLS-1$ - } - } - } - } - } - } - - protected void performDefaults() - { - _tldRegistryPreferences.setDefaults(); - //_provider.setStrategies(_tldRegistryPreferences.getStrategyIdOrdering()); - _panel.refresh(); - super.performDefaults(); - } - - public boolean performOk() - { - performApply(); - return true; - } - - @Override - protected IPreferenceStore doGetPreferenceStore() - { - return JSFCorePlugin.getDefault().getPreferenceStore(); - } - - - private static class MyLabelProvider extends LabelProvider implements - ITableLabelProvider - { - public Image getColumnImage(final Object element, final int columnIndex) - { - // no image. - return null; - } - - public String getColumnText(final Object element, final int columnIndex) - { - switch (columnIndex) - { - case 0: - if (element instanceof OrderableObject) - { - return ((StrategyIdentifier)(((OrderableObject) element).getObject())).getDisplayName(); - } - default: - Assert.isTrue(false); - return null; - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/Messages.java deleted file mode 100644 index d060193b5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.eclipse.jst.jsf.ui.internal.preferences; - -import org.eclipse.osgi.util.NLS; - -/** - * NLS messages - * @author cbateman - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.ui.internal.preferences.messages"; //$NON-NLS-1$ - /** - * see messages.properties - */ - public static String JSPTagRegistryPreferencePage_0; - /** - * see messages.properties - */ - public static String JSPTagRegistryPreferencePage_1; - /** - * see messages.properties - */ - public static String JSPTagRegistryPreferencePage_2; - /** - * see messages.properties - */ - public static String JSPTagRegistryPreferencePage_PanelDescription; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/messages.properties deleted file mode 100644 index 1cc72c580..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/preferences/messages.properties +++ /dev/null @@ -1,4 +0,0 @@ -JSPTagRegistryPreferencePage_0=Registry must be refreshed -JSPTagRegistryPreferencePage_1=Committing this changes will require that the TLD tag registry is refreshed -JSPTagRegistryPreferencePage_2=Flush caches -JSPTagRegistryPreferencePage_PanelDescription=Set the order in which tag resolvers are consulted when constructing the JSP tag registry diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/project/facet/JSFFacetInstallPage.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/project/facet/JSFFacetInstallPage.java deleted file mode 100644 index ed686320c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/project/facet/JSFFacetInstallPage.java +++ /dev/null @@ -1,467 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.project.facet; - -import java.util.Iterator; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.DialogSettings; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.dialogs.IInputValidator; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi; -import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties; -import org.eclipse.jst.jsf.core.internal.project.facet.IJSFFacetInstallDataModelProperties; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.jst.jsf.ui.internal.Messages; -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.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage; -import org.eclipse.wst.common.project.facet.ui.IWizardContext; - -/** - * JSF Facet installation wizard page. - * - * @author Gerry Kessler - Oracle - */ -public class JSFFacetInstallPage extends DataModelWizardPage implements - IJSFFacetInstallDataModelProperties, IFacetWizardPage { - // UI - private Label lblJSFConfig; - private Text txtJSFConfig; - private Label lblJSFServletName; - private Text txtJSFServletName; - private Label lblJSFServletClassName; - private Text txtJSFServletClassName; - private Label lblJSFServletURLPatterns; - private List lstJSFServletURLPatterns; - private Button btnAddPattern; - private Button btnRemovePattern; - - private IDialogSettings dialogSettings; - private IDataModel webAppDataModel; - private static final String SETTINGS_ROOT = JSFUiPlugin.PLUGIN_ID - + ".jsfFacetInstall"; //$NON-NLS-1$ - private static final String SETTINGS_CONFIG = "configPath"; //$NON-NLS-1$ - private static final String SETTINGS_SERVLET = "servletName"; //$NON-NLS-1$ - private static final String SETTINGS_SERVLET_CLASSNAME = "servletClassname"; //$NON-NLS-1$ - private static final String SETTINGS_URL_MAPPINGS = "urlMappings"; //$NON-NLS-1$ - private static final String SETTINGS_URL_PATTERN = "pattern"; //$NON-NLS-1$ - - // private String projectName = null; - private Composite composite = null; - - /** - * Zero argument constructor - */ - public JSFFacetInstallPage() { - // FIXME: following WebFacetInstallPage pattern which will be fixed at somepoint - super(DataModelFactory.createDataModel(new AbstractDataModelProvider() {/* - * do - * nothing - */ - }), "jsf.facet.install.page"); //$NON-NLS-1$ - setTitle(Messages.JSFFacetInstallPage_title); - setDescription(Messages.JSFFacetInstallPage_description); - dialogSettings = JSFUiPlugin.getDefault().getDialogSettings(); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite) - */ - protected Composite createTopLevelComposite(final Composite parent) { - initializeDialogUnits(parent); - composite = new Composite(parent, SWT.NONE); - final GridLayout jsfCompositeLayout = new GridLayout(3, false); - jsfCompositeLayout.marginTop = 0; - jsfCompositeLayout.marginBottom = 0; - jsfCompositeLayout.marginRight = 0; - jsfCompositeLayout.marginLeft = 0; - composite.setLayout(jsfCompositeLayout); - - final LibraryInstallDelegate librariesInstallDelegate - = (LibraryInstallDelegate) getDataModel().getProperty( LIBRARY_PROVIDER_DELEGATE ); - - final Control librariesComposite - = LibraryProviderFrameworkUi.createInstallLibraryPanel( composite, librariesInstallDelegate, - Messages.JSFFacetInstallPage_JSFImplementationLibrariesFrame ); - - GridData gd = new GridData( GridData.FILL_HORIZONTAL ); - gd.horizontalSpan = 3; - - librariesComposite.setLayoutData( gd ); - - final Label spacer = new Label( composite, SWT.NONE ); - spacer.setText( "" ); - - gd = new GridData( GridData.FILL_HORIZONTAL ); - gd.horizontalSpan = 3; - - spacer.setLayoutData( gd ); - - lblJSFConfig = new Label(composite, SWT.NONE); - lblJSFConfig.setText(Messages.JSFFacetInstallPage_JSFConfigLabel); - lblJSFConfig.setLayoutData(new GridData(GridData.BEGINNING)); - - txtJSFConfig = new Text(composite, SWT.BORDER); - GridData gd1 = new GridData(GridData.FILL_HORIZONTAL); - gd1.horizontalSpan = 2; - txtJSFConfig.setLayoutData(gd1); - - lblJSFServletName = new Label(composite, SWT.NONE); - lblJSFServletName - .setText(Messages.JSFFacetInstallPage_JSFServletNameLabel); - lblJSFServletName.setLayoutData(new GridData(GridData.BEGINNING)); - - txtJSFServletName = new Text(composite, SWT.BORDER); - GridData gd2 = new GridData(GridData.FILL_HORIZONTAL); - gd2.horizontalSpan = 2; - txtJSFServletName.setLayoutData(gd2); - - lblJSFServletClassName = new Label(composite, SWT.NONE); - lblJSFServletClassName - .setText(Messages.JSFFacetInstallPage_JSFServletClassNameLabel); - lblJSFServletClassName.setLayoutData(new GridData(GridData.BEGINNING)); - - txtJSFServletClassName = new Text(composite, SWT.BORDER); - GridData gd2c = new GridData(GridData.FILL_HORIZONTAL); - gd2c.horizontalSpan = 2; - txtJSFServletClassName.setLayoutData(gd2c); - - lblJSFServletURLPatterns = new Label(composite, SWT.NULL); - lblJSFServletURLPatterns - .setText(Messages.JSFFacetInstallPage_JSFURLMappingLabel); - lblJSFServletURLPatterns.setLayoutData(new GridData(GridData.BEGINNING - | GridData.VERTICAL_ALIGN_BEGINNING)); - lstJSFServletURLPatterns = new List(composite, SWT.BORDER); - GridData gd3 = new GridData(GridData.FILL_HORIZONTAL); - gd3.heightHint = convertHeightInCharsToPixels(5); - lstJSFServletURLPatterns.setLayoutData(gd3); - lstJSFServletURLPatterns.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - btnRemovePattern.setEnabled(lstJSFServletURLPatterns - .getSelectionCount() > 0); - } - }); - - Composite btnComposite = new Composite(composite, SWT.NONE); - GridLayout gl = new GridLayout(1, false); - // gl.marginBottom = 0; - // gl.marginTop = 0; - // gl.marginRight = 0; - gl.marginLeft = 0; - btnComposite.setLayout(gl); - btnComposite.setLayoutData(new GridData(GridData.END - | GridData.VERTICAL_ALIGN_FILL)); - - btnAddPattern = new Button(btnComposite, SWT.NONE); - btnAddPattern.setText(Messages.JSFFacetInstallPage_Add2); - btnAddPattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL - | GridData.VERTICAL_ALIGN_BEGINNING)); - btnAddPattern.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - InputDialog dialog = new InputDialog(getShell(), - Messages.JSFFacetInstallPage_PatternDialogTitle, - Messages.JSFFacetInstallPage_PatternDialogDesc, null, - new IInputValidator() { - - public String isValid(String newText) { - return isValidPattern(newText); - } - - }); - dialog.open(); - if (dialog.getReturnCode() == Window.OK) { - addItemToList(dialog.getValue(), true); - } - } - }); - - btnRemovePattern = new Button(btnComposite, SWT.NONE); - btnRemovePattern.setText(Messages.JSFFacetInstallPage_Remove); - btnRemovePattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL - | GridData.VERTICAL_ALIGN_BEGINNING)); - btnRemovePattern.setEnabled(false); - btnRemovePattern.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - removeItemFromList(lstJSFServletURLPatterns.getSelection()); - btnRemovePattern.setEnabled(false); - } - }); - - addModificationListeners(); - - this.getContainer().getShell().pack(); - - return composite; - } - - private void initializeValues() { - IDialogSettings root = dialogSettings.getSection(SETTINGS_ROOT); - - initJSFCfgCtrlValues(root); - - String conf = null; - if (root != null) - conf = root.get(SETTINGS_CONFIG); - if (conf == null || conf.equals("")) { //$NON-NLS-1$ - conf = (String) model - .getDefaultProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH); - } - txtJSFConfig.setText(conf); - - String servletName = null; - if (root != null) - servletName = root.get(SETTINGS_SERVLET); - if (servletName == null || servletName.equals("")) { //$NON-NLS-1$ - servletName = (String) model - .getDefaultProperty(IJSFFacetInstallDataModelProperties.SERVLET_NAME); - } - txtJSFServletName.setText(servletName); - - String servletClassname = null; - if (root != null) - servletClassname = root.get(SETTINGS_SERVLET_CLASSNAME); - if (servletClassname == null || servletClassname.equals("")) { //$NON-NLS-1$ - servletClassname = (String) model - .getDefaultProperty(IJSFFacetInstallDataModelProperties.SERVLET_CLASSNAME); - } - txtJSFServletClassName.setText(servletClassname); - - loadURLMappingPatterns(root); - } - - private void initJSFCfgCtrlValues(IDialogSettings root) { - /*IDialogSettings complibs = null; - if (root != null) { - complibs = root.getSection(SETTINGS_COMPLIB); - } - - String[] selection = null; - if (complibs != null) { - selection = complibs.getArray(SETTINGS_COMPLIB_SELECT_DEPLOY); - } - - JSFLibraryConfigDialogSettingData source = new JSFLibraryConfigDialogSettingData(selection); - jsfLibCfgComp.loadControlValuesFromModel(source);*/ - } - - - private void saveSettings() { - DialogSettings root = new DialogSettings(SETTINGS_ROOT); - dialogSettings.addSection(root); - - root.put(SETTINGS_CONFIG, getJSFConfig()); - root.put(SETTINGS_SERVLET, getJSFServletName()); - root.put(SETTINGS_SERVLET_CLASSNAME, getJSFServletClassname()); - DialogSettings mappings = new DialogSettings(SETTINGS_URL_MAPPINGS); - root.addSection(mappings); - mappings.put(SETTINGS_URL_PATTERN, getJSFPatterns()); - } - - private String getJSFConfig() { - return txtJSFConfig.getText().trim(); - } - - private String getJSFServletName() { - return txtJSFServletName.getText().trim(); - } - - private String getJSFServletClassname() { - return txtJSFServletClassName.getText().trim(); - } - - private String[] getJSFPatterns() { - return lstJSFServletURLPatterns.getItems(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.project.facet.ui.IFacetWizardPage#setConfig(java.lang.Object) - */ - public void setConfig(Object config) { - model.removeListener(this); - synchHelper.dispose(); - - model = (IDataModel) config; - model.addListener(this); - synchHelper = initializeSynchHelper(model); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.project.facet.ui.IFacetWizardPage#transferStateToConfig() - */ - public void transferStateToConfig() { - saveSettings(); // convenient place for this. don't want to save if user - // cancelled. - } - - private void addModificationListeners() { - synchHelper.synchText(txtJSFConfig, CONFIG_PATH, null); - synchHelper.synchText(txtJSFServletName, SERVLET_NAME, null); - synchHelper.synchText(txtJSFServletClassName, SERVLET_CLASSNAME, null); - synchHelper.synchList(lstJSFServletURLPatterns, SERVLET_URL_PATTERNS, null); - } - - private String isValidPattern(String value) { - if (value == null || value.trim().equals("")) //$NON-NLS-1$ - return Messages.JSFFacetInstallPage_PatternEmptyMsg; - if (lstJSFServletURLPatterns.indexOf(value) >= 0) - return Messages.JSFFacetInstallPage_PatternSpecifiedMsg; - - return null; - } - - private void loadURLMappingPatterns(IDialogSettings root) { - lstJSFServletURLPatterns.removeAll(); - IDialogSettings mappings = null; - if (root != null) - mappings = root.getSection(SETTINGS_URL_MAPPINGS); - String[] patterns = null; - if (mappings != null) - patterns = mappings.getArray(SETTINGS_URL_PATTERN); - - if (patterns == null || patterns.length == 0) { - patterns = (String[]) model - .getDefaultProperty(IJSFFacetInstallDataModelProperties.SERVLET_URL_PATTERNS); - } - for (int i = 0; i < patterns.length; i++) { - addItemToList(patterns[i], false); - } - } - - private void addItemToList(String pattern, boolean selectMe) { - lstJSFServletURLPatterns.add(pattern == null ? "" : pattern); //$NON-NLS-1$ - if (pattern == null && selectMe) - lstJSFServletURLPatterns.setSelection(lstJSFServletURLPatterns - .getItemCount() - 1); - // When 119321 is fixed - remove code below - updateModelForURLPattern(); - } - - private void removeItemFromList(String[] selection) { - for (int i = 0; i < selection.length; i++) { - String sel = selection[i]; - lstJSFServletURLPatterns.remove(sel); - } - // When 119321 is fixed - remove code below - updateModelForURLPattern(); - } - - private void updateModelForURLPattern() { - model.setProperty( - IJSFFacetInstallDataModelProperties.SERVLET_URL_PATTERNS, - lstJSFServletURLPatterns.getItems()); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage#getValidationPropertyNames() - */ - protected String[] getValidationPropertyNames() { - return new String[] { CONFIG_PATH, SERVLET_NAME, SERVLET_CLASSNAME, COMPONENT_LIBRARIES, LIBRARY_PROVIDER_DELEGATE }; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.project.facet.ui.IFacetWizardPage#setWizardContext(org.eclipse.wst.common.project.facet.ui.IWizardContext) - */ - public void setWizardContext(IWizardContext context) { - // hook into web datamodel if new project wizard. - Iterator it = context.getSelectedProjectFacets().iterator(); - IProjectFacetVersion webFacetVersion = null; - while (it.hasNext()) { - // find Web facet - IProjectFacetVersion pfv = (IProjectFacetVersion) it.next(); - if (pfv.getProjectFacet().getId().equals("jst.web")) { //$NON-NLS-1$ - webFacetVersion = pfv; - break; - } - } - if (webFacetVersion != null) { - try { - webAppDataModel = (IDataModel) context.getConfig( - webFacetVersion, IFacetedProject.Action.Type.INSTALL, - context.getProjectName()); - if (webAppDataModel != null) { - webAppDataModel.addListener(this); - } - } catch (CoreException e) { - JSFUiPlugin.log(IStatus.ERROR, - Messages.JSFFacetInstallPage_ErrorNoWebAppDataModel, e); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage#propertyChanged(org.eclipse.wst.common.frameworks.datamodel.DataModelEvent) - */ - public void propertyChanged(DataModelEvent event) { - if (webAppDataModel != null) { - String propertyName = event.getPropertyName(); - if (propertyName - .equals(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER)) { - model.setStringProperty(WEBCONTENT_DIR, event.getProperty() - .toString()); - } - } - super.propertyChanged(event); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage#dispose() - */ - public void dispose() { - if (webAppDataModel != null) - webAppDataModel.removeListener(this); - - //jsfLibCfgComp.dispose(); - super.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage#restoreDefaultSettings() - */ - protected void restoreDefaultSettings() { - initializeValues(); - } - /* (non-Javadoc) - * @see org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage#showValidationErrorsOnEnter() - */ - protected boolean showValidationErrorsOnEnter() { - return true; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/project/facet/JSFLibraryPropertyPage.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/project/facet/JSFLibraryPropertyPage.java deleted file mode 100644 index 149bfe63c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/project/facet/JSFLibraryPropertyPage.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.jst.jsf.ui.internal.project.facet; - -import org.eclipse.jst.common.project.facet.ui.libprov.FacetLibraryPropertyPage; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -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; - -public final class JSFLibraryPropertyPage - - extends FacetLibraryPropertyPage - -{ - @Override - public IProjectFacetVersion getProjectFacetVersion() - { - final IProjectFacet jsfFacet = ProjectFacetsManager.getProjectFacet( "jst.jsf" ); - final IFacetedProject fproj = getFacetedProject(); - return fproj.getInstalledVersion( jsfFacet ); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ComponentDetailSubForm.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ComponentDetailSubForm.java deleted file mode 100644 index 47b0a726c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ComponentDetailSubForm.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentTagElement; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm; -import org.eclipse.jst.jsf.ui.internal.common.ViewObjectPresenter; -import org.eclipse.swt.widgets.Composite; - -/** - * Details page for component details. - * - * @author cbateman - * - */ -public class ComponentDetailSubForm extends AbstractXMLSectionsDetailsForm -{ - private final static String COMPONENT_TYPE_SECTION_KEY = "componentSection"; - private static final String INTERFACES_SECTION_KEY = "interfacesSection"; - private XMLTextSection _componentTypeSection; - private XMLTextSection _interfacesSection; - - @Override - protected Map<? extends Object, XMLTextSection> createXMLTextSections(Composite parent) - { - final Map<String, XMLTextSection> sections = new HashMap<String, XMLTextSection>(); - _componentTypeSection = new XMLTextSection(getToolkit(), parent, "Component Type Information"); - sections.put(COMPONENT_TYPE_SECTION_KEY, _componentTypeSection); - - _interfacesSection = new XMLTextSection(getToolkit(), parent, "Interface Information"); - sections.put(INTERFACES_SECTION_KEY, _interfacesSection); - return sections; - } - - - @Override - protected Set<XMLTextSection> getInitiallyExpanded( - Map<Object, XMLTextSection> sections) - { - return Collections.singleton(_componentTypeSection); - } - - - @Override - protected void doUpdateSelection(final Object newSelection) - { - if (newSelection instanceof IComponentTagElement) - { - final IComponentTagElement curTagElement = (IComponentTagElement) newSelection; - final ComponentTypeInfo typeInfo = curTagElement.getComponent(); - if (typeInfo != null) - { - _componentTypeSection.setText(ViewObjectPresenter.present(typeInfo), true, false); - _interfacesSection.setText(ViewObjectPresenter.presentCompInterfaces(typeInfo, null), true, false); - _componentTypeSection.refresh(); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ConverterDetailsForm.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ConverterDetailsForm.java deleted file mode 100644 index 19fdacf33..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ConverterDetailsForm.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IConverterTagElement; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm; -import org.eclipse.swt.widgets.Composite; - -/** - * Details form for a converter tag. - * - * @author cbateman - * - */ -public class ConverterDetailsForm extends AbstractXMLSectionsDetailsForm -{ - private final static String CONVERTER_TYPE_SECTION_KEY = "converterSection"; - private XMLTextSection _converterTypeSection; - - @Override - protected Map<? extends Object, XMLTextSection> createXMLTextSections(Composite parent) - { - final Map<String, XMLTextSection> sections = new HashMap<String, XMLTextSection>(); - _converterTypeSection = new XMLTextSection(getToolkit(), parent, "Converter Type Information"); - sections.put(CONVERTER_TYPE_SECTION_KEY, _converterTypeSection); - return sections; - } - - - @Override - protected Set<XMLTextSection> getInitiallyExpanded( - Map<Object, XMLTextSection> sections) - { - return Collections.singleton(_converterTypeSection); - } - - @Override - protected void doUpdateSelection(Object newSelection) - { - if (newSelection instanceof IConverterTagElement) - { - IConverterTagElement converterTagElement = (IConverterTagElement) newSelection; - final ConverterTypeInfo typeInfo = converterTagElement.getConverter(); - - if (typeInfo != null) - { - final String formatText = "<form><p><b>Class:</b> %s</p> <p><b>Converter Id:</b> %s</p></form>"; - final String className = typeInfo.getClassName(); - final String converterId = typeInfo.getConverterId(); - - _converterTypeSection.setText(String.format(formatText, - className == null ? "" : className, - converterId == null ? "" : converterId), true, false); - _converterTypeSection.refresh(); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/GenerateMetadataAction.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/GenerateMetadataAction.java deleted file mode 100644 index bd4cb1d4e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/GenerateMetadataAction.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.io.IOException; -import java.util.Collection; - -import org.eclipse.jface.action.Action; -import org.eclipse.jst.jsf.common.runtime.internal.model.types.ClassTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IConverterTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IValidatorTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataGenerator; - -/** - * @author cbateman - * - */ -class GenerateMetadataAction extends Action -{ - private Namespace _ns; - - public GenerateMetadataAction() - { - super("Generate metadata"); - } - - public void setNamespace(final Namespace ns) - { - _ns = ns; - } - - @Override - public void run() - { - if (_ns != null) - { - // create resource set and resource - final ViewMetadataGenerator generator = new ViewMetadataGenerator(_ns - .getNSUri()); - for (final ITagElement element : (Collection<? extends ITagElement>) _ns - .getViewElements()) - { - final String tagName = element.getName(); - final ClassTypeInfo typeInfo = getTypeInfo(element); - if (typeInfo != null) - { - generator.addTagToViewObjectMapping(tagName, typeInfo, null, null); - } - } - - try - { - generator.save(System.out); - } - catch (final IOException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // final IProject project = (IProject) _viewer.getInput(); - // final ITaglibDomainMetaDataModelContext modelContext = - // TaglibDomainMetaDataQueryHelper.createMetaDataModelContext(project, - // "http://java.sun.com/jsf/html"); - // final Entity entity = TaglibDomainMetaDataQueryHelper.getEntity( - // modelContext, "outputText"); - // if (entity != null) - // { - // final Trait trait = TaglibDomainMetaDataQueryHelper.getTrait( - // entity, "viewElementMapping"); - // if (trait != null) - // { - // final TagToViewObjectMapping tagConstraint = - // (TagToViewObjectMapping) trait.getValue(); - // System.err.println(tagConstraint.toString()); - // } - // } - - } - } - - private ClassTypeInfo getTypeInfo(final ITagElement element) - { - ClassTypeInfo typeInfo = null; - if (element instanceof IComponentTagElement) - { - typeInfo = ((IComponentTagElement) element).getComponent(); - } - else if (element instanceof IConverterTagElement) - { - typeInfo = ((IConverterTagElement) element).getConverter(); - } - else if (element instanceof IValidatorTagElement) - { - typeInfo = ((IValidatorTagElement) element).getValidator(); - } - - return typeInfo; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/NamespaceDetailsForm.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/NamespaceDetailsForm.java deleted file mode 100644 index 6891180ad..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/NamespaceDetailsForm.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm; -import org.eclipse.swt.widgets.Composite; - - -/** - * Details form for a namespace - * - * @author cbateman - * - */ -public class NamespaceDetailsForm extends AbstractXMLSectionsDetailsForm -{ - private final static String NAMESPACE_SECTION_KEY = "namespaceSection"; - private XMLTextSection _namespaceSection; - - @Override - protected Map<? extends Object, XMLTextSection> createXMLTextSections(Composite parent) - { - final Map<String, XMLTextSection> sections = new HashMap<String, XMLTextSection>(); - _namespaceSection = new XMLTextSection(getToolkit(), parent, "Namespace"); - sections.put(NAMESPACE_SECTION_KEY, _namespaceSection); - return sections; - } - - @Override - protected Set<XMLTextSection> getInitiallyExpanded( - Map<Object, XMLTextSection> sections) - { - return Collections.singleton(_namespaceSection); - } - - @Override - protected void doUpdateSelection(Object newSelection) - { - if (newSelection instanceof Namespace) - - { - Namespace namespace = (Namespace) newSelection; - - final String formatText = "<form><p><b>Name:</b> %s</p> <p><b>Uri:</b> %s</p> </form>"; - final String displayName = namespace.getDisplayName(); - final String uri = namespace.getNSUri(); - - _namespaceSection.setText(String.format(formatText, - displayName == null ? "" : displayName, - uri == null ? "" : uri - ), true, false); - _namespaceSection.refresh(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ProjectTracker.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ProjectTracker.java deleted file mode 100644 index ea2f5b816..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ProjectTracker.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.util.HashSet; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.jst.jsf.common.internal.resource.IResourceLifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.LifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.EventType; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.ReasonType; -import org.eclipse.jst.jsf.ui.internal.tagregistry.ProjectTracker.ProjectTrackingListener.Reason; - -/** - * Tracks the active JSF projects in the workspace, maintaining a list of valid - * projects and firing events when it changes - * - * @author cbateman - * - */ -class ProjectTracker -{ - private final IWorkspaceRoot _root; - private final LifecycleListener _lifecycleListener; - private final CopyOnWriteArrayList<ProjectTrackingListener> _myListeners; - private Set<IProject> _validProjects; - private final ResourceChangeListener _resourceChangeListener; - private ProjectAdvisor _projectAdvisor; - - public ProjectTracker(final IWorkspaceRoot root, final ProjectAdvisor projectAdvisor) - { - _root = root; - _lifecycleListener = new LifecycleListener(); - _resourceChangeListener = new ResourceChangeListener(); - _myListeners = new CopyOnWriteArrayList<ProjectTrackingListener>(); - if (projectAdvisor != null) - { - _projectAdvisor = projectAdvisor; - } - else - { - _projectAdvisor = DEFAULT_ADVISOR; - } - } - - public void startTracking() - { - _lifecycleListener.addResource(_root); - - _validProjects = new HashSet<IProject>(); - - for (final IProject project : _root.getProjects()) - { - if (_projectAdvisor.shouldTrack(project)) - { - _validProjects.add(project); - _lifecycleListener.addResource(project); - } - } - // do this last, to ensure that any "simulataneous" events are handled - // by our listener only after everything is initialized. - _lifecycleListener.addListener(_resourceChangeListener); - } - - public Set<IProject> getProjects() - { - final Set<IProject> projects = new HashSet<IProject>(); - synchronized (this) - { - projects.addAll(_validProjects); - } - return projects; - } - - private synchronized void addProject(final IProject project) - { - if (_projectAdvisor.shouldTrack(project)) - { - synchronized (this) - { - _validProjects.add(project); - _lifecycleListener.addResource(project); - } - fireChangeEvent(project, Reason.ADDED); - } - } - - private void removeProject(final IProject project) - { - synchronized (this) - { - _validProjects.remove(project); - _lifecycleListener.removeResource(project); - } - fireChangeEvent(project, Reason.REMOVED); - } - - public void addListener(ProjectTrackingListener listener) - { - _myListeners.addIfAbsent(listener); - } - - public void removeListener(ProjectTrackingListener listener) - { - _myListeners.remove(listener); - } - - private void fireChangeEvent(final IProject project, - ProjectTrackingListener.Reason reason) - { - for (final ProjectTrackingListener listener : _myListeners) - { - listener.projectsChanged(project, reason); - } - } - - public void dispose() - { - _lifecycleListener.dispose(); - _validProjects.clear(); - _myListeners.clear(); - } - - private class ResourceChangeListener implements IResourceLifecycleListener - { - public EventResult acceptEvent(final ResourceLifecycleEvent event) - { - final IResource res = event.getAffectedResource(); - - // only interested if is affecting one of my resources - - // if the root is the source, check if a projected has been added - // or opened - // EventType eventType = event.getEventType(); - if (event.getEventType() == EventType.RESOURCE_ADDED - && event.getReasonType() == ReasonType.PROJECT_OPENED - && res instanceof IProject) - { - handleNewProject((IProject) res); - } - else if (_validProjects.contains(res) - && event.getEventType() == EventType.RESOURCE_INACCESSIBLE) - { - handleProjectClosed((IProject) res); - } - return EventResult.getDefaultEventResult(); - } - - private void handleNewProject(final IProject project) - { - addProject(project); - } - - private void handleProjectClosed(final IProject project) - { - removeProject(project); - } - } - - public static class ProjectTrackingListener - { - public enum Reason - { - /** - * Reason for change is a project added - */ - ADDED, - /** - * Reason for change is a project removed - */ - REMOVED - } - - protected void projectsChanged(final IProject project, Reason reason) - { - // do nothing by default - } - } - - private static final ProjectAdvisor DEFAULT_ADVISOR = new ProjectAdvisor() - { - @Override - public boolean shouldTrack( - IProject project) - { - return true; - } - }; - - public abstract static class ProjectAdvisor - { - public abstract boolean shouldTrack(final IProject project); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/SetInputRunnable.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/SetInputRunnable.java deleted file mode 100644 index 251e11e81..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/SetInputRunnable.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.ui.PlatformUI; - -class SetInputRunnable implements Runnable -{ - private final Viewer _viewer; - private final IProject _project; - - public SetInputRunnable(IProject project, Viewer viewer) - { - super(); - _project = project; - _viewer = viewer; - } - - public void run() - { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() - { - public void run() - { - _viewer.setInput(_project); - } - }); - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryDetailsForm.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryDetailsForm.java deleted file mode 100644 index 3bd136cd8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryDetailsForm.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm; -import org.eclipse.jst.jsf.core.internal.TagRegistryFactoryInfo; -import org.eclipse.jst.jsf.ui.internal.tagregistry.TaglibContentProvider.TagRegistryInstance; -import org.eclipse.swt.widgets.Composite; - -/** - * Details form for a tag registry - * - * @author cbateman - * - */ -public class TagRegistryDetailsForm extends AbstractXMLSectionsDetailsForm -{ - private final static String TAGREGISTRY_SECTION_KEY = "tagRegistrySection"; - private XMLTextSection _tagRegistrySection; - - @Override - protected Map<? extends Object, XMLTextSection> createXMLTextSections( - final Composite parent) - { - final Map<String, XMLTextSection> sections = new HashMap<String, XMLTextSection>(); - _tagRegistrySection = new XMLTextSection(getToolkit(), parent, - "Namespace"); - sections.put(TAGREGISTRY_SECTION_KEY, _tagRegistrySection); - return sections; - } - - @Override - protected Set<XMLTextSection> getInitiallyExpanded( - final Map<Object, XMLTextSection> sections) - { - return Collections.singleton(_tagRegistrySection); - } - - @Override - protected void doUpdateSelection(final Object newSelection) - { - if (newSelection instanceof TagRegistryInstance) - { - final TagRegistryInstance tagRegistry = (TagRegistryInstance) newSelection; - final TagRegistryFactoryInfo info = tagRegistry.getInfo(); - - if (info != null) - { - final String format = "<form><p><b>Description:</b> %s</p> <p><b>Id:</b> %s</p> <p><b>Content-Types:</b> %s</p></form>"; - final String description = info.getDescription(); - final String id = info.getId(); - final Set<IContentType> contentTypes = info.getContentTypes(); - String contentTypeLabel = ""; - final Iterator<IContentType> it = contentTypes.iterator(); - for (int i = 0; i < contentTypes.size() - 1 && it.hasNext(); i++) - { - final IContentType ctype = it.next(); - contentTypeLabel += ctype.getName() + ","; - } - - if (it.hasNext()) - { - final IContentType ctype = it.next(); - contentTypeLabel += ctype.getName(); - } - - _tagRegistrySection.setText(String.format(format, description, - id, contentTypeLabel), true, false); - _tagRegistrySection.refresh(); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterDetailBlock.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterDetailBlock.java deleted file mode 100644 index 3b91c75d9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterDetailBlock.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IConverterTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IValidatorTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractDetailsForm; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterDetailBlock; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterForm; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm; -import org.eclipse.jst.jsf.ui.internal.tagregistry.TaglibContentProvider.TagRegistryInstance; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/** - * A master-detail block for selecting items in a tag registry and examining - * their details. - * - * @author cbateman - * - */ -public class TagRegistryMasterDetailBlock extends AbstractMasterDetailBlock -{ - ComponentDetailSubForm _componentDetails; - TagRegistryDetailsForm _tagRegistryDetails; - NamespaceDetailsForm _namespaceDetails; - ConverterDetailsForm _converterDetails; - ValidatorDetailsForm _validatorDetails; - - - @Override - protected AbstractMasterForm createMasterPart(final FormToolkit toolkit) - { - return new TagRegistryMasterForm(toolkit); - } - - - @Override - protected final List<AbstractDetailsForm> createDetailPages() - { - final List<AbstractDetailsForm> detailForms = new ArrayList<AbstractDetailsForm>(); - _componentDetails = new ComponentDetailSubForm(); - detailForms.add(_componentDetails); - - _tagRegistryDetails = new TagRegistryDetailsForm(); - detailForms.add(_tagRegistryDetails); - - _namespaceDetails = new NamespaceDetailsForm(); - detailForms.add(_namespaceDetails); - - _converterDetails = new ConverterDetailsForm(); - detailForms.add(_converterDetails); - - _validatorDetails = new ValidatorDetailsForm(); - detailForms.add(_validatorDetails); - - return detailForms; - } - - - @Override - protected AbstractXMLSectionsDetailsForm doSelectPage(final Object forModel) - { - if (forModel instanceof IComponentTagElement) - { - return _componentDetails; - } - else if (forModel instanceof IConverterTagElement) - { - return _converterDetails; - } - else if (forModel instanceof IValidatorTagElement) - { - return _validatorDetails; - } - else if (forModel instanceof TagRegistryInstance) - { - return _tagRegistryDetails; - } - else if (forModel instanceof Namespace) - { - return _namespaceDetails; - } - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterForm.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterForm.java deleted file mode 100644 index 7ea7844b3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterForm.java +++ /dev/null @@ -1,497 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IConverterTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IValidatorTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterForm; -import org.eclipse.jst.jsf.common.ui.internal.utils.JSFSharedImages; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsf.ui.internal.JSFUITraceOptions; -import org.eclipse.jst.jsf.ui.internal.tagregistry.ProjectTracker.ProjectAdvisor; -import org.eclipse.jst.jsf.ui.internal.tagregistry.ProjectTracker.ProjectTrackingListener; -import org.eclipse.jst.jsf.ui.internal.tagregistry.TaglibContentProvider.TagRegistryInstance; -import org.eclipse.jst.jsf.ui.internal.tagregistry.TaglibContentProvider.TreePlaceholder; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.model.BaseWorkbenchContentProvider; -import org.eclipse.ui.model.IWorkbenchAdapter; -import org.eclipse.ui.model.WorkbenchAdapter; -import org.eclipse.ui.model.WorkbenchViewerComparator; - -/** - * The master form in the master/detail block for tag registry. Used to display - * a tree view of each tag registy on the currently selected project and its - * contents. - * - * @author cbateman - * - */ -public class TagRegistryMasterForm extends AbstractMasterForm -{ - private TreeViewer _registryTreeViewer; - // private Action _selectProjectAction; - private Action _refreshAction; - - private final ProjectTracker _projectTracker; - private final ProjectAdvisor _advisor; - private GenerateMetadataAction _generateMetadataAction; - - /** - * @param toolkit - */ - public TagRegistryMasterForm(final FormToolkit toolkit) - { - super(toolkit); - _advisor = new ProjectAdvisor() - { - @Override - public boolean shouldTrack(final IProject project) - { - return JSFAppConfigUtils.isValidJSFProject(project); - } - }; - - _projectTracker = new ProjectTracker(ResourcesPlugin.getWorkspace() - .getRoot(), _advisor); - } - - /** - * @param parent - * @return the contents main control - */ - @Override - public Control createClientArea(final Composite parent) - { - final Tree tree = getToolkit().createTree(parent, - SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); - - final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true); - tree.setLayoutData(gridData); - _registryTreeViewer = new TreeViewer(tree); - // _drillDownAdapter = new DrillDownAdapter(_viewer); - _registryTreeViewer.setContentProvider(new TaglibContentProvider()); - _registryTreeViewer.setLabelProvider(new CommonLabelProvider()); - _registryTreeViewer.setSorter(new NameSorter()); - - PlatformUI.getWorkbench().getHelpSystem() - .setHelp(_registryTreeViewer.getControl(), - "ViewHandlerPrototype.viewer"); - - _projectTracker.addListener(new ProjectTrackingListener() - { - @Override - protected void projectsChanged(final IProject project, - final Reason reason) - { - switch (reason) - { - case ADDED: - { - // nothing to do, since new project can't be selected - // yet - } - case REMOVED: - { - // if the removed project is the one that is current - // update the treeviewer - if (project.equals(_registryTreeViewer.getInput())) - { - updateProjects(); - } - } - } - } - }); - - _registryTreeViewer - .addSelectionChangedListener(new ISelectionChangedListener() - { - - public void selectionChanged( - final SelectionChangedEvent event) - { - getListener().selectionChanged(event); - updateActions(event.getSelection()); - } - }); - makeActions(); - createContextMenuManager(_registryTreeViewer.getControl()); - return tree; - } - - /** - * dispose of the master form - */ - @Override - public void dispose() - { - _projectTracker.dispose(); - } - - private void updateProjects() - { - final Set<IProject> projects = _projectTracker.getProjects(); - - for (final IProject project : projects) - { - new SetInputRunnable(project, _registryTreeViewer).run(); - break; - } - } - - @Override - protected final void contributeActions(IToolBarManager formManager, - IToolBarManager localManager) - { - // do nothing to the manager; we have our own toolbar - - // contribute to local tool bar - localManager.add(_refreshAction); - localManager.update(false); - } - - /** - */ - @Override - protected void contributeToHeadArea(final FormToolkit toolkit, - final Composite container) - { - final Label label = new Label(container, SWT.NONE); - label.setText("Project: "); - final ComboViewer combo = new ComboViewer(container, SWT.FLAT - | SWT.READ_ONLY); - getToolkit().adapt(combo.getControl(), true, false); - combo.addSelectionChangedListener(new ISelectionChangedListener() - { - public void selectionChanged(SelectionChangedEvent event) - { - IStructuredSelection selection = (IStructuredSelection) event - .getSelection(); - - final IProject selectedProject = (IProject) selection - .getFirstElement(); - _registryTreeViewer.setInput(selectedProject); - } - }); - combo.setLabelProvider(new CommonLabelProvider()); - combo.setContentProvider(new ProjectContentProvider()); - combo.setComparator(new WorkbenchViewerComparator()); - combo.setInput(_projectTracker); - _projectTracker.addListener(new ProjectTrackingListener() - { - @Override - protected void projectsChanged(IProject project, Reason reason) - { - combo.getControl().getDisplay().asyncExec(new Runnable() - { - public void run() - { - combo.refresh(); - } - }); - } - }); - } - - /** - */ - @Override - public void doInitialize() - { - _projectTracker.startTracking(); - } - - private void makeActions() - { - if (_registryTreeViewer == null) - { - throw new IllegalStateException( - "_registryTreeViewer must be initialized before calling makeActions"); - } - _refreshAction = new RefreshAction(_registryTreeViewer); - _refreshAction.setText("Refresh Registry"); - _refreshAction.setToolTipText("Refresh Registry"); - _refreshAction.setImageDescriptor(JSFUICommonPlugin.getDefault() - .getImageDescriptor("refresh_nav_16.gif")); - - if (JSFUITraceOptions.TRACE_METADATAGEN) - { - _generateMetadataAction = new GenerateMetadataAction(); - } - } - - private void createContextMenuManager(final Control control) - { - // Create menu manager. - MenuManager menuMgr = new MenuManager(); - menuMgr.setRemoveAllWhenShown(true); - menuMgr.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager mgr) { - fillContextMenu(mgr); - } - }); - - // Create menu. - Menu menu = menuMgr.createContextMenu(control); - control.setMenu(menu); - - // Register menu for extension. - //getSite().registerContextMenu(menuMgr, viewer); - } - - private void fillContextMenu(IMenuManager mgr) - { - if (JSFUITraceOptions.TRACE_METADATAGEN) - { - mgr.add(_generateMetadataAction); - } - } - - private void updateActions(final ISelection selection) - { - if (JSFUITraceOptions.TRACE_METADATAGEN) - { - updateMetadataGenAction(selection); - } - } - - private void updateMetadataGenAction(final ISelection selection) - { - if (selection instanceof IStructuredSelection) - { - if (((IStructuredSelection)selection).getFirstElement() instanceof Namespace) - { - Namespace ns = (Namespace) ((IStructuredSelection)selection).getFirstElement(); - _generateMetadataAction.setNamespace(ns); - _generateMetadataAction.setEnabled(true); - return; - } - } - _generateMetadataAction.setEnabled(false); - } - - private static class RefreshAction extends Action - { - private final StructuredViewer _viewer; - - /** - * @param viewer - */ - private RefreshAction(final StructuredViewer viewer) - { - super(); - _viewer = viewer; - setEnabled(false); - _viewer.addSelectionChangedListener(new ISelectionChangedListener() - { - public void selectionChanged(SelectionChangedEvent event) - { - boolean enabled = false; - final Object selectedObj = getSelected(event.getSelection()); - if (selectedObj instanceof TagRegistryInstance) - { - enabled = true; - } - setEnabled(enabled); - } - }); - } - - @Override - public void run() - { - MessageDialog dialog = new MessageDialog(_viewer.getControl().getShell(), "Also flush cached data?", null, // accept - // the - // default - // window - // icon - "Flushing cached data may cause some operations to slow until cached information is regenerated. If you answer no, the view will refresh but NOT flush cached data" - , MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, - IDialogConstants.NO_LABEL }, 1); // no is the - // default - final boolean flushCaches = (dialog.open() == 0); - final Object selectedObj = getSelected(_viewer.getSelection()); - - if (selectedObj instanceof TagRegistryInstance) - { - final TagRegistryInstance registryInstance = (TagRegistryInstance) selectedObj; - final ITagRegistry registry = registryInstance.getRegistry(); - if (registry != null) - { - // need a non-null runnable so that refresh won't block, - // but don't need to fire events, since the registry will - // fire events on change. - final Runnable nullRunnable = new Runnable() - { - public void run() - {/* do nothing */ - } - }; - - registry.refresh(nullRunnable, flushCaches); - } - } - } - - private Object getSelected(ISelection selection) - { - if (selection instanceof IStructuredSelection) - { - final IStructuredSelection structuredSel = (IStructuredSelection) selection; - if (structuredSel.size() == 1) - { - return structuredSel.getFirstElement(); - } - } - return null; - } - } - - private static class ProjectContentProvider extends - BaseWorkbenchContentProvider - { - @Override - protected IWorkbenchAdapter getAdapter(final Object element) - { - return new WorkbenchAdapter() - { - @Override - public Object[] getChildren(final Object object) - { - if (object instanceof ProjectTracker) - { - return ((ProjectTracker) object).getProjects() - .toArray(); - } - return new Object[0]; - } - }; - } - } - - private static class CommonLabelProvider extends LabelProvider - { - @Override - public String getText(final Object obj) - { - if (obj instanceof TagRegistryInstance) - { - return ((TagRegistryInstance) obj).getInfo().getDescription(); - } - else if (obj instanceof Namespace) - { - if (((Namespace) obj).getDisplayName() != null) - { - return ((Namespace) obj).getDisplayName(); - } - return ((Namespace) obj).getNSUri(); - } - else if (obj instanceof ITagElement) - { - return ((ITagElement) obj).getName(); - } - else if (obj instanceof TreePlaceholder) - { - return ((TreePlaceholder) obj).getText(); - } - else if (obj instanceof IProject) - { - return ((IProject) obj).getName(); - } - return obj.toString(); - } - - @Override - public Image getImage(final Object obj) - { - if (obj instanceof Namespace) - { - return JavaUI.getSharedImages().getImage( - org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_LIBRARY); - } - else if (obj instanceof TagRegistryInstance) - { - final String imageKey = ISharedImages.IMG_OBJ_FOLDER; - return PlatformUI.getWorkbench().getSharedImages().getImage( - imageKey); - } - else if (obj instanceof ITagElement) - { - if (obj instanceof IComponentTagElement) - { - return JSFUICommonPlugin.getDefault().getImage( - JSFSharedImages.GENERIC_OBJECT_IMG); - } - else if (obj instanceof IConverterTagElement) - { - return JSFUICommonPlugin.getDefault().getImage( - JSFSharedImages.GENERIC_CONVERTER_IMG); - } - else if (obj instanceof IValidatorTagElement) - { - return JSFUICommonPlugin.getDefault().getImage( - JSFSharedImages.GENERIC_VALIDATOR_IMG); - } - return JSFUICommonPlugin.getDefault().getImage( - JSFSharedImages.DEFAULT_PALETTE_TAG_IMG); - } - else if (obj instanceof TreePlaceholder) - { - return JSFUICommonPlugin.getDefault().getImage("configs.gif"); - } - - final String imageKey = ISharedImages.IMG_OBJ_ELEMENT; - return PlatformUI.getWorkbench().getSharedImages().getImage( - imageKey); - } - } - - class NameSorter extends ViewerSorter - { - // do nothing - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryView.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryView.java deleted file mode 100644 index 5ef7c8573..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryView.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.forms.widgets.Form; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.part.ViewPart; - -/** - * This sample class demonstrates how to plug-in a new workbench view. The view - * shows data obtained from the model. The sample creates a dummy model on the - * fly, but a real implementation would connect to the model available either in - * this or another plug-in (e.g. the workspace). The view is connected to the - * model using a content provider. - * <p> - * The view uses a label provider to define how model objects should be - * presented in the view. Each view can present the same model objects using - * different labels and icons, if needed. Alternatively, a single label provider - * can be shared between views in order to ensure that objects of the same type - * are presented in the same way everywhere. - * <p> - */ - -public class TagRegistryView extends ViewPart -{ - private FormToolkit _toolkit; - private Form _form; - private TagRegistryMasterDetailBlock _masterDetailBlock; - - /** - * The constructor. - */ - public TagRegistryView() - { - // do nothing - } - - @Override - public void init(IViewSite site) throws PartInitException - { - super.init(site); - setTitleImage(JSFUiPlugin.getDefault().getImage("obj16/library_obj.gif")); - } - - /** - * This is a callback that will allow us to create the viewer and initialize - * it. - */ - @Override - public void createPartControl(final Composite parent) - { - _toolkit = new FormToolkit(parent.getDisplay()); - - _form = _toolkit.createForm(parent); - _form.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,true)); - _masterDetailBlock = - new TagRegistryMasterDetailBlock(); - _masterDetailBlock.createContent(_toolkit,_form); - } - - - - @Override - public void dispose() - { - if (_masterDetailBlock != null) - { - _masterDetailBlock.dispose(); - _masterDetailBlock = null; - } - super.dispose(); - } - - /** - * Passing the focus request to the viewer's control. - */ - @Override - public void setFocus() - { - _form.setFocus(); - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TaglibContentProvider.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TaglibContentProvider.java deleted file mode 100644 index cf0d03b72..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TaglibContentProvider.java +++ /dev/null @@ -1,451 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicLong; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.core.internal.CompositeTagRegistryFactory; -import org.eclipse.jst.jsf.core.internal.TagRegistryFactoryInfo; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry.TagRegistryChangeEvent; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry.TagRegistryChangeEvent.EventType; -import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory.TagRegistryFactoryException; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; - -/** - * Structured content provider for tag libraries. - * - * @author cbateman - * - */ -public class TaglibContentProvider implements IStructuredContentProvider, - ITreeContentProvider, ITagRegistry.ITagRegistryListener -{ - private final static Object[] NO_CHILDREN = new Object[0]; - private IProject _curInput; - private Map<ITagRegistry, TagRegistryInstance> _curTagRegistries = - new HashMap<ITagRegistry, TagRegistryInstance>(); - private Viewer _curViewer; - private final AtomicLong _changeStamp = new AtomicLong( - 0); - - public Object[] getElements(final Object inputElement) - { - - if (inputElement instanceof IProject) - { - return _curTagRegistries.values().toArray(); - // return _rootNamespaces.values().toArray(); - } - - return NO_CHILDREN; - } - - public void dispose() - { - // nothing to do - } - - public void inputChanged(final Viewer viewer, final Object oldInput, - final Object newInput) - { - // update our change stamp to invalid outstanding update tasks - _changeStamp.incrementAndGet(); - _curViewer = viewer; - - if (oldInput instanceof IProject) - { - for (final TagRegistryInstance tagRegistry : _curTagRegistries.values()) - { - tagRegistry.getRegistry().removeListener(this); - } - } - - if (newInput instanceof IProject) - { - _curInput = (IProject) newInput; - - final Set<TagRegistryFactoryInfo> factories = CompositeTagRegistryFactory - .getInstance().getAllTagRegistryFactories(); - - _curTagRegistries.clear(); - - for (TagRegistryFactoryInfo factoryInfo : factories) - { - TagRegistryFactory factory = factoryInfo - .getTagRegistryFactory(); - ITagRegistry registry; - try - { - registry = factory.createTagRegistry(_curInput); - if (registry != null) - { - final TagRegistryInstance registryInstance = - new TagRegistryInstance(factoryInfo, registry); - _curTagRegistries.put(registry, registryInstance); - registry.addListener(this); - - new UpdateNamespacesListJob(_curInput, _changeStamp.get(), - registryInstance).schedule(); - } - } - catch (TagRegistryFactoryException e) - { - JSFUiPlugin.log(IStatus.ERROR, - "Problem getting tag registry", e); - } - } - } - else - { - _curInput = null; - _curTagRegistries.clear(); - } - } - - public Object[] getChildren(final Object parentElement) - { - if (parentElement instanceof IProject) - { - return _curTagRegistries.values().toArray(); - } - else if (parentElement instanceof TagRegistryInstance) - { - final TagRegistryInstance regInstance = (TagRegistryInstance) parentElement; - - if (!regInstance.isUpToDate()) - { - return new Object[] {new TreePlaceholder("Calculating...", null)}; - } - return regInstance.getNamespaces().values().toArray(); - } - else if (parentElement instanceof Namespace) - { - final Namespace ns = (Namespace) parentElement; - - // this could be very expensive if not initialized - if (ns.isInitialized()) - { - return ((Namespace) parentElement).getViewElements().toArray(); - } - - // fire up a job that ensures the namespace is initialized - // and then fires refresh again on this element - final Job updateNamespaceJob = new Job("Updating namespace") - { - @Override - protected IStatus run(final IProgressMonitor monitor) - { - ns.getViewElements(); - PlatformUI.getWorkbench().getDisplay().asyncExec( - new Runnable() - { - public void run() - { - // avoid infinite recursion - if (ns.isInitialized()) - { - TaglibContentProvider.this - .viewerRefresh(ns); - } - else - { - MessageDialog - .openError( - Display - .getCurrent() - .getActiveShell(), - "Error updating namespace", - "There was a problem initializing the namespace"); - } - } - }); - return Status.OK_STATUS; - } - }; - - updateNamespaceJob.schedule(); - - return new Object[] - { new TreePlaceholder("Calculating tags, please wait...", null) }; - } -// else if (parentElement instanceof IJSFTagElement) -// { -// return new Object[] -// { ((IJSFTagElement) parentElement).toString() }; -// } - - return NO_CHILDREN; - } - - public Object getParent(final Object element) - { - // no support for parent traversal right now - return null; - } - - public boolean hasChildren(final Object element) - { - // avoid an infinite refresh loop on the namespaces in the tag registry - if (element instanceof TagRegistryInstance) - { - return true; - } - // finding all children of a namespace can be expensive - else if (element instanceof Namespace) - { - return ((Namespace) element).hasViewElements(); - } - return getChildren(element).length > 0; - } - - public void registryChanged(final TagRegistryChangeEvent changeEvent) - { - if (_curViewer != null) - { - TagRegistryInstance registryInstance = - _curTagRegistries.get(changeEvent.getSource()); - - if (registryInstance != null) - { - _curViewer.getControl().getDisplay().asyncExec( - new RegistryChangeTask(changeEvent.getType(), changeEvent - .getAffectedObjects(), _changeStamp.get(),registryInstance)); - } - } - } - - private final class RegistryChangeTask implements Runnable - { - private final EventType _eventType; - private final long _timestamp; - private final List<? extends Namespace> _affectedObjects; - private final TagRegistryInstance _registryInstance; - - RegistryChangeTask(final TagRegistryChangeEvent.EventType eventType, - final List<? extends Namespace> affectedObjects, - final long timestamp, final TagRegistryInstance registryInstance) - { - _eventType = eventType; - _timestamp = timestamp; - _affectedObjects = affectedObjects; - _registryInstance = registryInstance; - } - - public void run() - { - // if changes have been made since this task was queued, then abort - // since we don't know if our data is still valid - if (_timestamp != TaglibContentProvider.this._changeStamp.get()) - { - return; - } - - switch (_eventType) - { - case ADDED_NAMESPACE: - case CHANGED_NAMESPACE: - { - for (final Namespace ns : _affectedObjects) - { - _registryInstance.getNamespaces().put(ns.getNSUri(), ns); - } - - viewerRefresh(_curInput); - } - break; - - case REMOVED_NAMESPACE: - { - for (final Namespace ns : _affectedObjects) - { - _registryInstance.getNamespaces().remove(ns.getNSUri()); - } - viewerRefresh(_curInput); - } - break; - - case REGISTRY_DISPOSED: - { - _registryInstance.getRegistry().removeListener(TaglibContentProvider.this); - _curTagRegistries.remove(_registryInstance); - viewerRefresh(_curInput); - } - } - } - } - - private void viewerRefresh(final Object parentElement) - { - if (_curViewer instanceof StructuredViewer) - { - final StructuredViewer viewer = (StructuredViewer) _curViewer; - viewer.refresh(parentElement); - } - else - { - _curViewer.refresh(); - } - } - - private class UpdateNamespacesListJob extends Job - { - - private final long _timestamp; - private final IProject _project; - private final TagRegistryInstance _registry; - - public UpdateNamespacesListJob(final IProject project, - final long timestamp, final TagRegistryInstance registry) - { - super("Updating available namespaces for project " - + project.getName()); - _project = project; - _timestamp = timestamp; - _registry = registry; - } - - @Override - protected IStatus run(final IProgressMonitor monitor) - { - if (!_project.isAccessible() - || _registry.isUpToDate()) - { - return new Status(IStatus.CANCEL, JSFUiPlugin.PLUGIN_ID, ""); - } - - final Collection<? extends Namespace> libs = _registry.getRegistry() - .getAllTagLibraries(); - _registry.getNamespaces().clear(); - - for (Namespace ns : libs) - { - if (ns.getNSUri() != null) - { - _registry.getNamespaces().put(ns.getNSUri(), ns); - - } - } - - _registry.setUpToDate(true); - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() - { - public void run() - { - // only bother if the provider hasn't changed asynchronously - if (_timestamp == TaglibContentProvider.this._changeStamp - .get()) - { - viewerRefresh(_curInput); - } - } - }); - - return Status.OK_STATUS; - } - } - - static class TagRegistryInstance - { - private final TagRegistryFactoryInfo _info; - private final ITagRegistry _registry; - private final Map<String, Namespace> _namespaces; - private boolean _isUpToDate; - - public TagRegistryInstance(final TagRegistryFactoryInfo info, - ITagRegistry registry) - { - _info = info; - _registry = registry; - _namespaces = new ConcurrentHashMap<String, Namespace>(); - } - - public TagRegistryFactoryInfo getInfo() - { - return _info; - } - - public ITagRegistry getRegistry() - { - return _registry; - } - - public Map<String, Namespace> getNamespaces() - { - return _namespaces; - } - - public synchronized boolean isUpToDate() - { - return _isUpToDate; - } - - public synchronized void setUpToDate(boolean isUpToDate) - { - _isUpToDate = isUpToDate; - } - } - - /** - * Takes the place of a real tree model object while the real object is - * being retrieved. - * - */ - public static class TreePlaceholder - { - private final String _text; - private final Image _image; - - TreePlaceholder(final String text, final Image image) - { - _text = text; - _image = image; - } - - /** - * @return the placeholder text or null if none - */ - public String getText() - { - return _text; - } - - /** - * @return the image or null if none - */ - public Image getImage() - { - return _image; - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ValidatorDetailsForm.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ValidatorDetailsForm.java deleted file mode 100644 index 207cb5650..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/ValidatorDetailsForm.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.tagregistry; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IValidatorTagElement; -import org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm; -import org.eclipse.swt.widgets.Composite; - -/** - * Details form for validator tags. - * @author cbateman - * - */ -public class ValidatorDetailsForm extends AbstractXMLSectionsDetailsForm -{ - private final static String VALIDATOR_TYPE_SECTION_KEY = "validatorSection"; - private XMLTextSection _validatorTypeSection; - - @Override - protected Map<? extends Object, XMLTextSection> createXMLTextSections(Composite parent) - { - final Map<String, XMLTextSection> sections = new HashMap<String, XMLTextSection>(); - _validatorTypeSection = new XMLTextSection(getToolkit(), parent, "Validator Type Information"); - sections.put(VALIDATOR_TYPE_SECTION_KEY, _validatorTypeSection); - return sections; - } - - - @Override - protected Set<XMLTextSection> getInitiallyExpanded( - Map<Object, XMLTextSection> sections) - { - return Collections.singleton(_validatorTypeSection); - } - - @Override - protected void doUpdateSelection(Object newSelection) - { - if (newSelection instanceof IValidatorTagElement) - { - IValidatorTagElement validatorTagElement = (IValidatorTagElement) newSelection; - final ValidatorTypeInfo typeInfo = validatorTagElement.getValidator(); - - if (typeInfo != null) - { - final String formatText = "<form><p><b>Class:</b> %s</p> <p><b>Validator Id:</b> %s</p></form>"; - final String className = typeInfo.getClassName(); - final String validatorId = typeInfo.getValidatorId(); - - _validatorTypeSection.setText(String.format(formatText, - className == null ? "" : className, - validatorId == null ? "" : validatorId), true, false); - _validatorTypeSection.refresh(); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ELPrefPanel.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ELPrefPanel.java deleted file mode 100644 index b81fa6afd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ELPrefPanel.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.ui.internal.validation; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.core.internal.CompositeJSFPreferenceModel; -import org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel; -import org.eclipse.jst.jsf.ui.internal.Messages; -import org.eclipse.jst.jsf.validation.internal.ValidationPreferences; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.Button; -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.ui.preferences.IWorkbenchPreferenceContainer; - -/** - * Creates and manages a panel for configuring - * - * @author cbateman - */ -/*package*/ class ELPrefPanel -{ - /* view */ - private final Group _container; - private final Button _chkBuildValidation; - private final Button _chkIncrementalValidation; - private final ProblemSeveritiesConfigurationBlock _problemSeverities; - - /* model */ - private final ValidationPreferences _prefs; - - /** - * Allocates new container in parent. - * @param parent - * @param container - * @param prefs - */ - public ELPrefPanel(Composite parent, IWorkbenchPreferenceContainer container, ValidationPreferences prefs) - { - _prefs = prefs; - - _container = new Group(parent, SWT.NONE); - _container.setText(Messages.JSFValidationPreferencePage_ELPrefPanel_Title); - RowLayout rowLayout = new RowLayout(SWT.VERTICAL); - rowLayout.marginTop = 5; - rowLayout.marginLeft = 5; - _container.setLayout(rowLayout); - - _chkBuildValidation = new Button(_container, SWT.CHECK); - _chkBuildValidation.setText(Messages.JSFValidationPreferencePage_ELPrefPanel_BuildValidationCheckBoxTitle); - _chkBuildValidation.addSelectionListener(new SelectionAdapter() - { - public void widgetSelected(SelectionEvent e) - { - _prefs.getElPrefs().setEnableBuildValidation(_chkBuildValidation.getSelection()); - refresh(); - } - }); - - _chkIncrementalValidation = new Button(_container, SWT.CHECK); - _chkIncrementalValidation.setText(Messages.JSFValidationPreferencePage_ELPrefPanel_IncrementalValidationCheckBoxTitle); - _chkIncrementalValidation.addSelectionListener(new SelectionAdapter() - { - public void widgetSelected(SelectionEvent e) - { - _prefs.getElPrefs().setEnableIncrementalValidation(_chkIncrementalValidation.getSelection()); - refresh(); - } - }); - - new Label(_container, SWT.NONE); - - final List<IJSFPreferenceModel> models = new ArrayList<IJSFPreferenceModel>(); - models.add(_prefs.getElPrefs()); - models.add(_prefs.getTypeComparatorPrefs()); - final IJSFPreferenceModel compositeModel = new CompositeJSFPreferenceModel( - models); - - _problemSeverities = new ProblemSeveritiesConfigurationBlock(compositeModel, null, container); - _problemSeverities.createContents(_container); - } - - /** - * @return the top-level container managed by this panel - */ - public Control getControl() - { - return _container; - } - - - /** - * Refreshes the UI from the model - */ - public void refresh() - { - _chkBuildValidation.setSelection(_prefs.getElPrefs().isEnableBuildValidation()); - _chkIncrementalValidation. - setSelection(_prefs.getElPrefs().isEnableIncrementalValidation()); - _problemSeverities.updateControls(); - } - - /** - * - */ - public void processChanges() { - _problemSeverities.performOk(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/JSFValidationPreferencePage.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/JSFValidationPreferencePage.java deleted file mode 100644 index 4200f7935..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/JSFValidationPreferencePage.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.ui.internal.validation; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.validation.internal.ValidationPreferences; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; - -/** - * Workbench preference page for configuring JSF validation - * - * @author cbateman - * - */ -public class JSFValidationPreferencePage extends PreferencePage implements - IWorkbenchPreferencePage -{ - private final ValidationPreferences _prefs; - - private ELPrefPanel _elPrefPanel; - - /** - * Constructor - */ - public JSFValidationPreferencePage() - { - super(/* TODO: title*/); - _prefs = new ValidationPreferences(getPreferenceStore()); - _prefs.load(); - } - - protected Control createContents(Composite parent) - { - _elPrefPanel = new ELPrefPanel(parent, - (IWorkbenchPreferenceContainer) getContainer(), _prefs); - _elPrefPanel.refresh(); - return _elPrefPanel.getControl(); - } - - public void init(IWorkbench workbench) - { - // do nothing - } - - protected void performApply() - { - // process changes before committing to pref store - _elPrefPanel.processChanges(); - _prefs.commit(getPreferenceStore()); - } - - protected void performDefaults() - { - _prefs.setDefaults(); - _elPrefPanel.refresh(); - super.performDefaults(); - } - - public boolean performOk() - { - performApply(); - return true; - } - - protected IPreferenceStore doGetPreferenceStore() - { - // load the validation pref store - return JSFCorePlugin.getDefault().getPreferenceStore(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/JSFValidator.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/JSFValidator.java deleted file mode 100644 index 1ac1c72a6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/JSFValidator.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.validation; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jst.jsf.common.internal.JSPUtil; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils; -import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator; -import org.eclipse.jst.jsf.validation.internal.JSFValidatorFactory; -import org.eclipse.jst.jsf.validation.internal.ValidationPreferences; -import org.eclipse.jst.jsp.core.internal.validation.JSPValidator; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.ui.internal.reconcile.validator.ISourceValidator; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.wst.validation.internal.provisional.core.IValidationContext; - -/** - * @author cbateman - * - */ -public class JSFValidator extends JSPValidator implements ISourceValidator -{ - // TODO: should the source validator be a separate class in jsp.ui? - // problem with simple split off is that preference must also be split off - static final boolean DEBUG; - static - { - final String value = Platform - .getDebugOption("org.eclipse.jst.jsf.ui/validation"); //$NON-NLS-1$ - DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$ - } - - private IDocument fDocument; - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.internal.reconcile.validator.ISourceValidator#connect(org.eclipse.jface.text.IDocument) - */ - public void connect(final IDocument document) - { - fDocument = document; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.internal.reconcile.validator.ISourceValidator#disconnect(org.eclipse.jface.text.IDocument) - */ - public void disconnect(final IDocument document) - { - // finished - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.internal.reconcile.validator.ISourceValidator#validate(org.eclipse.jface.text.IRegion, - * org.eclipse.wst.validation.internal.provisional.core.IValidationContext, - * org.eclipse.wst.validation.internal.provisional.core.IReporter) - */ - public void validate(final IRegion dirtyRegion, - final IValidationContext helper, final IReporter reporter) - { - if (DEBUG) - { - System.out.println("exec JSPSemanticsValidator.validateRegion"); - } - - final IFile file = getFile(helper); - - if (fDocument instanceof IStructuredDocument) - { - final IStructuredDocument sDoc = (IStructuredDocument) fDocument; - final IStructuredDocumentRegion[] regions = sDoc - .getStructuredDocumentRegions(dirtyRegion.getOffset(), - dirtyRegion.getLength()); - if (regions != null) - { - final IJSFViewValidator validator = JSFValidatorFactory - .createDefaultXMLValidator(); - final ValidationPreferences prefs = new ValidationPreferences( - JSFCorePlugin.getDefault().getPreferenceStore()); - prefs.load(); - - final ValidationReporter jsfReporter = new ValidationReporter( - this, reporter, file, prefs); - validator.validateView(file, regions, jsfReporter); - } - } - } - - private IFile getFile(final IValidationContext helper) - { - final String[] uris = helper.getURIs(); - final IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot(); - if (uris.length > 0) - { - return wsRoot.getFile(new Path(uris[0])); - } - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsp.core.internal.validation.JSPValidator#validateFile(org.eclipse.core.resources.IFile, - * org.eclipse.wst.validation.internal.provisional.core.IReporter) - */ - @Override - protected void validateFile(final IFile file, final IReporter reporter) - { - if (shouldValidate(file)) - { - final IJSFViewValidator validator = JSFValidatorFactory - .createDefaultXMLValidator(); - final ValidationPreferences prefs = new ValidationPreferences( - JSFCorePlugin.getDefault().getPreferenceStore()); - prefs.load(); - - final ValidationReporter jsfReporter = new ValidationReporter(this, - reporter, file, prefs); - validator.validateView(file, jsfReporter); - } - } - - private boolean shouldValidate(final IFile file) - { - return (JSPUtil.isJSPContentType(file) - && JSFAppConfigUtils.isValidJSFProject(file.getProject())); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/MyLocalizedMessage.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/MyLocalizedMessage.java deleted file mode 100644 index f479a0f53..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/MyLocalizedMessage.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.ui.internal.validation; - -import java.util.Locale; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.wst.validation.internal.core.Message; - -/** - * EL customized localizable validation message - * @author cbateman - * - */ -class MyLocalizedMessage extends Message -{ - private final String _message; - private final int _errorCode; - - /** - * @param severity - * @param messageText - * @param targetObject - * @param errorCode - */ - public MyLocalizedMessage(int severity, String messageText, IResource targetObject, int errorCode) { - this(severity, messageText, (Object) targetObject, errorCode); - } - - /** - * @param severity - * @param messageText - * @param targetObject - * @param errorCode - */ - private MyLocalizedMessage(int severity, String messageText, Object targetObject, int errorCode) { - super(JSFCorePlugin.getDefault().getBundle().getSymbolicName(), severity, - messageText); - _message = messageText; - setTargetObject(targetObject); - _errorCode = errorCode; - } - - /** - * @return the localized message - */ - public String getLocalizedMessage() { - return _message; - } - - /** - * @see org.eclipse.wst.validation.internal.core.Message#getText() - */ - public String getText() { - return getLocalizedMessage(); - } - - /** - * @see org.eclipse.wst.validation.internal.core.Message#getText(java.lang.ClassLoader) - */ - public String getText(ClassLoader cl) { - return getLocalizedMessage(); - } - - /** - * @see org.eclipse.wst.validation.internal.core.Message#getText(java.util.Locale) - */ - public String getText(Locale l) { - return getLocalizedMessage(); - } - - public String getText(Locale l, ClassLoader cl) { - return getLocalizedMessage(); - } - - /** - * @return the error code related to this message - */ - public int getErrorCode() { - return _errorCode; - } - - - /** - * @param offset - * @return true if this message applies to document offset - */ - public boolean appliesTo(int offset) - { - return (offset >= getOffset() && offset < getOffset()+getLength()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/OptionsConfigurationBlock.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/OptionsConfigurationBlock.java deleted file mode 100644 index 99dcd24f1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/OptionsConfigurationBlock.java +++ /dev/null @@ -1,979 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * Cameron Bateman/Oracle - adapted for use in JSF validation tooling - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.validation; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ProjectScope; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.preferences.DefaultScope; -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.jst.jsf.validation.internal.Severity; -import org.eclipse.swt.SWT; -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.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.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.forms.events.ExpansionAdapter; -import org.eclipse.ui.forms.events.ExpansionEvent; -import org.eclipse.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; -import org.eclipse.ui.preferences.IWorkingCopyManager; -import org.eclipse.ui.preferences.WorkingCopyManager; -import org.osgi.service.prefs.BackingStoreException; - -/** - * Abstract options configuration block providing a general implementation for setting up - * an options configuration page. - * - * @since 2.1 - */ -abstract class OptionsConfigurationBlock -{ - /** - * The preference model to be used - */ - protected final IJSFPreferenceModel _prefs; - - static final class Key - { - private String fQualifier; - private String fKey; - - Key(String qualifier, String key) { - fQualifier= qualifier; - fKey= key; - } - - /** - * @return the key name - */ - public String getName() { - return fKey; - } - -// private IEclipsePreferences getNode(IScopeContext context, IWorkingCopyManager manager) { -// IEclipsePreferences node= context.getNode(fQualifier); -// if (manager != null) { -// return manager.getWorkingCopy(node); -// } -// return node; -// -// } - - /** - * @param prefModel - * @param context - * @param manager - * @return the value stored for the key - */ - public Object getStoredValue(IJSFPreferenceModel prefModel, IScopeContext context, IWorkingCopyManager manager) - { - return prefModel.getStoredValueByKey(context, fKey); - } - - /** - * @param prefModel - * @param context - * @param manager - * @return the stored value in prefModel under context for - * this key - */ - public Object getCurValue(IJSFPreferenceModel prefModel, IScopeContext context, IWorkingCopyManager manager) { - //return getNode(context, manager).get(fKey, null); - return prefModel.getValueByKey(context, fKey); - } - - /** - * @param prefModel - * @param lookupOrder - * @param ignoreTopScope - * @param manager - * @return the stored value in the prefModelunder context - * using the list of lookupOrder for precedence of scopes - * in which to look. Return first found based on order in lookupOrder - */ - public Object getCurValue(IJSFPreferenceModel prefModel, IScopeContext[] lookupOrder, boolean ignoreTopScope, IWorkingCopyManager manager) { - for (int i= ignoreTopScope ? 1 : 0; i < lookupOrder.length; i++) { - Object value= getCurValue(prefModel, lookupOrder[i], manager); - if (value != null) { - return value; - } - } - return null; - } - - /** - * Set the stored value - * @param prefModel - * @param context - * @param value - * @param manager - * @return the old value or null if none - */ - public Object setCurValue(IJSFPreferenceModel prefModel, IScopeContext context, Object value, IWorkingCopyManager manager) { - return prefModel.setValueByKey(context, fKey, value); -// if (value != null) { -// getNode(context, manager).put(fKey, value); -// } else { -// getNode(context, manager).remove(fKey); -// } - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - return fQualifier + '/' + fKey; - } - - /** - * @return the plugin qualifier - */ - public String getQualifier() { - return fQualifier; - } - - } - - - static class ControlData { - private Key fKey; - private String[] fValues; - - ControlData(Key key, String[] values) { - fKey= key; - fValues= values; - } - - Key getKey() { - return fKey; - } - - String getValue(boolean selection) { - int index= selection ? 0 : 1; - return fValues[index]; - } - - String getValue(int index) { - return fValues[index]; - } - - int getSelection(String value) { - if (value != null) { - for (int i= 0; i < fValues.length; i++) { - if (value.equals(fValues[i])) { - return i; - } - } - } - return fValues.length -1; // assume the last option is the least severe - } - } - - private static final String REBUILD_COUNT_KEY= "preferences_build_requested"; //$NON-NLS-1$ - - private static final String SETTINGS_EXPANDED= "expanded"; //$NON-NLS-1$ - - private final ArrayList fCheckBoxes; - private final ArrayList fComboBoxes; - private final ArrayList fTextBoxes; - private final HashMap fLabels; - private final ArrayList fExpandedComposites; - - private SelectionListener fSelectionListener; - private ModifyListener fTextModifyListener; - - // TODO: protected IStatusChangeListener fContext; - private final IProject fProject; // project or null - private final Key[] fAllKeys; - - private IScopeContext[] fLookupOrder; - - private Shell fShell; - - private final IWorkingCopyManager fManager; - private IWorkbenchPreferenceContainer fContainer; - - private Map fDisabledProjectSettings; // null when project specific settings are turned off - - private int fRebuildCount; /// used to prevent multiple dialogs that ask for a rebuild - - OptionsConfigurationBlock(/*IStatusChangeListener context,*/IJSFPreferenceModel prefs, IProject project, Key[] allKeys, IWorkbenchPreferenceContainer container) { - //fContext= context; - fProject= project; - fAllKeys= allKeys; - fContainer= container; - _prefs = prefs; - - if (container == null) { - fManager= new WorkingCopyManager(); - } else { - fManager= container.getWorkingCopyManager(); - } - - if (fProject != null) { - fLookupOrder= new IScopeContext[] { - new ProjectScope(fProject), - new InstanceScope(), - new DefaultScope() - }; - } else { - fLookupOrder= new IScopeContext[] { - new InstanceScope(), - new DefaultScope() - }; - } - - testIfOptionsComplete(allKeys); - if (fProject == null || hasProjectSpecificOptions(fProject)) { - fDisabledProjectSettings= null; - } else { - fDisabledProjectSettings= new IdentityHashMap(); - for (int i= 0; i < allKeys.length; i++) { - Key curr= allKeys[i]; - fDisabledProjectSettings.put(curr, curr.getCurValue(_prefs, fLookupOrder, false, fManager)); - } - } - - fCheckBoxes= new ArrayList(); - fComboBoxes= new ArrayList(); - fTextBoxes= new ArrayList(2); - fLabels= new HashMap(); - fExpandedComposites= new ArrayList(); - - fRebuildCount= getRebuildCount(); - } - - /** - * @return the preference container - */ - protected final IWorkbenchPreferenceContainer getPreferenceContainer() { - return fContainer; - } - - /** - * @param plugin - * @param key - * @return construct a new Key based on the on the plugin id and - * preference key - */ - protected static Key getKey(String plugin, String key) { - return new Key(plugin, key); - } - - /** - * @param key - * @return construct a new Key for a JSF core plugin preference - */ - protected final static Key getJSFCoreKey(String key) { - return getKey(JSFCorePlugin.PLUGIN_ID, key); - } - - private void testIfOptionsComplete(Key[] allKeys) { - for (int i= 0; i < allKeys.length; i++) { - if (allKeys[i].getCurValue(_prefs, fLookupOrder, false, fManager) == null) { - JSFUiPlugin.log(IStatus.ERROR, "preference option missing: " + allKeys[i] + " (" + this.getClass().getName() +')'); //$NON-NLS-1$//$NON-NLS-2$ - } - } - } - - private int getRebuildCount() { - return fManager.getWorkingCopy(new DefaultScope().getNode(JavaUI.ID_PLUGIN)).getInt(REBUILD_COUNT_KEY, 0); - } - - private void incrementRebuildCount() { - fRebuildCount++; - fManager.getWorkingCopy(new DefaultScope().getNode(JavaUI.ID_PLUGIN)).putInt(REBUILD_COUNT_KEY, fRebuildCount); - } - -// public void selectOption(String key, String qualifier) { -// for (int i= 0; i < fAllKeys.length; i++) { -// Key curr= fAllKeys[i]; -// if (curr.getName().equals(key) && curr.getQualifier().equals(qualifier)) { -// selectOption(curr); -// } -// } -// } -// -// public void selectOption(Key key) { -// Control control= findControl(key); -// if (control != null) { -// if (!fExpandedComposites.isEmpty()) { -// ExpandableComposite expandable= getParentExpandableComposite(control); -// if (expandable != null) { -// for (int i= 0; i < fExpandedComposites.size(); i++) { -// ExpandableComposite curr= (ExpandableComposite) fExpandedComposites.get(i); -// curr.setExpanded(curr == expandable); -// } -// expandedStateChanged(expandable); -// } -// } -// control.setFocus(); -// } -// } - - - /** - * @param project - * @return true if there are project specific overrides in the - * preferences for 'project' - */ - public final boolean hasProjectSpecificOptions(IProject project) { - if (project != null) { - IScopeContext projectContext= new ProjectScope(project); - Key[] allKeys= fAllKeys; - for (int i= 0; i < allKeys.length; i++) { - if (allKeys[i].getCurValue(_prefs, projectContext, fManager) != null) { - return true; - } - } - } - return false; - } - - /** - * @return the shell hosting the UI - */ - protected Shell getShell() { - return fShell; - } - - /** - * Set the shell hosting the UI. - * @param shell - */ - protected void setShell(Shell shell) { - fShell= shell; - } - - /** - * @param parent - * @return the parent of the UI control to be created - */ - protected abstract Control createContents(Composite parent); - -// protected Button addCheckBox(Composite parent, String label, Key key, String[] values, int indent) { -// ControlData data= new ControlData(key, values); -// -// GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); -// gd.horizontalSpan= 3; -// gd.horizontalIndent= indent; -// -// Button checkBox= new Button(parent, SWT.CHECK); -// checkBox.setFont(JFaceResources.getDialogFont()); -// checkBox.setText(label); -// checkBox.setData(data); -// checkBox.setLayoutData(gd); -// checkBox.addSelectionListener(getSelectionListener()); -// -// makeScrollableCompositeAware(checkBox); -// -// String currValue= getValue(key); -// checkBox.setSelection(data.getSelection(currValue) == 0); -// -// fCheckBoxes.add(checkBox); -// -// return checkBox; -// } - - /** - * @param parent - * @param label - * @param key - * @param values - * @param indent - * @param widthHint - * @param listener - * @return a check box styled button with a related link - */ - protected Button addCheckBoxWithLink(Composite parent, String label, Key key, String[] values, int indent, int widthHint, SelectionListener listener) { - ControlData data= new ControlData(key, values); - - GridData gd= new GridData(GridData.FILL, GridData.FILL, true, false); - gd.horizontalSpan= 3; - gd.horizontalIndent= indent; - - Composite composite= new Composite(parent, SWT.NONE); - GridLayout layout= new GridLayout(); - layout.marginHeight= 0; - layout.marginWidth= 0; - layout.numColumns= 2; - composite.setLayout(layout); - composite.setLayoutData(gd); - - Button checkBox= new Button(composite, SWT.CHECK); - checkBox.setFont(JFaceResources.getDialogFont()); - checkBox.setData(data); - checkBox.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); - checkBox.addSelectionListener(getSelectionListener()); - - gd= new GridData(GridData.FILL, GridData.CENTER, true, false); - gd.widthHint= widthHint; - - Link link= new Link(composite, SWT.NONE); - link.setText(label); - link.setLayoutData(gd); - if (listener != null) { - link.addSelectionListener(listener); - } - - makeScrollableCompositeAware(link); - makeScrollableCompositeAware(checkBox); - - String currValue= getValue(key); - checkBox.setSelection(data.getSelection(currValue) == 0); - - fCheckBoxes.add(checkBox); - - return checkBox; - } - - /** - * @param parent - * @param label - * @param key - * @param values - * @param valueLabels - * @param indent - * @return a Combo box added to parent with the label and key - */ - protected Combo addComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) { - GridData gd= new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1); - gd.horizontalIndent= indent; - - Label labelControl= new Label(parent, SWT.LEFT); - labelControl.setFont(JFaceResources.getDialogFont()); - - labelControl.setText(label); - labelControl.setLayoutData(gd); - - Combo comboBox= newComboControl(parent, key, values, valueLabels); - comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - fLabels.put(comboBox, labelControl); - - return comboBox; - } - - Combo addInversedComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) { - GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); - gd.horizontalIndent= indent; - gd.horizontalSpan= 3; - - Composite composite= new Composite(parent, SWT.NONE); - GridLayout layout= new GridLayout(); - layout.marginHeight= 0; - layout.marginWidth= 0; - layout.numColumns= 2; - composite.setLayout(layout); - composite.setLayoutData(gd); - - Combo comboBox= newComboControl(composite, key, values, valueLabels); - comboBox.setFont(JFaceResources.getDialogFont()); - comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - Label labelControl= new Label(composite, SWT.LEFT | SWT.WRAP); - labelControl.setText(label); - labelControl.setLayoutData(new GridData()); - - fLabels.put(comboBox, labelControl); - return comboBox; - } - - Combo newComboControl(Composite composite, Key key, String[] values, String[] valueLabels) { - ControlData data= new ControlData(key, values); - - Combo comboBox= new Combo(composite, SWT.READ_ONLY); - comboBox.setItems(valueLabels); - comboBox.setData(data); - comboBox.addSelectionListener(getSelectionListener()); - comboBox.setFont(JFaceResources.getDialogFont()); - - makeScrollableCompositeAware(comboBox); - - String currValue= getValue(key); - comboBox.select(data.getSelection(currValue)); - - fComboBoxes.add(comboBox); - return comboBox; - } - - Text addTextField(Composite parent, String label, Key key, int indent, int widthHint) { - Label labelControl= new Label(parent, SWT.WRAP); - labelControl.setText(label); - labelControl.setFont(JFaceResources.getDialogFont()); - labelControl.setLayoutData(new GridData()); - - Text textBox= new Text(parent, SWT.BORDER | SWT.SINGLE); - textBox.setData(key); - textBox.setLayoutData(new GridData()); - - makeScrollableCompositeAware(textBox); - - fLabels.put(textBox, labelControl); - - String currValue= getValue(key); - if (currValue != null) { - textBox.setText(currValue); - } - textBox.addModifyListener(getTextModifyListener()); - - GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL); - if (widthHint != 0) { - data.widthHint= widthHint; - } - data.horizontalIndent= indent; - data.horizontalSpan= 2; - textBox.setLayoutData(data); - - fTextBoxes.add(textBox); - return textBox; - } - - ScrolledPageContent getParentScrolledComposite(Control control) { - Control parent= control.getParent(); - while (!(parent instanceof ScrolledPageContent) && parent != null) { - parent= parent.getParent(); - } - if (parent instanceof ScrolledPageContent) { - return (ScrolledPageContent) parent; - } - return null; - } - - ExpandableComposite getParentExpandableComposite(Control control) { - Control parent= control.getParent(); - while (!(parent instanceof ExpandableComposite) && parent != null) { - parent= parent.getParent(); - } - if (parent instanceof ExpandableComposite) { - return (ExpandableComposite) parent; - } - return null; - } - - private void makeScrollableCompositeAware(Control control) { - ScrolledPageContent parentScrolledComposite= getParentScrolledComposite(control); - if (parentScrolledComposite != null) { - parentScrolledComposite.adaptChild(control); - } - } - - ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) { - ExpandableComposite excomposite= new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); - excomposite.setText(label); - excomposite.setExpanded(false); - excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1)); - excomposite.addExpansionListener(new ExpansionAdapter() { - public void expansionStateChanged(ExpansionEvent e) { - expandedStateChanged((ExpandableComposite) e.getSource()); - } - }); - fExpandedComposites.add(excomposite); - makeScrollableCompositeAware(excomposite); - return excomposite; - } - - final void expandedStateChanged(ExpandableComposite expandable) { - ScrolledPageContent parentScrolledComposite= getParentScrolledComposite(expandable); - if (parentScrolledComposite != null) { - parentScrolledComposite.reflow(true); - } - } - - void restoreSectionExpansionStates(IDialogSettings settings) { - for (int i= 0; i < fExpandedComposites.size(); i++) { - ExpandableComposite excomposite= (ExpandableComposite) fExpandedComposites.get(i); - if (settings == null) { - excomposite.setExpanded(i == 0); // only expand the first node by default - } else { - excomposite.setExpanded(settings.getBoolean(SETTINGS_EXPANDED + String.valueOf(i))); - } - } - } - - void storeSectionExpansionStates(IDialogSettings settings) { - for (int i= 0; i < fExpandedComposites.size(); i++) { - ExpandableComposite curr= (ExpandableComposite) fExpandedComposites.get(i); - settings.put(SETTINGS_EXPANDED + String.valueOf(i), curr.isExpanded()); - } - } - - SelectionListener getSelectionListener() { - if (fSelectionListener == null) { - fSelectionListener= new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {/*do nothing*/} - - public void widgetSelected(SelectionEvent e) { - controlChanged(e.widget); - } - }; - } - return fSelectionListener; - } - - ModifyListener getTextModifyListener() { - if (fTextModifyListener == null) { - fTextModifyListener= new ModifyListener() { - public void modifyText(ModifyEvent e) { - textChanged((Text) e.widget); - } - }; - } - return fTextModifyListener; - } - - void controlChanged(Widget widget) { - ControlData data= (ControlData) widget.getData(); - String newValue= null; - if (widget instanceof Button) { - newValue= data.getValue(((Button)widget).getSelection()); - } else if (widget instanceof Combo) { - newValue= data.getValue(((Combo)widget).getSelectionIndex()); - } else { - return; - } - String oldValue= setValue(data.getKey(), newValue); - validateSettings(data.getKey(), oldValue, newValue); - } - - void textChanged(Text textControl) { - Key key= (Key) textControl.getData(); - String number= textControl.getText(); - String oldValue= setValue(key, number); - validateSettings(key, oldValue, number); - } - - boolean checkValue(Key key, String value) { - return value.equals(getValue(key)); - } - - String getValue(Key key) { - if (fDisabledProjectSettings != null) { - return (String) fDisabledProjectSettings.get(key); - } - return key.getCurValue(_prefs, fLookupOrder, false, fManager).toString(); - } - - - boolean getBooleanValue(Key key) { - return Boolean.valueOf(getValue(key)).booleanValue(); - } - - String setValue(Key key, String value) { - if (fDisabledProjectSettings != null) { - return (String) fDisabledProjectSettings.put(key, value); - } - Object newValue = key.setCurValue(_prefs, fLookupOrder[0], Severity.valueOfString(value), fManager); - return newValue != null ? newValue.toString() : ""; - } - - String setValue(Key key, boolean value) { - return setValue(key, String.valueOf(value)); - } - - /** - * Returns the value as actually stored in the preference store. - * @param key - * @return the value as actually stored in the preference store. - */ - Object getStoredValue(Key key) { - return key.getCurValue(_prefs, fLookupOrder, false, fManager); - } - - /** - * Update fields and validate. - * @param changedKey Key that changed, or null, if all changed. - * @param oldValue - * @param newValue - */ - protected abstract void validateSettings(Key changedKey, String oldValue, String newValue); - - - String[] getTokens(String text, String separator) { - StringTokenizer tok= new StringTokenizer(text, separator); - int nTokens= tok.countTokens(); - String[] res= new String[nTokens]; - for (int i= 0; i < res.length; i++) { - res[i]= tok.nextToken().trim(); - } - return res; - } - - private boolean getChanges(IScopeContext currContext, List changedSettings) { - boolean needsBuild= false; - for (int i= 0; i < fAllKeys.length; i++) { - Key key= fAllKeys[i]; - Object oldVal= key.getStoredValue(_prefs, currContext, null); - Object val= key.getCurValue(_prefs, currContext, fManager); - if (val == null) { - if (oldVal != null) { - changedSettings.add(key); - needsBuild |= !oldVal.equals(key.getCurValue(_prefs, fLookupOrder, true, fManager)); - } - } else if (!val.equals(oldVal)) { - changedSettings.add(key); - needsBuild |= oldVal != null || !val.equals(key.getCurValue(_prefs, fLookupOrder, true, fManager)); - } - } - return needsBuild; - } - - void useProjectSpecificSettings(boolean enable) { - boolean hasProjectSpecificOption= fDisabledProjectSettings == null; - if (enable != hasProjectSpecificOption && fProject != null) { - if (enable) { - for (int i= 0; i < fAllKeys.length; i++) { - Key curr= fAllKeys[i]; - String val= (String) fDisabledProjectSettings.get(curr); - curr.setCurValue(_prefs, fLookupOrder[0], Severity.valueOfString(val), fManager); - } - fDisabledProjectSettings= null; - updateControls(); - validateSettings(null, null, null); - } else { - fDisabledProjectSettings= new IdentityHashMap(); - for (int i= 0; i < fAllKeys.length; i++) { - Key curr= fAllKeys[i]; - Object oldSetting= curr.getCurValue(_prefs, fLookupOrder, false, fManager); - fDisabledProjectSettings.put(curr, oldSetting); - curr.setCurValue(_prefs, fLookupOrder[0], null, fManager); // clear project settings - } - } - } - } - - boolean areSettingsEnabled() { - return fDisabledProjectSettings == null || fProject == null; - } - - - boolean performOk() { - return processChanges(fContainer); - } - -// public boolean performApply() { -// return processChanges(null); // apply directly -// } - - boolean processChanges(IWorkbenchPreferenceContainer container) { - IScopeContext currContext= fLookupOrder[0]; - - List /* <Key>*/ changedOptions= new ArrayList(); - boolean needsBuild= getChanges(currContext, changedOptions); - if (changedOptions.isEmpty()) { - return true; - } - if (needsBuild) { - int count= getRebuildCount(); - if (count > fRebuildCount) { - needsBuild= false; // build already requested - fRebuildCount= count; - } - } - - boolean doBuild= false; - - final String showBuildWarningKey = JSFCorePlugin.PLUGIN_ID + "." + "buildwarning_dont_show_again"; - final IPreferenceStore prefStore = JSFCorePlugin.getDefault().getPreferenceStore(); - final boolean showDialog = !MessageDialogWithToggle.ALWAYS.equals(prefStore.getString(showBuildWarningKey)); - - if (needsBuild && showDialog) { - String[] strings= getFullBuildDialogStrings(fProject == null); - if (strings != null) { - MessageDialogWithToggle.openInformation - (getShell(), strings[0], strings[1], - PreferencesMessages.ProblemSeveritiesConfigurationBlock_buildwarning_dont_show_again - , false, prefStore, showBuildWarningKey); -// int res= dialog.open(); -// if (res == 0) { -// doBuild= true; -// } else if (res != 1) { -// return false; // cancel pressed -// } - } - } - if (container != null) { - // no need to apply the changes to the original store: will be done by the page container - if (doBuild) { // post build - incrementRebuildCount(); - // TODO: container.registerUpdateJob(CoreUtility.getBuildJob(fProject)); - } - } else { - // apply changes right away - try { - fManager.applyChanges(); - } catch (BackingStoreException e) { - JSFUiPlugin.log(IStatus.ERROR, "Error applying changes", e); - return false; - } - if (doBuild) { - //CoreUtility.getBuildJob(fProject).schedule(); - } - - } - return true; - } - - abstract String[] getFullBuildDialogStrings(boolean workspaceSettings); - - -// public void performDefaults() { -// for (int i= 0; i < fAllKeys.length; i++) { -// Key curr= fAllKeys[i]; -// String defValue= curr.getStoredValue(fLookupOrder, true, fManager); -// setValue(curr, defValue); -// } -// -// settingsUpdated(); -// updateControls(); -// validateSettings(null, null, null); -// } - - /** - * @since 3.1 - */ - void performRevert() { - for (int i= 0; i < fAllKeys.length; i++) { - Key curr= fAllKeys[i]; - String origValue= curr.getCurValue(_prefs, fLookupOrder, false, null).toString(); - setValue(curr, origValue); - } - - updateControls(); - validateSettings(null, null, null); - } - - void dispose() { - // do nothing; sub-class should override - } - - void updateControls() { - // update the UI - for (int i= fCheckBoxes.size() - 1; i >= 0; i--) { - updateCheckBox((Button) fCheckBoxes.get(i)); - } - for (int i= fComboBoxes.size() - 1; i >= 0; i--) { - updateCombo((Combo) fComboBoxes.get(i)); - } - for (int i= fTextBoxes.size() - 1; i >= 0; i--) { - updateText((Text) fTextBoxes.get(i)); - } - } - - void updateCombo(Combo curr) { - ControlData data= (ControlData) curr.getData(); - - String currValue= getValue(data.getKey()); - curr.select(data.getSelection(currValue)); - } - - void updateCheckBox(Button curr) { - ControlData data= (ControlData) curr.getData(); - - String currValue= getValue(data.getKey()); - curr.setSelection(data.getSelection(currValue) == 0); - } - - void updateText(Text curr) { - Key key= (Key) curr.getData(); - - String currValue= getValue(key); - if (currValue != null) { - curr.setText(currValue); - } - } - - Button getCheckBox(Key key) { - for (int i= fCheckBoxes.size() - 1; i >= 0; i--) { - Button curr= (Button) fCheckBoxes.get(i); - ControlData data= (ControlData) curr.getData(); - if (key.equals(data.getKey())) { - return curr; - } - } - return null; - } - - Combo getComboBox(Key key) { - for (int i= fComboBoxes.size() - 1; i >= 0; i--) { - Combo curr= (Combo) fComboBoxes.get(i); - ControlData data= (ControlData) curr.getData(); - if (key.equals(data.getKey())) { - return curr; - } - } - return null; - } - - Text getTextControl(Key key) { - for (int i= fTextBoxes.size() - 1; i >= 0; i--) { - Text curr= (Text) fTextBoxes.get(i); - ControlData data= (ControlData) curr.getData(); - if (key.equals(data.getKey())) { - return curr; - } - } - return null; - } - - Control findControl(Key key) { - Combo comboBox= getComboBox(key); - if (comboBox != null) { - return comboBox; - } - Button checkBox= getCheckBox(key); - if (checkBox != null) { - return checkBox; - } - Text text= getTextControl(key); - if (text != null) { - return text; - } - return null; - } - - void setComboEnabled(Key key, boolean enabled) { - Combo combo= getComboBox(key); - Label label= (Label) fLabels.get(combo); - combo.setEnabled(enabled); - label.setEnabled(enabled); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/PixelConverter.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/PixelConverter.java deleted file mode 100644 index a5ed50309..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/PixelConverter.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * Oracle - copied for use in JSF validation tooling - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.validation; - -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.jface.dialogs.Dialog; - -/** - * Copied from JDT. Used by OptionsConfigurationBlock - * - */ -class PixelConverter { - - private final FontMetrics fFontMetrics; - - /** - * @param control - */ - PixelConverter(Control control) { - this(control.getFont()); - } - - /** - * @param font - */ - PixelConverter(Font font) { - GC gc = new GC(font.getDevice()); - gc.setFont(font); - fFontMetrics= gc.getFontMetrics(); - gc.dispose(); - } - - /* - * see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int) - */ - int convertHeightInCharsToPixels(int chars) { - return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars); - } - - /* - * see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int) - */ - int convertHorizontalDLUsToPixels(int dlus) { - return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus); - } - - /* - * see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int) - */ - int convertVerticalDLUsToPixels(int dlus) { - return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus); - } - - /* - * see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int) - */ - int convertWidthInCharsToPixels(int chars) { - return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/PreferencesMessages.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/PreferencesMessages.java deleted file mode 100644 index 2148c52e1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/PreferencesMessages.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * John Kaplan, johnkaplantech@gmail.com - 108071 [code templates] template for body of newly created class - * Oracle - adapted for JSF tooling - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.validation; - -import org.eclipse.osgi.util.NLS; - -/** - * NLS messages for validation severity preferences - * - * @author cbateman - * - */ -public final class PreferencesMessages extends NLS { - - private static final String BUNDLE_NAME= "org.eclipse.jst.jsf.ui.internal.validation.messages";//$NON-NLS-1$ - - private PreferencesMessages() { - // Do not instantiate - } - - static { - NLS.initializeMessages(BUNDLE_NAME, PreferencesMessages.class); - } - - /** - * see messages.properties - */ - public static String ProblemSeveritiesPreferencePage_title; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_error; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_warning; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_ignore; - - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_section_id_resolution; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_section_general; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_section_type_coercion_problems; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_section_constant_folding_and_unused_code; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_section_programming_errors; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_section_type_comparison; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_needsbuild_title; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_needsfullbuild_message; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_needsprojectbuild_message; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_buildwarning_dont_show_again; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_common_description; - - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_general_syntax_error; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_empty_el_expression; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_missing_closing_expr_bracket; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_cannot_apply_operator_to_method_binding; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_dotted_property_key_should_use_array; - - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_variable_not_found; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_member_not_found; - - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_binary_op_numeric_coercion_error; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_binary_op_boolean_coercion_error; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_binary_op_no_coercion_available; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_binary_op_literal_to_number_coercion_error; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_unary_op_numeric_coercion_error; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_unary_op_boolean_coercion_error; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_unary_op_string_coercion_not_guaranteed; - - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_both_binary_operands_null; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_binary_expression_always_evaluates_same; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_equality_with_null_always_same; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_unary_expression_always_evaluates_same; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_empty_expression_always_false; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_enumeration_comparision_always_same; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_minus_on_null_always_zero; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_first_argument_short_circuits_expression; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_second_argument_always_evaluates_same; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_apply_dot_operator_with_null; - - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_possible_division_by_zero; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_possible_array_index_out_of_bounds; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_incompatible_enumeration_comparison; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_member_is_intermediate; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_method_expression_expected; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_incompatible_type_assignment; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_value_expression_expected; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_incompatible_method_types; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_property_not_readable; - /** - * see messages.properties - */ - public static String ProblemSeveritiesConfigurationBlock_pb_property_not_writable; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ProblemSeveritiesConfigurationBlock.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ProblemSeveritiesConfigurationBlock.java deleted file mode 100644 index 1aee97190..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ProblemSeveritiesConfigurationBlock.java +++ /dev/null @@ -1,470 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * Oracle - adapted for use in JSF Tooling - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.validation; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel; -import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin; -import org.eclipse.jst.jsf.validation.internal.ELValidationPreferences; -import org.eclipse.jst.jsf.validation.internal.JSFTypeComparatorPreferences; -import org.eclipse.jst.jsf.validation.internal.Severity; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -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.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; - - -/** - */ -/*package*/ class ProblemSeveritiesConfigurationBlock extends OptionsConfigurationBlock { - - private static final String SETTINGS_SECTION_NAME= "ProblemSeveritiesConfigurationBlock"; //$NON-NLS-1$ - - /** - * preference key. Match to DiagnosticFactory constants - */ - private final static Key PREF_BINARY_OP_BOTH_OPERANDS_NULL = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_BOTH_OPERANDS_NULL); - private final static Key PREF_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_POSSIBLE_DIVISION_BY_ZERO); - private final static Key PREF_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION); - private final static Key PREF_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME); - private final static Key PREF_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME); - private final static Key PREF_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN); - private final static Key PREF_BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS); - private final static Key PREF_BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME); - private final static Key PREF_BINARY_OP_NO_AVAILABLE_TYPE_COERCION = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_NO_AVAILABLE_TYPE_COERCION); - private final static Key PREF_BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS); - private final static Key PREF_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME = - getJSFCoreKey(ELValidationPreferences.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME); - private final static Key PREF_UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE = - getJSFCoreKey(ELValidationPreferences.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE); - private final static Key PREF_UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO = - getJSFCoreKey(ELValidationPreferences.UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO); - private final static Key PREF_UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION = - getJSFCoreKey(ELValidationPreferences.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION); - private final static Key PREF_UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN = - getJSFCoreKey(ELValidationPreferences.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN); -// private final static Key PREF_TERNARY_OP_CHOICE_IS_ALWAYS_SAME = -// getJSFCoreKey(ELValidationPreferences.TERNARY_OP_CHOICE_IS_ALWAYS_SAME); -// private final static Key PREF_TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN = -// getJSFCoreKey(ELValidationPreferences.TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN); - private final static Key PREF_UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED = - getJSFCoreKey(ELValidationPreferences.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED); - private final static Key PREF_CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING = - getJSFCoreKey(ELValidationPreferences.CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING); - private final static Key PREF_MEMBER_NOT_FOUND = - getJSFCoreKey(ELValidationPreferences.MEMBER_NOT_FOUND); - private final static Key PREF_VARIABLE_NOT_FOUND = - getJSFCoreKey(ELValidationPreferences.VARIABLE_NOT_FOUND); - private final static Key PREF_MISSING_CLOSING_EXPR_BRACKET = - getJSFCoreKey(ELValidationPreferences.MISSING_CLOSING_EXPR_BRACKET); - private final static Key PREF_GENERAL_SYNTAX_ERROR = - getJSFCoreKey(ELValidationPreferences.GENERAL_SYNTAX_ERROR); - private final static Key PREF_EMPTY_EL_EXPRESSION = - getJSFCoreKey(ELValidationPreferences.EMPTY_EL_EXPRESSION); - private final static Key PREF_BINARY_OP_DOT_WITH_VALUEB_NULL = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_DOT_WITH_VALUEB_NULL); - private final static Key PREF_BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY); - private final static Key PREF_POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS = - getJSFCoreKey(ELValidationPreferences.POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS); - private final static Key PREF_BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME = - getJSFCoreKey(ELValidationPreferences.BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME); - private final static Key PREF_BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE = - getJSFCoreKey(ELValidationPreferences.BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE); - private final static Key PREF_MEMBER_IS_INTERMEDIATE = - getJSFCoreKey(ELValidationPreferences.MEMBER_IS_INTERMEDIATE); - - // TypeComparator keys - private final static Key PREF_INCOMPATIBLE_METHOD_TYPES = - getJSFCoreKey(JSFTypeComparatorPreferences.INCOMPATIBLE_METHOD_TYPES); - private final static Key PREF_INCOMPATIBLE_TYPES = - getJSFCoreKey(JSFTypeComparatorPreferences.INCOMPATIBLE_TYPES); - private final static Key PREF_METHOD_EXPRESSION_EXPECTED = - getJSFCoreKey(JSFTypeComparatorPreferences.METHOD_EXPRESSION_EXPECTED); - private final static Key PREF_PROPERTY_NOT_READABLE = - getJSFCoreKey(JSFTypeComparatorPreferences.PROPERTY_NOT_READABLE); - private final static Key PREF_PROPERTY_NOT_WRITABLE = - getJSFCoreKey(JSFTypeComparatorPreferences.PROPERTY_NOT_WRITABLE); - private final static Key PREF_VALUE_EXPRESSION_EXPECTED = - getJSFCoreKey(JSFTypeComparatorPreferences.VALUE_EXPRESSION_EXPECTED); - - - private final static int EXPECTED_PREFS = 34; - - private PixelConverter fPixelConverter; - - /** - * @param prefs - * @param project - * @param container - */ - public ProblemSeveritiesConfigurationBlock(/*TODO:IStatusChangeListener context,*/ IJSFPreferenceModel prefs, IProject project, IWorkbenchPreferenceContainer container) { - super(prefs, project, getKeys(), container); - } - - private static Key[] getKeys() - { - Key[] keys = new Key[] { - PREF_BINARY_OP_BOTH_OPERANDS_NULL - , PREF_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO - , PREF_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION - , PREF_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME - , PREF_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME - , PREF_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN - , PREF_BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS - , PREF_BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME - , PREF_BINARY_OP_NO_AVAILABLE_TYPE_COERCION - , PREF_BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS - , PREF_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME - , PREF_UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE - , PREF_UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO - , PREF_UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION - , PREF_UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN - , PREF_UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED - , PREF_CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING - , PREF_MEMBER_NOT_FOUND - , PREF_VARIABLE_NOT_FOUND - , PREF_MISSING_CLOSING_EXPR_BRACKET - , PREF_GENERAL_SYNTAX_ERROR - , PREF_EMPTY_EL_EXPRESSION - , PREF_BINARY_OP_DOT_WITH_VALUEB_NULL - , PREF_BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY - , PREF_POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS - , PREF_BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME - , PREF_BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE - , PREF_MEMBER_IS_INTERMEDIATE - , PREF_INCOMPATIBLE_METHOD_TYPES - , PREF_INCOMPATIBLE_TYPES - , PREF_METHOD_EXPRESSION_EXPECTED - , PREF_PROPERTY_NOT_READABLE - , PREF_PROPERTY_NOT_WRITABLE - , PREF_VALUE_EXPRESSION_EXPECTED - }; - - if (EXPECTED_PREFS != keys.length) - { - JSFUiPlugin.log(IStatus.WARNING, "Expected "+EXPECTED_PREFS+" preferences but was "+keys.length, new Throwable()); - } - - return keys; - } - - /* - * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite) - */ - protected Control createContents(Composite parent) { - fPixelConverter= new PixelConverter(parent); - setShell(parent.getShell()); - - Group mainComp= new Group(parent, SWT.NONE); - mainComp.setFont(parent.getFont()); - GridLayout layout= new GridLayout(); - layout.marginHeight= 0; - layout.marginWidth= 0; - mainComp.setLayout(layout); - mainComp.setText(PreferencesMessages.ProblemSeveritiesConfigurationBlock_common_description); - - Composite commonComposite= createStyleTabContent(mainComp); - GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true); - gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20); - commonComposite.setLayoutData(gridData); - - validateSettings(null, null, null); - - return mainComp; - } - - private Composite createStyleTabContent(Composite folder) { - String[] errorWarningIgnore= new String[] { Severity.ERROR.toString(), Severity.WARNING.toString(), Severity.IGNORE.toString() }; - - String[] errorWarningIgnoreLabels= new String[] { - PreferencesMessages.ProblemSeveritiesConfigurationBlock_error, - PreferencesMessages.ProblemSeveritiesConfigurationBlock_warning, - PreferencesMessages.ProblemSeveritiesConfigurationBlock_ignore - }; - - //String[] enabledDisabled= new String[] { ENABLED, DISABLED }; - - int nColumns= 3; - - final ScrolledPageContent sc1 = new ScrolledPageContent(folder); - - Composite composite= sc1.getBody(); - GridLayout layout= new GridLayout(nColumns, false); - layout.marginHeight= 0; - layout.marginWidth= 0; - composite.setLayout(layout); - -// Label description= new Label(composite, SWT.LEFT | SWT.WRAP); -// description.setFont(description.getFont()); -// description.setText(PreferencesMessages.ProblemSeveritiesConfigurationBlock_common_description); -// description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, nColumns - 1, 1)); - - int indentStep= fPixelConverter.convertWidthInCharsToPixels(1); - - int defaultIndent= indentStep * 0; - //int extraIndent= indentStep * 2; - String label; - ExpandableComposite excomposite; - Composite inner; - - // -- general errors - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_general; - excomposite= createStyleSection(composite, label, nColumns); - - inner= new Composite(excomposite, SWT.NONE); - inner.setFont(composite.getFont()); - inner.setLayout(new GridLayout(nColumns, false)); - excomposite.setClient(inner); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_general_syntax_error; - addComboBox(inner, label, PREF_GENERAL_SYNTAX_ERROR, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_empty_el_expression; - addComboBox(inner, label, PREF_EMPTY_EL_EXPRESSION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_missing_closing_expr_bracket; - addComboBox(inner, label, PREF_MISSING_CLOSING_EXPR_BRACKET, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_cannot_apply_operator_to_method_binding; - addComboBox(inner, label, PREF_CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_dotted_property_key_should_use_array; - addComboBox(inner, label, PREF_BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - // --- id resolution - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_id_resolution; - excomposite= createStyleSection(composite, label, nColumns); - - inner= new Composite(excomposite, SWT.NONE); - inner.setFont(composite.getFont()); - inner.setLayout(new GridLayout(nColumns, false)); - excomposite.setClient(inner); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_variable_not_found; - addComboBox(inner, label, PREF_VARIABLE_NOT_FOUND, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_member_not_found; - addComboBox(inner, label, PREF_MEMBER_NOT_FOUND, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_member_is_intermediate; - addComboBox(inner, label, PREF_MEMBER_IS_INTERMEDIATE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - // --- type coercion problems - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_type_coercion_problems; - excomposite= createStyleSection(composite, label, nColumns); - - inner= new Composite(excomposite, SWT.NONE); - inner.setFont(composite.getFont()); - inner.setLayout(new GridLayout(nColumns, false)); - excomposite.setClient(inner); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_binary_op_numeric_coercion_error; - addComboBox(inner, label, PREF_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_binary_op_boolean_coercion_error; - addComboBox(inner, label, PREF_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_binary_op_no_coercion_available; - addComboBox(inner, label, PREF_BINARY_OP_NO_AVAILABLE_TYPE_COERCION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_binary_op_literal_to_number_coercion_error; - addComboBox(inner, label, PREF_BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unary_op_numeric_coercion_error; - addComboBox(inner, label, PREF_UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unary_op_boolean_coercion_error; - addComboBox(inner, label, PREF_UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unary_op_string_coercion_not_guaranteed; - addComboBox(inner, label, PREF_UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - // --- constant folder and unused code - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_constant_folding_and_unused_code; - excomposite= createStyleSection(composite, label, nColumns); - - inner= new Composite(excomposite, SWT.NONE); - inner.setFont(composite.getFont()); - inner.setLayout(new GridLayout(nColumns, false)); - excomposite.setClient(inner); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_both_binary_operands_null; - addComboBox(inner, label, PREF_BINARY_OP_BOTH_OPERANDS_NULL, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_binary_expression_always_evaluates_same; - addComboBox(inner, label, PREF_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_equality_with_null_always_same; - addComboBox(inner, label, PREF_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_enumeration_comparision_always_same; - addComboBox(inner, label, PREF_BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unary_expression_always_evaluates_same; - addComboBox(inner, label, PREF_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_empty_expression_always_false; - addComboBox(inner, label, PREF_UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_minus_on_null_always_zero; - addComboBox(inner, label, PREF_UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_first_argument_short_circuits_expression; - addComboBox(inner, label, PREF_BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_second_argument_always_evaluates_same; - addComboBox(inner, label, PREF_BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_apply_dot_operator_with_null; - addComboBox(inner, label, PREF_BINARY_OP_DOT_WITH_VALUEB_NULL, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - // --- possible programming errors - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_programming_errors; - excomposite= createStyleSection(composite, label, nColumns); - - inner= new Composite(excomposite, SWT.NONE); - inner.setFont(composite.getFont()); - inner.setLayout(new GridLayout(nColumns, false)); - excomposite.setClient(inner); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_possible_division_by_zero; - addComboBox(inner, label, PREF_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_possible_array_index_out_of_bounds; - addComboBox(inner, label, PREF_POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_incompatible_enumeration_comparison; - addComboBox(inner, label, PREF_BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - // --- type comparison with expected - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_type_comparison; - excomposite= createStyleSection(composite, label, nColumns); - - inner= new Composite(excomposite, SWT.NONE); - inner.setFont(composite.getFont()); - inner.setLayout(new GridLayout(nColumns, false)); - excomposite.setClient(inner); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_method_expression_expected; - addComboBox(inner, label, PREF_METHOD_EXPRESSION_EXPECTED, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_incompatible_type_assignment; - addComboBox(inner, label, PREF_INCOMPATIBLE_TYPES, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_value_expression_expected; - addComboBox(inner, label, PREF_VALUE_EXPRESSION_EXPECTED, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_incompatible_method_types; - addComboBox(inner, label, PREF_INCOMPATIBLE_METHOD_TYPES, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_property_not_readable; - addComboBox(inner, label, PREF_PROPERTY_NOT_READABLE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_property_not_writable; - addComboBox(inner, label, PREF_PROPERTY_NOT_WRITABLE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - - new Label(composite, SWT.NONE); - - IDialogSettings section= JSFUiPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME); - restoreSectionExpansionStates(section); - - return sc1; - } - - /* (non-javadoc) - * Update fields and validate. - * @param changedKey Key that changed, or null, if all changed. - */ - protected void validateSettings(Key changedKey, String oldValue, String newValue) { - if (!areSettingsEnabled()) { - return; - } - -// if (changedKey != null) { -// if (PREF_PB_UNUSED_PARAMETER.equals(changedKey) || -// PREF_PB_DEPRECATION.equals(changedKey) || -// PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey) || -// PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) { -// updateEnableStates(); -// } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) { -// // merging the two options -// setValue(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT, newValue); -// } else { -// return; -// } -// } else { - updateEnableStates(); -// } - // TODO: fContext.statusChanged(new StatusInfo()); - } - - private void updateEnableStates() { -// boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, Severity.IGNORE.toString()); -// getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams); -// getCheckBox(PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE).setEnabled(enableUnusedParams); -// -// boolean enableDeprecation= !checkValue(PREF_PB_DEPRECATION, Severity.IGNORE.toString()); -// getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(enableDeprecation); -// getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(enableDeprecation); -// -// boolean enableThrownExceptions= !checkValue(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, Severity.IGNORE.toString()); -// getCheckBox(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING).setEnabled(enableThrownExceptions); -// -// boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, Severity.IGNORE.toString()); -// getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding); - } - - protected String[] getFullBuildDialogStrings(boolean workspaceSettings) { - String title= PreferencesMessages.ProblemSeveritiesConfigurationBlock_needsbuild_title; - String message; - if (workspaceSettings) { - message= PreferencesMessages.ProblemSeveritiesConfigurationBlock_needsfullbuild_message; - } else { - message= PreferencesMessages.ProblemSeveritiesConfigurationBlock_needsprojectbuild_message; - } - return new String[] { title, message }; - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#dispose() - */ - public void dispose() { - IDialogSettings section= JSFUiPlugin.getDefault().getDialogSettings().addNewSection(SETTINGS_SECTION_NAME); - storeSectionExpansionStates(section); - super.dispose(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ScrolledPageContent.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ScrolledPageContent.java deleted file mode 100644 index 5cc17717d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ScrolledPageContent.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * Oracle - updated for JSF tools - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.validation; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.forms.FormColors; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.SharedScrolledComposite; - - -/** - * Customized SharedScrolledComposite - */ -/*package*/ class ScrolledPageContent extends SharedScrolledComposite { - - private FormToolkit fToolkit; - - /** - * @param parent - */ - public ScrolledPageContent(Composite parent) { - this(parent, SWT.V_SCROLL | SWT.H_SCROLL); - } - - /** - * @param parent - * @param style - */ - public ScrolledPageContent(Composite parent, int style) { - super(parent, style); - - setFont(parent.getFont()); - - initDialogsFormToolkit(); - - setExpandHorizontal(true); - setExpandVertical(true); - - Composite body= new Composite(this, SWT.NONE); - body.setFont(parent.getFont()); - setContent(body); - } - - private FormToolkit initDialogsFormToolkit() - { - if (fToolkit == null) { - FormColors colors= new FormColors(Display.getCurrent()); - colors.setBackground(null); - colors.setForeground(null); - fToolkit= new FormToolkit(colors); - } - return fToolkit; - } - - /** - * @param childControl - */ - public void adaptChild(Control childControl) { - fToolkit.adapt(childControl, true, true); - } - - /** - * @return the content composite - */ - public Composite getBody() { - return (Composite) getContent(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/SeverityOverrideStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/SeverityOverrideStrategy.java deleted file mode 100644 index 18cd3ca73..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/SeverityOverrideStrategy.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.ui.internal.validation; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy; - -/** - * A strategy for overriding the severity of diagnostics. - */ -abstract class SeverityOverrideStrategy implements IIdentifiableStrategy<Diagnostic, Integer, String> -{ - private final String _id; - - public SeverityOverrideStrategy(final String id) - { - _id = id; - } - - public abstract Integer override(Diagnostic diagnostic); - - public abstract String getDisplayName(); - - public Integer getNoResult() - { - return Integer.valueOf(-1); - } - - public final Integer perform(Diagnostic diagnostic) throws Exception - { - return override(diagnostic); - } - - public final String getId() - { - return _id; - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ValidationMessageFactory.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ValidationMessageFactory.java deleted file mode 100644 index 0772e66b9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ValidationMessageFactory.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.ui.internal.validation; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.TypeComparatorDiagnosticFactory; -import org.eclipse.jst.jsf.validation.internal.ELValidationPreferences; -import org.eclipse.jst.jsf.validation.internal.JSFTypeComparatorPreferences; -import org.eclipse.jst.jsf.validation.internal.ValidationPreferences; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; -import org.eclipse.wst.validation.internal.core.Message; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * Creates configured validation Message objects. - * - * @author cbateman - * - */ -public final class ValidationMessageFactory -{ - private final Map<String, SeverityOverrideStrategy> _strategies; - - /** - * @param prefs - * - */ - public ValidationMessageFactory(final ValidationPreferences prefs) - { - _strategies = new HashMap<String, SeverityOverrideStrategy>(); - _strategies.put(DiagnosticFactory.SOURCE_ID, - new ELSeverityOverrideStrategy(prefs)); - _strategies.put(TypeComparatorDiagnosticFactory.SOURCE_IDENTIFIER, - new TypeComparatorOverrideStrategy(prefs)); - } - - /** - * @param diagnostic - * @param offset - * @param length - * @param file - * @return a configured message - */ - public Message createFromDiagnostic(final Diagnostic diagnostic, - final int offset, final int length, final IFile file) - { - int severity = diagnostic.getSeverity(); - final String sourceId = diagnostic.getSource(); - final SeverityOverrideStrategy strategy = _strategies.get(sourceId); - - // only override if there's a strategy to do so - if (strategy != null) - { - final Integer value = strategy.override(diagnostic); - if (value != null) - { - severity = value.intValue(); - } - } - - final Message message = new MyLocalizedMessage( - convertSeverity(severity), diagnostic.getMessage(), file, - diagnostic.getCode()); - - message.setOffset(offset); - message.setLength(length); - - return message; - } - - /** - * @param severity - * @return a Message severity equivilent to diagnostic.getSeverity() - */ - private int convertSeverity(final int severity) - { - switch (severity) - { - case Diagnostic.ERROR: - return IMessage.HIGH_SEVERITY; - case Diagnostic.WARNING: - return IMessage.NORMAL_SEVERITY; - case Diagnostic.INFO: - return IMessage.LOW_SEVERITY; - case Diagnostic.OK: - default: - // no bits set - return 0; - } - } - - private static class ELSeverityOverrideStrategy extends - SeverityOverrideStrategy - { - private final ValidationPreferences _prefs; - - public ELSeverityOverrideStrategy(final ValidationPreferences prefs) - { - super(DiagnosticFactory.SOURCE_ID); - _prefs = prefs; - } - - @Override - public Integer override(final Diagnostic diagnostic) - { - final int code = diagnostic.getCode(); - final ELValidationPreferences elPrefs = _prefs.getElPrefs(); - return Integer.valueOf(elPrefs.getDiagnosticSeverity(code)); - } - - @Override - public String getDisplayName() - { - return "EL Preference Severities"; - } - } - - private static class TypeComparatorOverrideStrategy extends - SeverityOverrideStrategy - { - private final ValidationPreferences _prefs; - - public TypeComparatorOverrideStrategy(final ValidationPreferences prefs) - { - super(TypeComparatorDiagnosticFactory.SOURCE_IDENTIFIER); - _prefs = prefs; - } - - @Override - public Integer override(final Diagnostic diagnostic) - { - final int code = diagnostic.getCode(); - final JSFTypeComparatorPreferences jsfTypeCompPrefs = _prefs - .getTypeComparatorPrefs(); - return Integer - .valueOf(jsfTypeCompPrefs.getDiagnosticSeverity(code)); - } - - @Override - public String getDisplayName() - { - return "Type Comparison Preference Severities"; - } - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ValidationReporter.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ValidationReporter.java deleted file mode 100644 index e5f041189..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/ValidationReporter.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.ui.internal.validation; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator; -import org.eclipse.jst.jsf.validation.internal.ValidationPreferences; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.wst.validation.internal.provisional.core.IValidator; - -/*package*/class ValidationReporter implements - IJSFViewValidator.IValidationReporter -{ - private final IValidator _validator; - private final IReporter _reporter; - private final IFile _file; - private final ValidationMessageFactory _factory; - - public ValidationReporter(final IValidator validator, - final IReporter reporter, final IFile file, - final ValidationPreferences prefs) - { - _validator = validator; - _reporter = reporter; - _file = file; - _factory = new ValidationMessageFactory(prefs); - } - - public void report(final Diagnostic problem, final int start, - final int length) - { - final IMessage message = _factory.createFromDiagnostic( - problem, start, length, _file); - - if ((message.getSeverity() & IMessage.ALL_MESSAGES) != 0) - { - _reporter.addMessage(_validator, message); - } - } - - public void report(IMessage message) - { - if ((message.getSeverity() & IMessage.ALL_MESSAGES) != 0) - { - _reporter.addMessage(_validator, message); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/messages.properties deleted file mode 100644 index 6fc9f74dc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/validation/messages.properties +++ /dev/null @@ -1,72 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2007 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are 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: -# IBM Corporation - initial API and implementation -# John Kaplan, johnkaplantech@gmail.com - 108071 [code templates] template for body of newly created class -# Cameron Bateman/Oracle - adapted for use in JSF validation tooling -############################################################################### - -ProblemSeveritiesPreferencePage_title=Problem Severities - -ProblemSeveritiesConfigurationBlock_error=Error -ProblemSeveritiesConfigurationBlock_warning=Warning -ProblemSeveritiesConfigurationBlock_ignore=Ignore - -ProblemSeveritiesConfigurationBlock_section_id_resolution=&Identifier Resolution -ProblemSeveritiesConfigurationBlock_section_general=&General Problems -ProblemSeveritiesConfigurationBlock_section_type_coercion_problems=&Type Coercion Problems -ProblemSeveritiesConfigurationBlock_section_constant_folding_and_unused_code=&Constant folding and unused code -ProblemSeveritiesConfigurationBlock_section_programming_errors=&Possible programming errors -ProblemSeveritiesConfigurationBlock_section_type_comparison=Type &Assignment Problems - -ProblemSeveritiesConfigurationBlock_needsbuild_title=Error/Warning Settings Changed -ProblemSeveritiesConfigurationBlock_needsfullbuild_message=The Error/Warning settings have changed. You will need to rebuild or revalidate for these changes to take effect. -ProblemSeveritiesConfigurationBlock_needsprojectbuild_message=The Error/Warning settings have changed. A rebuild of the project is required for changes to take effect. Build the project now? -ProblemSeveritiesConfigurationBlock_buildwarning_dont_show_again=Don't show this dialog again - -ProblemSeveritiesConfigurationBlock_common_description=Select the severity level for the following problems - -ProblemSeveritiesConfigurationBlock_pb_general_syntax_error=General Syntax Error -ProblemSeveritiesConfigurationBlock_pb_empty_el_expression=Empty EL expression -ProblemSeveritiesConfigurationBlock_pb_missing_closing_expr_bracket=Missing closing bracket on expression -ProblemSeveritiesConfigurationBlock_pb_cannot_apply_operator_to_method_binding=Applying operator to method binding -ProblemSeveritiesConfigurationBlock_pb_dotted_property_key_should_use_array=Dotted property names should use array ([]) syntax - -ProblemSeveritiesConfigurationBlock_pb_variable_not_found=Variable not found -ProblemSeveritiesConfigurationBlock_pb_member_not_found=Member not found -ProblemSeveritiesConfigurationBlock_pb_member_is_intermediate=Member is intermediate - -ProblemSeveritiesConfigurationBlock_pb_binary_op_numeric_coercion_error=Binary operation number coercion problems -ProblemSeveritiesConfigurationBlock_pb_binary_op_boolean_coercion_error=Binary operation boolean coercion problems -ProblemSeveritiesConfigurationBlock_pb_binary_op_no_coercion_available=Binary operation no available coercions -ProblemSeveritiesConfigurationBlock_pb_binary_op_literal_to_number_coercion_error=Binary coercion of literal to number -ProblemSeveritiesConfigurationBlock_pb_unary_op_numeric_coercion_error=Unary operation number coercion problems -ProblemSeveritiesConfigurationBlock_pb_unary_op_boolean_coercion_error=Unary operation boolean coercion problems -ProblemSeveritiesConfigurationBlock_pb_unary_op_string_coercion_not_guaranteed=Unary operation string coercion not guaranteed - -ProblemSeveritiesConfigurationBlock_pb_both_binary_operands_null=Both operands null -ProblemSeveritiesConfigurationBlock_pb_binary_expression_always_evaluates_same=Binary expression always evaluates to same value -ProblemSeveritiesConfigurationBlock_pb_equality_with_null_always_same=Equality comparison with null always evaluates to same value -ProblemSeveritiesConfigurationBlock_pb_unary_expression_always_evaluates_same=Unary expression always evaluates to same value -ProblemSeveritiesConfigurationBlock_pb_empty_expression_always_false=Empty operator always resolves to false on type -ProblemSeveritiesConfigurationBlock_pb_enumeration_comparision_always_same=Enumeration comparison always evaluates to same value -ProblemSeveritiesConfigurationBlock_pb_minus_on_null_always_zero=Minus applied to null always evaluates to zero -ProblemSeveritiesConfigurationBlock_pb_first_argument_short_circuits_expression=First argument short-circuits expression -ProblemSeveritiesConfigurationBlock_pb_second_argument_always_evaluates_same=Second argument always evaluates the same -ProblemSeveritiesConfigurationBlock_pb_apply_dot_operator_with_null=Applying the dot ('.') operator with null always returns null - -ProblemSeveritiesConfigurationBlock_pb_possible_division_by_zero=Possible division by zero -ProblemSeveritiesConfigurationBlock_pb_possible_array_index_out_of_bounds=Possible array index out of bounds -ProblemSeveritiesConfigurationBlock_pb_incompatible_enumeration_comparison=Incompatible enumeration comparison - -ProblemSeveritiesConfigurationBlock_pb_method_expression_expected=Method expression expected -ProblemSeveritiesConfigurationBlock_pb_incompatible_type_assignment=Value expression type incompatibility -ProblemSeveritiesConfigurationBlock_pb_value_expression_expected= Value expression expected -ProblemSeveritiesConfigurationBlock_pb_incompatible_method_types=Method expression signature incompatibility -ProblemSeveritiesConfigurationBlock_pb_property_not_readable=Property expected to be readable but has no getter -ProblemSeveritiesConfigurationBlock_pb_property_not_writable=Property expected to be writable but has no setter
\ No newline at end of file |