Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2007, 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.pde.internal.ua.ui.editor.cheatsheet.simple.actions;
SimpleCSPreviewAction
public class SimpleCSPreviewAction extends Action {

Parameters:
input
		 = null;
		// Set action name
		// Set action image
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jface.action.Action#run()
	 */
	public void run() {
		// Ensure we have our input
		if ( == null) {
			return;
else if ( == null) {
			return;
		}
		// Get the editor input
		// Could be IFileEditorInput (File in workpspace - e.g. Package Explorer View)
		// Could be IStorageEditorInput (File not in workpsace - e.g. CVS Repositories View)
		try {
			// Write the current model into a String as raw XML
			StringWriter swriter = new StringWriter();
			PrintWriter writer = new PrintWriter(swriter);
			.write(""writer); //$NON-NLS-1$
			writer.flush();
			swriter.close();
			// Launch in the cheat sheet view
			// Note:  Having a null URL is valid for simple cheat sheets
			openAction.run();
catch (IOException e) {
			PDEUserAssistanceUIPlugin.logException(e);
		}
	}

Parameters:
object
	public void setDataModelObject(ISimpleCS object) {
		 = object;
	}

Parameters:
editorInput
	public void setEditorInput(IEditorInput editorInput) {
		 = editorInput;
	}
New to GrepCode? Check out our FAQ X