org.apache.log4j.varia.NullAppender#org.eclipse.core.runtime.FileLocator源码实例Demo

下面列出了org.apache.log4j.varia.NullAppender#org.eclipse.core.runtime.FileLocator 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: eclipse-cs   文件: BuiltInConfigurationType.java
@Override
protected URL resolveLocation(ICheckConfiguration checkConfiguration) {

  String contributorName = checkConfiguration.getAdditionalData().get(CONTRIBUTOR_KEY);

  Bundle contributor = Platform.getBundle(contributorName);
  URL locationUrl = FileLocator.find(contributor, new Path(checkConfiguration.getLocation()),
          null);

  // suggested by https://sourceforge.net/p/eclipse-cs/bugs/410/
  if (locationUrl == null) {
    locationUrl = contributor.getResource(checkConfiguration.getLocation());
  }

  return locationUrl;
}
 
源代码2 项目: wildwebdeveloper   文件: JSTSLanguageServer.java
public JSTSLanguageServer() {
	List<String> commands = new ArrayList<>();
	commands.add(InitializeLaunchConfigurations.getNodeJsLocation());
	try {
		URL url = FileLocator.toFileURL(getClass().getResource("/node_modules/typescript-language-server/lib/cli.js"));
		URL tsServer = FileLocator.toFileURL(getClass().getResource("/node_modules/typescript/lib/tsserver.js"));
		commands.add(new File(url.getPath()).getAbsolutePath());
		commands.add("--stdio");
		commands.add("--tsserver-path");
		commands.add(new File(tsServer.getPath()).getAbsolutePath());
		URL nodeDependencies = FileLocator.toFileURL(getClass().getResource("/"));
		setCommands(commands);
		setWorkingDirectory(nodeDependencies.getPath()); //Required for typescript-eslint-language-service to find it's dependencies

	} catch (IOException e) {
		Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), e.getMessage(), e));
	}
}
 
源代码3 项目: wildwebdeveloper   文件: Utils.java
/**
 * Provisions a project that's part of the "testProjects"
 * @param folderName the folderName under "testProjects" to provision from
 * @return the provisioned project
 * @throws CoreException
 * @throws IOException
 */
public static IProject provisionTestProject(String folderName) throws CoreException, IOException {
	URL url = FileLocator.find(Platform.getBundle("org.eclipse.wildwebdeveloper.tests"),
			Path.fromPortableString("testProjects/" + folderName), null);
	url = FileLocator.toFileURL(url);
	File folder = new File(url.getFile());
	if (folder.exists()) {
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("testProject" + System.nanoTime());
		project.create(null);
		project.open(null);
		java.nio.file.Path sourceFolder = folder.toPath();
		java.nio.file.Path destFolder = project.getLocation().toFile().toPath();

		Files.walk(sourceFolder).forEach(source -> {
			try {
				Files.copy(source, destFolder.resolve(sourceFolder.relativize(source)), StandardCopyOption.REPLACE_EXISTING);
			} catch (IOException e) {
				e.printStackTrace();
			}
		});
		project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
		return project;
	}
	return null;
}
 
/**
 * Test Class setup
 */
@BeforeClass
public static void init() {
    SWTBotUtils.initialize();

    /* set up test trace */
    URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(COLUMN_TRACE_PATH), null);
    URI uri;
    try {
        uri = FileLocator.toFileURL(location).toURI();
        fTestFile = new File(uri);
    } catch (URISyntaxException | IOException e) {
        fail(e.getMessage());
    }

    assumeTrue(fTestFile.exists());

    /* Set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
源代码5 项目: ice   文件: ImportFileAction.java
/**
 * Constructor
 */
public ImportFileAction(IWorkbenchWindow window) {

	// Set the action ID, Menu Text, and a tool tip.
	workbenchWindow = window;

	// Set the text properties.
	setId(ID);
	setText("&Import a file");
	setToolTipText("Import a file into ICE's "
			+ "project space for use by your items.");

	// Find the client bundle
	Bundle bundle = FrameworkUtil.getBundle(ImportFileAction.class);
	Path imagePath = new Path("icons"
			+ System.getProperty("file.separator") + "importArrow.gif");
	URL imageURL = FileLocator.find(bundle, imagePath, null);
	setImageDescriptor(ImageDescriptor.createFromURL(imageURL));

	return;
}
 
源代码6 项目: tracecompass   文件: Activator.java
/**
 * Return a path to a file relative to this plugin's base directory
 *
 * @param relativePath
 *            The path relative to the plugin's root directory
 * @return The path corresponding to the relative path in parameter
 */
public static @NonNull IPath getAbsoluteFilePath(String relativePath) {
    Activator plugin = Activator.getDefault();
    if (plugin == null) {
        /*
         * Shouldn't happen but at least throw something to get the test to
         * fail early
         */
        throw new IllegalStateException();
    }
    URL location = FileLocator.find(plugin.getBundle(), new Path(relativePath), null);
    try {
        return new Path(FileLocator.toFileURL(location).getPath());
    } catch (IOException e) {
        throw new IllegalStateException();
    }
}
 
源代码7 项目: bonita-studio   文件: ZoomOutToolEntry.java
private static ImageDescriptor findIconImageDescriptor(String iconPath) {
    String pluginId = "org.eclipse.gmf.runtime.diagram.ui.providers";
    Bundle bundle = Platform.getBundle(pluginId);
    try
    {
        if (iconPath != null) {
            URL fullPathString = FileLocator.find(bundle, new Path(iconPath), null);
            fullPathString = fullPathString != null ? fullPathString : new URL(iconPath);
            if (fullPathString != null) {
                return ImageDescriptor.createFromURL(fullPathString);
            }
        }
    }
    catch (MalformedURLException e)
    {
        Trace.catching(DiagramUIPlugin.getInstance(),
            DiagramUIDebugOptions.EXCEPTIONS_CATCHING,
            DefaultPaletteProvider.class, e.getLocalizedMessage(), e); 
        Log.error(DiagramUIPlugin.getInstance(),
            DiagramUIStatusCodes.RESOURCE_FAILURE, e.getMessage(), e);
    }
    
    return null;
}
 
源代码8 项目: bonita-studio   文件: ZoomInToolEntry.java
private static ImageDescriptor findIconImageDescriptor(String iconPath) {
	String pluginId = "org.eclipse.gmf.runtime.diagram.ui.providers";
	Bundle bundle = Platform.getBundle(pluginId);
	try
	{
		if (iconPath != null) {
			URL fullPathString = FileLocator.find(bundle, new Path(iconPath), null);
			fullPathString = fullPathString != null ? fullPathString : new URL(iconPath);
			if (fullPathString != null) {
				return ImageDescriptor.createFromURL(fullPathString);
			}
		}
	}
	catch (MalformedURLException e)
	{
		Trace.catching(DiagramUIPlugin.getInstance(),
				DiagramUIDebugOptions.EXCEPTIONS_CATCHING,
				DefaultPaletteProvider.class, e.getLocalizedMessage(), e); 
		Log.error(DiagramUIPlugin.getInstance(),
				DiagramUIStatusCodes.RESOURCE_FAILURE, e.getMessage(), e);
	}

	return null;
}
 
源代码9 项目: translationstudio8   文件: CommonFunction.java
/**
 * 当程序开始运行时,检查 qa 插件是否存在,如果不存在,则不执行任何操作,如果存在,则检查 configuration\net.heartsome.cat.ts.ui\hunspell 
 * 下面是否有 hunspell 运行所需要的词典以及运行函数库。如果没有,则需要从 qa 插件中进行获取,并且解压到上述目录下。
 * robert	2013-02-28
 */
public static void unZipHunspellDics() throws Exception{
	Bundle bundle = Platform.getBundle("net.heartsome.cat.ts.ui.qa");
	if (bundle == null) {
		return;
	}
	
	// 查看解压的 hunspell词典 文件夹是否存在
	String configHunspllDicFolder = Platform.getConfigurationLocation().getURL().getPath() 
			+ "net.heartsome.cat.ts.ui" + System.getProperty("file.separator") + "hunspell"
			+ System.getProperty("file.separator") + "hunspellDictionaries";
	if (!new File(configHunspllDicFolder).exists()) {
		new File(configHunspllDicFolder).mkdirs();
		String hunspellDicZipPath = FileLocator.toFileURL(bundle.getEntry("hunspell/hunspellDictionaries.zip")).getPath();
		upZipFile(hunspellDicZipPath, configHunspllDicFolder);
	}
}
 
源代码10 项目: orion.server   文件: TransferTest.java
@Test
public void testImportWithPost() throws CoreException, IOException, SAXException {
	//create a directory to upload to
	String directoryPath = "sample/testImportWithPost/path" + System.currentTimeMillis();
	createDirectory(directoryPath);

	//start the import
	URL entry = ServerTestsActivator.getContext().getBundle().getEntry("testData/importTest/client.zip");
	File source = new File(FileLocator.toFileURL(entry).getPath());
	long length = source.length();
	InputStream in = new BufferedInputStream(new FileInputStream(source));
	PostMethodWebRequest request = new PostMethodWebRequest(getImportRequestPath(directoryPath), in, "application/zip");
	request.setHeaderField("Content-Length", "" + length);
	request.setHeaderField("Content-Type", "application/zip");
	setAuthentication(request);
	WebResponse postResponse = webConversation.getResponse(request);
	assertEquals(HttpURLConnection.HTTP_CREATED, postResponse.getResponseCode());
	String location = postResponse.getHeaderField("Location");
	assertNotNull(location);
	String type = postResponse.getHeaderField("Content-Type");
	assertNotNull(type);
	assertTrue(type.contains("text/html"));

	//assert the file has been unzipped in the workspace
	assertTrue(checkFileExists(directoryPath + "/org.eclipse.e4.webide/static/js/navigate-tree/navigate-tree.js"));
}
 
源代码11 项目: bonita-studio   文件: TestTokenDispatcher.java
private ProcessDiagramEditor importBos(final String processResourceName)
        throws IOException, InvocationTargetException, InterruptedException {
    final ImportBosArchiveOperation op = new ImportBosArchiveOperation(repositoryAccessor);
    final URL fileURL = FileLocator.toFileURL(TestTokenDispatcher.class.getResource(processResourceName));
    op.setArchiveFile(FileLocator.toFileURL(fileURL).getFile());
    op.setCurrentRepository(repositoryAccessor.getCurrentRepository());
    op.run(new NullProgressMonitor());
    ProcessDiagramEditor processEditor = null;
    for (final IRepositoryFileStore f : op.getFileStoresToOpen()) {
        final IWorkbenchPart iWorkbenchPart = f.open();
        if (iWorkbenchPart instanceof ProcessDiagramEditor) {
            processEditor = (ProcessDiagramEditor) iWorkbenchPart;

        }
    }
    return processEditor;
}
 
源代码12 项目: birt   文件: UIUtil.java
/**
 * @return Report Designer UI plugin installation directory as OS string.
 */
public static String getFragmentDirectory( )
{
	Bundle bundle = Platform.getBundle( IResourceLocator.FRAGMENT_RESOURCE_HOST );
	if ( bundle == null )
	{
		return null;
	}
	URL url = bundle.getEntry( "/" ); //$NON-NLS-1$
	if ( url == null )
	{
		return null;
	}
	String directory = null;
	try
	{
		directory = FileLocator.resolve( url ).getPath( );
	}
	catch ( IOException e )
	{
		logger.log( Level.SEVERE, e.getMessage( ), e );
	}
	return directory;
}
 
源代码13 项目: orion.server   文件: ManifestParseTreeTest.java
@Test
public void testToJSONAgainsCorrectManifests() throws Exception {
	URL entry = ServerTestsActivator.getContext().getBundle().getEntry(CORRECT_MANIFEST_LOCATION);
	File manifestSource = new File(FileLocator.toFileURL(entry).getPath());

	File[] manifests = manifestSource.listFiles(new FilenameFilter() {

		public boolean accept(File dir, String name) {
			return name.toLowerCase().endsWith(".yml"); //$NON-NLS-1$
		}
	});

	for (File manifestFile : manifests) {
		InputStream inputStream = new FileInputStream(manifestFile);

		/* export the manifest to JSON - pass if no exceptions occurred */
		exportManifestJSON(inputStream);
	}
}
 
源代码14 项目: orion.server   文件: ManifestParserTest.java
@Test
public void testServicesWithSpacesManifest() throws Exception {
	String manifestName = "servicesWithSpaces.yml"; //$NON-NLS-1$

	URL entry = ServerTestsActivator.getContext().getBundle().getEntry(MANIFEST_LOCATION);
	File manifestFile = new File(FileLocator.toFileURL(entry).getPath().concat(manifestName));

	InputStream inputStream = new FileInputStream(manifestFile);
	ManifestParseTree manifest = parse(inputStream);

	ManifestParseTree application = manifest.get("applications").get(0); //$NON-NLS-1$
	ManifestParseTree services = application.get("services"); //$NON-NLS-1$

	assertEquals(2, services.getChildren().size());

	String service = services.get(0).getValue();
	assertEquals("Redis Cloud-fo service", service); //$NON-NLS-1$

	service = services.get(1).getValue();
	assertEquals("Redis-two", service); //$NON-NLS-1$
}
 
源代码15 项目: bonita-studio   文件: ImporterFactory.java
public void configure(final IConfigurationElement desc) {
    name = desc.getAttribute("inputName");
    filterExtension = desc.getAttribute("filterExtensions");
    description = desc.getAttribute("description");
    priorityDisplay = Integer.valueOf(desc.getAttribute("priorityDisplay"));
    final String menuIcon = desc.getAttribute("menuIcon");
    try {
        if (menuIcon != null) {
            final Bundle b = Platform.getBundle(desc.getContributor().getName());
            final URL iconURL = b.getResource(menuIcon);
            final File imageFile = new File(FileLocator.toFileURL(iconURL).getFile());
            try (final FileInputStream inputStream = new FileInputStream(imageFile);) {
                descriptionImage = new Image(Display.getDefault(), inputStream);
            }
        }
    } catch (final Exception e) {
        BonitaStudioLog.error(e);
    }
}
 
源代码16 项目: bonita-studio   文件: ImportLegacyBDMIT.java
@Test
public void should_import_a_legacy_bdm_and_convert_it_to_xml_file() throws Exception {
    final ImportBosArchiveOperation operation = new ImportBosArchiveOperation(repositoryAccessor);
    operation.setCurrentRepository(repositoryAccessor.getCurrentRepository());
    operation.setArchiveFile(
            new File(FileLocator.toFileURL(ImportLegacyBDMIT.class.getResource("/legacyBDM.bos")).getFile())
                    .getAbsolutePath());
    operation.run(Repository.NULL_PROGRESS_MONITOR);

    StatusAssert.assertThat(operation.getStatus()).hasSeverity(IStatus.INFO);
    assertThat(defStore.getResource().getFile(BusinessObjectModelFileStore.ZIP_FILENAME).getLocation().toFile().exists())
            .isFalse();
    assertThat(defStore.getChild(BusinessObjectModelFileStore.BOM_FILENAME, true)).isNotNull();
    final BusinessObjectModel model = defStore.getChild(BusinessObjectModelFileStore.BOM_FILENAME, true).getContent();
    assertThat(model).isNotNull();
    assertThat(model.getBusinessObjectsClassNames()).contains("com.bonita.lr.model.VacationRequest");

    assertThat(defStore.getChildren()).hasSize(1);
    assertThat(depStore.getChild(BusinessObjectModelFileStore.BDM_JAR_NAME, true)).isNotNull();
}
 
源代码17 项目: gama   文件: WorkspacePreferences.java
public static String getCurrentGamaStampString() {
	String gamaStamp = null;
	try {
		final URL tmpURL = new URL("platform:/plugin/msi.gama.models/models/");
		final URL resolvedFileURL = FileLocator.toFileURL(tmpURL);
		// We need to use the 3-arg constructor of URI in order to properly escape file system chars
		final URI resolvedURI = new URI(resolvedFileURL.getProtocol(), resolvedFileURL.getPath(), null).normalize();
		final File modelsRep = new File(resolvedURI);

		// loading file from URL Path is not a good idea. There are some bugs
		// File modelsRep = new File(urlRep.getPath());

		final long time = modelsRep.lastModified();
		gamaStamp = ".built_in_models_" + time;
		DEBUG.OUT(
			">GAMA version " + Platform.getProduct().getDefiningBundle().getVersion().toString() + " loading...");
		DEBUG.OUT(">GAMA models library version: " + gamaStamp);
	} catch (final IOException | URISyntaxException e) {
		e.printStackTrace();
	}
	return gamaStamp;
}
 
源代码18 项目: sarl   文件: BundleUtil.java
private static IPath getSourceRootProjectFolderPath(Bundle bundle) {
	for (final String srcFolder : SRC_FOLDERS) {
		final IPath relPath = Path.fromPortableString(srcFolder);
		final URL srcFolderURL = FileLocator.find(bundle, relPath, null);
		if (srcFolderURL != null) {
			try {
				final URL srcFolderFileURL = FileLocator.toFileURL(srcFolderURL);
				IPath absPath = new Path(srcFolderFileURL.getPath()).makeAbsolute();
				absPath = absPath.removeLastSegments(relPath.segmentCount());
				return absPath;
			} catch (IOException e) {
				//
			}
		}
	}
	return null;
}
 
源代码19 项目: ice   文件: ReflectivityViewPart.java
@Override
public void createPartControl(Composite parent) {

	try {
		Bundle bundle = FrameworkUtil.getBundle(this.getClass());
		URL picBundleURL = bundle.getEntry("reflectivityExample.png");
		URL picFileURL = FileLocator.toFileURL(picBundleURL);
		File picture = new File(picFileURL.getFile());

		Image image = new Image(Display.getCurrent(),picture.getAbsolutePath());
		Label label = new Label(parent, SWT.NONE);
		label.setImage(image);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		logger.error(getClass().getName() + " Exception!",e);
	}


}
 
源代码20 项目: tracecompass   文件: TmfCoreTestPlugin.java
/**
 * Return a path to a file relative to this plugin's base directory
 *
 * @param relativePath
 *            The path relative to the plugin's root directory
 * @return The path corresponding to the relative path in parameter
 */
public static @NonNull IPath getAbsoluteFilePath(String relativePath) {
    Plugin plugin = TmfCoreTestPlugin.getDefault();
    if (plugin == null) {
        /*
         * Shouldn't happen but at least throw something to get the test to
         * fail early
         */
        throw new IllegalStateException();
    }
    URL location = FileLocator.find(plugin.getBundle(), new Path(relativePath), null);
    try {
        return new Path(FileLocator.toFileURL(location).getPath());
    } catch (IOException e) {
        throw new IllegalStateException();
    }
}
 
源代码21 项目: bonita-studio   文件: ImportLegacyBDMIT.java
@Test
public void should_import_a_bdm_without_namespace_and_add_it() throws Exception {
    ImportBosArchiveOperation operation = new ImportBosArchiveOperation(repositoryAccessor);
    operation.setCurrentRepository(repositoryAccessor.getCurrentRepository());
    operation.setArchiveFile(
            new File(FileLocator.toFileURL(ImportLegacyBDMIT.class.getResource("/bdmWithoutNamespace.bos")).getFile())
                    .getAbsolutePath());
    operation.run(Repository.NULL_PROGRESS_MONITOR);

    StatusAssert.assertThat(operation.getStatus()).hasSeverity(IStatus.INFO);

    IFile iFile = defStore.getChild(BusinessObjectModelFileStore.BOM_FILENAME, true).getResource();
    String bomFileContent = IOUtils.toString(iFile.getContents(), Charset.defaultCharset());
    assertThat(bomFileContent).contains("xmlns=\"http://documentation.bonitasoft.com/bdm-xml-schema/1.0\"");
}
 
源代码22 项目: tlaplus   文件: HelpPDFHandler.java
private File getDocFile(final String bundleRelativePath) throws IOException, URISyntaxException {
	final Bundle bundle = Platform.getBundle(HelpActivator.PLUGIN_ID);
	// Do not call URL#toURI. The call throws an exception due to invalid chars on macOS
	// when the Toolbox is installed in (its default location) /Applications/TLA+
	// Toolbox.app/...
	return new File(FileLocator.resolve(bundle.getEntry(bundleRelativePath)).getFile());
}
 
源代码23 项目: MergeProcessor   文件: HandlerHtmlDialog.java
/**
 * @return the file containing the help information for the user.
 */
private static File getHtmlFile(final String url) {
	final URL helpUrl = FileLocator.find(Activator.getDefault().getBundle(), new Path(url));
	if (helpUrl == null) {
		LogUtil.getLogger().severe(String.format("File %s not found.", url)); //$NON-NLS-1$
	} else {
		try {
			return new File(FileLocator.resolve(helpUrl).toString());
		} catch (IOException e) {
			LogUtil.getLogger().log(Level.SEVERE,
					String.format("Exception occurred on accessing file %s.", helpUrl), e); //$NON-NLS-1$
		}
	}
	return null;
}
 
源代码24 项目: translationstudio8   文件: ExportQAResult.java
public static byte[] getImageData(String imgPath){
	byte[] arrayByte = null;
	try {
		Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID);
		URL defaultUrl = buddle.getEntry(imgPath);
		String imagePath = imgPath;
		imagePath = FileLocator.toFileURL(defaultUrl).getPath();
		arrayByte = IOUtils.toByteArray(new FileInputStream(new File(imagePath)));
	} catch (Exception e) {
	}
	
	return arrayByte;
}
 
源代码25 项目: bonita-studio   文件: ModelVersion.java
private static String lastModelVersion() {
    try {
        final URL resource = Platform.getBundle("org.bonitasoft.studio-models").getResource("process.history");
        final URI historyURI = URI.createFileURI(new File(FileLocator.toFileURL(resource).getFile()).getAbsolutePath());
        final History history = ResourceUtils.loadElement(historyURI);
        return history.getLatestRelease().getLabel();
    } catch (final Throwable t) {
        BonitaStudioLog.error("Failed to load model version from process history", Activator.PLUGIN_ID);
        return VERSION_6_0_0_ALPHA;
    }
}
 
源代码26 项目: gef   文件: MvcFxUiBundle.java
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
	// put action images into the registry
	Bundle bundle = getBundle();
	for (Entry<String, String> e : IMAGES.entrySet()) {
		reg.put(e.getKey(), ImageDescriptor.createFromURL(
				FileLocator.find(bundle, new Path(e.getValue()), null)));
	}
}
 
源代码27 项目: bonita-studio   文件: EdaptHistoryIT.java
@Before
public void setUp() throws Exception {
    final URL resource = Platform.getBundle("org.bonitasoft.studio-models").getResource("process.history");
    final URI historyURI = URI.createFileURI(new File(FileLocator.toFileURL(resource).getFile()).getAbsolutePath());
    HistoryPackage.eINSTANCE.getHistory();
    history = ResourceUtils.loadElement(historyURI);
}
 
源代码28 项目: developer-studio   文件: ImageUtils.java
/**
 * create ImageDescriptor 
 * @param imgName
 * @return
 */
private ImageDescriptor createImageDescriptor(String imgName) {
	if (imgName == null)
		return null;
	ImageDescriptor imageDescriptor = null;
	IPath path = new Path(getImageDirectoryName() + imgName);
	
	URL gifImageURL = FileLocator.find(getBundle(), path, null);
	if (gifImageURL != null){
		imageDescriptor = ImageDescriptor.createFromURL(gifImageURL);
	}
	return imageDescriptor;
}
 
源代码29 项目: tracecompass   文件: LTTngControlServiceTest.java
/**
 * Perform pre-test initialization.
 *
 * @throws Exception
 *             if the initialization fails for some reason
 */
@Before
public void setUp() throws Exception {
    URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(getTestDirectory() + File.separator + getTestStream()), null);
    File testfile = new File(FileLocator.toFileURL(location).toURI());
    fTestfile = testfile.getAbsolutePath();
    fShell.loadScenarioFile(fTestfile);
    fService = getControlService();
    if (fService == null) {
        throw new Exception("Unable to obtain a valid ControlService");
    }

    ControlPreferences.getInstance().init(Activator.getDefault().getPreferenceStore());
}
 
protected void addLanguage() {
	AddOrUpdateLanguageDialog dialog = new AddOrUpdateLanguageDialog(fFilteredTree.getShell(),
			AddOrUpdateLanguageDialog.DIALOG_ADD);
	dialog.setLanguageModel(languageModel);
	if (dialog.open() == IDialogConstants.OK_ID) {
		String strCode = dialog.getStrCode();
		String imagePath = dialog.getImagePath();
		String resultImagePath = "";
		if (!imagePath.equals("")) {
			File imgFile = new File(imagePath);
			if (imgFile.exists()) {
				try {
					String bundlePath = FileLocator.toFileURL(Activator.getDefault().getBundle().getEntry(""))
							.getPath();
					String rsImagePath = bundlePath + "images/lang/" + strCode + ".png";
					File rsImgFile = new File(rsImagePath);
					if (!rsImgFile.exists()) {
						rsImgFile.createNewFile();
					}
					ResourceUtils.copyFile(imgFile, rsImgFile);
				} catch (IOException e) {
					logger.error(Messages.getString("languagecode.LanguageCodesPreferencePage.logger2"), e);
					e.printStackTrace();
				}
			}
			resultImagePath = "images/lang/" + strCode + ".png";
		}
		Language language = new Language(strCode, dialog.getStrName(), resultImagePath, dialog.isBlnIsBidi());
		LocaleService.getLanguageConfiger().addLanguage(language);
		languageModel.getLanguages().add(language);
		languageModel.getLanguagesMap().put(strCode, language);
	}
	Tree tree = fFilteredTree.getViewer().getTree();
	try {
		tree.setRedraw(false);
		fFilteredTree.getViewer().refresh();
	} finally {
		tree.setRedraw(true);
	}
}