本文整理汇总了Java中org.eclipse.core.variables.VariablesPlugin类的典型用法代码示例。如果您正苦于以下问题:Java VariablesPlugin类的具体用法?Java VariablesPlugin怎么用?Java VariablesPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VariablesPlugin类属于org.eclipse.core.variables包,在下文中一共展示了VariablesPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: chooseWorkspace
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
protected void chooseWorkspace ()
{
final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog ( getShell (), new WorkbenchLabelProvider (), new WorkbenchContentProvider () );
dialog.setTitle ( "Select driver exporter configuration file" );
dialog.setMessage ( "Choose a driver exporter file for the configuration" );
dialog.setInput ( ResourcesPlugin.getWorkspace ().getRoot () );
dialog.setComparator ( new ResourceComparator ( ResourceComparator.NAME ) );
dialog.setAllowMultiple ( true );
dialog.setDialogBoundsSettings ( getDialogBoundsSettings ( HiveTab.WORKSPACE_SELECTION_DIALOG ), Dialog.DIALOG_PERSISTSIZE );
if ( dialog.open () == IDialogConstants.OK_ID )
{
final IResource resource = (IResource)dialog.getFirstResult ();
if ( resource != null )
{
final String arg = resource.getFullPath ().toString ();
final String fileLoc = VariablesPlugin.getDefault ().getStringVariableManager ().generateVariableExpression ( "workspace_loc", arg ); //$NON-NLS-1$
this.fileText.setText ( fileLoc );
makeDirty ();
}
}
}
示例2: updateInstalledVersion
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
@Override
protected void updateInstalledVersion(String version) {
WPILibCPPPlugin.getDefault().getPreferenceStore().setValue(PreferenceConstants.LIBRARY_INSTALLED,
version);
IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager();
try
{
IValueVariable vv = vm.getValueVariable("USER_HOME");
if (vv == null)
{
vm.addVariables(new IValueVariable[]{vm.newValueVariable("USER_HOME", "user.home directory", false,System.getProperty("user.home"))});
} else
{
if (!System.getProperty("user.home").equals(vm.performStringSubstitution("${USER_HOME}")))
vv.setValue(System.getProperty("user.home"));
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new RuntimeException(e);
}
}
示例3: validateAbsoluteFilePath
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
/**
* Validates that the file with the specified absolute path exists and can be opened.
*
* @param path The path of the file to validate
* @return a status without error if the path is valid
*/
protected static IStatus validateAbsoluteFilePath(String path) {
final StatusInfo status = new StatusInfo();
IStringVariableManager variableManager = VariablesPlugin.getDefault().getStringVariableManager();
try {
path = variableManager.performStringSubstitution(path);
if (path.length() > 0) {
final File file = new File(path);
if (!file.exists() && (!file.isAbsolute() || !file.getParentFile().canWrite()))
status.setError(PreferencesMessages.SpellingPreferencePage_dictionary_error);
else if (file.exists() && (!file.isFile() || !file.isAbsolute() || !file.canRead() || !file.canWrite()))
status.setError(PreferencesMessages.SpellingPreferencePage_dictionary_error);
}
} catch (CoreException e) {
status.setError(e.getLocalizedMessage());
}
return status;
}
示例4: getIFile
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
private IFile getIFile(ILaunchConfigurationWorkingCopy configuration) {
IFile file = null;
if (fNewFile != null) {
file = fNewFile;
fNewFile = null;
} else {
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
try {
String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null);
if (location != null) {
String expandedLocation = manager.performStringSubstitution(location);
if (expandedLocation != null) {
file = JSBuildFileUtil.getFileForLocation(expandedLocation);
}
}
}
catch (CoreException e) {
// do nothing
}
}
return file;
}
示例5: getCommand
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
@Override
public String getCommand() {
// anb0s: support of variables
IStringVariableManager variableManager = VariablesPlugin.getDefault().getStringVariableManager();
String resolved_location = null;
try {
resolved_location = variableManager.performStringSubstitution(this.location);
} catch (CoreException e) {
e.printStackTrace();
}
// Retrieves the real location where doxygen may be.
File realLocation = new File(resolved_location);
// Builds the path.
if (realLocation.isFile() == true) {
return realLocation.getPath();
} else {
return realLocation.getPath() + File.separator + COMMAND_NAME;
}
}
示例6: parse
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
public static WarParser parse(List<String> args, IJavaProject javaProject) {
// Get the WAR dir index (either after the "-war" arg or the last arg)
int unverifiedWarDirIndex = getUnverifiedWarDirIndex(args);
// Get the arg at the index
String unverifiedWarDir = LaunchConfigurationProcessorUtilities.getArgValue(args, unverifiedWarDirIndex);
String resolvedUnverifiedWarDir = unverifiedWarDir;
try {
resolvedUnverifiedWarDir = unverifiedWarDir != null
? VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(unverifiedWarDir)
: null;
} catch (CoreException e) {
GdtPlugin.getLogger().logWarning(e, "Could not resolve any variables in the WAR directory.");
}
// Check if the WAR dir is valid
boolean isWarDirValid = resolvedUnverifiedWarDir != null ? isWarDirValid(resolvedUnverifiedWarDir) : false;
// Check if it is specified with the "-war" arg
boolean isSpecifiedWithWarArg = unverifiedWarDirIndex != -1 ? isSpecifiedWithWarArg(unverifiedWarDirIndex, args)
: false;
return new WarParser(unverifiedWarDirIndex, isWarDirValid, isSpecifiedWithWarArg, unverifiedWarDir,
resolvedUnverifiedWarDir);
}
示例7: initPreferencesStore
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
private void initPreferencesStore() {
IScopeContext projectScope = new ProjectScope(project);
preferences = projectScope.getNode(FileSyncPlugin.PLUGIN_ID);
buildPathMap(preferences);
preferences.addPreferenceChangeListener(this);
preferences.addNodeChangeListener(this);
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
manager.addValueVariableListener(this);
jobChangeAdapter = new JobChangeAdapter(){
@Override
public void done(IJobChangeEvent event) {
// XXX dirty trick to re-evaluate dynamic egit variables on branch change
if(!event.getJob().getClass().getName().contains("org.eclipse.egit.ui.internal.branch.BranchOperationUI")){
return;
}
rebuildPathMap();
}
};
Job.getJobManager().addJobChangeListener(jobChangeAdapter);
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
}
示例8: doCheckState
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
@Override
public boolean doCheckState() {
VariablesPlugin variablesPlugin = VariablesPlugin.getDefault();
String value = getStringValue();
IStringVariableManager manager = variablesPlugin.getStringVariableManager();
// check if there are substitutions
String result;
try {
result = manager.performStringSubstitution(value, false);
if(!result.equals(getStringValue())) {
// string substitution present ... field editor cannot validate the value.
return true;
}
} catch (CoreException e) {
// replacement failed (but there are replaceable variables present)
return true;
}
if ( new File(value).isAbsolute()) {
return super.doCheckState();
}
return true;
}
示例9: checkState
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
@Override
public boolean checkState() {
VariablesPlugin variablesPlugin = VariablesPlugin.getDefault();
IStringVariableManager manager = variablesPlugin.getStringVariableManager();
// check if there are substitutions
String result;
try {
result = manager.performStringSubstitution(getStringValue(), false);
if(!result.equals(getStringValue())) {
// string substitution present ... field editor cannot validate the value.
return true;
}
} catch (CoreException e) {
e.printStackTrace();
}
return super.doCheckState();
}
示例10: validateAbsoluteFilePath
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
/**
* Validates that the file with the specified absolute path exists and can
* be opened.
*
* @param path
* The path of the file to validate
* @return a status without error if the path is valid
*/
protected static IStatus validateAbsoluteFilePath(String path) {
final StatusInfo status= new StatusInfo();
IStringVariableManager variableManager= VariablesPlugin.getDefault().getStringVariableManager();
try {
path= variableManager.performStringSubstitution(path);
if (path.length() > 0) {
final File file= new File(path);
if (!file.exists() && (!file.isAbsolute() || !file.getParentFile().canWrite()))
status.setError(PreferencesMessages.SpellingPreferencePage_dictionary_error);
else if (file.exists() && (!file.isFile() || !file.isAbsolute() || !file.canRead() || !file.canWrite()))
status.setError(PreferencesMessages.SpellingPreferencePage_dictionary_error);
}
} catch (CoreException e) {
status.setError(e.getLocalizedMessage());
}
return status;
}
示例11: resolveValue
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
@Override
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
ArchToolchainPairList atlist = new ArchToolchainPairList();
atlist.doLoad();
String toolchainFile = atlist.get(argument);
if(toolchainFile == null) {
Status status = new Status(Status.INFO, Activator.PLUGIN_ID, "No CMake toolchainfile specified for architecture '" + argument +"'");
throw new CoreException(status);
}
IStringVariableManager varMgr = VariablesPlugin.getDefault().getStringVariableManager();
toolchainFile = varMgr.performStringSubstitution(toolchainFile);
return toolchainFile;
}
示例12: createKarafPlatformResources
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
private void createKarafPlatformResources(final IProgressMonitor monitor) throws CoreException {
newKarafProject.getProjectHandle().getFolder(".bin").create(true, true, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform").create(true, true, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/etc").createLink(workingPlatformModel.getParentKarafModel().getConfigurationDirectory(), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/deploy").createLink(workingPlatformModel.getParentKarafModel().getUserDeployedDirectory(), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/lib").createLink(workingPlatformModel.getParentKarafModel().getRootDirectory().append("lib"), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/system").createLink(workingPlatformModel.getParentKarafModel().getPluginRootDirectory(), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/runtime").create(true, true, monitor);
// TODO: Is this the right way to add the current installation?
final IDynamicVariable eclipseHomeVariable = VariablesPlugin.getDefault().getStringVariableManager().getDynamicVariable("eclipse_home");
final String eclipseHome = eclipseHomeVariable.getValue("");
newKarafProject.getProjectHandle().getFolder(".bin/platform/eclipse").create(true, true, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/eclipse/dropins").createLink(new Path(eclipseHome).append("dropins"), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/eclipse/plugins").createLink(new Path(eclipseHome).append("plugins"), 0, monitor);
newKarafProject.getProjectHandle().setPersistentProperty(
new QualifiedName(KarafUIPluginActivator.PLUGIN_ID, "karafProject"),
"true");
newKarafProject.getProjectHandle().setPersistentProperty(
new QualifiedName(KarafUIPluginActivator.PLUGIN_ID, "karafModel"),
karafPlatformModel.getRootDirectory().toString());
}
示例13: testVariableSubstitution
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
@Test
public void testVariableSubstitution() throws CoreException {
final IStringVariableManager manager =
VariablesPlugin.getDefault().getStringVariableManager();
final IValueVariable var1 = manager.newValueVariable("my", "", false,
"MyTestProject");
final IValueVariable var2 = manager.newValueVariable("hello",
"hello world!", false, "Hello");
final IValueVariable var3 = manager.newValueVariable("ext", "", true,
"g4");
final IValueVariable[] vars = new IValueVariable[] {var1, var2, var3};
manager.addVariables(vars);
final String path = "/${my}/${hello}.${ext}";
final String actual = VariableButtonListener.substituteVariables(path);
final String expected = "/MyTestProject/Hello.g4";
Assert.assertEquals(expected, actual);
}
示例14: getFiles
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
private IFile[] getFiles(ILaunchConfiguration config) throws CoreException
{
String script = config.getAttribute(NSISLaunchSettings.SCRIPT,""); //$NON-NLS-1$
if(!script.equals("")) { //$NON-NLS-1$
String file = null;
try {
file = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(script);
}
catch (CoreException e) {
EclipseNSISPlugin.getDefault().log(e);
}
if(file != null) {
File f = new File(file);
if(f.exists()) {
return ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(f.toURI());
}
}
}
return null;
}
示例15: store
import org.eclipse.core.variables.VariablesPlugin; //导入依赖的package包/类
@Override
public void store()
{
String file = null;
try {
file = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(mScript);
}
catch (CoreException e) {
EclipseNSISPlugin.getDefault().log(e);
}
if(file != null) {
File f = new File(file);
if(f.exists()) {
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(f.toURI());
if(!Common.isEmptyArray(files) && mLaunchConfig instanceof ILaunchConfigurationWorkingCopy) {
((ILaunchConfigurationWorkingCopy)mLaunchConfig).setMappedResources(files);
}
}
}
setValue(SCRIPT, mScript);
setValue(RUN_INSTALLER, mRunInstaller);
super.store();
}