1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

[186589][api] move user defined types, user defined actions, and compile commands API to user actions plugin

This commit is contained in:
David Dykstal 2007-06-05 01:39:51 +00:00
parent 4b25985894
commit 56824e4bbe
53 changed files with 1010 additions and 857 deletions

View file

@ -17,6 +17,8 @@
* removed unneeded first time logic and flags
* renamed createRemoteSystemsProjectInternal to ensureRemoteSystemsProject
* made ensureRemoteSystemsProject private instead of protected
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.core;
@ -36,7 +38,6 @@ import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemHostPool;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.core.RemoteSystemsProject;
import org.eclipse.rse.internal.core.SystemResourceConstants;
@ -277,120 +278,6 @@ public class SystemResourceManager implements SystemResourceConstants
return getResourceHelpers().getOrCreateFolder(getRemoteSystemsProject(),profileName);
}
/*
* --------------------------------------------------------------------------------------------------------------------------------
* USER ACTIONS SUBTREE FOLDER METHODS...
* ======================================
* .--- Team (folder) - getProfileFolder(SystemProfile/"team")
* | |
* | |
* | .--- UserActions (folder) - getUserActionsFolder(SystemProfile/"team")
* | |
* | .--- SubSystemConfigurationID1 (folder) - getUserActionsFolder(SystemProfile/"team", SubSystemConfiguration)
* | | .--- actions.xml (file)
* | .--- SubSystemConfigurationID2 (folder)
* | .--- actions.xml (file)
* --------------------------------------------------------------------------------------------------------------------------------
*/
// ---------------------------------------------------
// GET USER DEFINED ACTIONS ROOT FOLDER PER PROFILE...
// ---------------------------------------------------
/**
* Get user defined actions root folder given a system profile name
*/
protected static IFolder getUserActionsFolder(String profileName)
{
return getResourceHelpers().getOrCreateFolder(getProfileFolder(profileName),RESOURCE_USERACTIONS_FOLDER_NAME);
}
/**
* Get user defined actions root folder given a system profile object and subsystem factory
*/
public static IFolder getUserActionsFolder(ISystemProfile profile, ISubSystemConfiguration ssFactory)
{
return getUserActionsFolder(profile.getName(),ssFactory);
}
/**
* Get user defined actions root folder given a system profile name and subsystem factory
*/
public static IFolder getUserActionsFolder(String profileName, ISubSystemConfiguration ssFactory)
{
IFolder parentFolder = getUserActionsFolder(profileName);
String folderName = getFolderName(ssFactory);
return getResourceHelpers().getOrCreateFolder(parentFolder, folderName); // Do create it.
}
/**
* Test for existence of user defined actions root folder given a system profile name and subsystem factory
*/
public static boolean testUserActionsFolder(String profileName, ISubSystemConfiguration ssFactory)
{
IFolder parentFolder = getUserActionsFolder(profileName);
String folderName = getFolderName(ssFactory);
return (getResourceHelpers().getFolder(parentFolder, folderName).exists()); // Do NOT create it.
}
/**
* Get user defined actions root folder given a system profile name and subsystem factory Id.
* This is a special-needs method provided for the Import action processing,
* when a subsystem instance is not available.
*/
public static IFolder getUserActionsFolder( String profileName, String factoryId)
{
IFolder parentFolder = getUserActionsFolder(profileName);
return getResourceHelpers().getOrCreateFolder(parentFolder, factoryId); // Do create it.
}
/*
* --------------------------------------------------------------------------------------------------------------------------------
* COMPILE COMMAND SUBTREE FOLDER METHODS...
* ======================================
* .--- Team (folder) - getProfileFolder(SystemProfile/"team")
* | |
* | |
* | .--- CompileCommands (folder) - getCompileCommandsFolder(SystemProfile/"team")
* | |
* | .--- SubSystemConfigurationID1 (folder) - getCompileCommandsFolder(SystemProfile/"team", SubSystemConfiguration)
* | | .--- compileCommands.xml (file)
* | .--- SubSystemConfigurationID2 (folder)
* | .--- compileCommands.xml (file)
* --------------------------------------------------------------------------------------------------------------------------------
*/
// ---------------------------------------------------
// GET COMPILE COMMANDS ROOT FOLDER PER PROFILE...
// ---------------------------------------------------
/**
* Get compile commands root folder given a system profile name
*/
protected static IFolder getCompileCommandsFolder(String profileName)
{
return getResourceHelpers().getOrCreateFolder(getProfileFolder(profileName),RESOURCE_COMPILECOMMANDS_FOLDER_NAME);
}
/**
* Get compile commands root folder given a system profile object and subsystem factory
*/
public static IFolder getCompileCommandsFolder(ISystemProfile profile, ISubSystemConfiguration ssFactory)
{
return getCompileCommandsFolder(profile.getName(),ssFactory);
}
/**
* Get compile commands root folder given a system profile name and subsystem factory
*/
public static IFolder getCompileCommandsFolder(String profileName, ISubSystemConfiguration ssFactory)
{
IFolder parentFolder = getCompileCommandsFolder(profileName);
String folderName = getFolderName(ssFactory);
return getResourceHelpers().getOrCreateFolder(parentFolder, folderName); // Do create it.
}
/**
* Get compile commands root folder given a system profile name and subsystem factory Id.
* This is a special-needs method provided for the Import action processing,
* when a subsystem instance is not available.
*/
public static IFolder getCompileCommandsFolder( String profileName, String factoryId)
{
IFolder parentFolder = getCompileCommandsFolder(profileName);
return getResourceHelpers().getOrCreateFolder(parentFolder, factoryId); // Do create it.
}
// -------------------
// FOLDER ACTIONS...
@ -534,38 +421,4 @@ public class SystemResourceManager implements SystemResourceConstants
return SystemResourceHelpers.testIfResourceInUse(resource);
}
/*
* --------------------------------------------------------------------------------------------------------------------------------
* TYPE FILTERS SUBTREE FOLDER METHODS...
* ======================================
* .--- TypeFilters (folder) - getTypeFiltersFolder()
* .--- SubSystemConfigurationID1 (folder) - getTypeFiltersFolder(SubSystemConfiguration)
* | .--- typefilters.xmi (file)
* --------------------------------------------------------------------------------------------------------------------------------
*/
/**
* Get the typeFilters root folder
*/
public static IFolder getTypeFiltersFolder()
{
return getResourceHelpers().getFolder(getRemoteSystemsProject(),RESOURCE_TYPE_FILTERS_FOLDER_NAME);
}
/**
* Get the typeFilters sub-folder per subsystem factory object
*/
public static IFolder getTypeFiltersFolder(ISubSystemConfiguration ssFactory)
{
IFolder parentFolder = getTypeFiltersFolder();
String folderName = getFolderName(ssFactory);
return getResourceHelpers().getOrCreateFolder(parentFolder, folderName); // DO create it.
}
/**
* Get the typeFilters sub-folder per subsystem factory id
*/
public static IFolder getTypeFiltersFolder(String ssFactoryId)
{
IFolder parentFolder = getTypeFiltersFolder();
return getResourceHelpers().getOrCreateFolder(parentFolder, ssFactoryId); // DO create it.
}
}

View file

@ -12,6 +12,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* David Dykstal (IBM) - [186589] Move User Actions events to the user actions plugin
********************************************************************************/
package org.eclipse.rse.core.events;
@ -84,18 +85,18 @@ public interface ISystemModelChangeEvents {
* Resource Type: filter
*/
public static final int SYSTEM_RESOURCETYPE_FILTER = 32;
/**
* Resource Type: user action
*/
public static final int SYSTEM_RESOURCETYPE_USERACTION = 128;
/**
* Resource Type: named type, which are used in user actions
*/
public static final int SYSTEM_RESOURCETYPE_NAMEDTYPE = 256;
/**
* Resource Type: compile command
*/
public static final int SYSTEM_RESOURCETYPE_COMPILECMD = 512;
// /**
// * Resource Type: user action
// */
// public static final int SYSTEM_RESOURCETYPE_USERACTION = 128;
// /**
// * Resource Type: named type, which are used in user actions
// */
// public static final int SYSTEM_RESOURCETYPE_NAMEDTYPE = 256;
// /**
// * Resource Type: compile command
// */
// public static final int SYSTEM_RESOURCETYPE_COMPILECMD = 512;
/**
* Resource Type: ALL. Used with SYSTEM_RESOURCE_ALL_RELOADED
*/

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation and others. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -12,6 +12,8 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - fix 158765: content assist miss disables enter
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.shells.ui.view;
@ -44,7 +46,6 @@ import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorUserActionCommand;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.VerifyKeyListener;
@ -105,10 +106,11 @@ public class SystemCommandEditor extends SourceViewer
}
private void init(int columnSpan, SourceViewerConfiguration sourceViewerConfiguration, String cmd)
{
if (cmdValidator == null)
{
setCommandValidator(new ValidatorUserActionCommand());
}
// TODO (dwd) will need to have an editor callback on instantiation to add validators instead of assuming one
// if (cmdValidator == null)
// {
// setCommandValidator(new ValidatorUserActionCommand());
// }
IDocument document = new Document();
configure(sourceViewerConfiguration);
setEditable(true);

View file

@ -14,6 +14,8 @@
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [189858] Removed the remote systems project in the team view
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.internal.ui.view.team;
@ -932,11 +934,11 @@ public class SystemTeamViewPart
// treeViewer.setSelection(new StructuredSelection(action));
// }
// }
else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_NAMEDTYPE)
{
if (testMode)
System.out.println("Named Type change event of type: " + event.getEventType()); //$NON-NLS-1$
}
// else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_NAMEDTYPE)
// {
// if (testMode)
// System.out.println("Named Type change event of type: " + event.getEventType()); //$NON-NLS-1$
// }
// compile actions separate now
// else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD)

View file

@ -14,6 +14,8 @@
* Michael Berger (IBM) - 146339 Added refresh action graphic.
* Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
* Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.ui;
@ -148,10 +150,6 @@ public interface ISystemIconConstants
// OTHER ACTION ICONS...
public static final String ICON_ACTIONS_DIR = "full/elcl16/"; //$NON-NLS-1$
public static final String ICON_SYSTEM_COMPILE_ROOT = "compile"; //$NON-NLS-1$
public static final String ICON_SYSTEM_COMPILE = ICON_ACTIONS_DIR + ICON_SYSTEM_COMPILE_ROOT+ICON_EXT;
public static final String ICON_SYSTEM_COMPILE_ID = PREFIX+ICON_SYSTEM_COMPILE_ROOT+ICON_SUFFIX;
public static final String ICON_SYSTEM_LOCK_ROOT = "lock"; //$NON-NLS-1$
public static final String ICON_SYSTEM_LOCK = ICON_ACTIONS_DIR + ICON_SYSTEM_LOCK_ROOT+ICON_EXT;
public static final String ICON_SYSTEM_LOCK_ID = PREFIX+ICON_SYSTEM_LOCK_ROOT+ICON_SUFFIX;
@ -225,18 +223,6 @@ public interface ISystemIconConstants
public static final String ICON_SYSTEM_WORKWITHFILTERPOOLS = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHFILTERPOOLS_ROOT+ICON_EXT;
public static final String ICON_SYSTEM_WORKWITHFILTERPOOLS_ID = PREFIX+ICON_SYSTEM_WORKWITHFILTERPOOLS_ROOT+ICON_SUFFIX;
public static final String ICON_SYSTEM_WORKWITHUSERACTIONS_ROOT = "workwithuseractions"; //$NON-NLS-1$
public static final String ICON_SYSTEM_WORKWITHUSERACTIONS = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHUSERACTIONS_ROOT+ICON_EXT;
public static final String ICON_SYSTEM_WORKWITHUSERACTIONS_ID = PREFIX+ICON_SYSTEM_WORKWITHUSERACTIONS_ROOT+ICON_SUFFIX;
public static final String ICON_SYSTEM_WORKWITHNAMEDTYPES_ROOT = "workwithnamedtypes"; //$NON-NLS-1$
public static final String ICON_SYSTEM_WORKWITHNAMEDTYPES = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHNAMEDTYPES_ROOT+ICON_EXT;
public static final String ICON_SYSTEM_WORKWITHNAMEDTYPES_ID = PREFIX+ICON_SYSTEM_WORKWITHNAMEDTYPES_ROOT+ICON_SUFFIX;
public static final String ICON_SYSTEM_WORKWITHCOMPILECMDS_ROOT = "workwithcompilecmds"; //$NON-NLS-1$
public static final String ICON_SYSTEM_WORKWITHCOMPILECMDS = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHCOMPILECMDS_ROOT+ICON_EXT;
public static final String ICON_SYSTEM_WORKWITHCOMPILECMDS_ID = PREFIX+ICON_SYSTEM_WORKWITHCOMPILECMDS_ROOT+ICON_SUFFIX;
public static final String ICON_SYSTEM_SHOW_TABLE_ROOT = "systemshowintable"; //$NON-NLS-1$
public static final String ICON_SYSTEM_SHOW_TABLE = ICON_ACTIONS_DIR + ICON_SYSTEM_SHOW_TABLE_ROOT + ICON_EXT;
public static final String ICON_SYSTEM_SHOW_TABLE_ID = PREFIX + ICON_SYSTEM_SHOW_TABLE_ROOT + ICON_SUFFIX;

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2000, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.ui;
@ -195,33 +196,10 @@ public interface ISystemMessages
public static final String MSG_SAVING_PROGRESS = "RSEG1119"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDANAME_EMPTY = "RSEG1180"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDANAME_NOTUNIQUE= "RSEG1181"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDANAME_NOTVALID = "RSEG1182"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDACMT_EMPTY = "RSEG1183"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDACMT_NOTVALID = "RSEG1184"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDACMD_EMPTY = "RSEG1185"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDACMD_NOTVALID = "RSEG1186"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTNAME_EMPTY = "RSEG1187"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTNAME_NOTUNIQUE= "RSEG1188"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTNAME_NOTVALID = "RSEG1189"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTTYPES_EMPTY = "RSEG1190"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTTYPES_NOTVALID = "RSEG1191"; //$NON-NLS-1$
public static final String MSG_VALIDATE_SRCTYPE_EMPTY = "RSEG1192"; //$NON-NLS-1$
public static final String MSG_VALIDATE_SRCTYPE_NOTVALID = "RSEG1193"; //$NON-NLS-1$
public static final String MSG_VALIDATE_SRCTYPE_NOTUNIQUE= "RSEG1194"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILELABEL_EMPTY = "RSEG1195"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILELABEL_NOTUNIQUE= "RSEG1196"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILELABEL_NOTVALID = "RSEG1197"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILESTRING_EMPTY = "RSEG1198"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILESTRING_NOTVALID = "RSEG1199"; //$NON-NLS-1$
public static final String MSG_VALIDATE_ARCHIVE_NAME = "RSEG1120"; //$NON-NLS-1$
@ -242,15 +220,9 @@ public interface ISystemMessages
public static final String MSG_LOADING_PROFILE_SHOULDBE_ACTIVATED = "RSEG1068"; //$NON-NLS-1$
public static final String MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED = "RSEG1069"; //$NON-NLS-1$
public static final String MSG_UDA_LOAD_ERROR = "RSEG1140"; //$NON-NLS-1$
public static final String MSG_UDA_ROOTTAG_ERROR = "RSEG1141"; //$NON-NLS-1$
public static final String MSG_HOSTNAME_NOTFOUND = "RSEG1220"; //$NON-NLS-1$
public static final String MSG_HOSTNAME_VERIFYING = "RSEG1221"; //$NON-NLS-1$
public static final String MSG_CONFIRM_DELETE_USERACTION = "RSEG1230"; //$NON-NLS-1$
public static final String MSG_CONFIRM_DELETE_USERTYPE = "RSEG1231"; //$NON-NLS-1$
public static final String MSG_WIZARD_PAGE_ERROR = "RSEG1240"; //$NON-NLS-1$
// universal find files

View file

@ -24,6 +24,8 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
* David Dykstal (IBM) - [189858] Delay the creation of the remote systems project
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.ui;
@ -313,8 +315,8 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
path+ISystemIconConstants.ICON_SYSTEM_RUN);
putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_STOP_ID,
path+ISystemIconConstants.ICON_SYSTEM_STOP);
putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_COMPILE_ID,
path+ISystemIconConstants.ICON_SYSTEM_COMPILE);
// putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_COMPILE_ID,
// path+ISystemIconConstants.ICON_SYSTEM_COMPILE);
putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEACTIVE_ID,
path+ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEACTIVE);
putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEINACTIVE_ID,
@ -330,12 +332,12 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
path+ISystemIconConstants.ICON_SYSTEM_SELECTFILTERPOOLS);
putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHFILTERPOOLS_ID,
path+ISystemIconConstants.ICON_SYSTEM_WORKWITHFILTERPOOLS);
putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHUSERACTIONS_ID,
path+ISystemIconConstants.ICON_SYSTEM_WORKWITHUSERACTIONS);
putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHNAMEDTYPES_ID,
path+ISystemIconConstants.ICON_SYSTEM_WORKWITHNAMEDTYPES);
putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHCOMPILECMDS_ID,
path+ISystemIconConstants.ICON_SYSTEM_WORKWITHCOMPILECMDS);
// putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHUSERACTIONS_ID,
// path+ISystemIconConstants.ICON_SYSTEM_WORKWITHUSERACTIONS);
// putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHNAMEDTYPES_ID,
// path+ISystemIconConstants.ICON_SYSTEM_WORKWITHNAMEDTYPES);
// putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHCOMPILECMDS_ID,
// path+ISystemIconConstants.ICON_SYSTEM_WORKWITHCOMPILECMDS);
putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID,
path+ISystemIconConstants.ICON_SYSTEM_REFRESH);

View file

@ -1,120 +0,0 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.ui.validators;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
/**
* This class is used to verify a user defined action's command
*/
public class ValidatorUserActionCommand
implements ISystemValidator
{
public static final int MAX_UDACMD_LENGTH = 512; // max command for an action
protected SystemMessage emptyMsg, invalidMsg, currentMessage;
/**
* Constructor to use when wanting to specify the "value required" error message,
* but use the default for the "Value not valid" error message
*/
public ValidatorUserActionCommand()
{
setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMD_EMPTY),
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMD_NOTVALID));
}
/**
* Set the error messages, overriding the defaults
*/
public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
{
this.emptyMsg = emptyMsg;
this.invalidMsg = invalidMsg;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
*/
public String isValid(Object input)
{
currentMessage = null;
if (!(input instanceof String))
{
return null;
}
else
return isValid((String)input);
}
/**
* @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
* @see #getSystemMessage()
*/
public String isValid(String input)
{
currentMessage = null;
if ((input==null)||(input.length()==0))
{
currentMessage = emptyMsg;
}
else
{
if (input.length() > MAX_UDACMD_LENGTH)
currentMessage = invalidMsg;
}
return (currentMessage==null) ? null : currentMessage.getLevelOneText();
}
/**
* When isValid returns non-null, call this to get the SystemMessage object for the error
* versus the simple string message.
*/
public SystemMessage getSystemMessage()
{
return currentMessage;
}
/**
* Return the max length for comments
*/
public int getMaximumNameLength()
{
return MAX_UDACMD_LENGTH;
}
/**
* For convenience, this is a shortcut to calling:
* <pre><code>
* if (isValid(text) != null)
* msg = getSystemMessage();
* </code></pre>
*/
public SystemMessage validate(String text)
{
if (isValid(text) != null)
return currentMessage;
else
return null;
}
}

View file

@ -1,120 +0,0 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.ui.validators;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
/**
* This class is used to verify a user defined action's comment
*/
public class ValidatorUserActionComment
implements ISystemValidator
{
public static final int MAX_UDACMT_LENGTH = 256; // max comment for an action
protected SystemMessage emptyMsg, invalidMsg, currentMessage;
/**
* Constructor to use when wanting to specify the "value required" error message,
* but use the default for the "Value not valid" error message
*/
public ValidatorUserActionComment()
{
setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMT_EMPTY),
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMT_NOTVALID));
}
/**
* Set the error messages, overriding the defaults
*/
public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
{
this.emptyMsg = emptyMsg;
this.invalidMsg = invalidMsg;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
*/
public String isValid(Object input)
{
currentMessage = null;
if (!(input instanceof String))
{
return null;
}
else
return isValid((String)input);
}
/**
* @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
* @see #getSystemMessage()
*/
public String isValid(String input)
{
currentMessage = null;
if ((input==null)||(input.length()==0))
{
//currentMessage = emptyMsg;
}
else
{
if (input.length() > MAX_UDACMT_LENGTH)
currentMessage = invalidMsg;
}
return (currentMessage==null) ? null : currentMessage.getLevelOneText();
}
/**
* When isValid returns non-null, call this to get the SystemMessage object for the error
* versus the simple string message.
*/
public SystemMessage getSystemMessage()
{
return currentMessage;
}
/**
* Return the max length for comments
*/
public int getMaximumNameLength()
{
return MAX_UDACMT_LENGTH;
}
/**
* For convenience, this is a shortcut to calling:
* <pre><code>
* if (isValid(text) != null)
* msg = getSystemMessage();
* </code></pre>
*/
public SystemMessage validate(String text)
{
if (isValid(text) != null)
return currentMessage;
else
return null;
}
}

View file

@ -1,120 +0,0 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.ui.validators;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
/**
* This class is used to verify a user defined action's comment
*/
public class ValidatorUserTypeTypes
implements ISystemValidator
{
public static final int MAX_UDTTYPES_LENGTH = 512;
protected SystemMessage emptyMsg, invalidMsg, currentMessage;
/**
* Constructor to use when wanting to specify the "value required" error message,
* but use the default for the "Value not valid" error message
*/
public ValidatorUserTypeTypes()
{
setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_EMPTY),
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_NOTVALID));
}
/**
* Set the error messages, overriding the defaults
*/
public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
{
this.emptyMsg = emptyMsg;
this.invalidMsg = invalidMsg;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
*/
public String isValid(Object input)
{
currentMessage = null;
if (!(input instanceof String))
{
return null;
}
else
return isValid((String)input);
}
/**
* @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
* @see #getSystemMessage()
*/
public String isValid(String input)
{
currentMessage = null;
if ((input==null)||(input.length()==0))
{
currentMessage = emptyMsg;
}
else
{
if (input.length() > MAX_UDTTYPES_LENGTH)
currentMessage = invalidMsg;
}
return (currentMessage==null) ? null : currentMessage.getLevelOneText();
}
/**
* When isValid returns non-null, call this to get the SystemMessage object for the error
* versus the simple string message.
*/
public SystemMessage getSystemMessage()
{
return currentMessage;
}
/**
* Return the max length for comments
*/
public int getMaximumNameLength()
{
return MAX_UDTTYPES_LENGTH;
}
/**
* For convenience, this is a shortcut to calling:
* <pre><code>
* if (isValid(text) != null)
* msg = getSystemMessage();
* </code></pre>
*/
public SystemMessage validate(String text)
{
if (isValid(text) != null)
return currentMessage;
else
return null;
}
}

View file

Before

Width:  |  Height:  |  Size: 241 B

After

Width:  |  Height:  |  Size: 241 B

View file

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

View file

@ -8,6 +8,7 @@
# Contributors:
# IBM Corporation - initial API and implementation
# Martin Oberhuber (Wind River) - add providerName
# David Dykstal (IBM) - [186589] move properties from org.eclipse.rse.ui
###############################################################################
# NLS_MESSAGEFORMAT_NONE
@ -15,3 +16,7 @@
pluginName = RSE User Actions
providerName = Eclipse.org
PropertyPage.TeamViewUserActionNode = User Action Information
PropertyPage.TeamViewCompileTypeNode = Compile Type Information
PropertyPage.TeamViewCompileCommandNode = Compile Command Information

View file

@ -8,25 +8,34 @@
<extension
point="org.eclipse.ui.propertyPages">
<page
objectClass="org.eclipse.rse.internal.useractions.ui.uda.SystemUDActionElement"
name="%PropertyPage.TeamViewUserActionNode"
class="org.eclipse.rse.internal.useractions.ui.propertypages.SystemTeamViewUserActionPropertyPage"
id="org.eclipse.rse.ui.SystemTeamViewUserActionPropertyPage">
<enabledWhen>
<instanceof
value="org.eclipse.rse.internal.useractions.ui.uda.SystemUDActionElement">
</instanceof>
</enabledWhen>
</page>
<page
objectClass="org.eclipse.rse.internal.useractions.ui.compile.teamview.SystemTeamViewCompileTypeNode"
name="%PropertyPage.TeamViewCompileTypeNode"
class="org.eclipse.rse.internal.useractions.ui.propertypages.SystemTeamViewCompileTypePropertyPage"
id="org.eclipse.rse.ui.SystemTeamViewCompileTypePropertyPage">
<enabledWhen>
<instanceof
value="org.eclipse.rse.internal.useractions.ui.compile.teamview.SystemTeamViewCompileTypeNode">
</instanceof>
</enabledWhen>
</page>
<page
objectClass="org.eclipse.rse.internal.useractions.ui.compile.teamview.SystemTeamViewCompileCommandNode"
name="%PropertyPage.TeamViewCompileCommandNode"
class="org.eclipse.rse.internal.useractions.ui.propertypages.SystemTeamViewCompileCommandPropertyPage"
id="com.ibm.etools.systems.SystemTeamViewCompileCommandPropertyPage">
<enabledWhen>
<instanceof
value="org.eclipse.rse.internal.useractions.ui.compile.teamview.SystemTeamViewCompileCommandNode">
</instanceof>
</enabledWhen>
</page>
</extension>
</plugin>

View file

@ -6,11 +6,15 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user actions API out of org.eclipse.rse.ui
*******************************************************************************/
package org.eclipse.rse.internal.useractions;
import java.net.URL;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@ -42,22 +46,41 @@ public class Activator extends AbstractUIPlugin {
super.stop(context);
plugin = null;
}
/**
* Returns the shared instance.
*/
public static Activator getDefault() {
return plugin;
}
/* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
*/
protected void initializeImageRegistry(ImageRegistry registry) {
super.initializeImageRegistry(registry);
registry.put(IUserActionsImageIds.COMPILE_0, getImageDescriptor("icons/full/dlcl16/compile.gif")); //$NON-NLS-1$
registry.put(IUserActionsImageIds.COMPILE_1, getImageDescriptor("icons/full/elcl16/compile.gif")); //$NON-NLS-1$
registry.put(IUserActionsImageIds.WORK_WITH_COMPILE_COMMANDS_0, getImageDescriptor("icons/full/dlcl16/workwithcompilecmds.gif")); //$NON-NLS-1$
registry.put(IUserActionsImageIds.WORK_WITH_COMPILE_COMMANDS_1, getImageDescriptor("icons/full/elcl16/workwithcompilecmds.gif")); //$NON-NLS-1$
registry.put(IUserActionsImageIds.WORK_WITH_NAMED_TYPES_0, getImageDescriptor("icons/full/dlcl16/workwithnamedtypes.gif")); //$NON-NLS-1$
registry.put(IUserActionsImageIds.WORK_WITH_NAMED_TYPES_1, getImageDescriptor("icons/full/elcl16/workwithnamedtypes.gif")); //$NON-NLS-1$
registry.put(IUserActionsImageIds.WORK_WITH_USER_ACTIONS_0, getImageDescriptor("icons/full/dlcl16/workwithuseractions.gif")); //$NON-NLS-1$
registry.put(IUserActionsImageIds.WORK_WITH_USER_ACTIONS_1, getImageDescriptor("icons/full/elcl16/workwithuseractions.gif")); //$NON-NLS-1$
}
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path.
*
* @param path the path
* Gets the image descriptor for images in the plugin bundle.
* @param path the plugin relative path of the image
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.rse.useractions", path); //$NON-NLS-1$
public ImageDescriptor getImageDescriptor(String path) {
ImageDescriptor descriptor = null;
URL url = getBundle().getResource(path);
if (url != null) {
descriptor = ImageDescriptor.createFromURL(url);
}
return descriptor;
}
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions;
public interface IUserActionsImageIds {
public static final String COMPILE_0 = "COMPILE_0"; //$NON-NLS-1$
public static final String COMPILE_1 = "COMPILE_1"; //$NON-NLS-1$
public static final String WORK_WITH_USER_ACTIONS_0 = "WORK_WITH_USER_ACTIONS_0"; //$NON-NLS-1$
public static final String WORK_WITH_USER_ACTIONS_1 = "WORK_WITH_USER_ACTIONS_1"; //$NON-NLS-1$
public static final String WORK_WITH_NAMED_TYPES_0 = "WORK_WITH_NAMED_TYPES_0"; //$NON-NLS-1$
public static final String WORK_WITH_NAMED_TYPES_1 = "WORK_WITH_NAMED_TYPES_1"; //$NON-NLS-1$
public static final String WORK_WITH_COMPILE_COMMANDS_0 = "WORK_WITH_COMPILE_COMMANDS_0"; //$NON-NLS-1$
public static final String WORK_WITH_COMPILE_COMMANDS_1 = "WORK_WITH_COMPILE_COMMANDS_1"; //$NON-NLS-1$
}

View file

@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions;
public interface IUserActionsMessageIds {
public static final String MSG_VALIDATE_UDANAME_EMPTY = "RSEG1180"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDANAME_NOTUNIQUE= "RSEG1181"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDANAME_NOTVALID = "RSEG1182"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDACMT_EMPTY = "RSEG1183"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDACMT_NOTVALID = "RSEG1184"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDACMD_EMPTY = "RSEG1185"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDACMD_NOTVALID = "RSEG1186"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTNAME_EMPTY = "RSEG1187"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTNAME_NOTUNIQUE= "RSEG1188"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTNAME_NOTVALID = "RSEG1189"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTTYPES_EMPTY = "RSEG1190"; //$NON-NLS-1$
public static final String MSG_VALIDATE_UDTTYPES_NOTVALID = "RSEG1191"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILELABEL_EMPTY = "RSEG1195"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILELABEL_NOTUNIQUE= "RSEG1196"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILELABEL_NOTVALID = "RSEG1197"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILESTRING_EMPTY = "RSEG1198"; //$NON-NLS-1$
public static final String MSG_VALIDATE_COMPILESTRING_NOTVALID = "RSEG1199"; //$NON-NLS-1$
public static final String MSG_UDA_LOAD_ERROR = "RSEG1140"; //$NON-NLS-1$
public static final String MSG_UDA_ROOTTAG_ERROR = "RSEG1141"; //$NON-NLS-1$
public static final String MSG_CONFIRM_DELETE_USERACTION = "RSEG1230"; //$NON-NLS-1$
public static final String MSG_CONFIRM_DELETE_USERTYPE = "RSEG1231"; //$NON-NLS-1$
}

View file

@ -0,0 +1,32 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions;
/*
* These constants for model change events were taken from ISystemModelChangeEvents.
*/
public interface IUserActionsModelChangeEvents {
/**
* Resource Type: user action
*/
public static final int SYSTEM_RESOURCETYPE_USERACTION = 128;
/**
* Resource Type: named type, which are used in user actions
*/
public static final int SYSTEM_RESOURCETYPE_NAMEDTYPE = 256;
/**
* Resource Type: compile command
*/
public static final int SYSTEM_RESOURCETYPE_COMPILECMD = 512;
}

View file

@ -6,7 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions;
@ -103,7 +105,7 @@ public class UserActionsIcon {
* @return the image descriptor
*/
public ImageDescriptor getImageDescriptor() {
ImageDescriptor descriptor = Activator.getImageDescriptor(location);
ImageDescriptor descriptor = Activator.getDefault().getImageDescriptor(location);
return descriptor;
}

View file

@ -0,0 +1,212 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
/**
* This class is a placeholder documenting the old persistence API and structure for
* user actions, user type filters, and compile commands.
* The class is not functional.
* TODO: (dwd) this needs to be replaced with the new persistence provider scheme.
*/
public class UserActionsPersistenceUtil {
/*
* Bogus infrastructure to make this compile
*/
private static class ResourceHelpers {
IFolder getOrCreateFolder(IFolder parent, String folderName) {
return null;
}
IFolder getFolder(IContainer parent, String folderName) {
return null;
}
}
private static ResourceHelpers getResourceHelpers() {
return new ResourceHelpers();
}
private static IFolder getProfileFolder(String profileName) {
return null;
}
private static String getFolderName(ISubSystemConfiguration subystemConfiguration) {
return null;
}
private static IProject getRemoteSystemsProject() {
return null;
}
private static final String RESOURCE_USERACTIONS_FOLDER_NAME = null;
private static final String RESOURCE_COMPILECOMMANDS_FOLDER_NAME = null;
private static final String RESOURCE_TYPE_FILTERS_FOLDER_NAME = null;
/*
* --------------------------------------------------------------------------------------------------------------------------------
* USER ACTIONS SUBTREE FOLDER METHODS...
* ======================================
* .--- Team (folder) - getProfileFolder(SystemProfile/"team")
* | |
* | |
* | .--- UserActions (folder) - getUserActionsFolder(SystemProfile/"team")
* | |
* | .--- SubSystemConfigurationID1 (folder) - getUserActionsFolder(SystemProfile/"team", SubSystemConfiguration)
* | | .--- actions.xml (file)
* | .--- SubSystemConfigurationID2 (folder)
* | .--- actions.xml (file)
* --------------------------------------------------------------------------------------------------------------------------------
*/
// ---------------------------------------------------
// GET USER DEFINED ACTIONS ROOT FOLDER PER PROFILE...
// ---------------------------------------------------
/**
* Get user defined actions root folder given a system profile name
*/
protected static IFolder getUserActionsFolder(String profileName)
{
return getResourceHelpers().getOrCreateFolder(getProfileFolder(profileName),RESOURCE_USERACTIONS_FOLDER_NAME);
}
/**
* Get user defined actions root folder given a system profile object and subsystem factory
*/
public static IFolder getUserActionsFolder(ISystemProfile profile, ISubSystemConfiguration ssFactory)
{
return getUserActionsFolder(profile.getName(),ssFactory);
}
/**
* Get user defined actions root folder given a system profile name and subsystem factory
*/
public static IFolder getUserActionsFolder(String profileName, ISubSystemConfiguration ssFactory)
{
IFolder parentFolder = getUserActionsFolder(profileName);
String folderName = getFolderName(ssFactory);
return getResourceHelpers().getOrCreateFolder(parentFolder, folderName); // Do create it.
}
/**
* Test for existence of user defined actions root folder given a system profile name and subsystem factory
*/
public static boolean testUserActionsFolder(String profileName, ISubSystemConfiguration ssFactory)
{
IFolder parentFolder = getUserActionsFolder(profileName);
String folderName = getFolderName(ssFactory);
return (getResourceHelpers().getFolder(parentFolder, folderName).exists()); // Do NOT create it.
}
/**
* Get user defined actions root folder given a system profile name and subsystem factory Id.
* This is a special-needs method provided for the Import action processing,
* when a subsystem instance is not available.
*/
public static IFolder getUserActionsFolder( String profileName, String factoryId)
{
IFolder parentFolder = getUserActionsFolder(profileName);
return getResourceHelpers().getOrCreateFolder(parentFolder, factoryId); // Do create it.
}
/*
* --------------------------------------------------------------------------------------------------------------------------------
* COMPILE COMMAND SUBTREE FOLDER METHODS...
* ======================================
* .--- Team (folder) - getProfileFolder(SystemProfile/"team")
* | |
* | |
* | .--- CompileCommands (folder) - getCompileCommandsFolder(SystemProfile/"team")
* | |
* | .--- SubSystemConfigurationID1 (folder) - getCompileCommandsFolder(SystemProfile/"team", SubSystemConfiguration)
* | | .--- compileCommands.xml (file)
* | .--- SubSystemConfigurationID2 (folder)
* | .--- compileCommands.xml (file)
* --------------------------------------------------------------------------------------------------------------------------------
*/
// ---------------------------------------------------
// GET COMPILE COMMANDS ROOT FOLDER PER PROFILE...
// ---------------------------------------------------
/**
* Get compile commands root folder given a system profile name
*/
protected static IFolder getCompileCommandsFolder(String profileName)
{
return getResourceHelpers().getOrCreateFolder(getProfileFolder(profileName),RESOURCE_COMPILECOMMANDS_FOLDER_NAME);
}
/**
* Get compile commands root folder given a system profile object and subsystem factory
*/
public static IFolder getCompileCommandsFolder(ISystemProfile profile, ISubSystemConfiguration ssFactory)
{
return getCompileCommandsFolder(profile.getName(),ssFactory);
}
/**
* Get compile commands root folder given a system profile name and subsystem factory
*/
public static IFolder getCompileCommandsFolder(String profileName, ISubSystemConfiguration ssFactory)
{
IFolder parentFolder = getCompileCommandsFolder(profileName);
String folderName = getFolderName(ssFactory);
return getResourceHelpers().getOrCreateFolder(parentFolder, folderName); // Do create it.
}
/**
* Get compile commands root folder given a system profile name and subsystem factory Id.
* This is a special-needs method provided for the Import action processing,
* when a subsystem instance is not available.
*/
public static IFolder getCompileCommandsFolder( String profileName, String factoryId)
{
IFolder parentFolder = getCompileCommandsFolder(profileName);
return getResourceHelpers().getOrCreateFolder(parentFolder, factoryId); // Do create it.
}
/*
* --------------------------------------------------------------------------------------------------------------------------------
* TYPE FILTERS SUBTREE FOLDER METHODS...
* ======================================
* .--- TypeFilters (folder) - getTypeFiltersFolder()
* .--- SubSystemConfigurationID1 (folder) - getTypeFiltersFolder(SubSystemConfiguration)
* | .--- typefilters.xmi (file)
* --------------------------------------------------------------------------------------------------------------------------------
*/
/**
* Get the typeFilters root folder
*/
public static IFolder getTypeFiltersFolder()
{
return getResourceHelpers().getFolder(getRemoteSystemsProject(),RESOURCE_TYPE_FILTERS_FOLDER_NAME);
}
/**
* Get the typeFilters sub-folder per subsystem factory object
*/
public static IFolder getTypeFiltersFolder(ISubSystemConfiguration ssFactory)
{
IFolder parentFolder = getTypeFiltersFolder();
String folderName = getFolderName(ssFactory);
return getResourceHelpers().getOrCreateFolder(parentFolder, folderName); // DO create it.
}
/**
* Get the typeFilters sub-folder per subsystem factory id
*/
public static IFolder getTypeFiltersFolder(String ssFactoryId)
{
IFolder parentFolder = getTypeFiltersFolder();
return getResourceHelpers().getOrCreateFolder(parentFolder, ssFactoryId); // DO create it.
}
}

View file

@ -1,5 +1,3 @@
package org.eclipse.rse.internal.useractions.files.uda;
/*******************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@ -8,8 +6,12 @@ package org.eclipse.rse.internal.useractions.files.uda;
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.files.uda;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
@ -19,11 +21,11 @@ import java.util.Vector;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.internal.useractions.ui.uda.ISystemUDTypeEditPaneTypesSelector;
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDAResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.messages.ISystemMessageLine;
@ -244,7 +246,7 @@ public class UDTypesEditorFiles implements ISystemUDTypeEditPaneTypesSelector, I
*/
public SystemMessage validate() {
if (typesSelectionList == null) return null;
if (!areTypesSelected()) return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_EMPTY);
if (!areTypesSelected()) return RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDTTYPES_EMPTY);
// validate that user-defined entry field!
return validateUserDefinedTypes();
}
@ -262,7 +264,7 @@ public class UDTypesEditorFiles implements ISystemUDTypeEditPaneTypesSelector, I
if (index == filename.length() - 1) {
if (index == 0 || (index == 1 && filename.charAt(0) == '*')) {
//setErrorMessage(GenericMessages.getString("FileExtension.extensionEmptyMessage")); //$NON-NLS-1$
return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_NOTVALID);
return RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDTTYPES_NOTVALID);
}
}
int startScan = 0;
@ -275,11 +277,11 @@ public class UDTypesEditorFiles implements ISystemUDTypeEditPaneTypesSelector, I
if (index > -1) {
if (filename.length() == 1) {
//setErrorMessage(GenericMessages.getString("FileExtension.extensionEmptyMessage")); //$NON-NLS-1$
return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_NOTVALID);
return RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDTTYPES_NOTVALID);
}
if (index != 0 || filename.charAt(1) != '.') {
//setErrorMessage(GenericMessages.getString("FileExtension.fileNameInvalidMessage")); //$NON-NLS-1$
return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_NOTVALID);
return RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDTTYPES_NOTVALID);
}
}
return null;

View file

@ -6,8 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
* David Dykstal (IBM) - [186589] move user actions API out of org.eclipse.rse.ui
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.compile;
@ -19,7 +20,8 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.internal.ui.GenericMessages;
import org.eclipse.rse.internal.ui.view.SystemTableViewProvider;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.internal.useractions.Activator;
import org.eclipse.rse.internal.useractions.IUserActionsImageIds;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.actions.SystemBaseAction;
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
@ -43,7 +45,7 @@ public class SystemCompileAction extends SystemBaseAction {
*/
public SystemCompileAction(Shell shell, SystemCompileCommand compileCommand, boolean isPrompt) {
super(
isPrompt ? compileCommand.getLabel() + "..." : compileCommand.getLabel(), compileCommand.getLabel(), RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_COMPILE_ID), shell); // null == image //$NON-NLS-1$
isPrompt ? compileCommand.getLabel() + "..." : compileCommand.getLabel(), compileCommand.getLabel(), Activator.getDefault().getImageDescriptor(IUserActionsImageIds.COMPILE_1), shell); // null == image //$NON-NLS-1$
this.compileCmd = compileCommand;
this.isPrompt = isPrompt;
SystemCompileManager mgr = compileCommand.getParentType().getParentProfile().getParentManager();

View file

@ -6,8 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
* David Dykstal (IBM) - [186589] move user actions API out of org.eclipse.rse.ui
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.compile;

View file

@ -8,7 +8,9 @@ package org.eclipse.rse.internal.useractions.ui.compile;
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
import java.util.Vector;
@ -18,13 +20,13 @@ import org.eclipse.rse.internal.useractions.ui.SystemCmdSubstVarList;
import org.eclipse.rse.internal.useractions.ui.SystemCommandTextField;
import org.eclipse.rse.internal.useractions.ui.SystemCommandViewerConfiguration;
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDAResources;
import org.eclipse.rse.internal.useractions.ui.validators.ValidatorCompileCommandLabel;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.shells.ui.view.ISystemCommandTextModifyListener;
import org.eclipse.rse.ui.ISystemMassager;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ISystemValidatorUniqueString;
import org.eclipse.rse.ui.validators.ValidatorCompileCommandLabel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

View file

@ -8,11 +8,14 @@ package org.eclipse.rse.internal.useractions.ui.compile;
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.internal.useractions.Activator;
import org.eclipse.rse.internal.useractions.IUserActionsImageIds;
import org.eclipse.swt.graphics.Image;
/**
@ -20,6 +23,9 @@ import org.eclipse.swt.graphics.Image;
* dialog.
*/
public class SystemCompileCommandLabelProvider extends LabelProvider {
Image _compileCommandImage = null;
/**
* Constructor
*/
@ -27,8 +33,8 @@ public class SystemCompileCommandLabelProvider extends LabelProvider {
super();
}
/**
* Override of parent to return the visual label for the given compile command
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
*/
public String getText(Object element) {
if (element instanceof SystemCompileCommand)
@ -39,11 +45,19 @@ public class SystemCompileCommandLabelProvider extends LabelProvider {
return null;
}
/**
* Override of parent so we can supply an image, if we desire.
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
*/
public Image getImage(Object element) {
if (element instanceof SystemCompileCommand) return RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_COMPILE_ID);
return null;
Image result = null;
if (element instanceof SystemCompileCommand) {
if (_compileCommandImage == null || _compileCommandImage.isDisposed()) {
ImageDescriptor id = Activator.getDefault().getImageDescriptor(IUserActionsImageIds.COMPILE_1);
_compileCommandImage = id.createImage();
}
result = _compileCommandImage;
}
return result;
}
}

View file

@ -6,9 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [186589] move user actions API out of org.eclipse.rse.ui
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.compile;
@ -18,11 +19,11 @@ import java.util.Hashtable;
import org.eclipse.core.resources.IFolder;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemResourceManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.SystemStartHere;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.useractions.UserActionsPersistenceUtil;
import org.eclipse.rse.internal.useractions.ui.SystemCmdSubstVarList;
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDAResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
@ -210,7 +211,7 @@ public abstract class SystemCompileManager {
}
//System.out.println("systemProfile = " + systemProfile);
//System.out.println("subsystemFactory = " + subsystemFactory);
IFolder folder = SystemResourceManager.getCompileCommandsFolder(systemProfile, subsystemFactory);
IFolder folder = UserActionsPersistenceUtil.getCompileCommandsFolder(systemProfile, subsystemFactory);
return folder;
}

View file

@ -8,6 +8,8 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.compile;
@ -17,10 +19,10 @@ import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
import org.eclipse.rse.internal.useractions.IUserActionsImageIds;
import org.eclipse.rse.internal.useractions.ui.compile.teamview.SystemTeamViewCompileTypeNode;
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDAResources;
import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
@ -39,7 +41,7 @@ public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction
public SystemWorkWithCompileCommandsAction(Shell shell, boolean fromCascadingCompileAction) {
super(fromCascadingCompileAction ? SystemUDAResources.ACTION_WORKWITH_WWCOMPILE_CMDS_LABEL : SystemUDAResources.ACTION_WORKWITH_COMPILE_CMDS_LABEL,
fromCascadingCompileAction ? SystemUDAResources.ACTION_WORKWITH_WWCOMPILE_CMDS_TOOLTIP : SystemUDAResources.ACTION_WORKWITH_COMPILE_CMDS_TOOLTIP, RSEUIPlugin.getDefault()
.getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_WORKWITHCOMPILECMDS_ID), shell);
.getImageDescriptor(IUserActionsImageIds.WORK_WITH_COMPILE_COMMANDS_1), shell);
allowOnMultipleSelection(false);
if (!fromCascadingCompileAction)
setContextMenuGroup(ISystemContextMenuConstants.GROUP_WORKWITH);

View file

@ -9,6 +9,8 @@
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.compile;
@ -28,6 +30,7 @@ import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.events.ISystemModelChangeEvents;
import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
import org.eclipse.rse.internal.useractions.IUserActionsModelChangeEvents;
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDAResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemContextMenuConstants;
@ -585,10 +588,10 @@ public class SystemWorkWithCompileCommandsDialog extends SystemPromptDialog impl
saveCompileCommand(editedCompileCmd, newMode, prevListSelection);
processCommandsListSelected();
if (newMode)
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, editedCompileCmd,
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, editedCompileCmd,
null);
else
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD,
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD,
editedCompileCmd, null);
}
}
@ -927,7 +930,7 @@ public class SystemWorkWithCompileCommandsDialog extends SystemPromptDialog impl
rmvSrcTypeButton.setEnabled(true);
//traceTest = false;
// fire model change event in case any BP code is listening...
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, deletedCmd, null);
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, deletedCmd, null);
}
} catch (Exception exc) {
}
@ -964,7 +967,7 @@ public class SystemWorkWithCompileCommandsDialog extends SystemPromptDialog impl
listView.showSelection();
processCommandsListSelected();
// fire model change event in case any BP code is listening...
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REORDERED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, currCmd, null);
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REORDERED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, currCmd, null);
}
/**
@ -998,7 +1001,7 @@ public class SystemWorkWithCompileCommandsDialog extends SystemPromptDialog impl
listView.showSelection();
processCommandsListSelected();
// fire model change event in case any BP code is listening...
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REORDERED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, currCmd, null);
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REORDERED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, currCmd, null);
}
/**
@ -1060,7 +1063,7 @@ public class SystemWorkWithCompileCommandsDialog extends SystemPromptDialog impl
clipboard.dispose();
clipboard = null;
// fire model change event in case any BP code is listening...
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, oldCmd, null);
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, oldCmd, null);
}
/**

View file

@ -6,7 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.compile.teamview;
@ -14,8 +16,8 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.internal.useractions.IUserActionsImageIds;
import org.eclipse.rse.internal.useractions.ui.compile.SystemCompileCommand;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
/**
@ -49,7 +51,7 @@ public class SystemTeamViewCompileCommandNode implements IAdaptable {
* @return the image to show in the tree, for this node
*/
public ImageDescriptor getImageDescriptor() {
return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_COMPILE_ID);
return RSEUIPlugin.getDefault().getImageDescriptor(IUserActionsImageIds.COMPILE_1);
}
/**

View file

@ -9,6 +9,8 @@
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.propertypages;
@ -17,6 +19,7 @@ import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.events.ISystemModelChangeEvents;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.useractions.IUserActionsModelChangeEvents;
import org.eclipse.rse.internal.useractions.UserActionsResources;
import org.eclipse.rse.internal.useractions.ui.compile.ISystemCompileCommandEditPaneHoster;
import org.eclipse.rse.internal.useractions.ui.compile.ISystemCompileCommandEditPaneListener;
@ -166,7 +169,7 @@ public class SystemTeamViewCompileCommandPropertyPage extends SystemBaseProperty
ok = (editedCompileCmd != null);
if (!ok) return false;
getCompileCommand().getCompileCommand().getParentType().getParentProfile().writeToDisk();
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, editedCompileCmd, null);
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD, editedCompileCmd, null);
return ok;
}

View file

@ -9,6 +9,8 @@
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
@ -24,18 +26,19 @@ import org.eclipse.rse.core.events.ISystemModelChangeEvents;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.useractions.IUserActionsModelChangeEvents;
import org.eclipse.rse.internal.useractions.ui.ISystemCommandTextAdditionalGUIProvider;
import org.eclipse.rse.internal.useractions.ui.SystemCmdSubstVarList;
import org.eclipse.rse.internal.useractions.ui.SystemCommandTextField;
import org.eclipse.rse.internal.useractions.ui.SystemCommandViewerConfiguration;
import org.eclipse.rse.internal.useractions.ui.validators.ValidatorUserActionComment;
import org.eclipse.rse.internal.useractions.ui.validators.ValidatorUserActionName;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.shells.ui.view.ISystemCommandTextModifyListener;
import org.eclipse.rse.ui.ISystemMassager;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ISystemValidatorUniqueString;
import org.eclipse.rse.ui.validators.ValidatorUserActionComment;
import org.eclipse.rse.ui.validators.ValidatorUserActionName;
import org.eclipse.rse.ui.widgets.SystemEditPaneStateMachine;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
@ -1097,9 +1100,9 @@ public class SystemUDActionEditPane implements SelectionListener, // for the che
udam.saveUserData(currentProfile);
// inform anybody registered as listeners that we have created/changed model object...
if (newMode)
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_USERACTION, currentAction, null);
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_USERACTION, currentAction, null);
else
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_USERACTION, currentAction, null);
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_USERACTION, currentAction, null);
}
/**

View file

@ -1,5 +1,3 @@
package org.eclipse.rse.internal.useractions.ui.uda;
/*******************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@ -8,17 +6,20 @@ package org.eclipse.rse.internal.useractions.ui.uda;
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user actions API out of org.eclipse.rse.ui
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
import java.io.File;
import java.util.Vector;
import org.eclipse.core.resources.IFolder;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.rse.core.SystemResourceManager;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.useractions.UserActionsIcon;
import org.eclipse.rse.internal.useractions.UserActionsPersistenceUtil;
import org.eclipse.swt.graphics.Image;
import org.w3c.dom.Element;
@ -130,14 +131,14 @@ public class SystemUDActionManager extends SystemUDBaseManager
* for the given profile
*/
protected IFolder getDocumentFolder(ISubSystemConfiguration subsystemFactory, ISystemProfile profile) {
return SystemResourceManager.getUserActionsFolder(profile.getName(), subsystemFactory);
return UserActionsPersistenceUtil.getUserActionsFolder(profile.getName(), subsystemFactory);
}
/**
* Intended for IMPORT actions only, where no Subsystem instance available:
*/
public void setFolder(String profileName, String factoryId) {
importCaseFolder = SystemResourceManager.getUserActionsFolder(profileName, factoryId);
importCaseFolder = UserActionsPersistenceUtil.getUserActionsFolder(profileName, factoryId);
}
/**
@ -152,7 +153,7 @@ public class SystemUDActionManager extends SystemUDBaseManager
*/
public boolean hasActions(ISystemProfile profile, ISubSystemConfiguration ssFactory) {
boolean hasActions = false;
boolean folderExists = SystemResourceManager.testUserActionsFolder(profile.getName(), ssFactory);
boolean folderExists = UserActionsPersistenceUtil.testUserActionsFolder(profile.getName(), ssFactory);
if (folderExists) {
String fileName = getFilePath(profile);
if (fileName != null) {

View file

@ -8,14 +8,16 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.rse.core.events.ISystemModelChangeEvents;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.useractions.IUserActionsModelChangeEvents;
import org.eclipse.swt.widgets.Composite;
/**
@ -46,7 +48,7 @@ public class SystemUDActionTreeView extends SystemUDBaseTreeView {
* This is a parent class override.
*/
protected int getResourceType() {
return ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_USERACTION;
return IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_USERACTION;
}
/**

View file

@ -9,6 +9,8 @@
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [180562][api] dont implement ISystemUDAConstants
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
@ -50,6 +52,7 @@ import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.ISystemMessages;
@ -422,7 +425,7 @@ public abstract class SystemUDBaseManager implements ErrorHandler, IResourceChan
// Phil. 08/2002
if ((null == docroot) || !docroot.getTagName().equals(getDocumentRootTagName())) {
Shell activeShell = getActiveShell();
SystemMessage docRootMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_UDA_ROOTTAG_ERROR);
SystemMessage docRootMsg = RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_UDA_ROOTTAG_ERROR);
String oldFileName = getFilePath(profile);
String newFileName = getFileName() + ".bad"; //$NON-NLS-1$
IFile file = getFolder(profile).getFile(getFileName());
@ -444,7 +447,7 @@ public abstract class SystemUDBaseManager implements ErrorHandler, IResourceChan
Document doc = initializeDocument();
SystemMessageDialog msgdlg = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), RSEUIPlugin.getPluginMessage(
// ISystemMessages.MSG_RESTORE_FAILED).makeSubstitution(exc));
ISystemMessages.MSG_UDA_LOAD_ERROR).makeSubstitution(fileName, exc));
IUserActionsMessageIds.MSG_UDA_LOAD_ERROR).makeSubstitution(fileName, exc));
msgdlg.open();
return doc;
}

View file

@ -9,6 +9,8 @@
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
@ -29,9 +31,9 @@ import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.actions.ISystemAction;
@ -398,7 +400,7 @@ public class SystemUDBaseTreeView extends TreeViewer implements IMenuListener, I
* Return message for delete confirmation
*/
protected SystemMessage getDeleteConfirmationMessage() {
return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONFIRM_DELETE_USERACTION);
return RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_CONFIRM_DELETE_USERACTION);
}
/**

View file

@ -8,13 +8,14 @@ package org.eclipse.rse.internal.useractions.ui.uda;
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user actions API out of org.eclipse.rse.ui
*******************************************************************************/
import org.eclipse.rse.internal.useractions.ui.validators.ValidatorUserTypeTypes;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.messages.ISystemMessageLine;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorUserTypeTypes;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@ -171,7 +172,7 @@ public class SystemUDSimpleTypesListEditor implements ISystemUDTypeEditPaneTypes
nonEditableVerbage.setVisible(false);
else {
nonEditableVerbage.setVisible(true);
if (vendor.equals("IBM"))
if (vendor.equals("IBM")) //$NON-NLS-1$
nonEditableVerbage.setText(SystemUDAResources.RESID_UDT_IBM_VERBAGE);
else {
String verbage = SystemUDAResources.RESID_UDT_VENDOR_VERBAGE;

View file

@ -9,6 +9,8 @@
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
@ -24,9 +26,10 @@ import org.eclipse.rse.core.events.ISystemModelChangeEvents;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.useractions.IUserActionsModelChangeEvents;
import org.eclipse.rse.internal.useractions.ui.validators.ValidatorUserTypeName;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.validators.ValidatorUserTypeName;
import org.eclipse.rse.ui.widgets.SystemEditPaneStateMachine;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@ -472,9 +475,9 @@ public class SystemUDTypeEditPane implements ISelectionChangedListener {
udtm.saveUserData();
// inform anybody registered as listeners that we have created/changed model object...
if (newMode)
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_NAMEDTYPE, currentType, null);
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_NAMEDTYPE, currentType, null);
else
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_NAMEDTYPE, currentType, null);
RSECorePlugin.getTheSystemRegistry().fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED, IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_NAMEDTYPE, currentType, null);
}
/**

View file

@ -6,8 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
* David Dykstal (IBM) - [186589] move user actions API out of org.eclipse.rse.ui
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
@ -19,10 +20,10 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.rse.core.SystemResourceHelpers;
import org.eclipse.rse.core.SystemResourceManager;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.useractions.UserActionsIcon;
import org.eclipse.rse.internal.useractions.UserActionsPersistenceUtil;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.swt.graphics.Image;
import org.w3c.dom.Element;
@ -159,7 +160,7 @@ public class SystemUDTypeManager extends SystemUDBaseManager {
*/
protected IFolder getDocumentFolder(ISubSystemConfiguration subsystemFactory, ISystemProfile profile) {
// return new location, as of R2
IFolder typesFolder = SystemResourceManager.getTypeFiltersFolder(subsystemFactory);
IFolder typesFolder = UserActionsPersistenceUtil.getTypeFiltersFolder(subsystemFactory);
// we check here for any residual old types files from R1. If found, we move it
// to the new location right away!
// TODO: DELETE THIS EXPENSIVE LOGIC AFTER A FEW RELEASES.
@ -167,7 +168,7 @@ public class SystemUDTypeManager extends SystemUDBaseManager {
//if (profile == null)
// profile = subsystem.getSystemProfile();
//System.out.println("Is profile null? " + (profile==null));
IFolder oldFolder = SystemResourceManager.getUserActionsFolder(profile.getName(), subsystemFactory);
IFolder oldFolder = UserActionsPersistenceUtil.getUserActionsFolder(profile.getName(), subsystemFactory);
IFile oldFile = oldFolder.getFile(getFileName());
if (exists(oldFile)) {
//System.out.println("Attempt to move old types folder...");
@ -209,7 +210,7 @@ public class SystemUDTypeManager extends SystemUDBaseManager {
*/
public void setFolder(String profileName, String factoryId) {
//importCaseFolder = SystemResourceManager.getUserActionsFolder(profileName, factoryId);
importCaseFolder = SystemResourceManager.getTypeFiltersFolder(factoryId);
importCaseFolder = UserActionsPersistenceUtil.getTypeFiltersFolder(factoryId);
}
/**

View file

@ -8,16 +8,18 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.rse.core.events.ISystemModelChangeEvents;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.internal.useractions.IUserActionsModelChangeEvents;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.swt.widgets.Composite;
@ -72,7 +74,7 @@ public class SystemUDTypeTreeView extends SystemUDBaseTreeView {
* Return message for delete confirmation
*/
protected SystemMessage getDeleteConfirmationMessage() {
return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONFIRM_DELETE_USERTYPE);
return RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_CONFIRM_DELETE_USERTYPE);
}
/**
@ -80,7 +82,7 @@ public class SystemUDTypeTreeView extends SystemUDBaseTreeView {
* This is a parent class override.
*/
protected int getResourceType() {
return ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_NAMEDTYPE;
return IUserActionsModelChangeEvents.SYSTEM_RESOURCETYPE_NAMEDTYPE;
}
/**

View file

@ -9,16 +9,18 @@ package org.eclipse.rse.internal.useractions.ui.uda.actions;
*
* Contributors:
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
import org.eclipse.rse.internal.useractions.IUserActionsImageIds;
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDAResources;
import org.eclipse.rse.internal.useractions.ui.uda.SystemWorkWithUDTypeDialog;
import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
import org.eclipse.swt.widgets.Shell;
@ -70,7 +72,7 @@ public class SystemWorkWithFileTypesAction extends SystemBaseDialogAction {
*/
public SystemWorkWithFileTypesAction(Shell parent) {
super(SystemUDAResources.ACTION_WORKWITH_NAMEDTYPES_LABEL, SystemUDAResources.ACTION_WORKWITH_NAMEDTYPES_TOOLTIP, RSEUIPlugin.getDefault().getImageDescriptor(
ISystemIconConstants.ICON_SYSTEM_WORKWITHNAMEDTYPES_ID), parent);
IUserActionsImageIds.WORK_WITH_NAMED_TYPES_1), parent);
allowOnMultipleSelection(false);
setContextMenuGroup(ISystemContextMenuConstants.GROUP_WORKWITH);
setHelp(RSEUIPlugin.HELPPREFIX + "actn0046"); //$NON-NLS-1$

View file

@ -9,6 +9,8 @@ package org.eclipse.rse.internal.useractions.ui.uda.actions;
*
* Contributors:
* IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
*******************************************************************************/
//import java.util.Iterator;
import org.eclipse.jface.dialogs.Dialog;
@ -17,10 +19,10 @@ import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
import org.eclipse.rse.internal.useractions.IUserActionsImageIds;
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDAResources;
import org.eclipse.rse.internal.useractions.ui.uda.SystemWorkWithUDAsDialog;
import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
import org.eclipse.swt.widgets.Shell;
@ -61,7 +63,7 @@ public class SystemWorkWithUDAsAction extends SystemBaseDialogAction {
*/
public SystemWorkWithUDAsAction(Shell parent) {
super(SystemUDAResources.ACTION_WORKWITH_UDAS_LABEL, SystemUDAResources.ACTION_WORKWITH_UDAS_TOOLTIP, RSEUIPlugin.getDefault().getImageDescriptor(
ISystemIconConstants.ICON_SYSTEM_WORKWITHUSERACTIONS_ID), parent);
IUserActionsImageIds.WORK_WITH_USER_ACTIONS_1), parent);
allowOnMultipleSelection(false);
setContextMenuGroup(ISystemContextMenuConstants.GROUP_WORKWITH);
setHelp(RSEUIPlugin.HELPPREFIX + "actn0045"); //$NON-NLS-1$
@ -76,7 +78,7 @@ public class SystemWorkWithUDAsAction extends SystemBaseDialogAction {
public SystemWorkWithUDAsAction(Shell parent, boolean fromCascadingCompileAction) {
super(fromCascadingCompileAction ? SystemUDAResources.ACTION_WORKWITH_WWUDAS_LABEL : SystemUDAResources.ACTION_WORKWITH_UDAS_LABEL,
fromCascadingCompileAction ? SystemUDAResources.ACTION_WORKWITH_WWUDAS_TOOLTIP : SystemUDAResources.ACTION_WORKWITH_UDAS_TOOLTIP, RSEUIPlugin.getDefault().getImageDescriptor(
ISystemIconConstants.ICON_SYSTEM_WORKWITHUSERACTIONS_ID), parent);
IUserActionsImageIds.WORK_WITH_USER_ACTIONS_1), parent);
allowOnMultipleSelection(false);
if (!fromCascadingCompileAction)
setContextMenuGroup(ISystemContextMenuConstants.GROUP_WORKWITH);

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -11,122 +11,114 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.ui.validators;
package org.eclipse.rse.internal.useractions.ui.validators;
import java.util.Collection;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorUniqueString;
/**
* This class is used to verify a user defined compile command's label
*/
public class ValidatorCompileCommandLabel extends ValidatorUniqueString
implements ISystemValidator
{
public class ValidatorCompileCommandLabel extends ValidatorUniqueString implements ISystemValidator {
public static final int MAX_CMDLABEL_LENGTH = 50; // max name for a compile command name
protected boolean fUnique;
protected SystemMessage msg_Invalid;
protected boolean fUnique;
protected SystemMessage msg_Invalid;
protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
/**
* Use this constructor when you have a list of existing labels.
* The collection will not be modified by the validator.
*/
public ValidatorCompileCommandLabel(Collection existingLabelList)
{
public ValidatorCompileCommandLabel(Collection existingLabelList) {
super(existingLabelList, CASE_INSENSITIVE); // case insensitive uniqueness
init();
init();
}
/**
* Use this constructor when you have an array of existing labels.
*/
public ValidatorCompileCommandLabel(String existingLabelList[])
{
public ValidatorCompileCommandLabel(String existingLabelList[]) {
super(existingLabelList, CASE_INSENSITIVE); // case insensitive uniqueness
init();
init();
}
/**
* Use this constructor when the name need not be unique, and you just want
* the syntax checking. Or if you will call setExistingNamesList later.
*/
public ValidatorCompileCommandLabel()
{
public ValidatorCompileCommandLabel() {
super(new String[0], CASE_INSENSITIVE);
init();
}
private void init()
{
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_COMPILELABEL_EMPTY),
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_COMPILELABEL_NOTUNIQUE));
fUnique = true;
msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_COMPILELABEL_NOTVALID);
init();
}
private void init() {
super.setErrorMessages(RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_COMPILELABEL_EMPTY), RSEUIPlugin
.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_COMPILELABEL_NOTUNIQUE));
fUnique = true;
msg_Invalid = RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_COMPILELABEL_NOTVALID);
}
/**
* Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
* @param msg_Empty error message when entry field is empty
* @param msg_NonUnique error message when value entered is not unique
* @param msg_Invalid error message when syntax is not valid
*/
public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
{
public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid) {
super.setErrorMessages(msg_Empty, msg_NonUnique);
this.msg_Invalid = msg_Invalid;
this.msg_Invalid = msg_Invalid;
}
/**
* Overridable method for invalidate character check, beyond what this class offers
* @return true if valid, false if not
*/
protected boolean checkForBadCharacters(String newText)
{
protected boolean checkForBadCharacters(String newText) {
return ((newText.indexOf('&') == -1) && // causes problems in menu popup as its a mnemonic character.
(newText.indexOf('@') == -1)); // defect 43950
(newText.indexOf('@') == -1)); // defect 43950
}
public String toString()
{
public String toString() {
return getClass().getName();
}
// ---------------------------
// Parent Overrides...
// ---------------------------
// ---------------------------
// Parent Overrides...
// ---------------------------
/**
* Validate each character.
* Override of parent method.
* Override yourself to refine the error checking.
*/
public SystemMessage isSyntaxOk(String newText)
{
if (newText.length() > getMaximumNameLength())
currentMessage = msg_Invalid;
else
currentMessage = checkForBadCharacters(newText) ? null: msg_Invalid;
return currentMessage;
public SystemMessage isSyntaxOk(String newText) {
if (newText.length() > getMaximumNameLength())
currentMessage = msg_Invalid;
else
currentMessage = checkForBadCharacters(newText) ? null : msg_Invalid;
return currentMessage;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* Return the max length for compile commands: 50
*/
public int getMaximumNameLength()
{
return MAX_CMDLABEL_LENGTH;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* Return the max length for compile commands: 50
*/
public int getMaximumNameLength() {
return MAX_CMDLABEL_LENGTH;
}
}

View file

@ -0,0 +1,107 @@
/********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.internal.useractions.ui.validators;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.validators.ISystemValidator;
/**
* This class is used to verify a user defined action's command
*/
public class ValidatorUserActionCommand implements ISystemValidator {
public static final int MAX_UDACMD_LENGTH = 512; // max command for an action
protected SystemMessage emptyMsg, invalidMsg, currentMessage;
/**
* Constructor to use when wanting to specify the "value required" error message,
* but use the default for the "Value not valid" error message
*/
public ValidatorUserActionCommand() {
setErrorMessages(RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDACMD_EMPTY), RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDACMD_NOTVALID));
}
/**
* Set the error messages, overriding the defaults
*/
public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg) {
this.emptyMsg = emptyMsg;
this.invalidMsg = invalidMsg;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
*/
public String isValid(Object input) {
currentMessage = null;
if (!(input instanceof String)) {
return null;
} else
return isValid((String) input);
}
/**
* @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
* @see #getSystemMessage()
*/
public String isValid(String input) {
currentMessage = null;
if ((input == null) || (input.length() == 0)) {
currentMessage = emptyMsg;
} else {
if (input.length() > MAX_UDACMD_LENGTH) currentMessage = invalidMsg;
}
return (currentMessage == null) ? null : currentMessage.getLevelOneText();
}
/**
* When isValid returns non-null, call this to get the SystemMessage object for the error
* versus the simple string message.
*/
public SystemMessage getSystemMessage() {
return currentMessage;
}
/**
* Return the max length for comments
*/
public int getMaximumNameLength() {
return MAX_UDACMD_LENGTH;
}
/**
* For convenience, this is a shortcut to calling:
* <pre><code>
* if (isValid(text) != null)
* msg = getSystemMessage();
* </code></pre>
*/
public SystemMessage validate(String text) {
if (isValid(text) != null)
return currentMessage;
else
return null;
}
}

View file

@ -0,0 +1,107 @@
/********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.internal.useractions.ui.validators;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.validators.ISystemValidator;
/**
* This class is used to verify a user defined action's comment
*/
public class ValidatorUserActionComment implements ISystemValidator {
public static final int MAX_UDACMT_LENGTH = 256; // max comment for an action
protected SystemMessage emptyMsg, invalidMsg, currentMessage;
/**
* Constructor to use when wanting to specify the "value required" error message,
* but use the default for the "Value not valid" error message
*/
public ValidatorUserActionComment() {
setErrorMessages(RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDACMT_EMPTY), RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDACMT_NOTVALID));
}
/**
* Set the error messages, overriding the defaults
*/
public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg) {
this.emptyMsg = emptyMsg;
this.invalidMsg = invalidMsg;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
*/
public String isValid(Object input) {
currentMessage = null;
if (!(input instanceof String)) {
return null;
} else
return isValid((String) input);
}
/**
* @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
* @see #getSystemMessage()
*/
public String isValid(String input) {
currentMessage = null;
if ((input == null) || (input.length() == 0)) {
//currentMessage = emptyMsg;
} else {
if (input.length() > MAX_UDACMT_LENGTH) currentMessage = invalidMsg;
}
return (currentMessage == null) ? null : currentMessage.getLevelOneText();
}
/**
* When isValid returns non-null, call this to get the SystemMessage object for the error
* versus the simple string message.
*/
public SystemMessage getSystemMessage() {
return currentMessage;
}
/**
* Return the max length for comments
*/
public int getMaximumNameLength() {
return MAX_UDACMT_LENGTH;
}
/**
* For convenience, this is a shortcut to calling:
* <pre><code>
* if (isValid(text) != null)
* msg = getSystemMessage();
* </code></pre>
*/
public SystemMessage validate(String text) {
if (isValid(text) != null)
return currentMessage;
else
return null;
}
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -11,124 +11,115 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.ui.validators;
package org.eclipse.rse.internal.useractions.ui.validators;
import java.util.Collection;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorUniqueString;
/**
* This class is used to verify a user defined action's name.
*/
public class ValidatorUserActionName extends ValidatorUniqueString
implements ISystemValidator
{
public class ValidatorUserActionName extends ValidatorUniqueString implements ISystemValidator {
public static final int MAX_UDANAME_LENGTH = 256; // max name for an action
protected boolean fUnique;
protected SystemMessage msg_Invalid;
protected boolean fUnique;
protected SystemMessage msg_Invalid;
protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
/**
* Use this constructor when the name must be unique.
* @param existingNameList a collection of existing names to compare against.
* The collection will not be modified by the validator.
*/
public ValidatorUserActionName(Collection existingNameList)
{
public ValidatorUserActionName(Collection existingNameList) {
super(existingNameList, CASE_SENSITIVE); // case sensitive uniqueness
init();
init();
}
/**
* Use this constructor when the name must be unique. Give the
* ctor a string array of existing names to compare against.
*/
public ValidatorUserActionName(String existingNameList[])
{
public ValidatorUserActionName(String existingNameList[]) {
super(existingNameList, CASE_SENSITIVE); // case sensitive uniqueness
init();
init();
}
/**
* Use this constructor when the name need not be unique, and you just want
* the syntax checking.
*/
public ValidatorUserActionName()
{
public ValidatorUserActionName() {
super(new String[0], CASE_SENSITIVE);
init();
}
private void init()
{
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDANAME_EMPTY),
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDANAME_NOTUNIQUE));
fUnique = true;
msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDANAME_NOTVALID);
init();
}
private void init() {
super.setErrorMessages(RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDANAME_EMPTY), RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDANAME_NOTUNIQUE));
fUnique = true;
msg_Invalid = RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDANAME_NOTVALID);
}
/**
* Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
* @param msg_Empty error message when entry field is empty
* @param msg_NonUnique error message when value entered is not unique
* @param msg_Invalid error message when syntax is not valid
*/
public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
{
public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid) {
super.setErrorMessages(msg_Empty, msg_NonUnique);
this.msg_Invalid = msg_Invalid;
this.msg_Invalid = msg_Invalid;
}
/**
* Overridable method for invalidate character check, beyond what this class offers
* @return true if valid, false if not
*/
protected boolean checkForBadCharacters(String newText)
{
protected boolean checkForBadCharacters(String newText) {
return ((newText.indexOf('&') == -1) && // causes problems in menu popup as its a mnemonic character
(newText.indexOf('@') == -1)); // defect 43950
(newText.indexOf('@') == -1)); // defect 43950
}
public String toString()
{
public String toString() {
return "UserActionNameValidator class"; //$NON-NLS-1$
}
// ---------------------------
// Parent Overrides...
// ---------------------------
// ---------------------------
// Parent Overrides...
// ---------------------------
/**
* Validate each character.
* Override of parent method.
* Override yourself to refine the error checking.
*/
public SystemMessage isSyntaxOk(String newText)
{
if (newText.length() > getMaximumNameLength())
currentMessage = msg_Invalid;
else
currentMessage = checkForBadCharacters(newText) ? null: msg_Invalid;
return currentMessage;
public SystemMessage isSyntaxOk(String newText) {
if (newText.length() > getMaximumNameLength())
currentMessage = msg_Invalid;
else
currentMessage = checkForBadCharacters(newText) ? null : msg_Invalid;
return currentMessage;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* Return the max length for folder names: 256
*/
public int getMaximumNameLength()
{
return MAX_UDANAME_LENGTH;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* Return the max length for folder names: 256
*/
public int getMaximumNameLength() {
return MAX_UDANAME_LENGTH;
}
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -11,96 +11,87 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.ui.validators;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
package org.eclipse.rse.internal.useractions.ui.validators;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorUniqueString;
/**
* This class is used to verify a user defined type's name.
*/
public class ValidatorUserTypeName extends ValidatorUniqueString
implements ISystemValidator
{
public class ValidatorUserTypeName extends ValidatorUniqueString implements ISystemValidator {
public static final int MAX_UDTNAME_LENGTH = 50; // max name for a file type
protected SystemMessage msg_Invalid;
protected SystemMessage msg_Invalid;
/**
* Use this constructor when the name need not be unique, and you just want the syntax checking.
*/
public ValidatorUserTypeName()
{
public ValidatorUserTypeName() {
super(new String[0], CASE_INSENSITIVE);
init();
}
private void init()
{
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTNAME_EMPTY),
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTNAME_NOTUNIQUE));
msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTNAME_NOTVALID);
init();
}
private void init() {
super.setErrorMessages(RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDTNAME_EMPTY), RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDTNAME_NOTUNIQUE));
msg_Invalid = RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDTNAME_NOTVALID);
}
/**
* Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
* @param msg_Empty error message when entry field is empty
* @param msg_NonUnique error message when value entered is not unique
* @param msg_Invalid error message when syntax is not valid
*/
public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
{
public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid) {
super.setErrorMessages(msg_Empty, msg_NonUnique);
this.msg_Invalid = msg_Invalid;
this.msg_Invalid = msg_Invalid;
}
/**
* Overridable method for invalidate character check, beyond what this class offers
* @return true if valid, false if not
*/
protected boolean checkForBadCharacters(String newText)
{
protected boolean checkForBadCharacters(String newText) {
return true;
}
public String toString()
{
public String toString() {
return "UserTypeNameValidator class"; //$NON-NLS-1$
}
// ---------------------------
// Parent Overrides...
// ---------------------------
// ---------------------------
// Parent Overrides...
// ---------------------------
/**
* Validate each character.
* Override of parent method.
* Override yourself to refine the error checking.
*/
public SystemMessage isSyntaxOk(String newText)
{
if (newText.length() > getMaximumNameLength())
currentMessage = msg_Invalid;
else
currentMessage = checkForBadCharacters(newText) ? null: msg_Invalid;
return currentMessage;
public SystemMessage isSyntaxOk(String newText) {
if (newText.length() > getMaximumNameLength())
currentMessage = msg_Invalid;
else
currentMessage = checkForBadCharacters(newText) ? null : msg_Invalid;
return currentMessage;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* Return the max length for folder names: 50
*/
public int getMaximumNameLength()
{
return MAX_UDTNAME_LENGTH;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* Return the max length for folder names: 50
*/
public int getMaximumNameLength() {
return MAX_UDTNAME_LENGTH;
}
}

View file

@ -0,0 +1,107 @@
/********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
********************************************************************************/
package org.eclipse.rse.internal.useractions.ui.validators;
import org.eclipse.rse.internal.useractions.IUserActionsMessageIds;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.validators.ISystemValidator;
/**
* This class is used to verify a user defined action's comment
*/
public class ValidatorUserTypeTypes implements ISystemValidator {
public static final int MAX_UDTTYPES_LENGTH = 512;
protected SystemMessage emptyMsg, invalidMsg, currentMessage;
/**
* Constructor to use when wanting to specify the "value required" error message,
* but use the default for the "Value not valid" error message
*/
public ValidatorUserTypeTypes() {
setErrorMessages(RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDTTYPES_EMPTY), RSEUIPlugin.getPluginMessage(IUserActionsMessageIds.MSG_VALIDATE_UDTTYPES_NOTVALID));
}
/**
* Set the error messages, overriding the defaults
*/
public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg) {
this.emptyMsg = emptyMsg;
this.invalidMsg = invalidMsg;
}
// ---------------------------
// ISystemValidator methods...
// ---------------------------
/**
* @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
*/
public String isValid(Object input) {
currentMessage = null;
if (!(input instanceof String)) {
return null;
} else
return isValid((String) input);
}
/**
* @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
* @see #getSystemMessage()
*/
public String isValid(String input) {
currentMessage = null;
if ((input == null) || (input.length() == 0)) {
currentMessage = emptyMsg;
} else {
if (input.length() > MAX_UDTTYPES_LENGTH) currentMessage = invalidMsg;
}
return (currentMessage == null) ? null : currentMessage.getLevelOneText();
}
/**
* When isValid returns non-null, call this to get the SystemMessage object for the error
* versus the simple string message.
*/
public SystemMessage getSystemMessage() {
return currentMessage;
}
/**
* Return the max length for comments
*/
public int getMaximumNameLength() {
return MAX_UDTTYPES_LENGTH;
}
/**
* For convenience, this is a shortcut to calling:
* <pre><code>
* if (isValid(text) != null)
* msg = getSystemMessage();
* </code></pre>
*/
public SystemMessage validate(String text) {
if (isValid(text) != null)
return currentMessage;
else
return null;
}
}