Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor')
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java731
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IOrdered.java33
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorActionFactory.java64
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorInput.java31
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPageSectionFactory.java54
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPartFactory.java68
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java1037
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java980
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionBarContributor.java113
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionFactory.java164
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorCore.java231
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInput.java182
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInputFactory.java55
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPageSectionFactory.java205
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartFactory.java243
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartInput.java83
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java102
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/StatusLineContributionItem.java91
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/TextAction.java246
19 files changed, 0 insertions, 4713 deletions
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java
deleted file mode 100644
index 7b33baac7..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java
+++ /dev/null
@@ -1,731 +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.wst.server.ui.internal.editor;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-/**
- *
- */
-public class GlobalCommandManager {
- // maximum number of commands in the history
- private static final int MAX_HISTORY = 200;
-
- class ServerResourceCommand {
- IUndoableOperation command;
- String id;
- }
-
- // commands in the undo history
- protected List<ServerResourceCommand> undoList = new ArrayList<ServerResourceCommand>();
-
- // size of the undo stack on last save
- protected int undoSaveIndex = 0;
-
- // commands in the redo history
- protected List<ServerResourceCommand> redoList = new ArrayList<ServerResourceCommand>();
-
- class CommandManagerInfo {
- // number of open editors on this resource
- int count;
-
- // true if the resource has not been saved since
- // the last change
- boolean isDirty;
-
- // true if the resource is read-only
- boolean isReadOnly;
-
- // the element id
- String id;
-
- // the working copy
- IServerWorkingCopy wc;
-
- // files and timestamps
- Map<IFile, Long> fileMap;
-
- int timestamp;
- }
-
- protected Map<String, CommandManagerInfo> commandManagers = new HashMap<String, CommandManagerInfo>();
-
- // property change listeners
- protected List<PropertyChangeListener> propertyListeners;
- public static final String PROP_DIRTY = "dirtyState";
- public static final String PROP_UNDO = "undoAction";
- public static final String PROP_REDO = "redoAction";
- public static final String PROP_RELOAD = "reload";
-
- protected static GlobalCommandManager instance;
-
- public static GlobalCommandManager getInstance() {
- if (instance == null)
- instance = new GlobalCommandManager();
- return instance;
- }
-
- /**
- * Add a property change listener to this instance.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- if (propertyListeners == null)
- propertyListeners = new ArrayList<PropertyChangeListener>();
- propertyListeners.add(listener);
- }
-
- /**
- * Remove a property change listener from this instance.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- if (propertyListeners != null)
- propertyListeners.remove(listener);
- }
-
- /**
- * Fire a property change event.
- */
- protected void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
- if (propertyListeners == null)
- return;
-
- PropertyChangeEvent event = new PropertyChangeEvent(this, propertyName, oldValue, newValue);
- //Trace.trace("Firing: " + event + " " + oldValue);
- try {
- int size = propertyListeners.size();
- PropertyChangeListener[] pcl = new PropertyChangeListener[size];
- propertyListeners.toArray(pcl);
-
- for (int i = 0; i < size; i++)
- try {
- pcl[i].propertyChange(event);
- } catch (Exception e) {
- // ignore
- }
- } catch (Exception e) {
- // ignore
- }
- }
-
- /**
- * Get the command manager for a given id.
- *
- * @param id an id
- */
- public void getCommandManager(String id) {
- Trace.trace(Trace.FINEST, "Getting command manager for " + id);
- try {
- CommandManagerInfo info = commandManagers.get(id);
- if (info != null) {
- info.count ++;
- return;
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not find existing command manager", e);
- }
- Trace.trace(Trace.FINEST, "Creating new command manager for " + id);
- try {
- CommandManagerInfo info = new CommandManagerInfo();
- info.count = 1;
- info.id = id;
- IServer server = null;
- if (id != null)
- server = ServerCore.findServer(id);
- if (server != null)
- info.wc = server.createWorkingCopy();
- info.isDirty = false;
- info.isReadOnly = false;
- commandManagers.put(id, info);
- updateTimestamps(id);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not obtain command manager", e);
- }
- return;
- }
-
- /**
- * Release the command manager for a given id.
- *
- * @param id an id
- */
- public void releaseCommandManager(String id) {
- Trace.trace(Trace.FINEST, "Releasing command manager for " + id);
- try {
- CommandManagerInfo info = commandManagers.get(id);
- if (info != null) {
- info.count --;
- if (info.count == 0) {
- commandManagers.remove(id);
- clearUndoList(id);
- clearRedoList(id);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not release command manager", e);
- }
- }
-
- /**
- * Reload the command manager for a given id.
- *
- * @param id an id
- */
- public void reload(String id) {
- try {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info != null) {
- IServer server = null;
- if (id != null)
- server = ServerCore.findServer(id);
- if (server != null)
- info.wc = server.createWorkingCopy();
- firePropertyChangeEvent(PROP_RELOAD, id, null);
- }
- clearUndoList(id);
- clearRedoList(id);
- undoSaveIndex = undoList.size();
- setDirtyState(id, false);
- updateTimestamps(id);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not release command manager", e);
- }
- }
-
- /**
- *
- */
- protected CommandManagerInfo getExistingCommandManagerInfo(String id) {
- try {
- return commandManagers.get(id);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not find existing command manager info");
- }
- return null;
- }
-
- /**
- * Returns true if there is only one command manager.
- *
- * @param id an id
- * @return <code>true</code> if the only command manager
- */
- public boolean isOnlyCommandManager(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- return (info != null && info.count == 1);
- }
-
- protected IServerEditorPartInput getPartInput(String serverId, ServerResourceCommandManager serverCommandManager) {
- CommandManagerInfo serverInfo = null;
- IServerWorkingCopy server = null;
- boolean serverReadOnly = false;
- if (serverId != null) {
- serverInfo = getExistingCommandManagerInfo(serverId);
- if (serverInfo == null)
- return null;
-
- server = serverInfo.wc;
- serverReadOnly = serverInfo.isReadOnly;
- }
-
- return new ServerEditorPartInput(serverCommandManager, server, serverReadOnly);
- }
-
- /**
- *
- */
- protected IServerWorkingCopy getServerResource(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return null;
-
- return info.wc;
- }
-
- /**
- * Return the currently active shell.
- *
- * @return a shell
- */
- private Shell getShell() {
- try {
- Display d = Display.getCurrent();
- if (d == null)
- d = Display.getDefault();
-
- return d.getActiveShell();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not get shell", e);
- return null;
- }
- }
-
- /**
- * Execute the given command and place it in the undo stack.
- * If the command cannot be undone, the user will be notified
- * before it is executed.
- *
- * @param id an id
- * @param command a task
- */
- public void executeCommand(String id, IUndoableOperation command) {
- final Shell shell = getShell();
-
- if (!command.canUndo() && !undoList.isEmpty()) {
- try {
- if (!MessageDialog.openConfirm(shell, Messages.editorServerEditor, Messages.editorPromptIrreversible))
- return;
- } catch (Exception e) {
- // ignore
- }
- }
-
- ServerResourceCommand src = new ServerResourceCommand();
- src.id = id;
- src.command = command;
-
- try {
- IAdaptable adaptable = new IAdaptable() {
- public Object getAdapter(Class adapter) {
- if (Shell.class.equals(adapter))
- return shell;
- return null;
- }
- };
- IStatus status = command.execute(new NullProgressMonitor(), adaptable);
- if (status != null && !status.isOK())
- MessageDialog.openError(shell, Messages.editorServerEditor, status.getMessage());
- } catch (ExecutionException ce) {
- Trace.trace(Trace.SEVERE, "Error executing command", ce);
- return;
- }
-
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return;
-
- if (command.canUndo())
- addToUndoList(src);
- else {
- undoSaveIndex = -1;
- clearUndoList(id);
- }
-
- // clear redo list since a new command has been executed.
- clearRedoList(id);
-
- setDirtyState(id, true);
- }
-
- /**
- * Add a command to the history.
- */
- private void addToUndoList(ServerResourceCommand src) {
- undoList.add(src);
-
- // limit history growth
- if (undoList.size() > MAX_HISTORY)
- undoList.remove(0);
-
- firePropertyChangeEvent(PROP_UNDO, src.id, null);
- }
-
- /**
- * Clears the undo of a particular resource.
- */
- private void clearUndoList(String id) {
- int i = 0;
- boolean modified = false;
- while (i < undoList.size()) {
- ServerResourceCommand src = undoList.get(i);
- if (src.id.equals(id)) {
- modified = true;
- undoList.remove(i);
- } else
- i++;
- }
- if (modified)
- firePropertyChangeEvent(PROP_UNDO, id, null);
- }
-
- /**
- * Clears the redo of a particular resource.
- */
- private void clearRedoList(String id) {
- int i = 0;
- boolean modified = false;
- while (i < redoList.size()) {
- ServerResourceCommand src = redoList.get(i);
- if (src.id.equals(id)) {
- redoList.remove(i);
- modified = true;
- } else
- i++;
- }
- if (modified)
- firePropertyChangeEvent(PROP_REDO, id, null);
- }
-
- /**
- * Returns true if there is a command that can be undone.
- * @return boolean
- */
- protected boolean canUndo(String a, String b) {
- Iterator iterator = undoList.iterator();
- while (iterator.hasNext()) {
- ServerResourceCommand src = (ServerResourceCommand) iterator.next();
- if (src.id == a || src.id == b)
- return true;
- }
- return false;
- }
-
- /**
- * Returns true if there is a command that can be redone.
- * @return boolean
- */
- protected boolean canRedo(String a, String b) {
- Iterator iterator = redoList.iterator();
- while (iterator.hasNext()) {
- ServerResourceCommand src = (ServerResourceCommand) iterator.next();
- if (src.id == a || src.id == b)
- return true;
- }
- return false;
- }
-
- /**
- * Returns the command that would be undone next.
- *
- * @param a an id
- * @return a task
- */
- public IUndoableOperation getUndoCommand(String a) {
- int size = undoList.size();
- for (int i = size - 1; i >= 0; i--) {
- ServerResourceCommand src = undoList.get(i);
- if (src.id == a)
- return src.command;
- }
- return null;
- }
-
- /**
- * Returns the command that would be redone next.
- *
- * @param a an id
- * @return a task
- */
- public IUndoableOperation getRedoCommand(String a) {
- int size = redoList.size();
- for (int i = size - 1; i >= 0; i--) {
- ServerResourceCommand src = redoList.get(i);
- if (src.id == a)
- return src.command;
- }
- return null;
- }
-
- /**
- * Returns true if the server resource is "dirty".
- *
- * @param id an id
- * @return a task
- */
- public boolean isDirty(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return false;
-
- return info.isDirty;
- }
-
- /**
- * Returns true if the server resource is read-only.
- *
- * @param id an id
- * @return boolean
- */
- public boolean isReadOnly(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return false;
- return info.isReadOnly;
- }
-
- /**
- * Sets the server resource read-only flag.
- *
- * @param id an id
- * @param readOnly <code>true</code> to set read-only, <code>false</code> otherwise
- */
- public void setReadOnly(String id, boolean readOnly) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return;
-
- if (info.isReadOnly == readOnly)
- return;
- info.isReadOnly = readOnly;
- firePropertyChangeEvent(PROP_RELOAD, id, null);
- }
-
- /**
- * Returns true if the server resource files are read-only.
- *
- * @param id an id
- * @return <code>true</code> if the files are read-only
- */
- public boolean areFilesReadOnly(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return false;
- return (getReadOnlyFiles(id).length > 0);
- }
-
- /**
- * Sets the dirty state and fires an event if needed.
- * @param dirty boolean
- */
- private void setDirtyState(String id, boolean dirty) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info.isDirty == dirty)
- return;
-
- info.isDirty = dirty;
- firePropertyChangeEvent(PROP_DIRTY, id, null);
- }
-
- /**
- * Undo the last command.
- */
- protected void undo(String a) {
- ServerResourceCommand src = null;
- Iterator iterator = undoList.iterator();
- while (iterator.hasNext()) {
- ServerResourceCommand src2 = (ServerResourceCommand) iterator.next();
- if (src2.id == a)
- src = src2;
- }
- if (src == null)
- return;
-
- try {
- src.command.undo(null, null);
- } catch (ExecutionException ee) {
- // do something
- }
-
- undoList.remove(src);
- firePropertyChangeEvent(PROP_UNDO, src.id, null);
- redoList.add(src);
- firePropertyChangeEvent(PROP_REDO, src.id, null);
-
- if (undoSaveIndex == undoList.size())
- setDirtyState(src.id, false);
- else
- setDirtyState(src.id, true);
- }
-
- /**
- * Redo the last command.
- */
- protected void redo(String a) {
- ServerResourceCommand src = null;
- Iterator iterator = redoList.iterator();
- while (iterator.hasNext()) {
- ServerResourceCommand src2 = (ServerResourceCommand) iterator.next();
- if (src2.id == a)
- src = src2;
- }
- if (src == null)
- return;
-
- try {
- final Shell shell = getShell();
- IAdaptable adaptable = new IAdaptable() {
- public Object getAdapter(Class adapter) {
- if (Shell.class.equals(adapter))
- return shell;
- return null;
- }
- };
- IStatus status = src.command.execute(new NullProgressMonitor(), adaptable);
- if (status != null && !status.isOK())
- MessageDialog.openError(shell, Messages.editorServerEditor, status.getMessage());
- } catch (ExecutionException ce) {
- Trace.trace(Trace.SEVERE, "Error executing command", ce);
- return;
- }
- redoList.remove(src);
- firePropertyChangeEvent(PROP_REDO, src.id, null);
- undoList.add(src);
- firePropertyChangeEvent(PROP_UNDO, src.id, null);
-
- if (undoSaveIndex == undoList.size())
- setDirtyState(src.id, false);
- else
- setDirtyState(src.id, true);
- }
-
- /**
- * Clears the history list.
- *
- * @param id an id
- */
- public void resourceSaved(String id) {
- undoSaveIndex = undoList.size();
- setDirtyState(id, false);
- }
-
- /**
- * Return an array of read-only files.
- *
- * @param server a server
- * @return a possibly empty array of files
- */
- public static IFile[] getReadOnlyFiles(IServerAttributes server) {
- try {
- List<IFile> list = new ArrayList<IFile>();
- IFile file = ((Server)server).getFile();
-
- if (file != null)
- list.add(file);
-
- IFile[] files = new IFile[list.size()];
- list.toArray(files);
- return files;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "getReadOnlyFiles", e);
- }
- return null;
- }
-
- /**
- *
- */
- protected IFile[] getServerResourceFiles(String id) {
- if (id == null)
- return new IFile[0];
-
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return new IFile[0];
-
- return getReadOnlyFiles(info.wc);
- }
-
- protected IFile[] getReadOnlyFiles(String id) {
- List<IFile> list = new ArrayList<IFile>();
- IFile[] files = getServerResourceFiles(id);
- int size = files.length;
- for (int i = 0; i < size; i++) {
- if (files[i].isReadOnly())
- list.add(files[i]);
- }
-
- IFile[] fileList = new IFile[list.size()];
- list.toArray(fileList);
- return fileList;
- }
-
- /**
- * Update the timestamps.
- *
- * @param id an id
- */
- public void updateTimestamps(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return;
-
- info.fileMap = new HashMap<IFile, Long>();
- IFile[] files = getServerResourceFiles(id);
- if (files != null) {
- int size = files.length;
-
- for (int i = 0; i < size; i++) {
- if (files[i] != null) {
- File f = files[i].getLocation().toFile();
- if (f != null) {
- long time = f.lastModified();
- info.fileMap.put(files[i], new Long(time));
- }
- }
- }
- }
- info.timestamp = getTimestamp(info);
- }
-
- protected static int getTimestamp(CommandManagerInfo info) {
- IServer server = info.wc.getOriginal();
-
- if (server != null)
- return ((Server)server).getTimestamp();
- return -1;
- }
-
- /**
- *
- */
- protected boolean hasChanged(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return false;
- IFile[] files = getServerResourceFiles(id);
- int size = files.length;
-
- int count = 0;
- for (int i = 0; i < size; i++) {
- count++;
- File f = files[i].getLocation().toFile();
- try {
- Long time = info.fileMap.get(files[i]);
- if (time.longValue() != f.lastModified())
- return true;
- } catch (Exception e) {
- return true;
- }
- }
-
- int timestamp = getTimestamp(info);
- if (info.timestamp != timestamp)
- return true;
-
- if (count != info.fileMap.size())
- return true;
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IOrdered.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IOrdered.java
deleted file mode 100644
index 8872f8bd8..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IOrdered.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-/**
- * An object that has an absolute ordering, and can be ordered against other objects.
- *
- * <p>
- * [issue: It is notoriously difficult to place any kind of
- * useful order on objects that are contributed independently by
- * non-collaborating parties. The IOrdered mechanism is weak, and
- * can't really solve the problem. Issues of presentation are usually
- * best left to the UI, which can sort objects based on arbitrary
- * properties.]
- * </p>
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IOrdered {
- /**
- * Returns the order (index/priority).
- *
- * @return int
- */
- public int getOrder();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorActionFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorActionFactory.java
deleted file mode 100644
index 41791ecf6..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorActionFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.IEditorSite;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
-/**
- *
- */
-public interface IServerEditorActionFactory extends IOrdered {
- /**
- * Returns the id.
- *
- * @return an id
- */
- public String getId();
-
- /**
- * Returns the name.
- *
- * @return a name
- */
- public String getName();
-
- /**
- * Returns true if the given server resource type (given by the
- * id) can be opened with this editor. This result is based on
- * the result of the getFactoryIds() method.
- *
- * @param id an id
- * @return boolean
- */
- public boolean supportsServerElementType(String id);
-
- /**
- * Returns true if this editor page should be visible with the given server.
- * This allows (for instance) complex configuration pages to only be shown when used
- * with non-unittest servers.
- *
- * @param server a server
- * @return <code>true</code> if the action should display
- */
- public boolean shouldDisplay(IServerWorkingCopy server);
-
- /**
- * Create the action.
- *
- * @param site an editor site
- * @param input a server editor input
- * @return an action
- */
- public IAction createAction(IEditorSite site, IServerEditorPartInput input);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorInput.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorInput.java
deleted file mode 100644
index 61ec8d9eb..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorInput.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.ui.IEditorInput;
-/**
- * This is the editor input for the server and server
- * configuration editor. The input includes both a server
- * and server configuration.
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IServerEditorInput extends IEditorInput {
- public static final String EDITOR_ID = ServerUIPlugin.PLUGIN_ID + ".editor";
-
- /**
- * Returns the server id.
- *
- * @return java.lang.String
- */
- public String getServerId();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPageSectionFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPageSectionFactory.java
deleted file mode 100644
index 474385334..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPageSectionFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.ServerEditorSection;
-/**
- *
- */
-public interface IServerEditorPageSectionFactory extends IOrdered {
- /**
- * Returns the id.
- *
- * @return the id
- */
- public String getId();
-
- /**
- * Returns true if the given server resource type (given by the
- * id) can be opened with this editor. This result is based on
- * the result of the types attribute.
- *
- * @param id the type id
- * @return boolean
- */
- public boolean supportsType(String id);
-
- public String getInsertionId();
-
- /**
- * Returns true if this editor page section should be visible with the given server.
- * This allows (for instance) complex configuration pages to only be shown when used
- * with non-unittest servers.
- *
- * @param server a server
- * @return <code>true</code> if the section should be shown, and <code>false</code> otherwise
- */
- public boolean shouldCreateSection(IServerWorkingCopy server);
-
- /**
- * Create the editor page section.
- *
- * @return the section
- */
- public ServerEditorSection createSection();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPartFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPartFactory.java
deleted file mode 100644
index dc601de6e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPartFactory.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.ui.IEditorPart;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-/**
- *
- */
-public interface IServerEditorPartFactory extends IOrdered {
- /**
- * Returns the id.
- *
- * @return the id
- */
- public String getId();
-
- /**
- * Return the displayable name.
- *
- * @return the name
- */
- public String getName();
-
- /**
- * Returns true if the given server resource type (given by the
- * id) can be opened with this editor. This result is based on
- * the result of the types attribute.
- *
- * @param id a server type id
- * @return <code>true</code> if the type is supported
- */
- public boolean supportsType(String id);
-
- /**
- * Returns true if a given insertion id is supported.
- *
- * @param id
- * @return <code>true</code> if the insertion id is supported
- */
- public boolean supportsInsertionId(String id);
-
- /**
- * Returns true if this editor page should be visible with the given server.
- * This allows (for instance) complex configuration pages to only be shown when used
- * with non-unittest servers.
- *
- * @param server a server
- * @return <code>true</code> if the page should be visible
- */
- public boolean shouldCreatePage(IServerWorkingCopy server);
-
- /**
- * Create the editor page.
- *
- * @return the editor page
- */
- public IEditorPart createPage();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java
deleted file mode 100644
index db47e6b5a..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java
+++ /dev/null
@@ -1,1037 +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.wst.server.ui.internal.editor;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.fieldassist.AutoCompleteField;
-import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.jface.fieldassist.FieldDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.fieldassist.TextContentAdapter;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.ManagedForm;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.*;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Publisher;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.internal.ServerType;
-import org.eclipse.wst.server.core.util.SocketUtil;
-import org.eclipse.wst.server.ui.editor.*;
-import org.eclipse.wst.server.ui.internal.ContextIds;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.internal.command.*;
-import org.eclipse.wst.server.ui.internal.viewers.BaseContentProvider;
-import org.eclipse.wst.server.ui.internal.viewers.BaseLabelProvider;
-import org.eclipse.wst.server.ui.internal.wizard.TaskWizard;
-import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- * Server general editor page.
- */
-public class OverviewEditorPart extends ServerEditorPart {
- protected Text serverName;
- protected Text serverConfiguration;
- protected Text hostname;
- protected Combo runtimeCombo;
- protected Button browse;
- protected Button autoPublishDisable;
- protected Button autoPublishEnable;
- protected Spinner autoPublishTime;
- protected Table publishersTable;
- protected CheckboxTableViewer publishersViewer;
- protected Spinner startTimeoutSpinner;
- protected Spinner stopTimeoutSpinner;
- protected ManagedForm managedForm;
-
- protected boolean updating;
-
- protected IRuntime[] runtimes;
-
- protected PropertyChangeListener listener;
-
- protected IRuntimeLifecycleListener runtimeListener;
-
- class PublisherContentProvider extends BaseContentProvider {
- protected Publisher[] pubs;
- public PublisherContentProvider(Publisher[] pubs) {
- this.pubs = pubs;
- }
-
- public Object[] getElements(Object inputElement) {
- return pubs;
- }
- }
-
- class PublishLabelProvider extends BaseLabelProvider {
- public String getText(Object element) {
- if (element instanceof Publisher) {
- Publisher pub = (Publisher) element;
- return pub.getName();
- }
- return "";
- }
- }
-
- /**
- * OverviewEditorPart constructor comment.
- */
- public OverviewEditorPart() {
- super();
- }
-
- /**
- *
- */
- protected void addChangeListener() {
- listener = new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getPropertyName().equals("configuration-id") && serverConfiguration != null)
- validate();
-
- // following code behaves poorly because there is no default local or remote
- // publishing time per server or server type. as a result it sets the value
- // to the default, which seems to be more harm than good until we revamp the
- // default publishing times
- /*if ("hostname".equals(event.getPropertyName())) {
- final String oldHostname = (String) event.getOldValue();
- final String newHostname = (String) event.getNewValue();
- final boolean isNewHostnameLocalhost = SocketUtil.isLocalhost(newHostname);
- if (isNewHostnameLocalhost != SocketUtil.isLocalhost(oldHostname)) {
- // run this code only if the hostname changed from
- // 'localhost' to a remote name, or vice-versa
- hostname.getDisplay().asyncExec(new Runnable() {
- public void run() {
- try {
- if (isNewHostnameLocalhost) {
- int autoPublishTime2 = ServerPreferences.getInstance().getAutoPublishLocalTime();
- ((ServerWorkingCopy)getServer()).setAutoPublishTime(autoPublishTime2);
- } else {
- int autoPublishTime2 = ServerPreferences.getInstance().getAutoPublishRemoteTime();
- ((ServerWorkingCopy)getServer()).setAutoPublishTime(autoPublishTime2);
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not update publish time to new host");
- }
- }
- });
- }
- }*/
-
- if (updating)
- return;
- updating = true;
- if (event.getPropertyName().equals("name"))
- updateNames();
- else if (event.getPropertyName().equals("hostname") && hostname != null) {
- hostname.setText((String) event.getNewValue());
- } else if (event.getPropertyName().equals("runtime-id")) {
- String runtimeId = (String) event.getNewValue();
- IRuntime runtime = null;
- if (runtimeId != null)
- runtime = ServerCore.findRuntime(runtimeId);
- if (runtimeCombo != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
- }
- } else if (event.getPropertyName().equals("configuration-id") && serverConfiguration != null) {
- String path = (String) event.getNewValue();
- serverConfiguration.setText(path);
- } else if (event.getPropertyName().equals(Server.PROP_AUTO_PUBLISH_TIME)) {
- Integer curAutoPublishTime = (Integer)event.getNewValue();
- autoPublishTime.setSelection(curAutoPublishTime.intValue());
- SWTUtil.setSpinnerTooltip(autoPublishTime);
- validate();
- } else if (event.getPropertyName().equals(Server.PROP_AUTO_PUBLISH_SETTING)) {
- Integer autoPublishSetting = (Integer)event.getNewValue();
- int setting = autoPublishSetting.intValue();
- autoPublishEnable.setSelection(setting == Server.AUTO_PUBLISH_ENABLE);
- autoPublishDisable.setSelection(setting == Server.AUTO_PUBLISH_DISABLE);
- autoPublishTime.setEnabled(setting == Server.AUTO_PUBLISH_ENABLE);
- validate();
- } else if (event.getPropertyName().equals(Server.PROP_START_TIMEOUT)) {
- Integer time = (Integer)event.getNewValue();
- startTimeoutSpinner.setSelection(time.intValue());
- SWTUtil.setSpinnerTooltip(startTimeoutSpinner);
- } else if (event.getPropertyName().equals(Server.PROP_STOP_TIMEOUT)) {
- Integer time = (Integer)event.getNewValue();
- stopTimeoutSpinner.setSelection(time.intValue());
- SWTUtil.setSpinnerTooltip(stopTimeoutSpinner);
- } else if (Server.PROP_PUBLISHERS.equals(event.getPropertyName())) {
- if (publishersViewer == null)
- return;
-
- List<String> list = (List<String>) event.getNewValue();
- Iterator<String> iter = list.iterator();
- while (iter.hasNext()) {
- String id = iter.next();
- int ind = id.indexOf(":");
- boolean enabled = false;
- if ("true".equals(id.substring(ind+1)))
- enabled = true;
- id = id.substring(0, ind);
- Publisher pub = ServerPlugin.findPublisher(id);
- if (pub != null)
- publishersViewer.setChecked(pub, enabled);
- }
- }
- updating = false;
- }
- };
- if (server != null)
- server.addPropertyChangeListener(listener);
- }
-
- protected void updateNames() {
- if (serverName != null)
- serverName.setText(server.getName());
- }
-
- /**
- * Creates the SWT controls for this workbench part.
- *
- * @param parent the parent control
- */
- public final void createPartControl(final Composite parent) {
- managedForm = new ManagedForm(parent);
- setManagedForm(managedForm);
- ScrolledForm form = managedForm.getForm();
- FormToolkit toolkit = managedForm.getToolkit();
- toolkit.decorateFormHeading(form.getForm());
- form.setText(Messages.serverEditorOverviewPageTitle);
- form.setImage(ImageResource.getImage(ImageResource.IMG_SERVER));
- form.getBody().setLayout(new GridLayout());
-
- Composite columnComp = toolkit.createComposite(form.getBody());
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- //layout.marginHeight = 10;
- //layout.marginWidth = 10;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 10;
- columnComp.setLayout(layout);
- columnComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- // left column
- Composite leftColumnComp = toolkit.createComposite(columnComp);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 10;
- layout.horizontalSpacing = 0;
- leftColumnComp.setLayout(layout);
- leftColumnComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- createGeneralSection(leftColumnComp, toolkit);
-
- insertSections(leftColumnComp, "org.eclipse.wst.server.editor.overview.left");
-
- // right column
- Composite rightColumnComp = toolkit.createComposite(columnComp);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 10;
- layout.horizontalSpacing = 0;
- rightColumnComp.setLayout(layout);
- rightColumnComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- createPublishSection(rightColumnComp, toolkit);
- createTimeoutSection(rightColumnComp, toolkit);
-
- insertSections(rightColumnComp, "org.eclipse.wst.server.editor.overview.right");
-
- form.reflow(true);
-
- initialize();
- }
-
- protected void createGeneralSection(Composite leftColumnComp, FormToolkit toolkit) {
- Section section = toolkit.createSection(leftColumnComp, ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
- section.setText(Messages.serverEditorOverviewGeneralSection);
- section.setDescription(Messages.serverEditorOverviewGeneralDescription);
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- Composite composite = toolkit.createComposite(section);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 5;
- layout.marginWidth = 10;
- layout.verticalSpacing = 5;
- layout.horizontalSpacing = 5;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
- whs.setHelp(composite, ContextIds.EDITOR_OVERVIEW_PAGE);
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
-
- int decorationWidth = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
-
- // server name
- if (server != null) {
- createLabel(toolkit, composite, Messages.serverEditorOverviewServerName);
-
- serverName = toolkit.createText(composite, server.getName());
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.horizontalIndent = decorationWidth;
- serverName.setLayoutData(data);
- serverName.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (updating)
- return;
- updating = true;
- execute(new SetServerNameCommand(getServer(), serverName.getText()));
- updating = false;
- validate();
- }
- });
- whs.setHelp(serverName, ContextIds.EDITOR_SERVER);
-
- // hostname
- createLabel(toolkit, composite, Messages.serverEditorOverviewServerHostname);
-
- hostname = toolkit.createText(composite, server.getHost());
- final ControlDecoration hostnameDecoration = new ControlDecoration(hostname, SWT.TOP | SWT.LEAD);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.horizontalIndent = decorationWidth;
- hostname.setLayoutData(data);
- hostname.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (updating)
- return;
- updating = true;
- execute(new SetServerHostnameCommand(getServer(), hostname.getText()));
- updating = false;
- }
- });
- whs.setHelp(hostname, ContextIds.EDITOR_HOSTNAME);
-
- FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
- FieldDecoration fd = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
- hostnameDecoration.setImage(fd.getImage());
- hostnameDecoration.setDescriptionText(fd.getDescription());
- hostnameDecoration.hide();
-
- hostname.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
- hostnameDecoration.show();
- }
-
- public void focusLost(FocusEvent e) {
- hostnameDecoration.hide();
- }
- });
-
- //updateDecoration(hostnameDecoration, new Status(IStatus.INFO, ServerUIPlugin.PLUGIN_ID, "Press Ctrl-Space"));
-
- List<String> hosts = ServerUIPlugin.getPreferences().getHostnames();
- String[] hosts2 = hosts.toArray(new String[hosts.size()]);
- new AutoCompleteField(hostname, new TextContentAdapter(), hosts2);
- }
-
- // runtime
- if (server != null && server.getServerType() != null && server.getServerType().hasRuntime()) {
- final Hyperlink link = toolkit.createHyperlink(composite, Messages.serverEditorOverviewRuntime, SWT.NONE);
- link.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- IRuntime runtime = server.getRuntime();
- if (runtime != null && ServerUIPlugin.hasWizardFragment(runtime.getRuntimeType().getId()))
- editRuntime(runtime);
- }
- });
-
- final IRuntime runtime = server.getRuntime();
- if (runtime == null || !ServerUIPlugin.hasWizardFragment(runtime.getRuntimeType().getId()))
- link.setEnabled(false);
-
- IRuntimeType runtimeType = server.getServerType().getRuntimeType();
- runtimes = ServerUIPlugin.getRuntimes(runtimeType);
-
- runtimeCombo = new Combo(composite, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalIndent = decorationWidth;
- data.horizontalSpan = 2;
- runtimeCombo.setLayoutData(data);
- updateRuntimeCombo();
-
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
-
- runtimeCombo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- try {
- if (updating)
- return;
- updating = true;
- IRuntime newRuntime = runtimes[runtimeCombo.getSelectionIndex()];
- execute(new SetServerRuntimeCommand(getServer(), newRuntime));
- link.setEnabled(newRuntime != null && !ServerUIPlugin.hasWizardFragment(newRuntime.getRuntimeType().getId()));
- updating = false;
- } catch (Exception ex) {
- // ignore
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
- whs.setHelp(runtimeCombo, ContextIds.EDITOR_RUNTIME);
-
- // add runtime listener
- runtimeListener = new IRuntimeLifecycleListener() {
- public void runtimeChanged(final IRuntime runtime2) {
- // may be name change of current runtime
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (runtime2.equals(getServer().getRuntime())) {
- try {
- if (updating)
- return;
- updating = true;
- execute(new SetServerRuntimeCommand(getServer(), runtime2));
- updating = false;
- } catch (Exception ex) {
- // ignore
- }
- }
-
- if (runtimeCombo != null && !runtimeCombo.isDisposed()) {
- updateRuntimeCombo();
-
- int size2 = runtimes.length;
- for (int i = 0; i < size2; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
- }
- }
- });
- }
-
- public void runtimeAdded(final IRuntime runtime2) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (runtimeCombo != null && !runtimeCombo.isDisposed()) {
- updateRuntimeCombo();
-
- int size2 = runtimes.length;
- for (int i = 0; i < size2; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
- }
- }
- });
- }
-
- public void runtimeRemoved(IRuntime runtime2) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (runtimeCombo != null && !runtimeCombo.isDisposed()) {
- updateRuntimeCombo();
-
- int size2 = runtimes.length;
- for (int i = 0; i < size2; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
- }
- }
- });
- }
- };
-
- ServerCore.addRuntimeLifecycleListener(runtimeListener);
- }
-
- // server configuration path
- if (server != null && server.getServerType() != null && server.getServerType().hasServerConfiguration()) {
- createLabel(toolkit, composite, Messages.serverEditorOverviewServerConfigurationPath);
-
- IFolder folder = server.getServerConfiguration();
- if (folder == null)
- serverConfiguration = toolkit.createText(composite, Messages.elementUnknownName);
- else
- serverConfiguration = toolkit.createText(composite, "" + server.getServerConfiguration().getFullPath());
-
- serverConfiguration.setEditable(false);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalIndent = decorationWidth;
- data.widthHint = 75;
- serverConfiguration.setLayoutData(data);
-
- whs.setHelp(serverConfiguration, ContextIds.EDITOR_CONFIGURATION);
-
- final IFolder currentFolder = server.getServerConfiguration();
- browse = toolkit.createButton(composite, Messages.serverEditorOverviewServerConfigurationBrowse, SWT.PUSH);
- browse.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(serverConfiguration.getShell(),
- currentFolder, true, Messages.serverEditorOverviewServerConfigurationBrowseMessage);
- dialog.showClosedProjects(false);
-
- if (dialog.open() != Window.CANCEL) {
- Object[] result = dialog.getResult();
- if (result != null && result.length == 1) {
- IPath path = (IPath) result[0];
-
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IResource resource = root.findMember(path);
- if (resource != null && resource instanceof IFolder) {
- IFolder folder2 = (IFolder) resource;
-
- if (updating)
- return;
- updating = true;
- execute(new SetServerConfigurationFolderCommand(getServer(), folder2));
- serverConfiguration.setText(folder2.getFullPath().toString());
- updating = false;
- }
- }
- }
- }
- });
- browse.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- }
-
- if (server != null && server.getServerType() != null) {
- IServerType serverType = server.getServerType();
- if (serverType.supportsLaunchMode(ILaunchManager.RUN_MODE) || serverType.supportsLaunchMode(ILaunchManager.DEBUG_MODE)
- || serverType.supportsLaunchMode(ILaunchManager.PROFILE_MODE)) {
- ILaunchConfigurationType launchType = ((ServerType) serverType).getLaunchConfigurationType();
- if (launchType != null && launchType.isPublic()) {
- final Hyperlink link = toolkit.createHyperlink(composite, Messages.serverEditorOverviewOpenLaunchConfiguration, SWT.NONE);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- link.setLayoutData(data);
- link.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- try {
- ILaunchConfiguration launchConfig = ((Server) getServer()).getLaunchConfiguration(true, null);
- // TODO: use correct launch group
- DebugUITools.openLaunchConfigurationPropertiesDialog(link.getShell(), launchConfig, "org.eclipse.debug.ui.launchGroup.run");
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Could not create launch configuration", ce);
- }
- }
- });
- }
- }
- }
- }
-
- protected void createPublishSection(Composite rightColumnComp, FormToolkit toolkit) {
- Section section = toolkit.createSection(rightColumnComp, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
- section.setText(Messages.serverEditorOverviewPublishSection);
- section.setDescription(Messages.serverEditorOverviewPublishDescription);
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- Composite composite = toolkit.createComposite(section);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 5;
- layout.marginWidth = 10;
- layout.verticalSpacing = 5;
- layout.horizontalSpacing = 15;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
- whs.setHelp(composite, ContextIds.EDITOR_OVERVIEW_PAGE);
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
-
- // auto-publish
- if (server != null) {
- final Server svr = (Server) server;
- int publishSetting = svr.getAutoPublishSetting();
-
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- autoPublishDisable = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishDisable, SWT.RADIO);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- autoPublishDisable.setLayoutData(data);
- autoPublishDisable.setSelection(publishSetting == Server.AUTO_PUBLISH_DISABLE);
- whs.setHelp(autoPublishDisable, ContextIds.EDITOR_AUTOPUBLISH_DISABLE);
-
- autoPublishEnable = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishEnabled, SWT.RADIO);
- autoPublishEnable.setSelection(publishSetting == Server.AUTO_PUBLISH_ENABLE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- autoPublishEnable.setLayoutData(data);
- whs.setHelp(autoPublishEnable, ContextIds.EDITOR_AUTOPUBLISH_ENABLE);
-
- final Label autoPublishTimeLabel = createLabel(toolkit,composite, Messages.serverEditorOverviewAutoPublishEnabledInterval);
- data = new GridData();
- data.horizontalIndent = 20;
- autoPublishTimeLabel.setLayoutData(data);
- autoPublishTimeLabel.setEnabled(autoPublishEnable.getSelection());
-
- autoPublishTime = new Spinner(composite, SWT.BORDER);
- autoPublishTime.setMinimum(0);
- autoPublishTime.setIncrement(5);
- autoPublishTime.setMaximum(120);
- autoPublishTime.setSelection(svr.getAutoPublishTime());
- data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- data.widthHint = 30;
- autoPublishTime.setLayoutData(data);
- autoPublishTime.setEnabled(autoPublishEnable.getSelection());
- SWTUtil.setSpinnerTooltip(autoPublishTime);
- whs.setHelp(autoPublishTime, ContextIds.EDITOR_AUTOPUBLISH_ENABLE);
-
- autoPublishEnable.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (updating || !autoPublishEnable.getSelection())
- return;
- updating = true;
- execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_ENABLE));
- updating = false;
- autoPublishTimeLabel.setEnabled(autoPublishEnable.getSelection());
- autoPublishTime.setEnabled(autoPublishEnable.getSelection());
- validate();
- }
- });
-
- autoPublishDisable.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (updating || !autoPublishDisable.getSelection())
- return;
- updating = true;
- execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_DISABLE));
- updating = false;
- autoPublishTimeLabel.setEnabled(autoPublishEnable.getSelection());
- autoPublishTime.setEnabled(autoPublishEnable.getSelection());
- validate();
- }
- });
-
- autoPublishTime.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (updating)
- return;
- updating = true;
- execute(new SetServerAutoPublishTimeCommand(getServer(), autoPublishTime.getSelection()));
- SWTUtil.setSpinnerTooltip(autoPublishTime);
- updating = false;
- validate();
- }
- });
-
- // publishers
- Publisher[] pubs = ((Server)server).getAllPublishers();
- if (pubs != null && pubs.length > 0) {
- Label label = toolkit.createLabel(composite, Messages.serverEditorOverviewPublishers);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- publishersTable = toolkit.createTable(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.CHECK);
- publishersTable.setHeaderVisible(false);
- publishersTable.setLinesVisible(false);
- whs.setHelp(publishersTable, ContextIds.EDITOR_PUBLISHTASKS_CONFIGURATION);
-
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- data.heightHint = 80;
- publishersTable.setLayoutData(data);
-
- publishersViewer = new CheckboxTableViewer(publishersTable);
- publishersViewer.setColumnProperties(new String[] {"name"});
- publishersViewer.setContentProvider(new PublisherContentProvider(pubs));
- publishersViewer.setLabelProvider(new PublishLabelProvider());
- publishersViewer.setInput("root");
-
- Publisher[] pubs2 = ((Server)server).getEnabledPublishers();
- for (Publisher p : pubs2)
- publishersViewer.setChecked(p, true);
-
- publishersViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object element = event.getElement();
- if (element == null || !(element instanceof Publisher))
- return;
- if (updating)
- return;
- updating = true;
- execute(new SetPublisherEnablementCommand(getServer(), (Publisher) element, event.getChecked()));
- updating = false;
- }
- });
- }
- }
- }
-
- protected void createTimeoutSection(Composite rightColumnComp, FormToolkit toolkit) {
- Section section = toolkit.createSection(rightColumnComp, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
- section.setText(Messages.serverEditorOverviewTimeoutSection);
- section.setDescription(Messages.serverEditorOverviewTimeoutDescription);
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- Composite composite = toolkit.createComposite(section);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 5;
- layout.marginWidth = 10;
- layout.verticalSpacing = 5;
- layout.horizontalSpacing = 15;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
- whs.setHelp(composite, ContextIds.EDITOR_OVERVIEW_PAGE);
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
-
- // timeouts
- if (server != null) {
- final Server svr = (Server) server;
-
- // start timeout label
- final Label startTimeoutLabel = createLabel(toolkit, composite, Messages.serverEditorOverviewStartTimeout);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalIndent = 20;
- startTimeoutLabel.setLayoutData(data);
-
- startTimeoutSpinner = new Spinner(composite, SWT.BORDER);
- startTimeoutSpinner.setEnabled(true);
- startTimeoutSpinner.setMinimum(1);
- startTimeoutSpinner.setMaximum(60*60*24); // 24 hours
- startTimeoutSpinner.setIncrement(5);
- startTimeoutSpinner.setSelection(svr.getStartTimeout());
- SWTUtil.setSpinnerTooltip(startTimeoutSpinner);
- data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- data.widthHint = 30;
- startTimeoutSpinner.setLayoutData(data);
- whs.setHelp(startTimeoutSpinner, ContextIds.EDITOR_TIMEOUT_START);
-
- // stop timeout label
- final Label stopTimeoutLabel = createLabel(toolkit, composite, Messages.serverEditorOverviewStopTimeout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalIndent = 20;
- stopTimeoutLabel.setLayoutData(data);
-
- stopTimeoutSpinner = new Spinner(composite, SWT.BORDER);
- stopTimeoutSpinner.setEnabled(true);
- stopTimeoutSpinner.setMinimum(1);
- stopTimeoutSpinner.setMaximum(60*60*24); // 24 hours
- stopTimeoutSpinner.setIncrement(5);
- stopTimeoutSpinner.setSelection(svr.getStopTimeout());
- SWTUtil.setSpinnerTooltip(stopTimeoutSpinner);
- data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- data.widthHint = 30;
- stopTimeoutSpinner.setLayoutData(data);
- whs.setHelp(stopTimeoutSpinner, ContextIds.EDITOR_TIMEOUT_STOP);
-
- startTimeoutSpinner.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (updating)
- return;
- updating = true;
- execute(new SetServerStartTimeoutCommand(getServer(), startTimeoutSpinner.getSelection()));
- SWTUtil.setSpinnerTooltip(startTimeoutSpinner);
- updating = false;
- validate();
- }
- });
- stopTimeoutSpinner.addModifyListener(new ModifyListener(){
- public void modifyText(ModifyEvent e) {
- if (updating)
- return;
- updating = true;
- execute(new SetServerStopTimeoutCommand(getServer(), stopTimeoutSpinner.getSelection()));
- SWTUtil.setSpinnerTooltip(stopTimeoutSpinner);
- updating = false;
- validate();
- }
- });
- }
- }
-
- protected void editRuntime(IRuntime runtime) {
- IRuntimeWorkingCopy runtimeWorkingCopy = runtime.createWorkingCopy();
- if (showWizard(runtimeWorkingCopy) != Window.CANCEL) {
- try {
- runtimeWorkingCopy.save(false, null);
- } catch (Exception ex) {
- // ignore
- }
- }
- }
-
- protected int showWizard(final IRuntimeWorkingCopy runtimeWorkingCopy) {
- String title = Messages.wizEditRuntimeWizardTitle;
- final WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(runtimeWorkingCopy.getRuntimeType().getId());
- if (fragment2 == null)
- return Window.CANCEL;
-
- TaskModel taskModel = new TaskModel();
- taskModel.putObject(TaskModel.TASK_RUNTIME, runtimeWorkingCopy);
-
- WizardFragment fragment = new WizardFragment() {
- protected void createChildFragments(List<WizardFragment> list) {
- list.add(fragment2);
- list.add(WizardTaskUtil.SaveRuntimeFragment);
- }
- };
-
- TaskWizard wizard = new TaskWizard(title, fragment, taskModel);
- wizard.setForcePreviousAndNextButtons(true);
- WizardDialog dialog = new WizardDialog(getEditorSite().getShell(), wizard);
- return dialog.open();
- }
-
- protected void updateRuntimeCombo() {
- IRuntimeType runtimeType = server.getServerType().getRuntimeType();
- runtimes = ServerUIPlugin.getRuntimes(runtimeType);
-
- if (SocketUtil.isLocalhost(server.getHost()) && runtimes != null) {
- List<IRuntime> runtimes2 = new ArrayList<IRuntime>();
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- IRuntime runtime2 = runtimes[i];
- if (!runtime2.isStub())
- runtimes2.add(runtime2);
- }
- runtimes = new IRuntime[runtimes2.size()];
- runtimes2.toArray(runtimes);
- }
-
- int size = runtimes.length;
- String[] items = new String[size];
- for (int i = 0; i < size; i++)
- items[i] = runtimes[i].getName();
-
- runtimeCombo.setItems(items);
- }
-
- protected Label createLabel(FormToolkit toolkit, Composite parent, String text) {
- Label label = toolkit.createLabel(parent, text);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- return label;
- }
-
- public void dispose() {
- super.dispose();
-
- if (server != null)
- server.removePropertyChangeListener(listener);
-
- if (runtimeListener != null)
- ServerCore.removeRuntimeLifecycleListener(runtimeListener);
-
- if (managedForm != null) {
- managedForm.dispose();
- managedForm = null;
- }
- }
-
- /* (non-Javadoc)
- * Initializes the editor part with a site and input.
- */
- public void init(IEditorSite site, IEditorInput input) {
- super.init(site, input);
-
- addChangeListener();
- initialize();
- }
-
- /**
- * Initialize the fields in this editor.
- */
- protected void initialize() {
- if (serverName == null)
- return;
- updating = true;
-
- if (server != null) {
- serverName.setText(server.getName());
- if (readOnly)
- serverName.setEditable(false);
- else
- serverName.setEditable(true);
-
- hostname.setText(server.getHost());
- if (readOnly)
- hostname.setEditable(false);
- else
- hostname.setEditable(true);
-
- if (runtimeCombo != null) {
- updateRuntimeCombo();
- IRuntime runtime = server.getRuntime();
- int size2 = runtimes.length;
- for (int i = 0; i < size2; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
- if (readOnly)
- runtimeCombo.setEnabled(false);
- else
- runtimeCombo.setEnabled(true);
- }
-
- if (serverConfiguration != null) {
- IFolder folder = server.getServerConfiguration();
- if (folder == null)
- serverConfiguration.setText(Messages.elementUnknownName);
- else
- serverConfiguration.setText("" + server.getServerConfiguration().getFullPath());
- if (readOnly) {
- serverConfiguration.setEditable(false);
- browse.setEnabled(false);
- } else {
- serverConfiguration.setEditable(true);
- browse.setEnabled(true);
- }
- }
-
- Server svr = (Server) server;
- int publishSetting = svr.getAutoPublishSetting();
- autoPublishDisable.setSelection(publishSetting == Server.AUTO_PUBLISH_DISABLE);
- autoPublishEnable.setSelection(publishSetting == Server.AUTO_PUBLISH_ENABLE);
- autoPublishTime.setSelection(svr.getAutoPublishTime());
-
- if (readOnly) {
- autoPublishDisable.setEnabled(false);
- autoPublishEnable.setEnabled(false);
- autoPublishTime.setEnabled(false);
- } else {
- autoPublishDisable.setEnabled(true);
- autoPublishEnable.setEnabled(true);
- autoPublishTime.setEnabled(publishSetting == Server.AUTO_PUBLISH_ENABLE);
- }
- }
-
- updating = false;
- validate();
- }
-
- protected void validate() {
- IManagedForm mForm = getManagedForm();
- if (mForm == null)
- return;
-
- mForm.getMessageManager().removeMessage("name", serverName);
- if (server != null && serverName != null) {
- if (ServerPlugin.isNameInUse(server, serverName.getText().trim()))
- mForm.getMessageManager().addMessage("name", Messages.errorDuplicateName, null, IMessageProvider.ERROR, serverName);
- }
-
- if (serverConfiguration != null) {
- mForm.getMessageManager().removeMessage("config", serverConfiguration);
- if (server != null && server.getServerType() != null && server.getServerType().hasServerConfiguration()) {
- IFolder folder = getServer().getServerConfiguration();
-
- if (folder == null || !folder.exists()) {
- IProject project = null;
- if (folder != null)
- project = folder.getProject();
- if (project != null && project.exists() && !project.isOpen())
- mForm.getMessageManager().addMessage("config", NLS.bind(Messages.errorConfigurationNotAccessible, project.getName()), null, IMessageProvider.ERROR, serverConfiguration);
- else
- mForm.getMessageManager().addMessage("config", Messages.errorMissingConfiguration, null, IMessageProvider.ERROR, serverConfiguration);
- }
- }
- }
-
- mForm.getMessageManager().update();
- }
-
- protected void updateDecoration(ControlDecoration decoration, IStatus status) {
- if (status != null) {
- Image newImage = null;
- FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
- switch (status.getSeverity()) {
- case IStatus.INFO:
- //newImage = registry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage();
- newImage = registry.getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED).getImage();
- break;
- case IStatus.WARNING:
- newImage = registry.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage();
- break;
- case IStatus.ERROR:
- newImage = registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();
- }
- decoration.setDescriptionText(status.getMessage());
- decoration.setImage(newImage);
- decoration.show();
- } else {
- decoration.setDescriptionText(null);
- decoration.hide();
- }
- }
-
- /*
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- if (serverName != null)
- serverName.setFocus();
- else if (serverConfiguration != null)
- serverConfiguration.setFocus();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java
deleted file mode 100644
index 6d6a8cd83..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java
+++ /dev/null
@@ -1,980 +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.wst.server.ui.internal.editor;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.MultiPageEditorPart;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.editor.*;
-import org.eclipse.wst.server.ui.internal.*;
-/**
- * A multi-page server resource editor.
- */
-public class ServerEditor extends MultiPageEditorPart {
- /**
- * Internal part and shell activation listener
- */
- class ActivationListener extends ShellAdapter implements IPartListener {
- private IWorkbenchPart fActivePart;
- private boolean fIsHandlingActivation = false;
-
- public void partActivated(IWorkbenchPart part) {
- fActivePart = part;
- handleActivation();
- }
-
- public void partBroughtToTop(IWorkbenchPart part) {
- // do nothing
- }
-
- public void partClosed(IWorkbenchPart part) {
- // do nothing
- }
-
- public void partDeactivated(IWorkbenchPart part) {
- fActivePart = null;
- }
-
- public void partOpened(IWorkbenchPart part) {
- // do nothing
- }
-
- public void shellActivated(ShellEvent e) {
- handleActivation();
- }
-
- private void handleActivation() {
- if (fIsHandlingActivation)
- return;
-
- if (fActivePart == ServerEditor.this) {
- fIsHandlingActivation = true;
- try {
- checkResourceState();
- } finally {
- fIsHandlingActivation = false;
- }
- }
- }
- }
-
- class LifecycleListener implements IServerLifecycleListener {
- public void serverAdded(IServer oldServer) {
- // do nothing
- }
- public void serverChanged(IServer oldServer) {
- // do nothing
- }
- public void serverRemoved(IServer oldServer) {
- if (oldServer.equals(server) && !isDirty())
- closeEditor();
- }
- }
-
- protected IServerWorkingCopy server;
- protected String serverId;
- protected String serverName;
-
- protected GlobalCommandManager commandManager;
-
- protected PropertyChangeListener listener;
-
- protected IAction undoAction;
- protected IAction redoAction;
-
- protected TextAction cutAction;
- protected TextAction copyAction;
- protected TextAction pasteAction;
- protected boolean updatingActions;
-
- protected IAction[] editorActions;
-
- protected java.util.List<IEditorPart> serverPages;
-
- // on focus change flag
- protected boolean resourceDeleted;
-
- // input given to the contained pages
- protected IServerEditorPartInput editorPartInput;
-
- // status line and status
- protected IStatusLineManager status;
- protected StatusLineContributionItem statusItem;
-
- private ActivationListener activationListener = new ActivationListener();
- protected LifecycleListener resourceListener;
-
- // used for disabling resource change check when saving through editor
- protected boolean isSaving = false;
-
- protected Map<IEditorPart, IServerEditorPartFactory> pageToFactory = new HashMap<IEditorPart, IServerEditorPartFactory>();
-
- /**
- * ServerEditor constructor comment.
- */
- public ServerEditor() {
- super();
-
- ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
-
- undoAction = new Action() {
- public void run() {
- getCommandManager().undo(serverId);
- }
- };
- undoAction.setEnabled(false);
- undoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- //undoAction.setHoverImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_HOVER));
- //undoAction.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
-
- redoAction = new Action() {
- public void run() {
- getCommandManager().redo(serverId);
- }
- };
- redoAction.setEnabled(false);
- redoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
- //redoAction.setHoverImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_HOVER));
- //redoAction.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
- }
-
- /**
- * Close the editor correctly.
- */
- protected void closeEditor() {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- getEditorSite().getPage().closeEditor(ServerEditor.this, false);
- }
- });
- }
-
- protected void createActions() {
- List<IAction> actionList = new ArrayList<IAction>();
-
- // add server actions
- if (server != null && server.getServerType() != null) {
- Iterator iterator = ServerEditorCore.getServerEditorActionFactories().iterator();
- String id = server.getServerType().getId();
- while (iterator.hasNext()) {
- ServerEditorActionFactory factory = (ServerEditorActionFactory) iterator.next();
- if (factory.supportsServerElementType(id) && factory.shouldDisplay(server))
- actionList.add(factory.createAction(getEditorSite(), editorPartInput));
- }
- }
-
- editorActions = new IAction[actionList.size()];
- actionList.toArray(editorActions);
- }
-
- public IServerEditorPartFactory getPageFactory(ServerEditorPart part) {
- try {
- return pageToFactory.get(part);
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- /**
- * Creates the pages of this multi-page editor.
- * <p>
- * Subclasses of <code>MultiPageEditor</code> must implement this method.
- * </p>
- */
- protected void createPages() {
- try {
- int index = 0;
- serverPages = new ArrayList<IEditorPart>();
-
- // add editor pages
- int pageCount = 0;
-
- String serverTypeId = null;
- if (server != null && server.getServerType() != null)
- serverTypeId = server.getServerType().getId();
-
- Iterator iterator = ServerEditorCore.getServerEditorPageFactories().iterator();
- while (iterator.hasNext()) {
- IServerEditorPartFactory factory = (IServerEditorPartFactory) iterator.next();
- if (factory.supportsType(serverTypeId) && factory.shouldCreatePage(server)) {
- Trace.trace(Trace.FINEST, "Adding page: " + factory.getId() + " " + editorPartInput);
- try {
- IEditorPart page = factory.createPage();
- if (page != null) {
- pageToFactory.put(page, factory);
- index = addPage(page, editorPartInput);
- setPageText(index, factory.getName());
-
- serverPages.add(page);
-
- pageCount ++;
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not display editor page " + factory.getId(), e);
- }
- }
- }
-
- if (pageCount > 0)
- setActivePage(0);
-
- // register for events that might change the cut/copy/paste actions
- int count = getPageCount();
- for (int i = 0; i < count; i++) {
- Control control = getControl(i);
- registerEvents(control);
- }
- updateActions();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error creating server editor pages", e);
- }
- }
-
- public void dispose() {
- if (activationListener != null) {
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.getPartService().removePartListener(activationListener);
- Shell shell = window.getShell();
- if (shell != null && !shell.isDisposed())
- shell.removeShellListener(activationListener);
- activationListener = null;
- }
-
- if (resourceListener != null)
- ServerCore.removeServerLifecycleListener(resourceListener);
-
- if (serverName != null && !server.getName().equals(serverName)) {
- // only prompt if the server is in the workspace or there is a configuration
- if (server.getServerConfiguration() != null || ((Server)server).getFile() != null) {
- String title = Messages.editorServerEditor;
- String message = Messages.editorRenameFiles;
- if (MessageDialog.openQuestion(getEditorSite().getShell(), title, message))
- try {
- ((ServerWorkingCopy)server).renameFiles(null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error renaming server", e);
- }
- }
- }
-
- super.dispose();
- if (commandManager != null) {
- commandManager.removePropertyChangeListener(listener);
-
- if (serverId != null)
- commandManager.releaseCommandManager(serverId);
-
- commandManager = null;
- }
- }
-
- /* (non-Javadoc)
- * Saves the contents of this editor.
- * <p>
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public void doSave(IProgressMonitor monitor) {
- // set the isSaving flag to true
- isSaving = true;
-
- // check pages for errors first
- java.util.List<String> errors = new ArrayList<String>();
- Iterator iterator = serverPages.iterator();
- int count = 0;
- int maxSeverity = -1;
- while (iterator.hasNext()) {
- IEditorPart part = (IEditorPart) iterator.next();
- if (part instanceof ServerEditorPart) {
- IStatus[] status2 = ((ServerEditorPart) part).getSaveStatus();
- if (status2 != null) {
- int size = status2.length;
- for (int i = 0; i < size; i++) {
- errors.add("[" + getPageText(count) + "] " + status2[i].getMessage());
- maxSeverity = Math.max(maxSeverity, status2[i].getSeverity());
- }
- }
- }
- count ++;
- }
- if (!errors.isEmpty() && maxSeverity > IStatus.OK) {
- StringBuffer sb = new StringBuffer();
- sb.append(Messages.errorEditorCantSave + "\n");
- iterator = errors.iterator();
- while (iterator.hasNext())
- sb.append("\t" + ((String) iterator.next()) + "\n");
-
- if (maxSeverity == IStatus.ERROR) {
- MessageDialog.openError(getEditorSite().getShell(), getPartName(), sb.toString());
- monitor.setCanceled(true);
- // reset the isSaving flag
- isSaving = false;
- return;
- } else if (maxSeverity == IStatus.WARNING)
- MessageDialog.openWarning(getEditorSite().getShell(), getPartName(), sb.toString());
- else // if (maxSeverity == IStatus.INFO)
- MessageDialog.openInformation(getEditorSite().getShell(), getPartName(), sb.toString());
- }
-
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- int ticks = 2000;
- String name = "";
- if (server != null)
- name = server.getName();
- monitor.beginTask(NLS.bind(Messages.savingTask, name), ticks);
- if (server != null)
- ticks /= 2;
-
- if (server != null) {
- server.save(false, ProgressUtil.getSubMonitorFor(monitor, ticks));
- getCommandManager().resourceSaved(serverId);
- commandManager.updateTimestamps(serverId);
- }
-
- ILabelProvider labelProvider = ServerUICore.getLabelProvider();
- if (server != null)
- setPartName(labelProvider.getText(server));
- labelProvider.dispose();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error saving server editor", e);
-
- monitor.setCanceled(true);
-
- String title = Messages.editorSaveErrorDialog;
- String message = NLS.bind(Messages.editorSaveErrorMessage, e.getLocalizedMessage());
- MessageDialog.openError(getEditorSite().getShell(), title, message);
- } finally {
- monitor.done();
- }
- // reset the isSaving flag
- isSaving = false;
- }
-
- /* (non-Javadoc)
- * Saves the contents of this editor to another object.
- * <p>
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public void doSaveAs() {
- // do nothing
- }
-
- /**
- * Fire a property change event.
- *
- * @param i a property change value
- */
- protected void firePropertyChange(int i) {
- if (i == ServerEditorPart.PROP_ERROR)
- updateStatusError();
- super.firePropertyChange(i);
- }
-
- /**
- * Return the global command manager.
- *
- * @return the global command manager
- */
- public GlobalCommandManager getCommandManager() {
- return commandManager;
- }
-
- /**
- * Return the redo action.
- *
- * @return org.eclipse.jface.action.Action
- */
- public IAction getRedoAction() {
- return redoAction;
- }
-
- /**
- * Return the undo action.
- *
- * @return org.eclipse.jface.action.Action
- */
- public IAction getUndoAction() {
- return undoAction;
- }
-
- /* (non-Javadoc)
- * Sets the cursor and selection state for this editor to the passage defined
- * by the given marker.
- * <p>
- * Subclasses may override. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public void gotoMarker(IMarker marker) {
- // do nothing
- }
-
- /**
- * Update the cut, copy, and paste actions.
- */
- public void updateActionsImpl() {
- if (updatingActions)
- return;
-
- updatingActions = true;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- updatingActions = false;
- updateActions();
- }
- });
- }
-
- /**
- * Update the cut, copy, and paste actions.
- */
- public void updateActions() {
- cutAction.update();
- copyAction.update();
- pasteAction.update();
- }
-
- /**
- * Update the cut, copy, and paste actions.
- */
- protected void updateStatusLine() {
- if (statusItem != null) {
- boolean readOnly = false;
- if (server != null && commandManager.isReadOnly(serverId))
- readOnly = true;
-
- if (readOnly)
- statusItem.setText(Messages.editorReadOnly);
- else
- statusItem.setText(Messages.editorWritable);
- }
-
- if (status != null) {
- StringBuffer sb = new StringBuffer();
- boolean first = true;
- if (server != null) {
- IFile[] files = commandManager.getReadOnlyFiles(serverId);
- for (int i = 0; i < files.length; i++) {
- if (!first)
- sb.append(", ");
- sb.append(files[i].getName());
- first = false;
- }
- }
- /*if (serverConfiguration != null) {
- IFile[] files = commandManager.getReadOnlyFiles(serverConfigurationId);
- for (int i = 0; i < files.length; i++) {
- if (!first)
- sb.append(", ");
- sb.append(files[i].getName());
- first = false;
- }
- }*/
- if (sb.length() > 1)
- status.setMessage(NLS.bind(Messages.editorReadOnlyFiles, sb.toString()));
- else
- status.setMessage("");
- }
- }
-
- /**
- *
- */
- public void updateStatusError() {
- if (status == null)
- return;
-
- String error = null;
- IEditorPart part = getActiveEditor();
- if (part instanceof ServerEditorPart)
- error = ((ServerEditorPart) part).getErrorMessage();
-
- Iterator iterator = serverPages.iterator();
- int count = 0;
- while (error == null && iterator.hasNext()) {
- part = (IEditorPart) iterator.next();
- if (part instanceof ServerEditorPart) {
- error = ((ServerEditorPart) part).getErrorMessage();
- if (error != null)
- error = "[" + getPageText(count) + "] " + error;
- }
- count ++;
- }
- status.setErrorMessage(error);
- }
-
- /**
- *
- */
- protected void pageChange(int newPageIndex) {
- super.pageChange(newPageIndex);
- updateStatusError();
- }
-
- /**
- * Set the status.
- *
- * @param status a status line manager
- * @param item a status contribution item
- */
- public void setStatus(IStatusLineManager status, StatusLineContributionItem item) {
- this.status = status;
- this.statusItem = item;
- updateStatusError();
- }
-
- /**
- * Register for key and traversal events to enable/disable the cut/copy/paste actions.
- */
- protected void registerEvents(Control control) {
- if (control == null)
- return;
-
- if (control instanceof Text || control instanceof Combo) {
- // register the world... any of these actions could cause the state to change
- control.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent event) {
- updateActionsImpl();
- }
- });
- control.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent event) {
- updateActionsImpl();
- }
- public void keyReleased(KeyEvent event) {
- updateActionsImpl();
- }
- });
- control.addMouseListener(new MouseListener() {
- public void mouseDown(MouseEvent event) {
- // do nothing
- }
- public void mouseUp(MouseEvent event) {
- updateActionsImpl();
- }
- public void mouseDoubleClick(MouseEvent event) {
- updateActionsImpl();
- }
- });
- control.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent event) {
- updateActionsImpl();
- }
- public void focusLost(FocusEvent event) {
- updateActionsImpl();
- }
- });
- if (control instanceof Text) {
- Text text = (Text) control;
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- updateActionsImpl();
- }
- });
- text.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- updateActionsImpl();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- updateActionsImpl();
- }
- });
- } else {
- Combo combo = (Combo) control;
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- updateActionsImpl();
- }
- });
- combo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- updateActionsImpl();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- updateActionsImpl();
- }
- });
- }
- }
-
- if (control instanceof Composite) {
- Control[] children = ((Composite)control).getChildren();
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++)
- registerEvents(children[i]);
- }
- }
- }
-
- /* (non-Javadoc)
- * Initializes the editor part with a site and input.
- * <p>
- * Subclasses of <code>EditorPart</code> must implement this method. Within
- * the implementation subclasses should verify that the input type is acceptable
- * and then save the site and input. Here is sample code:
- * </p>
- * <pre>
- * if (!(input instanceof IFileEditorInput))
- * throw new PartInitException("Invalid Input: Must be IFileEditorInput");
- * setSite(site);
- * setInput(editorInput);
- * </pre>
- */
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- commandManager = GlobalCommandManager.getInstance();
- super.init(site, input);
-
- if (input instanceof IFileEditorInput) {
- IFileEditorInput fei = (IFileEditorInput) input;
- IFile file = fei.getFile();
- if (file != null && file.exists()) {
- IServer server2 = ServerUIPlugin.findServer(file);
- if (server2 != null)
- serverId = server2.getId();
- }
- if (serverId == null) {
- if (file == null)
- throw new PartInitException(NLS.bind(Messages.errorEditor, Messages.elementUnknownName));
- throw new PartInitException(NLS.bind(Messages.errorEditor, file.getName()));
- }
- } else if (input instanceof IServerEditorInput) {
- IServerEditorInput sei = (IServerEditorInput) input;
- serverId = sei.getServerId();
- }
-
- if (serverId != null) {
- commandManager.getCommandManager(serverId);
- server = commandManager.getServerResource(serverId);
- }
-
- ILabelProvider labelProvider = ServerUICore.getLabelProvider();
- if (server != null) {
- setPartName(labelProvider.getText(server));
- setTitleImage(labelProvider.getImage(server));
- setTitleToolTip(serverId);
- serverName = server.getName();
- } else
- setPartName("-");
- labelProvider.dispose();
- labelProvider = null;
-
- cutAction = new TextAction(site.getShell().getDisplay(), TextAction.CUT_ACTION);
- copyAction = new TextAction(site.getShell().getDisplay(), TextAction.COPY_ACTION);
- pasteAction = new TextAction(site.getShell().getDisplay(), TextAction.PASTE_ACTION);
-
- listener = new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (GlobalCommandManager.PROP_DIRTY.equals(event.getPropertyName())) {
- Object obj = event.getOldValue();
- if (obj == serverId)
- firePropertyChange(PROP_DIRTY);
- } else if (GlobalCommandManager.PROP_UNDO.equals(event.getPropertyName())) {
- Object obj = event.getOldValue();
- if (obj == serverId)
- updateUndoAction();
- } else if (GlobalCommandManager.PROP_REDO.equals(event.getPropertyName())) {
- Object obj = event.getOldValue();
- if (obj == serverId)
- updateRedoAction();
- } else if (GlobalCommandManager.PROP_RELOAD.equals(event.getPropertyName())) {
- Object obj = event.getOldValue();
- if (obj == serverId) {
- server = commandManager.getServerResource(serverId);
- refresh();
- }
- }
- }
- };
- if (server != null && commandManager.isDirty(serverId))
- firePropertyChange(PROP_DIRTY);
-
- commandManager.addPropertyChangeListener(listener);
-
- // create editor input
- ServerResourceCommandManager serverCommandManager = null;
- if (server != null)
- serverCommandManager = new ServerResourceCommandManager(this, serverId, commandManager);
- editorPartInput = commandManager.getPartInput(serverId, serverCommandManager);
-
- createActions();
-
- // add resource listener
- resourceListener = new LifecycleListener();
- ServerCore.addServerLifecycleListener(resourceListener);
-
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.getPartService().addPartListener(activationListener);
- window.getShell().addShellListener(activationListener);
- }
-
- /* (non-Javadoc)
- * Returns whether the contents of this editor have changed since the last save
- * operation.
- * <p>
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public boolean isDirty() {
- if (commandManager != null) {
- if (server != null && commandManager.isDirty(serverId))
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * Returns whether the "save as" operation is supported by this editor.
- * <p>
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /**
- * Update the undo action.
- */
- protected void updateUndoAction() {
- IUndoableOperation command = commandManager.getUndoCommand(serverId);
- if (command == null) {
- undoAction.setText(Messages.editorUndoDisabled);
- undoAction.setToolTipText("");
- undoAction.setDescription("");
- undoAction.setEnabled(false);
- } else {
- String text = NLS.bind(Messages.editorUndoEnabled, new Object[] {command.getLabel()});
- undoAction.setText(text);
- undoAction.setToolTipText(command.getLabel());
- undoAction.setDescription(command.getLabel());
- undoAction.setEnabled(true);
- }
- }
-
- /**
- * Update the redo action.
- */
- protected void updateRedoAction() {
- IUndoableOperation command = commandManager.getRedoCommand(serverId);
- if (command == null) {
- redoAction.setText(Messages.editorRedoDisabled);
- redoAction.setToolTipText("");
- redoAction.setDescription("");
- redoAction.setEnabled(false);
- } else {
- String text = NLS.bind(Messages.editorRedoEnabled, new Object[] {command.getLabel()});
- redoAction.setText(text);
- redoAction.setToolTipText(command.getLabel());
- redoAction.setDescription(command.getLabel());
- redoAction.setEnabled(true);
- }
- }
-
- /**
- * Return the cut action.
- *
- * @return org.eclipse.jface.action.IAction
- */
- public IAction getCutAction() {
- return cutAction;
- }
-
- /**
- * Return the copy action.
- *
- * @return org.eclipse.jface.action.IAction
- */
- public IAction getCopyAction() {
- return copyAction;
- }
-
- /**
- * Return the paste action.
- *
- * @return org.eclipse.jface.action.IAction
- */
- public IAction getPasteAction() {
- return pasteAction;
- }
-
- /**
- * Returns the editor actions.
- *
- * @return org.eclipse.jface.action.IAction
- */
- public IAction[] getEditorActions() {
- return editorActions;
- }
-
- /**
- * Update the server pages with new input.
- */
- protected void refresh() {
- // create editor input
- ServerResourceCommandManager serverCommandManager = null;
- if (server != null)
- serverCommandManager = new ServerResourceCommandManager(this, serverId, commandManager);
- editorPartInput = commandManager.getPartInput(serverId, serverCommandManager);
-
- Iterator iterator = serverPages.iterator();
- while (iterator.hasNext()) {
- IEditorPart part = (IEditorPart) iterator.next();
- try {
- part.init(part.getEditorSite(), editorPartInput);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error refresh()ing editor part", e);
- }
- }
- }
-
- /**
- *
- */
- protected void promptReadOnlyServerFile(String id) {
- commandManager.setReadOnly(id, true);
- String title = Messages.editorResourceModifiedTitle;
- String message = Messages.editorReadOnlyMessage;
- MessageDialog.openInformation(getEditorSite().getShell(), title, message);
- }
-
- /**
- *
- */
- protected void promptReloadServerFile(String id) {
- String title = Messages.editorResourceModifiedTitle;
- String message = Messages.editorServerModifiedMessage;
-
- if (MessageDialog.openQuestion(getEditorSite().getShell(), title, message)) {
- /*try {
- //wc.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
- //TODO: refresh local server
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error refreshing server", e);
- }*/
- commandManager.reload(id);
- }
- }
-
- /**
- *
- */
- public void setFocus() {
- super.setFocus();
- }
-
- /**
- *
- */
- protected void checkResourceState() {
- // do not check the resource state change if saving through the editor
- if (isSaving) {
- // do nothing
- return;
- }
-
- // check for deleted files
- if (resourceDeleted) {
- String title = Messages.editorResourceDeleteTitle;
- String message = null;
- if (server != null)
- message = NLS.bind(Messages.editorResourceDeleteServerMessage, server.getName());
- String[] labels = new String[] {Messages.editorResourceDeleteSave, IDialogConstants.CLOSE_LABEL};
- MessageDialog dialog = new MessageDialog(getEditorSite().getShell(), title, null, message, MessageDialog.INFORMATION, labels, 0);
-
- if (dialog.open() == 0)
- doSave(new NullProgressMonitor());
- else
- closeEditor();
- return;
- }
- resourceDeleted = false;
-
- // check for server changes
- if (serverId != null) {
- if (!commandManager.isDirty(serverId)) {
- if (commandManager.hasChanged(serverId)) {
- IServer newServer = ServerCore.findServer(serverId);
- if (newServer != null && ((Server)newServer).getTimestamp() > ((Server)server).getTimestamp())
- commandManager.reload(serverId);
- else
- promptReloadServerFile(serverId);
- }
- } else {
- if (commandManager.hasChanged(serverId) && !commandManager.areFilesReadOnly(serverId))
- promptReloadServerFile(serverId);
- else if (commandManager.areFilesReadOnly(serverId) && !commandManager.isReadOnly(serverId))
- promptReadOnlyServerFile(serverId);
- }
- if (commandManager.isReadOnly(serverId) && !commandManager.areFilesReadOnly(serverId))
- commandManager.setReadOnly(serverId, false);
- commandManager.updateTimestamps(serverId);
- }
-
- updateStatusLine();
- }
-
- /**
- * Set the title tooltip.
- *
- * @return the title tooltip
- */
- public String getTitleToolTip() {
- Server server2 = (Server) server;
- if (server != null && server2.getFile() != null)
- return server2.getFile().getFullPath().toString();
- else if (server != null)
- return server.getName();
- else
- return "error";
- }
-
- public int getOrientation() {
- return Window.getDefaultOrientation();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionBarContributor.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionBarContributor.java
deleted file mode 100644
index ae4c948dd..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionBarContributor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.EditorActionBarContributor;
-/**
- * Server editor action bar contributor.
- */
-public class ServerEditorActionBarContributor extends EditorActionBarContributor {
- public static final String SERVER_EDITOR_SEPARATOR = "server-editor-additions";
-
- // current editor
- protected ServerEditor editor;
-
- /**
- * ServerEditorActionBarContributor constructor comment.
- */
- public ServerEditorActionBarContributor() {
- super();
- }
-
- /**
- * Sets the active editor for the contributor.
- * <p>
- * The <code>EditorActionBarContributor</code> implementation of this method does
- * nothing. Subclasses may reimplement. This generally entails disconnecting
- * from the old editor, connecting to the new editor, and updating the actions
- * to reflect the new editor.
- * </p>
- *
- * @param targetEditor the new target editor
- */
- public void setActiveEditor(IEditorPart targetEditor) {
- super.setActiveEditor(targetEditor);
-
- if (targetEditor != null && targetEditor.equals(editor))
- return;
-
- IActionBars actionBars = getActionBars();
- boolean actionBarsUpdated = false;
-
- if (editor != null) {
- editor.setStatus(null, null);
-
- IStatusLineManager status = actionBars.getStatusLineManager();
- status.removeAll();
-
- IToolBarManager tbm = actionBars.getToolBarManager();
- tbm.removeAll();
-
- actionBarsUpdated = true;
- }
-
- if (targetEditor instanceof ServerEditor) {
- editor = (ServerEditor) targetEditor;
- Trace.trace(Trace.FINEST, "Editor action bar contributor for: " + editor);
- editor.updateUndoAction();
- editor.updateRedoAction();
-
- actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), editor.getUndoAction());
- actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), editor.getRedoAction());
-
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), editor.getCopyAction());
- actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), editor.getCutAction());
- actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), editor.getPasteAction());
-
- IStatusLineManager status = actionBars.getStatusLineManager();
- StatusLineContributionItem item = new StatusLineContributionItem("id");
- status.add(item);
-
- editor.setStatus(status, item);
- editor.updateStatusLine();
-
- IAction[] actions = editor.getEditorActions();
- IToolBarManager tbm = actionBars.getToolBarManager();
- tbm.add(new Separator(SERVER_EDITOR_SEPARATOR));
- boolean modified = false;
- if (actions != null) {
- int size = actions.length;
- Trace.trace(Trace.FINEST, "Attempting to add editor actions: " + size);
- for (int i = 0; i < size; i++) {
- Trace.trace(Trace.FINEST, "action: " + actions[i]);
- tbm.appendToGroup(SERVER_EDITOR_SEPARATOR, actions[i]);
- modified = true;
- }
- }
-
- if (modified)
- tbm.update(false);
- actionBarsUpdated = true;
- } else
- editor = null;
-
- if (actionBarsUpdated)
- actionBars.updateActionBars();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionFactory.java
deleted file mode 100644
index 1b178963b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionFactory.java
+++ /dev/null
@@ -1,164 +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.wst.server.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.internal.provisional.ServerEditorActionFactoryDelegate;
-import org.eclipse.ui.IEditorSite;
-/**
- * A default server that can be created for a set of given
- * natures.
- */
-public class ServerEditorActionFactory implements IServerEditorActionFactory {
- private IConfigurationElement element;
- private ServerEditorActionFactoryDelegate delegate;
-
- /**
- * ServerEditorActionFactory constructor.
- *
- * @param element a configuration element
- */
- public ServerEditorActionFactory(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- *
- */
- protected IConfigurationElement getConfigurationElement() {
- return element;
- }
-
- /**
- * Returns the id of this default server.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the id of this default server.
- *
- * @return java.lang.String
- */
- public String getName() {
- return element.getAttribute("name");
- }
-
- /**
- * Returns the order.
- *
- * @return int
- */
- public int getOrder() {
- try {
- String o = element.getAttribute("order");
- return Integer.parseInt(o);
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- /**
- * Return the ids of the server resource factories (specified
- * using Java-import style) that this page may support.
- *
- * @return java.lang.String[]
- */
- public String[] getTypeIds() {
- try {
- List<String> list = new ArrayList<String>();
- StringTokenizer st = new StringTokenizer(element.getAttribute("typeIds"), ",");
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str);
- }
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- } catch (Exception e) {
- //Trace.trace("Could not get server resource from: " + element.getAttribute("serverResources"));
- return null;
- }
- }
-
- /**
- * @see IServerEditorActionFactory#supportsServerElementType(String)
- */
- public boolean supportsServerElementType(String id) {
- if (id == null || id.length() == 0)
- return false;
-
- String[] s = getTypeIds();
- if (s == null)
- return false;
-
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
- return true;
- } else if (id.equals(s[i]))
- return true;
- }
- return false;
- }
-
- /*
- *
- */
- public ServerEditorActionFactoryDelegate getDelegate() {
- if (delegate == null) {
- try {
- delegate = (ServerEditorActionFactoryDelegate) element.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create server action factory delegate", t);
- }
- }
- return delegate;
- }
-
- /**
- * @see IServerEditorActionFactory#shouldDisplay(IServerWorkingCopy)
- */
- public boolean shouldDisplay(IServerWorkingCopy server) {
- try {
- return getDelegate().shouldDisplay(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return false;
- }
- }
-
- /**
- * @see IServerEditorActionFactory#createAction(IEditorSite, IServerEditorPartInput)
- */
- public IAction createAction(IEditorSite site, IServerEditorPartInput input) {
- try {
- return getDelegate().createAction(site, input);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return null;
- }
- }
-}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorCore.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorCore.java
deleted file mode 100644
index 9cf30ce64..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorCore.java
+++ /dev/null
@@ -1,231 +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.wst.server.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionDelta;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- *
- */
-public class ServerEditorCore {
- // cached copy of all editor factories and actions
- private static List<ServerEditorPartFactory> editorPageFactories;
- private static List<ServerEditorPageSectionFactory> editorPageSectionFactories;
- private static List editorActionFactories;
-
- /**
- * Returns a List of all editor page factories
- *
- * @return java.util.List
- */
- public static List<ServerEditorPartFactory> getServerEditorPageFactories() {
- if (editorPageFactories == null)
- loadEditorPageFactories();
- return editorPageFactories;
- }
-
- /**
- * Returns a List of all editor page section factories
- *
- * @return java.util.List
- */
- public static List getServerEditorPageSectionFactories() {
- if (editorPageSectionFactories == null)
- loadEditorPageSectionFactories();
- return editorPageSectionFactories;
- }
-
- /**
- * Load the editor page factory extension point.
- */
- private static void loadEditorPageFactories() {
- Trace.trace(Trace.CONFIG, "->- Loading .editorPages extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, ServerUIPlugin.EXTENSION_EDITOR_PAGES);
- List<ServerEditorPartFactory> list = new ArrayList<ServerEditorPartFactory>(cf.length);
- loadEditorPageFactories(cf, list);
- editorPageFactories = list;
- ServerUIPlugin.addRegistryListener();
- Trace.trace(Trace.CONFIG, "-<- Done loading .editorPages extension point -<-");
- }
-
- /**
- * Load the editor page factory extension point.
- */
- private static void loadEditorPageFactories(IConfigurationElement[] cf, List<ServerEditorPartFactory> list) {
- int size = cf.length;
- for (int i = 0; i < size; i++) {
- try {
- list.add(new ServerEditorPartFactory(cf[i]));
- Trace.trace(Trace.CONFIG, " Loaded editorPage: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load editorPage: " + cf[i].getAttribute("id"), t);
- }
- }
-
- // sort pages
- sortOrderedList(list);
- }
-
- public static void handleEditorPageFactoriesDelta(IExtensionDelta delta) {
- if (editorPageFactories == null) // not loaded yet
- return;
-
- IConfigurationElement[] cf = delta.getExtension().getConfigurationElements();
-
- List<ServerEditorPartFactory> list = new ArrayList<ServerEditorPartFactory>(editorPageFactories);
- if (delta.getKind() == IExtensionDelta.ADDED)
- loadEditorPageFactories(cf, list);
- else {
- int size = list.size();
- ServerEditorPartFactory[] sepf = new ServerEditorPartFactory[size];
- list.toArray(sepf);
- int size2 = cf.length;
-
- for (int i = 0; i < size; i++) {
- for (int j = 0; j < size2; j++) {
- if (sepf[i].getId().equals(cf[j].getAttribute("id"))) {
- list.remove(sepf[i]);
- }
- }
- }
- }
- editorPageFactories = list;
- }
-
- /**
- * Load the editor page section factory extension point.
- */
- private static void loadEditorPageSectionFactories() {
- Trace.trace(Trace.CONFIG, "->- Loading .editorPageSections extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, ServerUIPlugin.EXTENSION_EDITOR_PAGE_SECTIONS);
- List<ServerEditorPageSectionFactory> list = new ArrayList<ServerEditorPageSectionFactory>(cf.length);
- loadEditorPageSectionFactories(cf, list);
- editorPageSectionFactories = list;
- ServerUIPlugin.addRegistryListener();
- Trace.trace(Trace.CONFIG, "-<- Done loading .editorPageSections extension point -<-");
- }
-
- /**
- * Load the editor page section factory extension point.
- */
- private static void loadEditorPageSectionFactories(IConfigurationElement[] cf, List<ServerEditorPageSectionFactory> list) {
- int size = cf.length;
- for (int i = 0; i < size; i++) {
- try {
- list.add(new ServerEditorPageSectionFactory(cf[i]));
- Trace.trace(Trace.CONFIG, " Loaded editorPageSection: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load editorPageSection: " + cf[i].getAttribute("id"), t);
- }
- }
-
- // sort sections
- sortOrderedList(list);
- }
-
- public static void handleEditorPageSectionFactoriesDelta(IExtensionDelta delta) {
- if (editorPageSectionFactories == null) // not loaded yet
- return;
-
- IConfigurationElement[] cf = delta.getExtension().getConfigurationElements();
-
- List<ServerEditorPageSectionFactory> list = new ArrayList<ServerEditorPageSectionFactory>(editorPageSectionFactories);
- if (delta.getKind() == IExtensionDelta.ADDED)
- loadEditorPageSectionFactories(cf, list);
- else {
- int size = list.size();
- ServerEditorPageSectionFactory[] seps = new ServerEditorPageSectionFactory[size];
- list.toArray(seps);
- int size2 = cf.length;
-
- for (int i = 0; i < size; i++) {
- for (int j = 0; j < size2; j++) {
- if (seps[i].getId().equals(cf[j].getAttribute("id"))) {
- list.remove(seps[i]);
- }
- }
- }
- }
- editorPageSectionFactories = list;
- }
-
- /**
- * Returns a List of all editor action factories.
- *
- * @return java.util.List
- */
- public static List getServerEditorActionFactories() {
- if (editorActionFactories == null)
- loadEditorActionFactories();
- return editorActionFactories;
- }
-
- /**
- * Load the editor action factories extension point.
- */
- private static void loadEditorActionFactories() {
- Trace.trace(Trace.CONFIG, "->- Loading .editorActions extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, "editorActions");
-
- int size = cf.length;
- List<ServerEditorActionFactory> list = new ArrayList<ServerEditorActionFactory>(size);
- for (int i = 0; i < size; i++) {
- try {
- list.add(new ServerEditorActionFactory(cf[i]));
- Trace.trace(Trace.CONFIG, " Loaded editorAction: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load editorAction: " + cf[i].getAttribute("id"), t);
- }
- }
-
- // sort pages
- sortOrderedList(list);
- editorActionFactories = list;
-
- Trace.trace(Trace.CONFIG, "-<- Done loading .editorActions extension point -<-");
- }
-
- /**
- * Sort the given list of IOrdered items into indexed order. This method
- * modifies the original list, but returns the value for convenience.
- *
- * @param list java.util.List
- * @return java.util.List
- */
- public static List sortOrderedList(List list) {
- if (list == null)
- return null;
-
- int size = list.size();
- for (int i = 0; i < size - 1; i++) {
- for (int j = i + 1; j < size; j++) {
- IOrdered a = (IOrdered) list.get(i);
- IOrdered b = (IOrdered) list.get(j);
- if (a.getOrder() > b.getOrder()) {
- IOrdered temp = a;
- list.set(i, b);
- list.set(j, temp);
- }
- }
- }
- return list;
- }
-}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInput.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInput.java
deleted file mode 100644
index 31861ac4c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInput.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPersistableElement;
-/**
- * The editor input for server configurations and instances. The
- * input points to a resource that is either an instance or
- * configuration.
- *
- * <p>Editors supporting this editor input should use the ResourceManager
- * to load their own copy of the resource. Each editor is responsible
- * for managing this resource and making sure that only one copy is
- * loaded from disk when multiple editors are opened on the same
- * resource.</p>
- *
- * <p>When the editor saves back to the resource, the server tooling
- * will notice the change and reload the new configuration.</p>
- *
- * <p>Editors should call setEditing(resource, true) when the first
- * editor opens on a particular resource, and setEditing(resource,
- * false) when the last editor on a resource closes. This will
- * ensure that the server tooling does not try to edit the resource
- * and cause conflicting changes while an editor is open.</p>
- */
-public class ServerEditorInput implements IServerEditorInput, IPersistableElement {
- private String serverId;
-
- /**
- * ServerEditorInput constructor comment.
- *
- * @param serverId a server id
- */
- public ServerEditorInput(String serverId) {
- super();
- this.serverId = serverId;
- }
-
- /**
- * Returns the server id.
- * @return org.eclipse.core.resources.IResource
- */
- public String getServerId() {
- return serverId;
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof ServerEditorInput))
- return false;
- ServerEditorInput other = (ServerEditorInput) obj;
- if (serverId == null) {
- if (other.serverId != null)
- return false;
- } else if (!serverId.equals(other.serverId))
- return false;
- return true;
- }
-
- /**
- * Returns whether the editor input exists.
- * <p>
- * This method is primarily used to determine if an editor input should
- * appear in the "File Most Recently Used" menu. An editor input will appear
- * in the list until the return value of <code>exists</code> becomes
- * <code>false</code> or it drops off the bottom of the list.
- *
- * @return <code>true</code> if the editor input exists; <code>false</code>
- * otherwise
- */
- public boolean exists() {
- if (serverId != null && ServerCore.findServer(serverId) == null)
- return false;
-
- return true;
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- *
- * @param adapter the adapter class to look up
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- */
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * Returns the ID of an element factory which can be used to recreate
- * this object. An element factory extension with this ID must exist
- * within the workbench registry.
- *
- * @return the element factory ID
- */
- public String getFactoryId() {
- return ServerEditorInputFactory.FACTORY_ID;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return ImageResource.getImageDescriptor(ImageResource.IMG_SERVER);
- }
-
- /**
- * Returns the name of this editor input for display purposes.
- * <p>
- * For instance, if the fully qualified input name is
- * <code>"a\b\MyFile.gif"</code>, the return value would be just
- * <code>"MyFile.gif"</code>.
- *
- * @return the file name string
- */
- public String getName() {
- if (serverId != null) {
- IServer server = ServerCore.findServer(serverId);
- if (server != null)
- return server.getName();
- return serverId;
- }
- return "";
- }
-
- /*
- * Returns an object that can be used to save the state of this editor input.
- *
- * @return the persistable element, or <code>null</code> if this editor input
- * cannot be persisted
- */
- public IPersistableElement getPersistable() {
- return this;
- }
-
- public String getToolTipText() {
- String s = null;
- if (serverId != null) {
- IServer server = ServerCore.findServer(serverId);
- if (server != null) {
- Server server2 = (Server) server;
- if (server2.getFile() != null) {
- s = server2.getFile().getFullPath().makeRelative().toString();
- if (s.startsWith("/"))
- s = s.substring(1);
- } else
- s = server.getName();
- }
- }
- if (s == null)
- s = "";
- return s;
- }
-
- /**
- * Saves the state of an element within a memento.
- *
- * @param memento the storage area for element state
- */
- public void saveState(IMemento memento) {
- ServerEditorInputFactory.saveState(memento, this);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInputFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInputFactory.java
deleted file mode 100644
index 83e062c7f..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInputFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-/**
- * This factory is used in the persistence of ServerResourceEditorInput
- * instances. This allows the user to close the workbench with an
- * open editor and reopen to the same editor.
- */
-public class ServerEditorInputFactory implements IElementFactory {
- protected final static String FACTORY_ID = "org.eclipse.wst.server.ui.editor.input.factory";
- protected final static String SERVER_ID = "server-id";
-
- /**
- * ServerEditorInputFactory constructor comment.
- */
- public ServerEditorInputFactory() {
- // do nothing
- }
-
- /*
- * Creates editor input based on the state in the memento.
- */
- public IAdaptable createElement(IMemento memento) {
- // get the resource names
- String serverId = memento.getString(SERVER_ID);
-
- return new ServerEditorInput(serverId);
- }
-
- /**
- * Saves the state of an element within a memento.
- *
- * @param memento the storage area for element state
- * @param input server editor input
- */
- public static void saveState(IMemento memento, ServerEditorInput input) {
- if (input == null)
- return;
-
- if (input.getServerId() != null)
- memento.putString(SERVER_ID, input.getServerId());
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPageSectionFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPageSectionFactory.java
deleted file mode 100644
index b5cc2f4d2..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPageSectionFactory.java
+++ /dev/null
@@ -1,205 +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.wst.server.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.expressions.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.*;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- *
- */
-public class ServerEditorPageSectionFactory implements IServerEditorPageSectionFactory {
- private IConfigurationElement element;
- private Expression fContextualLaunchExpr = null;
-
- /**
- * ServerEditorPageSectionFactory constructor.
- *
- * @param element a configuration element
- */
- public ServerEditorPageSectionFactory(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- *
- */
- protected IConfigurationElement getConfigurationElement() {
- return element;
- }
-
- /**
- * Returns the id of this factory.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the order.
- *
- * @return int
- */
- public int getOrder() {
- try {
- String o = element.getAttribute("order");
- return Integer.parseInt(o);
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- /**
- * Returns the insertion id of this factory.
- *
- * @return the insertion id
- */
- public String getInsertionId() {
- return element.getAttribute("insertionId");
- }
-
- /**
- * Return the ids of the server resource factories (specified
- * using Java-import style) that this page may support.
- *
- * @return an array of type ids
- */
- protected String[] getTypeIds() {
- try {
- List<String> list = new ArrayList<String>();
- StringTokenizer st = new StringTokenizer(element.getAttribute("typeIds"), ",");
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str.trim());
- }
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- } catch (Exception e) {
- //Trace.trace("Could not get server resource from: " + element.getAttribute("serverResources"));
- return null;
- }
- }
-
- /**
- * @see IServerEditorPageSectionFactory#supportsType(String)
- */
- public boolean supportsType(String id) {
- if (id == null || id.length() == 0)
- return false;
-
- String[] s = getTypeIds();
- if (s == null)
- return false;
-
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
- return true;
- } else if (id.equals(s[i]))
- return true;
- }
- return false;
- }
-
- /**
- * @see IServerEditorPageSectionFactory#shouldCreateSection(IServerWorkingCopy)
- */
- public boolean shouldCreateSection(IServerWorkingCopy server) {
- try {
- return isEnabled(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return false;
- }
- }
-
- /**
- * @see IServerEditorPageSectionFactory#createSection()
- */
- public ServerEditorSection createSection() {
- try {
- return (ServerEditorSection) element.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create server editor section", t);
- return null;
- }
- }
-
- /**
- * Returns an expression that represents the enablement logic for the
- * contextual launch element of this launch shortcut description or
- * <code>null</code> if none.
- * @return an evaluatable expression or <code>null</code>
- * @throws CoreException if the configuration element can't be
- * converted. Reasons include: (a) no handler is available to
- * cope with a certain configuration element or (b) the XML
- * expression tree is malformed.
- */
- public Expression getContextualLaunchEnablementExpression() throws CoreException {
- if (fContextualLaunchExpr == null) {
- IConfigurationElement[] elements = element.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null)
- fContextualLaunchExpr = ExpressionConverter.getDefault().perform(enablement);
- }
- return fContextualLaunchExpr;
- }
-
- /**
- * Evaluate the given expression within the given context and return
- * the result. Returns <code>true</code> iff result is either TRUE or NOT_LOADED.
- * This allows optimistic inclusion of shortcuts before plugins are loaded.
- * Returns <code>false</code> if exp is <code>null</code>.
- *
- * @param exp the enablement expression to evaluate or <code>null</code>
- * @param context the context of the evaluation. Usually, the
- * user's selection.
- * @return the result of evaluating the expression
- * @throws CoreException
- */
- protected boolean evalEnablementExpression(IEvaluationContext context, Expression exp) throws CoreException {
- return (exp != null) ? ((exp.evaluate(context)) != EvaluationResult.FALSE) : false;
- }
-
- /**
- * Returns true if enabled for the given object.
- *
- * @param obj an object
- * @return <code>true</code> if enabled
- * @throws CoreException if anything goes wrong
- */
- public boolean isEnabled(Object obj) throws CoreException {
- if (getContextualLaunchEnablementExpression() == null)
- return true;
- IEvaluationContext context = new EvaluationContext(null, obj);
- context.addVariable("server", obj);
- return evalEnablementExpression(context, getContextualLaunchEnablementExpression());
- }
-
- public String toString() {
- return "ServerEditorSection [" + getId() + ", " + getInsertionId() + ", " + getOrder() + "]";
- }
-}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartFactory.java
deleted file mode 100644
index 680cc2245..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartFactory.java
+++ /dev/null
@@ -1,243 +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.wst.server.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.expressions.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.ui.IEditorPart;
-/**
- *
- */
-public class ServerEditorPartFactory implements IServerEditorPartFactory {
- private IConfigurationElement element;
- private Expression fContextualLaunchExpr = null;
-
- /**
- * ServerEditorPartFactory constructor.
- *
- * @param element a configuration element
- */
- public ServerEditorPartFactory(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- *
- */
- protected IConfigurationElement getConfigurationElement() {
- return element;
- }
-
- /**
- * Returns the id of this part factory.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the name of this part factory.
- *
- * @return java.lang.String
- */
- public String getName() {
- return element.getAttribute("name");
- }
-
- protected String[] getInsertionIds() {
- try {
- String insertionIds = element.getAttribute("insertionIds");
- List<String> list = new ArrayList<String>();
- if (insertionIds != null && insertionIds.length() > 0) {
- StringTokenizer st = new StringTokenizer(insertionIds, ",");
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str.trim());
- }
- }
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- } catch (Exception e) {
- //Trace.trace("Could not get server resource from: " + element.getAttribute("serverResources"));
- return null;
- }
- }
-
- /**
- * @see IServerEditorPartFactory#supportsInsertionId(String)
- */
- public boolean supportsInsertionId(String id) {
- if (id == null || id.length() == 0)
- return false;
-
- String[] s = getInsertionIds();
- if (s == null)
- return false;
-
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
- return true;
- } else if (id.equals(s[i]))
- return true;
- }
- return false;
- }
-
- /**
- * Returns the order.
- *
- * @return int
- */
- public int getOrder() {
- try {
- String o = element.getAttribute("order");
- return Integer.parseInt(o);
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- /**
- * Return the ids of the server and server configuration type ids (specified
- * using Java-import style) that this page may support.
- *
- * @return an array of type ids
- */
- protected String[] getTypeIds() {
- try {
- List<String> list = new ArrayList<String>();
- StringTokenizer st = new StringTokenizer(element.getAttribute("typeIds"), ",");
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str.trim());
- }
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- } catch (Exception e) {
- //Trace.trace("Could not get server resource from: " + element.getAttribute("serverResources"));
- return null;
- }
- }
-
- /**
- * @see IServerEditorPartFactory#supportsType(String)
- */
- public boolean supportsType(String id) {
- String[] s = getTypeIds();
- if (s == null || s.length == 0 || "*".equals(s[0]))
- return true;
-
- if (id == null || id.length() == 0)
- return false;
-
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
- return true;
- } else if (id.equals(s[i]))
- return true;
- }
- return false;
- }
-
- /**
- * @see IServerEditorPartFactory#shouldCreatePage(IServerWorkingCopy)
- */
- public boolean shouldCreatePage(IServerWorkingCopy server) {
- try {
- return isEnabled(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return false;
- }
- }
-
- /**
- * @see IServerEditorPartFactory#createPage()
- */
- public IEditorPart createPage() {
- try {
- return (IEditorPart) element.createExecutableExtension("class");
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return null;
- }
- }
-
- /**
- * Returns an expression that represents the enablement logic for the
- * contextual launch element of this launch shortcut description or
- * <code>null</code> if none.
- * @return an evaluatable expression or <code>null</code>
- * @throws CoreException if the configuration element can't be
- * converted. Reasons include: (a) no handler is available to
- * cope with a certain configuration element or (b) the XML
- * expression tree is malformed.
- */
- public Expression getContextualLaunchEnablementExpression() throws CoreException {
- if (fContextualLaunchExpr == null) {
- IConfigurationElement[] elements = element.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null)
- fContextualLaunchExpr = ExpressionConverter.getDefault().perform(enablement);
- }
- return fContextualLaunchExpr;
- }
-
- /**
- * Evaluate the given expression within the given context and return
- * the result. Returns <code>true</code> iff result is either TRUE or NOT_LOADED.
- * This allows optimistic inclusion of shortcuts before plugins are loaded.
- * Returns <code>false</code> if exp is <code>null</code>.
- *
- * @param exp the enablement expression to evaluate or <code>null</code>
- * @param context the context of the evaluation. Usually, the
- * user's selection.
- * @return the result of evaluating the expression
- * @throws CoreException
- */
- protected boolean evalEnablementExpression(IEvaluationContext context, Expression exp) throws CoreException {
- return (exp != null) ? ((exp.evaluate(context)) != EvaluationResult.FALSE) : false;
- }
-
- /**
- * Returns true if enabled for the given object.
- *
- * @param obj an object
- * @return <code>true</code> if enabled
- * @throws CoreException if anything goes wrong
- */
- public boolean isEnabled(Object obj) throws CoreException {
- if (getContextualLaunchEnablementExpression() == null)
- return true;
- IEvaluationContext context = new EvaluationContext(null, obj);
- context.addVariable("server", obj);
- return evalEnablementExpression(context, getContextualLaunchEnablementExpression());
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartInput.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartInput.java
deleted file mode 100644
index 79045b29c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartInput.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IPersistableElement;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
-/**
- *
- */
-public class ServerEditorPartInput implements IServerEditorPartInput {
- protected IServerWorkingCopy server;
- protected boolean serverReadOnly;
- protected ServerResourceCommandManager serverCommandManager;
-
- public ServerEditorPartInput(ServerResourceCommandManager serverCommandManager,
- IServerWorkingCopy server, boolean serverReadOnly) {
-
- this.server = server;
- this.serverReadOnly = serverReadOnly;
- this.serverCommandManager = serverCommandManager;
- }
-
- public String getName() {
- return "-";
- }
-
- public String getToolTipText() {
- return "-";
- }
-
- public boolean exists() {
- return true;
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /**
- * Returns the server to be edited.
- *
- * @return IServerResource
- */
- public IServerWorkingCopy getServer() {
- return server;
- }
-
- /**
- * Returns true if the server is read-only.
- *
- * @return boolean
- */
- public boolean isServerReadOnly() {
- return serverReadOnly;
- }
-
- public ServerResourceCommandManager getServerCommandManager() {
- return serverCommandManager;
- }
-
- public String toString() {
- return "ServerEditorPartInput [" + server + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java
deleted file mode 100644
index 662fffcc2..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java
+++ /dev/null
@@ -1,102 +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.wst.server.ui.internal.editor;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * A command manager for a single server resource.
- */
-public class ServerResourceCommandManager {
- protected ServerEditor editor;
- protected GlobalCommandManager commandManager;
- protected String id;
-
- public ServerResourceCommandManager(ServerEditor editor, String id, GlobalCommandManager commandManager) {
- this.editor = editor;
- this.commandManager = commandManager;
- this.id = id;
- }
-
- public boolean isReadOnly() {
- return commandManager.isReadOnly(id);
- }
-
- /**
- * Execute the given command and place it in the undo stack.
- * If the command cannot be undone, the user will be notifed
- * before it is executed.
- *
- * @param operation an undoable operation
- */
- public void execute(IUndoableOperation operation) {
- if (!validateEdit())
- return;
-
- if (commandManager.isReadOnly(id)) {
- warnReadOnly();
- return;
- }
- commandManager.executeCommand(id, operation);
- }
-
- protected void warnReadOnly() {
- String title = Messages.editorResourceWarnTitle;
- String message = Messages.editorResourceWarnMessage;
-
- MessageDialog.openWarning(editor.getEditorSite().getShell(), title, message);
- }
-
- /**
- *
- */
- protected boolean validateEdit() {
- if (commandManager.isDirty(id))
- return true;
-
- IFile[] files = commandManager.getReadOnlyFiles(id);
- if (files.length == 0)
- return true;
-
- IStatus status = ResourcesPlugin.getWorkspace().validateEdit(files, editor.getEditorSite().getShell());
-
- if (status.getSeverity() == IStatus.ERROR) {
- // inform user
- String message = Messages.editorValidateEditFailureMessage;
- ErrorDialog.openError(editor.getEditorSite().getShell(), Messages.errorDialogTitle, message, status);
-
- // change to read-only
- commandManager.setReadOnly(id, true);
-
- // do not execute command
- return false;
- }
- // check file timestamp
- IServerAttributes serverfile = commandManager.getServerResource(id);
- if (commandManager.hasChanged(id)) {
- if (serverfile instanceof IServer)
- editor.promptReloadServerFile(id);
- }
-
- // allow edit
- return true;
- }
-
- public ServerEditor getServerEditor() {
- return editor;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/StatusLineContributionItem.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/StatusLineContributionItem.java
deleted file mode 100644
index d4a68e56e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/StatusLineContributionItem.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.texteditor.IStatusField;
-/**
- * Contribution item for the status line.
- */
-public class StatusLineContributionItem extends ContributionItem implements IStatusField {
-
- static class StatusLineLabel extends CLabel {
-
- private static int INDENT= 3; // left and right margin used in CLabel
-
- private Point fFixedSize;
-
- public StatusLineLabel(Composite parent, int style) {
- super(parent, style);
-
- GC gc= new GC(parent);
- gc.setFont(parent.getFont());
- Point extent= gc.textExtent("MMMMMMMMM"); //$NON-NLS-1$
- gc.dispose();
-
- fFixedSize= new Point(extent.x + INDENT * 2, 10);
- }
-
- public Point computeSize(int wHint, int hHint, boolean changed) {
- return fFixedSize;
- }
- }
-
- private String fText;
- private Image fImage;
- private StatusLineLabel fLabel;
-
- /**
- * Creates a new item with the given id.
- *
- * @param id the item's id
- */
- StatusLineContributionItem(String id) {
- super(id);
- }
-
- /*
- * @see IStatusField#setText
- */
- public void setText(String text) {
- fText= text;
- if (fLabel != null && !fLabel.isDisposed()) {
- fLabel.setText(fText);
- }
- }
-
- /*
- * @see IStatusField#setImage(Image)
- */
- public void setImage(Image image) {
- fImage= image;
- if (fLabel != null && !fLabel.isDisposed()) {
- fLabel.setImage(fImage);
- }
- }
-
- /*
- * @see IContributionItem#fill(Composite)
- */
- public void fill(Composite parent) {
- fLabel= new StatusLineLabel(parent, SWT.SHADOW_IN);
- fLabel.setData(this);
-
- if (fText != null)
- fLabel.setText(fText);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/TextAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/TextAction.java
deleted file mode 100644
index 458b5bf04..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/TextAction.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.editor;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Text;
-/**
- * Text actions (cut, copy, paste) for the Web browser.
- */
-public class TextAction extends Action {
- protected Display display;
- protected Clipboard clipboard;
- protected byte type;
-
- public static final byte CUT_ACTION = 0;
- public static final byte COPY_ACTION = 1;
- public static final byte PASTE_ACTION = 2;
-
- /**
- * TextAction constructor comment.
- */
- protected TextAction(Display display, byte type) {
- super("Text action: " + type);
- this.display = display;
- clipboard = new Clipboard(display);
- this.type = type;
- }
-
- protected Control getControl() {
- Control control = display.getFocusControl();
- return control;
- }
-
- protected Point getControlSelection() {
- Control control = getControl();
- if (control == null)
- return null;
-
- if (control instanceof Text) {
- Text text = (Text) control;
- return text.getSelection();
- } else if (control instanceof Combo) {
- Combo combo = (Combo) control;
- return combo.getSelection();
- } else
- return null;
- }
-
- protected void setControlSelection(Point sel) {
- Control control = getControl();
- if (control == null)
- return;
-
- if (control instanceof Text) {
- Text text = (Text) control;
- text.setSelection(sel);
- } else if (control instanceof Combo) {
- Combo combo = (Combo) control;
- combo.setSelection(sel);
- }
- }
-
- protected String getControlText() {
- Control control = getControl();
- if (control == null)
- return null;
-
- if (control instanceof Text) {
- Text text = (Text) control;
- return text.getText();
- } else if (control instanceof Combo) {
- Combo combo = (Combo) control;
- return combo.getText();
- } else
- return null;
- }
-
- protected void setControlText(String text) {
- Control control = getControl();
- if (control == null)
- return;
-
- if (control instanceof Text) {
- Text text2 = (Text) control;
- text2.setText(text);
- } else if (control instanceof Combo) {
- Combo combo = (Combo) control;
- combo.setText(text);
- }
- }
-
- /**
- * Copies the selected text to the clipboard. The text will be put in the
- * clipboard in plain text format.
- */
- public void copy() {
- Point selection = getControlSelection();
- String text = getControlText();
- if (selection == null || text == null)
- return;
-
- int length = selection.y - selection.x;
- if (length > 0) {
- TextTransfer plainTextTransfer = TextTransfer.getInstance();
- try {
- clipboard.setContents(
- new String[] { text.substring(selection.x, selection.y) },
- new Transfer[] { plainTextTransfer });
- } catch (SWTError error) {
- // Copy to clipboard failed. This happens when another application
- // is accessing the clipboard while we copy. Ignore the error.
- }
- }
- }
-
- /**
- * Moves the selected text to the clipboard. The text will be put in the
- * clipboard in plain text format and RTF format.
- */
- public void cut(){
- Point selection = getControlSelection();
- if (selection == null)
- return;
-
- if (selection.y > selection.x) {
- copy();
- delete();
- }
- }
-
- /**
- * Deletes the character to the right of the caret. Delete the selected text if any.
- */
- public void delete() {
- Point selection = getControlSelection();
- String text = getControlText();
- if (selection == null || text == null)
- return;
-
- if (selection.x != selection.y) {
- text = text.substring(0, selection.x) + text.substring(selection.y);
- setControlText(text);
- setControlSelection(new Point(selection.x, selection.x));
- }
- }
-
- /**
- * Replaces the selection with the clipboard text or insert the text at
- * the current caret offset if there is no selection.
- * If the widget has the SWT.SINGLE style and the clipboard text contains
- * more than one line, only the first line without line delimiters is
- * inserted in the widget.
- */
- public void paste() {
- TextTransfer transfer = TextTransfer.getInstance();
- Point selection = getControlSelection();
- String text = getControlText();
- if (selection == null)
- return;
-
- String newText = (String) clipboard.getContents(transfer);
- if (newText != null && newText.length() > 0) {
- if (text == null)
- text = newText;
- else
- text = text.substring(0, selection.x) + newText + text.substring(selection.y);
- setControlText(text);
-
- // set the selection to the end of the paste
- int x = selection.x + newText.length();
- setControlSelection(new Point(x, x));
- }
- }
-
- /**
- * Execute the action.
- */
- public void run() {
- if (display == null)
- return;
- if (type == CUT_ACTION)
- cut();
- else if (type == COPY_ACTION)
- copy();
- else if (type == PASTE_ACTION)
- paste();
- }
-
- /**
- * Update the actions enabled/disabled state.
- */
- protected void update() {
- if (getControl() == null) {
- setEnabled(false);
- return;
- }
- Point selection = getControlSelection();
- String text = getControlText();
-
- try {
- if (type == CUT_ACTION)
- setEnabled(text != null && text.length() > 0 && selection != null && selection.x < selection.y);
- else if (type == COPY_ACTION)
- setEnabled(text != null && text.length() > 0 && selection != null && selection.x < selection.y);
- else if (type == PASTE_ACTION) {
- Control control = getControl();
- if (!control.isEnabled()) {
- setEnabled(false);
- return;
- }
- if (!(control instanceof Text)) {
- setEnabled(false);
- return;
- }
-
- Text text2 = (Text) control;
- if (!text2.getEditable()) {
- setEnabled(false);
- return;
- }
- TextTransfer transfer = TextTransfer.getInstance();
- String newText = (String) clipboard.getContents(transfer);
- setEnabled(newText != null && newText.length() > 0);
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error updating text action", e);
- }
- }
-} \ No newline at end of file

Back to the top