diff --git a/plugins/org.eclipse.fordiac.ide.ant/src_ant/org/eclipse/fordiac/ide/ant/ant/ExportProjectLibrary.java b/plugins/org.eclipse.fordiac.ide.ant/src_ant/org/eclipse/fordiac/ide/ant/ant/ExportProjectLibrary.java index 16cbf43355..5884d91556 100644 --- a/plugins/org.eclipse.fordiac.ide.ant/src_ant/org/eclipse/fordiac/ide/ant/ant/ExportProjectLibrary.java +++ b/plugins/org.eclipse.fordiac.ide.ant/src_ant/org/eclipse/fordiac/ide/ant/ant/ExportProjectLibrary.java @@ -78,13 +78,8 @@ protected void checkFordiacProject() { excludePatterns = new ArrayList<>(); typelib = TypeLibraryManager.INSTANCE.getTypeLibrary(getFordiacProject()); - library.getIncludes().getLibraryElement().forEach(elem -> { - includePatterns.add(createPattern(elem.getValue())); - }); - - library.getExcludes().getLibraryElement().forEach(elem -> { - excludePatterns.add(createPattern(elem.getValue())); - }); + library.getIncludes().getLibraryElement().forEach(elem -> includePatterns.add(createPattern(elem.getValue()))); + library.getExcludes().getLibraryElement().forEach(elem -> excludePatterns.add(createPattern(elem.getValue()))); } @Override diff --git a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/editors/FBNetworkContextMenuProvider.java b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/editors/FBNetworkContextMenuProvider.java index 01abf6bdde..68fac0425a 100644 --- a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/editors/FBNetworkContextMenuProvider.java +++ b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/editors/FBNetworkContextMenuProvider.java @@ -78,9 +78,8 @@ public FBNetworkContextMenuProvider(final DiagramEditorWithFlyoutPalette editor, this.typeLib = typeLib; this.editor = editor; - editor.getViewer().getControl().addMenuDetectListener(e -> { - invocationLocation = getViewer().getControl().toControl(e.x, e.y); - }); + editor.getViewer().getControl() + .addMenuDetectListener(e -> invocationLocation = getViewer().getControl().toControl(e.x, e.y)); } @@ -133,8 +132,8 @@ public void buildContextMenu(final IMenuManager menu) { menu.appendToGroup(GEFActionConstants.GROUP_COPY, action); action = getRegistry().getAction(ActionFactory.PASTE.getId()); - if (action instanceof PasteEditPartsAction) { - ((PasteEditPartsAction) action).setPastRefPosition(getTranslatedAndZoomedPoint()); + if (action instanceof final PasteEditPartsAction pasteAction) { + pasteAction.setPastRefPosition(getTranslatedAndZoomedPoint()); } menu.appendToGroup(GEFActionConstants.GROUP_COPY, action); @@ -153,10 +152,10 @@ public void buildFBInsertMenu(final IMenuManager menu, final Point point, final private void fillMenuForFolder(final IMenuManager submenu, final IContainer container) { try { for (final IResource res : container.members()) { - if (res instanceof IFolder) { - createSubMenu(submenu, (IFolder) res); - } else if (res instanceof IFile) { - createFBMenuEntry(submenu, (IFile) res); + if (res instanceof final IFolder folder) { + createSubMenu(submenu, folder); + } else if (res instanceof final IFile file) { + createFBMenuEntry(submenu, file); } } } catch (final CoreException e) { diff --git a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/editparts/HiddenPinIndicatorEditPart.java b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/editparts/HiddenPinIndicatorEditPart.java index 518fc8615f..4783ad71db 100644 --- a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/editparts/HiddenPinIndicatorEditPart.java +++ b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/editparts/HiddenPinIndicatorEditPart.java @@ -62,7 +62,7 @@ public void validate() { super.validate(); final Rectangle r = new Rectangle(); r.setBounds(getBounds()); - r.crop(getInsets()); + r.shrink(getInsets()); r.resize(-1, -1); int size = Math.min(r.height, r.width); size = Math.max(size, 1); // Size cannot be negative diff --git a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/handlers/RepairCommandHandler.java b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/handlers/RepairCommandHandler.java index bb3c1c5430..ca0beb0dd8 100644 --- a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/handlers/RepairCommandHandler.java +++ b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/handlers/RepairCommandHandler.java @@ -237,8 +237,7 @@ public static EObject getEObjectFromEditor(final Object model) { return getEObjectFromEditor(varDecl); } - if (model instanceof final VarDeclaration varDecl - && varDecl.getType() instanceof final ErrorMarkerDataType errorType) { + if (model instanceof final VarDeclaration varDecl && varDecl.getType() instanceof ErrorMarkerDataType) { return varDecl; } diff --git a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/policies/StructuredManipulatorLayoutEditPolicy.java b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/policies/StructuredManipulatorLayoutEditPolicy.java index c1e2119bea..289a4d92fc 100644 --- a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/policies/StructuredManipulatorLayoutEditPolicy.java +++ b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/policies/StructuredManipulatorLayoutEditPolicy.java @@ -14,7 +14,6 @@ import org.eclipse.fordiac.ide.gef.policies.ModifiedNonResizeableEditPolicy; import org.eclipse.fordiac.ide.model.commands.change.ChangeStructCommand; -import org.eclipse.fordiac.ide.model.data.StructuredType; import org.eclipse.fordiac.ide.model.libraryElement.StructManipulator; import org.eclipse.fordiac.ide.model.typelibrary.DataTypeEntry; import org.eclipse.gef.EditPart; @@ -37,7 +36,7 @@ protected Command getCreateCommand(final CreateRequest request) { final Object childClass = request.getNewObjectType(); if ((getHost().getModel() instanceof final StructManipulator structManipulator) && (childClass instanceof final DataTypeEntry dataTypeEntry)) { - return new ChangeStructCommand(structManipulator, (StructuredType) dataTypeEntry.getType()); + return new ChangeStructCommand(structManipulator, dataTypeEntry.getType()); } } return null; @@ -45,7 +44,7 @@ protected Command getCreateCommand(final CreateRequest request) { @Override protected Command getMoveChildrenCommand(final Request request) { - // TODO Auto-generated method stub + // children should not be moveable return null; } diff --git a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/utilities/ExpandedInterfacePositionMap.java b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/utilities/ExpandedInterfacePositionMap.java index 9ca49fcec4..598aa1e546 100644 --- a/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/utilities/ExpandedInterfacePositionMap.java +++ b/plugins/org.eclipse.fordiac.ide.application/src/org/eclipse/fordiac/ide/application/utilities/ExpandedInterfacePositionMap.java @@ -42,7 +42,7 @@ public class ExpandedInterfacePositionMap { - private final static String PREFERENCE_STORE = "org.eclipse.fordiac.ide.gef"; //$NON-NLS-1$ + private static final String PREFERENCE_STORE = "org.eclipse.fordiac.ide.gef"; //$NON-NLS-1$ private final SubAppForFBNetworkEditPart ep; private Rectangle clientArea = null; @@ -390,7 +390,7 @@ private Map calculateDirectPositions(final List(); diff --git a/plugins/org.eclipse.fordiac.ide.deployment.eval/src/org/eclipse/fordiac/ide/deployment/eval/Messages.java b/plugins/org.eclipse.fordiac.ide.deployment.eval/src/org/eclipse/fordiac/ide/deployment/eval/Messages.java index 51f6c38842..a80decec70 100644 --- a/plugins/org.eclipse.fordiac.ide.deployment.eval/src/org/eclipse/fordiac/ide/deployment/eval/Messages.java +++ b/plugins/org.eclipse.fordiac.ide.deployment.eval/src/org/eclipse/fordiac/ide/deployment/eval/Messages.java @@ -14,6 +14,7 @@ import org.eclipse.osgi.util.NLS; +@SuppressWarnings("squid:S3008") // tell sonar the java naming convention does not make sense for this class public class Messages extends NLS { private static final String BUNDLE_NAME = Messages.class.getPackageName() + ".messages"; //$NON-NLS-1$ public static String DeploymentFBEvaluator_InvalidEventCounter; diff --git a/plugins/org.eclipse.fordiac.ide.emf.compare/src/org/eclipse/fordiac/ide/emf/compare/provider/AdapterConnectionItemProviderEmfCompare.java b/plugins/org.eclipse.fordiac.ide.emf.compare/src/org/eclipse/fordiac/ide/emf/compare/provider/AdapterConnectionItemProviderEmfCompare.java index df2e3bd0c1..997eace1e5 100644 --- a/plugins/org.eclipse.fordiac.ide.emf.compare/src/org/eclipse/fordiac/ide/emf/compare/provider/AdapterConnectionItemProviderEmfCompare.java +++ b/plugins/org.eclipse.fordiac.ide.emf.compare/src/org/eclipse/fordiac/ide/emf/compare/provider/AdapterConnectionItemProviderEmfCompare.java @@ -28,7 +28,7 @@ public AdapterConnectionItemProviderEmfCompare(final AdapterFactory adapterFacto @Override public Collection getChildren(final Object object) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } @Override diff --git a/plugins/org.eclipse.fordiac.ide.emf.compare/src/org/eclipse/fordiac/ide/emf/compare/provider/AdapterDeclarationItemProviderEmfCompare.java b/plugins/org.eclipse.fordiac.ide.emf.compare/src/org/eclipse/fordiac/ide/emf/compare/provider/AdapterDeclarationItemProviderEmfCompare.java index d7d3460646..40b9fe0426 100644 --- a/plugins/org.eclipse.fordiac.ide.emf.compare/src/org/eclipse/fordiac/ide/emf/compare/provider/AdapterDeclarationItemProviderEmfCompare.java +++ b/plugins/org.eclipse.fordiac.ide.emf.compare/src/org/eclipse/fordiac/ide/emf/compare/provider/AdapterDeclarationItemProviderEmfCompare.java @@ -33,7 +33,7 @@ public Object getParent(final Object object) { @Override public Collection getChildren(final Object object) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } } diff --git a/plugins/org.eclipse.fordiac.ide.export.xmi/src/org/eclipse/fordiac/ide/export/xmi/Messages.java b/plugins/org.eclipse.fordiac.ide.export.xmi/src/org/eclipse/fordiac/ide/export/xmi/Messages.java index 384fbc67fa..c19179f579 100644 --- a/plugins/org.eclipse.fordiac.ide.export.xmi/src/org/eclipse/fordiac/ide/export/xmi/Messages.java +++ b/plugins/org.eclipse.fordiac.ide.export.xmi/src/org/eclipse/fordiac/ide/export/xmi/Messages.java @@ -14,6 +14,7 @@ import org.eclipse.osgi.util.NLS; +@SuppressWarnings("squid:S3008") // tell sonar the java naming convention does not make sense for this class public class Messages extends NLS { private static final String BUNDLE_NAME = Messages.class.getPackageName() + ".messages"; //$NON-NLS-1$ public static String XMIExportFilter_AttributeValueError; diff --git a/plugins/org.eclipse.fordiac.ide.fb.interpreter.design/src/org/eclipse/fordiac/ide/fb/interpreter/design/Activator.java b/plugins/org.eclipse.fordiac.ide.fb.interpreter.design/src/org/eclipse/fordiac/ide/fb/interpreter/design/Activator.java index 3ea5140256..e9258dde94 100644 --- a/plugins/org.eclipse.fordiac.ide.fb.interpreter.design/src/org/eclipse/fordiac/ide/fb/interpreter/design/Activator.java +++ b/plugins/org.eclipse.fordiac.ide.fb.interpreter.design/src/org/eclipse/fordiac/ide/fb/interpreter/design/Activator.java @@ -25,55 +25,59 @@ * The activator class controls the plug-in life cycle */ public class Activator extends AbstractUIPlugin { - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.fordiac.ide.fb.interpreter.design"; + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.fordiac.ide.fb.interpreter.design"; //$NON-NLS-1$ - // The shared instance - private static Activator plugin; + // The shared instance + private static Activator plugin; - private static Set viewpoints; + private static Set viewpoints; - /** - * The constructor - */ - public Activator() { - } + /** + * The constructor + */ + public Activator() { + } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - viewpoints = new HashSet(); - viewpoints.addAll(ViewpointRegistry.getInstance().registerFromPlugin(PLUGIN_ID + "/description/OpSem.odesign")); - } + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework. + * BundleContext) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + plugin = this; + viewpoints = new HashSet<>(); + viewpoints.addAll(ViewpointRegistry.getInstance().registerFromPlugin(PLUGIN_ID + "/description/OpSem.odesign")); //$NON-NLS-1$ + } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - if (viewpoints != null) { - for (final Viewpoint viewpoint: viewpoints) { - ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint); - } - viewpoints.clear(); - viewpoints = null; + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(final BundleContext context) throws Exception { + plugin = null; + if (viewpoints != null) { + for (final Viewpoint viewpoint : viewpoints) { + ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint); + } + viewpoints.clear(); + viewpoints = null; + } + super.stop(context); } - super.stop(context); - } - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } } diff --git a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/commands/CreateRecordedServiceSequenceCommand.java b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/commands/CreateRecordedServiceSequenceCommand.java index 94e41ee0e7..7d9386a6f9 100644 --- a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/commands/CreateRecordedServiceSequenceCommand.java +++ b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/commands/CreateRecordedServiceSequenceCommand.java @@ -171,14 +171,14 @@ private static String sumParameter(final List list) { private static void setParameters(final FBTransaction transaction, final List parameters) { final List paramVars = new ArrayList<>(); for (final String s : parameters) { - final VarDeclaration var = LibraryElementFactory.eINSTANCE.createVarDeclaration(); + final VarDeclaration varDecl = LibraryElementFactory.eINSTANCE.createVarDeclaration(); final List param = ServiceSequenceUtils.splitParameter(s); if (param.size() == 2) { - var.setName(param.get(0)); - var.setValue(LibraryElementFactory.eINSTANCE.createValue()); - var.getValue().setValue(param.get(1)); + varDecl.setName(param.get(0)); + varDecl.setValue(LibraryElementFactory.eINSTANCE.createValue()); + varDecl.getValue().setValue(param.get(1)); } - paramVars.add(var); + paramVars.add(varDecl); } transaction.getInputVariables().addAll(paramVars); } diff --git a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/exporter/CppBoostTestConstants.java b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/exporter/CppBoostTestConstants.java index 15621c1aac..b49e38dd18 100644 --- a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/exporter/CppBoostTestConstants.java +++ b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/exporter/CppBoostTestConstants.java @@ -15,44 +15,44 @@ @SuppressWarnings("nls") public final class CppBoostTestConstants { - static String newLine = System.getProperty("line.separator"); + static final String NEW_LINE = System.getProperty("line.separator"); - public static String testIncludeString = """ + public static final String TEST_INCLUDE_STRING = """ #include "core/fbtests/fbtestfixture.h" #include - #include \n"""; + #include """ + NEW_LINE; - public static String tester_genString = """ + public static final String TESTER_GEN_STRING = """ #ifdef FORTE_ENABLE_GENERATED_SOURCE_CPP #include "{0}_ServiceSeq_gen.cpp" #endif """; - public static String testFixtureStruct = "struct {0}_TestFixture : public CFBTestFixtureBase '{'"; + public static final String TEST_FIXTURE_STRUCT = "struct {0}_TestFixture : public CFBTestFixtureBase '{'"; - public static String testFixtureBase = "{0}_TestFixture() : " + newLine + public static final String TEST_FICTURE_BASE = "{0}_TestFixture() : " + NEW_LINE + "CFBTestFixtureBase(g_nStringIdservSeq__{0}) '{'"; - public static String testFixtureSetup = "CFBTestFixtureBase::setup();" + newLine + "}"; + public static final String TEST_FICTURE_SETUP = "CFBTestFixtureBase::setup();" + NEW_LINE + "}"; - public static String setInputDataSTART = "setInputData({"; - public static String setInputDataEND = "});"; + public static final String SET_INPUT_DATA_START = "setInputData({"; + public static final String SET_INPUT_DATA_END = "});"; - public static String setOutputDataSTART = "setOutputData({"; - public static String setOutputDataEND = "});"; + public static final String SET_OUTPUT_DATA_START = "setOutputData({"; + public static final String SET_OUTPUT_DATA_END = "});"; - public static String testSuiteName = "BOOST_FIXTURE_TEST_SUITE({0}TEST, {0}_TestFixture)"; - public static String testSuiteEND = "BOOST_AUTO_TEST_SUITE_END()"; + public static final String TEST_SUITE_NAME = "BOOST_FIXTURE_TEST_SUITE({0}TEST, {0}_TestFixture)"; + public static final String TEST_SUITE_END = "BOOST_AUTO_TEST_SUITE_END()"; - public static String testCase = "BOOST_AUTO_TEST_CASE({0}) '{'"; + public static final String TEST_CASE = "BOOST_AUTO_TEST_CASE({0}) '{'"; - public static String setECCState = "setECCState(CIEC_STATE({0}));"; + public static final String SET_ECC_STATE = "setECCState(CIEC_STATE({0}));"; - public static String triggerEvent = "triggerEvent({0});"; - public static String triggerEventByID = "triggerEvent(CFBTestFixtureBase::getFB()->getEIID(CStringDictionary::getInstance().getId(\"{0}\")));"; + public static final String TRIGGER_EVENT = "triggerEvent({0});"; + public static final String TRIGGER_EVENT_BY_ID = "triggerEvent(CFBTestFixtureBase::getFB()->getEIID(CStringDictionary::getInstance().getId(\"{0}\")));"; - public static String boostAssertEQUAL = "BOOST_TEST({0} == {1});"; - public static String boostAssertNOTEQUAL = "BOOST_TEST({0} != {1});"; + public static final String BOOS_ASSERT_EQUAL = "BOOST_TEST({0} == {1});"; + public static final String BOOS_ASSERT_NOT_EQUAL = "BOOST_TEST({0} != {1});"; private CppBoostTestConstants() { // empty private constructor diff --git a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/exporter/ExportServiceSequenceToCppTest.java b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/exporter/ExportServiceSequenceToCppTest.java index 87f1fd3190..b8475dd1de 100644 --- a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/exporter/ExportServiceSequenceToCppTest.java +++ b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/exporter/ExportServiceSequenceToCppTest.java @@ -71,23 +71,21 @@ public void exportServiceSequenceToCppTest(final List serviceSe addTesterGen(writer); addDataStruct(writer); addTestSuite(writer); - - writer.close(); } catch (final IOException ex) { FordiacLogHelper.logError(ex.getMessage(), ex); } } private void addTestSuite(final BufferedWriter writer) throws IOException { - writer.append(MessageFormat.format(CppBoostTestConstants.testSuiteName, fb.getName())); + writer.append(MessageFormat.format(CppBoostTestConstants.TEST_SUITE_NAME, fb.getName())); writer.newLine(); for (final ServiceSequence sequence : serviceSeq) { - writer.append(MessageFormat.format(CppBoostTestConstants.testCase, sequence.getName())); + writer.append(MessageFormat.format(CppBoostTestConstants.TEST_CASE, sequence.getName())); writer.newLine(); final int stateID = fb.getECC().getECState().indexOf(fb.getECC().getECState().stream() .filter(state -> state.getName().equals(sequence.getStartState())).findFirst().orElse(null)); if (stateID > 0) { - writer.append(MessageFormat.format(CppBoostTestConstants.setECCState, stateID)); + writer.append(MessageFormat.format(CppBoostTestConstants.SET_ECC_STATE, Integer.toString(stateID))); writer.newLine(); } for (final ServiceTransaction transaction : sequence.getServiceTransaction()) { @@ -97,14 +95,14 @@ private void addTestSuite(final BufferedWriter writer) throws IOException { .indexOf(fb.getInterfaceList().getEventInputs().stream() .filter(event -> event.getName().equals(transaction.getInputPrimitive().getEvent())) .findFirst().orElse(null)); - writer.append(MessageFormat.format(CppBoostTestConstants.triggerEvent, eventID)); + writer.append(MessageFormat.format(CppBoostTestConstants.TRIGGER_EVENT, Integer.toString(eventID))); writer.newLine(); parseAndAddOutputAsserts(writer, transaction.getOutputPrimitive()); } writer.append("}"); writer.newLine(); } - writer.append(CppBoostTestConstants.testSuiteEND); + writer.append(CppBoostTestConstants.TEST_SUITE_END); } @@ -119,7 +117,7 @@ private static void parseAndAddOutputAsserts(final BufferedWriter writer, final param = param.replace(param.subSequence(param.indexOf("=") + 1, param.indexOf("(")), getForteDataTypeFromString( param.subSequence(param.indexOf("=") + 1, param.indexOf("(")).toString())); - writer.append(MessageFormat.format(CppBoostTestConstants.boostAssertEQUAL, + writer.append(MessageFormat.format(CppBoostTestConstants.BOOS_ASSERT_EQUAL, param.subSequence(0, param.indexOf(":")), param.subSequence(param.indexOf("=") + 1, param.length()).toString().replace("'", "\""))); writer.newLine(); @@ -145,11 +143,11 @@ private static void parseAndAddParameters(final BufferedWriter writer, final Str } private static void addImports(final BufferedWriter writer) throws IOException { - writer.write(CppBoostTestConstants.testIncludeString); + writer.write(CppBoostTestConstants.TEST_INCLUDE_STRING); } private void addTesterGen(final BufferedWriter writer) throws IOException { - writer.write(MessageFormat.format(CppBoostTestConstants.tester_genString, fb.getName())); + writer.write(MessageFormat.format(CppBoostTestConstants.TESTER_GEN_STRING, fb.getName())); writer.newLine(); } @@ -157,23 +155,23 @@ private void addDataStruct(final BufferedWriter writer) throws IOException { final var outputData = fb.getOutputParameters(); final var inputData = fb.getInputParameters(); - writer.append(MessageFormat.format(CppBoostTestConstants.testFixtureStruct, fb.getName())); + writer.append(MessageFormat.format(CppBoostTestConstants.TEST_FIXTURE_STRUCT, fb.getName())); writer.newLine(); - writer.append(MessageFormat.format(CppBoostTestConstants.testFixtureBase, fb.getName())); + writer.append(MessageFormat.format(CppBoostTestConstants.TEST_FICTURE_BASE, fb.getName())); writer.newLine(); - writer.append(CppBoostTestConstants.setInputDataSTART); + writer.append(CppBoostTestConstants.SET_INPUT_DATA_START); if (!inputData.isEmpty()) { writer.append(inputData.stream().map(INamedElement::getName).collect(Collectors.joining(",&", "&", ""))); } - writer.append(CppBoostTestConstants.setInputDataEND); + writer.append(CppBoostTestConstants.SET_INPUT_DATA_END); writer.newLine(); - writer.append(CppBoostTestConstants.setOutputDataSTART); + writer.append(CppBoostTestConstants.SET_OUTPUT_DATA_START); if (!outputData.isEmpty()) { writer.append(outputData.stream().map(INamedElement::getName).collect(Collectors.joining(",&", "&", ""))); } - writer.append(CppBoostTestConstants.setOutputDataEND); + writer.append(CppBoostTestConstants.SET_OUTPUT_DATA_END); writer.newLine(); - writer.append(CppBoostTestConstants.testFixtureSetup); + writer.append(CppBoostTestConstants.TEST_FICTURE_SETUP); writer.newLine(); for (final INamedElement varDec : inputData) { diff --git a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/handler/GetCoverageHandler.java b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/handler/GetCoverageHandler.java index d5c51a7ecd..c3fd7b59df 100644 --- a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/handler/GetCoverageHandler.java +++ b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/handler/GetCoverageHandler.java @@ -93,20 +93,17 @@ private void setCoverageData(final EventManager evntMngr, final ServiceSequence final BasicFbExecutionTrace eccTraceHelper = new BasicFbExecutionTrace(evntMngr.getTransactions(), ((BasicFBType) seq.getService().getFBType()).getECC()); if (visitedStates.isEmpty()) { - eccTraceHelper.getAllPossibleStates().forEach(s -> { - visitedStates.put(s.getName(), 0); - }); + eccTraceHelper.getAllPossibleStates().forEach(s -> visitedStates.put(s.getName(), Integer.valueOf(0))); } if (visitedPaths.isEmpty()) { - eccTraceHelper.getAllPossiblePaths().forEach(p -> { - visitedPaths.put(p, 0); - }); + eccTraceHelper.getAllPossiblePaths().forEach(p -> visitedPaths.put(p, Integer.valueOf(0))); } - eccTraceHelper.getAllStatesOfSequence().forEach(s -> visitedStates.merge(s.getName(), 1, Integer::sum)); - eccTraceHelper.getAllPathsOfSequence().forEach(p -> visitedPaths.merge(p, 1, Integer::sum)); + eccTraceHelper.getAllStatesOfSequence() + .forEach(s -> visitedStates.merge(s.getName(), Integer.valueOf(1), Integer::sum)); + eccTraceHelper.getAllPathsOfSequence().forEach(p -> visitedPaths.merge(p, Integer.valueOf(1), Integer::sum)); } - private Optional checkForExistingEventManager(final ServiceSequence seq, final FBType fbType) { + private static Optional checkForExistingEventManager(final ServiceSequence seq, final FBType fbType) { if (seq.getEventManager() == null) { seq.setEventManager(ServiceSequenceSaveAndLoadHelper.loadEventManagerFromServiceSequenceFile(fbType, seq)); } diff --git a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/messages.properties b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/messages.properties index 523d63ce96..697fe585e9 100644 --- a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/messages.properties +++ b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/messages.properties @@ -90,5 +90,5 @@ ServiceSequenceAssignView_START=START Coverage_NAME=Coverage Coverage_VISITED_STATES=visited states Coverage_VISITED_PATHS=visited paths -Coverage_NODECOVERAGE=node coverage -Coverage_PATHCOVERAGE=path coverage \ No newline at end of file +Coverage_NODECOVERAGE=node coverage: {0}%\n +Coverage_PATHCOVERAGE=path coverage: {0}%\n diff --git a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/view/GetCoverageDialog.java b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/view/GetCoverageDialog.java index 3443794ce6..0ab1df866d 100644 --- a/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/view/GetCoverageDialog.java +++ b/plugins/org.eclipse.fordiac.ide.fbtypeeditor.servicesequence/src/org/eclipse/fordiac/ide/fbtypeeditor/servicesequence/view/GetCoverageDialog.java @@ -13,6 +13,7 @@ *******************************************************************************/ package org.eclipse.fordiac.ide.fbtypeeditor.servicesequence.view; +import java.text.MessageFormat; import java.util.List; import java.util.Map; @@ -57,12 +58,12 @@ protected Control createCustomArea(final Composite parent) { visitedStates.entrySet().forEach(entry -> { final Label label = new Label(vistedStatesGroup, SWT.None); - label.setText(entry.getKey() + " : " + entry.getValue() + " \n"); + label.setText(entry.getKey() + " : " + entry.getValue() + " \n"); //$NON-NLS-1$ //$NON-NLS-2$ }); Label label = new Label(vistedStatesGroup, SWT.None); - label.setText(Messages.Coverage_NODECOVERAGE + ": " - + CoverageCalculator.calculateNodeCoverageOfSuiteBy(visitedStates) * 100 + "% \n"); + label.setText(MessageFormat.format(Messages.Coverage_NODECOVERAGE, + Float.toString(CoverageCalculator.calculateNodeCoverageOfSuiteBy(visitedStates) * 100))); final Group vistedPathsGroup = new Group(dialogArea, SWT.NONE); vistedPathsGroup.setText(Messages.Coverage_VISITED_PATHS); @@ -71,18 +72,25 @@ protected Control createCustomArea(final Composite parent) { visitedPaths.entrySet().forEach(entry -> { final Label label2 = new Label(vistedPathsGroup, SWT.None); - String pathString = ""; + final StringBuilder pathString = new StringBuilder(); for (final String state : entry.getKey()) { - pathString += state + " -> "; + pathString.append(state); + pathString.append(" -> "); //$NON-NLS-1$ } - pathString = pathString.substring(0, pathString.length() - 4); - label2.setText(pathString + " : " + entry.getValue() + " \n"); + if (!entry.getKey().isEmpty()) { + pathString.setLength(pathString.length() - 4); + } + pathString.append(" : "); //$NON-NLS-1$ + pathString.append(entry.getValue()); + pathString.append(" \n"); //$NON-NLS-1$ + + label2.setText(pathString.toString()); }); label = new Label(vistedPathsGroup, SWT.None); - label.setText(Messages.Coverage_PATHCOVERAGE + ": " - + CoverageCalculator.calculatePathCoverageOfSuiteBy(visitedPaths) * 100 + "% \n"); + label.setText(MessageFormat.format(Messages.Coverage_PATHCOVERAGE, + Float.toString(CoverageCalculator.calculatePathCoverageOfSuiteBy(visitedPaths) * 100))); return dialogArea; } diff --git a/plugins/org.eclipse.fordiac.ide.fbtypeeditor/src/org/eclipse/fordiac/ide/fbtypeeditor/editors/FBTypeEditor.java b/plugins/org.eclipse.fordiac.ide.fbtypeeditor/src/org/eclipse/fordiac/ide/fbtypeeditor/editors/FBTypeEditor.java index 7c61cec0f2..0d8faf77a0 100644 --- a/plugins/org.eclipse.fordiac.ide.fbtypeeditor/src/org/eclipse/fordiac/ide/fbtypeeditor/editors/FBTypeEditor.java +++ b/plugins/org.eclipse.fordiac.ide.fbtypeeditor/src/org/eclipse/fordiac/ide/fbtypeeditor/editors/FBTypeEditor.java @@ -126,7 +126,6 @@ public class FBTypeEditor extends AbstractCloseAbleFormEditor implements ISelect private final CommandStack commandStack = new CommandStack(); private GraphicalAnnotationModel annotationModel; private ValidationJob validationJob; - private FBTypeUpdateDialog fbSaveDialog; private static final int DEFAULT_BUTTON_INDEX = 0; // Save Button private static final int CANCEL_BUTTON_INDEX = 1; private int interfaceChanges = 0; // number of interface changes happend since the last save @@ -149,7 +148,8 @@ private void createSaveDialog(final IProgressMonitor monitor) { final String[] labels = { Messages.FBTypeEditor_AlteringButton_SaveAndUpdate, // Messages.StructAlteringButton_SaveAs, SWT.getMessage("SWT_Cancel") }; //$NON-NLS-1$ - fbSaveDialog = new FBTypeUpdateDialog<>(null, Messages.FBTypeEditor_ViewingComposite_Headline, null, "", //$NON-NLS-1$ + final FBTypeUpdateDialog fbSaveDialog = new FBTypeUpdateDialog<>(null, + Messages.FBTypeEditor_ViewingComposite_Headline, null, "", //$NON-NLS-1$ MessageDialog.NONE, labels, DEFAULT_BUTTON_INDEX, new FBTypeEntryDataHandler(typeEntry)); // Depending on the button clicked: diff --git a/plugins/org.eclipse.fordiac.ide.fbtypeeditor/src/org/eclipse/fordiac/ide/fbtypeeditor/editparts/InterfaceEditPart.java b/plugins/org.eclipse.fordiac.ide.fbtypeeditor/src/org/eclipse/fordiac/ide/fbtypeeditor/editparts/InterfaceEditPart.java index 400678cae1..0b330d7652 100644 --- a/plugins/org.eclipse.fordiac.ide.fbtypeeditor/src/org/eclipse/fordiac/ide/fbtypeeditor/editparts/InterfaceEditPart.java +++ b/plugins/org.eclipse.fordiac.ide.fbtypeeditor/src/org/eclipse/fordiac/ide/fbtypeeditor/editparts/InterfaceEditPart.java @@ -158,7 +158,7 @@ public void updateAnnotations(final GraphicalAnnotationModelEvent event) { protected void refreshVisuals() { super.refreshVisuals(); if (getCastedModel() instanceof Event && null != sourceConnections) { - for (final Object con : sourceConnections) { + for (final ConnectionEditPart con : sourceConnections) { final WithEditPart with = (WithEditPart) con; with.updateWithPos(); } @@ -206,14 +206,12 @@ private FBTypeRootEditPart getFBTypeRootEP() { } public void setInOutConnectionsWith(final int with) { - for (final Object element : getSourceConnections()) { - final ConnectionEditPart cep = (ConnectionEditPart) element; + for (final ConnectionEditPart cep : getSourceConnections()) { if (cep.getFigure() instanceof final PolylineConnection plc) { plc.setLineWidth(with); } } - for (final Object element : getTargetConnections()) { - final ConnectionEditPart cep = (ConnectionEditPart) element; + for (final ConnectionEditPart cep : getTargetConnections()) { if (cep.getFigure() instanceof final PolylineConnection plc) { plc.setLineWidth(with); } diff --git a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/nat/StyledTextCellEditor.java b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/nat/StyledTextCellEditor.java index 8fd9cce0fa..99820aacb6 100644 --- a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/nat/StyledTextCellEditor.java +++ b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/nat/StyledTextCellEditor.java @@ -45,131 +45,200 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Text; -/** {@link ICellEditor} implementation that wraps a SWT {@link StyledText} control to support text editing. */ +/** + * {@link ICellEditor} implementation that wraps a SWT {@link StyledText} + * control to support text editing. + */ public class StyledTextCellEditor extends AbstractCellEditor { - /** The StyledText control which is the editor wrapped by this StyledTextCellEditor. */ + /** + * The StyledText control which is the editor wrapped by this + * StyledTextCellEditor. + */ private StyledText text = null; /** Flag to configure if the wrapped text editor control is editable or not. */ private boolean editable = true; - /** Flag to configure whether the editor should commit and move the selection in the corresponding way if the up or - * down key is pressed. */ + /** + * Flag to configure whether the editor should commit and move the selection in + * the corresponding way if the up or down key is pressed. + */ private final boolean commitOnUpDown; - /** Flag to configure whether the editor should commit and move the selection in the corresponding way if the left - * or right key is pressed on the according content edge. */ + /** + * Flag to configure whether the editor should commit and move the selection in + * the corresponding way if the left or right key is pressed on the according + * content edge. + */ private final boolean commitOnLeftRight; - /** Flag to configure whether the selection should move after a value was committed after pressing enter. */ + /** + * Flag to configure whether the selection should move after a value was + * committed after pressing enter. + */ private final boolean moveSelectionOnEnter; - /** The selection mode that should be used on activating the wrapped text control. By default the behaviour is to - * set the selection at the end of the containing text if the text editor control is activated with an initial - * value. If it is activated only specifying the original canonical value, the default behaviour is to select the - * whole text contained in the text editor control. + /** + * The selection mode that should be used on activating the wrapped text + * control. By default the behaviour is to set the selection at the end of the + * containing text if the text editor control is activated with an initial + * value. If it is activated only specifying the original canonical value, the + * default behaviour is to select the whole text contained in the text editor + * control. * *

- * You can override this default behaviour by setting an {@link EditorSelectionEnum} explicitly. With this you are - * able e.g. to set the selection at the beginning of the contained text, so writing in the text control will result - * in prefixing. + * You can override this default behaviour by setting an + * {@link EditorSelectionEnum} explicitly. With this you are able e.g. to set + * the selection at the beginning of the contained text, so writing in the text + * control will result in prefixing. * *

- * Note that on overriding the behaviour, you override both activation cases. */ + * Note that on overriding the behaviour, you override both activation cases. + */ private EditorSelectionEnum selectionMode; - /** The {@link ControlDecorationProvider} responsible for adding a {@link ControlDecoration} to the wrapped editor - * control. Can be configured via convenience methods of this StyledTextCellEditor. */ + /** + * The {@link ControlDecorationProvider} responsible for adding a + * {@link ControlDecoration} to the wrapped editor control. Can be configured + * via convenience methods of this StyledTextCellEditor. + */ protected final ControlDecorationProvider decorationProvider = new ControlDecorationProvider(); - /** The {@link IEditErrorHandler} that is used for showing conversion errors on typing into this editor. By default - * this is the {@link RenderErrorHandling} which will render the content in the editor red to indicate a conversion - * error. */ + /** + * The {@link IEditErrorHandler} that is used for showing conversion errors on + * typing into this editor. By default this is the {@link RenderErrorHandling} + * which will render the content in the editor red to indicate a conversion + * error. + */ private IEditErrorHandler inputConversionErrorHandler = new RenderErrorHandling(this.decorationProvider); - /** The {@link IEditErrorHandler} that is used for showing validation errors on typing into this editor. By default - * this is the {@link RenderErrorHandling} which will render the content in the editor red to indicate a validation - * error. */ + /** + * The {@link IEditErrorHandler} that is used for showing validation errors on + * typing into this editor. By default this is the {@link RenderErrorHandling} + * which will render the content in the editor red to indicate a validation + * error. + */ private IEditErrorHandler inputValidationErrorHandler = new RenderErrorHandling(this.decorationProvider); - /** Flag to determine whether this editor should try to commit and close on pressing the ENTER key. The default is - * true. For a multi line text editor, the ENTER key might be used to insert a new line instead of - * committing the value when opened in a dialog. In that case the value should not be committed, as applying the - * dialog will trigger the commit. For inline editors setting {@link #commitWithCtrlKey} to true might - * be interesting in combination with setting this value to true, which means that the commit operation - * is only performed if CTRL + ENTER is pressed. */ + /** + * Flag to determine whether this editor should try to commit and close on + * pressing the ENTER key. The default is true. For a multi line + * text editor, the ENTER key might be used to insert a new line instead of + * committing the value when opened in a dialog. In that case the value should + * not be committed, as applying the dialog will trigger the commit. For inline + * editors setting {@link #commitWithCtrlKey} to true might be + * interesting in combination with setting this value to true, + * which means that the commit operation is only performed if CTRL + ENTER is + * pressed. + */ protected boolean commitOnEnter = true; - /** Flag to determine whether this editor should try to commit and close on pressing the enter key in combination - * with the CTRL key. It is only interpreted with {@link #commitOnEnter} set to true, and it is needed - * for a multi line text editor where a simple enter press should add a new line and a combination with CTRL should - * commit the value. + /** + * Flag to determine whether this editor should try to commit and close on + * pressing the enter key in combination with the CTRL key. It is only + * interpreted with {@link #commitOnEnter} set to true, and it is + * needed for a multi line text editor where a simple enter press should add a + * new line and a combination with CTRL should commit the value. * - * @since 1.6 */ + * @since 1.6 + */ private boolean commitWithCtrlKey = false; - /** @see ContentProposalAdapter#ContentProposalAdapter(Control, IControlContentAdapter, IContentProposalProvider, - * KeyStroke, char[]) - * @since 1.4 */ + /** + * @see ContentProposalAdapter#ContentProposalAdapter(Control, + * IControlContentAdapter, IContentProposalProvider, KeyStroke, char[]) + * @since 1.4 + */ protected IControlContentAdapter controlContentAdapter; - /** @see ContentProposalAdapter#ContentProposalAdapter(Control, IControlContentAdapter, IContentProposalProvider, - * KeyStroke, char[]) - * @since 1.4 */ + /** + * @see ContentProposalAdapter#ContentProposalAdapter(Control, + * IControlContentAdapter, IContentProposalProvider, KeyStroke, char[]) + * @since 1.4 + */ protected IContentProposalProvider proposalProvider; - /** @see ContentProposalAdapter#ContentProposalAdapter(Control, IControlContentAdapter, IContentProposalProvider, - * KeyStroke, char[]) - * @since 1.4 */ + /** + * @see ContentProposalAdapter#ContentProposalAdapter(Control, + * IControlContentAdapter, IContentProposalProvider, KeyStroke, char[]) + * @since 1.4 + */ protected KeyStroke keyStroke; - /** @see ContentProposalAdapter#ContentProposalAdapter(Control, IControlContentAdapter, IContentProposalProvider, - * KeyStroke, char[]) - * @since 1.4 */ + /** + * @see ContentProposalAdapter#ContentProposalAdapter(Control, + * IControlContentAdapter, IContentProposalProvider, KeyStroke, char[]) + * @since 1.4 + */ protected char[] autoActivationCharacters; - /** @see ContentProposalAdapter#setProposalAcceptanceStyle(int) - * @since 2.0 */ + /** + * @see ContentProposalAdapter#setProposalAcceptanceStyle(int) + * @since 2.0 + */ protected int proposalAcceptanceStyle = ContentProposalAdapter.PROPOSAL_REPLACE; - /** @see ContentProposalAdapter#setAutoActivationDelay(int) - * @since 2.0 */ + /** + * @see ContentProposalAdapter#setAutoActivationDelay(int) + * @since 2.0 + */ protected int autoActivationDelay = 0; - /** The active {@link ContentProposalAdapter} if supported. + /** + * The active {@link ContentProposalAdapter} if supported. * - * @since 2.0 */ + * @since 2.0 + */ protected ContentProposalAdapter contentProposalAdapter; - /** Creates the default StyledTextCellEditor that does not commit on pressing the up/down arrow keys and will not - * move the selection on committing a value by pressing enter. */ + /** + * Creates the default StyledTextCellEditor that does not commit on pressing the + * up/down arrow keys and will not move the selection on committing a value by + * pressing enter. + */ public StyledTextCellEditor() { this(false); } - /** Creates a StyledTextCellEditor that will not move the selection on committing a value by pressing enter. + /** + * Creates a StyledTextCellEditor that will not move the selection on committing + * a value by pressing enter. * - * @param commitOnUpDown Flag to configure whether the editor should commit and move the selection in the - * corresponding way if the up or down key is pressed. */ + * @param commitOnUpDown Flag to configure whether the editor should commit and + * move the selection in the corresponding way if the up + * or down key is pressed. + */ public StyledTextCellEditor(final boolean commitOnUpDown) { this(commitOnUpDown, false); } - /** Creates a StyledTextCellEditor that will not move the selection on pressing the left or right arrow keys on the - * according edges. + /** + * Creates a StyledTextCellEditor that will not move the selection on pressing + * the left or right arrow keys on the according edges. * - * @param commitOnUpDown Flag to configure whether the editor should commit and move the selection in the - * corresponding way if the up or down key is pressed. - * @param moveSelectionOnEnter Flag to configure whether the selection should move after a value was committed after - * pressing enter. */ + * @param commitOnUpDown Flag to configure whether the editor should + * commit and move the selection in the + * corresponding way if the up or down key is + * pressed. + * @param moveSelectionOnEnter Flag to configure whether the selection should + * move after a value was committed after pressing + * enter. + */ public StyledTextCellEditor(final boolean commitOnUpDown, final boolean moveSelectionOnEnter) { this(commitOnUpDown, moveSelectionOnEnter, false); } - /** Creates a StyledTextCellEditor. - * - * @param commitOnUpDown Flag to configure whether the editor should commit and move the selection in the - * corresponding way if the up or down key is pressed. - * @param moveSelectionOnEnter Flag to configure whether the selection should move after a value was committed after - * pressing enter. - * @param commitOnLeftRight Flag to configure whether the editor should commit and move the selection in the - * corresponding way if the left or right key is pressed on the according content edge. - * @since 1.4 */ + /** + * Creates a StyledTextCellEditor. + * + * @param commitOnUpDown Flag to configure whether the editor should + * commit and move the selection in the + * corresponding way if the up or down key is + * pressed. + * @param moveSelectionOnEnter Flag to configure whether the selection should + * move after a value was committed after pressing + * enter. + * @param commitOnLeftRight Flag to configure whether the editor should + * commit and move the selection in the + * corresponding way if the left or right key is + * pressed on the according content edge. + * @since 1.4 + */ public StyledTextCellEditor(final boolean commitOnUpDown, final boolean moveSelectionOnEnter, final boolean commitOnLeftRight) { this.commitOnUpDown = commitOnUpDown; @@ -207,18 +276,16 @@ protected Control activateCell(final Composite parent, final Object originalCano // Note: this is currently only implemented in here, as the // StyledTextCellEditor is the only editor that supports just in time // conversion/validation - if (this.inputConversionErrorHandler instanceof RenderErrorHandling) { + if (this.inputConversionErrorHandler instanceof final RenderErrorHandling renderErrorHandling) { final IStyle conversionErrorStyle = this.configRegistry .getConfigAttribute(EditConfigAttributes.CONVERSION_ERROR_STYLE, DisplayMode.EDIT, this.labelStack); - - ((RenderErrorHandling) this.inputConversionErrorHandler).setErrorStyle(conversionErrorStyle); + renderErrorHandling.setErrorStyle(conversionErrorStyle); } - if (this.inputValidationErrorHandler instanceof RenderErrorHandling) { + if (this.inputValidationErrorHandler instanceof final RenderErrorHandling renderErrorHandling) { final IStyle validationErrorStyle = this.configRegistry .getConfigAttribute(EditConfigAttributes.VALIDATION_ERROR_STYLE, DisplayMode.EDIT, this.labelStack); - - ((RenderErrorHandling) this.inputValidationErrorHandler).setErrorStyle(validationErrorStyle); + renderErrorHandling.setErrorStyle(validationErrorStyle); } // if a IControlContentAdapter is registered, create and register a @@ -257,12 +324,15 @@ public StyledText createEditorControl(final Composite parent) { return createEditorControl(parent, style); } - /** Creates the editor control that is wrapped by this ICellEditor. Will use the style configurations in - * ConfigRegistry for styling the control. + /** + * Creates the editor control that is wrapped by this ICellEditor. Will use the + * style configurations in ConfigRegistry for styling the control. * - * @param parent The Composite that will be the parent of the new editor control. Can not be null + * @param parent The Composite that will be the parent of the new editor + * control. Can not be null * @param style The SWT style of the text control to create. - * @return The created editor control that is wrapped by this ICellEditor. */ + * @return The created editor control that is wrapped by this ICellEditor. + */ protected StyledText createEditorControl(final Composite parent, final int style) { // create the Text control based on the specified style final StyledText textControl = createStyledText(parent, style); @@ -362,11 +432,13 @@ public void keyReleased(final KeyEvent e) { return textControl; } - /** Creates the styled text control. + /** + * Creates the styled text control. * * @param parent The parent control * @param style The style - * @return The text control */ + * @return The text control + */ @SuppressWarnings("static-method") protected StyledText createStyledText(final Composite parent, final int style) { return new StyledText(parent, style); @@ -391,44 +463,62 @@ public void close() { this.decorationProvider.dispose(); } - /** @return true if the wrapped Text control is editable, false if not. */ + /** + * @return true if the wrapped Text control is editable, + * false if not. + */ public boolean isEditable() { return this.editable; } - /** @param editable true if the wrapped Text control should be editable, false if not. */ + /** + * @param editable true if the wrapped Text control should be + * editable, false if not. + */ public void setEditable(final boolean editable) { this.editable = editable; } - /** Returns the current configured selection mode that is used on activating the wrapped text editor control. By - * default this is null which causes the following default behaviour. If the text editor control is - * activated with an initial value then the selection is set at the end of the containing text. If it is activated - * only specifying the original canonical value, the default behaviour is to select the whole text contained in the + /** + * Returns the current configured selection mode that is used on activating the + * wrapped text editor control. By default this is null which + * causes the following default behaviour. If the text editor control is + * activated with an initial value then the selection is set at the end of the + * containing text. If it is activated only specifying the original canonical + * value, the default behaviour is to select the whole text contained in the * text editor control. * - * @return The current configured selection mode, null for default behaviour. */ + * @return The current configured selection mode, null for default + * behaviour. + */ public final EditorSelectionEnum getSelectionMode() { return this.selectionMode; } - /** Set the selection mode that should be used on the content of the wrapped text editor control when it gets - * activated. By setting a value explicitly you configure the selection mode for both cases, activating the wrapped - * text editor control with and without an initial value. Setting this value to null will reactivate - * the default behaviour like described here {@link StyledTextCellEditor#getSelectionMode()}. + /** + * Set the selection mode that should be used on the content of the wrapped text + * editor control when it gets activated. By setting a value explicitly you + * configure the selection mode for both cases, activating the wrapped text + * editor control with and without an initial value. Setting this value to + * null will reactivate the default behaviour like described here + * {@link StyledTextCellEditor#getSelectionMode()}. * - * @param selectionMode The selection mode that should be used on the content of the wrapped text editor control - * when it gets activated. */ + * @param selectionMode The selection mode that should be used on the content of + * the wrapped text editor control when it gets activated. + */ public final void setSelectionMode(final EditorSelectionEnum selectionMode) { this.selectionMode = selectionMode; } - /** Will set the selection to the wrapped text control regarding the configured {@link EditorSelectionEnum}. + /** + * Will set the selection to the wrapped text control regarding the configured + * {@link EditorSelectionEnum}. * *

* This method is called * - * @see Text#setSelection(int, int) */ + * @see Text#setSelection(int, int) + */ private void selectText(final EditorSelectionEnum selectionMode) { final int textLength = this.text.getText().length(); if (textLength > 0) { @@ -442,97 +532,138 @@ private void selectText(final EditorSelectionEnum selectionMode) { } } - /** @return The {@link ControlDecorationProvider} responsible for adding a {@link ControlDecoration} to the wrapped - * editor control. */ + /** + * @return The {@link ControlDecorationProvider} responsible for adding a + * {@link ControlDecoration} to the wrapped editor control. + */ public ControlDecorationProvider getDecorationProvider() { return this.decorationProvider; } - /** Enables/disables the error decoration for the wrapped text control. + /** + * Enables/disables the error decoration for the wrapped text control. * - * @param enabled true if an error decoration should be added to the wrapped text control, - * false if not. */ + * @param enabled true if an error decoration should be added to + * the wrapped text control, false if not. + */ public void setErrorDecorationEnabled(final boolean enabled) { this.decorationProvider.setErrorDecorationEnabled(enabled); } - /** Force the error decoration hover to show immediately. + /** + * Force the error decoration hover to show immediately. * * @param customErrorText The text to show in the hover popup. * * @see ControlDecoration#show() - * @see ControlDecoration#showHoverText(String) */ + * @see ControlDecoration#showHoverText(String) + */ public void showErrorDecorationHover(final String customErrorText) { this.decorationProvider.showErrorDecorationHover(customErrorText); } - /** Set the id of the {@link FieldDecoration} to be used by the local {@link ControlDecorationProvider}. + /** + * Set the id of the {@link FieldDecoration} to be used by the local + * {@link ControlDecorationProvider}. * - * @param fieldDecorationId The String to determine the {@link FieldDecoration} to use by the - * {@link ControlDecoration} that is provided by this {@link ControlDecorationProvider}. + * @param fieldDecorationId The String to determine the {@link FieldDecoration} + * to use by the {@link ControlDecoration} that is + * provided by this {@link ControlDecorationProvider}. * - * @see org.eclipse.jface.fieldassist.FieldDecorationRegistry#getFieldDecoration(String) */ + * @see org.eclipse.jface.fieldassist.FieldDecorationRegistry#getFieldDecoration(String) + */ public void setFieldDecorationId(final String fieldDecorationId) { this.decorationProvider.setFieldDecorationId(fieldDecorationId); } - /** Set the position of the control decoration relative to the control. It should include style bits describing both - * the vertical and horizontal orientation. + /** + * Set the position of the control decoration relative to the control. It should + * include style bits describing both the vertical and horizontal orientation. * - * @param decorationPositionOverride bit-wise or of position constants (SWT.TOP, - * SWT.BOTTOM, SWT.LEFT, SWT.RIGHT, and + * @param decorationPositionOverride bit-wise or of position constants + * (SWT.TOP, + * SWT.BOTTOM, + * SWT.LEFT, + * SWT.RIGHT, and * SWT.CENTER). * - * @see ControlDecoration#ControlDecoration(Control, int) */ + * @see ControlDecoration#ControlDecoration(Control, int) + */ public void setDecorationPositionOverride(final int decorationPositionOverride) { this.decorationProvider.setDecorationPositionOverride(decorationPositionOverride); } - /** @return The {@link IEditErrorHandler} that is used for showing conversion errors on typing into this editor. By - * default this is the {@link RenderErrorHandling} which will render the content in the editor red to - * indicate a conversion error. */ + /** + * @return The {@link IEditErrorHandler} that is used for showing conversion + * errors on typing into this editor. By default this is the + * {@link RenderErrorHandling} which will render the content in the + * editor red to indicate a conversion error. + */ public IEditErrorHandler getInputConversionErrorHandler() { return this.inputConversionErrorHandler; } - /** @param inputConversionErrorHandler The {@link IEditErrorHandler} that is should be used for showing conversion - * errors on typing into this editor. */ + /** + * @param inputConversionErrorHandler The {@link IEditErrorHandler} that is + * should be used for showing conversion + * errors on typing into this editor. + */ public void setInputConversionErrorHandler(final IEditErrorHandler inputConversionErrorHandler) { this.inputConversionErrorHandler = inputConversionErrorHandler; } - /** @return The {@link IEditErrorHandler} that is used for showing validation errors on typing into this editor. By - * default this is the {@link RenderErrorHandling} which will render the content in the editor red to - * indicate a validation error. */ + /** + * @return The {@link IEditErrorHandler} that is used for showing validation + * errors on typing into this editor. By default this is the + * {@link RenderErrorHandling} which will render the content in the + * editor red to indicate a validation error. + */ public IEditErrorHandler getInputValidationErrorHandler() { return this.inputValidationErrorHandler; } - /** @param inputValidationErrorHandler The {@link IEditErrorHandler} that is should used for showing validation - * errors on typing into this editor. */ + /** + * @param inputValidationErrorHandler The {@link IEditErrorHandler} that is + * should used for showing validation errors + * on typing into this editor. + */ public void setInputValidationErrorHandler(final IEditErrorHandler inputValidationErrorHandler) { this.inputValidationErrorHandler = inputValidationErrorHandler; } - /** Configure the parameters necessary to create the content proposal adapter on opening an editor. - * - * @param controlContentAdapter the IControlContentAdapter used to obtain and update the control's - * contents as proposals are accepted. May not be null. - * @param proposalProvider the IContentProposalProvider used to obtain content proposals for - * this control, or null if no content proposal is available. - * @param keyStroke the keystroke that will invoke the content proposal popup. If this value is - * null, then proposals will be activated automatically when any of the - * auto activation characters are typed. - * @param autoActivationCharacters An array of characters that trigger auto-activation of content proposal. If - * specified, these characters will trigger auto-activation of the proposal popup, - * regardless of whether an explicit invocation keyStroke was specified. If this - * parameter is null, then only a specified keyStroke will invoke - * content proposal. If this parameter is null and the keyStroke - * parameter is null, then all alphanumeric characters will + /** + * Configure the parameters necessary to create the content proposal adapter on + * opening an editor. + * + * @param controlContentAdapter the IControlContentAdapter used + * to obtain and update the control's contents + * as proposals are accepted. May not be + * null. + * @param proposalProvider the IContentProposalProvider + * used to obtain content proposals for this + * control, or null if no content + * proposal is available. + * @param keyStroke the keystroke that will invoke the content + * proposal popup. If this value is + * null, then proposals will be + * activated automatically when any of the auto + * activation characters are typed. + * @param autoActivationCharacters An array of characters that trigger + * auto-activation of content proposal. If + * specified, these characters will trigger + * auto-activation of the proposal popup, + * regardless of whether an explicit invocation + * keyStroke was specified. If this parameter is + * null, then only a specified + * keyStroke will invoke content proposal. If + * this parameter is null and the + * keyStroke parameter is null, + * then all alphanumeric characters will * auto-activate content proposal. * * @see ContentProposalAdapter - * @since 1.4 */ + * @since 1.4 + */ public void enableContentProposal(final IControlContentAdapter controlContentAdapter, final IContentProposalProvider proposalProvider, final KeyStroke keyStroke, final char[] autoActivationCharacters) { @@ -541,29 +672,47 @@ public void enableContentProposal(final IControlContentAdapter controlContentAda ContentProposalAdapter.PROPOSAL_REPLACE, 0); } - /** Configure the parameters necessary to create the content proposal adapter on opening an editor. - * - * @param controlContentAdapter the IControlContentAdapter used to obtain and update the control's - * contents as proposals are accepted. May not be null. - * @param proposalProvider the IContentProposalProvider used to obtain content proposals for - * this control, or null if no content proposal is available. - * @param keyStroke the keystroke that will invoke the content proposal popup. If this value is - * null, then proposals will be activated automatically when any of the - * auto activation characters are typed. - * @param autoActivationCharacters An array of characters that trigger auto-activation of content proposal. If - * specified, these characters will trigger auto-activation of the proposal popup, - * regardless of whether an explicit invocation keyStroke was specified. If this - * parameter is null, then only a specified keyStroke will invoke - * content proposal. If this parameter is null and the keyStroke - * parameter is null, then all alphanumeric characters will + /** + * Configure the parameters necessary to create the content proposal adapter on + * opening an editor. + * + * @param controlContentAdapter the IControlContentAdapter used + * to obtain and update the control's contents + * as proposals are accepted. May not be + * null. + * @param proposalProvider the IContentProposalProvider + * used to obtain content proposals for this + * control, or null if no content + * proposal is available. + * @param keyStroke the keystroke that will invoke the content + * proposal popup. If this value is + * null, then proposals will be + * activated automatically when any of the auto + * activation characters are typed. + * @param autoActivationCharacters An array of characters that trigger + * auto-activation of content proposal. If + * specified, these characters will trigger + * auto-activation of the proposal popup, + * regardless of whether an explicit invocation + * keyStroke was specified. If this parameter is + * null, then only a specified + * keyStroke will invoke content proposal. If + * this parameter is null and the + * keyStroke parameter is null, + * then all alphanumeric characters will * auto-activate content proposal. - * @param proposalAcceptanceStyle a constant indicating how an accepted proposal should affect the control's - * content. Should be one of PROPOSAL_INSERT, - * PROPOSAL_REPLACE, or PROPOSAL_IGNORE - * @param autoActivationDelay the time in milliseconds that will pass before a popup is automatically opened + * @param proposalAcceptanceStyle a constant indicating how an accepted + * proposal should affect the control's content. + * Should be one of + * PROPOSAL_INSERT, + * PROPOSAL_REPLACE, or + * PROPOSAL_IGNORE + * @param autoActivationDelay the time in milliseconds that will pass + * before a popup is automatically opened * * @see ContentProposalAdapter - * @since 2.0 */ + * @since 2.0 + */ public void enableContentProposal(final IControlContentAdapter controlContentAdapter, final IContentProposalProvider proposalProvider, final KeyStroke keyStroke, final char[] autoActivationCharacters, final int proposalAcceptanceStyle, final int autoActivationDelay) { @@ -586,12 +735,15 @@ public void keyTraversed(final TraverseEvent event) { }; } - /** Adds the listeners necessary for interaction between the control of this StyledTextCellEditor and the - * ContentProposalAdapter. + /** + * Adds the listeners necessary for interaction between the control of this + * StyledTextCellEditor and the ContentProposalAdapter. * - * @param contentProposalAdapter The {@link ContentProposalAdapter} that should be used to add content proposal - * abilities to this {@link StyledTextCellEditor}. - * @since 1.4 */ + * @param contentProposalAdapter The {@link ContentProposalAdapter} that should + * be used to add content proposal abilities to + * this {@link StyledTextCellEditor}. + * @since 1.4 + */ protected void configureContentProposalAdapter(final ContentProposalAdapter contentProposalAdapter) { this.contentProposalAdapter = contentProposalAdapter; @@ -608,15 +760,15 @@ protected void configureContentProposalAdapter(final ContentProposalAdapter cont @Override public void proposalPopupClosed(final ContentProposalAdapter adapter) { - if (StyledTextCellEditor.this.focusListener instanceof InlineFocusListener) { - ((InlineFocusListener) StyledTextCellEditor.this.focusListener).handleFocusChanges = true; + if (StyledTextCellEditor.this.focusListener instanceof final InlineFocusListener inlineFL) { + inlineFL.handleFocusChanges = true; } } @Override public void proposalPopupOpened(final ContentProposalAdapter adapter) { - if (StyledTextCellEditor.this.focusListener instanceof InlineFocusListener) { - ((InlineFocusListener) StyledTextCellEditor.this.focusListener).handleFocusChanges = false; + if (StyledTextCellEditor.this.focusListener instanceof final InlineFocusListener inlineFL) { + inlineFL.handleFocusChanges = false; } } }); @@ -625,65 +777,88 @@ public void proposalPopupOpened(final ContentProposalAdapter adapter) { contentProposalAdapter.setAutoActivationDelay(this.autoActivationDelay); } - /** Return whether this editor should try to commit and close on pressing the ENTER key. The default is - * true. For a multi line text editor, the ENTER key might be used to insert a new line instead of - * committing the value when opened in a dialog. In that case the value should not be committed, as applying the - * dialog will trigger the commit. For inline editors setting {@link #commitWithCtrlKey} to true might - * be interesting in combination with setting this value to true, which means that the commit operation - * is only performed if CTRL + ENTER is pressed. + /** + * Return whether this editor should try to commit and close on pressing the + * ENTER key. The default is true. For a multi line text editor, + * the ENTER key might be used to insert a new line instead of committing the + * value when opened in a dialog. In that case the value should not be + * committed, as applying the dialog will trigger the commit. For inline editors + * setting {@link #commitWithCtrlKey} to true might be interesting + * in combination with setting this value to true, which means that + * the commit operation is only performed if CTRL + ENTER is pressed. * - * @return true if commit and close is performed on pressing the ENTER key, false if - * pressing ENTER does not perform a commit operation. + * @return true if commit and close is performed on pressing the + * ENTER key, false if pressing ENTER does not perform a + * commit operation. * - * @since 1.6 */ + * @since 1.6 + */ public boolean isCommitOnEnter() { return this.commitOnEnter; } - /** Configure whether this editor should try to commit and close on pressing the ENTER key. The default is - * true. For a multi line text editor, the ENTER key might be used to insert a new line instead of - * committing the value when opened in a dialog. In that case the value should not be committed, as applying the - * dialog will trigger the commit. For inline editors setting {@link #commitWithCtrlKey} to true might - * be interesting in combination with setting this value to true, which means that the commit operation - * is only performed if CTRL + ENTER is pressed. + /** + * Configure whether this editor should try to commit and close on pressing the + * ENTER key. The default is true. For a multi line text editor, + * the ENTER key might be used to insert a new line instead of committing the + * value when opened in a dialog. In that case the value should not be + * committed, as applying the dialog will trigger the commit. For inline editors + * setting {@link #commitWithCtrlKey} to true might be interesting + * in combination with setting this value to true, which means that + * the commit operation is only performed if CTRL + ENTER is pressed. * - * @param commitOnEnter true to perform commit and close on pressing the ENTER key, false - * if pressing ENTER should not perform a commit operation. + * @param commitOnEnter true to perform commit and close on + * pressing the ENTER key, false if pressing + * ENTER should not perform a commit operation. * - * @since 1.6 */ + * @since 1.6 + */ public void setCommitOnEnter(final boolean commitOnEnter) { this.commitOnEnter = commitOnEnter; } - /** Return whether this editor should try to commit and close on pressing the ENTER key in combination with the CTRL - * state mask key, or if pressing ENTER solely should work. It is only interpreted with {@link #commitOnEnter} set - * to true, and it is needed for a multi line text editor where a simple enter press should add a new - * line and a combination with CTRL should commit the value. + /** + * Return whether this editor should try to commit and close on pressing the + * ENTER key in combination with the CTRL state mask key, or if pressing ENTER + * solely should work. It is only interpreted with {@link #commitOnEnter} set to + * true, and it is needed for a multi line text editor where a + * simple enter press should add a new line and a combination with CTRL should + * commit the value. * - * @return true if committing via pressing the ENTER key is only working with the CTRL state mask key - * pressed. false if pressing the ENTER key solely is performing the commit. + * @return true if committing via pressing the ENTER key is only + * working with the CTRL state mask key pressed. false if + * pressing the ENTER key solely is performing the commit. * - * @since 1.6 */ + * @since 1.6 + */ public boolean isCommitWithCtrlKey() { return this.commitWithCtrlKey; } - /** Configure whether this editor should try to commit and close on pressing the ENTER key in combination with the - * CTRL state mask key, or if pressing ENTER solely should work. It is only interpreted with {@link #commitOnEnter} - * set to true, and it is needed for a multi line text editor where a simple enter press should add a - * new line and a combination with CTRL should commit the value. + /** + * Configure whether this editor should try to commit and close on pressing the + * ENTER key in combination with the CTRL state mask key, or if pressing ENTER + * solely should work. It is only interpreted with {@link #commitOnEnter} set to + * true, and it is needed for a multi line text editor where a + * simple enter press should add a new line and a combination with CTRL should + * commit the value. * - * @param commitWithCtrlKey true if committing via pressing the ENTER key should only work with the - * CTRL state mask key pressed. false if pressing the ENTER key solely should - * perform the commit. + * @param commitWithCtrlKey true if committing via pressing the + * ENTER key should only work with the CTRL state mask + * key pressed. false if pressing the + * ENTER key solely should perform the commit. * - * @since 1.6 */ + * @since 1.6 + */ public void setCommitWithCtrlKey(final boolean commitWithCtrlKey) { this.commitWithCtrlKey = commitWithCtrlKey; } - /** @return true if a {@link ContentProposalAdapter} is active and the proposal popup is open. - * @since 2.0 */ + /** + * @return true if a {@link ContentProposalAdapter} is active and + * the proposal popup is open. + * @since 2.0 + */ protected boolean isProposalPopupOpen() { return this.contentProposalAdapter != null && this.contentProposalAdapter.isProposalPopupOpen(); } diff --git a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/nat/VarDeclarationConfigLabelAccumulator.java b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/nat/VarDeclarationConfigLabelAccumulator.java index 9bd0095766..c95990da6e 100644 --- a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/nat/VarDeclarationConfigLabelAccumulator.java +++ b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/nat/VarDeclarationConfigLabelAccumulator.java @@ -84,6 +84,7 @@ public void accumulateConfigLabels(final LabelStack configLabels, final int colu break; case RETAIN: configLabels.addLabelOnTop(NatTableWidgetFactory.RETAIN_CONFIG_CELL); + break; default: break; } diff --git a/plugins/org.eclipse.fordiac.ide.library.ui/src/org/eclipse/fordiac/ide/library/ui/editors/ManifestEditor.java b/plugins/org.eclipse.fordiac.ide.library.ui/src/org/eclipse/fordiac/ide/library/ui/editors/ManifestEditor.java index f6881f174c..76e276d69d 100644 --- a/plugins/org.eclipse.fordiac.ide.library.ui/src/org/eclipse/fordiac/ide/library/ui/editors/ManifestEditor.java +++ b/plugins/org.eclipse.fordiac.ide.library.ui/src/org/eclipse/fordiac/ide/library/ui/editors/ManifestEditor.java @@ -21,12 +21,12 @@ public class ManifestEditor extends FormEditor { private TextEditor textEditor; - private ManifestUpdateFormPage updatePage; @Override protected void addPages() { textEditor = new TextEditor(); - updatePage = new ManifestUpdateFormPage(this, "updateFormPage", "Update Dependencies"); //$NON-NLS-1$ //$NON-NLS-2$ + final ManifestUpdateFormPage updatePage = new ManifestUpdateFormPage(this, "updateFormPage", //$NON-NLS-1$ + "Update Dependencies"); //$NON-NLS-1$ try { final int index = addPage(textEditor, getEditorInput()); diff --git a/plugins/org.eclipse.fordiac.ide.library.ui/src/org/eclipse/fordiac/ide/library/ui/wizards/LibrarySelectionPage.java b/plugins/org.eclipse.fordiac.ide.library.ui/src/org/eclipse/fordiac/ide/library/ui/wizards/LibrarySelectionPage.java index 1d64fdc324..7496067864 100644 --- a/plugins/org.eclipse.fordiac.ide.library.ui/src/org/eclipse/fordiac/ide/library/ui/wizards/LibrarySelectionPage.java +++ b/plugins/org.eclipse.fordiac.ide.library.ui/src/org/eclipse/fordiac/ide/library/ui/wizards/LibrarySelectionPage.java @@ -49,8 +49,6 @@ public class LibrarySelectionPage extends WizardPage { private List libraries; private Map> libGroupings; private CheckboxTableViewer tableViewer; - private Button selectAllButton; - private Button deselectButton; private boolean showStandard; private boolean showWorkspace; private final boolean selectAll; @@ -150,10 +148,9 @@ public Map getChosenLibraries() { private void selectAll() { deselectAll(); final VersionComparator comparator = new VersionComparator(); - libGroupings.forEach((symb, list) -> { - list.stream().max((l1, l2) -> comparator.compare(l1.getVersion(), l2.getVersion())) - .ifPresent(lib -> lib.setSelected(true)); - }); + libGroupings.forEach( + (symb, list) -> list.stream().max((l1, l2) -> comparator.compare(l1.getVersion(), l2.getVersion())) + .ifPresent(lib -> lib.setSelected(true))); } private void deselectAll() { @@ -257,12 +254,12 @@ private TableLayout createTableLayout() { private void createButtons(final Composite buttonComposite) { - selectAllButton = new Button(buttonComposite, SWT.PUSH); + final Button selectAllButton = new Button(buttonComposite, SWT.PUSH); selectAllButton.setFont(buttonComposite.getFont()); selectAllButton.setText(Messages.LibraryPage_SelectAll); setButtonLayoutData(selectAllButton); - deselectButton = new Button(buttonComposite, SWT.PUSH); + final Button deselectButton = new Button(buttonComposite, SWT.PUSH); deselectButton.setFont(buttonComposite.getFont()); deselectButton.setText(Messages.LibraryPage_DeselectAll); setButtonLayoutData(deselectButton); diff --git a/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/change/UpdatePinInTypeDeclarationCommand.java b/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/change/UpdatePinInTypeDeclarationCommand.java index a550177791..ac4556a11f 100644 --- a/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/change/UpdatePinInTypeDeclarationCommand.java +++ b/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/change/UpdatePinInTypeDeclarationCommand.java @@ -34,10 +34,9 @@ public boolean canExecute() { @Override public void execute() { - fbType.getInterfaceList().getAllInterfaceElements().stream().filter(VarDeclaration.class::isInstance) - .map(VarDeclaration.class::cast).filter(i -> i.getType().getTypeEntry() == dataTypeEntry) - .forEach(el -> { - el.setType(dataTypeEntry.getTypeEditable()); - }); + fbType.getInterfaceList().getAllInterfaceElements().stream() // + .filter(VarDeclaration.class::isInstance).map(VarDeclaration.class::cast) // + .filter(i -> i.getType().getTypeEntry() == dataTypeEntry) // + .forEach(el -> el.setType(dataTypeEntry.getTypeEditable())); } } \ No newline at end of file diff --git a/plugins/org.eclipse.fordiac.ide.model.search/src/org/eclipse/fordiac/ide/model/search/ModelSearchQuery.java b/plugins/org.eclipse.fordiac.ide.model.search/src/org/eclipse/fordiac/ide/model/search/ModelSearchQuery.java index 35224ba8a2..0850081bed 100644 --- a/plugins/org.eclipse.fordiac.ide.model.search/src/org/eclipse/fordiac/ide/model/search/ModelSearchQuery.java +++ b/plugins/org.eclipse.fordiac.ide.model.search/src/org/eclipse/fordiac/ide/model/search/ModelSearchQuery.java @@ -185,9 +185,7 @@ private void searchResources(final AutomationSystem sys) { private boolean matchTypeEntry(final LibraryElement elem) { switch (elem) { - case final CompositeFBType comp -> { - searchFBNetwork(comp.getFBNetwork(), new ArrayList<>()); - } + case final CompositeFBType comp -> searchFBNetwork(comp.getFBNetwork(), new ArrayList<>()); case final BaseFBType type -> { for (final FB fb : type.getInternalFbs()) { if (matchEObject(fb)) { @@ -216,9 +214,7 @@ private boolean matchTypeEntry(final LibraryElement elem) { searchResult.addResult(base); } } - case final StructuredType struct -> { - matchStruct(struct); - } + case final StructuredType struct -> matchStruct(struct); case final AttributeDeclaration attDecl -> { if (attDecl.getType() instanceof final StructuredType struct) { matchStruct(struct); diff --git a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/dataimport/FBTImporter.java b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/dataimport/FBTImporter.java index c35fb5d5a8..98f1b4e7ee 100644 --- a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/dataimport/FBTImporter.java +++ b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/dataimport/FBTImporter.java @@ -65,7 +65,6 @@ import org.eclipse.fordiac.ide.model.libraryElement.STAlgorithm; import org.eclipse.fordiac.ide.model.libraryElement.STMethod; import org.eclipse.fordiac.ide.model.libraryElement.ServiceInterface; -import org.eclipse.fordiac.ide.model.libraryElement.ServiceInterfaceFBType; import org.eclipse.fordiac.ide.model.libraryElement.ServiceSequence; import org.eclipse.fordiac.ide.model.libraryElement.ServiceTransaction; import org.eclipse.fordiac.ide.model.libraryElement.SimpleFBType; @@ -346,19 +345,6 @@ private void parseInputPrimitive(final ServiceTransaction serviceTransaction, fi serviceTransaction.setInputPrimitive(inputPrimitive); } - /** - * This method converts a FBType to a ServiceInterfaceFBType. - * - * @param type - The FBType that is being converted to ServiceInterfaceFBType - * - * @return - A FBType that is converted - */ - private static FBType convertToServiceInterfaceType(final FBType type) { - final ServiceInterfaceFBType serviceType = LibraryElementFactory.eINSTANCE.createServiceInterfaceFBType(); - copyGeneralTypeInformation(serviceType, type); - return serviceType; - } - private static void copyGeneralTypeInformation(final FBType dstType, final FBType srcType) { dstType.setName(srcType.getName()); dstType.setComment(srcType.getComment()); diff --git a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/helpers/FBShapeHelper.java b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/helpers/FBShapeHelper.java index 3e02a1c8ae..480684479e 100644 --- a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/helpers/FBShapeHelper.java +++ b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/helpers/FBShapeHelper.java @@ -101,7 +101,7 @@ private static int getInterfaceCharacters(final FBNetworkElement element, final int pinLabelSize = element.getInterface().getAllInterfaceElements().stream() .filter(IInterfaceElement::isVisible).filter(filter).map(IInterfaceElement::getName) .mapToInt(String::length).max().orElse(0); - return Math.min(Math.max(pinLabelSize, minPinLabelSize), maxPinLabelSize + 1); + return Math.clamp(pinLabelSize, minPinLabelSize, maxPinLabelSize + 1); } private static int getTypeNameCharacters(final FBNetworkElement element) { diff --git a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/libraryElement/impl/FBNetworkAnnotations.java b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/libraryElement/impl/FBNetworkAnnotations.java index ef2eeca95b..0c753b04c5 100644 --- a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/libraryElement/impl/FBNetworkAnnotations.java +++ b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/libraryElement/impl/FBNetworkAnnotations.java @@ -82,7 +82,7 @@ static boolean validateCollisions(final Optional parent, final int marginTopBottom = (int) (getIntPreference(context, PreferenceConstants.MARGIN_TOP_BOTTOM) * lineHeight); final int cellSize = (int) (CELL_SIZE * lineHeight); - final int gridSize = Math.min(Math.max(networkElements.size(), GRID_SIZE_MIN), GRID_SIZE_MAX); + final int gridSize = Math.clamp(networkElements.size(), GRID_SIZE_MIN, GRID_SIZE_MAX); final SpatialHash spatialHash = new SpatialHash<>(cellSize, gridSize); for (final FBNetworkElement element : networkElements) { if (element instanceof ErrorMarkerFBNElement || !filter.test(element)) { diff --git a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/libraryElement/impl/OutMappedInOutVarAdapter.java b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/libraryElement/impl/OutMappedInOutVarAdapter.java index 093e83d8d0..a42074a4ae 100644 --- a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/libraryElement/impl/OutMappedInOutVarAdapter.java +++ b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/libraryElement/impl/OutMappedInOutVarAdapter.java @@ -96,13 +96,8 @@ private void handleVarDeclarationNotifications(final Notification notification, } private void handleArraySizeNotifications(final Notification notification, final ArraySize arraySize) { - switch (notification.getFeatureID(ArraySize.class)) { - case LibraryElementPackage.ARRAY_SIZE__VALUE: + if (notification.getFeatureID(ArraySize.class) == LibraryElementPackage.ARRAY_SIZE__VALUE) { outMappedInOutVar.getArraySize().setValue(arraySize.getValue()); - break; - default: - // we don't want to copy anything for the other features - break; } } diff --git a/plugins/org.eclipse.fordiac.ide.structuredtextfunctioneditor.tests/src/org/eclipse/fordiac/ide/structuredtextfunctioneditor/tests/STFunctionCommentAssociaterTest.java b/plugins/org.eclipse.fordiac.ide.structuredtextfunctioneditor.tests/src/org/eclipse/fordiac/ide/structuredtextfunctioneditor/tests/STFunctionCommentAssociaterTest.java index c47a447371..7f47c77b7f 100644 --- a/plugins/org.eclipse.fordiac.ide.structuredtextfunctioneditor.tests/src/org/eclipse/fordiac/ide/structuredtextfunctioneditor/tests/STFunctionCommentAssociaterTest.java +++ b/plugins/org.eclipse.fordiac.ide.structuredtextfunctioneditor.tests/src/org/eclipse/fordiac/ide/structuredtextfunctioneditor/tests/STFunctionCommentAssociaterTest.java @@ -34,7 +34,7 @@ @ExtendWith(InjectionExtension.class) @InjectWith(STFunctionInjectorProvider.class) -@SuppressWarnings("nls") +@SuppressWarnings({ "nls", "squid:S2479" }) class STFunctionCommentAssociaterTest { private static final Pattern SL_COMMENT_PATTERN = Pattern.compile("// (\\w+) (.*)\\R"); //$NON-NLS-1$ diff --git a/plugins/org.eclipse.fordiac.ide.subapptypeeditor/src/org/eclipse/fordiac/ide/subapptypeeditor/editors/SubAppNetworkBreadCrumbEditor.java b/plugins/org.eclipse.fordiac.ide.subapptypeeditor/src/org/eclipse/fordiac/ide/subapptypeeditor/editors/SubAppNetworkBreadCrumbEditor.java index 67f8537d9c..dd8566a63c 100644 --- a/plugins/org.eclipse.fordiac.ide.subapptypeeditor/src/org/eclipse/fordiac/ide/subapptypeeditor/editors/SubAppNetworkBreadCrumbEditor.java +++ b/plugins/org.eclipse.fordiac.ide.subapptypeeditor/src/org/eclipse/fordiac/ide/subapptypeeditor/editors/SubAppNetworkBreadCrumbEditor.java @@ -29,7 +29,6 @@ import org.eclipse.fordiac.ide.model.libraryElement.FBNetwork; import org.eclipse.fordiac.ide.model.libraryElement.FBNetworkElement; import org.eclipse.fordiac.ide.model.libraryElement.FBType; -import org.eclipse.fordiac.ide.model.libraryElement.MemberVarDeclaration; import org.eclipse.fordiac.ide.model.libraryElement.SubApp; import org.eclipse.fordiac.ide.model.libraryElement.SubAppType; import org.eclipse.fordiac.ide.model.libraryElement.VarDeclaration; diff --git a/plugins/org.eclipse.fordiac.ide.subapptypeeditor/src/org/eclipse/fordiac/ide/subapptypeeditor/properties/FBSubappTypePropertiesFilter.java b/plugins/org.eclipse.fordiac.ide.subapptypeeditor/src/org/eclipse/fordiac/ide/subapptypeeditor/properties/FBSubappTypePropertiesFilter.java index 28087b036b..0bfeffc249 100644 --- a/plugins/org.eclipse.fordiac.ide.subapptypeeditor/src/org/eclipse/fordiac/ide/subapptypeeditor/properties/FBSubappTypePropertiesFilter.java +++ b/plugins/org.eclipse.fordiac.ide.subapptypeeditor/src/org/eclipse/fordiac/ide/subapptypeeditor/properties/FBSubappTypePropertiesFilter.java @@ -20,7 +20,6 @@ public class FBSubappTypePropertiesFilter extends FBTypePropertiesFilter { @Override public boolean select(final Object toTest) { - final Object retval = getFBTypeFromSelectedElement(toTest); - return retval != null && (retval instanceof SubAppType); + return (getFBTypeFromSelectedElement(toTest) instanceof SubAppType); } } diff --git a/plugins/org.eclipse.fordiac.ide.systemmanagement/src/org/eclipse/fordiac/ide/systemmanagement/SystemManager.java b/plugins/org.eclipse.fordiac.ide.systemmanagement/src/org/eclipse/fordiac/ide/systemmanagement/SystemManager.java index 3f3b64ae77..2d01d91a4a 100644 --- a/plugins/org.eclipse.fordiac.ide.systemmanagement/src/org/eclipse/fordiac/ide/systemmanagement/SystemManager.java +++ b/plugins/org.eclipse.fordiac.ide.systemmanagement/src/org/eclipse/fordiac/ide/systemmanagement/SystemManager.java @@ -68,8 +68,6 @@ public enum SystemManager { INSTANCE; - private static final String PLUGIN_ID = "org.eclipse.fordiac.ide.systemmanagement"; //$NON-NLS-1$ - public static final String FORDIAC_PROJECT_NATURE_ID = "org.eclipse.fordiac.ide.systemmanagement.FordiacNature"; //$NON-NLS-1$ public static final String ROBOT_PROJECT_NATURE_ID = "org.robotframework.ide.eclipse.main.plugin.robotNature"; //$NON-NLS-1$ public static final String OLD_DISTRIBUTED_PROJECT_NATURE_ID = "org.fordiac.systemManagement.DistributedNature"; //$NON-NLS-1$ @@ -113,9 +111,7 @@ public IProject createNew4diacProject(final String projectName, final IPath loca final IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName()); final Map includes = new HashMap<>(); - includedLibraries.forEach((key, value) -> { - includes.put(key.getSymbolicName(), value); - }); + includedLibraries.forEach((key, value) -> includes.put(key.getSymbolicName(), value)); if (!Platform.getLocation().equals(location)) { description.setLocation(location); diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/Messages.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/Messages.java index f98560f429..4cada9a9d8 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/Messages.java +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/Messages.java @@ -68,6 +68,37 @@ public final class Messages extends NLS { public static String CommandUndoChange_CannotUndoCommand; + public static String ConnectionsToStructRefactoring_ChangeName; + public static String ConnectionsToStructRefactoring_CheckPreconditions; + public static String ConnectionsToStructRefactoring_IncompatibleStructType; + public static String ConnectionsToStructRefactoring_InvalidName; + public static String ConnectionsToStructRefactoring_InvalidType; + public static String ConnectionsToStructRefactoring_NameExists; + public static String ConnectionsToStructRefactoring_ProgressText; + public static String ConnectionsToStructRefactoring_RefactoringTitle; + public static String ConnectionsToStructRefactoring_SameFBSameName; + public static String ConnectionsToStructRefactoring_SelectionIsNoStruct; + public static String ConnectionsToStructRefactoring_EventConflict; + public static String ConnectionsToStructRefactoring_IsServiceFB; + public static String ConnectionsToStructRefactoring_NoFB; + public static String ConnectionsToStructRefactoring_PortsNoMatch; + public static String ConnectionsToStructRefactoring_StructExists; + public static String ConnectionsToStructRefactoring_Source; + public static String ConnectionsToStructRefactoring_Destination; + public static String ConnectionsToStructRefactoring_Output; + public static String ConnectionsToStructRefactoring_Input; + public static String ConnectionsToStructRefactoring_MissingStructManipulator; + public static String CreateStructChange_Name; + public static String RepairBrokenConnectionChange_Name; + public static String ReplaceVarsWithStructChange_Inputs; + public static String ReplaceVarsWithStructChange_Outputs; + public static String ReplaceVarsWithStructChange_Replace; + public static String ReplaceVarsWithStructChange_Struct; + public static String SystemConnectStructChange_Name; + public static String SystemUpdateFBChange_Name; + public static String ConnectionsToStructRefactoring_FBNotInSystem; + public static String ReplaceVarsWithStructChange_NotContained; + public static String DataTypeChange_TypeDeclarationChanged; public static String DeleteFBTypeParticipant_Name; diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/messages.properties b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/messages.properties index ecd523d3e4..7af101fc24 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/messages.properties +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/messages.properties @@ -37,6 +37,37 @@ BuildPathPropertyPage_SaveError=Error Saving Build Path Configuration BuildPathPropertyPage_Toggle=Toggle CommandRedoChange_CannotRedoCommand=Cannot redo command CommandUndoChange_CannotUndoCommand=Cannot undo command +ConnectionsToStructRefactoring_ChangeName=Convert Connections To Struct +ConnectionsToStructRefactoring_CheckPreconditions=Checking preconditions... +ConnectionsToStructRefactoring_DestinationIsServiceFB=Destination FB is Service Interface\! +ConnectionsToStructRefactoring_IncompatibleStructType=Incompatible Structured Type +ConnectionsToStructRefactoring_InvalidName=Invalid {0} Name\! +ConnectionsToStructRefactoring_InvalidType=Invalid Type selected\! +ConnectionsToStructRefactoring_NameExists={0} Name already exists\! +ConnectionsToStructRefactoring_ProgressText=Converting Connections To Struct +ConnectionsToStructRefactoring_RefactoringTitle=Replace multiple Data Connections with Struct +ConnectionsToStructRefactoring_SameFBSameName=Input Name cannot match Output name on the same FB +ConnectionsToStructRefactoring_SelectionIsNoStruct=Selected type is no Structured Type\! +ConnectionsToStructRefactoring_EventConflict={0} pins must all be dependent on the same Events +ConnectionsToStructRefactoring_IsServiceFB={0} FB is Service Interface\! +ConnectionsToStructRefactoring_NoFB={0} is no FBType\! +ConnectionsToStructRefactoring_PortsNoMatch={0} pins do not match\! +ConnectionsToStructRefactoring_StructExists=Structured Type already exists +ConnectionsToStructRefactoring_Source=Source +ConnectionsToStructRefactoring_Destination=Destination +ConnectionsToStructRefactoring_Output=Output +ConnectionsToStructRefactoring_Input=Input +ConnectionsToStructRefactoring_MissingStructManipulator=Missing StructManipulator +CreateStructChange_Name=: Create new Structured Type +RepairBrokenConnectionChange_Name=: Repair broken Connections +ReplaceVarsWithStructChange_Inputs=Inputs +ReplaceVarsWithStructChange_Outputs=Outputs +ReplaceVarsWithStructChange_Replace=: Replace +ReplaceVarsWithStructChange_Struct=\ with new Struct +SystemConnectStructChange_Name=: Connect identical Patterns with Struct Connection +SystemUpdateFBChange_Name=: Update Instances +ConnectionsToStructRefactoring_FBNotInSystem= FB URI is not in the target system +ReplaceVarsWithStructChange_NotContained= is not contained in DeleteFBTypeParticipant_Name=Delete IEC 61499 Type DeleteFBTypeParticipant_TypeInUseWarning=FB type {0} is used in the following types: {1} DeleteFBTypeParticipant_Change_DeleteFBTypeInterface=Update FB type interface: {0} diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/ReconnectPinChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/ReconnectPinChange.java index 5d9c11f835..66a81f0fc4 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/ReconnectPinChange.java +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/ReconnectPinChange.java @@ -14,6 +14,7 @@ package org.eclipse.fordiac.ide.typemanagement.refactoring; import java.util.EnumSet; +import java.util.Set; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -92,10 +93,10 @@ class ReconnectPinByName extends Command { final String newName; final FBNetworkElement element; final CompoundCommand cmds = new CompoundCommand(); - private final EnumSet state; + private final Set state; public ReconnectPinByName(final String oldName, final String newName, final FBNetworkElement fbNeworkElement, - final EnumSet state) { + final Set state) { this.oldName = oldName; this.newName = newName; this.element = fbNeworkElement; diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/ConnectionsToStructRefactoring.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/ConnectionsToStructRefactoring.java index 9b96c5b726..1ddb20019e 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/ConnectionsToStructRefactoring.java +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/ConnectionsToStructRefactoring.java @@ -44,6 +44,7 @@ import org.eclipse.fordiac.ide.model.typelibrary.TypeEntry; import org.eclipse.fordiac.ide.model.typelibrary.TypeLibrary; import org.eclipse.fordiac.ide.model.typelibrary.TypeLibraryManager; +import org.eclipse.fordiac.ide.typemanagement.Messages; import org.eclipse.fordiac.ide.typemanagement.refactoring.CommandCompositeChange; import org.eclipse.ltk.core.refactoring.Change; import org.eclipse.ltk.core.refactoring.CompositeChange; diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/CreateStructChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/CreateStructChange.java index 274512690f..1e36081c67 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/CreateStructChange.java +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/CreateStructChange.java @@ -29,6 +29,7 @@ import org.eclipse.fordiac.ide.model.libraryElement.VarDeclaration; import org.eclipse.fordiac.ide.model.typelibrary.TypeEntry; import org.eclipse.fordiac.ide.model.typelibrary.TypeLibraryManager; +import org.eclipse.fordiac.ide.typemanagement.Messages; import org.eclipse.fordiac.ide.typemanagement.preferences.TypeManagementPreferencesHelper; import org.eclipse.ltk.core.refactoring.Change; import org.eclipse.ltk.core.refactoring.RefactoringStatus; diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/Messages.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/Messages.java deleted file mode 100644 index 21cca2f0a4..0000000000 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/Messages.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2024 Primetals Technologies Austria GmbH - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Mathias Garstenauer - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.fordiac.ide.typemanagement.refactoring.connection; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = Messages.class.getPackageName() + ".messages"; //$NON-NLS-1$ - public static String ConnectionsToStructRefactoring_ChangeName; - public static String ConnectionsToStructRefactoring_CheckPreconditions; - public static String ConnectionsToStructRefactoring_IncompatibleStructType; - public static String ConnectionsToStructRefactoring_InvalidName; - public static String ConnectionsToStructRefactoring_InvalidType; - public static String ConnectionsToStructRefactoring_NameExists; - public static String ConnectionsToStructRefactoring_ProgressText; - public static String ConnectionsToStructRefactoring_RefactoringTitle; - public static String ConnectionsToStructRefactoring_SameFBSameName; - public static String ConnectionsToStructRefactoring_SelectionIsNoStruct; - public static String ConnectionsToStructRefactoring_EventConflict; - public static String ConnectionsToStructRefactoring_IsServiceFB; - public static String ConnectionsToStructRefactoring_NoFB; - public static String ConnectionsToStructRefactoring_PortsNoMatch; - public static String ConnectionsToStructRefactoring_StructExists; - public static String ConnectionsToStructRefactoring_Source; - public static String ConnectionsToStructRefactoring_Destination; - public static String ConnectionsToStructRefactoring_Output; - public static String ConnectionsToStructRefactoring_Input; - public static String ConnectionsToStructRefactoring_MissingStructManipulator; - public static String CreateStructChange_Name; - public static String RepairBrokenConnectionChange_Name; - public static String ReplaceVarsWithStructChange_Inputs; - public static String ReplaceVarsWithStructChange_Outputs; - public static String ReplaceVarsWithStructChange_Replace; - public static String ReplaceVarsWithStructChange_Struct; - public static String SystemConnectStructChange_Name; - public static String SystemUpdateFBChange_Name; - public static String ConnectionsToStructRefactoring_FBNotInSystem; - public static String ReplaceVarsWithStructChange_NotContained; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/ReplaceVarsWithStructChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/ReplaceVarsWithStructChange.java index 0e83b4e8ce..f05a876217 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/ReplaceVarsWithStructChange.java +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/ReplaceVarsWithStructChange.java @@ -22,6 +22,7 @@ import org.eclipse.fordiac.ide.model.data.StructuredType; import org.eclipse.fordiac.ide.model.libraryElement.FBType; import org.eclipse.fordiac.ide.model.typelibrary.TypeLibraryManager; +import org.eclipse.fordiac.ide.typemanagement.Messages; import org.eclipse.fordiac.ide.typemanagement.refactoring.AbstractCommandChange; import org.eclipse.fordiac.ide.typemanagement.refactoring.connection.commands.ReplaceVarsWithStructCommand; import org.eclipse.gef.commands.Command; diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemConnectStructChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemConnectStructChange.java index df78d78d2b..796106c94b 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemConnectStructChange.java +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemConnectStructChange.java @@ -24,6 +24,7 @@ import org.eclipse.fordiac.ide.model.commands.delete.DeleteConnectionCommand; import org.eclipse.fordiac.ide.model.libraryElement.AutomationSystem; import org.eclipse.fordiac.ide.model.libraryElement.FBNetworkElement; +import org.eclipse.fordiac.ide.typemanagement.Messages; import org.eclipse.fordiac.ide.typemanagement.refactoring.AbstractCommandChange; import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.CompoundCommand; diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemRepairBrokenConnectionChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemRepairBrokenConnectionChange.java index 89e4b9db62..e9f7f089d2 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemRepairBrokenConnectionChange.java +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemRepairBrokenConnectionChange.java @@ -29,6 +29,7 @@ import org.eclipse.fordiac.ide.model.libraryElement.ErrorMarkerInterface; import org.eclipse.fordiac.ide.model.libraryElement.FBNetworkElement; import org.eclipse.fordiac.ide.model.typelibrary.TypeLibraryManager; +import org.eclipse.fordiac.ide.typemanagement.Messages; import org.eclipse.fordiac.ide.typemanagement.refactoring.AbstractCommandChange; import org.eclipse.fordiac.ide.typemanagement.refactoring.connection.commands.RepairBrokenConnectionCommand; import org.eclipse.gef.commands.Command; diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemUpdateFBChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemUpdateFBChange.java index fcc7f3b315..c142d4ad9f 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemUpdateFBChange.java +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/SystemUpdateFBChange.java @@ -22,6 +22,7 @@ import org.eclipse.fordiac.ide.model.commands.change.UpdateFBTypeCommand; import org.eclipse.fordiac.ide.model.libraryElement.AutomationSystem; import org.eclipse.fordiac.ide.model.libraryElement.FBNetworkElement; +import org.eclipse.fordiac.ide.typemanagement.Messages; import org.eclipse.fordiac.ide.typemanagement.refactoring.AbstractCommandChange; import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.CompoundCommand; diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/messages.properties b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/messages.properties deleted file mode 100644 index c21f174db0..0000000000 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/connection/messages.properties +++ /dev/null @@ -1,31 +0,0 @@ -ConnectionsToStructRefactoring_ChangeName=Convert Connections To Struct -ConnectionsToStructRefactoring_CheckPreconditions=Checking preconditions... -ConnectionsToStructRefactoring_DestinationIsServiceFB=Destination FB is Service Interface\! -ConnectionsToStructRefactoring_IncompatibleStructType=Incompatible Structured Type -ConnectionsToStructRefactoring_InvalidName=Invalid {0} Name\! -ConnectionsToStructRefactoring_InvalidType=Invalid Type selected\! -ConnectionsToStructRefactoring_NameExists={0} Name already exists\! -ConnectionsToStructRefactoring_ProgressText=Converting Connections To Struct -ConnectionsToStructRefactoring_RefactoringTitle=Replace multiple Data Connections with Struct -ConnectionsToStructRefactoring_SameFBSameName=Input Name cannot match Output name on the same FB -ConnectionsToStructRefactoring_SelectionIsNoStruct=Selected type is no Structured Type\! -ConnectionsToStructRefactoring_EventConflict={0} pins must all be dependent on the same Events -ConnectionsToStructRefactoring_IsServiceFB={0} FB is Service Interface\! -ConnectionsToStructRefactoring_NoFB={0} is no FBType\! -ConnectionsToStructRefactoring_PortsNoMatch={0} pins do not match\! -ConnectionsToStructRefactoring_StructExists=Structured Type already exists -ConnectionsToStructRefactoring_Source=Source -ConnectionsToStructRefactoring_Destination=Destination -ConnectionsToStructRefactoring_Output=Output -ConnectionsToStructRefactoring_Input=Input -ConnectionsToStructRefactoring_MissingStructManipulator=Missing StructManipulator -CreateStructChange_Name=: Create new Structured Type -RepairBrokenConnectionChange_Name=: Repair broken Connections -ReplaceVarsWithStructChange_Inputs=Inputs -ReplaceVarsWithStructChange_Outputs=Outputs -ReplaceVarsWithStructChange_Replace=: Replace -ReplaceVarsWithStructChange_Struct=\ with new Struct -SystemConnectStructChange_Name=: Connect identical Patterns with Struct Connection -SystemUpdateFBChange_Name=: Update Instances -ConnectionsToStructRefactoring_FBNotInSystem= FB URI is not in the target system -ReplaceVarsWithStructChange_NotContained= is not contained in diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/delete/SafeFBTypeDeletionChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/delete/SafeFBTypeDeletionChange.java index cddd0c327e..cb037b5bcd 100644 --- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/delete/SafeFBTypeDeletionChange.java +++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/delete/SafeFBTypeDeletionChange.java @@ -32,7 +32,6 @@ import org.eclipse.fordiac.ide.model.typelibrary.TypeLibrary; import org.eclipse.fordiac.ide.typemanagement.Messages; import org.eclipse.fordiac.ide.typemanagement.refactoring.IFordiacPreviewChange; -import org.eclipse.fordiac.ide.typemanagement.refactoring.IFordiacPreviewChange.ChangeState; import org.eclipse.gef.commands.Command; import org.eclipse.ltk.core.refactoring.Change; import org.eclipse.ltk.core.refactoring.CompositeChange; diff --git a/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/FordiacMessages.java b/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/FordiacMessages.java index 30c4a40d25..02947670a3 100644 --- a/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/FordiacMessages.java +++ b/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/FordiacMessages.java @@ -22,6 +22,7 @@ import org.eclipse.osgi.util.NLS; /** The Class Messages. */ +@SuppressWarnings("squid:S3008") // tell sonar the java naming convention does not make sense for this class public final class FordiacMessages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.fordiac.ide.ui.messages"; //$NON-NLS-1$ diff --git a/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/handlers/ContributeHandler.java b/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/handlers/ContributeHandler.java index 6261fa8885..7591069974 100644 --- a/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/handlers/ContributeHandler.java +++ b/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/handlers/ContributeHandler.java @@ -13,7 +13,8 @@ package org.eclipse.fordiac.ide.ui.handlers; import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; @@ -35,8 +36,8 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { IWebBrowser browser; try { browser = activeWorkbenchWindow.getWorkbench().getBrowserSupport().createBrowser(getClass().getName()); - browser.openURL(new URL(FORDIAC_CONTRIBUTION_URL)); - } catch (PartInitException | MalformedURLException e) { + browser.openURL(new URI(FORDIAC_CONTRIBUTION_URL).toURL()); + } catch (PartInitException | MalformedURLException | URISyntaxException e) { FordiacLogHelper.logError("Error in opening the 4diac contribution web-page!", e); //$NON-NLS-1$ } } diff --git a/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/widget/StyledTextCellEditor.java b/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/widget/StyledTextCellEditor.java index 65f0528d43..2b85988e57 100644 --- a/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/widget/StyledTextCellEditor.java +++ b/plugins/org.eclipse.fordiac.ide.ui/src/org/eclipse/fordiac/ide/ui/widget/StyledTextCellEditor.java @@ -33,7 +33,9 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -/** A cell editor that manages a text entry field. The cell editor's value is the text string itself. +/** + * A cell editor that manages a text entry field. The cell editor's value is the + * text string itself. *

* This class may be instantiated or subclassed. *

@@ -52,38 +54,51 @@ public class StyledTextCellEditor extends CellEditor { private boolean isSelectable = false; - /** Default StyledTextCellEditor style specify no borders on text widget as cell outline in table already provides - * the look of a border. */ - private static final int defaultStyle = SWT.SINGLE; + /** + * Default StyledTextCellEditor style specify no borders on text widget as cell + * outline in table already provides the look of a border. + */ + private static final int DEFAULT_STYLE = SWT.SINGLE; - /** Creates a new text string cell editor with no control The cell editor value is the string itself, which is - * initially the empty string. Initially, the cell editor has no cell validator. + /** + * Creates a new text string cell editor with no control The cell editor value + * is the string itself, which is initially the empty string. Initially, the + * cell editor has no cell validator. * - * @since 2.1 */ + * @since 2.1 + */ public StyledTextCellEditor() { - setStyle(defaultStyle); + setStyle(DEFAULT_STYLE); } - /** Creates a new text string cell editor parented under the given control. The cell editor value is the string - * itself, which is initially the empty string. Initially, the cell editor has no cell validator. + /** + * Creates a new text string cell editor parented under the given control. The + * cell editor value is the string itself, which is initially the empty string. + * Initially, the cell editor has no cell validator. * - * @param parent the parent control */ + * @param parent the parent control + */ public StyledTextCellEditor(final Composite parent) { - this(parent, defaultStyle); + this(parent, DEFAULT_STYLE); } - /** Creates a new text string cell editor parented under the given control. The cell editor value is the string - * itself, which is initially the empty string. Initially, the cell editor has no cell validator. + /** + * Creates a new text string cell editor parented under the given control. The + * cell editor value is the string itself, which is initially the empty string. + * Initially, the cell editor has no cell validator. * * @param parent the parent control * @param style the style bits - * @since 2.1 */ + * @since 2.1 + */ public StyledTextCellEditor(final Composite parent, final int style) { super(parent, style); } - /** Checks to see if the "deletable" state (can delete/ nothing to delete) has changed and if so fire an enablement - * changed notification. */ + /** + * Checks to see if the "deletable" state (can delete/ nothing to delete) has + * changed and if so fire an enablement changed notification. + */ private void checkDeleteable() { final boolean oldIsDeleteable = isDeleteable; isDeleteable = isDeleteEnabled(); @@ -92,8 +107,10 @@ private void checkDeleteable() { } } - /** Checks to see if the "selectable" state (can select) has changed and if so fire an enablement changed - * notification. */ + /** + * Checks to see if the "selectable" state (can select) has changed and if so + * fire an enablement changed notification. + */ private void checkSelectable() { final boolean oldIsSelectable = isSelectable; isSelectable = isSelectAllEnabled(); @@ -102,8 +119,10 @@ private void checkSelectable() { } } - /** Checks to see if the selection state (selection / no selection) has changed and if so fire an enablement changed - * notification. */ + /** + * Checks to see if the selection state (selection / no selection) has changed + * and if so fire an enablement changed notification. + */ private void checkSelection() { final boolean oldIsSelection = isSelection; isSelection = text.getSelectionCount() > 0; @@ -179,18 +198,22 @@ public void focusLost(final FocusEvent e) { return text; } - /** Create the text control + /** + * Create the text control * * @param parent The parent control - * @return The text control */ + * @return The text control + */ protected StyledText createStyledText(final Composite parent) { return new StyledText(parent, getStyle()); } - /** The StyledTextCellEditor implementation of this CellEditor framework method returns - * the text string. + /** + * The StyledTextCellEditor implementation of this + * CellEditor framework method returns the text string. * - * @return the text string */ + * @return the text string + */ @Override protected Object doGetValue() { return text.getText(); @@ -207,10 +230,13 @@ protected void doSetFocus() { } } - /** The StyledTextCellEditor implementation of this CellEditor framework method accepts a - * text string (type String). + /** + * The StyledTextCellEditor implementation of this + * CellEditor framework method accepts a text string (type + * String). * - * @param value a text string (type String) */ + * @param value a text string (type String) + */ @Override protected void doSetValue(final Object value) { Assert.isTrue(text != null && (value instanceof String)); @@ -219,11 +245,15 @@ protected void doSetValue(final Object value) { text.addModifyListener(getModifyListener()); } - /** Processes a modify event that occurred in this text cell editor. This framework method performs validation and - * sets the error message accordingly, and then reports a change via fireEditorValueChanged. Subclasses - * should call this method at appropriate times. Subclasses may extend or reimplement. + /** + * Processes a modify event that occurred in this text cell editor. This + * framework method performs validation and sets the error message accordingly, + * and then reports a change via fireEditorValueChanged. Subclasses + * should call this method at appropriate times. Subclasses may extend or + * reimplement. * - * @param e the SWT modify event */ + * @param e the SWT modify event + */ protected void editOccured(final ModifyEvent e) { String value = text.getText(); if (value == null) { @@ -255,8 +285,11 @@ private ModifyListener getModifyListener() { return modifyListener; } - /** The StyledTextCellEditor implementation of this CellEditor method returns - * true if the current selection is not empty. */ + /** + * The StyledTextCellEditor implementation of this + * CellEditor method returns true if the current + * selection is not empty. + */ @Override public boolean isCopyEnabled() { if (text == null || text.isDisposed()) { @@ -265,8 +298,11 @@ public boolean isCopyEnabled() { return text.getSelectionCount() > 0; } - /** The StyledTextCellEditor implementation of this CellEditor method returns - * true if the current selection is not empty. */ + /** + * The StyledTextCellEditor implementation of this + * CellEditor method returns true if the current + * selection is not empty. + */ @Override public boolean isCutEnabled() { if (text == null || text.isDisposed()) { @@ -275,8 +311,11 @@ public boolean isCutEnabled() { return text.getSelectionCount() > 0; } - /** The StyledTextCellEditor implementation of this CellEditor method returns - * true if there is a selection or if the caret is not positioned at the end of the text. */ + /** + * The StyledTextCellEditor implementation of this + * CellEditor method returns true if there is a + * selection or if the caret is not positioned at the end of the text. + */ @Override public boolean isDeleteEnabled() { if (text == null || text.isDisposed()) { @@ -285,27 +324,27 @@ public boolean isDeleteEnabled() { return text.getSelectionCount() > 0 || text.getCaretOffset() < text.getCharCount(); } - /** The StyledTextCellEditor implementation of this CellEditor method always returns - * true. */ + /** + * The StyledTextCellEditor implementation of this + * CellEditor method always returns true. + */ @Override public boolean isPasteEnabled() { - if (text == null || text.isDisposed()) { - return false; - } - return true; + return (text == null || text.isDisposed()); } - /** Check if save all is enabled + /** + * Check if save all is enabled * - * @return true if it is */ + * @return true if it is + */ public boolean isSaveAllEnabled() { - if (text == null || text.isDisposed()) { - return false; - } - return true; + return (text == null || text.isDisposed()); } - /** Returns true if this cell editor is able to perform the select all action. + /** + * Returns true if this cell editor is able to perform the select + * all action. *

* This default implementation always returns false. *

@@ -313,7 +352,9 @@ public boolean isSaveAllEnabled() { * Subclasses may override *

* - * @return true if select all is possible, false otherwise */ + * @return true if select all is possible, false + * otherwise + */ @Override public boolean isSelectAllEnabled() { if (text == null || text.isDisposed()) { @@ -322,15 +363,19 @@ public boolean isSelectAllEnabled() { return text.getCharCount() > 0; } - /** The StyledTextCellEditor implementation of this CellEditor method copies the current - * selection to the clipboard. */ + /** + * The StyledTextCellEditor implementation of this + * CellEditor method copies the current selection to the clipboard. + */ @Override public void performCopy() { text.copy(); } - /** The StyledTextCellEditor implementation of this CellEditor method cuts the current - * selection to the clipboard. */ + /** + * The StyledTextCellEditor implementation of this + * CellEditor method cuts the current selection to the clipboard. + */ @Override public void performCut() { text.cut(); @@ -339,8 +384,11 @@ public void performCut() { checkSelectable(); } - /** The StyledTextCellEditor implementation of this CellEditor method deletes the current - * selection or, if there is no selection, the character next character from the current position. */ + /** + * The StyledTextCellEditor implementation of this + * CellEditor method deletes the current selection or, if there is + * no selection, the character next character from the current position. + */ @Override public void performDelete() { if (text.getSelectionCount() > 0) { @@ -359,8 +407,11 @@ public void performDelete() { checkSelectable(); } - /** The StyledTextCellEditor implementation of this CellEditor method pastes the the - * clipboard contents over the current selection. */ + /** + * The StyledTextCellEditor implementation of this + * CellEditor method pastes the the clipboard contents over the + * current selection. + */ @Override public void performPaste() { text.paste(); @@ -369,8 +420,10 @@ public void performPaste() { checkSelectable(); } - /** The StyledTextCellEditor implementation of this CellEditor method selects all of the - * current text. */ + /** + * The StyledTextCellEditor implementation of this + * CellEditor method selects all of the current text. + */ @Override public void performSelectAll() { text.selectAll(); @@ -378,27 +431,34 @@ public void performSelectAll() { checkDeleteable(); } - /** This implementation of {@link CellEditor#dependsOnExternalFocusListener()} returns false if the current - * instance's class is StyledTextCellEditor, and true otherwise. Subclasses that hook their own focus listener - * should override this method and return false. See also bug 58777. + /** + * This implementation of {@link CellEditor#dependsOnExternalFocusListener()} + * returns false if the current instance's class is StyledTextCellEditor, and + * true otherwise. Subclasses that hook their own focus listener should override + * this method and return false. See also bug 58777. * - * @since 3.4 */ + * @since 3.4 + */ @Override protected boolean dependsOnExternalFocusListener() { return getClass() != StyledTextCellEditor.class; } - /** Check whether a proposal popup is open + /** + * Check whether a proposal popup is open * - * @return The popup proposal open status */ + * @return The popup proposal open status + */ @SuppressWarnings("static-method") protected boolean isProposalPopupOpen() { return false; } - /** Returns whether to commit by pressing enter with the control key + /** + * Returns whether to commit by pressing enter with the control key * - * @return The commit with control key behavior */ + * @return The commit with control key behavior + */ private boolean isCommitWithCtrlKey() { return (getStyle() & SWT.MULTI) != 0; } diff --git a/plugins/org.eclipse.fordiac.ide/src/org/eclipse/fordiac/ide/FordiacLogListener.java b/plugins/org.eclipse.fordiac.ide/src/org/eclipse/fordiac/ide/FordiacLogListener.java index 9f38af9278..6ae2754eb0 100644 --- a/plugins/org.eclipse.fordiac.ide/src/org/eclipse/fordiac/ide/FordiacLogListener.java +++ b/plugins/org.eclipse.fordiac.ide/src/org/eclipse/fordiac/ide/FordiacLogListener.java @@ -15,7 +15,8 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import java.util.Arrays; import java.util.concurrent.atomic.AtomicBoolean; @@ -105,11 +106,10 @@ private static void openBugReportBrowser() { try { final IWorkbench wb = PlatformUI.getWorkbench(); final IWebBrowser browser = wb.getBrowserSupport().createBrowser(Activator.PLUGIN_ID); - browser.openURL(new URL(FORDIAC_IDE_ISSUE_URL)); - } catch (PartInitException | MalformedURLException e) { + browser.openURL(new URI(FORDIAC_IDE_ISSUE_URL).toURL()); + } catch (PartInitException | MalformedURLException | URISyntaxException e) { FordiacLogHelper.logError("Error in opening the 4diac bugzilla web-page!", e); //$NON-NLS-1$ } - } } diff --git a/tests/org.eclipse.fordiac.ide.test.library/src/org/eclipse/fordiac/ide/test/library/LibraryImportTest.java b/tests/org.eclipse.fordiac.ide.test.library/src/org/eclipse/fordiac/ide/test/library/LibraryImportTest.java index 4ab4df4c3a..9402fe82cc 100644 --- a/tests/org.eclipse.fordiac.ide.test.library/src/org/eclipse/fordiac/ide/test/library/LibraryImportTest.java +++ b/tests/org.eclipse.fordiac.ide.test.library/src/org/eclipse/fordiac/ide/test/library/LibraryImportTest.java @@ -81,9 +81,8 @@ static void setupBeforeClass() throws Exception { } // deactivate other downloaders - TypeLibraryManager.useExtensions(LibraryManager.DOWNLOADER_EXTENSION, IArchiveDownloader.class, downloader -> { - downloader.setActive(downloader instanceof MockDownloader); - }); + TypeLibraryManager.useExtensions(LibraryManager.DOWNLOADER_EXTENSION, IArchiveDownloader.class, + downloader -> downloader.setActive(downloader instanceof MockDownloader)); } @BeforeEach diff --git a/tests/org.eclipse.fordiac.ide.test.library/src/org/eclipse/fordiac/ide/test/library/MockDownloader.java b/tests/org.eclipse.fordiac.ide.test.library/src/org/eclipse/fordiac/ide/test/library/MockDownloader.java index e75947f2b7..376ac6b756 100644 --- a/tests/org.eclipse.fordiac.ide.test.library/src/org/eclipse/fordiac/ide/test/library/MockDownloader.java +++ b/tests/org.eclipse.fordiac.ide.test.library/src/org/eclipse/fordiac/ide/test/library/MockDownloader.java @@ -38,7 +38,7 @@ public class MockDownloader implements IArchiveDownloader { Map.entry("test02", List.of("1.0.0", "1.1.0")), Map.entry("test03", List.of("1.0.0", "1.1.0")), Map.entry("test04", List.of("1.0.0", "1.1.0")), Map.entry("test05", List.of("1.0.0")), Map.entry("test06", List.of("1.0.0")), Map.entry("test07", List.of("1.0.0"))); - private final String formatString = "data/%s-%s.zip"; //$NON-NLS-1$ + private final static String FORMAT_STRING = "data/%s-%s.zip"; //$NON-NLS-1$ @Override public List availableLibraries() throws IOException { @@ -79,7 +79,7 @@ public Path downloadLibrary(final String symbolicName, final VersionRange range, try { return Paths.get(FileLocator .toFileURL(FileLocator.find(bundle, - new org.eclipse.core.runtime.Path(String.format(formatString, symbolicName, version)))) + new org.eclipse.core.runtime.Path(String.format(FORMAT_STRING, symbolicName, version)))) .toURI()); } catch (URISyntaxException | IOException e) { // empty diff --git a/tests/org.eclipse.fordiac.ide.test.model.commands/src/org/eclipse/fordiac/ide/model/commands/change/ChangeCompilerCommandTest.java b/tests/org.eclipse.fordiac.ide.test.model.commands/src/org/eclipse/fordiac/ide/model/commands/change/ChangeCompilerCommandTest.java index b2c259106e..33aff524a4 100644 --- a/tests/org.eclipse.fordiac.ide.test.model.commands/src/org/eclipse/fordiac/ide/model/commands/change/ChangeCompilerCommandTest.java +++ b/tests/org.eclipse.fordiac.ide.test.model.commands/src/org/eclipse/fordiac/ide/model/commands/change/ChangeCompilerCommandTest.java @@ -205,9 +205,7 @@ public static Collection data() { ), // new ExecutionDescription<>("Add Compiler Info to Functionblock", //$NON-NLS-1$ ChangeCompilerCommandTest::executeAddCommand, // - (final State s, final State o, final TestFunction t) -> { - verifyDefaultState(s, t, 0, 1); - }), // + (final State s, final State o, final TestFunction t) -> verifyDefaultState(s, t, 0, 1)), // new ExecutionDescription<>("Add second Compiler Info to Functionblock", //$NON-NLS-1$ ChangeCompilerCommandTest::executeAddCommand, // (final State s, final State o, final TestFunction t) -> { @@ -244,9 +242,7 @@ public static Collection data() { ), // new ExecutionDescription<>("Delete first Compiler Info from Functionblock", //$NON-NLS-1$ ChangeCompilerCommandTest::executeDeleteCommand, // - (final State s, final State o, final TestFunction t) -> { - verifyDefaultState(s, t, 0, 1); // - }), // + (final State s, final State o, final TestFunction t) -> verifyDefaultState(s, t, 0, 1)), // new ExecutionDescription<>("Change Compiler Vendor to NULL on Functionblock", //$NON-NLS-1$ ChangeCompilerCommandTest::executeChangeVendorToNullCommand, // (final State s, final State o, final TestFunction t) -> verifyChangedVendorToNullState(s, t, 0, diff --git a/tests/org.eclipse.fordiac.ide.test.model.commands/src/org/eclipse/fordiac/ide/model/commands/create/AddDeleteDemuxPortCommandTest.java b/tests/org.eclipse.fordiac.ide.test.model.commands/src/org/eclipse/fordiac/ide/model/commands/create/AddDeleteDemuxPortCommandTest.java index eb36c4a93e..d676fdabe4 100644 --- a/tests/org.eclipse.fordiac.ide.test.model.commands/src/org/eclipse/fordiac/ide/model/commands/create/AddDeleteDemuxPortCommandTest.java +++ b/tests/org.eclipse.fordiac.ide.test.model.commands/src/org/eclipse/fordiac/ide/model/commands/create/AddDeleteDemuxPortCommandTest.java @@ -181,7 +181,7 @@ protected static void verifyAdded(final State state, final TestFunction t, final t.test(Arrays.asList(attribute.getValue().split(",")) //$NON-NLS-1$ .contains(name)); } - t.test(state.getDemultiplexer().getMemberVars().stream().anyMatch(var -> var.getName().equals(name))); + t.test(state.getDemultiplexer().getMemberVars().stream().anyMatch(memVar -> memVar.getName().equals(name))); } private static Attribute getVisibleChildrenAttribute(final Demultiplexer demux) { @@ -199,7 +199,7 @@ protected static void verifyDeleted(final State state, final TestFunction t, fin t.test(!Arrays.asList(attribute.getValue().split(",")) //$NON-NLS-1$ .contains(name)); } - t.test(state.getDemultiplexer().getMemberVars().stream().noneMatch(var -> var.getName().equals(name))); + t.test(state.getDemultiplexer().getMemberVars().stream().noneMatch(memVar -> memVar.getName().equals(name))); } private static State executeDeleteCommand(final State state, final String name) { diff --git a/tests/org.eclipse.fordiac.ide.test.model.eval/src/org/eclipse/fordiac/ide/test/model/eval/function/StandardFunctionsTest.java b/tests/org.eclipse.fordiac.ide.test.model.eval/src/org/eclipse/fordiac/ide/test/model/eval/function/StandardFunctionsTest.java index 9ecb810dfc..4257b2ed66 100644 --- a/tests/org.eclipse.fordiac.ide.test.model.eval/src/org/eclipse/fordiac/ide/test/model/eval/function/StandardFunctionsTest.java +++ b/tests/org.eclipse.fordiac.ide.test.model.eval/src/org/eclipse/fordiac/ide/test/model/eval/function/StandardFunctionsTest.java @@ -1526,8 +1526,8 @@ void testStringConversions(final String typeName) throws Throwable { assertEquals(wrapValue(Integer.valueOf(17), type), Functions.invoke(StandardFunctions.class, functionStringAsTypeName, toStringValue(wrapValue(Integer.valueOf(17), type).toString()))); // *_AS_WSTRING - assertEquals(toWStringValue(defaultValue(type).toString()), Functions.invoke(StandardFunctions.class, - functionTypeAsWStringName.toString(), defaultValue(type))); + assertEquals(toWStringValue(defaultValue(type).toString()), + Functions.invoke(StandardFunctions.class, functionTypeAsWStringName, defaultValue(type))); assertEquals(toWStringValue(WStringValue.toWStringValue(wrapValue(Integer.valueOf(17), type).toString())), Functions.invoke(StandardFunctions.class, functionTypeAsWStringName, wrapValue(Integer.valueOf(17), type))); @@ -1595,10 +1595,10 @@ void testToBcdFunctions(final String intTypeName, final String bitTypeName) thro Functions.invoke(StandardFunctions.class, functionName, defaultValue(intType))); assertEquals(wrapValue(Integer.valueOf(0x17), bitType), Functions.invoke(StandardFunctions.class, functionName, wrapValue(Integer.valueOf(17), intType))); - assertEquals(wrapValue(Integer.valueOf(0x42), bitType), Functions.invoke(StandardFunctions.class, - functionName.toString(), wrapValue(Integer.valueOf(42), intType))); - assertEquals(wrapValue(Integer.valueOf(0x84), bitType), Functions.invoke(StandardFunctions.class, - functionName.toString(), wrapValue(Integer.valueOf(84), intType))); + assertEquals(wrapValue(Integer.valueOf(0x42), bitType), + Functions.invoke(StandardFunctions.class, functionName, wrapValue(Integer.valueOf(42), intType))); + assertEquals(wrapValue(Integer.valueOf(0x84), bitType), + Functions.invoke(StandardFunctions.class, functionName, wrapValue(Integer.valueOf(84), intType))); assertEquals(castValue(wrapValue(Long.valueOf(0x8442211784422117L), intType), bitType), Functions .invoke(StandardFunctions.class, functionName, toDigitsValue(8442211784422117L, bitType, intType))); } @@ -1634,8 +1634,8 @@ void testBcdToFunctions(final String intTypeName, final String bitTypeName) thro Functions.invoke(StandardFunctions.class, functionName, wrapValue(Integer.valueOf(0x17), bitType))); assertEquals(wrapValue(Integer.valueOf(42), intType), Functions.invoke(StandardFunctions.class, functionName, wrapValue(Integer.valueOf(0x42), bitType))); - assertEquals(wrapValue(Integer.valueOf(84), intType), Functions.invoke(StandardFunctions.class, - functionName.toString(), wrapValue(Integer.valueOf(0x84), bitType))); + assertEquals(wrapValue(Integer.valueOf(84), intType), + Functions.invoke(StandardFunctions.class, functionName, wrapValue(Integer.valueOf(0x84), bitType))); assertEquals(toDigitsValue(8442211784422117L, bitType, intType), Functions.invoke(StandardFunctions.class, functionName, castValue(wrapValue(Long.valueOf(0x8442211784422117L), intType), bitType))); @@ -1655,8 +1655,8 @@ void testTypeBcdToFunctions(final String intTypeName, final String bitTypeName) Functions.invoke(StandardFunctions.class, functionName, wrapValue(Integer.valueOf(0x17), bitType))); assertEquals(wrapValue(Integer.valueOf(42), intType), Functions.invoke(StandardFunctions.class, functionName, wrapValue(Integer.valueOf(0x42), bitType))); - assertEquals(wrapValue(Integer.valueOf(84), intType), Functions.invoke(StandardFunctions.class, - functionName.toString(), wrapValue(Integer.valueOf(0x84), bitType))); + assertEquals(wrapValue(Integer.valueOf(84), intType), + Functions.invoke(StandardFunctions.class, functionName, wrapValue(Integer.valueOf(0x84), bitType))); assertEquals(toDigitsValue(8442211784422117L, bitType, intType), Functions.invoke(StandardFunctions.class, functionName, castValue(wrapValue(Long.valueOf(0x8442211784422117L), intType), bitType)));