diff options
| author | kgilmer | 2006-04-25 03:11:57 +0000 |
|---|---|---|
| committer | kgilmer | 2006-04-25 03:11:57 +0000 |
| commit | e608fa968b034fd422f525d4fb9a1ef3e76920f0 (patch) | |
| tree | 7b99eaa1e424a70bf38fe0ae37e53c322f663f81 | |
| parent | fa6402876d07313ad595e54bf4b62d867fc43ab5 (diff) | |
| download | org.eclipse.ecf-e608fa968b034fd422f525d4fb9a1ef3e76920f0.tar.gz org.eclipse.ecf-e608fa968b034fd422f525d4fb9a1ef3e76920f0.tar.xz org.eclipse.ecf-e608fa968b034fd422f525d4fb9a1ef3e76920f0.zip | |
Code cleanup.
12 files changed, 120 insertions, 145 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/plugin.xml b/examples/bundles/org.eclipse.ecf.example.collab.editor/plugin.xml index 4c3d08131..a382464f9 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/plugin.xml +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/plugin.xml @@ -3,30 +3,6 @@ <plugin> <extension - point="org.eclipse.ui.actionSets"> - <actionSet - label="Sample Action Set" - visible="true" - id="org.eclipse.ecf.example.collab.editor.actionSet"> - <menu - label="Sample &Menu" - id="sampleMenu"> - <separator - name="sampleGroup"> - </separator> - </menu> - <action - label="&Sample Action" - icon="icons/sample.gif" - class="org.eclipse.ecf.example.collab.editor.ShareEditorAction" - tooltip="Hello, Eclipse world" - menubarPath="sampleMenu/sampleGroup" - toolbarPath="sampleGroup" - id="org.eclipse.ecf.example.collab.editor.ShareEditorAction"> - </action> - </actionSet> - </extension> - <extension point="org.eclipse.ui.popupMenus"> <objectContribution adaptable="false" diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/Activator.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/Activator.java index e5c9c009d..d2d68a0d0 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/Activator.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/Activator.java @@ -1,3 +1,12 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer. 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ + package org.eclipse.ecf.example.collab.editor; import java.io.IOException; diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditChannelListener.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditChannelListener.java index a1ec24efd..e0049250c 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditChannelListener.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditChannelListener.java @@ -1,3 +1,11 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ package org.eclipse.ecf.example.collab.editor; import java.io.ByteArrayInputStream; @@ -37,7 +45,7 @@ public class EditChannelListener implements IChannelListener { if (event instanceof IChannelMessageEvent) { setEditorEditable(false); Activator.getDefault().setListenerActive(false); - System.out.println("Setting events off"); + IChannelMessageEvent msg = (IChannelMessageEvent) event; ByteArrayInputStream bins = new ByteArrayInputStream(msg.getData()); @@ -57,7 +65,6 @@ public class EditChannelListener implements IChannelListener { } finally { setEditorEditable(true); Activator.getDefault().setListenerActive(true); - System.out.println("Setting events on"); } } } diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditorListener.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditorListener.java index a4423003e..409f97280 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditorListener.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditorListener.java @@ -1,3 +1,11 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ package org.eclipse.ecf.example.collab.editor; import java.io.ByteArrayOutputStream; diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/PresenceChannelListener.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/PresenceChannelListener.java index 85ac7e471..e5d828349 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/PresenceChannelListener.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/PresenceChannelListener.java @@ -1,3 +1,11 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ package org.eclipse.ecf.example.collab.editor; import java.io.ByteArrayInputStream; diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/ShareEditorAction.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/ShareEditorAction.java deleted file mode 100644 index 5463e0ed8..000000000 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/ShareEditorAction.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.eclipse.ecf.example.collab.editor; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.texteditor.AbstractTextEditor; -import org.eclipse.ui.texteditor.DocumentProviderRegistry; -import org.eclipse.ui.texteditor.IDocumentProvider; - -public class ShareEditorAction implements IWorkbenchWindowActionDelegate { - - public ShareEditorAction() { - } - - public void run(IAction action) { - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - - IEditorPart editorPart = page.getActiveEditor(); - - if (editorPart instanceof AbstractTextEditor) { - IDocumentProvider dp = DocumentProviderRegistry.getDefault() - .getDocumentProvider(editorPart.getEditorInput()); - AbstractTextEditor textEditor = (AbstractTextEditor) editorPart; - - IDocument document = dp.getDocument(editorPart.getEditorInput()); - - if (document != null) { - EditorListener listener = new EditorListener(document, textEditor); - document.addDocumentListener(listener); - } - } - } - - public void selectionChanged(IAction action, ISelection selection) { - } - - public void dispose() { - } - - public void init(IWorkbenchWindow window) { - } -}
\ No newline at end of file diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/actions/InitiateSharedSessionAction.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/actions/InitiateSharedSessionAction.java index 745caa1e2..13bd28010 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/actions/InitiateSharedSessionAction.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/actions/InitiateSharedSessionAction.java @@ -1,3 +1,11 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer. 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ package org.eclipse.ecf.example.collab.editor.actions; import org.eclipse.core.resources.IFile; @@ -22,6 +30,12 @@ import org.eclipse.ui.texteditor.AbstractTextEditor; import org.eclipse.ui.texteditor.DocumentProviderRegistry; import org.eclipse.ui.texteditor.IDocumentProvider; +/** + * This action is used to initiate a shared session. + * + * @author kgilmer + * + */ public class InitiateSharedSessionAction extends Action implements IObjectActionDelegate, IViewActionDelegate { private IFile file; @@ -48,7 +62,7 @@ public class InitiateSharedSessionAction extends Action implements IObjectAction //Open the default editor for the selected file. IEditorPart editorPart = page.openEditor(new FileEditorInput(file), editorDescriptor.getId()); - //Create ECF infrastructre and begin sharing. + //Create ECF container and begin sharing. if (editorPart instanceof AbstractTextEditor) { IDocumentProvider dp = DocumentProviderRegistry.getDefault().getDocumentProvider(editorPart.getEditorInput()); AbstractTextEditor textEditor = (AbstractTextEditor) editorPart; @@ -79,7 +93,6 @@ public class InitiateSharedSessionAction extends Action implements IObjectAction } public void init(IViewPart view) { - System.out.println("init: " + view.getTitle()); } } diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/EditorChangeMessage.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/EditorChangeMessage.java index b788d9ace..1546853b1 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/EditorChangeMessage.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/EditorChangeMessage.java @@ -1,7 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ + package org.eclipse.ecf.example.collab.editor.message; import java.io.Serializable; +/** + * This message is passed when a document is changed. Currently the ENTIRE document + * is passed upon each successive modification, from the modifiers to all other peers + * in the shared container. + * + * TODO: provide a more efficient way of passing IDocument model changes. + * + * @author kgilmer + * + */ public class EditorChangeMessage implements Serializable { private static final long serialVersionUID = -8142516068285829708L; private String document; diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionList.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionList.java index a9b88cd3f..6373d4f54 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionList.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionList.java @@ -1,8 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer. 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ + package org.eclipse.ecf.example.collab.editor.message; import java.io.Serializable; import java.util.List; +/** + * This message is passed as a response to a <code>SharedEditorSessionListRequest</code> message. + * The message is passed from peers that have open editor sessions to all others in the shared container. + * + * @author kgilmer + * + */ public class SharedEditorSessionList implements Serializable { private static final long serialVersionUID = 4337027955521207775L; private List sessionNames; diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionListRequest.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionListRequest.java index e0b41d786..2940fbc6c 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionListRequest.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionListRequest.java @@ -1,7 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer. 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ + package org.eclipse.ecf.example.collab.editor.message; import java.io.Serializable; +/** + * This message is passed when a peer wishes to "discover" all available + * shared editing sessions in it's shared container group (as defined by the + * ChannelID). An asynchronous <code>SharedEditorSessionList</code> message + * is expected in return. + * + * @author kgilmer + * + */ public class SharedEditorSessionListRequest implements Serializable { private static final long serialVersionUID = 2096909220585200273L; diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizard.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizard.java index 53a580158..9cccfa455 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizard.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizard.java @@ -1,3 +1,12 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer. 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ + package org.eclipse.ecf.example.collab.editor.wizards; import org.eclipse.jface.text.IDocument; @@ -23,41 +32,21 @@ import org.eclipse.ui.texteditor.AbstractTextEditor; import org.eclipse.ui.texteditor.DocumentProviderRegistry; import org.eclipse.ui.texteditor.IDocumentProvider; -/** - * This is a sample new wizard. Its role is to create a new file resource in the - * provided container. If the container resource (a folder or a project) is - * selected in the workspace when the wizard is opened, it will accept it as the - * target container. The wizard creates one file with the extension "mpe". If a - * sample multi-page editor (also available as a template) is registered for the - * same extension, it will be able to open it. - */ - public class NewSharedSessionWizard extends Wizard implements INewWizard { private NewSharedSessionWizardPage page; private ISelection selection; - /** - * Constructor for SampleNewWizard. - */ public NewSharedSessionWizard() { super(); setNeedsProgressMonitor(true); } - /** - * Adding the page to the wizard. - */ - public void addPages() { page = new NewSharedSessionWizardPage(selection); addPage(page); } - /** - * This method is called when 'Finish' button is pressed in the wizard. We - * will create an operation and run it using wizard as execution context. - */ public boolean performFinish() { final String containerName = page.getContainerName(); final String fileName = page.getFileName(); @@ -84,12 +73,6 @@ public class NewSharedSessionWizard extends Wizard implements INewWizard { return true; } - /** - * The worker method. It will find the container, create the file if missing - * or just replace its contents, and open the editor on the newly created - * file. - */ - private void doFinish(String containerName, String fileName, IProgressMonitor monitor) throws CoreException { // create a sample file monitor.beginTask("Creating " + fileName, 2); @@ -141,10 +124,6 @@ public class NewSharedSessionWizard extends Wizard implements INewWizard { monitor.worked(1); } - /** - * We will initialize file contents with a sample text. - */ - private InputStream openContentStream() { String contents = ""; return new ByteArrayInputStream(contents.getBytes()); @@ -154,13 +133,6 @@ public class NewSharedSessionWizard extends Wizard implements INewWizard { IStatus status = new Status(IStatus.ERROR, "org.eclipse.ecf.example.collab.editor", IStatus.OK, message, null); throw new CoreException(status); } - - /** - * We will accept the selection in the workbench to see if we can initialize - * from it. - * - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ public void init(IWorkbench workbench, IStructuredSelection selection) { this.selection = selection; } diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizardPage.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizardPage.java index 858ccf1f1..43ece668e 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizardPage.java +++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizardPage.java @@ -1,3 +1,12 @@ +/******************************************************************************* + * Copyright (c) 2006 Ken Gilmer. 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: Ken Gilmer - initial API and implementation + ******************************************************************************/ + package org.eclipse.ecf.example.collab.editor.wizards; import java.io.ByteArrayInputStream; @@ -50,12 +59,6 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.ContainerSelectionDialog; -/** - * The "New" wizard page allows setting the container for the new file as well - * as the file name. The page will only accept file name without the extension - * OR with the extension that matches the expected one (mpe). - */ - public class NewSharedSessionWizardPage extends WizardPage { private Text containerText; @@ -67,11 +70,6 @@ public class NewSharedSessionWizardPage extends WizardPage { private List sessions; - /** - * Constructor for SampleNewWizardPage. - * - * @param pageName - */ public NewSharedSessionWizardPage(ISelection selection) { super("wizardPage"); setTitle("Shared Editor"); @@ -80,19 +78,11 @@ public class NewSharedSessionWizardPage extends WizardPage { sessions = new ArrayList(); } - /** - * @see IDialogPage#createControl(Composite) - */ public void createControl(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(new GridLayout(2, false)); main.setLayoutData(new GridData(GridData.FILL_BOTH)); - /* - * Composite container = new Composite(main, SWT.NULL); GridLayout - * layout = new GridLayout(); container.setLayout(layout); - * layout.numColumns = 3; layout.verticalSpacing = 9; - */ Label label = new Label(main, SWT.NULL); label.setText("&Project:"); @@ -188,10 +178,6 @@ public class NewSharedSessionWizardPage extends WizardPage { } - /** - * Tests if the current workbench selection is a suitable container to use. - */ - private void initialize() { if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; @@ -270,11 +256,6 @@ public class NewSharedSessionWizardPage extends WizardPage { return bouts.toByteArray(); } - /** - * Uses the standard container selection dialog to choose the new value for - * the container field. - */ - private void handleBrowse() { ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select new file container"); @@ -286,10 +267,6 @@ public class NewSharedSessionWizardPage extends WizardPage { } } - /** - * Ensures that both text fields are set. - */ - private void dialogChanged() { IResource container = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(getContainerName())); String fileName = getFileName(); |
