diff options
Diffstat (limited to 'plugins/org.eclipse.jst.server.ui/src/org/eclipse')
11 files changed, 0 insertions, 908 deletions
diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ContextIds.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ContextIds.java deleted file mode 100644 index be2c0ea8a..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ContextIds.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.server.ui.internal; -/** - * Context help id constants. - */ -public interface ContextIds { - public static final String RUNTIME_COMPOSITE = JavaServerUIPlugin.PLUGIN_ID + ".jvrt0000"; -} diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeComposite.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeComposite.java deleted file mode 100644 index 091b2b130..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeComposite.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 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 - *******************************************************************************/ -package org.eclipse.jst.server.ui.internal; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.server.core.IRuntimeWorkingCopy; -import org.eclipse.wst.server.ui.wizard.IWizardHandle; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; -import org.eclipse.jdt.launching.IVMInstall; -import org.eclipse.jdt.launching.IVMInstallType; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jface.preference.IPreferenceNode; -import org.eclipse.jface.preference.PreferenceDialog; -import org.eclipse.jface.preference.PreferenceManager; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.server.core.internal.GenericRuntime; -import org.eclipse.jst.server.core.internal.IGenericRuntimeWorkingCopy; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.ui.PlatformUI; -/** - * Wizard page to set the server install directory. - */ -public class GenericRuntimeComposite extends Composite { - protected static final String INSTALLED_JRE_PREFERENCE_PAGE_ID = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"; - protected IRuntimeWorkingCopy runtimeWC; - protected IGenericRuntimeWorkingCopy runtime; - - protected IWizardHandle wizard; - - protected Text name; - protected Text installDir; - protected Combo combo; - protected List<IVMInstall> installedJREs; - protected String[] jreNames; - - /** - * GenericRuntimeComposite constructor comment. - */ - protected GenericRuntimeComposite(Composite parent, IWizardHandle wizard) { - super(parent, SWT.NONE); - this.wizard = wizard; - - wizard.setTitle(Messages.runtimeTypeTitle); - wizard.setDescription(Messages.runtimeTypeDescription); - wizard.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZ_RUNTIME_TYPE)); - - createControl(); - } - - protected void setRuntime(IRuntimeWorkingCopy newRuntime) { - if (newRuntime == null) { - runtimeWC = null; - runtime = null; - } else { - runtimeWC = newRuntime; - runtime = (IGenericRuntimeWorkingCopy) newRuntime.loadAdapter(IGenericRuntimeWorkingCopy.class, null); - } - - init(); - validate(); - } - - /** - * Provide a wizard page to change the root directory. - */ - protected void createControl() { - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - setLayout(layout); - setLayoutData(new GridData(GridData.FILL_BOTH)); - PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.RUNTIME_COMPOSITE); - - Label label = new Label(this, SWT.NONE); - label.setText(Messages.runtimeTypeName); - GridData data = new GridData(); - data.horizontalSpan = 2; - label.setLayoutData(data); - - name = new Text(this, SWT.BORDER); - data = new GridData(GridData.FILL_HORIZONTAL); - name.setLayoutData(data); - name.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - runtimeWC.setName(name.getText()); - validate(); - } - }); - - label = new Label(this, SWT.NONE); - label.setText(Messages.runtimeTypeLocation); - data = new GridData(); - data.horizontalSpan = 2; - label.setLayoutData(data); - - installDir = new Text(this, SWT.BORDER); - data = new GridData(GridData.FILL_HORIZONTAL); - installDir.setLayoutData(data); - installDir.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - runtimeWC.setLocation(new Path(installDir.getText())); - validate(); - } - }); - - Button browse = SWTUtil.createButton(this, Messages.browse); - browse.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent se) { - DirectoryDialog dialog = new DirectoryDialog(GenericRuntimeComposite.this.getShell()); - dialog.setMessage(Messages.runtimeTypeSelectLocation); - dialog.setFilterPath(installDir.getText()); - String selectedDirectory = dialog.open(); - if (selectedDirectory != null) - installDir.setText(selectedDirectory); - } - }); - - updateJREs(); - - // JDK location - label = new Label(this, SWT.NONE); - label.setText(Messages.runtimeTypeJRE); - data = new GridData(); - data.horizontalSpan = 2; - label.setLayoutData(data); - - combo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY); - combo.setItems(jreNames); - data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - combo.setLayoutData(data); - - combo.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - int sel = combo.getSelectionIndex(); - IVMInstall vmInstall = null; - if (sel > 0) - vmInstall = installedJREs.get(sel - 1); - - runtime.setVMInstall(vmInstall); - validate(); - } - - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } - }); - - Button button = SWTUtil.createButton(this, Messages.runtimeTypeInstalledJREs); - button.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - String currentVM = combo.getText(); - if (showPreferencePage()) { - updateJREs(); - combo.setItems(jreNames); - combo.setText(currentVM); - if (combo.getSelectionIndex() == -1) - combo.select(0); - } - } - }); - - init(); - validate(); - - Dialog.applyDialogFont(this); - - name.forceFocus(); - } - - protected void updateJREs() { - // get all installed JVMs - installedJREs = new ArrayList<IVMInstall>(); - IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes(); - for (IVMInstallType vit : vmInstallTypes) { - IVMInstall[] vmInstalls = vit.getVMInstalls(); - for (IVMInstall vmInstall : vmInstalls) - installedJREs.add(vmInstall); - } - - // get names - int size = installedJREs.size(); - jreNames = new String[size+1]; - jreNames[0] = Messages.runtimeTypeDefaultJRE; - for (int i = 0; i < size; i++) { - IVMInstall vmInstall = installedJREs.get(i); - jreNames[i+1] = vmInstall.getName(); - } - } - - protected boolean showPreferencePage() { - String id = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"; - - // should be using the following API, but it only allows a single preference page instance. - // see bug 168211 for details - //PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, null); - //return (dialog.open() == Window.OK); - - PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager(); - IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode(id); - PreferenceManager manager2 = new PreferenceManager(); - manager2.addToRoot(node); - PreferenceDialog dialog = new PreferenceDialog(getShell(), manager2); - dialog.create(); - return (dialog.open() == Window.OK); - } - - protected void init() { - if (installDir == null || runtime == null) - return; - - name.setText(runtimeWC.getName()); - - if (runtimeWC.getLocation() != null) - installDir.setText(runtimeWC.getLocation().toOSString()); - else - installDir.setText(""); - - // set selection - if (((GenericRuntime)runtime).isUsingDefaultJRE()) - combo.select(0); - else { - boolean found = false; - int size = installedJREs.size(); - for (int i = 0; i < size; i++) { - IVMInstall vmInstall = installedJREs.get(i); - if (vmInstall.equals(runtime.getVMInstall())) { - combo.select(i + 1); - found = true; - } - } - if (!found) - combo.select(0); - } - } - - protected void validate() { - if (runtime == null) { - wizard.setMessage("", IMessageProvider.ERROR); - return; - } - - IStatus status = runtimeWC.validate(null); - if (status == null || status.isOK()) - wizard.setMessage(null, IMessageProvider.NONE); - else - wizard.setMessage(status.getMessage(), IMessageProvider.ERROR); - } -} diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeWizardFragment.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeWizardFragment.java deleted file mode 100644 index c8a7470d9..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeWizardFragment.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.server.ui.internal; - -import org.eclipse.wst.server.core.*; -import org.eclipse.wst.server.ui.wizard.IWizardHandle; -import org.eclipse.wst.server.ui.wizard.WizardFragment; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.swt.widgets.Composite; -/** - * - */ -public class GenericRuntimeWizardFragment extends WizardFragment { - protected GenericRuntimeComposite comp; - - /** - * Create a new fragment. - */ - public GenericRuntimeWizardFragment() { - // do nothing - } - - /** - * @see WizardFragment#hasComposite() - */ - public boolean hasComposite() { - return true; - } - - /** - * @see WizardFragment#createComposite(Composite, IWizardHandle) - */ - public Composite createComposite(Composite parent, IWizardHandle wizard) { - comp = new GenericRuntimeComposite(parent, wizard); - return comp; - } - - /** - * @see WizardFragment#isComplete() - */ - public boolean isComplete() { - IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME); - - if (runtime == null) - return false; - IStatus status = runtime.validate(null); - return (status != null && status.isOK()); - } - - /** - * @see WizardFragment#enter() - */ - public void enter() { - if (comp != null) { - IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME); - comp.setRuntime(runtime); - } - } -} diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ImageResource.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ImageResource.java deleted file mode 100644 index 684357dde..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ImageResource.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2009 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 - *******************************************************************************/ -package org.eclipse.jst.server.ui.internal; - -import java.net.URL; -import java.util.Map; -import java.util.HashMap; -import org.eclipse.swt.graphics.Image; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -/** - * Utility class to handle image resources. - */ -public class ImageResource { - // the image registry - private static ImageRegistry imageRegistry; - - // map of image descriptors since these - // will be lost by the image registry - private static Map<String, ImageDescriptor> imageDescriptors; - - // base urls for images - private static URL ICON_BASE_URL; - - static { - try { - String pathSuffix = "icons/"; - ICON_BASE_URL = JavaServerUIPlugin.getInstance().getBundle().getEntry(pathSuffix); - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Could not set icon base URL", e); - } - } - - private static final String URL_WIZBAN = "wizban/"; - - public static final String IMG_WIZ_RUNTIME_TYPE = "wiz_runtimeType"; - - /** - * Cannot construct an ImageResource. Use static methods only. - */ - private ImageResource() { - // do nothing - } - - /** - * Return the image with the given key. - * - * @param key java.lang.String - * @return org.eclipse.swt.graphics.Image - */ - public static Image getImage(String key) { - if (imageRegistry == null) - initializeImageRegistry(); - return imageRegistry.get(key); - } - - /** - * Return the image descriptor with the given key. - * - * @param key java.lang.String - * @return org.eclipse.jface.resource.ImageDescriptor - */ - public static ImageDescriptor getImageDescriptor(String key) { - if (imageRegistry == null) - initializeImageRegistry(); - return imageDescriptors.get(key); - } - - /** - * Initialize the image resources. - */ - protected static void initializeImageRegistry() { - imageRegistry = new ImageRegistry(); - imageDescriptors = new HashMap<String, ImageDescriptor>(); - - registerImage(IMG_WIZ_RUNTIME_TYPE, URL_WIZBAN + "new_runtime_wiz.png"); - } - - /** - * Register an image with the registry. - * - * @param key the key - * @param partialURL a partial URL - */ - private static void registerImage(String key, String partialURL) { - try { - ImageDescriptor id = ImageDescriptor.createFromURL(new URL(ICON_BASE_URL, partialURL)); - imageRegistry.put(key, id); - imageDescriptors.put(key, id); - } catch (Exception e) { - Trace.trace(Trace.WARNING, "Error registering image " + key + " from " + partialURL, e); - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/JavaServerUIPlugin.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/JavaServerUIPlugin.java deleted file mode 100644 index 6eaf7651e..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/JavaServerUIPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.server.ui.internal; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.plugin.AbstractUIPlugin; -/** - * The main server tooling plugin class. - */ -public class JavaServerUIPlugin extends AbstractUIPlugin { - /** - * Java server UI plugin id - */ - public static final String PLUGIN_ID = "org.eclipse.jst.server.ui"; - - // singleton instance of this class - private static JavaServerUIPlugin singleton; - - /** - * Create the JavaServerUIPlugin. - */ - public JavaServerUIPlugin() { - super(); - singleton = this; - } - - /** - * Returns the singleton instance of this plugin. - * - * @return org.eclipse.jst.server.ui.JavaServerUIPlugin - */ - public static JavaServerUIPlugin getInstance() { - return singleton; - } - - /** - * Convenience method for logging. - * - * @param t a throwable - */ - public static void log(Throwable t) { - getInstance().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Internal error", t)); //$NON-NLS-1$ - } - - /** - * Returns the active workbench shell - * - * @return the active workbench shell - */ - public static Shell getActiveWorkbenchShell() { - IWorkbenchWindow workBenchWindow = getActiveWorkbenchWindow(); - if (workBenchWindow == null) - return null; - return workBenchWindow.getShell(); - } - - /** - * Returns the active workbench window - * - * @return the active workbench window - */ - protected static IWorkbenchWindow getActiveWorkbenchWindow() { - IWorkbench workBench= getInstance().getWorkbench(); - if (workBench == null) - return null; - return workBench.getActiveWorkbenchWindow(); - } -} diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/Messages.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/Messages.java deleted file mode 100644 index 2ccbc5e3d..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/Messages.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 - *******************************************************************************/ -package org.eclipse.jst.server.ui.internal; - -import org.eclipse.osgi.util.NLS; -/** - * Translated messages. - */ -public class Messages extends NLS { - public static String runtimeTypeTitle; - public static String runtimeTypeDescription; - public static String runtimeTypeName; - public static String runtimeTypeLocation; - public static String runtimeTypeSelectLocation; - public static String runtimeTypeJRE; - public static String browse; - public static String runtimeTypeInstalledJREs; - public static String runtimeTypeDefaultJRE; - public static String errorInternalCactus; - - public static String classpathContainer; - public static String classpathContainerDescription; - public static String classpathContainerRuntimeList; - - public static String LaunchTestAction_message_selectConfiguration; - public static String LaunchTestAction_message_selectDebugConfiguration; - public static String LaunchTestAction_message_selectRunConfiguration; - - public static String NewServletTestCaseWizard_WindowTitle; - public static String NewServletTestCaseWizard_ErrorMessageTitleMissingLibrary; - public static String NewServletTestCaseWizard_ErrorMessageMissingLibrary; - public static String NewServletTestCaseWizard_ErrorTitleNew; - public static String NewServletTestCaseWizard_ErrorTitleCreateOfElementFailed; - public static String NewServletTestCaseWizard_ErrorMessageSeeErrorLog; - public static String NewServletTestCaseWizard_WarningMessageSelectAWebProject; - public static String NewServletTestCaseWizard_WarningTitleWebProjectRequired; - public static String NewServletTestCaseWizard_WarningMessageSuperclassIsEmpty; - public static String NewServletTestCaseWizard_WarningMessageSuperclassDoesNotExist; - public static String NewServletTestCaseWizard_WarningMessageSuperclassIsInterface; - public static String NewServletTestCaseWizard_WarningMessageSuperclassNotServletTestCase; - public static String CactusAddLibrariesProposal_ErrorMessageCouldntInstallLibraries; - public static String CactusAddLibrariesProposal_ErrorMessageCactusBundleNotFound; - public static String CactusAddLibrariesProposal_ErrorMessageDestDirNotFound; - public static String CactusAddLibrariesProposal_ErrorMessageInstallationOfLibsFailed; - public static String CactusAddLibrariesProposal_ErrorMessageInstallDirNotFound; - public static String CactusAddLibrariesProposal_AdditionalInfoAddCactusLibraries; - public static String CactusAddLibrariesProposal_DisplayStringAddCactusLibs; - static { - NLS.initializeMessages(JavaServerUIPlugin.PLUGIN_ID + ".internal.Messages", Messages.class); - } -} diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/Messages.properties b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/Messages.properties deleted file mode 100644 index 2785a8976..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/Messages.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2004, 2009 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 -############################################################################### - -runtimeTypeTitle=Generic J2EE Runtime -runtimeTypeDescription=Define a generic J2EE runtime. Specify a directory containing jar files to compile against. -runtimeTypeName=Na&me: -runtimeTypeLocation=&Location: -browse=B&rowse... -runtimeTypeSelectLocation=Select the location of the runtime. -runtimeTypeJRE=&JRE: -runtimeTypeDefaultJRE=Workbench default JRE -runtimeTypeInstalledJREs=In&stalled JREs... - -classpathContainer=Server Library -classpathContainerDescription=Select a server runtime to add to the classpath -classpathContainerRuntimeList=Select a &runtime to add to the classpath: diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/RuntimeLabelProvider.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/RuntimeLabelProvider.java deleted file mode 100644 index f5be1c126..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/RuntimeLabelProvider.java +++ /dev/null @@ -1,43 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - * IBM Corporation - Support for all server types - ******************************************************************************/ -package org.eclipse.jst.server.ui.internal; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; -import org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider; -/** - * - */ -public final class RuntimeLabelProvider implements IRuntimeComponentLabelProvider { - private final IRuntimeComponent rc; - - public RuntimeLabelProvider(final IRuntimeComponent rc) { - this.rc = rc; - } - - public String getLabel() { - return rc.getProperty("type"); - } - - public static final class Factory implements IAdapterFactory { - private static final Class[] ADAPTER_TYPES = { IRuntimeComponentLabelProvider.class }; - - public Object getAdapter(final Object adaptable, final Class adapterType) { - final IRuntimeComponent rc = (IRuntimeComponent) adaptable; - return new RuntimeLabelProvider(rc); - } - - public Class[] getAdapterList() { - return ADAPTER_TYPES; - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/SWTUtil.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/SWTUtil.java deleted file mode 100644 index 1129600f6..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/SWTUtil.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.server.ui.internal; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -/** - * SWT Utility class. - */ -public class SWTUtil { - private static FontMetrics fontMetrics; - - protected static void initializeDialogUnits(Control testControl) { - // Compute and store a font metric - GC gc = new GC(testControl); - gc.setFont(JFaceResources.getDialogFont()); - fontMetrics = gc.getFontMetrics(); - gc.dispose(); - } - - /** - * Returns a width hint for a button control. - */ - protected static int getButtonWidthHint(Button button) { - int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); - return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - } - - /** - * Create a new button with the standard size. - * - * @param comp the component to add the button to - * @param label the button label - * @return a button - */ - public static Button createButton(Composite comp, String label) { - Button b = new Button(comp, SWT.PUSH); - b.setText(label); - if (fontMetrics == null) - initializeDialogUnits(comp); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - data.widthHint = getButtonWidthHint(b); - b.setLayoutData(data); - return b; - } -} diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ServerClasspathContainerPage.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ServerClasspathContainerPage.java deleted file mode 100644 index 29e0b9327..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ServerClasspathContainerPage.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 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 - *******************************************************************************/ -package org.eclipse.jst.server.ui.internal; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.ui.wizards.IClasspathContainerPage; -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.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jst.server.core.internal.JavaServerPlugin; -import org.eclipse.jst.server.core.internal.RuntimeClasspathContainer; -import org.eclipse.jst.server.core.internal.RuntimeClasspathProviderWrapper; -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.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.ui.internal.viewers.RuntimeTableLabelProvider; - -public class ServerClasspathContainerPage extends WizardPage implements IClasspathContainerPage { - protected IClasspathEntry selection; - - protected Map<IRuntime, IClasspathEntry> runtimeMap = new HashMap<IRuntime, IClasspathEntry>(); - - public ServerClasspathContainerPage() { - super("server.container"); - setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZ_RUNTIME_TYPE)); - setTitle(Messages.classpathContainer); - setDescription(Messages.classpathContainerDescription); - setPageComplete(false); - - IRuntime[] runtimes = ServerCore.getRuntimes(); - for (IRuntime runtime : runtimes) { - if (runtime.getRuntimeType() != null) { - RuntimeClasspathProviderWrapper rcpw = JavaServerPlugin.findRuntimeClasspathProvider(runtime.getRuntimeType()); - if (rcpw != null) { - IPath serverContainerPath = new Path(RuntimeClasspathContainer.SERVER_CONTAINER) - .append(rcpw.getId()).append(runtime.getId()); - runtimeMap.put(runtime, JavaCore.newContainerEntry(serverContainerPath)); - } - } - } - } - - public boolean finish() { - return true; - } - - public IClasspathEntry getSelection() { - return selection; - } - - public void setSelection(IClasspathEntry containerEntry) { - selection = containerEntry; - } - - public void createControl(Composite parent) { - Composite comp = new Composite(parent, SWT.NONE); - comp.setLayoutData(new GridData(GridData.FILL_BOTH)); - - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - comp.setLayout(layout); - - Label label = new Label(comp, SWT.NONE); - label.setText(Messages.classpathContainerRuntimeList); - - Table table = new Table(comp, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION); - table.setLayoutData(new GridData(GridData.FILL_BOTH)); - - table.setHeaderVisible(false); - - TableViewer tableViewer = new TableViewer(table); - tableViewer.setContentProvider(new IStructuredContentProvider() { - public Object[] getElements(Object inputElement) { - Object[] obj = runtimeMap.keySet().toArray(); - return obj; - } - - public void dispose() { - // ignore - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // ignore - } - }); - tableViewer.setLabelProvider(new RuntimeTableLabelProvider()); - tableViewer.setInput("root"); - - tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - try { - IStructuredSelection sel = (IStructuredSelection) event.getSelection(); - selection = runtimeMap.get(sel.getFirstElement()); - setPageComplete(true); - } catch (Exception e) { - selection = null; - setPageComplete(false); - } - } - }); - - if (tableViewer.getTable().getItemCount() != 0) - tableViewer.getTable().setFocus(); - - setControl(comp); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/Trace.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/Trace.java deleted file mode 100644 index 0f54f82e2..000000000 --- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/Trace.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.server.ui.internal; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -/** - * Helper class to route trace output. - */ -public class Trace { - public static final byte CONFIG = 0; - public static final byte WARNING = 1; - public static final byte SEVERE = 2; - public static final byte FINEST = 3; - - /** - * Trace constructor comment. - */ - private Trace() { - super(); - } - - /** - * Trace the given text. - * - * @param level a trace level - * @param s a message - */ - public static void trace(byte level, String s) { - Trace.trace(level, s, null); - } - - /** - * Trace the given message and exception. - * - * @param level a trace level - * @param s a message - * @param t a throwable - */ - public static void trace(byte level, String s, Throwable t) { - if (level == SEVERE) - JavaServerUIPlugin.getInstance().getLog().log(new Status(IStatus.ERROR, JavaServerUIPlugin.PLUGIN_ID, s, t)); - - if (!JavaServerUIPlugin.getInstance().isDebugging()) - return; - - System.out.println(JavaServerUIPlugin.PLUGIN_ID + " " + s); - if (t != null) - t.printStackTrace(); - } -}
\ No newline at end of file |