blob: 53e2075da9203ab1ce0323948d24105353aad7a5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*******************************************************************************
* Copyright (c) 2003, 2005 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
*******************************************************************************/
/*
* Created on Jun 13, 2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.eclipse.jst.j2ee.internal.web.jfaces.extension;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jem.util.logger.proxy.Logger;
/**
* @author vijayb
*
* TODO To change the template for this generated type comment go to Window - Preferences - Java -
* Code Style - Code Templates
*/
public class FileURLExtension {
private String id = null;
private FileURL instance;
private boolean errorCondition = false;
private IConfigurationElement element;
public static final String FILE_URL_EXTENSION = "fileURL"; //$NON-NLS-1$
public static final String RUN = "run"; //$NON-NLS-1$
public static final String ATT_ID = "id"; //$NON-NLS-1$
public static final String ATT_CLASS = "class"; //$NON-NLS-1$
/**
*
*/
public FileURLExtension() {
super();
}
public FileURL getInstance() {
try {
if (this.instance == null && !this.errorCondition)
this.instance = (FileURL) this.element.createExecutableExtension("run"); //$NON-NLS-1$
} catch (Throwable e) {
Logger.getLogger().logError(e);
this.errorCondition = true;
}
return this.instance;
}
public FileURLExtension(IConfigurationElement element) {
if (!FILE_URL_EXTENSION.equals(element.getName()))
throw new IllegalArgumentException("Extensions must be of the type \"" + FILE_URL_EXTENSION + "\"."); //$NON-NLS-1$ //$NON-NLS-2$
this.element = element;
init();
}
private void init() {
this.id = this.element.getAttribute(ATT_ID);
}
/**
* @return Returns the id.
*/
public String getId() {
return this.id;
}
/**
* @param id
* The id to set.
*/
public void setId(String id) {
this.id = id;
}
}
|