Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2009 Bestsolution.at 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: Tom Schindl<tom.schindl@bestsolution.at> - Initial API and implementation
package org.eclipse.emf.example.databinding.project.ui.rcp.handlers;
import  org.eclipse.swt.SWT;
import  org.eclipse.swt.widgets.FileDialog;
import  org.eclipse.swt.widgets.Shell;
Handles the opening of a XMI-Resource
public class OpenXMIHandler extends AbstractHandler
  public Object execute(ExecutionEvent eventthrows ExecutionException
  {
    Shell shell = (Shell)ctx.getVariable(.);
    FileDialog dialog = new FileDialog(shell, SWT.OPEN);
    String name = dialog.open();
    if (name != null)
    {
      File f = new File(name);
      try
      {
        String path = f.toURI().toURL().toString();
        path = path.replaceAll(":""#_#");
      }
      catch (PartInitException e)
      {
        e.printStackTrace();
      }
      catch (MalformedURLException e)
      {
        e.printStackTrace();
      }
    }
    return null;
  }
New to GrepCode? Check out our FAQ X