Mercurial > hg > RemoteEditor > Eclipse
view src/remoteeditor/action/RemoteEditorAction.java @ 101:de9e0d2e2139
Add UntitledTextFileWizard
author | yabiku |
---|---|
date | Sat, 22 Dec 2007 17:43:37 +0900 |
parents | 00e0deb365f9 |
children | dca742322984 |
line wrap: on
line source
package remoteeditor.action; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; import org.eclipse.core.resources.IContainer; //import org.eclipse.core.resources.IFile; //import org.eclipse.core.resources.IProject; //import org.eclipse.core.resources.IWorkspace; //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.Path; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; //import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.internal.editors.text.UntitledTextFileWizard; //import org.eclipse.ui.internal.Workbench; //import org.eclipse.ui.internal.WorkbenchPage; //import org.eclipse.ui.views.IViewDescriptor; import remoteeditor.ui.REPSelectWindow; import remoteeditor.ui.RepInputDialog; public class RemoteEditorAction implements IWorkbenchWindowActionDelegate { public RemoteEditorAction(){ } public void dispose() { } public void init(IWorkbenchWindow window) { } public void run(IAction action) { IWorkbench workbench = PlatformUI.getWorkbench(); UntitledTextFileWizard obj = new UntitledTextFileWizard(); obj.init(workbench, null); obj.performFinish(); /* IWorkbench workbench = PlatformUI.getWorkbench(); //Display display = workbench.getDisplay(); IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); IEditorPart editorPart = workbenchPage.getActiveEditor(); //System.out.println(editorPart.getEditorInput().toString()); IEditorInput editorinput = editorPart.getEditorInput(); workbenchPage.closeEditor(editorPart, true); System.out.println("ActionID: " + action.getId()); */ /*** 危険 ***/ // IWorkspace workspace = ResourcesPlugin.getWorkspace(); // IWorkspaceRoot root = workspace.getRoot(); // IProject project = root.getProject("Pin"); // //IProject[] project = root.getProjects(); // IContainer container = project; // System.out.println(project.getFullPath().toOSString()); // IFile file = container.getFile(new Path("hoge.txt")); // String string = "hugo"; // InputStream is = new ByteArrayInputStream(string.getBytes()); // try { // file.create(is, false, null); // } catch (CoreException e1) { // e1.printStackTrace(); // } // if(!project.exists()) { // try { // System.out.println("afro"); // project.create(null); // } catch (CoreException e) { // e.printStackTrace(); // } // } //org.eclipse.ui.part.FileEditorInput(); //File file = new File("/Users/j02054/Desktop/SessionManager/sessionmanager.sh"); //System.out.println(editorinput.getName()); //ComboSample1 combo = new ComboSample1(display); //combo.addText(); //combo.open(); //IWorkbenchPage page = workbenchWindow.getActivePage(); //editorPart = IDE.openEditor(workbenchPage,null); /* try { editorPart = workbenchPage.openEditor(editorinput, "remoteeditor.editors.RemoteEditor"); //editorPart = workbenchPage.openEditor(null, "remoteeditor.editors.RemoteEditor"); System.out.println("test"); } catch (PartInitException e) { e.printStackTrace(); }*/ } public void selectionChanged(IAction action, ISelection selection) { } }