Drools :: Eclipse :: Guvnor tools 6.1.0.Beta2

org.guvnor.tools.utils
Class PlatformUtils

java.lang.Object
  extended by org.guvnor.tools.utils.PlatformUtils

public class PlatformUtils
extends Object

A set of utilities for interacting with the Eclipse platform.


Nested Class Summary
 class PlatformUtils.AuthPromptResults
          The results from a log in dialog prompt.
 
Constructor Summary
PlatformUtils()
           
 
Method Summary
 boolean authenticateForServer(String server, IWebDavClient client)
           
static org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent, int numColumns)
           
static org.eclipse.swt.widgets.Table createResourceHistoryTable(org.eclipse.swt.widgets.Composite parent)
           
static PlatformUtils getInstance()
          For convenience, we keep one instance of PlatformUtils around
static org.eclipse.core.resources.IFile getResourceFromFSPath(String location)
          Resolves a file system location to an Eclipse workspace resource.
static ResourceHistoryView getResourceHistoryView()
          Tries to find the Resource History view, attempting to open it if necessary.
static void openEditor(String contents, String name)
          Opens a read-only, in-memory editor.
 PlatformUtils.AuthPromptResults promptForAuthentication(String server)
          Prompts for user name and password for a given Guvnor repository.
static void refreshRepositoryView()
          Causes the Repository view to refresh, if it is open.
static void reportAuthenticationFailure()
          Convenience method for reporting log in failure
 void updateAuthentication(String server, String username, String password, boolean saveInfo)
           
static void updateDecoration()
          Causes the platform to update Guvnor decoration notions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformUtils

public PlatformUtils()
Method Detail

getInstance

public static PlatformUtils getInstance()
For convenience, we keep one instance of PlatformUtils around

Returns:
the PlatformUtils instance

getResourceFromFSPath

public static org.eclipse.core.resources.IFile getResourceFromFSPath(String location)
Resolves a file system location to an Eclipse workspace resource.

Parameters:
location - The file system location
Returns:
The Eclipse IFile, null if not found

createComposite

public static org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent,
                                                                int numColumns)

updateDecoration

public static void updateDecoration()
Causes the platform to update Guvnor decoration notions.


refreshRepositoryView

public static void refreshRepositoryView()
Causes the Repository view to refresh, if it is open.


getResourceHistoryView

public static ResourceHistoryView getResourceHistoryView()
                                                  throws Exception
Tries to find the Resource History view, attempting to open it if necessary.

Throws:
Exception

openEditor

public static void openEditor(String contents,
                              String name)
Opens a read-only, in-memory editor.

Parameters:
contents - The contents for the editor
name - The name of the file. Will be used to determine eclipse editor association, defaulting to text editor if no association is found

createResourceHistoryTable

public static org.eclipse.swt.widgets.Table createResourceHistoryTable(org.eclipse.swt.widgets.Composite parent)

authenticateForServer

public boolean authenticateForServer(String server,
                                     IWebDavClient client)
                              throws Exception
Throws:
Exception

updateAuthentication

public void updateAuthentication(String server,
                                 String username,
                                 String password,
                                 boolean saveInfo)
                          throws Exception
Throws:
Exception

reportAuthenticationFailure

public static void reportAuthenticationFailure()
Convenience method for reporting log in failure


promptForAuthentication

public PlatformUtils.AuthPromptResults promptForAuthentication(String server)
Prompts for user name and password for a given Guvnor repository.

Parameters:
server - The repository for log in
Returns:
The dialog results. Includes whether the user decided to save the user name and password in the platform's key ring. Null if the user cancels the dialog.

Drools :: Eclipse :: Guvnor tools 6.1.0.Beta2

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.