org.eclipse.datatools.sqltools.data.internal.ui
Class DataUIPlugin

java.lang.Object
  extended by org.eclipse.core.runtime.Plugin
      extended by org.eclipse.ui.plugin.AbstractUIPlugin
          extended by org.eclipse.datatools.sqltools.data.internal.ui.DataUIPlugin
All Implemented Interfaces:
org.osgi.framework.BundleActivator

public class DataUIPlugin
extends org.eclipse.ui.plugin.AbstractUIPlugin


Field Summary
static java.lang.String PLUGIN_ID
           
 
Fields inherited from class org.eclipse.core.runtime.Plugin
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
 
Constructor Summary
DataUIPlugin()
          The constructor.
 
Method Summary
static java.lang.String getCharacterEncoding()
          Gets the encoding string from the Window->Preferences menu
static DataUIPlugin getDefault()
          Returns the shared instance.
static java.lang.String getFileContentWithEncoding(java.lang.String filePath)
          Gets the file content of a file with consideration for the character encoding for that file.
 org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String key)
          This gets a .gif from the icons folder.
 org.eclipse.jface.resource.ImageDescriptor getPngImageDescriptor(java.lang.String key)
          This gets a .png from the icons folder.
 TableDataEditorActionBarContributor getTableDataEditorContributor()
           
static boolean isGroupIDOK(org.eclipse.emf.ecore.EObject o)
           
 IExternalTableDataEditor newExternalTableDataCellEditor(ITableDataEditor editor, int columnIndex)
          returns the best matching IExternalTableDataEditor or null.
static java.lang.String parseEncoding(java.lang.String filePath)
          Parses the character encoding from an XML file.
 void setTableDataEditorContributor(TableDataEditorActionBarContributor tableDataEditorContributor)
           
 void writeLog(int severity, int code, java.lang.String message, java.lang.Throwable exception)
          Method writeLog.
 
Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, shutdown, start, startup, stop
 
Methods inherited from class org.eclipse.core.runtime.Plugin
find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PLUGIN_ID

public static final java.lang.String PLUGIN_ID
See Also:
Constant Field Values
Constructor Detail

DataUIPlugin

public DataUIPlugin()
The constructor.

Method Detail

getDefault

public static DataUIPlugin getDefault()
Returns the shared instance.


getTableDataEditorContributor

public TableDataEditorActionBarContributor getTableDataEditorContributor()

setTableDataEditorContributor

public void setTableDataEditorContributor(TableDataEditorActionBarContributor tableDataEditorContributor)

writeLog

public void writeLog(int severity,
                     int code,
                     java.lang.String message,
                     java.lang.Throwable exception)
Method writeLog.

Parameters:
severity - - the severity; one of IStatus.OK, IStatus.ERROR, IStatus.INFO, or IStatus.WARNING
code - - the plug-in-specific status code, or OK
message - - a human-readable message, localized to the current locale
exception- - a low-level exception, or null if not applicable

isGroupIDOK

public static boolean isGroupIDOK(org.eclipse.emf.ecore.EObject o)

getCharacterEncoding

public static java.lang.String getCharacterEncoding()
Gets the encoding string from the Window->Preferences menu

Returns:
the encoding string to be used for saving and loading

parseEncoding

public static java.lang.String parseEncoding(java.lang.String filePath)
Parses the character encoding from an XML file.

This method assumes that the encoding will appear on the first line of the file and that it will always be in the form below:

Parameters:
filePath - the path of the file to parse
Returns:
the encoding found, or null if not found

getFileContentWithEncoding

public static java.lang.String getFileContentWithEncoding(java.lang.String filePath)
                                                   throws java.io.FileNotFoundException,
                                                          java.io.IOException
Gets the file content of a file with consideration for the character encoding for that file. XML files normally declare an encoding in the first line of the file.

The content of the file is examined to determine the encoding. If found, then that encoding is used. If not found, then the encoding found in the workbench properties is used instead

Parameters:
filePath - the path to the file
Returns:
the content of the file in form of a string
Throws:
FileNotFoundException, - IOException if file not found, or some other problems.
java.io.FileNotFoundException
java.io.IOException

getImageDescriptor

public org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String key)
This gets a .gif from the icons folder.


getPngImageDescriptor

public org.eclipse.jface.resource.ImageDescriptor getPngImageDescriptor(java.lang.String key)
This gets a .png from the icons folder.


newExternalTableDataCellEditor

public IExternalTableDataEditor newExternalTableDataCellEditor(ITableDataEditor editor,
                                                               int columnIndex)
returns the best matching IExternalTableDataEditor or null.

Parameters:
editor - the TableDataEditor
columnIndex - the index of the sql table column
Returns:
the best fitting IExternalTableDataEditor or null if none matches