Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern')
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/CustomizeAction.java92
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/ExtensionActionI.java86
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/ExtensionActionII.java86
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/FactoryCustomizeAction.java20
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/LaunchPatternSelectionDialogAction.java39
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenClassNameFilledAction.java130
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenJavaClassWizardWithMain.java77
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenJavaProjectWizard.java56
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenNewJavaProjectWizardWithNameAction.java59
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/PatternGenerator.java247
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/SingletonCustomizeAction.java20
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/VisitorCustomizeAction.java20
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/dialogs/CustomizePatternDialog.java157
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/dialogs/PatternSelectionDialog.java118
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/listeners/PatternItemListener.java51
-rw-r--r--org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/wizards/MyProjectCreationWizard.java43
16 files changed, 0 insertions, 1301 deletions
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/CustomizeAction.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/CustomizeAction.java
deleted file mode 100644
index ce1de35e4..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/CustomizeAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.cheatsheets.*;
-import org.eclipse.ui.examples.cheatsheets.pattern.dialogs.CustomizePatternDialog;
-
-/**
- * Our sample action implements workbench action delegate.
- * The action proxy will be created by the workbench and
- * shown in the UI. When the user tries to use the action,
- * this delegate will be created and execution will be
- * delegated to it.
- * @see IWorkbenchWindowActionDelegate
- */
-public class CustomizeAction extends Action implements IWorkbenchWindowActionDelegate, ICheatSheetAction {
- private IWorkbenchWindow window;
- private ICheatSheetManager csmanager;
- /**
- * The constructor.
- */
- public CustomizeAction() {
- }
-
- /**
- * The action has been activated. The argument of the
- * method represents the 'real' action sitting
- * in the workbench UI.
- * @see IWorkbenchWindowActionDelegate#run
- */
- public void run(IAction action) {
- run();
- }
-
- public void run(){
- try {
-// IWorkbench workbench = PlatformUI.getWorkbench();
-// IStructuredSelection selection = new StructuredSelection();
- Shell shell = Display.getCurrent().getActiveShell();
- CustomizePatternDialog p = new CustomizePatternDialog(shell);
- p.setCSM(csmanager);
- p.create();
- p.open();
- } catch(Exception e) {
-
- }
- }
-
- public void run(String[] params, ICheatSheetManager csm){
- csmanager = csm;
- run();
- }
-
- /**
- * Selection in the workbench has been changed. We
- * can change the state of the 'real' action here
- * if we want, but this can only happen after
- * the delegate has been created.
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /**
- * We can use this method to dispose of any system
- * resources we previously allocated.
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose() {
- }
-
- /**
- * We will cache window object in order to
- * be able to provide parent shell for the message dialog.
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/ExtensionActionI.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/ExtensionActionI.java
deleted file mode 100644
index 238c682aa..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/ExtensionActionI.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.cheatsheets.AbstractItemExtensionElement;
-import org.eclipse.ui.forms.events.*;
-import org.eclipse.ui.forms.widgets.*;
-import org.eclipse.ui.tests.cheatsheets.CheatSheetTestPlugin;
-
-public class ExtensionActionI extends AbstractItemExtensionElement {
-
- private Image helpImage;
- private FormToolkit toolkit;
-
- /**
- * @param attributeName
- */
- public ExtensionActionI(String attributeName) {
- super(attributeName);
- }
-
- protected ImageHyperlink createButton(Composite parent, Image image, Color color, String toolTipText) {
- ImageHyperlink button = new ImageHyperlink(parent, SWT.NULL);
- toolkit.adapt(button, true, true);
- button.setImage(image);
- button.setBackground(color);
- button.setToolTipText(toolTipText);
-
- return button;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.cheatsheets.AbstractItemExtensionElement#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite c) {
- System.out.println("ADDING STUFF TO COMPOSITE!!!"); //$NON-NLS-1$
-
- toolkit = new FormToolkit(c.getDisplay());
-
- String imageFileName = "icons/sample.gif"; //$NON-NLS-1$
- URL imageURL = CheatSheetTestPlugin.getDefault().find(new Path(imageFileName));
- ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imageURL);
- helpImage = imageDescriptor.createImage();
-
- ImageHyperlink helpButton = createButton(c, helpImage, c.getBackground(), "Button I"); //$NON-NLS-1$
- helpButton.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- System.out.println("Button I Pressed!!!");//$NON-NLS-1$
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.cheatsheets.AbstractItemExtensionElement#handleAttribute(java.lang.String)
- */
- public void handleAttribute(String attributeValue) {
- System.out.println("HANDLING ATTRIBUTE: "+attributeValue); //$NON-NLS-1$
- return;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.cheatsheets.AbstractItemExtensionElement#dispose()
- */
- public void dispose() {
- if(helpImage != null)
- helpImage.dispose();
-
- if(toolkit != null)
- toolkit.dispose();
- }
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/ExtensionActionII.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/ExtensionActionII.java
deleted file mode 100644
index fbd514d9f..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/ExtensionActionII.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.cheatsheets.AbstractItemExtensionElement;
-import org.eclipse.ui.forms.events.*;
-import org.eclipse.ui.forms.widgets.*;
-import org.eclipse.ui.tests.cheatsheets.CheatSheetTestPlugin;
-
-public class ExtensionActionII extends AbstractItemExtensionElement {
-
- private Image helpImage;
- private FormToolkit toolkit;
-
- /**
- * @param attributeName
- */
- public ExtensionActionII(String attributeName) {
- super(attributeName);
- }
-
- protected ImageHyperlink createButton(Composite parent, Image image, Color color, String toolTipText) {
- ImageHyperlink button = new ImageHyperlink(parent, SWT.NULL);
- toolkit.adapt(button, true, true);
- button.setImage(image);
- button.setBackground(color);
- button.setToolTipText(toolTipText);
-
- return button;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.cheatsheets.AbstractItemExtensionElement#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite c) {
- System.out.println("ADDING STUFF TO COMPOSITE!!!"); //$NON-NLS-1$
-
- toolkit = new FormToolkit(c.getDisplay());
-
- String imageFileName = "icons/sample2.gif"; //$NON-NLS-1$
- URL imageURL = CheatSheetTestPlugin.getDefault().find(new Path(imageFileName));
- ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imageURL);
- helpImage = imageDescriptor.createImage();
-
- ImageHyperlink helpButton = createButton(c, helpImage, c.getBackground(), "Button II"); //$NON-NLS-1$
- helpButton.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- System.out.println("Button II Pressed!!!");//$NON-NLS-1$
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.cheatsheets.AbstractItemExtensionElement#handleAttribute(java.lang.String)
- */
- public void handleAttribute(String attributeValue) {
- System.out.println("HANDLING ATTRIBUTE: "+attributeValue); //$NON-NLS-1$
- return;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.cheatsheets.AbstractItemExtensionElement#dispose()
- */
- public void dispose() {
- if(helpImage != null)
- helpImage.dispose();
-
- if(toolkit != null)
- toolkit.dispose();
- }
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/FactoryCustomizeAction.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/FactoryCustomizeAction.java
deleted file mode 100644
index 46b635bbd..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/FactoryCustomizeAction.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import org.eclipse.ui.cheatsheets.ICheatSheetManager;
-
-public class FactoryCustomizeAction extends CustomizeAction {
- public void run(String[] params, ICheatSheetManager csm) {
- System.out.println("In FactoryCustomizeAction");
- super.run(params, csm);
- }
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/LaunchPatternSelectionDialogAction.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/LaunchPatternSelectionDialogAction.java
deleted file mode 100644
index 8596dcc52..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/LaunchPatternSelectionDialogAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.cheatsheets.*;
-import org.eclipse.ui.examples.cheatsheets.pattern.dialogs.PatternSelectionDialog;
-
-public class LaunchPatternSelectionDialogAction extends Action implements ICheatSheetAction {
- private ICheatSheetManager csmanager;
- /**
- * The constructor.
- */
- public LaunchPatternSelectionDialogAction() {
- }
-
- public void run(String[] s, ICheatSheetManager csm){
- csmanager = csm;
-
- try {
- Shell shell = Display.getCurrent().getActiveShell();
- PatternSelectionDialog p = new PatternSelectionDialog(shell);
- p.setCSM(csmanager);
- p.create();
- p.open();
- } catch(Exception e) {
-
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenClassNameFilledAction.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenClassNameFilledAction.java
deleted file mode 100644
index aac96798a..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenClassNameFilledAction.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard;
-import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.cheatsheets.*;
-import org.eclipse.ui.cheatsheets.ICheatSheetAction;
-
-
-public class OpenClassNameFilledAction extends Action implements ICheatSheetAction {
- private ICheatSheetManager csmanager;
- private String className;
- private String projectName;
-
- /**
- * Create a new <code>OpenFileImportWizard</code> action.
- */
- public OpenClassNameFilledAction() {
-
- }
-
- public void run() {
- boolean extendBase = false;
- try {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IStructuredSelection psel = null;
- if (projectName != null) {
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if (p != null)
- psel = new StructuredSelection(p);
- }
-
- IStructuredSelection selection = null;
- // ISelection s = workbench.getActiveWorkbenchWindow().getSelectionService().getSelection();
-
- if (psel != null)
- selection = psel;
- else
- selection = new StructuredSelection();
-
- NewClassCreationWizard classWizard = new NewClassCreationWizard();
- classWizard.init(workbench, selection);
-
- Shell shell = Display.getCurrent().getActiveShell();
- WizardDialog wizardDialog = new WizardDialog(shell, classWizard);
- wizardDialog.create();
-
- IWizardPage[] pages = classWizard.getPages();
-
-
- String values = csmanager.getData("files"); //$NON-NLS-1$
-
- StringTokenizer tokenizer = new StringTokenizer(values, ",");
- String[] files = new String[tokenizer.countTokens()];
- for(int i = 0; tokenizer.hasMoreTokens(); i++) {
- files[i] = tokenizer.nextToken();
- }
- String baseClassName = null;
- String derived = null;
- String secondderived = null;
- if(files.length == 4) {
- baseClassName = files[1];
- derived = files[2];
- secondderived = files[3];
- }
-
-
-
- if (className != null){
- if(className.equals(derived) || //$NON-NLS-1$
- className.equals(secondderived)){//$NON-NLS-1$
- extendBase = true;
- }
- }else {
- className = "NewClass"; //$NON-NLS-1$
- }
-
- if (pages[0] instanceof NewClassWizardPage) {
- NewClassWizardPage page1 = (NewClassWizardPage) pages[0];
- page1.setTypeName(className, true);
- page1.setMethodStubSelection(false, false, false, false);
- if(extendBase){
- page1.setSuperClass(baseClassName, false); //$NON-NLS-1$
- }
- }
-
- wizardDialog.open();
-
- PatternGenerator.generate(csmanager);
- } catch (Exception e) {
-
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[], org.eclipse.ui.cheatsheets.ICheatSheetManager)
- */
- public void run(String[] params, ICheatSheetManager csm) {
- csmanager = csm;
- if (params != null && !(params.length < 2))
- if (params[0] != null)
- className = params[0];
- if (params[1] != null)
- projectName = params[1];
- run();
- }
-
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenJavaClassWizardWithMain.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenJavaClassWizardWithMain.java
deleted file mode 100644
index 689e1e26e..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenJavaClassWizardWithMain.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard;
-import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IWorkbench;
-
-public class OpenJavaClassWizardWithMain extends Action {
-
- public OpenJavaClassWizardWithMain() {
- super();
-
- }
-
- public OpenJavaClassWizardWithMain(String text) {
- super(text);
-
- }
-
- public OpenJavaClassWizardWithMain(String text, ImageDescriptor image) {
- super(text, image);
-
- }
-
- public OpenJavaClassWizardWithMain(String text, int style) {
- super(text, style);
-
- }
-
- public void run() {
- try {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IStructuredSelection selection = new StructuredSelection();
- NewClassCreationWizard classWizard = new NewClassCreationWizard();
- classWizard.init(workbench, selection);
-
- Shell shell = Display.getCurrent().getActiveShell();
- WizardDialog wizardDialog = new WizardDialog(shell, classWizard);
- wizardDialog.create();
-
- IWizardPage[] pages = classWizard.getPages();
- String className = "HelloWorld"; //$NON-NLS-1$
-
- if (pages[0] instanceof NewClassWizardPage) {
- NewClassWizardPage page1 = (NewClassWizardPage) pages[0];
- page1.setTypeName(className, true);
- page1.setMethodStubSelection(true, false,false,true);
- }
-
- int result = wizardDialog.open();
-
- notifyResult(result == Window.OK ? true : false);
- } catch (Exception e) {
-
- }
- }
-
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenJavaProjectWizard.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenJavaProjectWizard.java
deleted file mode 100644
index 6bcca75ba..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenJavaProjectWizard.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import org.eclipse.jdt.internal.ui.wizards.JavaProjectWizard;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-
-public class OpenJavaProjectWizard extends Action {
-
- public OpenJavaProjectWizard() {
- super();
- }
-
- public OpenJavaProjectWizard(String text) {
- super(text);
- }
-
- public OpenJavaProjectWizard(String text, ImageDescriptor image) {
- super(text, image);
- }
-
- public OpenJavaProjectWizard(String text, int style) {
- super(text, style);
- }
-
- public void run() {
- try {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IStructuredSelection selection = new StructuredSelection();
- JavaProjectWizard projectWizard = new JavaProjectWizard();
- projectWizard.init(workbench, selection);
-
- Shell shell = Display.getCurrent().getActiveShell();
- WizardDialog wizardDialog = new WizardDialog(shell, projectWizard);
- wizardDialog.create();
- int result = wizardDialog.open();
-
- notifyResult(result == Window.OK ? true : false);
- } catch (Exception e) {
- }
- }
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenNewJavaProjectWizardWithNameAction.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenNewJavaProjectWizardWithNameAction.java
deleted file mode 100644
index cdb30b59e..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/OpenNewJavaProjectWizardWithNameAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.cheatsheets.*;
-import org.eclipse.ui.examples.cheatsheets.pattern.wizards.MyProjectCreationWizard;
-
-public class OpenNewJavaProjectWizardWithNameAction extends Action implements ICheatSheetAction {
- private ICheatSheetManager csmanager;
-
- /**
- * Create a new <code>OpenFileImportWizard</code> action.
- */
- public OpenNewJavaProjectWizardWithNameAction() {
- }
-
- public void run() {
- try {
- IWorkbench workbench = PlatformUI.getWorkbench();
-
- IStructuredSelection selection = new StructuredSelection();
-
- MyProjectCreationWizard projectWizard = new MyProjectCreationWizard(csmanager);
- projectWizard.init(workbench, selection);
-
- Shell shell = Display.getCurrent().getActiveShell();
- WizardDialog wizardDialog = new WizardDialog(shell, projectWizard);
-
- wizardDialog.create();
-
- wizardDialog.open();
-
- } catch (Exception e) {
-
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.cheatsheets.ICheatsheetAction#run(java.lang.String[], org.eclipse.ui.cheatsheets.ICheatsheetManager)
- */
- public void run(String[] params, ICheatSheetManager csm) {
- csmanager = csm;
- run();
- }
-
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/PatternGenerator.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/PatternGenerator.java
deleted file mode 100644
index 87dec4cf9..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/PatternGenerator.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.jdt.core.*;
-import org.eclipse.ui.cheatsheets.*;
-
-public class PatternGenerator {
-
-
- private static IType findType(IJavaProject project, String typeName) throws JavaModelException {
- if (project.exists()) {
- return project.findType(typeName);
- }
- return null;
- }
-
- public static void generate(ICheatSheetManager csm) {
- String project = csm.getData("project"); //$NON-NLS-1$
- String pattern = csm.getData("pattern"); //$NON-NLS-1$
- String thisValue = csm.getData("this"); //$NON-NLS-1$
- String values = csm.getData("files"); //$NON-NLS-1$
-
- StringTokenizer tokenizer = new StringTokenizer(values, ",");
- String[] files = new String[tokenizer.countTokens()];
- for(int i = 0; tokenizer.hasMoreTokens(); i++) {
- files[i] = tokenizer.nextToken();
- }
-
- if (project == null)
- return;
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject wproject = workspace.getRoot().getProject(project);
- IJavaProject jproject = JavaCore.create(wproject);
-
- if (pattern != null && pattern.equals("Factory")) //$NON-NLS-1$
- handleFactoryFileAutomation(pattern, csm, jproject, thisValue, files);
- else if (pattern != null && pattern.equals("Singleton")) //$NON-NLS-1$
- handleSingletonFileAutomation(pattern, csm, jproject, thisValue, files);
- else if (pattern != null && pattern.equals("Visitor")) //$NON-NLS-1$
- handleVisitorFileAutomation(pattern, csm, jproject, thisValue, files);
- }
-
- private static void handleSingletonFileAutomation(String pattern, ICheatSheetManager csm, IJavaProject jproject, String thisValue, String[] files) {
- IType mytype = null;
- String singletonClassName = files[0];
- if (singletonClassName == null)
- return;
-
- if (thisValue != null) {
- if (thisValue.equals(singletonClassName)) { //$NON-NLS-1$
- try {
- mytype = findType(jproject, singletonClassName);
- StringBuffer sb = new StringBuffer();
- sb.append("public static synchronized "); //$NON-NLS-1$
- sb.append(singletonClassName + " getInstance () {"); //$NON-NLS-1$
- sb.append("\n\t if(instance == null)\n\t\t instance = new " + singletonClassName + "();"); //$NON-NLS-1$ //$NON-NLS-2$
- sb.append("\n\t return instance;"); //$NON-NLS-1$
- sb.append("\n}\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
-
- sb = new StringBuffer();
- sb.append("public void print(String s) {\n\t System.out.println(s);\n}\n"); //$NON-NLS-1$
- mytype.createMethod(sb.toString(), null, false, null);
-
- sb = new StringBuffer();
- sb.append("private static " + singletonClassName + " instance;\n\n"); //$NON-NLS-1$ //$NON-NLS-2$
- mytype.createField(sb.toString(), null, false, null);
-
- } catch (Exception je) {
- }
-
- }
- } else {
- try {
- mytype = findType(jproject, "TestPattern"); //$NON-NLS-1$
- StringBuffer sb = new StringBuffer();
- sb.append("public static "); //$NON-NLS-1$
- sb.append("void main (String[] args) {"); //$NON-NLS-1$
- sb.append("\n\t" + singletonClassName + " singleInstance = " + singletonClassName + ".getInstance();"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- sb.append("\n\t singleInstance.print(\"Printed by the single instance.\");"); //$NON-NLS-1$
- sb.append("\n}\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
- } catch (Exception je) {
- }
- }
-
- }
- private static void handleVisitorFileAutomation(String pattern, ICheatSheetManager csm, IJavaProject jproject, String thisValue, String[] files) {
- IType mytype = null;
- String visitorClassName = files[0];
- if (visitorClassName == null)
- return;
- String classToVisitClassName = files[1];
- if (classToVisitClassName == null)
- return;
-
- if (thisValue != null) {
- if (thisValue.equals(visitorClassName)) { //$NON-NLS-1$
- try {
- mytype = findType(jproject, visitorClassName);
- StringBuffer sb = new StringBuffer();
- sb.append("public void visit (" + classToVisitClassName + " v) {"); //$NON-NLS-1$ //$NON-NLS-2$
- sb.append("\n\t System.out.println(\"Visiting ....\");"); //$NON-NLS-1$
- sb.append("\n\t System.out.println(v.getString());"); //$NON-NLS-1$
- sb.append("\n}\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
- } catch (Exception je) {
- }
-
- }
-
- if (thisValue.equals(classToVisitClassName)) { //$NON-NLS-1$
- try {
- mytype = findType(jproject, classToVisitClassName);
- StringBuffer sb = new StringBuffer();
- sb.append("public void accept (" + visitorClassName + " v) {"); //$NON-NLS-1$ //$NON-NLS-2$
- sb.append("\n\t v.visit(this);"); //$NON-NLS-1$
- sb.append("\n}\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
-
- sb = new StringBuffer();
- sb.append("public String visitString = \"This is the String in the class to visit!\";\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createField(sb.toString(), null, false, null);
-
- sb = new StringBuffer();
- sb.append("public String getString() { \n\t return visitString; \n}\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
-
- } catch (Exception je) {
- }
- }
- } else {
- try {
- mytype = findType(jproject, "TestPattern"); //$NON-NLS-1$
- StringBuffer sb = new StringBuffer();
- sb.append("public static "); //$NON-NLS-1$
- sb.append("void main (String[] args) {"); //$NON-NLS-1$
- sb.append("\n\t" + visitorClassName + " visitor = new " + visitorClassName + "();"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- sb.append("\n\t" + classToVisitClassName + " objectToVisit = new " + classToVisitClassName + "();"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- sb.append("\n\t objectToVisit.accept(visitor);"); //$NON-NLS-1$
-
- sb.append("\n}\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
- } catch (Exception je) {
- }
- }
-
- }
- private static void handleFactoryFileAutomation(String pattern, ICheatSheetManager csm, IJavaProject jproject, String thisValue, String[] files) {
-
- IType mytype = null;
- String factoryClassName = files[0];
- if (factoryClassName == null)
- return;
- String baseClassName = files[1];
- String derived = files[2];
- String secondderived = files[3];
-
- if (baseClassName == null || derived == null || secondderived == null)
- return;
-
- if (jproject instanceof IJavaProject) {
- if (baseClassName.equals(thisValue)) { //$NON-NLS-1$
- try {
- mytype = findType(jproject, baseClassName);
- StringBuffer sb = new StringBuffer();
- sb.append("public "); //$NON-NLS-1$
- sb.append("void printObjectType () {"); //$NON-NLS-1$
- sb.append("\n}\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
- } catch (Exception je) {
- }
- } else if (derived.equals(thisValue)) { //$NON-NLS-1$
- try {
- mytype = findType(jproject, derived);
- StringBuffer sb = new StringBuffer();
- sb.append("public "); //$NON-NLS-1$
- sb.append("void printObjectType () {"); //$NON-NLS-1$
- sb.append("\n\tSystem.out.println(\"Type is: " + derived + "\");\n}\n\n"); //$NON-NLS-1$ //$NON-NLS-2$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
- } catch (Exception je) {
- }
- } else if (secondderived.equals(thisValue)) { //$NON-NLS-1$
- try {
- mytype = findType(jproject, secondderived);
- StringBuffer sb = new StringBuffer();
- sb.append("public "); //$NON-NLS-1$
- sb.append("void printObjectType () {"); //$NON-NLS-1$
- sb.append("\n\tSystem.out.println(\"Type is: " + secondderived + "\");\n}\n\n"); //$NON-NLS-1$ //$NON-NLS-2$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
- } catch (Exception je) {
- }
- } else if (factoryClassName.equals(thisValue)) { //$NON-NLS-1$
- try {
- mytype = findType(jproject, factoryClassName);
- StringBuffer sb = new StringBuffer();
- sb.append("public "); //$NON-NLS-1$
- sb.append(baseClassName + " getObjectFromFactory (String derivedTypeIndicator) {"); //$NON-NLS-1$
- sb.append("\n\t if(derivedTypeIndicator.equals(\"baseOne\"))\n\t return new " + derived + "();"); //$NON-NLS-1$ //$NON-NLS-2$
- sb.append("\n\t if(derivedTypeIndicator.equals(\"baseTwo\"))\n\t return new " + secondderived + "();"); //$NON-NLS-1$ //$NON-NLS-2$
- sb.append("\n\t else\n\t return new " + baseClassName + "();"); //$NON-NLS-1$ //$NON-NLS-2$
- sb.append("\n}\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
- } catch (Exception je) {
- }
- } else { //$NON-NLS-1$
- try {
- mytype = findType(jproject, "TestPattern"); //$NON-NLS-1$ //$NON-NLS-2$
- StringBuffer sb = new StringBuffer();
- sb.append("public static "); //$NON-NLS-1$
- sb.append("void main (String[] args) {"); //$NON-NLS-1$
- sb.append("\n\t" + factoryClassName + " factory = new " + factoryClassName + "();"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- sb.append("\n\tSystem.out.println(\"First Type From Factory: \");\n\t factory.getObjectFromFactory(\"baseOne\").printObjectType();\n"); //$NON-NLS-1$
- sb.append("\tSystem.out.println(\"Second Type From Factory: \");\n\t factory.getObjectFromFactory(\"baseTwo\").printObjectType();\n}\n\n"); //$NON-NLS-1$
- if (mytype != null)
- mytype.createMethod(sb.toString(), null, false, null);
- } catch (Exception je) {
- }
- }
- }
-
- }
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/SingletonCustomizeAction.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/SingletonCustomizeAction.java
deleted file mode 100644
index 5f83f332a..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/SingletonCustomizeAction.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import org.eclipse.ui.cheatsheets.ICheatSheetManager;
-
-public class SingletonCustomizeAction extends CustomizeAction {
- public void run(String[] params, ICheatSheetManager csm) {
- System.out.println("In SingletonCustomizeAction");
- super.run(params, csm);
- }
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/VisitorCustomizeAction.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/VisitorCustomizeAction.java
deleted file mode 100644
index e452d0cfc..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/actions/VisitorCustomizeAction.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.actions;
-
-import org.eclipse.ui.cheatsheets.ICheatSheetManager;
-
-public class VisitorCustomizeAction extends CustomizeAction {
- public void run(String[] params, ICheatSheetManager csm) {
- System.out.println("In VisitorCustomizeAction");
- super.run(params, csm);
- }
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/dialogs/CustomizePatternDialog.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/dialogs/CustomizePatternDialog.java
deleted file mode 100644
index c45aa85c3..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/dialogs/CustomizePatternDialog.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.dialogs;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.cheatsheets.*;
-
-public class CustomizePatternDialog extends Dialog {
- private ICheatSheetManager csmanager;
- private Text t1;
- private Text t2;
- private Text t3;
- private Text t4;
- private Text t5;
- private String pname;
- private String cname;
- /**
- * @param parentShell
- */
- public CustomizePatternDialog(Shell parentShell) {
- super(parentShell);
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- GridLayout g = new GridLayout();
- g.numColumns = 1;
- composite.setLayout(g);
-
- Composite descComposite = new Composite(composite, SWT.NULL);
- GridLayout dg = new GridLayout();
- dg.numColumns = 1;
- descComposite.setLayout(dg);
-
- Composite bComposite = new Composite(composite, SWT.NULL);
- GridLayout bg = new GridLayout(2, false);
- bComposite.setLayout(bg);
-
- Label dl = new Label(descComposite, SWT.NULL);
- String data = null;
- if (csmanager != null)
- data = csmanager.getData("pattern");//$NON-NLS-1$
- if (data != null) {
- dl.setText("Customize your " + data + " pattern.");//$NON-NLS-1$//$NON-NLS-2$
- if (data.equals("Singleton"))//$NON-NLS-1$
- addSingletonStuff(bComposite);
- else if (data.equals("Visitor"))//$NON-NLS-1$
- addVisitorStuff(bComposite);
- else if (data.equals("Factory"))//$NON-NLS-1$
- addFactoryStuff(bComposite);
- } else
- dl.setText("Customize your pattern.");//$NON-NLS-1$
-
- return composite;
- }
-
- private void addSingletonStuff(Composite c) {
- Label l = new Label(c, SWT.NULL);
- l.setText("Java Project Name:");//$NON-NLS-1$
- t1 = new Text(c, SWT.BORDER);
-
- l = new Label(c, SWT.NULL);
- l.setText("Singleton Class Name:");//$NON-NLS-1$
- t2 = new Text(c, SWT.BORDER);
- }
-
- public void addFactoryStuff(Composite c) {
- Label l = new Label(c, SWT.NULL);
- l.setText("Java Project Name:");//$NON-NLS-1$
- t1 = new Text(c, SWT.BORDER);
-
- l = new Label(c, SWT.NULL);
- l.setText("Factory Class Name:");//$NON-NLS-1$
- t2 = new Text(c, SWT.BORDER);
-
- l = new Label(c, SWT.NULL);
- l.setText("Base Derived Class Name:");//$NON-NLS-1$
- t3 = new Text(c, SWT.BORDER);
-
- l = new Label(c, SWT.NULL);
- l.setText("First Derived Class Name:");//$NON-NLS-1$
- t4 = new Text(c, SWT.BORDER);
-
- l = new Label(c, SWT.NULL);
- l.setText("Second Derived Class Name:");//$NON-NLS-1$
- t5 = new Text(c, SWT.BORDER);
- }
-
- public void addVisitorStuff(Composite c) {
-
- Label l = new Label(c, SWT.NULL);
- l.setText("Java Project Name:");//$NON-NLS-1$
- t1 = new Text(c, SWT.BORDER);
-
- l = new Label(c, SWT.NULL);
- l.setText("Visitor Class Name:");//$NON-NLS-1$
- t2 = new Text(c, SWT.BORDER);
-
- l = new Label(c, SWT.NULL);
- l.setText("Class to visit Name:");//$NON-NLS-1$
- t3 = new Text(c, SWT.BORDER);
-
- }
-
- protected void okPressed() {
- pname = t1.getText();
- cname = t2.getText();
- csmanager.setData("project", pname);//$NON-NLS-1$
- String pattern = csmanager.getData("pattern");//$NON-NLS-1$
- if (pattern.equals("Factory")) {//$NON-NLS-1$
- StringBuffer buffer = new StringBuffer();
- buffer.append(t2.getText());
- buffer.append(',');
- buffer.append(t3.getText());
- buffer.append(',');
- buffer.append(t4.getText());
- buffer.append(',');
- buffer.append(t5.getText());
-
- csmanager.setData("files", buffer.toString());//$NON-NLS-1$
- } else if (pattern.equals("Visitor")) {//$NON-NLS-1$
- StringBuffer buffer = new StringBuffer();
- buffer.append(t2.getText());
- buffer.append(',');
- buffer.append(t3.getText());
-
- csmanager.setData("files", buffer.toString());//$NON-NLS-1$
- } else if (pattern.equals("Singleton")) {//$NON-NLS-1$
- StringBuffer buffer = new StringBuffer();
- buffer.append(t2.getText());
-
- csmanager.setData("files", buffer.toString());//$NON-NLS-1$
- }
-
- super.okPressed();
- }
-
- public void setCSM(ICheatSheetManager csm) {
- csmanager = csm;
- }
-
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/dialogs/PatternSelectionDialog.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/dialogs/PatternSelectionDialog.java
deleted file mode 100644
index fc38f6428..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/dialogs/PatternSelectionDialog.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.dialogs;
-
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridLayout;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.cheatsheets.ICheatSheetManager;
-
-
-public class PatternSelectionDialog extends Dialog {
- Button f;
- Button v;
- Button s;
- String selected;
- private static final String factory = "Factory"; //$NON-NLS-1$
- private static final String singleton = "Singleton"; //$NON-NLS-1$
- private static final String visitor = "Visitor"; //$NON-NLS-1$
- private ICheatSheetManager csmanager;
-
- public PatternSelectionDialog(Shell parentShell) {
- super(parentShell);
- }
-
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText("Pattern Selection"); //$NON-NLS-1$
-
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- GridLayout g = new GridLayout();
- g.numColumns = 1;
- composite.setLayout(g);
-
- Composite descComposite = new Composite(composite, SWT.NULL);
- GridLayout dg = new GridLayout();
- dg.numColumns = 1;
- descComposite.setLayout(dg);
-
- Composite bComposite = new Composite(composite, SWT.NULL);
- GridLayout bg = new GridLayout(2, false);
- bComposite.setLayout(bg);
-
- Label dl = new Label(descComposite, SWT.NULL);
- dl.setText("Please select a design pattern."); //$NON-NLS-1$
-
- f = new Button(bComposite, SWT.RADIO);
- f.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- selected = factory;
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- return;
- }
- }
- );
- Label fl = new Label(bComposite, SWT.NULL);
- fl.setText(factory);
-
- s = new Button(bComposite, SWT.RADIO);
- s.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- selected = singleton;
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- return;
- }
- });
- Label sl = new Label(bComposite, SWT.NULL);
- sl.setText(singleton);
-
- v = new Button(bComposite, SWT.RADIO);
- v.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- selected = visitor;
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- return;
- }
- });
- Label vl = new Label(bComposite, SWT.NULL);
- vl.setText(visitor);
-
- return composite;
- }
-
- protected void okPressed() {
-
- //System.out.println(selected);
- csmanager.setData("pattern", selected); //$NON-NLS-1$
- super.okPressed();
- }
-
- public void setCSM(ICheatSheetManager csm){
- csmanager = csm;
- }
-
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/listeners/PatternItemListener.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/listeners/PatternItemListener.java
deleted file mode 100644
index 6ed40942c..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/listeners/PatternItemListener.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.listeners;
-
-import org.eclipse.ui.cheatsheets.*;
-
-public class PatternItemListener extends CheatSheetListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.cheatsheets.CheatSheetListener#cheatSheetEvent(org.eclipse.ui.cheatsheets.ICheatSheetEvent)
- */
- public void cheatSheetEvent(ICheatSheetEvent event) {
- ICheatSheetManager csm = event.getCheatSheetManager();
- System.out.print("CheatSheetEvent for ");
- System.out.println(event.getCheatSheetID());
- System.out.print("Event type: ");
- System.out.print(event.getEventType());
- System.out.print(" - ");
- switch (event.getEventType()) {
- case ICheatSheetEvent.CHEATSHEET_OPENED :
- System.out.println("OPENED");
- break;
- case ICheatSheetEvent.CHEATSHEET_CLOSED :
- System.out.println("CLOSED");
- break;
- case ICheatSheetEvent.CHEATSHEET_STARTED :
- System.out.println("STARTED");
- break;
- case ICheatSheetEvent.CHEATSHEET_RESTARTED :
- System.out.println("RESTARTED");
- break;
- case ICheatSheetEvent.CHEATSHEET_COMPLETED :
- System.out.println("COMPLETED");
- break;
- case ICheatSheetEvent.CHEATSHEET_RESTORED :
- System.out.println("RESTORED");
- break;
- default :
- System.out.println("UNKNOWN");
- break;
- }
- }
-}
diff --git a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/wizards/MyProjectCreationWizard.java b/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/wizards/MyProjectCreationWizard.java
deleted file mode 100644
index 6ea71a4ec..000000000
--- a/org.eclipse.ua.tests/src/org/eclipse/ui/examples/cheatsheets/pattern/wizards/MyProjectCreationWizard.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Common Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ui.examples.cheatsheets.pattern.wizards;
-
-import org.eclipse.jdt.internal.ui.wizards.JavaProjectWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.ui.cheatsheets.ICheatSheetManager;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-public class MyProjectCreationWizard extends JavaProjectWizard {
- private ICheatSheetManager csmanager;
-
- public MyProjectCreationWizard(ICheatSheetManager csm) {
- super();
- csmanager = csm;
- }
-
- public MyProjectCreationWizard() {
- super();
- }
-
- /*
- * @see Wizard#addPages
- */
- public void addPages() {
- super.addPages();
- IWizardPage[] pagesf = getPages();
- if (pagesf[0] instanceof WizardNewProjectCreationPage) {
- WizardNewProjectCreationPage page1 = (WizardNewProjectCreationPage) pagesf[0];
- String project = csmanager.getData("project"); //$NON-NLS-1$
- if (project == null)
- project = "PatternProject"; //$NON-NLS-1$
- page1.setInitialProjectName(project);
- }
- }
-
-} \ No newline at end of file

Back to the top