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.wizards.toc;
import  org.eclipse.swt.widgets.Display;
public class TocOperation extends WorkspaceModifyOperation {
	private IFile fFile;
	private String fTocName;
	public TocOperation(IFile fileString tocName) {
		 = file;
		 = tocName;
	}
		TocModel model = new TocModel(CoreUtility.getTextDocument(.getContents()), false);
		model.save();
		model.dispose();
		monitor.done();
	}
	private void initializeToc(TocModel model) {
		// Create Topic
		TocTopic topic = createTopic(model);
		// Bind the created topic to this TOC
		model.getToc().addChild(topic);
		// Set the initial TOC name 
	}
	private TocTopic createTopic(TocModel model) {
		TocDocumentFactory factory = model.getFactory();
		TocTopic topic = factory.createTocTopic();
		return topic;
	}
	protected void openFile() {
		Display.getCurrent().asyncExec(new Runnable() {
			public void run() {
				IWorkbenchWindow ww = PDEUserAssistanceUIPlugin.getActiveWorkbenchWindow();
				if (ww == null) {
					return;
				}
				if (page == null || !.exists())
					return;
				IWorkbenchPart focusPart = page.getActivePart();
				if (focusPart instanceof ISetSelectionTarget) {
					ISelection selection = new StructuredSelection();
					((ISetSelectionTargetfocusPart).selectReveal(selection);
				}
				try {
catch (PartInitException e) {
				}
			}
		});
	}
New to GrepCode? Check out our FAQ X