Class Activator
- All Implemented Interfaces:
IWebServiceEngine
,IKStringInfoProviderHolder
,org.osgi.framework.BundleActivator
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
Debug setting for Undo.static final PropFactory
The Designer property factory.static final PropMgr
The Property Manager for the Designer.static final GProp<?>[]
The empty array.static IFileURLResolver
Interface used to resolve URL's to files for the Designer.static final org.eclipse.core.resources.IResource[]
An empty resource array.static final String
The plug-in ID: "com.iizigo" as in package name for this class.static final Class<?>
The resource class.protected static final long
The serial UID.static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
The resource setup.static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
static final PropertyEditorSetup
Fields inherited from class org.eclipse.core.runtime.Plugin
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds required options for the server when launched from inside iiziGo.static boolean
areAllResourceBased
(GProp<?>[] props) Checks if the properties only contains resources.static void
centerDialog
(org.eclipse.swt.widgets.Shell shell) Centers a dialog box Shell over it's parent.static int
checkEnabledOrStarting
(org.eclipse.swt.widgets.Shell shell, org.eclipse.jface.wizard.IWizard wizard) Call this function in e.g.static int
checkEnabledOrStarting
(org.eclipse.swt.widgets.Shell shell, org.eclipse.jface.wizard.IWizard wizard, Runnable runnable) Call this function in e.g.void
Configures a Http(s)URLConnection for proxy information.static PropMgr
Creates a Property Manager for the Designer connection with JavaScript.static org.eclipse.core.runtime.Status
createErrorStatus
(String msg) Creates an error status.static org.eclipse.core.runtime.Status
createErrorStatus
(String msg, Throwable e) Creates an error status.static org.eclipse.core.runtime.Status
createInfoStatus
(String msg) Creates an informational status.static byte[]
createInputData
(PropCnr container) Creates InputStream byte array data from a property container.static InputStream
createInputStream
(PropCnr container) Creates an InputStream from a property container.createKStringInfoProvider
(GProp<?> anyProp, boolean shouldResolve) Creates an IKStringInfoProvider for a property.static PropFactory
Creates a new Server property factory.static PropMgr
createServerPropMgr
(boolean hasJSClient) Creates a new Property Manager for a Server simulation.static org.eclipse.core.runtime.Status
Creates a warning status.static DesignerProp
Converts the DesignerProp from the data container to the FilePropCnr one, if it refers to a file.static GProp<?>
dataToFile
(GProp<?> gp) Converts the property to get the FilePropCnr instead of the data container property.static GProp<?>[]
dataToFile
(GProp<?>[] props) Converts the array of properties to get the FilePropCnr instead of the data container property.static void
Disposes of the clipboard.static int
errorMessageBox
(org.eclipse.swt.widgets.Shell shell, String title, String msg, org.eclipse.core.runtime.CoreException e) Shows an error message box from any thread for an exception.static DesignerProp
Converts the property to get the data container property instead of a FilePropCnr.static GProp<?>
fileToData
(GProp<?> gp) Converts the property to get the data container property instead of a FilePropCnr.static GProp<?>[]
fileToData
(GProp<?>[] props) Converts the array of properties to get the data container property instead of a FilePropCnr.static String
getByteSize
(long size) Gets a size string in bytes.static org.eclipse.swt.dnd.Clipboard
Gets the clip board instance for the plug-in.static org.osgi.service.prefs.Preferences
Gets the iiziGo Configuration Preferences, not stored in the workspace, but with the Eclipse installation.Gets the classpath entries for the IIZI Core.Gets the database directory to use.Gets the database directory candidate to use.static ExecutorService
Gets the executor service.static org.eclipse.core.resources.IFile
getFirstSelectedFile
(org.eclipse.jface.viewers.IStructuredSelection selection) Gets the first selected file resource.static DesignerProp
Gets the first currently selected property.static DesignerProp
getFirstSelectedProperty
(org.eclipse.jface.viewers.ISelection sel) Gets the first currently selected property.static Activator
Returns the shared instance.static int
Returns the current HTTP port for the internal web server.static File
Gets the JDBC drivers directory, a user local directory that always should exist.Retrieves the KStringInfoProvider.getKStringInfoProvider
(GProp<?> anyProp) Retrieves the KStringInfoProvider.Gets the classpath entries for IIZI Plug-ins.static PropCnr[]
getPropCnrs
(ArrayList<DesignerProp> list) Gets a PropCnr's from a DesignerProp list.Gets a Java Proxy instance for an URL.static PropCnr
getRootProperty
(String name) Gets a root property from a registered name.static IRuntimeBuilder
Gets the runtime creation builder.static GProp<?>[]
getSelectedGProps
(org.eclipse.jface.viewers.ISelection sel) Gets a list of all GProp's for DesignerProp's in a selection that should be used in e.g.static org.eclipse.core.resources.IProject
Gets the currently selected project.static org.eclipse.core.resources.IProject
getSelectedProject
(org.eclipse.jface.viewers.ISelection sel) Gets the currently selected project.static ArrayList<DesignerProp>
getSelectedProps
(org.eclipse.jface.viewers.ISelection sel) Gets a list of all DesignerProp's in a selection that should be used in e.g.getSelectedRawGProps
(org.eclipse.jface.viewers.ISelection sel) Gets a list of all RAW GProp's without DesignerProp's in a selection that should be used in e.g.static org.eclipse.core.resources.IResource[]
Returns the resource selection from the LocalSelectionTransfer.static org.eclipse.core.resources.IResource[]
getSelectedResources
(org.eclipse.jface.viewers.ISelection selection) Returns the resource selection.static org.eclipse.core.resources.IResource[]
getSelectedResources
(org.eclipse.jface.viewers.IStructuredSelection selection) Returns the resource selection.static PropFactory
Gets the Server property factory.static org.eclipse.swt.widgets.Shell
Gets a shell.static File
getStateLocationFile
(String fileName) Gets a file in the state location area.static File
Gets the user's private directory, normally where the other directories are placed, such as the JDBC drivers "jdbc-drivers", the database "db", etc.static Worker
Gets the Worker.static boolean
Returns if IIZI is enabled or not.static boolean
isResourceBased
(GProp<?> gp) Checks if the property contains a resource.static boolean
Checks if IIZI is currently starting up.static PropCnr
loadPropertiesFile
(File file) Loads a properties file.static PropCnr
loadPropertiesFile
(URL url) Loads a properties file.static PropCnr
loadPropertiesFile
(org.eclipse.core.resources.IFile file) Loads a properties file.static void
mergeStatus
(org.eclipse.core.runtime.MultiStatus status, org.eclipse.core.runtime.IStatus toMerge) Adds the given status to the list of problems.static int
messageBox
(String title, String msg, int style) Shows a message box.static int
messageBox
(org.eclipse.swt.widgets.Shell shell, String title, String msg, int style) Shows a message box.static void
messageBoxAsync
(String title, String msg, int style) Shows a message box asynchronously in the SWT Thread.static void
Opens an error dialog if necessary.static void
Opens an error dialog if necessary.static void
Opens an error dialog if necessary.static void
Opens an error dialog if necessary.static void
Opens an error dialog if necessary.static void
openError
(org.eclipse.swt.widgets.Shell shell, String genericTitle, String error, Throwable exception) Opens an error dialog if necessary.static void
openError
(org.eclipse.swt.widgets.Shell shell, String genericTitle, org.eclipse.core.runtime.CoreException exception) Opens an error dialog if necessary.static void
openError
(org.eclipse.swt.widgets.Shell shell, String genericTitle, org.eclipse.core.runtime.IStatus status) Opens an error dialog if necessary.static void
openExceptionDetailsError
(org.eclipse.swt.widgets.Shell shell, String genericTitle, org.eclipse.core.runtime.IStatus status) Opens an error dialog if necessary.static void
Opens an URL in an external browser.static void
prepareFolder
(org.eclipse.core.resources.IFolder folder, org.eclipse.core.runtime.IProgressMonitor monitor) Prepares a folder, i.e.static void
refresh
(Collection<DesignerProp> dps) Refreshes the workspace for the specified properties.static boolean
registerRootProperty
(String name, PropCnr root) Registers a root property container not being a Java or Module root, e.g.static void
savePropertiesFile
(PropCnr container, org.eclipse.core.resources.IFile file, org.eclipse.core.runtime.IProgressMonitor monitor) Saves a properties file.static void
setEnabled
(boolean isEnabled) Assigns the enabled state of IIZI.static void
Sets the runtime creation builder.void
start
(org.osgi.framework.BundleContext context) Starts up the iiziGo plug-in bundle.static int
statusMessageBox
(org.eclipse.swt.widgets.Shell shell, String title, String msg, org.eclipse.core.runtime.IStatus status) Shows a message box from any thread.void
stop
(org.osgi.framework.BundleContext context) static int
threadMessageBox
(String title, String msg, int style) Shows a message box from another thread.static int
threadMessageBox
(org.eclipse.swt.widgets.Shell shell, String title, String msg, int style) Shows a message box from another thread.static boolean
unregisterRootProperty
(String name, PropCnr root) Unregisters a root property container not being a Java or Module root, e.g.Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, initializeImageRegistry, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startup
Methods inherited from class org.eclipse.core.runtime.Plugin
find, find, getBundle, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toString
Field Details
serialVersionUID
protected static final long serialVersionUIDThe serial UID.- See Also:
PLUGIN_ID
The plug-in ID: "com.iizigo" as in package name for this class.- See Also:
DEBUG_UNDO
public static final boolean DEBUG_UNDODebug setting for Undo.- See Also:
NO_RESOURCES
public static final org.eclipse.core.resources.IResource[] NO_RESOURCESAn empty resource array.EMPTY_GPROPS
The empty array.RESOURCE_CLASS
The resource class.designerFactory
The Designer property factory.designerPropertyManager
The Property Manager for the Designer.setupPanel
The resource setup.setupSelector
setupStyle
setupImage
setupVS
setupResource
setupTextTable
setupModuleApp
setupServerConfig
setupServerMonitor
setupAppDist
setupPush
setupPWA
setupRuntimeBuilder
setupFont
fileURLResolver
Interface used to resolve URL's to files for the Designer. In other products, the same URL is returned unchanged.
Constructor Details
Activator
public Activator()The Eclipse constructor.
Method Details
isEnabled
public static boolean isEnabled()Returns if IIZI is enabled or not.- Returns:
- true if IIZI is enabled, false otherwise.
isStartingUp
public static boolean isStartingUp()Checks if IIZI is currently starting up.- Returns:
- true if IIZI is still starting up, false if ready.
setEnabled
public static void setEnabled(boolean isEnabled) Assigns the enabled state of IIZI.- Parameters:
isEnabled
- The enabled state.- Throws:
IllegalStateException
- If state is already set.
checkEnabledOrStarting
public static int checkEnabledOrStarting(org.eclipse.swt.widgets.Shell shell, org.eclipse.jface.wizard.IWizard wizard) Call this function in e.g. wizards to check if IIZI is enabled.A dialog box showing that IIZI is not enabled or starting up.
- Parameters:
shell
- The shell.wizard
- The wizard.- Returns:
- 1 if enabled, 0 (zero) if disabled, -1 if starting up.
checkEnabledOrStarting
public static int checkEnabledOrStarting(org.eclipse.swt.widgets.Shell shell, org.eclipse.jface.wizard.IWizard wizard, Runnable runnable) Call this function in e.g. wizards to check if IIZI is enabled.A dialog box showing that IIZI is not enabled or starting up will be shown, then the runnable is called. The runnable should close e.g. the wizard in question.
The runnable will be called in the SWT thread in the "next cycle".
- Parameters:
shell
- The shell.wizard
- The wizard.runnable
- Optional runnable to call. If non-null, the runnable must close the wizard.- Returns:
- 1 if enabled, 0 (zero) if disabled, -1 if starting up.
getRuntimeCreation
Gets the runtime creation builder.- Returns:
- The runtime builder instance, null if not yet set.
setRuntimeCreation
Sets the runtime creation builder. Do not call this method, it is used by the framework.- Parameters:
impl
- The runtime builder.
getCoreClasspathEntries
Gets the classpath entries for the IIZI Core.- Returns:
- The list of core class path entry URL's.
getPluginClasspathEntries
Gets the classpath entries for IIZI Plug-ins. These entries must also include the Server class entries.- Returns:
- The list of plugin class path entry URL's.
getUserPrivateDirectory
Gets the user's private directory, normally where the other directories are placed, such as the JDBC drivers "jdbc-drivers", the database "db", etc.- Returns:
- The User's private directory "~/.iizi/db" in canonical form, the directory is always present.
getJDBCDriversDir
Gets the JDBC drivers directory, a user local directory that always should exist.- Returns:
- The canonical form of the directory "~/.iizi/jdbc-drivers".
getDatabaseDirectoryCandidate
Gets the database directory candidate to use. This call also updates the default value "db_dir" in the Eclipse preference store, if not set.- Returns:
- The directory to use.
getDatabaseDirectory
Gets the database directory to use. The database directory is created if not present.- Returns:
- The directory to use.
- Throws:
IOException
- If the database directory failed to be created. In case of an exception, a SEVERE error is logged prior to returning from this method, so no additional logging is required.
addServerLaunchOptions
public void addServerLaunchOptions(ArrayList<String> args) throws org.eclipse.core.runtime.CoreException Adds required options for the server when launched from inside iiziGo.- Parameters:
args
- The list of server arguments.- Throws:
org.eclipse.core.runtime.CoreException
- For errors.
getByteSize
Gets a size string in bytes.- Parameters:
size
- The size.- Returns:
- The string formatted as "#,##0 bytes".
openURL
Opens an URL in an external browser. If the browser cannot be opened, a message box is displayed. This method may be called from any thread.- Parameters:
shell
- The shell owner, null for none.url
- The URL to display.
start
Starts up the iiziGo plug-in bundle.If this method throws an exception, it is taken as an indication that plug-in initialization has failed; as a result, the plug-in will not be activated; moreover, the plug-in will be marked as disabled and ineligible for activation for the duration.
Note 1: This method is automatically invoked by the platform the first time any code in the plug-in is executed.
Note 2: This method is intended to perform simple initialization of the plug-in environment. The platform may terminate initializers that do not complete in a timely fashion.
Note 3: The class loader typically has monitors acquired during invocation of this method. It is strongly recommended that this method avoid synchronized blocks or other thread locking mechanisms, as this would lead to deadlock vulnerability.
Note 4: The supplied bundle context represents the plug-in to the OSGi framework. For security reasons, it is strongly recommended that this object should not be divulged.
Note 5: This method and the stop(BundleContext) may be called from separate threads, but the OSGi framework ensures that both methods will not be called simultaneously.
- Specified by:
start
in interfaceorg.osgi.framework.BundleActivator
- Overrides:
start
in classorg.eclipse.ui.plugin.AbstractUIPlugin
- Parameters:
context
- The bundle context.- Throws:
Exception
- For errors in loading the IIZI properties framework.
stop
- Specified by:
stop
in interfaceorg.osgi.framework.BundleActivator
- Overrides:
stop
in classorg.eclipse.ui.plugin.AbstractUIPlugin
- Throws:
Exception
getWorker
Gets the Worker.- Returns:
- The worker, never null.
- Throws:
IOException
- If the worker cannot be started.
createDesignerPropMgr
Creates a Property Manager for the Designer connection with JavaScript.- Returns:
- The newly created PropMgr instance using Server and JavaScript mappings.
createServerPropMgr
Creates a new Property Manager for a Server simulation.- Parameters:
hasJSClient
- Flag indicating it's a JavaScript client or not.- Returns:
- The Property Manager or null if instance failed (errors are logged already).
createNewServerPropertyFactory
Creates a new Server property factory.- Returns:
- The newly created property factory.
- Throws:
IOException
- For failures.
getServerPropertyFactory
Gets the Server property factory.- Returns:
- The server property factory, always the same instance once created.
registerRootProperty
Registers a root property container not being a Java or Module root, e.g. Terminal Sessions.- Parameters:
name
- The name.root
- The root instance.- Returns:
- true For success, false (with logged warning message) indicates name is already registered.
- Throws:
IllegalArgumentException
- If it's not a root property.
getRootProperty
Gets a root property from a registered name.- Parameters:
name
- The name.- Returns:
- The root property, or null if not registered.
unregisterRootProperty
Unregisters a root property container not being a Java or Module root, e.g. Terminal Sessions.- Parameters:
name
- The name.root
- The root instance.- Returns:
- true For success, false (with logged warning message) indicates name is not registered.
- Throws:
IllegalArgumentException
- If it's not a root property.
getStateLocationFile
Gets a file in the state location area.- Parameters:
fileName
- The file name, set to null to get the (parent) directory where state files are stored.- Returns:
- The file for the activator plugin, or null if not initialized or exiting.
getSomeShell
public static org.eclipse.swt.widgets.Shell getSomeShell()Gets a shell.- Returns:
- Some shell.
messageBoxAsync
Shows a message box asynchronously in the SWT Thread. If the call is from a non-SWT thread, a switch to the SWT thread is done.- Parameters:
title
- The title.msg
- The message.style
- The SWT style, icons, buttons, etc.
messageBox
Shows a message box. If the call is from a non-SWT thread, a switch to the SWT thread is done.- Parameters:
title
- The title.msg
- The message.style
- The SWT style, icons, buttons, etc.- Returns:
- The button selected.
messageBox
public static int messageBox(org.eclipse.swt.widgets.Shell shell, String title, String msg, int style) Shows a message box.- Parameters:
shell
- The shell (owner of message box).title
- The title.msg
- The message.style
- The SWT style, icons, buttons, etc.- Returns:
- The button selected.
threadMessageBox
Shows a message box from another thread.- Parameters:
msg
- The message.title
- The title.style
- The SWT style, icons, buttons, etc.- Returns:
- The button selected.
threadMessageBox
public static int threadMessageBox(org.eclipse.swt.widgets.Shell shell, String title, String msg, int style) Shows a message box from another thread.- Parameters:
shell
- The shell or null for none.msg
- The message.title
- The title.style
- The SWT style, icons, buttons, etc.- Returns:
- The button selected.
openError
Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.This call can be done from any thread, if not the SWT thread, it will "syncExec" to it.
- Parameters:
genericTitle
- The title, or null to use "Error".exception
- The core exception.
openError
Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.This call can be done from any thread, if not the SWT thread, it will "syncExec" to it.
- Parameters:
genericTitle
- The title, or null to use "Error".errorMsg
- Error message.
openError
public static void openError(org.eclipse.swt.widgets.Shell shell, String genericTitle, org.eclipse.core.runtime.CoreException exception) Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.This call can be done from any thread, if not the SWT thread, it will "syncExec" to it.
- Parameters:
shell
- The shell, or null to get the topmost one.genericTitle
- The title, or null to use "Error".exception
- The core exception.
openError
Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.This call can be done from any thread, if not the SWT thread, it will "syncExec" to it.
- Parameters:
genericTitle
- The title, or null to use "Error".status
- The status.
openError
Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.- Parameters:
genericTitle
- The title, or null to use "Error".error
- The error message.exception
- The exception.
openError
public static void openError(org.eclipse.swt.widgets.Shell shell, String genericTitle, String error) Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.This call can be done from any thread, if not the SWT thread, it will "syncExec" to it.
- Parameters:
shell
- The shell, or null to get the topmost one.genericTitle
- The title, or null to use "Error".error
- The error message.
openError
public static void openError(org.eclipse.swt.widgets.Shell shell, String genericTitle, String error, Throwable exception) Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.This call can be done from any thread, if not the SWT thread, it will "syncExec" to it.
- Parameters:
shell
- The shell, or null to get the topmost one.genericTitle
- The title, or null to use "Error".error
- The error message.exception
- The exception.
openError
public static void openError(org.eclipse.swt.widgets.Shell shell, String genericTitle, org.eclipse.core.runtime.IStatus status) Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.This call can be done from any thread, if not the SWT thread, it will "syncExec" to it.
- Parameters:
shell
- The shell, or null to get the topmost one.genericTitle
- The title, or null to use "Error".status
- The status.
openExceptionDetailsError
public static void openExceptionDetailsError(org.eclipse.swt.widgets.Shell shell, String genericTitle, org.eclipse.core.runtime.IStatus status) Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.This call can be done from any thread, if not the SWT thread, it will "syncExec" to it.
- Parameters:
shell
- The shell, or null to get the topmost one.genericTitle
- The title, or null to use "Error".status
- The status.
errorMessageBox
public static int errorMessageBox(org.eclipse.swt.widgets.Shell shell, String title, String msg, org.eclipse.core.runtime.CoreException e) Shows an error message box from any thread for an exception.- Parameters:
shell
- The shell to use, if null one will be found...title
- The title.msg
- The message.e
- The Core Exception.- Returns:
- The code of the button that was pressed that resulted in this dialog closing. This will be Dialog.OK if the OK button was pressed, or Dialog.CANCEL if this dialog's close window decoration or the ESC key was used.
statusMessageBox
public static int statusMessageBox(org.eclipse.swt.widgets.Shell shell, String title, String msg, org.eclipse.core.runtime.IStatus status) Shows a message box from any thread.- Parameters:
shell
- The shell to use, if null one will be found...title
- The title.msg
- The message.status
- The IStatus message (also MultiStatus).- Returns:
- The code of the button that was pressed that resulted in this dialog closing. This will be Dialog.OK if the OK button was pressed, or Dialog.CANCEL if this dialog's close window decoration or the ESC key was used.
getInstance
Returns the shared instance.- Returns:
- The shared instance.
getProxy
Gets a Java Proxy instance for an URL.- Specified by:
getProxy
in interfaceIWebServiceEngine
- Parameters:
url
- The URL to get the proxy from.- Returns:
- The proxy to use.
configureProxy
Configures a Http(s)URLConnection for proxy information.- Specified by:
configureProxy
in interfaceIWebServiceEngine
- Parameters:
uc
- The HttpURLConnection or HttpsURLConnection.
loadPropertiesFile
Loads a properties file.- Parameters:
file
- The file.- Returns:
- The loaded property container.
- Throws:
PropException
- For property errors.IOException
- For I/O errors.
loadPropertiesFile
Loads a properties file.- Parameters:
url
- The URL.- Returns:
- The loaded property container.
- Throws:
PropException
- For property errors.IOException
- For I/O errors.
loadPropertiesFile
public static PropCnr loadPropertiesFile(org.eclipse.core.resources.IFile file) throws org.eclipse.core.runtime.CoreException Loads a properties file.- Parameters:
file
- The file.- Returns:
- The loaded property container.
- Throws:
org.eclipse.core.runtime.CoreException
- For file errors.
createInputData
Creates InputStream byte array data from a property container.- Parameters:
container
- The property container.- Returns:
- The byte array for the property container.
- Throws:
IOException
- For I/O errors.TransformerException
- For XML error.
createInputStream
public static InputStream createInputStream(PropCnr container) throws IOException, TransformerException Creates an InputStream from a property container.- Parameters:
container
- The property container.- Returns:
- The InputStream for the property container.
- Throws:
IOException
- For I/O errors.TransformerException
- For XML error.
savePropertiesFile
public static void savePropertiesFile(PropCnr container, org.eclipse.core.resources.IFile file, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Saves a properties file. The IFile reference and the file modification stamp are saved in the property container.- Parameters:
container
- The property container.file
- The file.monitor
- The monitor.- Throws:
org.eclipse.core.runtime.CoreException
- For Eclipse file system errors.
prepareFolder
public static void prepareFolder(org.eclipse.core.resources.IFolder folder, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Prepares a folder, i.e. makes sure it exists. If not it is created, recursively.- Parameters:
folder
- The folder to prepare.monitor
- The progress monitor.- Throws:
org.eclipse.core.runtime.CoreException
- For folder creation errors.
getSelectedProject
public static org.eclipse.core.resources.IProject getSelectedProject()Gets the currently selected project.- Returns:
- The project, or null if none is selected.
getSelectedProject
public static org.eclipse.core.resources.IProject getSelectedProject(org.eclipse.jface.viewers.ISelection sel) Gets the currently selected project.- Parameters:
sel
- The structured selection, null for none.- Returns:
- The project, or null if none is selected.
getFirstSelectedProperty
Gets the first currently selected property.- Returns:
- The property, or null if none is selected.
getFirstSelectedProperty
Gets the first currently selected property.This method validates the properties and skips those that are disposed of in case the viewer selection is "old" and not refreshed.
- Parameters:
sel
- The structured selection, null for none.- Returns:
- The property, or null if none is selected.
getSelectedProps
Gets a list of all DesignerProp's in a selection that should be used in e.g. a Delete or Copy/Cut operation. If a property container is present in the selection, all its children are removed from the list, because they would be included in the container operation.This method validates the properties and skips those that are disposed of in case the viewer selection is "old" and not refreshed.
- Parameters:
sel
- The structured selection, null for none.- Returns:
- The list of selected properties.
getSelectedGProps
Gets a list of all GProp's for DesignerProp's in a selection that should be used in e.g. a Delete or Copy/Cut operation. If a property container is present in the selection, all its children are removed from the list, because they would be included in the container operation.- Parameters:
sel
- The selection.- Returns:
- The GProp array.
getSelectedRawGProps
Gets a list of all RAW GProp's without DesignerProp's in a selection that should be used in e.g. a Delete or Copy/Cut operation. If a property container is present in the selection, all its children are removed from the list, because they would be included in the container operation.- Parameters:
sel
- The selection.- Returns:
- The GProp array.
getPropCnrs
Gets a PropCnr's from a DesignerProp list.- Parameters:
list
- The list of DesignerProp's or null for none.- Returns:
- The returned array, never null.
isResourceBased
Checks if the property contains a resource.- Parameters:
gp
- The property.- Returns:
- true if the property is a FilePropCnr or FolderPropCnr with a resource.
areAllResourceBased
Checks if the properties only contains resources.- Parameters:
props
- The properties.- Returns:
- true if all properties are resource based, false otherwise.
fileToData
Converts the property to get the data container property instead of a FilePropCnr.- Parameters:
gp
- The input property.- Returns:
- The same as the input property for no change, the data container property if it was a FilePropCnr when possible (data container not null).
fileToData
Converts the property to get the data container property instead of a FilePropCnr.- Parameters:
dp
- The input property.- Returns:
- The same as the input property for no change, the data container property if it was a FilePropCnr when possible (data container not null).
fileToData
Converts the array of properties to get the data container property instead of a FilePropCnr.- Parameters:
props
- The input properties.- Returns:
- The same as the input array for no change, a new array without FilePropCnr when possible (data container not null).
dataToFile
Converts the property to get the FilePropCnr instead of the data container property.- Parameters:
gp
- The input propertY.- Returns:
- The property or its FilePropCnr when possible.
dataToFile
Converts the DesignerProp from the data container to the FilePropCnr one, if it refers to a file.- Parameters:
dp
- The Designer property instance of e.g. the data container.- Returns:
- The File Designer property if the parameter
dp
was a data container, otherwise the same value as thedp
parameter.
dataToFile
Converts the array of properties to get the FilePropCnr instead of the data container property.- Parameters:
props
- The input properties.- Returns:
- The same as the input array for no change, a new array with FilePropCnr when possible.
getSelectedResources
public static org.eclipse.core.resources.IResource[] getSelectedResources()Returns the resource selection from the LocalSelectionTransfer.- Returns:
- The currently selected resources, never null.
getSelectedResources
public static org.eclipse.core.resources.IResource[] getSelectedResources(org.eclipse.jface.viewers.ISelection selection) Returns the resource selection.- Parameters:
selection
- Any selection of properties, resources, etc.- Returns:
- The resources from a selection, never null.
getSelectedResources
public static org.eclipse.core.resources.IResource[] getSelectedResources(org.eclipse.jface.viewers.IStructuredSelection selection) Returns the resource selection.- Parameters:
selection
- Any selection of properties, resources, etc.- Returns:
- The resources from a selection, never null.
getFirstSelectedFile
public static org.eclipse.core.resources.IFile getFirstSelectedFile(org.eclipse.jface.viewers.IStructuredSelection selection) Gets the first selected file resource.- Parameters:
selection
- The selection.- Returns:
- The resource or null if none.
getClipboard
public static org.eclipse.swt.dnd.Clipboard getClipboard()Gets the clip board instance for the plug-in. It will be disposed of when the plug-in stops.- Returns:
- The clipboard instance.
disposeClipboard
public static void disposeClipboard()Disposes of the clipboard.mergeStatus
public static void mergeStatus(org.eclipse.core.runtime.MultiStatus status, org.eclipse.core.runtime.IStatus toMerge) Adds the given status to the list of problems. Discards OK statuses. If the status is a multi-status, only its children are added.- Parameters:
status
- The status to merge with.toMerge
- The status to merge, if it's OK to merge!
createErrorStatus
Creates an error status.- Parameters:
msg
- The message.- Returns:
- The status.
createErrorStatus
Creates an error status.- Parameters:
msg
- The message.e
- The exception.- Returns:
- The status.
createWarningStatus
Creates a warning status.- Parameters:
msg
- The message.- Returns:
- The status.
createInfoStatus
Creates an informational status.- Parameters:
msg
- The message.- Returns:
- The status.
refresh
Refreshes the workspace for the specified properties.- Parameters:
dps
- The collection of DesignerProp's to refresh.
centerDialog
public static void centerDialog(org.eclipse.swt.widgets.Shell shell) Centers a dialog box Shell over it's parent.- Parameters:
shell
- The dialog box shell.
getInternalWebServerUnsecurePort
public static int getInternalWebServerUnsecurePort()Returns the current HTTP port for the internal web server.- Returns:
- The port number, or zero if not started.
createKStringInfoProvider
public KStringInfoProviderAdapter createKStringInfoProvider(GProp<?> anyProp, boolean shouldResolve) Creates an IKStringInfoProvider for a property.- Parameters:
anyProp
- Property for reference resolving.shouldResolve
- Flag indicating the "real" resolved string should be returned. This value is true for the runtime client when in "real run mode".- Returns:
- A new KStringInfoProviderAdapter instance for the unsecure web server port if any.
getKStringInfoProvider
Retrieves the KStringInfoProvider.- Specified by:
getKStringInfoProvider
in interfaceIKStringInfoProviderHolder
- Returns:
- The KString information provider instance, or null if not possible.
getKStringInfoProvider
Retrieves the KStringInfoProvider.- Parameters:
anyProp
- Any property, ornull
to get it from the module root.- Returns:
- The KString information provider instance, or null if not possible.
getConfigurationPreferences
public static org.osgi.service.prefs.Preferences getConfigurationPreferences()Gets the iiziGo Configuration Preferences, not stored in the workspace, but with the Eclipse installation.You may create another node if you wish to separate it from the default iiziGo ones.
- Returns:
- The preferences.
getExecutorService
Gets the executor service.- Returns:
- The executor service instance tunes for this machine.