org.eclipse.ui.win32_3.2.200.v20110928-1505

16:48:30.042 INFO  jd.cli.Main - Decompiling org.eclipse.ui.win32_3.2.200.v20110928-1505.jar
package org.eclipse.ui.internal.editorsupport.win32;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;

class OleEditor$1
  implements IResourceChangeListener
{
  final OleEditor this$0;
  
  OleEditor$1(OleEditor paramOleEditor)
  {
    this$0 = paramOleEditor;
  }
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    IResourceDelta mainDelta = event.getDelta();
    if (mainDelta == null) {
      return;
    }
    IResourceDelta affectedElement = mainDelta.findMember(OleEditor.access$0(this$0)
      .getFullPath());
    if (affectedElement != null) {
      processDelta(affectedElement);
    }
  }
  
  private boolean processDelta(IResourceDelta delta)
  {
    Runnable changeRunnable = null;
    switch (delta.getKind())
    {
    case 2: 
      if ((0x2000 & delta.getFlags()) != 0) {
        changeRunnable = new OleEditor.2(this, delta);
      } else {
        changeRunnable = new OleEditor.3(this);
      }
      break;
    }
    if (changeRunnable != null) {
      OleEditor.access$2(this$0, changeRunnable);
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleEditor.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.editorsupport.win32;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;

class OleEditor$2
  implements Runnable
{
  final OleEditor.1 this$1;
  private final IResourceDelta val$delta;
  
  OleEditor$2(OleEditor.1 param1, IResourceDelta paramIResourceDelta)
  {
    this$1 = param1;val$delta = paramIResourceDelta;
  }
  
  public void run()
  {
    IPath path = val$delta.getMovedToPath();
    IFile newFile = val$delta.getResource().getWorkspace()
      .getRoot().getFile(path);
    if (newFile != null) {
      OleEditor.access$1(OleEditor.1.access$0(this$1), newFile);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleEditor.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.editorsupport.win32;

import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartSite;

class OleEditor$3
  implements Runnable
{
  final OleEditor.1 this$1;
  
  OleEditor$3(OleEditor.1 param1)
  {
    this$1 = param1;
  }
  
  public void run()
  {
    access$0this$1).sourceDeleted = true;
    OleEditor.1.access$0(this$1).getSite().getPage().closeEditor(OleEditor.1.access$0(this$1), 
      true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleEditor.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.editorsupport.win32;

import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;

class OleEditor$4
  implements IPartListener
{
  final OleEditor this$0;
  
  OleEditor$4(OleEditor paramOleEditor)
  {
    this$0 = paramOleEditor;
  }
  
  public void partActivated(IWorkbenchPart part)
  {
    OleEditor.access$3(this$0, part);
  }
  
  public void partBroughtToTop(IWorkbenchPart part) {}
  
  public void partClosed(IWorkbenchPart part) {}
  
  public void partOpened(IWorkbenchPart part) {}
  
  public void partDeactivated(IWorkbenchPart part)
  {
    OleEditor.access$4(this$0, part);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleEditor.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.editorsupport.win32;

import org.eclipse.swt.ole.win32.OleClientSite;

class OleEditor$5
  implements Runnable
{
  final OleEditor this$0;
  
  OleEditor$5(OleEditor paramOleEditor)
  {
    this$0 = paramOleEditor;
  }
  
  public void run()
  {
    OleEditor.access$5(this$0).exec(6, 
      1, null, null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleEditor.5
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.editorsupport.win32;

import java.io.File;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.ole.win32.OleClientSite;

class OleEditor$6
  implements Runnable
{
  final OleEditor this$0;
  private final IProgressMonitor val$monitor;
  
  OleEditor$6(OleEditor paramOleEditor, IProgressMonitor paramIProgressMonitor)
  {
    this$0 = paramOleEditor;val$monitor = paramIProgressMonitor;
  }
  
  public void run()
  {
    if (!this$0.sourceChanged)
    {
      int result = OleEditor.access$5(this$0).queryStatus(3);
      if ((result & 0x2) != 0)
      {
        result = OleEditor.access$5(this$0).exec(3, 
          1, null, null);
        if (result == 0)
        {
          try
          {
            OleEditor.access$0(this$0).refreshLocal(0, 
              val$monitor);
          }
          catch (CoreException localCoreException1) {}
          return;
        }
        OleEditor.access$8(this$0, OleEditor.access$6(), 
          OleEditor.access$7() + String.valueOf(result));
        return;
      }
    }
    if (OleEditor.access$10(this$0, OleEditor.access$9(this$0))) {
      try
      {
        if (OleEditor.access$0(this$0) == null) {
          return;
        }
        OleEditor.access$0(this$0).refreshLocal(0, val$monitor);
      }
      catch (CoreException localCoreException2) {}
    } else {
      OleEditor.access$8(this$0, OleEditor.access$11(), OleEditor.access$12() + 
        OleEditor.access$9(this$0).getName());
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleEditor.6
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.editorsupport.win32;

import java.io.File;
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.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.dialogs.SaveAsDialog;
import org.eclipse.ui.ide.ResourceUtil;

class OleEditor$7
  extends WorkspaceModifyOperation
{
  final OleEditor this$0;
  
  OleEditor$7(OleEditor paramOleEditor)
  {
    this$0 = paramOleEditor;
  }
  
  public void execute(IProgressMonitor monitor)
    throws CoreException
  {
    SaveAsDialog dialog = new SaveAsDialog(OleEditor.access$13(this$0).getShell());
    IFile sFile = ResourceUtil.getFile(this$0.getEditorInput());
    if (sFile != null)
    {
      dialog.setOriginalFile(sFile);
      dialog.open();
      
      IPath newPath = dialog.getResult();
      if (newPath == null) {
        return;
      }
      if (dialog.getReturnCode() == 0)
      {
        String projectName = newPath.segment(0);
        newPath = newPath.removeFirstSegments(1);
        IProject project = OleEditor.access$0(this$0).getWorkspace().getRoot()
          .getProject(projectName);
        newPath = project.getLocation().append(newPath);
        File newFile = newPath.toFile();
        if (OleEditor.access$10(this$0, newFile))
        {
          IFile newResource = OleEditor.access$0(this$0).getWorkspace().getRoot()
            .getFileForLocation(newPath);
          if (newResource != null)
          {
            OleEditor.access$1(this$0, newResource);
            newResource.refreshLocal(0, 
              monitor);
          }
        }
        else
        {
          OleEditor.access$8(this$0, OleEditor.access$11(), OleEditor.access$12() + 
            newFile.getName());
          return;
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleEditor.7
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.editorsupport.win32;

import org.eclipse.swt.ole.win32.OleClientSite;
import org.eclipse.swt.widgets.Display;

class OleEditor$8
  implements Runnable
{
  final OleEditor this$0;
  
  OleEditor$8(OleEditor paramOleEditor)
  {
    this$0 = paramOleEditor;
  }
  
  public void run()
  {
    if ((OleEditor.access$5(this$0) == null) || (OleEditor.access$0(this$0) == null)) {
      return;
    }
    boolean dirty = this$0.isDirty();
    if (OleEditor.access$14(this$0) != dirty)
    {
      OleEditor.access$15(this$0, dirty);
      OleEditor.access$16(this$0, 257);
    }
    OleEditor.access$5(this$0).getDisplay().timerExec(1000, this);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleEditor.8
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.editorsupport.win32;

import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
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.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.OleClientSite;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.ole.win32.Variant;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.dialogs.SaveAsDialog;
import org.eclipse.ui.ide.ResourceUtil;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.part.FileEditorInput;

public class OleEditor
  extends EditorPart
{
  private IResourceChangeListener resourceListener = new IResourceChangeListener()
  {
    public void resourceChanged(IResourceChangeEvent event)
    {
      IResourceDelta mainDelta = event.getDelta();
      if (mainDelta == null) {
        return;
      }
      IResourceDelta affectedElement = mainDelta.findMember(resource
        .getFullPath());
      if (affectedElement != null) {
        processDelta(affectedElement);
      }
    }
    
    private boolean processDelta(IResourceDelta delta)
    {
      Runnable changeRunnable = null;
      switch (delta.getKind())
      {
      case 2: 
        if ((0x2000 & delta.getFlags()) != 0) {
          changeRunnable = new OleEditor.2(this, delta);
        } else {
          changeRunnable = new OleEditor.3(this);
        }
        break;
      }
      if (changeRunnable != null) {
        OleEditor.this.update(changeRunnable);
      }
      return true;
    }
  };
  private OleFrame clientFrame;
  private OleClientSite clientSite;
  private File source;
  private IFile resource;
  private Image oleTitleImage;
  boolean sourceDeleted = false;
  boolean sourceChanged = false;
  private boolean clientActive = false;
  private boolean oleActivated = false;
  private IPartListener partListener = new IPartListener()
  {
    public void partActivated(IWorkbenchPart part)
    {
      OleEditor.this.activateClient(part);
    }
    
    public void partBroughtToTop(IWorkbenchPart part) {}
    
    public void partClosed(IWorkbenchPart part) {}
    
    public void partOpened(IWorkbenchPart part) {}
    
    public void partDeactivated(IWorkbenchPart part)
    {
      OleEditor.this.deactivateClient(part);
    }
  };
  private static final String RENAME_ERROR_TITLE = OleMessages.getString("OleEditor.errorSaving");
  private static final String OLE_EXCEPTION_TITLE = OleMessages.getString("OleEditor.oleExceptionTitle");
  private static final String OLE_EXCEPTION_MESSAGE = OleMessages.getString("OleEditor.oleExceptionMessage");
  private static final String OLE_CREATE_EXCEPTION_MESSAGE = OleMessages.getString("OleEditor.oleCreationExceptionMessage");
  private static final String OLE_CREATE_EXCEPTION_REASON = OleMessages.getString("OleEditor.oleCreationExceptionReason");
  private static final String SAVE_ERROR_TITLE = OleMessages.getString("OleEditor.savingTitle");
  private static final String SAVE_ERROR_MESSAGE = OleMessages.getString("OleEditor.savingMessage");
  
  private void activateClient(IWorkbenchPart part)
  {
    if (part == this)
    {
      oleActivate();
      clientActive = true;
    }
  }
  
  public void createPartControl(Composite parent)
  {
    clientFrame = new OleFrame(parent, 4096);
    clientFrame.setBackground(JFaceColors.getBannerBackground(clientFrame
      .getDisplay()));
    
    initializeWorkbenchMenus();
    
    createClientSite();
    updateDirtyFlag();
  }
  
  private void createClientSite()
  {
    if ((clientFrame == null) || (clientFrame.isDisposed())) {
      return;
    }
    try
    {
      clientSite = new OleClientSite(clientFrame, 0, source);
    }
    catch (SWTException exception)
    {
      IStatus errorStatus = new Status(4, 
        WorkbenchPlugin.PI_WORKBENCH, 4, 
        OLE_CREATE_EXCEPTION_REASON, exception);
      
      ErrorDialog.openError(null, OLE_EXCEPTION_TITLE, OLE_CREATE_EXCEPTION_MESSAGE, errorStatus);
      return;
    }
    clientSite.setBackground(JFaceColors.getBannerBackground(clientFrame
      .getDisplay()));
  }
  
  private void deactivateClient(IWorkbenchPart part)
  {
    if ((part == this) && (clientActive))
    {
      if (clientSite != null) {
        clientSite.deactivateInPlaceClient();
      }
      clientActive = false;
      oleActivated = false;
    }
  }
  
  private void displayErrorDialog(String title, String message)
  {
    Shell parent = null;
    if (getClientSite() != null) {
      parent = getClientSite().getShell();
    }
    MessageDialog.openError(parent, title, message);
  }
  
  public void dispose()
  {
    if (resource != null)
    {
      ResourcesPlugin.getWorkspace().removeResourceChangeListener(
        resourceListener);
      resource = null;
    }
    if (oleTitleImage != null)
    {
      oleTitleImage.dispose();
      oleTitleImage = null;
    }
    if ((getSite() != null) && (getSite().getPage() != null)) {
      getSite().getPage().removePartListener(partListener);
    }
  }
  
  public void doPrint()
  {
    if (clientSite == null) {
      return;
    }
    BusyIndicator.showWhile(clientSite.getDisplay(), new Runnable()
    {
      public void run()
      {
        clientSite.exec(6, 
          1, null, null);
      }
    });
  }
  
  public void doSave(IProgressMonitor monitor)
  {
    if (clientSite == null) {
      return;
    }
    BusyIndicator.showWhile(clientSite.getDisplay(), new Runnable()
    {
      private final IProgressMonitor val$monitor;
      
      public void run()
      {
        if (!sourceChanged)
        {
          int result = clientSite.queryStatus(3);
          if ((result & 0x2) != 0)
          {
            result = clientSite.exec(3, 
              1, null, null);
            if (result == 0)
            {
              try
              {
                resource.refreshLocal(0, 
                  val$monitor);
              }
              catch (CoreException localCoreException1) {}
              return;
            }
            OleEditor.this.displayErrorDialog(OleEditor.OLE_EXCEPTION_TITLE, 
              OleEditor.OLE_EXCEPTION_MESSAGE + String.valueOf(result));
            return;
          }
        }
        if (OleEditor.this.saveFile(source)) {
          try
          {
            if (resource == null) {
              return;
            }
            resource.refreshLocal(0, val$monitor);
          }
          catch (CoreException localCoreException2) {}
        } else {
          OleEditor.this.displayErrorDialog(OleEditor.SAVE_ERROR_TITLE, OleEditor.SAVE_ERROR_MESSAGE + 
            source.getName());
        }
      }
    });
  }
  
  public void doSaveAs()
  {
    if (clientSite == null) {
      return;
    }
    WorkspaceModifyOperation op = saveNewFileOperation();
    Shell shell = clientSite.getShell();
    try
    {
      new ProgressMonitorDialog(shell).run(false, true, op);
    }
    catch (InterruptedException localInterruptedException) {}catch (InvocationTargetException invocationException)
    {
      MessageDialog.openError(shell, RENAME_ERROR_TITLE, 
        invocationException.getTargetException().getMessage());
    }
  }
  
  public OleClientSite getClientSite()
  {
    return clientSite;
  }
  
  public File getSourceFile()
  {
    return source;
  }
  
  private void handleWord()
  {
    OleAutomation dispInterface = new OleAutomation(clientSite);
    
    int[] appId = dispInterface
      .getIDsOfNames(new String[] { "Application" });
    if (appId != null)
    {
      Variant pVarResult = dispInterface.getProperty(appId[0]);
      if (pVarResult != null)
      {
        OleAutomation application = pVarResult.getAutomation();
        int[] dispid = application
          .getIDsOfNames(new String[] { "DisplayScrollBars" });
        if (dispid != null)
        {
          Variant rgvarg = new Variant(true);
          application.setProperty(dispid[0], rgvarg);
        }
        application.dispose();
      }
    }
    dispInterface.dispose();
  }
  
  public void init(IEditorSite site, IEditorInput input)
    throws PartInitException
  {
    validatePathEditorInput(input);
    
    setSite(site);
    setInputWithNotify(input);
    
    setPartName(input.getName());
    setTitleToolTip(input.getToolTipText());
    ImageDescriptor desc = input.getImageDescriptor();
    if (desc != null)
    {
      oleTitleImage = desc.createImage();
      setTitleImage(oleTitleImage);
    }
    site.getPage().addPartListener(partListener);
  }
  
  private boolean validatePathEditorInput(IEditorInput input)
    throws PartInitException
  {
    IPathEditorInput pathEditorInput = (IPathEditorInput)input.getAdapter(IPathEditorInput.class);
    if (pathEditorInput == null) {
      throw new PartInitException(OleMessages.format(
        "OleEditor.invalidInput", new Object[] { input }));
    }
    IPath path = pathEditorInput.getPath();
    if (!new File(path.toOSString()).exists()) {
      throw new PartInitException(
      
        OleMessages.format(
        "OleEditor.noFileInput", new Object[] { path.toOSString() }));
    }
    return true;
  }
  
  protected void initializeWorkbenchMenus()
  {
    if ((clientFrame == null) || (clientFrame.isDisposed())) {
      return;
    }
    Shell shell = clientFrame.getShell();
    Menu menuBar = shell.getMenuBar();
    if (menuBar == null)
    {
      menuBar = new Menu(shell, 2);
      shell.setMenuBar(menuBar);
    }
    MenuItem[] windowMenu = new MenuItem[1];
    MenuItem[] fileMenu = new MenuItem[1];
    Vector containerItems = new Vector();
    
    IWorkbenchWindow window = getSite().getWorkbenchWindow();
    for (int i = 0; i < menuBar.getItemCount(); i++)
    {
      MenuItem item = menuBar.getItem(i);
      String id = "";
      if ((item.getData() instanceof IMenuManager)) {
        id = ((IMenuManager)item.getData()).getId();
      }
      if (id.equals("file")) {
        fileMenu[0] = item;
      } else if (id.equals("window")) {
        windowMenu[0] = item;
      } else if (window.isApplicationMenu(id)) {
        containerItems.addElement(item);
      }
    }
    MenuItem[] containerMenu = new MenuItem[containerItems.size()];
    containerItems.copyInto(containerMenu);
    clientFrame.setFileMenus(fileMenu);
    clientFrame.setContainerMenus(containerMenu);
    clientFrame.setWindowMenus(windowMenu);
  }
  
  public boolean isDirty()
  {
    return (clientSite != null) && (clientSite.isDirty());
  }
  
  public boolean isSaveAsAllowed()
  {
    return true;
  }
  
  public boolean isSaveNeeded()
  {
    return isDirty();
  }
  
  private boolean saveFile(File file)
  {
    File tempFile = new File(file.getAbsolutePath() + ".tmp");
    file.renameTo(tempFile);
    boolean saved = false;
    if ((OLE.isOleFile(file)) || (usesStorageFiles(clientSite.getProgramID()))) {
      saved = clientSite.save(file, true);
    } else {
      saved = clientSite.save(file, false);
    }
    if (saved)
    {
      tempFile.delete();
      return true;
    }
    tempFile.renameTo(file);
    return false;
  }
  
  private WorkspaceModifyOperation saveNewFileOperation()
  {
    new WorkspaceModifyOperation()
    {
      public void execute(IProgressMonitor monitor)
        throws CoreException
      {
        SaveAsDialog dialog = new SaveAsDialog(clientFrame.getShell());
        IFile sFile = ResourceUtil.getFile(getEditorInput());
        if (sFile != null)
        {
          dialog.setOriginalFile(sFile);
          dialog.open();
          
          IPath newPath = dialog.getResult();
          if (newPath == null) {
            return;
          }
          if (dialog.getReturnCode() == 0)
          {
            String projectName = newPath.segment(0);
            newPath = newPath.removeFirstSegments(1);
            IProject project = resource.getWorkspace().getRoot()
              .getProject(projectName);
            newPath = project.getLocation().append(newPath);
            File newFile = newPath.toFile();
            if (OleEditor.this.saveFile(newFile))
            {
              IFile newResource = resource.getWorkspace().getRoot()
                .getFileForLocation(newPath);
              if (newResource != null)
              {
                OleEditor.this.sourceChanged(newResource);
                newResource.refreshLocal(0, 
                  monitor);
              }
            }
            else
            {
              OleEditor.this.displayErrorDialog(OleEditor.SAVE_ERROR_TITLE, OleEditor.SAVE_ERROR_MESSAGE + 
                newFile.getName());
              return;
            }
          }
        }
      }
    };
  }
  
  public void setFocus() {}
  
  private void oleActivate()
  {
    if ((clientSite == null) || (clientFrame == null) || 
      (clientFrame.isDisposed())) {
      return;
    }
    if (!oleActivated)
    {
      clientSite.doVerb(-1);
      oleActivated = true;
      String progId = clientSite.getProgramID();
      if ((progId != null) && (progId.startsWith("Word.Document"))) {
        handleWord();
      }
    }
  }
  
  protected void setInputWithNotify(IEditorInput input)
  {
    IPathEditorInput pathEditorInput = (IPathEditorInput)input.getAdapter(IPathEditorInput.class);
    if (pathEditorInput != null) {
      source = new File(pathEditorInput.getPath().toOSString());
    }
    if ((input instanceof IFileEditorInput))
    {
      if (resource == null) {
        ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceListener);
      }
      resource = ((IFileEditorInput)input).getFile();
    }
    else if (resource != null)
    {
      ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceListener);
      resource = null;
    }
    super.setInputWithNotify(input);
  }
  
  private static boolean usesStorageFiles(String progID)
  {
    return (progID != null) && ((progID.startsWith("Word.", 0)) || (progID.startsWith("MSGraph", 0)) || (progID.startsWith("PowerPoint", 0)) || (progID.startsWith("Excel", 0)));
  }
  
  private void sourceChanged(IFile newFile)
  {
    FileEditorInput newInput = new FileEditorInput(newFile);
    setInputWithNotify(newInput);
    sourceChanged = true;
    setPartName(newInput.getName());
  }
  
  public boolean isSaveOnCloseNeeded()
  {
    return (!sourceDeleted) && (super.isSaveOnCloseNeeded());
  }
  
  private void update(Runnable runnable)
  {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
    if ((windows != null) && (windows.length > 0))
    {
      Display display = windows[0].getShell().getDisplay();
      display.asyncExec(runnable);
    }
    else
    {
      runnable.run();
    }
  }
  
  private boolean isDirty = false;
  
  private void updateDirtyFlag()
  {
    Runnable dirtyFlagUpdater = new Runnable()
    {
      public void run()
      {
        if ((clientSite == null) || (resource == null)) {
          return;
        }
        boolean dirty = isDirty();
        if (isDirty != dirty)
        {
          isDirty = dirty;
          firePropertyChange(257);
        }
        clientSite.getDisplay().timerExec(1000, this);
      }
    };
    dirtyFlagUpdater.run();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleEditor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.editorsupport.win32;

import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class OleMessages
{
  private static final String RESOURCE_BUNDLE = "org.eclipse.ui.internal.editorsupport.win32.messages";
  private static ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.ui.internal.editorsupport.win32.messages");
  
  public static String format(String key, Object[] args)
  {
    return MessageFormat.format(getString(key), args);
  }
  
  public static String getString(String key)
  {
    try
    {
      return bundle.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return key;
  }
  
  public static String getString(String key, String def)
  {
    try
    {
      return bundle.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return def;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.editorsupport.win32.OleMessages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
1

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd