Class Activator
- All Implemented Interfaces:
IWebServiceEngine, IKStringInfoProviderHolder, org.osgi.framework.BundleActivator
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanDebug setting for Undo.static final PropFactoryThe Designer property factory.static final PropMgrThe Property Manager for the Designer.static final GProp<?>[]The empty array.static IFileURLResolverInterface used to resolve URL's to files for the Designer.static final IResource[]An empty resource array.static final StringThe plug-in ID: "com.iizigo" as in package name for this class.static final StringSystem property overriding the database directory of the Derby network database server for this JVM only, never saved (CC-FIX-HARNESS-DERBY-ISOLATION): the UI harness ofcom.iizigo.term.testssets it to a directory under its own work directory, so that no test uses the user's "~/.iizi/db".static final StringSystem property overriding the port of the Derby network database server for this JVM only, never saved (CC-FIX-HARNESS-DERBY-ISOLATION):0lets this process pick a free loopback port once, kept for the life of the process.static final StringSystem property naming the directory this JVM copies the JDBC drivers into and runs its Derby network database server from, instead of the user's "~/.iizi/jdbc-drivers", for this JVM only, never saved (CC-FIX-HARNESS-OWN-JDBC): the UI harness ofcom.iizigo.term.testssets it to a directory under its own work directory, so that a test run neither rewrites the user's JDBC drivers nor fails on a file that a database server of the user runs from.protected static final longThe serial UID.static final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupThe resource setup.static final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupstatic final PropertyEditorSetupFields inherited from class Plugin
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAMEConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionvoidaddServerLaunchOptions(List<String> args) Adds required options for the server when launched from inside iiziGo.static booleanareAllResourceBased(GProp<?>[] props) Checks if the properties only contains resources.static voidcenterDialog(Shell shell) Centers a dialog box Shell over its parent shell inside the work area of the parent shell's monitor (the monitor without the taskbar).static intcheckEnabledOrStarting(Shell shell, IWizard wizard) Call this function in e.g.static intcheckEnabledOrStarting(Shell shell, IWizard wizard, Runnable runnable) Call this function in e.g.voidConfigures a Http(s)URLConnection for proxy information.static PropMgrCreates a Property Manager for the Designer connection with JavaScript.static StatuscreateErrorStatus(String msg) Creates an error status.static StatuscreateErrorStatus(String msg, Throwable e) Creates an error status.static StatuscreateInfoStatus(String msg) Creates an informational status.static byte[]createInputData(PropCnr container) Creates InputStream byte array data from a property container.static InputStreamcreateInputStream(PropCnr container) Creates an InputStream from a property container.createKStringInfoProvider(GProp<?> anyProp, boolean shouldResolve) Creates an IKStringInfoProvider for a property.static PropFactoryCreates a new Server property factory.static PropMgrcreateServerPropMgr(boolean hasJSClient) Creates a new Property Manager for a Server simulation.static StatusCreates a warning status.static DesignerPropConverts 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 voidDisposes of the clipboard.static interrorMessageBox(Shell shell, String title, String msg, CoreException e) Shows an error message box from any thread for an exception.static DesignerPropConverts 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 RectanglefitDialogBounds(Rectangle area, Rectangle over, Rectangle bounds) Fits the bounds of a dialog box into a work area, centered over a rectangle (normally the bounds of its parent shell): a dialog wider or taller than the work area gets the work area's width or height, and the position is kept inside the work area, left/top side first, so that the title bar stays on screen (CC-FIX-SHADOW-DIALOG-SIZE: pure geometry, no widget).static StringgetByteSize(long size) Gets a size string in bytes.static ClipboardGets the clip board instance for the plug-in.static org.osgi.service.prefs.PreferencesGets 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: the directory overriding the preferences for this JVM (PROP_DERBY_DIR, a UI harness) when set, else the preference "db_dir".intGets the port of the Derby network database server in effect: the override of this JVM (PROP_DERBY_PORT) when set, else the preference "db_port" with its default registered (setDatabaseDefaults(IPreferenceStore)).static FileGets the database directory of the Derby network database server overriding the preferences for this JVM (PROP_DERBY_DIR).static IntegerGets the port of the Derby network database server overriding the preferences for this JVM (PROP_DERBY_PORT), resolved once: a value of 0 picks a free loopback port the first time, kept for the life of the process.static RectanglegetDialogWorkArea(Shell shell) Gets the work area of a dialog box Shell: the client area of the monitor of its parent shell (the monitor without the taskbar), or of the monitor of the shell itself when it has no parent.static IFilegetFirstSelectedFile(IStructuredSelection selection) Gets the first selected file resource.static DesignerPropGets the first currently selected property.static DesignerPropGets the first currently selected property.static GProp<?>[]getGProps(List<DesignerProp> list) Gets a list of all GProp's for the DesignerProp's list.static ActivatorReturns the shared instance.static intReturns the current HTTP port for the internal web server.static FileGets 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 IProjectgetProject(Object o) Attempts to get the project from an Object, first as an IProject, then a DesignerProp, then as an adapted IResource.static PropCnr[]getPropCnrs(ArrayList<DesignerProp> list) Gets a PropCnr's from a DesignerProp list.Gets a Java Proxy instance for an URL.static PropCnrgetRootProperty(String name) Gets a root property from a registered name.static IRuntimeBuilderGets the runtime creation builder.static GProp<?>[]Gets a list of all GProp's for DesignerProp's in a selection that should be used in e.g.static IProjectGets the currently selected project.static IProjectGets the first selected project.static IProject[]Gets all selected projects.static ArrayList<DesignerProp> Gets a list of all DesignerProp's in a selection that should be used in e.g.Gets a list of all RAW GProp's without DesignerProp's in a selection that should be used in e.g.static IResource[]Returns the resource selection from the LocalSelectionTransfer.static IResource[]getSelectedResources(ISelection selection) Returns the resource selection.static IResource[]getSelectedResources(IStructuredSelection selection) Returns the resource selection.static PropFactoryGets the Server property factory.static ShellGets a shell: the shell of the active workbench window, otherwise the active shell.static FilegetStateLocationFile(String fileName) Gets a file in the state location area.static FileGets the user's private directory, normally where the other directories are placed, such as the JDBC drivers "jdbc-drivers", the database "db", etc.static WorkerGets the Worker.static booleanTells whether the Derby network database server is isolated to this JVM: its database directory or its port is overridden (PROP_DERBY_DIR,PROP_DERBY_PORT), as in a UI harness.static booleanReturns if IIZI is enabled or not.static booleanisResourceBased(GProp<?> gp) Checks if the property contains a resource.static booleanChecks if IIZI is currently starting up.static booleanChecks if plugin is stopped or not started at all.static PropCnrloadPropertiesContent(IFile file, byte[] content) Loads a properties file from its bytes, read before withreadFileContent(IFile): whatloadPropertiesFile(IFile)does, without reading the file again.static PropCnrloadPropertiesFile(File file) Loads a properties file.static PropCnrloadPropertiesFile(URL url) Loads a properties file.static PropCnrloadPropertiesFile(IFile file) Loads a properties file.static voidmergeStatus(MultiStatus status, IStatus toMerge) Adds the given status to the list of problems.static intmessageBox(String title, String msg, int style) Shows a message box.static intmessageBox(Shell shell, String title, String msg, int style) Shows a message box.static voidmessageBoxAsync(String title, String msg, int style) Shows a message box asynchronously in the SWT Thread.voidonModuleModelDisposed(ModuleModel model) Called by the Project Manager when a Module project is closed or deleted and its model has been disposed of: drops the cached KString information provider when it resolves references through that project's root container.static voidOpens an error dialog if necessary.static voidOpens an error dialog if necessary.static voidopenError(String genericTitle, CoreException exception) Opens an error dialog if necessary.static voidOpens an error dialog if necessary.static voidOpens an error dialog if necessary.static voidOpens an error dialog if necessary.static voidopenError(Shell shell, String genericTitle, CoreException exception) Opens an error dialog if necessary.static voidOpens an error dialog if necessary.static voidopenExceptionDetailsError(Shell shell, String genericTitle, IStatus status) Opens an error dialog if necessary.static voidOpens an URL in an external browser.static voidprepareFolder(IFolder folder, IProgressMonitor monitor) Prepares a folder, i.e.static byte[]readFileContent(IFile file) Reads the bytes a file of the workspace holds on disk, asloadPropertiesFile(IFile)reads them (also when the workspace has not yet seen the file's change on disk).static voidrefresh(Collection<DesignerProp> dps) Refreshes the workspace for the specified properties.static booleanregisterRootProperty(String name, PropCnr root) Registers a root property container not being a Java or Module root, e.g.static voidsavePropertiesFile(PropCnr container, IFile file, IProgressMonitor monitor) Saves a properties file.static voidRegisters the defaults of the Derby network database server preferences in a store (DP-D-2 of CC-FIX-DERBY-PREF-STATE): "db_autostart" true, "db_autostop" true, "db_port"DerbyImpl.DERBY_DEFAULT_PORTand "db_address" "localhost".static voidsetEnabled(boolean isEnabled) Assigns the enabled state of IIZI.static voidSets the runtime creation builder.voidstart(org.osgi.framework.BundleContext context) Starts up the iiziGo plug-in bundle.static intstatusMessageBox(Shell shell, String title, String msg, IStatus status) Shows a message box from any thread.voidstop(org.osgi.framework.BundleContext context) static intthreadMessageBox(String title, String msg, int style) Shows a message box from another thread.static intthreadMessageBox(Shell shell, String title, String msg, int style) Shows a message box from another thread.static booleanunregisterRootProperty(String name, PropCnr root) Unregisters a root property container not being a Java or Module root, e.g.Methods inherited from class AbstractUIPlugin
createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, initializeImageRegistry, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startupMethods inherited from class 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
An empty resource array.EMPTY_GPROPS
The empty array.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
setupColor
setupRuntimeBuilder
setupFont
PROP_DERBY_DIR
System property overriding the database directory of the Derby network database server for this JVM only, never saved (CC-FIX-HARNESS-DERBY-ISOLATION): the UI harness ofcom.iizigo.term.testssets it to a directory under its own work directory, so that no test uses the user's "~/.iizi/db". Read before the preference "db_dir" wherever iiziGo resolves the directory (getDatabaseDirectoryCandidate()); a normal iiziGo start does not set it.- See Also:
PROP_DERBY_PORT
System property overriding the port of the Derby network database server for this JVM only, never saved (CC-FIX-HARNESS-DERBY-ISOLATION):0lets this process pick a free loopback port once, kept for the life of the process. The UI harness sets it to 0, so that no test uses the default port 1527. Read before the preference "db_port" wherever iiziGo resolves the port (getDatabasePort()).- See Also:
fileURLResolver
Interface used to resolve URL's to files for the Designer. In other products, the same URL is returned unchanged.PROP_JDBC_DIR
System property naming the directory this JVM copies the JDBC drivers into and runs its Derby network database server from, instead of the user's "~/.iizi/jdbc-drivers", for this JVM only, never saved (CC-FIX-HARNESS-OWN-JDBC): the UI harness ofcom.iizigo.term.testssets it to a directory under its own work directory, so that a test run neither rewrites the user's JDBC drivers nor fails on a file that a database server of the user runs from. Read once, where the directory is resolved (jdbcDriversDir(String,File)); a normal iiziGo start does not set it. It stands besidePROP_DERBY_DIRandPROP_DERBY_PORT; it is declared here, at the end of the class, so that no line above moved when it was added.- See Also:
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
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
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
getPluginClasspathEntries
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" 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" (or of the one
PROP_JDBC_DIRnames).
getDatabaseDirectoryCandidate
Gets the database directory candidate to use: the directory overriding the preferences for this JVM (PROP_DERBY_DIR, a UI harness) when set, else the preference "db_dir". This call also updates the default value "db_dir" in the Eclipse preference store, if not set.- Returns:
- The directory to use.
getDerbyDirectoryOverride
Gets the database directory of the Derby network database server overriding the preferences for this JVM (PROP_DERBY_DIR).- Returns:
- The canonical directory, null when the property is not set or blank.
getDerbyPortOverride
Gets the port of the Derby network database server overriding the preferences for this JVM (PROP_DERBY_PORT), resolved once: a value of 0 picks a free loopback port the first time, kept for the life of the process. A value that is not a number or not 1 to 65534, or a free port that cannot be picked, is logged as SEVERE once and ignored.- Returns:
- The port, null when not overridden.
isDerbyOverridden
public static boolean isDerbyOverridden()Tells whether the Derby network database server is isolated to this JVM: its database directory or its port is overridden (PROP_DERBY_DIR,PROP_DERBY_PORT), as in a UI harness. Such a Derby is this process's alone: it is started and stopped by this process whatever other iiziGo instances run.- Returns:
- true when overridden.
getDatabasePort
public int getDatabasePort()Gets the port of the Derby network database server in effect: the override of this JVM (PROP_DERBY_PORT) when set, else the preference "db_port" with its default registered (setDatabaseDefaults(IPreferenceStore)).- Returns:
- The port.
setDatabaseDefaults
Registers the defaults of the Derby network database server preferences in a store (DP-D-2 of CC-FIX-DERBY-PREF-STATE): "db_autostart" true, "db_autostop" true, "db_port"DerbyImpl.DERBY_DEFAULT_PORTand "db_address" "localhost". Called wherever they are read - the auto-start at iiziGo's start and the Internal Database preference page - so that the page never reads them unregistered (the auto-start box unticked and the address empty) while the copy of the JDBC drivers that precedes the auto-start has not completed, or failed. The default of "db_dir" is set bygetDatabaseDirectoryCandidate().- Parameters:
store- The preference store of iiziGo.
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
Adds required options for the server when launched from inside iiziGo.- Parameters:
args- The list of server arguments.- Throws:
CoreException- For errors.
getByteSize
Gets a size string in bytes.- Parameters:
size- The size.- Returns:
- The string formatted as "#,##0 bytes".
openURL
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:
startin interfaceorg.osgi.framework.BundleActivator- Overrides:
startin classAbstractUIPlugin- Parameters:
context- The bundle context.- Throws:
Exception- For errors in loading the IIZI properties framework.
isStopped
public static boolean isStopped()Checks if plugin is stopped or not started at all.stop
- Specified by:
stopin interfaceorg.osgi.framework.BundleActivator- Overrides:
stopin classAbstractUIPlugin- 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
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
getSomeShell
Gets a shell: the shell of the active workbench window, otherwise the active shell.This call can be done from any thread, if not the SWT thread, it will "syncExec" to it: the caller waits until the SWT thread has answered, so never call it from a thread the SWT thread is waiting for.
- Returns:
- Some shell, or null: when there is none, or when the workbench is not running (not started yet, or closed).
messageBoxAsync
messageBox
messageBox
threadMessageBox
threadMessageBox
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
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
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
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
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
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
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
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
getProxy
Gets a Java Proxy instance for an URL.- Specified by:
getProxyin 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:
configureProxyin 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
Loads a properties file.- Parameters:
file- The file.- Returns:
- The loaded property container.
- Throws:
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, IFile file, IProgressMonitor monitor) throws CoreException Saves a properties file. The IFile reference and the file modification stamp are saved in the container when it is aFilePropCnr.- Parameters:
container- The property container.file- The file.monitor- The monitor.- Throws:
CoreException- For Eclipse file system errors.
prepareFolder
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:
CoreException- For folder creation errors.
getSelectedProject
Gets the currently selected project.- Returns:
- The project, or null if none is selected.
getSelectedProject
Gets the first selected project.- Parameters:
sel- The structured selection, null for none.- Returns:
- The project, or null if none is selected.
getSelectedProjects
Gets all selected projects.- Parameters:
sel- The structured selection, null for none.- Returns:
- The projects, or null if none is selected.
getProject
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.
getGProps
Gets a list of all GProp's for the DesignerProp's list.- Parameters:
list- List of designer properties.- 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
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
dpwas a data container, otherwise the same value as thedpparameter.
dataToFile
getSelectedResources
Returns the resource selection from the LocalSelectionTransfer.- Returns:
- The currently selected resources, never null.
getSelectedResources
Returns the resource selection.- Parameters:
selection- Any selection of properties, resources, etc.- Returns:
- The resources from a selection, never null.
getSelectedResources
Returns the resource selection.- Parameters:
selection- Any selection of properties, resources, etc.- Returns:
- The resources from a selection, never null.
getFirstSelectedFile
Gets the first selected file resource.- Parameters:
selection- The selection.- Returns:
- The resource or null if none.
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
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
createErrorStatus
createWarningStatus
createInfoStatus
refresh
Refreshes the workspace for the specified properties.- Parameters:
dps- The collection of DesignerProp's to refresh.
getDialogWorkArea
Gets the work area of a dialog box Shell: the client area of the monitor of its parent shell (the monitor without the taskbar), or of the monitor of the shell itself when it has no parent.- Parameters:
shell- The dialog box shell.- Returns:
- The work area in points.
fitDialogBounds
Fits the bounds of a dialog box into a work area, centered over a rectangle (normally the bounds of its parent shell): a dialog wider or taller than the work area gets the work area's width or height, and the position is kept inside the work area, left/top side first, so that the title bar stays on screen (CC-FIX-SHADOW-DIALOG-SIZE: pure geometry, no widget).- Parameters:
area- The work area of the monitor.over- The rectangle to center over.bounds- The bounds of the dialog box: only its size is used.- Returns:
- The bounds to give the dialog box.
centerDialog
Centers a dialog box Shell over its parent shell inside the work area of the parent shell's monitor (the monitor without the taskbar). The right/bottom side will first attempt to be set visible, then the left/top side will be adjusted to fit at worst at the top/left of the work area, and a dialog box larger than the work area is sized to it (CC-FIX-SHADOW-DIALOG-SIZE: it was kept inside the monitor's bounds, so a tall dialog box reached under the taskbar).- 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:
getKStringInfoProviderin interfaceIKStringInfoProviderHolder- Returns:
- The KString information provider instance, or null if not possible.
getKStringInfoProvider
Retrieves the KStringInfoProvider.- Parameters:
anyProp- Any property, ornullto get it from the module root.- Returns:
- The KString information provider instance, or null if not possible.
onModuleModelDisposed
Called by the Project Manager when a Module project is closed or deleted and its model has been disposed of: drops the cached KString information provider when it resolves references through that project's root container. Until then the provider was only dropped lazily, by the next caller finding its property disposed of, and it kept the closed project's whole property tree reachable in the meantime (CC-FIX-PROJECT-LEAK).- Parameters:
model- The disposed Module model.
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.
readFileContent
Reads the bytes a file of the workspace holds on disk, asloadPropertiesFile(IFile)reads them (also when the workspace has not yet seen the file's change on disk). The Module model reads a file of its folders once, with this method, and loads it from these bytes (loadPropertiesContent(IFile,byte[])), so that what it remembers as the file's content on disk is exactly what it loaded (CC-FIX-RELOAD-KEEPS-UNSAVED). It is declared here, at the end of the class, so that no line above moved when it was added.- Parameters:
file- The file.- Returns:
- The bytes of the file.
- Throws:
CoreException- For file errors.
loadPropertiesContent
Loads a properties file from its bytes, read before withreadFileContent(IFile): whatloadPropertiesFile(IFile)does, without reading the file again.- Parameters:
file- The file.content- The bytes of the file.- Returns:
- The loaded property container.
- Throws:
CoreException- For file errors.