Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2013-12-17 10:08:17 -0500
committerTom Schindl2013-12-17 10:08:17 -0500
commit8d46a5a20ae263b2a98ad926419f9b5290e06b4d (patch)
tree71de080b8e18a6316d82f7d1fbb846862fa7b41b
parent9987475880df488989dbe229e1af8157deecfb50 (diff)
downloadorg.eclipse.efxclipse-8d46a5a20ae263b2a98ad926419f9b5290e06b4d.tar.gz
org.eclipse.efxclipse-8d46a5a20ae263b2a98ad926419f9b5290e06b4d.tar.xz
org.eclipse.efxclipse-8d46a5a20ae263b2a98ad926419f9b5290e06b4d.zip
code clean up
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/.settings/org.eclipse.jdt.core.prefs107
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/Activator.java3
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/compile/FxmlAnnotationCompilationParticipant.java4
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposal.java37
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposalComputer.java378
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLEditor.java45
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLHyperlinkDetector.java38
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextHover.java94
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextViewerConfiguration.java7
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidationMessage.java10
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidator.java118
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/Util.java30
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/refactoring/RenameJFXControllerParticipant.java39
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/FXMLWizardPage.java64
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/Messages.java34
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/NewFXMLWizard.java50
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/messages.properties8
-rwxr-xr-xbundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/template/FXMLElement.java22
18 files changed, 645 insertions, 443 deletions
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/.settings/org.eclipse.jdt.core.prefs b/bundles/tooling/org.eclipse.fx.ide.fxml/.settings/org.eclipse.jdt.core.prefs
index f42de363a..0448c8920 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,114 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/Activator.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/Activator.java
index b58425acb..bbb939a0b 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/Activator.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/Activator.java
@@ -20,6 +20,9 @@ import org.osgi.framework.BundleContext;
public class Activator extends AbstractUIPlugin {
// The plug-in ID
+ /**
+ * The plugin id
+ */
public static final String PLUGIN_ID = "org.eclipse.fx.ide.fxml"; //$NON-NLS-1$
// The shared instance
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/compile/FxmlAnnotationCompilationParticipant.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/compile/FxmlAnnotationCompilationParticipant.java
index 3345aa4ae..d85a862f9 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/compile/FxmlAnnotationCompilationParticipant.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/compile/FxmlAnnotationCompilationParticipant.java
@@ -101,7 +101,7 @@ public class FxmlAnnotationCompilationParticipant extends
/**
* @param context
*/
- private List<CategorizedProblem> checkCU(final ICompilationUnit unit,
+ private static List<CategorizedProblem> checkCU(final ICompilationUnit unit,
final Collection<CategorizedProblem> existingProblems) {
List<CategorizedProblem> problems = new ArrayList<CategorizedProblem>();
if (existingProblems != null) {
@@ -196,7 +196,7 @@ public class FxmlAnnotationCompilationParticipant extends
return problems;
}
- private int getMethodLineNumber(final IType type, final IMethod method)
+ private static int getMethodLineNumber(final IType type, final IMethod method)
throws JavaModelException {
String source = type.getCompilationUnit().getSource();
String sourceUpToMethod = source.substring(0, method.getSourceRange()
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposal.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposal.java
index d35ffc9ba..a7c930533 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposal.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposal.java
@@ -15,11 +15,46 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.sse.ui.internal.contentassist.IRelevanceCompletionProposal;
import org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal;
+/**
+ * Completetion proposal
+ */
+@SuppressWarnings("restriction")
public class FXMLCompletionProposal extends ConfigurableCompletionProposal implements IRelevanceCompletionProposal {
+
+ /**
+ * Create a proposal
+ *
+ * @param replacementString
+ * the replacement string
+ * @param replacementOffset
+ * the offset
+ * @param replacementLength
+ * the length
+ * @param cursorPosition
+ * the cursor position after the replace
+ */
public FXMLCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition) {
super(replacementString, replacementOffset, replacementLength, cursorPosition);
}
-
+
+ /**
+ * Create a proposal
+ *
+ * @param replacementString
+ * the replacement string
+ * @param replacementOffset
+ * the offset
+ * @param replacementLength
+ * the length
+ * @param cursorPosition
+ * the cursor position after the replace
+ * @param image
+ * the image to display
+ * @param displayString
+ * the displayed string
+ * @param additionalProposalInfo
+ * additional informations
+ */
public FXMLCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, StyledString displayString, String additionalProposalInfo) {
super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, null, additionalProposalInfo);
}
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposalComputer.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposalComputer.java
index af2cb3771..8aed476c1 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposalComputer.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLCompletionProposalComputer.java
@@ -86,53 +86,61 @@ import org.eclipse.fx.ide.ui.editor.IValueOfContributor.Proposal;
import org.eclipse.fx.ide.ui.editor.ValueOfContributionCollector;
import org.eclipse.fx.ide.ui.util.IconKeys;
+/**
+ * Computes proposals for FXML documents
+ */
@SuppressWarnings("restriction")
public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposalComputer implements ICompletionProposalComputer {
private static final CamelCase MATCHER = new CamelCase();
private static final PrefixMatcher ATTRIBUTE_MATCHER = new CamelCase() {
+ @Override
public boolean isCandidateMatchingPrefix(String name, String prefix) {
- return super.isCandidateMatchingPrefix(name.startsWith("\"") ? name.substring(1) : name, prefix.startsWith("\"") ? prefix.substring(1) : prefix);
+ return super.isCandidateMatchingPrefix(name.startsWith("\"") ? name.substring(1) : name, prefix.startsWith("\"") ? prefix.substring(1) : prefix); //$NON-NLS-1$ //$NON-NLS-2$
}
};
private static final PrefixMatcher STATIC_ELEMENT_MATCHER = new CamelCase() {
+ @Override
public boolean isCandidateMatchingPrefix(String name, String prefix) {
- name = name.substring(name.indexOf('.') + 1, name.indexOf('>')).trim();
- return super.isCandidateMatchingPrefix(name, prefix);
+ String n = name;
+ n = n.substring(n.indexOf('.') + 1, n.indexOf('>')).trim();
+ return super.isCandidateMatchingPrefix(n, prefix);
}
};
private static final PrefixMatcher STATIC_ATTRIBUTE_MATCHER = new CamelCase() {
+ @Override
public boolean isCandidateMatchingPrefix(String name, String prefix) {
- name = name.substring(name.indexOf('.') + 1);
- prefix = prefix.startsWith("\"") ? prefix.substring(1) : prefix;
- return super.isCandidateMatchingPrefix(name, prefix);
+ String n = name.substring(name.indexOf('.') + 1);
+ String p = prefix.startsWith("\"") ? prefix.substring(1) : prefix; //$NON-NLS-1$
+ return super.isCandidateMatchingPrefix(n, p);
}
};
- private static final PrefixMatcher CLASS_ATTRIBUTE_MATCHER = new PrefixMatcher() {
+ static final PrefixMatcher CLASS_ATTRIBUTE_MATCHER = new PrefixMatcher() {
@Override
public boolean isCandidateMatchingPrefix(String name, String prefix) {
- name = name.startsWith("\"") ? name.substring(1) : name;
- prefix = prefix.startsWith("\"") ? prefix.substring(1) : prefix;
- return FQN_MATCHER.isCandidateMatchingPrefix(name, prefix);
+ String n = name.startsWith("\"") ? name.substring(1) : name; //$NON-NLS-1$
+ String p = prefix.startsWith("\"") ? prefix.substring(1) : prefix; //$NON-NLS-1$
+ return FQN_MATCHER.isCandidateMatchingPrefix(n, p);
}
};
private static final PrefixMatcher EVENT_ATTRIBUTE_MATCHER = new CamelCase() {
+ @Override
public boolean isCandidateMatchingPrefix(String name, String prefix) {
return super.isCandidateMatchingPrefix(normalize(name), normalize(prefix));
}
private String normalize(String value) {
- value = value.startsWith("\"") ? value.substring(1) : value;
- value = value.startsWith("#") ? value.substring(1) : value;
+ String v = value.startsWith("\"") ? value.substring(1) : value; //$NON-NLS-1$
+ v = v.startsWith("#") ? v.substring(1) : v; //$NON-NLS-1$
- return value;
+ return v;
}
};
- private static final FQNPrefixMatcher FQN_MATCHER = new FQNPrefixMatcher();
+ static final FQNPrefixMatcher FQN_MATCHER = new FQNPrefixMatcher();
{
FQN_MATCHER.setLastSegmentFinder(new FQNPrefixMatcher.DefaultLastSegmentFinder());
@@ -141,17 +149,20 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
private static final int DEFAULT_PRIORITY = 200;
private static final int PRIORITY_LOWER_1 = 100;
- private static final int PRIORITY_HIGHER_1 = 300;
private ValueOfContributionCollector valueOfCollector;
+ /**
+ * Create a new instance
+ */
public FXMLCompletionProposalComputer() {
ServiceReference<ValueOfContributionCollector> ref = Activator.getContext().getServiceReference(ValueOfContributionCollector.class);
- valueOfCollector = Activator.getContext().getService(ref);
+ this.valueOfCollector = Activator.getContext().getService(ref);
}
@Override
public void sessionStarted() {
+ //nothing
}
@Override
@@ -161,6 +172,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
@Override
public void sessionEnded() {
+ //nothing
}
@Override
@@ -176,15 +188,13 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- System.err.println(existingAttributes);
-
- if( "fx:root".equals(typeName) ) {
- typeName = parent.getAttributes().getNamedItem("type").getNodeValue();
+ if( "fx:root".equals(typeName) ) { //$NON-NLS-1$
+ typeName = parent.getAttributes().getNamedItem("type").getNodeValue(); //$NON-NLS-1$
}
if (typeName != null) {
- if (Character.isLowerCase(typeName.charAt(0)) || typeName.contains(".")) {
+ if (Character.isLowerCase(typeName.charAt(0)) || typeName.contains(".")) { //$NON-NLS-1$
// no proposal for static elements and attribute definitions
return;
}
@@ -194,7 +204,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
IFXClass fxClass = FXPlugin.getClassmodel().findClass(type.getJavaProject(), type);
if( fxClass.getValueOf() != null ) {
- FXMLCompletionProposal cp = createAttributeProposal(contentAssistRequest, context, "fx:value=\"\"", new StyledString("fx:valueOf").append(" - " + fxClass.getSimpleName(), StyledString.QUALIFIER_STYLER), IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY+10, MATCHER);
+ FXMLCompletionProposal cp = createAttributeProposal(contentAssistRequest, context, "fx:value=\"\"", new StyledString("fx:valueOf").append(" - " + fxClass.getSimpleName(), StyledString.QUALIFIER_STYLER), IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY+10, MATCHER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (cp != null) {
cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
cp.setHover(new HoverImpl(fxClass.getValueOf()));
@@ -212,18 +222,18 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
if (parent.getParentNode() != null) {
Node n = null;
- if (Character.isUpperCase(parent.getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getNodeName())) {
+ if (Character.isUpperCase(parent.getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getNodeName())) { //$NON-NLS-1$
n = parent.getParentNode();
} else if (parent.getParentNode().getParentNode() != null) {
- if (Character.isUpperCase(parent.getParentNode().getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getParentNode().getNodeName())) {
+ if (Character.isUpperCase(parent.getParentNode().getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getParentNode().getNodeName())) { //$NON-NLS-1$
n = parent.getParentNode().getParentNode();
}
}
if (n != null) {
IType containerType;
- if( "fx:root".equals(n.getNodeName()) ) {
- containerType = Util.findType(n.getAttributes().getNamedItem("type").getNodeValue(), parent.getOwnerDocument());
+ if( "fx:root".equals(n.getNodeName()) ) { //$NON-NLS-1$
+ containerType = Util.findType(n.getAttributes().getNamedItem("type").getNodeValue(), parent.getOwnerDocument()); //$NON-NLS-1$
} else {
containerType = Util.findType(n.getNodeName(), parent.getOwnerDocument());
}
@@ -232,14 +242,14 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
IFXClass fxclass = FXPlugin.getClassmodel().findClass(type.getJavaProject(), containerType);
if (fxclass != null) {
for (IFXProperty property : fxclass.getAllStaticProperties().values()) {
- if( ! existingAttributes.contains(property.getFXClass().getSimpleName() + "." +property.getName()) ) {
+ if( ! existingAttributes.contains(property.getFXClass().getSimpleName() + "." +property.getName()) ) { //$NON-NLS-1$
createAttributeNameProposal(contentAssistRequest, context, property);
}
}
}
}
} else {
- FXMLCompletionProposal cp = createAttributeProposal(contentAssistRequest, context, "fx:controller=\"\"", new StyledString("fx:controller").append(" - FXML built-in", StyledString.QUALIFIER_STYLER), IconKeys.getIcon(IconKeys.CLASS_KEY), DEFAULT_PRIORITY+10, MATCHER);
+ FXMLCompletionProposal cp = createAttributeProposal(contentAssistRequest, context, "fx:controller=\"\"", new StyledString("fx:controller").append(" - FXML built-in", StyledString.QUALIFIER_STYLER), IconKeys.getIcon(IconKeys.CLASS_KEY), DEFAULT_PRIORITY+10, MATCHER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if( cp != null ) {
contentAssistRequest.addProposal(cp);
}
@@ -249,7 +259,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createAttributeNameProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXProperty fxProperty) {
+ private static void createAttributeNameProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXProperty fxProperty) {
if (fxProperty.isSetable()) {
if (fxProperty instanceof IFXPrimitiveProperty) {
createPrimitivePropnameProposal(contentAssistRequest, context, (IFXPrimitiveProperty) fxProperty);
@@ -263,23 +273,23 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createEnumPropnameProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXEnumProperty prop) {
+ private static void createEnumPropnameProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXEnumProperty prop) {
FXMLCompletionProposal cp;
if (prop.isStatic()) {
StyledString s = new StyledString();
- s.append("(static) ", StyledString.COUNTER_STYLER);
- s.append(prop.getFXClass().getSimpleName() + "." + prop.getName() + " : " + prop.getEnumTypeAsString(false));
- s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
+ s.append("(static) ", StyledString.COUNTER_STYLER); //$NON-NLS-1$
+ s.append(prop.getFXClass().getSimpleName() + "." + prop.getName() + " : " + prop.getEnumTypeAsString(false)); //$NON-NLS-1$ //$NON-NLS-2$
+ s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
- String proposalValue = prop.getFXClass().getSimpleName() + "." + prop.getName() + "=\"\"";
+ String proposalValue = prop.getFXClass().getSimpleName() + "." + prop.getName() + "=\"\""; //$NON-NLS-1$ //$NON-NLS-2$
cp = createAttributeProposal(contentAssistRequest, context, proposalValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY - 10, STATIC_ATTRIBUTE_MATCHER);
} else {
- StyledString s = new StyledString(prop.getName() + " : " + prop.getEnumTypeAsString(false));
- s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
+ StyledString s = new StyledString(prop.getName() + " : " + prop.getEnumTypeAsString(false)); //$NON-NLS-1$
+ s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
- String propValue = prop.getName() + "=\"\"";
+ String propValue = prop.getName() + "=\"\""; //$NON-NLS-1$
cp = createAttributeProposal(contentAssistRequest, context, propValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY, MATCHER);
}
@@ -292,12 +302,12 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createEventHandlerPropnameProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXEventHandlerProperty prop) {
+ private static void createEventHandlerPropnameProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXEventHandlerProperty prop) {
if (!prop.isStatic()) {
- StyledString s = new StyledString(prop.getName() + " : " + prop.getEventTypeAsString(false));
- s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
+ StyledString s = new StyledString(prop.getName() + " : " + prop.getEventTypeAsString(false)); //$NON-NLS-1$
+ s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
- String propValue = prop.getName() + "=\"#\"";
+ String propValue = prop.getName() + "=\"#\""; //$NON-NLS-1$
FXMLCompletionProposal cp = createAttributeProposal(contentAssistRequest, context, propValue, s, IconKeys.getIcon(IconKeys.EVENT_KEY), DEFAULT_PRIORITY, MATCHER);
if (cp != null) {
@@ -309,28 +319,28 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createObjectPropnameProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXObjectProperty prop) {
+ private static void createObjectPropnameProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXObjectProperty prop) {
String type = prop.getElementTypeAsString(true);
// TODO Should we allow other elements because one can use $... to
// reference elements
- if ("java.lang.Boolean".equals(type) || isIntegerType(type) || isDoubleType(type) || prop.hasValueOf()) {
+ if ("java.lang.Boolean".equals(type) || isIntegerType(type) || isDoubleType(type) || prop.hasValueOf()) { //$NON-NLS-1$
FXMLCompletionProposal cp;
if (prop.isStatic()) {
StyledString s = new StyledString();
- s.append("(static) ", StyledString.COUNTER_STYLER);
- s.append(prop.getFXClass().getSimpleName() + "." + prop.getName() + " : " + prop.getElementTypeAsString(false));
- s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
+ s.append("(static) ", StyledString.COUNTER_STYLER); //$NON-NLS-1$
+ s.append(prop.getFXClass().getSimpleName() + "." + prop.getName() + " : " + prop.getElementTypeAsString(false)); //$NON-NLS-1$ //$NON-NLS-2$
+ s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
- String proposalValue = prop.getFXClass().getSimpleName() + "." + prop.getName() + "=\"\"";
+ String proposalValue = prop.getFXClass().getSimpleName() + "." + prop.getName() + "=\"\""; //$NON-NLS-1$ //$NON-NLS-2$
cp = createAttributeProposal(contentAssistRequest, context, proposalValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY - 10, STATIC_ATTRIBUTE_MATCHER);
} else {
- StyledString s = new StyledString(prop.getName() + " : " + prop.getElementTypeAsString(false));
- s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
+ StyledString s = new StyledString(prop.getName() + " : " + prop.getElementTypeAsString(false)); //$NON-NLS-1$
+ s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
- String propValue = prop.getName() + "=\"\"";
+ String propValue = prop.getName() + "=\"\""; //$NON-NLS-1$
cp = createAttributeProposal(contentAssistRequest, context, propValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY, MATCHER);
}
@@ -343,53 +353,53 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createPrimitivePropnameProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXPrimitiveProperty fxProperty) {
+ private static void createPrimitivePropnameProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXPrimitiveProperty fxProperty) {
String typeName;
switch (fxProperty.getType()) {
case BOOLEAN:
- typeName = "boolean";
+ typeName = "boolean"; //$NON-NLS-1$
break;
case BYTE:
- typeName = "byte";
+ typeName = "byte"; //$NON-NLS-1$
break;
case CHAR:
- typeName = "char";
+ typeName = "char"; //$NON-NLS-1$
break;
case DOUBLE:
- typeName = "double";
+ typeName = "double"; //$NON-NLS-1$
break;
case FLOAT:
- typeName = "float";
+ typeName = "float"; //$NON-NLS-1$
break;
case INTEGER:
- typeName = "integer";
+ typeName = "integer"; //$NON-NLS-1$
break;
case LONG:
- typeName = "long";
+ typeName = "long"; //$NON-NLS-1$
break;
case SHORT:
- typeName = "short";
+ typeName = "short"; //$NON-NLS-1$
break;
default:
- typeName = "String";
+ typeName = "String"; //$NON-NLS-1$
break;
}
FXMLCompletionProposal cp;
if (fxProperty.isStatic()) {
StyledString s = new StyledString();
- s.append("(static) ", StyledString.COUNTER_STYLER);
- s.append(fxProperty.getFXClass().getSimpleName() + "." + fxProperty.getName() + " : " + typeName);
- s.append(" - " + fxProperty.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
+ s.append("(static) ", StyledString.COUNTER_STYLER); //$NON-NLS-1$
+ s.append(fxProperty.getFXClass().getSimpleName() + "." + fxProperty.getName() + " : " + typeName); //$NON-NLS-1$ //$NON-NLS-2$
+ s.append(" - " + fxProperty.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
- String proposalValue = fxProperty.getFXClass().getSimpleName() + "." + fxProperty.getName() + "=\"\"";
+ String proposalValue = fxProperty.getFXClass().getSimpleName() + "." + fxProperty.getName() + "=\"\""; //$NON-NLS-1$ //$NON-NLS-2$
cp = createAttributeProposal(contentAssistRequest, context, proposalValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY - 10, STATIC_ATTRIBUTE_MATCHER);
} else {
- StyledString s = new StyledString(fxProperty.getName() + " : " + typeName);
- s.append(" - " + fxProperty.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
+ StyledString s = new StyledString(fxProperty.getName() + " : " + typeName); //$NON-NLS-1$
+ s.append(" - " + fxProperty.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
- String proposalValue = fxProperty.getName() + "=\"\"";
+ String proposalValue = fxProperty.getName() + "=\"\""; //$NON-NLS-1$
cp = createAttributeProposal(contentAssistRequest, context, proposalValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY, MATCHER);
}
@@ -402,7 +412,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private FXMLCompletionProposal createAttributeProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, String proposalValue, StyledString s, Image image, int priority, PrefixMatcher matcher) {
+ private static FXMLCompletionProposal createAttributeProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, String proposalValue, StyledString s, Image image, int priority, PrefixMatcher matcher) {
if (matcher.isCandidateMatchingPrefix(proposalValue, contentAssistRequest.getMatchString())) {
FXMLCompletionProposal cp = new FXMLCompletionProposal(proposalValue, context.getInvocationOffset() - contentAssistRequest.getMatchString().length(), proposalValue.length(), proposalValue.length() - 1, image, s, null);
cp.setMatcher(matcher);
@@ -412,7 +422,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
return null;
}
- private FXMLCompletionProposal createProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, String proposalValue, StyledString s, Image img, PrefixMatcher matcher) {
+ static FXMLCompletionProposal createProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, String proposalValue, StyledString s, Image img, PrefixMatcher matcher) {
if (matcher.isCandidateMatchingPrefix(proposalValue, contentAssistRequest.getMatchString())) {
FXMLCompletionProposal cp = new FXMLCompletionProposal(proposalValue, context.getInvocationOffset() - contentAssistRequest.getMatchString().length(), proposalValue.length(), proposalValue.length(), img, s, null);
cp.setMatcher(matcher);
@@ -421,7 +431,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
return null;
}
- private FXMLCompletionProposal createElementProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, String proposalValue, StyledString s, boolean withEnd, int priority, Image img, PrefixMatcher m) {
+ static FXMLCompletionProposal createElementProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, String proposalValue, StyledString s, boolean withEnd, int priority, Image img, PrefixMatcher m) {
if (m.isCandidateMatchingPrefix(proposalValue, contentAssistRequest.getMatchString())) {
FXMLCompletionProposal cp = new FXMLCompletionProposal(proposalValue, context.getInvocationOffset() - contentAssistRequest.getMatchString().length(), proposalValue.length(), withEnd ? proposalValue.length() / 2 - 1 : proposalValue.length(), img, s, null);
cp.setPriority(priority);
@@ -436,8 +446,8 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
Node parent = contentAssistRequest.getParent();
if (parent.getNodeType() == Node.ELEMENT_NODE) {
- if (parent.getNodeName().contains(".")) {
- String[] parts = parent.getNodeName().split("\\.");
+ if (parent.getNodeName().contains(".")) { //$NON-NLS-1$
+ String[] parts = parent.getNodeName().split("\\."); //$NON-NLS-1$
IType ownerType = Util.findType(parts[0], parent.getOwnerDocument());
if (ownerType != null) {
IFXClass fxClass = FXPlugin.getClassmodel().findClass(ownerType.getJavaProject(), ownerType);
@@ -454,7 +464,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
}
- } else if (Character.isUpperCase(parent.getNodeName().charAt(0)) || "fx:root".equals(parent.getNodeName())) {
+ } else if (Character.isUpperCase(parent.getNodeName().charAt(0)) || "fx:root".equals(parent.getNodeName())) { //$NON-NLS-1$
if (!contentAssistRequest.getMatchString().isEmpty() && Character.isUpperCase(contentAssistRequest.getMatchString().charAt(0))) {
// TODO This means we are static?
// IJavaProject jproject =
@@ -475,20 +485,20 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
if (parent.getParentNode() != null) {
Node n = null;
- if( "fx:root".equals(parent.getNodeName()) ) {
+ if( "fx:root".equals(parent.getNodeName()) ) { //$NON-NLS-1$
n = parent;
- } else if (Character.isUpperCase(parent.getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getNodeName())) {
+ } else if (Character.isUpperCase(parent.getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getNodeName())) { //$NON-NLS-1$
n = parent.getParentNode();
} else if (parent.getParentNode().getParentNode() != null) {
- if (Character.isUpperCase(parent.getParentNode().getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getParentNode().getNodeName())) {
+ if (Character.isUpperCase(parent.getParentNode().getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getParentNode().getNodeName())) { //$NON-NLS-1$
n = parent.getParentNode().getParentNode();
}
}
if (n != null) {
IType type;
- if( "fx:root".equals(n.getNodeName()) ) {
- type = Util.findType(n.getAttributes().getNamedItem("type").getNodeValue(), parent.getOwnerDocument());
+ if( "fx:root".equals(n.getNodeName()) ) { //$NON-NLS-1$
+ type = Util.findType(n.getAttributes().getNamedItem("type").getNodeValue(), parent.getOwnerDocument()); //$NON-NLS-1$
} else {
type = Util.findType(n.getNodeName(), parent.getOwnerDocument());
}
@@ -497,12 +507,12 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
IFXClass fxclass = FXPlugin.getClassmodel().findClass(type.getJavaProject(), type);
if (fxclass != null) {
for (IFXProperty p : fxclass.getAllStaticProperties().values()) {
- String proposalValue = fxclass.getSimpleName() + "." + p.getName() + ">" + "</" + fxclass.getSimpleName() + "." + p.getName() + ">";
+ String proposalValue = fxclass.getSimpleName() + "." + p.getName() + ">" + "</" + fxclass.getSimpleName() + "." + p.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
String sType;
if (p instanceof IFXPrimitiveProperty) {
IFXPrimitiveProperty pp = (IFXPrimitiveProperty) p;
- sType = pp.getType() == Type.STRING ? "String" : pp.getType().jvmType();
+ sType = pp.getType() == Type.STRING ? "String" : pp.getType().jvmType(); //$NON-NLS-1$
} else if (p instanceof IFXObjectProperty) {
IFXObjectProperty op = (IFXObjectProperty) p;
sType = op.getElementTypeAsString(false);
@@ -510,11 +520,11 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
IFXEnumProperty ep = (IFXEnumProperty) p;
sType = ep.getEnumTypeAsString(false);
} else {
- sType = "<unknown>";
+ sType = "<unknown>"; //$NON-NLS-1$
}
FXMLCompletionProposal cp = createElementProposal(contentAssistRequest, context, proposalValue,
- new StyledString().append("(static) ", StyledString.COUNTER_STYLER).append(p.getFXClass().getSimpleName() + "." + p.getName()).append(" - " + sType, StyledString.QUALIFIER_STYLER), true, PRIORITY_LOWER_1, null, STATIC_ELEMENT_MATCHER);
+ new StyledString().append("(static) ", StyledString.COUNTER_STYLER).append(p.getFXClass().getSimpleName() + "." + p.getName()).append(" - " + sType, StyledString.QUALIFIER_STYLER), true, PRIORITY_LOWER_1, null, STATIC_ELEMENT_MATCHER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (cp != null) {
cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
cp.setHover(new HoverImpl(p.getJavaElement()));
@@ -527,8 +537,8 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
IType type;
- if( "fx:root".equals(parent.getNodeName()) ) {
- type = Util.findType(parent.getAttributes().getNamedItem("type").getNodeValue(), parent.getOwnerDocument());
+ if( "fx:root".equals(parent.getNodeName()) ) { //$NON-NLS-1$
+ type = Util.findType(parent.getAttributes().getNamedItem("type").getNodeValue(), parent.getOwnerDocument()); //$NON-NLS-1$
} else {
type = Util.findType(parent.getNodeName(), parent.getOwnerDocument());
}
@@ -545,8 +555,8 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
IType type;
- if( "fx:root".equals(parent.getNodeName()) ) {
- type = Util.findType(parent.getAttributes().getNamedItem("type").getNodeValue(), parent.getOwnerDocument());
+ if( "fx:root".equals(parent.getNodeName()) ) { //$NON-NLS-1$
+ type = Util.findType(parent.getAttributes().getNamedItem("type").getNodeValue(), parent.getOwnerDocument()); //$NON-NLS-1$
} else {
type = Util.findType(parent.getNodeName(), parent.getOwnerDocument());
}
@@ -568,13 +578,13 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createClassElementNameProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
+ private static void createClassElementNameProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
Node propertyType = contentAssistRequest.getParent();
Node elementType = propertyType.getParentNode();
IType type;
- if( "fx:root".equals(elementType.getNodeName()) ) {
- type = Util.findType(elementType.getAttributes().getNamedItem("type").getNodeValue(), elementType.getOwnerDocument());
+ if( "fx:root".equals(elementType.getNodeName()) ) { //$NON-NLS-1$
+ type = Util.findType(elementType.getAttributes().getNamedItem("type").getNodeValue(), elementType.getOwnerDocument()); //$NON-NLS-1$
} else {
type = findType(elementType.getNodeName(), contentAssistRequest, context);
}
@@ -594,7 +604,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createPropertyElementNameProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXProperty fxProperty) {
+ private static void createPropertyElementNameProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXProperty fxProperty) {
if (fxProperty instanceof IFXCollectionProperty) {
createListPropertyElementProposal(contentAssistRequest, context, (IFXCollectionProperty) fxProperty);
} else if (fxProperty instanceof IFXObjectProperty) {
@@ -602,11 +612,11 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createListPropertyElementProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXCollectionProperty prop) {
- StyledString s = new StyledString(prop.getName() + " : " + prop.getCollectionAsString());
- s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
+ private static void createListPropertyElementProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXCollectionProperty prop) {
+ StyledString s = new StyledString(prop.getName() + " : " + prop.getCollectionAsString()); //$NON-NLS-1$
+ s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
- String propValue = prop.getName() + "></" + prop.getName() + ">";
+ String propValue = prop.getName() + "></" + prop.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
FXMLCompletionProposal cp = createElementProposal(contentAssistRequest, context, propValue, s, true, DEFAULT_PRIORITY, IconKeys.getIcon(IconKeys.FIELD_KEY), MATCHER);
if (cp != null) {
@@ -617,11 +627,11 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createObjectPropertyElementProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXObjectProperty prop) {
- StyledString s = new StyledString(prop.getName() + " : " + prop.getElementTypeAsString(false));
- s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
+ private static void createObjectPropertyElementProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXObjectProperty prop) {
+ StyledString s = new StyledString(prop.getName() + " : " + prop.getElementTypeAsString(false)); //$NON-NLS-1$
+ s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
- String propValue = prop.getName() + "></" + prop.getName() + ">";
+ String propValue = prop.getName() + "></" + prop.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
FXMLCompletionProposal cp = createElementProposal(contentAssistRequest, context, propValue, s, true, DEFAULT_PRIORITY, IconKeys.getIcon(IconKeys.FIELD_KEY), MATCHER);
if (cp != null) {
@@ -632,7 +642,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createSubtypeProposals(final ContentAssistRequest contentAssistRequest, final CompletionProposalInvocationContext context, IType superType) {
+ private static void createSubtypeProposals(final ContentAssistRequest contentAssistRequest, final CompletionProposalInvocationContext context, IType superType) {
IJavaProject jproject = findProject(contentAssistRequest);
try {
@@ -652,12 +662,12 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) {
String sPackageName = new String(packageName);
int priority = PRIORITY_LOWER_1;
- if (sPackageName.startsWith("com.sun.javafx")) {
+ if (sPackageName.startsWith("com.sun.javafx")) { //$NON-NLS-1$
priority -= 10;
}
StyledString s = new StyledString(new String(simpleTypeName));
- s.append(" - " + sPackageName, StyledString.QUALIFIER_STYLER);
- FXMLCompletionProposal prop = createElementProposal(contentAssistRequest, context, sPackageName + "." + new String(simpleTypeName) + " ", s, false, priority, IconKeys.getIcon(IconKeys.CLASS_KEY), FQN_MATCHER);
+ s.append(" - " + sPackageName, StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
+ FXMLCompletionProposal prop = createElementProposal(contentAssistRequest, context, sPackageName + "." + new String(simpleTypeName) + " ", s, false, priority, IconKeys.getIcon(IconKeys.CLASS_KEY), FQN_MATCHER); //$NON-NLS-1$ //$NON-NLS-2$
if (prop != null) {
prop.setMatcher(FQN_MATCHER);
@@ -708,11 +718,11 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
proposal.setCursorPosition(shortened.length());
document.replace(proposal.getReplacementOffset(), proposal.getReplacementLength(), shortened);
- String importStatement = (startWithLineBreak ? "\n<?import " : "import ") + proposalReplacementString.trim();
- importStatement += "?>";
+ String importStatement = (startWithLineBreak ? "\n<?import " : "import ") + proposalReplacementString.trim(); //$NON-NLS-1$ //$NON-NLS-2$
+ importStatement += "?>"; //$NON-NLS-1$
if (endWithLineBreak)
- importStatement += "\n\n";
+ importStatement += "\n\n"; //$NON-NLS-1$
document.replace(offset, 0, importStatement.toString());
proposal.setCursorPosition(proposal.getCursorPosition() + importStatement.length());
}
@@ -731,18 +741,18 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
@Override
protected void addStartDocumentProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
- FXMLCompletionProposal proposal = new FXMLCompletionProposal("<?scenebuilder-stylesheet ?>", context.getInvocationOffset() - contentAssistRequest.getMatchString().length(), "<?scenebuilder-stylesheet ?>".length(), "<?scenebuilder-stylesheet ?>".length()-2);
+ FXMLCompletionProposal proposal = new FXMLCompletionProposal("<?scenebuilder-stylesheet ?>", context.getInvocationOffset() - contentAssistRequest.getMatchString().length(), "<?scenebuilder-stylesheet ?>".length(), "<?scenebuilder-stylesheet ?>".length()-2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
proposal.setMatcher(MATCHER);
contentAssistRequest.addProposal(proposal);
- proposal = new FXMLCompletionProposal("<?scenebuilder-preview-i18n-resource ?>", context.getInvocationOffset() - contentAssistRequest.getMatchString().length(), "<?scenebuilder-preview-i18n-resource ?>".length(), "<?scenebuilder-preview-i18n-resource ?>".length()-2);
+ proposal = new FXMLCompletionProposal("<?scenebuilder-preview-i18n-resource ?>", context.getInvocationOffset() - contentAssistRequest.getMatchString().length(), "<?scenebuilder-preview-i18n-resource ?>".length(), "<?scenebuilder-preview-i18n-resource ?>".length()-2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
proposal.setMatcher(MATCHER);
contentAssistRequest.addProposal(proposal);
IJavaProject jproject = findProject(contentAssistRequest);
try {
- IType superType = jproject.findType("javafx.scene.Parent");
+ IType superType = jproject.findType("javafx.scene.Parent"); //$NON-NLS-1$
if (superType != null) {
createSubtypeProposals(contentAssistRequest, context, superType);
}
@@ -767,8 +777,8 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
if (attribute != null) {
- if ("http://javafx.com/fxml".equals(attribute.getNamespaceURI())) {
- if("constant".equals(attribute.getLocalName())) {
+ if ("http://javafx.com/fxml".equals(attribute.getNamespaceURI())) { //$NON-NLS-1$
+ if("constant".equals(attribute.getLocalName())) { //$NON-NLS-1$
IType type = findType(n.getNodeName(), contentAssistRequest, context);
if (type != null) {
try {
@@ -776,13 +786,13 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
collectStaticFields(fields, type);
for( IField f : fields ) {
- StyledString s = new StyledString(f.getElementName() + " : " + Signature.getSimpleName(Signature.toString(f.getTypeSignature())));
+ StyledString s = new StyledString(f.getElementName() + " : " + Signature.getSimpleName(Signature.toString(f.getTypeSignature()))); //$NON-NLS-1$
String owner = ((IType)f.getAncestor(IJavaElement.TYPE)).getElementName();
- s.append(" - " + Signature.getSimpleName(owner), StyledString.QUALIFIER_STYLER);
+ s.append(" - " + Signature.getSimpleName(owner), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
FXMLCompletionProposal cp = createProposal(
contentAssistRequest,
- context, "\"" + f.getElementName(),
+ context, "\"" + f.getElementName(), //$NON-NLS-1$
s,
IconKeys.getIcon(IconKeys.CLASS_KEY), CLASS_ATTRIBUTE_MATCHER);
@@ -796,13 +806,13 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
e.printStackTrace();
}
}
- } else if ("controller".equals(attribute.getLocalName())) {
+ } else if ("controller".equals(attribute.getLocalName())) { //$NON-NLS-1$
IJavaProject jproject = findProject(contentAssistRequest);
char[] typeName = null;
char[] packageName = null;
if (!contentAssistRequest.getMatchString().isEmpty()) {
- if( contentAssistRequest.getMatchString().startsWith("\"") ) {
+ if( contentAssistRequest.getMatchString().startsWith("\"") ) { //$NON-NLS-1$
typeName = contentAssistRequest.getMatchString().substring(1).toCharArray();
} else {
typeName = contentAssistRequest.getMatchString().toCharArray();
@@ -813,18 +823,15 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
SearchEngine searchEngine = new SearchEngine();
try {
searchEngine.searchAllTypeNames(packageName, SearchPattern.R_PATTERN_MATCH, typeName, SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CAMELCASE_MATCH, IJavaSearchConstants.TYPE, searchScope, new TypeNameRequestor() {
+ @Override
public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) {
String sPackageName = new String(packageName);
- int priority = PRIORITY_LOWER_1;
- if (sPackageName.startsWith("com.sun")) {
- priority -= 10;
- }
StyledString s = new StyledString(new String(simpleTypeName));
- s.append(" - " + sPackageName, StyledString.QUALIFIER_STYLER);
+ s.append(" - " + sPackageName, StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
FXMLCompletionProposal cp = createProposal(
contentAssistRequest,
- context, "\"" + sPackageName + "." + new String(simpleTypeName),
+ context, "\"" + sPackageName + "." + new String(simpleTypeName), //$NON-NLS-1$ //$NON-NLS-2$
s,
IconKeys.getIcon(IconKeys.CLASS_KEY), CLASS_ATTRIBUTE_MATCHER);
@@ -838,10 +845,10 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
e.printStackTrace();
}
- } else if("id".equals(attribute.getLocalName())) {
+ } else if("id".equals(attribute.getLocalName())) { //$NON-NLS-1$
Document d = contentAssistRequest.getNode().getOwnerDocument();
Element e = d.getDocumentElement();
- Attr a = e.getAttributeNodeNS("http://javafx.com/fxml", "controller");
+ Attr a = e.getAttributeNodeNS("http://javafx.com/fxml", "controller"); //$NON-NLS-1$ //$NON-NLS-2$
if (a != null) {
IType t = Util.findType(a.getValue(), d);
if (t != null) {
@@ -853,7 +860,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
IFXCtrlField f = ef.getValue();
if( org.eclipse.fx.ide.model.Util.assignable(fromType, f.getType()) ) {
StyledString s = new StyledString(f.getName());
- s.append(" - " + ctrlClass.getSimpleName(), StyledString.QUALIFIER_STYLER);
+ s.append(" - " + ctrlClass.getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
Image img;
switch (f.getVisibility()) {
case PUBLIC:
@@ -873,7 +880,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
FXMLCompletionProposal cp = createProposal(
contentAssistRequest,
context,
- "\""+f.getName(),
+ "\""+f.getName(), //$NON-NLS-1$
s, img, CLASS_ATTRIBUTE_MATCHER);
if( cp != null ) {
@@ -886,8 +893,8 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
}
- } else if (attribute.getNodeName().contains(".")) {
- String[] parts = attribute.getNodeName().split("\\.");
+ } else if (attribute.getNodeName().contains(".")) { //$NON-NLS-1$
+ String[] parts = attribute.getNodeName().split("\\."); //$NON-NLS-1$
IType type = findType(parts[0], contentAssistRequest, context);
if (type != null) {
@@ -941,10 +948,10 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createAttributeValueEventHandlerProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXEventHandlerProperty p) {
+ private static void createAttributeValueEventHandlerProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXEventHandlerProperty p) {
Document d = contentAssistRequest.getNode().getOwnerDocument();
Element e = d.getDocumentElement();
- Attr a = e.getAttributeNodeNS("http://javafx.com/fxml", "controller");
+ Attr a = e.getAttributeNodeNS("http://javafx.com/fxml", "controller"); //$NON-NLS-1$//$NON-NLS-2$
if (a != null) {
IType t = Util.findType(a.getValue(), d);
if (t != null) {
@@ -954,15 +961,15 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
for (IFXCtrlEventMethod ctrlMethod : ctrlClass.getAllEventMethods().values()) {
StyledString s = null;
if (!ctrlMethod.hasArgument()) {
- s = new StyledString(ctrlMethod.getName() + "()");
+ s = new StyledString(ctrlMethod.getName() + "()"); //$NON-NLS-1$
} else {
if (org.eclipse.fx.ide.model.Util.assignable(p.getEventType(), ctrlMethod.getArgumentType())) {
- s = new StyledString(ctrlMethod.getName() + "(" + p.getEventTypeAsString(false) + ")");
+ s = new StyledString(ctrlMethod.getName() + "(" + p.getEventTypeAsString(false) + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
if (s != null) {
- s.append(" - " + ctrlClass.getSimpleName(), StyledString.QUALIFIER_STYLER);
+ s.append(" - " + ctrlClass.getSimpleName(), StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
Image img = null;
switch (ctrlMethod.getVisibility()) {
@@ -980,7 +987,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
break;
}
- FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"#" + ctrlMethod.getName(), s, img, EVENT_ATTRIBUTE_MATCHER);
+ FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"#" + ctrlMethod.getName(), s, img, EVENT_ATTRIBUTE_MATCHER); //$NON-NLS-1$
if (cp != null) {
contentAssistRequest.addProposal(cp);
@@ -993,10 +1000,10 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
}
- private void createAttributeValuePrimitiveProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXPrimitiveProperty p) {
+ private static void createAttributeValuePrimitiveProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXPrimitiveProperty p) {
switch (p.getType()) {
case BOOLEAN: {
- FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"true", new StyledString("true"), null, ATTRIBUTE_MATCHER);
+ FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"true", new StyledString("true"), null, ATTRIBUTE_MATCHER); //$NON-NLS-1$ //$NON-NLS-2$
if (cp != null) {
cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
@@ -1004,7 +1011,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
contentAssistRequest.addProposal(cp);
}
- cp = createProposal(contentAssistRequest, context, "\"false", new StyledString("false"), null, ATTRIBUTE_MATCHER);
+ cp = createProposal(contentAssistRequest, context, "\"false", new StyledString("false"), null, ATTRIBUTE_MATCHER); //$NON-NLS-1$ //$NON-NLS-2$
if (cp != null) {
cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
@@ -1014,59 +1021,18 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
break;
}
- // case BYTE:
- // case CHAR:
- // case INTEGER:
- // case LONG:
- // case SHORT: {
- // FXMLCompletionProposal cp =
- // createProposal(contentAssistRequest,context, "1", new
- // StyledString("1"), null, ATTRIBUTE_MATCHER);
- //
- // if (cp != null) {
- // cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
- // cp.setHover(new HoverImpl(p.getJavaElement()));
- // contentAssistRequest.addProposal(cp);
- // }
- // break;
- // }
- // case DOUBLE:
- // case FLOAT: {
- // FXMLCompletionProposal cp =
- // createProposal(contentAssistRequest,context, "1.0", new
- // StyledString("1.0"), null, ATTRIBUTE_MATCHER);
- //
- // if (cp != null) {
- // cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
- // cp.setHover(new HoverImpl(p.getJavaElement()));
- // contentAssistRequest.addProposal(cp);
- // }
- // break;
- // }
- // case STRING: {
- // FXMLCompletionProposal cp =
- // createProposal(contentAssistRequest,context, "<String>", new
- // StyledString("<String>"), null, ATTRIBUTE_MATCHER);
- //
- // if (cp != null) {
- // cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
- // cp.setHover(new HoverImpl(p.getJavaElement()));
- // contentAssistRequest.addProposal(cp);
- // }
- // break;
- // }
default:
break;
}
}
- private void createAttributeValueEnumProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXEnumProperty p) {
+ private static void createAttributeValueEnumProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXEnumProperty p) {
IType t = p.getEnumType();
if (t != null) {
try {
for (IField f : t.getFields()) {
if (Flags.isEnum(f.getFlags())) {
- FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"" + f.getElementName(), new StyledString(f.getElementName()).append(" - " + p.getEnumTypeAsString(false), StyledString.QUALIFIER_STYLER), IconKeys.getIcon(IconKeys.ENUM_KEY), ATTRIBUTE_MATCHER);
+ FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"" + f.getElementName(), new StyledString(f.getElementName()).append(" - " + p.getEnumTypeAsString(false), StyledString.QUALIFIER_STYLER), IconKeys.getIcon(IconKeys.ENUM_KEY), ATTRIBUTE_MATCHER); //$NON-NLS-1$//$NON-NLS-2$
if (cp != null) {
cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
cp.setHover(new HoverImpl(f));
@@ -1083,9 +1049,9 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
private void createAttributeValueObjectProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXObjectProperty p) {
if( p.hasValueOf() ) {
- for( IValueOfContributor c : valueOfCollector.getContributors(p.getElementTypeAsString(true)) ) {
+ for( IValueOfContributor c : this.valueOfCollector.getContributors(p.getElementTypeAsString(true)) ) {
for( Proposal vProp : c.getProposals() ) {
- FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"" +vProp.getValue(), new StyledString(vProp.getValue()), IconKeys.getIcon(IconKeys.VALUE_OF_KEY), ATTRIBUTE_MATCHER);
+ FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"" +vProp.getValue(), new StyledString(vProp.getValue()), IconKeys.getIcon(IconKeys.VALUE_OF_KEY), ATTRIBUTE_MATCHER); //$NON-NLS-1$
if (cp != null) {
cp.setPriority(cp.getPriority() + vProp.getPriority() + 1);
if( vProp instanceof DialogProposal ) {
@@ -1094,7 +1060,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
@Override
public String getActualReplacementString(
ConfigurableCompletionProposal proposal) {
- return "\"" + dProp.openDialogValue();
+ return "\"" + dProp.openDialogValue(); //$NON-NLS-1$
}
});
}
@@ -1108,85 +1074,91 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
}
private static boolean isIntegerType(String fqnType) {
- if ("java.lang.Integer".equals(fqnType)) {
+ if ("java.lang.Integer".equals(fqnType)) { //$NON-NLS-1$
return true;
- } else if ("java.lang.Long".equals(fqnType)) {
+ } else if ("java.lang.Long".equals(fqnType)) { //$NON-NLS-1$
return true;
- } else if ("java.lang.Short".equals(fqnType)) {
+ } else if ("java.lang.Short".equals(fqnType)) { //$NON-NLS-1$
return true;
- } else if ("java.lang.Byte".equals(fqnType)) {
+ } else if ("java.lang.Byte".equals(fqnType)) { //$NON-NLS-1$
return true;
}
return false;
}
private static boolean isDoubleType(String fqnType) {
- if ("java.lang.Float".equals(fqnType)) {
+ if ("java.lang.Float".equals(fqnType)) { //$NON-NLS-1$
return true;
- } else if ("java.lang.Double".equals(fqnType)) {
+ } else if ("java.lang.Double".equals(fqnType)) { //$NON-NLS-1$
return true;
}
return false;
}
- private IJavaProject findProject(ContentAssistRequest contentAssistRequest) {
+ private static IJavaProject findProject(ContentAssistRequest contentAssistRequest) {
Document xmlDoc = contentAssistRequest.getNode().getOwnerDocument();
return Util.findProject(xmlDoc);
}
- private IType findType(String name, ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
+ private static IType findType(String name, ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
return Util.findType(name, contentAssistRequest.getNode().getOwnerDocument());
}
- private List<String> getImportedTypes(ContentAssistRequest contentAssistRequest) {
+ static List<String> getImportedTypes(ContentAssistRequest contentAssistRequest) {
Document xmlDoc = contentAssistRequest.getNode().getOwnerDocument();
return Util.getImportedTypes(xmlDoc);
}
@Override
protected void addCommentProposal(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
+ //nothing
}
@Override
protected void addEmptyDocumentProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
+ //nothing
}
@Override
protected void addEndTagNameProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
+ //nothing
}
@Override
protected void addEndTagProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
+ //nothing
}
@Override
protected void addPCDATAProposal(String nodeName, ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
-
+ //nothing
}
@Override
protected void addTagCloseProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
+ //nothing
}
@Override
protected void addTagInsertionProposals(ContentAssistRequest contentAssistRequest, int childPosition, CompletionProposalInvocationContext context) {
+ //nothing
}
@Override
protected void addEntityProposals(ContentAssistRequest contentAssistRequest, ITextRegion completionRegion, IDOMNode treeNode, CompletionProposalInvocationContext context) {
-
+ //nothing
}
@Override
- protected void addEntityProposals(Vector proposals, Properties map, String key, int nodeOffset, IStructuredDocumentRegion sdRegion, ITextRegion completionRegion, CompletionProposalInvocationContext context) {
-
+ protected void addEntityProposals(@SuppressWarnings("rawtypes") Vector proposals, Properties map, String key, int nodeOffset, IStructuredDocumentRegion sdRegion, ITextRegion completionRegion, CompletionProposalInvocationContext context) {
+ //nothing
}
static abstract class Filter {
public abstract boolean select(String fqnName);
}
- public static class HoverImpl implements IEObjectHover, ITextHoverExtension {
+ static class HoverImpl implements IEObjectHover, ITextHoverExtension {
private JavadocHoverWrapper javadocWrapper = new JavadocHoverWrapper();
private IJavaElement currentElement;
@@ -1196,23 +1168,23 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
@Override
public IInformationControlCreator getHoverControlCreator() {
- javadocWrapper.setJavaElement(currentElement);
- return javadocWrapper.getHoverControlCreator();
+ this.javadocWrapper.setJavaElement(this.currentElement);
+ return this.javadocWrapper.getHoverControlCreator();
}
@Override
public Object getHoverInfo(EObject eObject, ITextViewer textViewer, IRegion hoverRegion) {
- javadocWrapper.setJavaElement(currentElement);
- return javadocWrapper.getHoverInfo2(textViewer, hoverRegion);
+ this.javadocWrapper.setJavaElement(this.currentElement);
+ return this.javadocWrapper.getHoverInfo2(textViewer, hoverRegion);
}
}
- public static class JavadocHoverWrapper extends JavadocHover {
+ static class JavadocHoverWrapper extends JavadocHover {
private IJavaElement currentElement;
public void setJavaElement(IJavaElement element) {
- currentElement = element;
+ this.currentElement = element;
}
@Override
@@ -1220,7 +1192,7 @@ public class FXMLCompletionProposalComputer extends AbstractXMLCompletionProposa
// hack: return previously registered element
// required as JavadocHover.getHoverInfo(IJavaElement[]
// elements,...) is private
- return new IJavaElement[] { currentElement };
+ return new IJavaElement[] { this.currentElement };
}
}
}
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLEditor.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLEditor.java
index 2d11880c5..f4a29ed9d 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLEditor.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLEditor.java
@@ -38,13 +38,17 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
+/**
+ * The FXML-Editor
+ */
public class FXMLEditor extends StructuredTextEditor implements IFXMLProviderAdapter {
- private static final String FX_NAMESPACE = "http://javafx.com/fxml";
+
@Override
public String getPreviewFXML() {
return getSourceViewer().getDocument().get();
}
+ @SuppressWarnings({ "deprecation", "restriction" })
@Override
public List<String> getPreviewCSSFiles() {
final IFile file = getFile();
@@ -52,8 +56,8 @@ public class FXMLEditor extends StructuredTextEditor implements IFXMLProviderAda
Properties propFile = getProperties();
if (propFile != null) {
- if (propFile.getProperty("fxmlpreview.all.stylesheets") != null) {
- for (String f : propFile.getProperty("fxmlpreview.all.stylesheets").split(",")) {
+ if (propFile.getProperty("fxmlpreview.all.stylesheets") != null) { //$NON-NLS-1$
+ for (String f : propFile.getProperty("fxmlpreview.all.stylesheets").split(",")) { //$NON-NLS-1$ //$NON-NLS-2$
File absFile = RelativeFileLocator.locateFile(file, f.trim());
if (absFile != null) {
try {
@@ -66,9 +70,9 @@ public class FXMLEditor extends StructuredTextEditor implements IFXMLProviderAda
}
}
- String fileConfig = "fxmlpreview.file." + file.getName().substring(0, file.getName().length() - 5);
- if (propFile.getProperty(fileConfig + ".stylesheets") != null) {
- for (String f : propFile.getProperty(fileConfig + ".stylesheets").split(",")) {
+ String fileConfig = "fxmlpreview.file." + file.getName().substring(0, file.getName().length() - 5); //$NON-NLS-1$
+ if (propFile.getProperty(fileConfig + ".stylesheets") != null) { //$NON-NLS-1$
+ for (String f : propFile.getProperty(fileConfig + ".stylesheets").split(",")) { //$NON-NLS-1$ //$NON-NLS-2$
File absFile = RelativeFileLocator.locateFile(file, f.trim());
if (absFile != null) {
try {
@@ -87,7 +91,7 @@ public class FXMLEditor extends StructuredTextEditor implements IFXMLProviderAda
p.parse(new InputSource(new StringReader(getModel().getStructuredDocument().get())), new DefaultHandler() {
@Override
public void processingInstruction(String target, String data) throws SAXException {
- if( "scenebuilder-stylesheet".equals(target) ) {
+ if( "scenebuilder-stylesheet".equals(target) ) { //$NON-NLS-1$
File absFile = RelativeFileLocator.locateFile(file, data);
if( absFile != null ) {
try {
@@ -114,6 +118,7 @@ public class FXMLEditor extends StructuredTextEditor implements IFXMLProviderAda
return cssFiles;
}
+ @SuppressWarnings({ "deprecation", "restriction" })
@Override
public String getPreviewResourceBundle() {
final IFile file = getFile();
@@ -124,7 +129,7 @@ public class FXMLEditor extends StructuredTextEditor implements IFXMLProviderAda
p.parse(new InputSource(new StringReader(getModel().getStructuredDocument().get())), new DefaultHandler() {
@Override
public void processingInstruction(String target, String data) throws SAXException {
- if( "scenebuilder-preview-i18n-resource".equals(target) ) {
+ if( "scenebuilder-preview-i18n-resource".equals(target) ) { //$NON-NLS-1$
File absFile = RelativeFileLocator.locateFile(file, data);
if( absFile != null && absFile.exists() ) {
ref.set(absFile.getAbsolutePath());
@@ -152,17 +157,17 @@ public class FXMLEditor extends StructuredTextEditor implements IFXMLProviderAda
if (propFile != null) {
- String fileConfig = "fxmlpreview.file." + file.getName().substring(0, file.getName().length() - 5);
+ String fileConfig = "fxmlpreview.file." + file.getName().substring(0, file.getName().length() - 5); //$NON-NLS-1$
- if (propFile.getProperty("fxmlpreview.all.messagefile") != null) {
- File f = RelativeFileLocator.locateFile(file, propFile.getProperty("fxmlpreview.all.messagefile"));
+ if (propFile.getProperty("fxmlpreview.all.messagefile") != null) { //$NON-NLS-1$
+ File f = RelativeFileLocator.locateFile(file, propFile.getProperty("fxmlpreview.all.messagefile")); //$NON-NLS-1$
if (f != null && f.exists()) {
return f.getAbsolutePath();
}
}
- if (propFile.getProperty(fileConfig + ".messagefile") != null) {
- File f = RelativeFileLocator.locateFile(file, propFile.getProperty(fileConfig + ".messagefile").trim());
+ if (propFile.getProperty(fileConfig + ".messagefile") != null) { //$NON-NLS-1$
+ File f = RelativeFileLocator.locateFile(file, propFile.getProperty(fileConfig + ".messagefile").trim()); //$NON-NLS-1$
if (f != null && f.exists()) {
return f.getAbsolutePath();
}
@@ -175,14 +180,11 @@ public class FXMLEditor extends StructuredTextEditor implements IFXMLProviderAda
private Properties getProperties() {
IFile file = getFile();
IProject project = file.getProject();
- IFile previewConfig = project.getFile(new Path("fxml-preview.properties"));
+ IFile previewConfig = project.getFile(new Path("fxml-preview.properties")); //$NON-NLS-1$
if (previewConfig.exists()) {
- InputStream stream = null;
-
Properties propFile = new Properties();
- try {
- stream = previewConfig.getContents(true);
+ try(InputStream stream = previewConfig.getContents(true) ) {
propFile.load(stream);
return propFile;
} catch (CoreException e) {
@@ -191,13 +193,6 @@ public class FXMLEditor extends StructuredTextEditor implements IFXMLProviderAda
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- }
- }
}
}
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLHyperlinkDetector.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLHyperlinkDetector.java
index 4ad246f46..4c18f0768 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLHyperlinkDetector.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLHyperlinkDetector.java
@@ -25,12 +25,12 @@ import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.w3c.dom.Node;
import org.w3c.dom.ProcessingInstruction;
+/**
+ * Detector for hyperlink areas in FXML-Documents
+ */
@SuppressWarnings("restriction")
public class FXMLHyperlinkDetector extends AbstractHyperlinkDetector {
- public FXMLHyperlinkDetector() {
- }
-
@Override
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion hoverRegion, boolean canShowMultipleHyperlinks) {
if ((hoverRegion == null) || (textViewer == null) || (textViewer.getDocument() == null)) {
@@ -68,7 +68,7 @@ public class FXMLHyperlinkDetector extends AbstractHyperlinkDetector {
IDOMNode dom = (IDOMNode)treeNode;
if( dom instanceof ProcessingInstruction ) {
String fqn = dom.getNodeValue();
- if( fqn.endsWith("?") ) {
+ if( fqn.endsWith("?") ) { //$NON-NLS-1$
fqn = fqn.substring(0,fqn.length()-1);
}
link = new FXMLJavaElementHyperLink(Util.findType(fqn, dom.getOwnerDocument()),new Region(flatNode.getStartOffset(region), region.getTextLength()), (IDOMNode)treeNode, regionType, documentOffset);
@@ -86,14 +86,14 @@ public class FXMLHyperlinkDetector extends AbstractHyperlinkDetector {
String value = dom.getNodeValue();
// Strip the ? it is part of the value
- if( value.endsWith("?") ) {
+ if( value.endsWith("?") ) { //$NON-NLS-1$
value = value.substring(0,value.length()-1);
}
- if( value.endsWith(".css") || value.endsWith(".properties") ) {
+ if( value.endsWith(".css") || value.endsWith(".properties") ) { //$NON-NLS-1$ //$NON-NLS-2$
link = new ResourceHyperLink(new Region(flatNode.getStartOffset(region), region.getTextLength()), (IDOMNode) treeNode, value);
} else {
- if(! value.endsWith("*") ) {
+ if(! value.endsWith("*") ) { //$NON-NLS-1$
link = new FXMLJavaElementHyperLink(Util.findType(value, dom.getOwnerDocument()),new Region(flatNode.getStartOffset(region), region.getTextLength()), (IDOMNode)treeNode, regionType, documentOffset);
}
}
@@ -121,7 +121,7 @@ public class FXMLHyperlinkDetector extends AbstractHyperlinkDetector {
@Override
public IRegion getHyperlinkRegion() {
- return region;
+ return this.region;
}
@Override
@@ -136,12 +136,12 @@ public class FXMLHyperlinkDetector extends AbstractHyperlinkDetector {
@Override
public void open() {
- String baseLocation = xmlnode.getModel().getBaseLocation();
+ String baseLocation = this.xmlnode.getModel().getBaseLocation();
IContainer c = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(baseLocation)).getParent();
- IFile f = c.getFile(new Path(resourceValue));
- if( resourceValue.endsWith(".css") ) {
+ IFile f = c.getFile(new Path(this.resourceValue));
+ if( this.resourceValue.endsWith(".css") ) { //$NON-NLS-1$
try {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput(f), "org.eclipse.fx.ide.css.CssDsl");
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput(f), "org.eclipse.fx.ide.css.CssDsl"); //$NON-NLS-1$
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -169,7 +169,7 @@ public class FXMLHyperlinkDetector extends AbstractHyperlinkDetector {
@Override
public IRegion getHyperlinkRegion() {
- return region;
+ return this.region;
}
@Override
@@ -186,14 +186,14 @@ public class FXMLHyperlinkDetector extends AbstractHyperlinkDetector {
public void open() {
IJavaElement element = this.element;
if( element == null ) {
- if (regionType == DOMRegionContext.XML_TAG_NAME) {
- element = FXMLTextHover.computeTagNameHelp(xmlnode);
+ if (this.regionType == DOMRegionContext.XML_TAG_NAME) {
+ element = FXMLTextHover.computeTagNameHelp(this.xmlnode);
}
- else if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
- element = FXMLTextHover.computeTagAttNameHelp(xmlnode, documentOffset);
+ else if (this.regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
+ element = FXMLTextHover.computeTagAttNameHelp(this.xmlnode, this.documentOffset);
}
- else if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
- element = FXMLTextHover.computeTagAttValueHelp(xmlnode, documentOffset);
+ else if (this.regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
+ element = FXMLTextHover.computeTagAttValueHelp(this.xmlnode, this.documentOffset);
}
}
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextHover.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextHover.java
index 5b6ed6758..e5b388995 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextHover.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextHover.java
@@ -47,6 +47,9 @@ import org.eclipse.fx.ide.model.IFXEnumProperty;
import org.eclipse.fx.ide.model.IFXEventHandlerProperty;
import org.eclipse.fx.ide.model.IFXProperty;
+/**
+ * Hover information provider
+ */
@SuppressWarnings("restriction")
public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHoverExtension2 {
private JavadocHoverWrapper javadocWrapper = new JavadocHoverWrapper();
@@ -69,35 +72,34 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
if (flatNode != null) {
region = flatNode.getRegionAtCharacterOffset(offset);
- }
-
-
- if (region != null) {
- // only supply hoverhelp for tag name, attribute name, or
- // attribute value
- String regionType = region.getType();
- if ((regionType == DOMRegionContext.XML_TAG_NAME) || (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) || (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) || (regionType == DOMRegionContext.XML_PI_CONTENT)) {
- try {
- // check if we are at whitespace before or after line
- IRegion line = textViewer.getDocument().getLineInformationOfOffset(offset);
- if ((offset > (line.getOffset())) && (offset < (line.getOffset() + line.getLength()))) {
- // check if we are in region's trailing whitespace
- // (whitespace after relevant info)
- if (offset < flatNode.getTextEndOffset(region)) {
- return new Region(flatNode.getStartOffset(region), region.getTextLength());
+ if (region != null) {
+ // only supply hoverhelp for tag name, attribute name, or
+ // attribute value
+ String regionType = region.getType();
+ if ((regionType == DOMRegionContext.XML_TAG_NAME) || (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) || (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) || (regionType == DOMRegionContext.XML_PI_CONTENT)) {
+ try {
+ // check if we are at whitespace before or after line
+ IRegion line = textViewer.getDocument().getLineInformationOfOffset(offset);
+ if ((offset > (line.getOffset())) && (offset < (line.getOffset() + line.getLength()))) {
+ // check if we are in region's trailing whitespace
+ // (whitespace after relevant info)
+ if (offset < flatNode.getTextEndOffset(region)) {
+ return new Region(flatNode.getStartOffset(region), region.getTextLength());
+ }
}
}
- }
- catch (BadLocationException e) {
- Logger.logException(e);
+ catch (BadLocationException e) {
+ Logger.logException(e);
+ }
}
}
}
+
return null;
}
- public static IJavaElement computeTagNameHelp(IDOMNode xmlnode) {
+ static IJavaElement computeTagNameHelp(IDOMNode xmlnode) {
if( Character.isLowerCase(xmlnode.getNodeName().charAt(0)) ) {
Node parent = xmlnode.getParentNode();
if( parent == null || parent.getNodeName() == null || parent.getOwnerDocument() == null) {
@@ -114,8 +116,8 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
}
}
} else {
- if( xmlnode.getNodeName().contains(".") ) {
- String[] parts = xmlnode.getNodeName().split("\\.");
+ if( xmlnode.getNodeName().contains(".") ) { //$NON-NLS-1$
+ String[] parts = xmlnode.getNodeName().split("\\."); //$NON-NLS-1$
IType ownerType = Util.findType(parts[0], xmlnode.getOwnerDocument());
if( ownerType != null ) {
IFXClass fxClass = FXPlugin.getClassmodel().findClass(ownerType.getJavaProject(), ownerType);
@@ -145,7 +147,7 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
return null;
}
- public static IJavaElement computeTagAttNameHelp(IDOMNode xmlnode,int offset) {
+ static IJavaElement computeTagAttNameHelp(IDOMNode xmlnode,int offset) {
NamedNodeMap m = xmlnode.getAttributes();
IDOMNode attribute = null;
if( m != null ) {
@@ -160,8 +162,8 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
if( attribute != null ) {
Node parent = xmlnode;
- if( attribute.getNodeName().contains(".") ) {
- String[] parts = attribute.getNodeName().split("\\.");
+ if( attribute.getNodeName().contains(".") ) { //$NON-NLS-1$
+ String[] parts = attribute.getNodeName().split("\\."); //$NON-NLS-1$
IType ownerType = Util.findType(parts[0], parent.getOwnerDocument());
if( ownerType != null ) {
IFXClass fxClass = FXPlugin.getClassmodel().findClass(ownerType.getJavaProject(), ownerType);
@@ -189,7 +191,7 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
return null;
}
- public static IJavaElement computeTagAttValueHelp(IDOMNode xmlnode, int offset) {
+ static IJavaElement computeTagAttValueHelp(IDOMNode xmlnode, int offset) {
NamedNodeMap m = xmlnode.getAttributes();
IDOMNode attribute = null;
if( m == null ) {
@@ -206,13 +208,13 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
Node parent = xmlnode;
IFXProperty p = null;
- if( "http://javafx.com/fxml".equals(attribute.getNamespaceURI()) ) {
+ if( "http://javafx.com/fxml".equals(attribute.getNamespaceURI()) ) { //$NON-NLS-1$
Document d = xmlnode.getOwnerDocument();
return Util.findType(attribute.getNodeValue(), d);
}
- if( attribute.getNodeName().contains(".") ) {
- String[] parts = attribute.getNodeName().split("\\.");
+ if( attribute.getNodeName().contains(".") ) { //$NON-NLS-1$
+ String[] parts = attribute.getNodeName().split("\\."); //$NON-NLS-1$
IType ownerType = Util.findType(parts[0], parent.getOwnerDocument());
if( ownerType != null ) {
IFXClass fxClass = FXPlugin.getClassmodel().findClass(ownerType.getJavaProject(), ownerType);
@@ -246,10 +248,10 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
// TODO Auto-generated catch block
e.printStackTrace();
}
- } else if( p instanceof IFXEventHandlerProperty && attribute.getNodeValue().startsWith("#") ) {
+ } else if( p instanceof IFXEventHandlerProperty && attribute.getNodeValue().startsWith("#") ) { //$NON-NLS-1$
Document d = xmlnode.getOwnerDocument();
Element e = d.getDocumentElement();
- Attr a = e.getAttributeNodeNS("http://javafx.com/fxml", "controller");
+ Attr a = e.getAttributeNodeNS("http://javafx.com/fxml", "controller"); //$NON-NLS-1$//$NON-NLS-2$
if (a != null) {
IType t = Util.findType(a.getValue(), d);
if( t != null ) {
@@ -269,9 +271,9 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
@Override
public IInformationControlCreator getHoverControlCreator() {
- if( element != null ) {
- javadocWrapper.setJavaElement(element);
- return javadocWrapper.getHoverControlCreator();
+ if( this.element != null ) {
+ this.javadocWrapper.setJavaElement(this.element);
+ return this.javadocWrapper.getHoverControlCreator();
}
return null;
}
@@ -282,7 +284,7 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
return null;
}
- element = null;
+ this.element = null;
int documentOffset = hoverRegion.getOffset();
@@ -302,40 +304,40 @@ public class FXMLTextHover implements ITextHover, ITextHoverExtension, ITextHove
if (region != null) {
String regionType = region.getType();
if (regionType == DOMRegionContext.XML_TAG_NAME) {
- element = computeTagNameHelp((IDOMNode) treeNode);
+ this.element = computeTagNameHelp((IDOMNode) treeNode);
}
else if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
IDOMNode dom = (IDOMNode)treeNode;
if( dom instanceof ProcessingInstruction ) {
String fqn = dom.getNodeValue();
- if( fqn.endsWith("?") ) {
+ if( fqn.endsWith("?") ) { //$NON-NLS-1$
fqn = fqn.substring(0,fqn.length()-1);
}
- element = Util.findType(fqn, dom.getOwnerDocument());
+ this.element = Util.findType(fqn, dom.getOwnerDocument());
} else {
- element = computeTagAttNameHelp((IDOMNode) treeNode, documentOffset);
+ this.element = computeTagAttNameHelp((IDOMNode) treeNode, documentOffset);
}
}
else if( regionType == DOMRegionContext.XML_PI_CONTENT) {
IDOMNode dom = (IDOMNode)treeNode;
String fqn = dom.getNodeValue();
- if( fqn.endsWith("?") ) {
+ if( fqn.endsWith("?") ) { //$NON-NLS-1$
fqn = fqn.substring(0,fqn.length()-1);
}
- if( !(fqn.endsWith(".css") || fqn.endsWith(".properties") || fqn.endsWith("*")) ) {
- element = Util.findType(fqn, dom.getOwnerDocument());
+ if( !(fqn.endsWith(".css") || fqn.endsWith(".properties") || fqn.endsWith("*")) ) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ this.element = Util.findType(fqn, dom.getOwnerDocument());
}
}
else if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
- element = computeTagAttValueHelp((IDOMNode) treeNode, documentOffset);
+ this.element = computeTagAttValueHelp((IDOMNode) treeNode, documentOffset);
}
}
}
- if( element != null ) {
- javadocWrapper.setJavaElement(element);
- return javadocWrapper.getHoverInfo2(textViewer, hoverRegion);
+ if( this.element != null ) {
+ this.javadocWrapper.setJavaElement(this.element);
+ return this.javadocWrapper.getHoverInfo2(textViewer, hoverRegion);
}
return null;
}
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextViewerConfiguration.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextViewerConfiguration.java
index 22fbd7ac8..f13fa8906 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextViewerConfiguration.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLTextViewerConfiguration.java
@@ -14,15 +14,14 @@ import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;
+/**
+ * TextViewer configuration
+ */
public class FXMLTextViewerConfiguration extends StructuredTextViewerConfigurationXML {
- public FXMLTextViewerConfiguration() {
- }
-
@Override
protected IContentAssistProcessor[] getContentAssistProcessors(
ISourceViewer sourceViewer, String partitionType) {
- // TODO Auto-generated method stub
return super.getContentAssistProcessors(sourceViewer, partitionType);
}
}
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidationMessage.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidationMessage.java
index cf672ddfa..d5db35bdd 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidationMessage.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidationMessage.java
@@ -12,9 +12,17 @@ package org.eclipse.fx.ide.fxml.editors;
import org.eclipse.wst.validation.internal.core.Message;
+/**
+ * Validation message
+ */
@SuppressWarnings("restriction")
public class FXMLValidationMessage extends Message {
+ /**
+ * @param severity
+ * @param messageKey
+ * @param aParams
+ */
public FXMLValidationMessage(int severity, String messageKey, String... aParams) {
- super("org.eclipse.fx.ide.fxml.editors.messages", severity, messageKey, aParams);
+ super("org.eclipse.fx.ide.fxml.editors.messages", severity, messageKey, aParams); //$NON-NLS-1$
}
} \ No newline at end of file
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidator.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidator.java
index 600af7379..17c563fbb 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidator.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/FXMLValidator.java
@@ -58,7 +58,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-
import org.eclipse.fx.ide.model.FXPlugin;
import org.eclipse.fx.ide.model.IFXClass;
import org.eclipse.fx.ide.model.IFXCtrlClass;
@@ -68,6 +67,9 @@ import org.eclipse.fx.ide.model.IFXEventHandlerProperty;
import org.eclipse.fx.ide.model.IFXProperty;
import org.eclipse.fx.ide.ui.util.IconKeys;
+/**
+ * Validates the FXML-Document and provides quick fixes
+ */
@SuppressWarnings("restriction")
public class FXMLValidator extends AbstractValidator implements IValidator, ISourceValidator {
private IDocument document;
@@ -106,13 +108,13 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
// remove old messages
reporter.removeAllMessages(this);
- IStructuredDocumentRegion[] regions = ((IStructuredDocument) document).getStructuredDocumentRegions(dirtyRegion.getOffset(), dirtyRegion.getLength());
+ IStructuredDocumentRegion[] regions = ((IStructuredDocument) this.document).getStructuredDocumentRegions(dirtyRegion.getOffset(), dirtyRegion.getLength());
for (int i = 0; i < regions.length; i++) {
validate(regions[i], reporter);
}
}
- public void validate(IStructuredDocumentRegion structuredDocumentRegion, IReporter reporter) {
+ private void validate(IStructuredDocumentRegion structuredDocumentRegion, IReporter reporter) {
if (structuredDocumentRegion == null) {
return;
}
@@ -132,7 +134,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
for (int i = 0; i < textRegions.size(); i++) {
ITextRegion textRegion = textRegions.get(i);
if (textRegion.getType() == DOMRegionContext.XML_TAG_OPEN) {
- IndexedRegion treeNode = getNode(document, structuredDocumentRegion.getStartOffset(textRegion));
+ IndexedRegion treeNode = getNode(this.document, structuredDocumentRegion.getStartOffset(textRegion));
if (treeNode == null) {
return;
}
@@ -154,7 +156,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
Map<String, IFXProperty> props = e.getAllProperties();
for (int j = 0; j < nnm.getLength(); j++) {
Node attribute = nnm.item(j);
- if (attribute.getNodeName().equals("fx:id")) {
+ if (attribute.getNodeName().equals("fx:id")) { //$NON-NLS-1$
IFXCtrlField f = fxCtrl.getAllFields().get(attribute.getNodeValue());
IType type = e.getType();
@@ -163,7 +165,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
IType fromType = Util.findType(node.getLocalName(), node.getOwnerDocument());
if( fromType != null && toType != null ) {
if( ! org.eclipse.fx.ide.model.Util.assignable(fromType, toType) ) {
- FXMLValidationMessage message = new FXMLValidationMessage(IMessage.ERROR_AND_WARNING, "FXMLValidator.incompatibleFieldTypes", fromType.getElementName(), toType.getElementName());
+ FXMLValidationMessage message = new FXMLValidationMessage(IMessage.ERROR_AND_WARNING, "FXMLValidator.incompatibleFieldTypes", fromType.getElementName(), toType.getElementName()); //$NON-NLS-1$
IDOMAttr domAttr = (IDOMAttr) attribute;
message.setLength(getAttributeLength(structuredDocumentRegion, domAttr));
message.setOffset(domAttr.getStartOffset());
@@ -172,7 +174,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
}
} else {
String fielname = attribute.getNodeValue();
- FXMLValidationMessage message = new FXMLValidationMessage(IMessage.ERROR_AND_WARNING, "FXMLValidator.unknownControllerField", fxCtrl.getSimpleName(), fielname);
+ FXMLValidationMessage message = new FXMLValidationMessage(IMessage.ERROR_AND_WARNING, "FXMLValidator.unknownControllerField", fxCtrl.getSimpleName(), fielname); //$NON-NLS-1$
IDOMAttr domAttr = (IDOMAttr) attribute;
message.setLength(getAttributeLength(structuredDocumentRegion, domAttr));
message.setOffset(domAttr.getStartOffset());
@@ -187,7 +189,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
IFXCtrlEventMethod evtMethod = fxCtrl.getAllEventMethods().get(attribute.getNodeValue().substring(1));
if (evtMethod == null) {
String methodName = nnm.item(j).getNodeValue().substring(1);
- FXMLValidationMessage message = new FXMLValidationMessage(IMessage.HIGH_SEVERITY, "FXMLValidator.unknownControllerMethod", fxCtrl.getSimpleName(), methodName);
+ FXMLValidationMessage message = new FXMLValidationMessage(IMessage.HIGH_SEVERITY, "FXMLValidator.unknownControllerMethod", fxCtrl.getSimpleName(), methodName); //$NON-NLS-1$
IDOMAttr domAttr = (IDOMAttr) attribute;
message.setLength(getAttributeLength(structuredDocumentRegion, domAttr));
@@ -206,16 +208,17 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
}
}
- private int getAttributeLength(IStructuredDocumentRegion structuredDocumentRegion, IDOMAttr domAttr) {
+ @SuppressWarnings("deprecation")
+ private static int getAttributeLength(IStructuredDocumentRegion structuredDocumentRegion, IDOMAttr domAttr) {
int l = domAttr.getValueRegionStartOffset() - domAttr.getStartOffset();
l += structuredDocumentRegion.getText(domAttr.getValueRegion()).length();
- return l; // domAttr.getLength() too long
+ return l; // domAttr.getLength() too long
}
- private IFXCtrlClass getController(IDOMNode node) {
+ private static IFXCtrlClass getController(IDOMNode node) {
Document d = node.getOwnerDocument();
Element docEl = d.getDocumentElement();
- Attr a = docEl.getAttributeNodeNS("http://javafx.com/fxml", "controller");
+ Attr a = docEl.getAttributeNodeNS("http://javafx.com/fxml", "controller"); //$NON-NLS-1$//$NON-NLS-2$
if (a != null && a.getValue() != null && !a.getValue().trim().isEmpty()) {
IType type = Util.findType(a.getValue(), d);
@@ -227,10 +230,10 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
return null;
}
- private IFXClass computeTagNameHelp(IDOMNode xmlnode) {
+ private static IFXClass computeTagNameHelp(IDOMNode xmlnode) {
if (!Character.isLowerCase(xmlnode.getNodeName().charAt(0))) {
- if (xmlnode.getNodeName().contains(".")) {
- String[] parts = xmlnode.getNodeName().split("\\.");
+ if (xmlnode.getNodeName().contains(".")) { //$NON-NLS-1$
+ String[] parts = xmlnode.getNodeName().split("\\."); //$NON-NLS-1$
IType ownerType = Util.findType(parts[0], xmlnode.getOwnerDocument());
if (ownerType != null) {
return FXPlugin.getClassmodel().findClass(ownerType.getJavaProject(), ownerType);
@@ -247,7 +250,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
return null;
}
- private IndexedRegion getNode(IDocument document, int documentOffset) {
+ private static IndexedRegion getNode(IDocument document, int documentOffset) {
IndexedRegion node = null;
IModelManager mm = StructuredModelManager.getModelManager();
IStructuredModel model = null;
@@ -269,7 +272,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
return node;
}
- private boolean isStartTag(IStructuredDocumentRegion structuredDocumentRegion) {
+ private static boolean isStartTag(IStructuredDocumentRegion structuredDocumentRegion) {
if ((structuredDocumentRegion == null) || structuredDocumentRegion.isDeleted()) {
return false;
}
@@ -278,7 +281,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
@Override
public void cleanup(IReporter reporter) {
- document = null;
+ this.document = null;
}
private boolean shouldValidate(IResource file, boolean checkExtension) {
@@ -286,7 +289,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
return false;
if (checkExtension) {
String extension = file.getFileExtension();
- if (extension != null && "xml".endsWith(extension.toLowerCase(Locale.US)))
+ if (extension != null && "xml".endsWith(extension.toLowerCase(Locale.US))) //$NON-NLS-1$
return true;
}
@@ -295,7 +298,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
contentDescription = ((IFile) file).getContentDescription();
if (contentDescription != null) {
IContentType contentType = contentDescription.getContentType();
- return contentDescription != null && contentType.isKindOf(getXMLContentType());
+ return contentType.isKindOf(getXMLContentType());
}
} catch (CoreException e) {
Logger.logException(e);
@@ -304,10 +307,10 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
}
private IContentType getXMLContentType() {
- if (fRootContentType == null) {
- fRootContentType = Platform.getContentTypeManager().getContentType("org.eclipse.core.runtime.xml");
+ if (this.fRootContentType == null) {
+ this.fRootContentType = Platform.getContentTypeManager().getContentType("org.eclipse.core.runtime.xml"); //$NON-NLS-1$
}
- return fRootContentType;
+ return this.fRootContentType;
}
@Override
@@ -334,10 +337,10 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
validateV1Project(helper, reporter);
}
- private boolean shouldValidate(IResourceProxy proxy) {
+ boolean shouldValidate(IResourceProxy proxy) {
if (proxy.getType() == IResource.FILE) {
String name = proxy.getName();
- if (name.toLowerCase(Locale.US).endsWith(".fxml")) {
+ if (name.toLowerCase(Locale.US).endsWith(".fxml")) { //$NON-NLS-1$
return true;
}
}
@@ -349,6 +352,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
if (helper instanceof IWorkbenchContext) {
IProject project = ((IWorkbenchContext) helper).getProject();
IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
+ @Override
public boolean visit(IResourceProxy proxy) throws CoreException {
if (shouldValidate(proxy)) {
validateV1File((IFile) proxy.requestResource(), reporter);
@@ -365,7 +369,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
}
}
- private void validateV1File(IFile currentFile, IReporter reporter) {
+ void validateV1File(IFile currentFile, IReporter reporter) {
Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, currentFile.getFullPath().toString().substring(1));
reporter.displaySubtask(FXMLValidator.this, message);
@@ -393,9 +397,9 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
}
static class UnknownControllerFieldQuickAssist implements IQuickAssistProcessor {
- private final String fieldName;
- private final IType fieldType;
- private final IFXCtrlClass controller;
+ final String fieldName;
+ final IType fieldType;
+ final IFXCtrlClass controller;
public UnknownControllerFieldQuickAssist(final String fieldName, final IType fieldType, final IFXCtrlClass controller) {
this.fieldName = fieldName;
@@ -421,25 +425,25 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
@Override
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {
return new ICompletionProposal[] {
- new BaseCompletionProposalImpl("Add field '"+fieldName+"' to controller '"+controller.getSimpleName()+"'",null,invocationContext.getOffset(),0) {
+ new BaseCompletionProposalImpl("Add field '"+this.fieldName+"' to controller '"+this.controller.getSimpleName()+"'",null,invocationContext.getOffset(),0) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@Override
public void apply(IDocument document) {
try {
- IType type = controller.getType();
- String[][] resolvedType = type.resolveType("FXML");
+ IType type = UnknownControllerFieldQuickAssist.this.controller.getType();
+ String[][] resolvedType = type.resolveType("FXML"); //$NON-NLS-1$
if( resolvedType == null ) {
- type.getCompilationUnit().createImport("javafx.fxml.FXML", null, new NullProgressMonitor());
+ type.getCompilationUnit().createImport("javafx.fxml.FXML", null, new NullProgressMonitor()); //$NON-NLS-1$
}
- resolvedType = type.resolveType(Signature.getSimpleName(fieldType.getElementName()));
+ resolvedType = type.resolveType(Signature.getSimpleName(UnknownControllerFieldQuickAssist.this.fieldType.getElementName()));
if( resolvedType == null ) {
- type.getCompilationUnit().createImport(fieldType.getFullyQualifiedName(), null, new NullProgressMonitor());
+ type.getCompilationUnit().createImport(UnknownControllerFieldQuickAssist.this.fieldType.getFullyQualifiedName(), null, new NullProgressMonitor());
}
- type.createField("@FXML " + Signature.getSimpleName(fieldType.getElementName()) + " " + fieldName + ";", null, true, new NullProgressMonitor());
+ type.createField("@FXML " + Signature.getSimpleName(UnknownControllerFieldQuickAssist.this.fieldType.getElementName()) + " " + UnknownControllerFieldQuickAssist.this.fieldName + ";", null, true, new NullProgressMonitor()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} catch (JavaModelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -451,9 +455,9 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
}
static class UnknownControllerEventMethodQuickFixAssist implements IQuickAssistProcessor {
- private final String methodName;
- private final IFXCtrlClass controller;
- private final IFXEventHandlerProperty property;
+ final String methodName;
+ final IFXCtrlClass controller;
+ final IFXEventHandlerProperty property;
public UnknownControllerEventMethodQuickFixAssist(final String methodName, final IFXCtrlClass controller, final IFXEventHandlerProperty property) {
this.methodName = methodName;
@@ -463,7 +467,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
@Override
public String getErrorMessage() {
- return "THIS IS THE ERROR MESSAGE";
+ return "THIS IS THE ERROR MESSAGE"; //$NON-NLS-1$
}
@Override
@@ -478,19 +482,19 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
@Override
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {
- return new ICompletionProposal[] { new BaseCompletionProposalImpl("Add '" + methodName + "()' to controller '" + controller.getSimpleName() + "'", IconKeys.getIcon(IconKeys.EVENT_KEY), invocationContext.getOffset(), 0) {
+ return new ICompletionProposal[] { new BaseCompletionProposalImpl("Add '" + this.methodName + "()' to controller '" + this.controller.getSimpleName() + "'", IconKeys.getIcon(IconKeys.EVENT_KEY), invocationContext.getOffset(), 0) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@Override
public void apply(IDocument document) {
try {
- IType type = controller.getType();
+ IType type = UnknownControllerEventMethodQuickFixAssist.this.controller.getType();
- String[][] resolvedType = type.resolveType("FXML");
+ String[][] resolvedType = type.resolveType("FXML"); //$NON-NLS-1$
if (resolvedType == null) {
- type.getCompilationUnit().createImport("javafx.fxml.FXML", null, new NullProgressMonitor());
+ type.getCompilationUnit().createImport("javafx.fxml.FXML", null, new NullProgressMonitor()); //$NON-NLS-1$
}
- type.createMethod("@FXML public void " + methodName + "() {}", null, true, new NullProgressMonitor());
+ type.createMethod("@FXML public void " + UnknownControllerEventMethodQuickFixAssist.this.methodName + "() {}", null, true, new NullProgressMonitor()); //$NON-NLS-1$ //$NON-NLS-2$
} catch (JavaModelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -498,30 +502,30 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
// Retrigger validation
try {
- document.replace(0, 0, "");
+ document.replace(0, 0, ""); //$NON-NLS-1$
} catch (BadLocationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
- }, new BaseCompletionProposalImpl("Add '" + methodName + "(" + property.getEventTypeAsString(false) + ")' to controller '" + controller.getSimpleName() + "'", IconKeys.getIcon(IconKeys.EVENT_KEY), invocationContext.getOffset(), invocationContext.getLength()) {
+ }, new BaseCompletionProposalImpl("Add '" + this.methodName + "(" + this.property.getEventTypeAsString(false) + ")' to controller '" + this.controller.getSimpleName() + "'", IconKeys.getIcon(IconKeys.EVENT_KEY), invocationContext.getOffset(), invocationContext.getLength()) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@Override
public void apply(IDocument document) {
try {
- IType type = controller.getType();
- String[][] resolvedType = type.resolveType("FXML");
+ IType type = UnknownControllerEventMethodQuickFixAssist.this.controller.getType();
+ String[][] resolvedType = type.resolveType("FXML"); //$NON-NLS-1$
if (resolvedType == null) {
- type.getCompilationUnit().createImport("javafx.fxml.FXML", null, new NullProgressMonitor());
+ type.getCompilationUnit().createImport("javafx.fxml.FXML", null, new NullProgressMonitor()); //$NON-NLS-1$
}
- resolvedType = type.resolveType(property.getEventTypeAsString(false));
+ resolvedType = type.resolveType(UnknownControllerEventMethodQuickFixAssist.this.property.getEventTypeAsString(false));
if (resolvedType == null) {
- type.getCompilationUnit().createImport(property.getEventTypeAsString(true), null, new NullProgressMonitor());
+ type.getCompilationUnit().createImport(UnknownControllerEventMethodQuickFixAssist.this.property.getEventTypeAsString(true), null, new NullProgressMonitor());
}
- type.createMethod("@FXML public void " + methodName + "(" + property.getEventTypeAsString(false) + " event) {}", null, true, new NullProgressMonitor());
+ type.createMethod("@FXML public void " + UnknownControllerEventMethodQuickFixAssist.this.methodName + "(" + UnknownControllerEventMethodQuickFixAssist.this.property.getEventTypeAsString(false) + " event) {}", null, true, new NullProgressMonitor()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} catch (JavaModelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -529,7 +533,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
// Retrigger validation
try {
- document.replace(0, 0, "");
+ document.replace(0, 0, ""); //$NON-NLS-1$
} catch (BadLocationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
@@ -554,7 +558,7 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
@Override
public Point getSelection(IDocument document) {
- return new Point(replacementOffset + cursorPosition, 0);
+ return new Point(this.replacementOffset + this.cursorPosition, 0);
}
@Override
@@ -564,12 +568,12 @@ public class FXMLValidator extends AbstractValidator implements IValidator, ISou
@Override
public String getDisplayString() {
- return label;
+ return this.label;
}
@Override
public Image getImage() {
- return image;
+ return this.image;
}
@Override
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/Util.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/Util.java
index 7deb3894f..651f6aeb7 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/Util.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/editors/Util.java
@@ -26,14 +26,24 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.ProcessingInstruction;
+/**
+ * Utility methods
+ */
@SuppressWarnings("restriction")
public class Util {
- public static IJavaProject findProject(Document xmlDoc) {
+ static IJavaProject findProject(Document xmlDoc) {
String baseLocation = ((IDOMNode) xmlDoc).getModel().getBaseLocation();
IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(baseLocation));
return JavaCore.create(f.getProject());
}
-
+
+ /**
+ * Get all imported types
+ *
+ * @param xmlDoc
+ * the document
+ * @return list of imports
+ */
public static List<String> getImportedTypes(Document xmlDoc) {
NodeList list = xmlDoc.getChildNodes();
@@ -42,7 +52,7 @@ public class Util {
Node n = list.item(i);
if (n.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
String data = ((ProcessingInstruction) n).getData();
- if (data.endsWith("?")) {
+ if (data.endsWith("?")) { //$NON-NLS-1$
data = data.substring(0, data.length() - 1);
}
imports.add(data);
@@ -50,11 +60,11 @@ public class Util {
}
return imports;
}
-
- public static IType findType(String name, Document xmlDoc) {
+
+ static IType findType(String name, Document xmlDoc) {
IJavaProject jpProject = findProject(xmlDoc);
-
- if( name.contains(".") ) {
+
+ if (name.contains(".")) { //$NON-NLS-1$
try {
IType t = jpProject.findType(name);
if (t != null) {
@@ -64,12 +74,12 @@ public class Util {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
}
List<String> imports = getImportedTypes(xmlDoc);
for (String i : imports) {
- if (i.endsWith("." + name)) {
+ if (i.endsWith("." + name)) { //$NON-NLS-1$
try {
IType t = jpProject.findType(i);
if (t != null) {
@@ -83,7 +93,7 @@ public class Util {
}
for (String i : imports) {
- if (i.endsWith("*")) {
+ if (i.endsWith("*")) { //$NON-NLS-1$
try {
IType t = jpProject.findType(i.substring(0, i.length() - 1) + name);
if (t != null) {
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/refactoring/RenameJFXControllerParticipant.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/refactoring/RenameJFXControllerParticipant.java
index 31196fb26..0d979876a 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/refactoring/RenameJFXControllerParticipant.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/refactoring/RenameJFXControllerParticipant.java
@@ -43,7 +43,6 @@ import org.eclipse.search.core.text.TextSearchEngine;
import org.eclipse.search.core.text.TextSearchMatchAccess;
import org.eclipse.search.core.text.TextSearchRequestor;
import org.eclipse.search.ui.text.FileTextSearchScope;
-import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.text.edits.TextEditGroup;
@@ -70,9 +69,9 @@ public class RenameJFXControllerParticipant extends RenameParticipant {
@Override
protected boolean initialize(Object element) {
if (element instanceof ICompilationUnit) {
- renamedElement = (ICompilationUnit) element;
+ this.renamedElement = (ICompilationUnit) element;
try {
- for (IJavaElement e : renamedElement.getChildren()) {
+ for (IJavaElement e : this.renamedElement.getChildren()) {
if (e instanceof IType) {
// check fields
for (IField m : ((IType) e).getFields()) {
@@ -107,8 +106,8 @@ public class RenameJFXControllerParticipant extends RenameParticipant {
* @param an
* an annotation
*/
- private boolean isFxmlAnnotation(IAnnotation a) {
- if ("FXML".equals(a.getElementName())) {
+ private static boolean isFxmlAnnotation(IAnnotation a) {
+ if ("FXML".equals(a.getElementName())) { //$NON-NLS-1$
return true;
} else {
return false;
@@ -153,28 +152,28 @@ public class RenameJFXControllerParticipant extends RenameParticipant {
OperationCanceledException {
final HashMap<Object, Change> changes = new HashMap<Object, Change>();
- if (renamedElement != null) {
- String fullname = renamedElement.getElementName();
- String extension = "."
- + renamedElement.getCorrespondingResource()
+ if (this.renamedElement != null) {
+ String fullname = this.renamedElement.getElementName();
+ String extension = "." //$NON-NLS-1$
+ + this.renamedElement.getCorrespondingResource()
.getFileExtension();
String controllerClassName = fullname.substring(0,
fullname.length() - extension.length());
- IResource[] roots = renamedElement.getCorrespondingResource()
+ IResource[] roots = this.renamedElement.getCorrespondingResource()
.getWorkspace().getRoot().getProjects();
- String pack = "";
- if (renamedElement.getPackageDeclarations().length > 0) {
- pack = renamedElement.getPackageDeclarations()[0]
- .getElementName() + ".";
+ String pack = ""; //$NON-NLS-1$
+ if (this.renamedElement.getPackageDeclarations().length > 0) {
+ pack = this.renamedElement.getPackageDeclarations()[0]
+ .getElementName() + "."; //$NON-NLS-1$
}
final String oldFullyQualifiedName = pack + controllerClassName;
final String newFullyQualifiedName = pack
- + getArguments().getNewName().replace(".java", "");
+ + getArguments().getNewName().replace(".java", ""); //$NON-NLS-1$ //$NON-NLS-2$
createChangesForFullyQualifiedOccurrences(pm, changes, roots,
oldFullyQualifiedName, newFullyQualifiedName);
createChangesForNotFullyQualifiedOccurrences(pm, changes, roots,
pack, controllerClassName, getArguments().getNewName()
- .replace(".java", ""));
+ .replace(".java", "")); //$NON-NLS-1$ //$NON-NLS-2$
}
if (changes.isEmpty()) {
return null;
@@ -197,7 +196,7 @@ public class RenameJFXControllerParticipant extends RenameParticipant {
final HashMap<Object, Change> changes, IResource[] roots,
final String oldFullyQualifiedName,
final String newFullyQualifiedName) {
- String[] fileNamePatterns = { "*.fxml", "*.fxgraph" }; //$NON-NLS-1$
+ String[] fileNamePatterns = { "*.fxml", "*.fxgraph" }; //$NON-NLS-1$ //$NON-NLS-2$
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(roots,
fileNamePatterns, false);
@@ -247,7 +246,7 @@ public class RenameJFXControllerParticipant extends RenameParticipant {
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(roots,
fileNamePatterns, false);
- Pattern pattern = Pattern.compile("\"" + oldName + "\"");
+ Pattern pattern = Pattern.compile("\"" + oldName + "\""); //$NON-NLS-1$ //$NON-NLS-2$
TextSearchRequestor collector = new TextSearchRequestor() {
@Override
@@ -264,7 +263,7 @@ public class RenameJFXControllerParticipant extends RenameParticipant {
List<String> l = Util.getImportedTypes(doc);
for (String imp : l) {
- if (imp.startsWith(pack + "*")
+ if (imp.startsWith(pack + "*") //$NON-NLS-1$
|| imp.startsWith(pack + oldName)) {
found = true;
break;
@@ -295,7 +294,7 @@ public class RenameJFXControllerParticipant extends RenameParticipant {
changes.put(file, change);
}
- int index = content.indexOf("\"" + oldName + "\"");
+ int index = content.indexOf("\"" + oldName + "\""); //$NON-NLS-1$ //$NON-NLS-2$
if (index >= 0) {
ReplaceEdit edit = new ReplaceEdit(index + 1,
oldName.length(), newName);
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/FXMLWizardPage.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/FXMLWizardPage.java
index 51b3e98cb..292dabd2d 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/FXMLWizardPage.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/FXMLWizardPage.java
@@ -48,33 +48,36 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
-
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.fx.ide.ui.wizards.AbstractJDTElementPage;
+/**
+ * Page to create FXML
+ */
public class FXMLWizardPage extends AbstractJDTElementPage<FXMLElement> {
- private IType customSelection;
+ IType customSelection;
protected FXMLWizardPage(IPackageFragmentRoot froot, IPackageFragment fragment, IWorkspaceRoot fWorkspaceRoot) {
- super("fxml", "FXML File", "Create a new FXML File", froot, fragment, fWorkspaceRoot);
+ super("fxml", Messages.FXMLWizardPage_1, Messages.FXMLWizardPage_0, froot, fragment, fWorkspaceRoot); //$NON-NLS-1$
}
@Override
protected ImageDescriptor getTitleAreaImage(Display display) {
- return Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/title_banner.png");
+ return AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/title_banner.png"); //$NON-NLS-1$
}
@Override
protected void createFields(Composite parent, DataBindingContext dbc) {
{
Label l = new Label(parent, SWT.NONE);
- l.setText("Root Element");
+ l.setText(Messages.FXMLWizardPage_4);
final ComboViewer viewer = new ComboViewer(parent);
viewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
IType t = (IType)element;
- return t.getElementName() + " - " + t.getPackageFragment().getElementName();
+ return t.getElementName() + " - " + t.getPackageFragment().getElementName(); //$NON-NLS-1$
}
});
viewer.setContentProvider(new ArrayContentProvider());
@@ -83,13 +86,13 @@ public class FXMLWizardPage extends AbstractJDTElementPage<FXMLElement> {
viewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Button button = new Button(parent, SWT.PUSH);
- button.setText("Browse ...");
+ button.setText(Messages.FXMLWizardPage_6);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IType type = findContainerType();
if( type != null ) {
- customSelection = type;
+ FXMLWizardPage.this.customSelection = type;
viewer.setInput(getTypes());
viewer.setSelection(new StructuredSelection(type));
}
@@ -101,12 +104,12 @@ public class FXMLWizardPage extends AbstractJDTElementPage<FXMLElement> {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- if( "fragmentRoot".equals(evt.getPropertyName()) ) {
+ if( "fragmentRoot".equals(evt.getPropertyName()) ) { //$NON-NLS-1$
viewer.setInput(getTypes());
}
}
});
- dbc.bindValue(ViewerProperties.singleSelection().observe(viewer), BeanProperties.value("rootElement").observe(getClazz()));
+ dbc.bindValue(ViewerProperties.singleSelection().observe(viewer), BeanProperties.value("rootElement").observe(getClazz())); //$NON-NLS-1$
if( types.size() > 0 ) {
viewer.setSelection(new StructuredSelection(types.get(0)));
@@ -115,10 +118,10 @@ public class FXMLWizardPage extends AbstractJDTElementPage<FXMLElement> {
{
Label l = new Label(parent, SWT.NONE);
- l.setText("Dynamic Root (fx:root)");
+ l.setText(Messages.FXMLWizardPage_9);
Button b = new Button(parent, SWT.CHECK);
- dbc.bindValue(WidgetProperties.selection().observe(b), BeanProperties.value("fxRoot").observe(getClazz()));
+ dbc.bindValue(WidgetProperties.selection().observe(b), BeanProperties.value("fxRoot").observe(getClazz())); //$NON-NLS-1$
}
}
@@ -127,13 +130,13 @@ public class FXMLWizardPage extends AbstractJDTElementPage<FXMLElement> {
IJavaProject project= getClazz().getFragmentRoot().getJavaProject();
try {
- IType superType = project.findType("javafx.scene.Parent");
+ IType superType = project.findType("javafx.scene.Parent"); //$NON-NLS-1$
if( superType != null ) {
IJavaSearchScope searchScope = SearchEngine.createStrictHierarchyScope(project, superType, true, false, null);
- SelectionDialog dialog = JavaUI.createTypeDialog(getShell(), PlatformUI.getWorkbench().getProgressService(), searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "");
- dialog.setTitle("Find Preloader");
+ SelectionDialog dialog = JavaUI.createTypeDialog(getShell(), PlatformUI.getWorkbench().getProgressService(), searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, ""); //$NON-NLS-1$
+ dialog.setTitle(Messages.FXMLWizardPage_3);
if (dialog.open() == Window.OK) {
IType type = (IType) dialog.getResult()[0];
return type;
@@ -148,28 +151,29 @@ public class FXMLWizardPage extends AbstractJDTElementPage<FXMLElement> {
return null;
}
+ @Override
protected void revalidate() {
if( getClazz().getName() == null || getClazz().getName().trim().length() == 0 ) {
setPageComplete(false);
- setMessage("Enter a name", IMessageProvider.ERROR);
+ setMessage(Messages.FXMLWizardPage_2, IMessageProvider.ERROR);
} else if(Character.isLowerCase(getClazz().getName().charAt(0))) {
setPageComplete(true);
- setMessage("An FXML file should start with an uppercase", IMessageProvider.WARNING);
+ setMessage(Messages.FXMLWizardPage_5, IMessageProvider.WARNING);
} else {
setPageComplete(true);
setMessage(null);
}
}
- private List<IType> getTypes() {
+ List<IType> getTypes() {
List<IType> list = new ArrayList<IType>();
if( getClazz().getFragmentRoot() != null ) {
IJavaProject jp = getClazz().getFragmentRoot().getJavaProject();
- if( customSelection != null ) {
+ if( this.customSelection != null ) {
try {
- IType t = jp.findType(customSelection.getFullyQualifiedName());
+ IType t = jp.findType(this.customSelection.getFullyQualifiedName());
if( t != null && ! list.contains(t) ) {
list.add(t);
}
@@ -196,16 +200,16 @@ public class FXMLWizardPage extends AbstractJDTElementPage<FXMLElement> {
}
for(String s : new String[] {
- "javafx.scene.layout.AnchorPane",
- "javafx.scene.layout.BorderPane",
- "javafx.scene.layout.FlowPane",
- "javafx.scene.layout.GridPane",
- "javafx.scene.layout.HBox",
- "javafx.scene.layout.Region",
- "javafx.scene.layout.StackPane",
- "javafx.scene.layout.TilePane",
- "javafx.scene.layout.VBox",
- "javafx.scene.Scene"
+ "javafx.scene.layout.AnchorPane", //$NON-NLS-1$
+ "javafx.scene.layout.BorderPane", //$NON-NLS-1$
+ "javafx.scene.layout.FlowPane", //$NON-NLS-1$
+ "javafx.scene.layout.GridPane", //$NON-NLS-1$
+ "javafx.scene.layout.HBox", //$NON-NLS-1$
+ "javafx.scene.layout.Region", //$NON-NLS-1$
+ "javafx.scene.layout.StackPane", //$NON-NLS-1$
+ "javafx.scene.layout.TilePane", //$NON-NLS-1$
+ "javafx.scene.layout.VBox", //$NON-NLS-1$
+ "javafx.scene.Scene" //$NON-NLS-1$
}) {
try {
IType t = jp.findType(s);
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/Messages.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/Messages.java
new file mode 100644
index 000000000..b207d1464
--- /dev/null
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/Messages.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BestSolution.at 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:
+ * Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.ide.fxml.wizards;
+
+import org.eclipse.osgi.util.NLS;
+
+@SuppressWarnings("javadoc")
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.fx.ide.fxml.wizards.messages"; //$NON-NLS-1$
+
+ public static String FXMLWizardPage_0;
+ public static String FXMLWizardPage_1;
+ public static String FXMLWizardPage_2;
+ public static String FXMLWizardPage_3;
+ public static String FXMLWizardPage_4;
+ public static String FXMLWizardPage_5;
+ public static String FXMLWizardPage_6;
+ public static String FXMLWizardPage_9;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/NewFXMLWizard.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/NewFXMLWizard.java
index eb0f62179..09f491f02 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/NewFXMLWizard.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/NewFXMLWizard.java
@@ -30,18 +30,25 @@ import org.eclipse.fx.ide.fxml.wizards.template.FXMLTemplate;
import org.eclipse.fx.ide.ui.wizards.AbstractNewJDTElementWizard;
import org.eclipse.fx.ide.ui.wizards.template.IGenerator;
+/**
+ * Wizard to create FXML File
+ */
public class NewFXMLWizard extends AbstractNewJDTElementWizard<FXMLElement> {
- private static final String SETTINGS_FILE = "new-fxml-settings.xml";
- public static final String KEY_LAST_SELECTIONS = "KEY_LAST_SELECTIONS";
+ private static final String SETTINGS_FILE = "new-fxml-settings.xml"; //$NON-NLS-1$
+ static final String KEY_LAST_SELECTIONS = "KEY_LAST_SELECTIONS"; //$NON-NLS-1$
private static final int MAX_HISTORY_SIZE = 20;
+ /**
+ * Create a new instance
+ */
public NewFXMLWizard() {
if( getDialogSettings() == null ) {
- DialogSettings settings = new DialogSettings("new-fxml");
+ DialogSettings settings = new DialogSettings("new-fxml"); //$NON-NLS-1$
try {
settings.load(SETTINGS_FILE);
} catch (IOException e) {
+ //nothing
}
setDialogSettings(settings);
}
@@ -54,7 +61,7 @@ public class NewFXMLWizard extends AbstractNewJDTElementWizard<FXMLElement> {
@Override
public void addPages() {
- addPage(new FXMLWizardPage(root,fragment,ResourcesPlugin.getWorkspace().getRoot()));
+ addPage(new FXMLWizardPage(this.root,this.fragment,ResourcesPlugin.getWorkspace().getRoot()));
}
@Override
@@ -64,21 +71,20 @@ public class NewFXMLWizard extends AbstractNewJDTElementWizard<FXMLElement> {
if( finish && getDialogSettings() != null ) {
IFile propFile = getPropertiesFile();
if( ! propFile.exists() ) {
- InputStream in = getClass().getClassLoader().getResourceAsStream("tpl_fxml-preview.properties");
- if( in != null ) {
- try {
- propFile.create(in, true, null);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- in.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ try(InputStream in = getClass().getClassLoader().getResourceAsStream("tpl_fxml-preview.properties")) { //$NON-NLS-1$
+ if( in != null ) {
+ try {
+ propFile.create(in, true, null);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
+ } catch (IOException e) {
+ // TODO: handle exception
+ e.printStackTrace();
}
+
}
IDialogSettings settings = getDialogSettings();
@@ -116,13 +122,13 @@ public class NewFXMLWizard extends AbstractNewJDTElementWizard<FXMLElement> {
@Override
protected IFile createFile() {
- if (fragment != null) {
- String fxgraph = getDomainClass().getName() + ".fxml";
- IFolder p = (IFolder) fragment.getResource();
+ if (this.fragment != null) {
+ String fxgraph = getDomainClass().getName() + ".fxml"; //$NON-NLS-1$
+ IFolder p = (IFolder) this.fragment.getResource();
IResource resource = p.getFile(fxgraph);
return (IFile) resource;
} else {
- String fxgraph = getDomainClass().getName() + ".fxml";
+ String fxgraph = getDomainClass().getName() + ".fxml"; //$NON-NLS-1$
IFolder p = (IFolder) getDomainClass().getFragmentRoot().getResource();
return p.getFile(fxgraph);
}
@@ -130,6 +136,6 @@ public class NewFXMLWizard extends AbstractNewJDTElementWizard<FXMLElement> {
private IFile getPropertiesFile() {
IProject p = (IProject) getDomainClass().getFragmentRoot().getJavaProject().getResource();
- return p.getFile("fxml-preview.properties");
+ return p.getFile("fxml-preview.properties"); //$NON-NLS-1$
}
}
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/messages.properties b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/messages.properties
new file mode 100644
index 000000000..fcfde48a0
--- /dev/null
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/messages.properties
@@ -0,0 +1,8 @@
+FXMLWizardPage_0=Create a new FXML File
+FXMLWizardPage_1=FXML File
+FXMLWizardPage_2=Enter a name
+FXMLWizardPage_3=Find Preloader
+FXMLWizardPage_4=Root Element
+FXMLWizardPage_5=An FXML file should start with an uppercase
+FXMLWizardPage_6=Browse ...
+FXMLWizardPage_9=Dynamic Root (fx:root)
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/template/FXMLElement.java b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/template/FXMLElement.java
index 468068d82..ec839a418 100755
--- a/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/template/FXMLElement.java
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml/src/org/eclipse/fx/ide/fxml/wizards/template/FXMLElement.java
@@ -14,23 +14,39 @@ import org.eclipse.jdt.core.IType;
import org.eclipse.fx.ide.ui.wizards.template.JDTElement;
+/**
+ * FXML Definition
+ */
public class FXMLElement extends JDTElement {
private IType rootElement;
private boolean fxRoot;
+ /**
+ * @return the root type
+ */
public IType getRootElement() {
- return rootElement;
+ return this.rootElement;
}
+ /**
+ * set the root type
+ * @param rootElement the root type
+ */
public void setRootElement(IType rootElement) {
- support.firePropertyChange("rootElement", this.rootElement, this.rootElement = rootElement);
+ this.support.firePropertyChange("rootElement", this.rootElement, this.rootElement = rootElement); //$NON-NLS-1$
}
+ /**
+ * @param fxRoot is it a root
+ */
public void setFxRoot(boolean fxRoot) {
this.fxRoot = fxRoot;
}
+ /**
+ * @return is it a root
+ */
public boolean isFxRoot() {
- return fxRoot;
+ return this.fxRoot;
}
}

Back to the top