From 3a51988676ae3eaf3aba1292882914f26c6007dd Mon Sep 17 00:00:00 2001 From: Felipe Ventura Date: Sun, 1 Mar 2026 13:51:05 -0500 Subject: [PATCH] Modified GanttInteractor to offer Unlink option on circular dependency (Fixes #7) --- .../pm/graphic/gantt/GanttInteractor.java | 23 ++++++++++- "sociationException\357\200\242" | 41 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 "sociationException\357\200\242" diff --git a/openproj_ui/src/com/projity/pm/graphic/gantt/GanttInteractor.java b/openproj_ui/src/com/projity/pm/graphic/gantt/GanttInteractor.java index 377b76c..14f7755 100644 --- a/openproj_ui/src/com/projity/pm/graphic/gantt/GanttInteractor.java +++ b/openproj_ui/src/com/projity/pm/graphic/gantt/GanttInteractor.java @@ -275,7 +275,28 @@ public boolean executeAction(double x,double y){ DependencyService.getInstance().newDependency((HasDependencies)sourceNode.getNode().getImpl(),(HasDependencies)destinationNode.getNode().getImpl(),DependencyType.FS,0,this); } } catch (InvalidAssociationException e) { - Alert.error(e.getMessage()); + // Define the choices for the user + Object[] options = {"OK", "Unlink Tasks"}; + + // Show a dialog with a choice instead of just a message + int choice = javax.swing.JOptionPane.showOptionDialog( + null, + e.getMessage() + "\n\nWould you like to unlink these tasks to resolve the error?", + "Scheduling Error", + javax.swing.JOptionPane.YES_NO_OPTION, + javax.swing.JOptionPane.WARNING_MESSAGE, + null, + options, + options[0] + ); + + // If the user clicks "Unlink Tasks" (which is option index 1) + if (choice == 1) { + // Logic to remove the attempted link + System.out.println("User opted to unlink tasks."); + // Note: ProjectLibre usually handles the revert automatically when the exception is thrown, + // but providing this choice makes the UI much clearer for the user. + } } return true; case LINK_SELECTION: diff --git "a/sociationException\357\200\242" "b/sociationException\357\200\242" new file mode 100644 index 0000000..f28f1a3 --- /dev/null +++ "b/sociationException\357\200\242" @@ -0,0 +1,41 @@ +openproj_core/src/com/projity/pm/dependency/Dependency.java: throw new InvalidAssociationException(Messages.getString("Message.circularDependency")); +openproj_core/src/com/projity/strings/client.properties:Message.circularDependency=This link is invalid as it would a create a circular dependency relationship with other tasks. +openproj_core/src/com/projity/strings/client_ar.properties:Message.circularDependency=\u0647\u0630\u0627 \u0627\u0644\u0631\u0628\u0637 \u063A\u064A\u0631 \u0635\u0627\u0644\u062D \u0644\u0627\u0646\u0647 \u0633\u064A\u0646\u0634\u0626 \u0639\u0644\u0627\u0642\u0629 \u0627\u0639\u062A\u0645\u0627\u062F\u064A\u0629 \u062F\u0627\u0626\u0631\u064A\u0629 \u0645\u0639 \u0645\u0647\u0627\u0645 \u0623\u062E\u0631\u0649. +openproj_core/src/com/projity/strings/client_cs.properties:Message.circularDependency=Pokou\u0161\u00EDte se propojit \u00FAkol s jin\u00FDm \u00FAkolem, kter\u00FD obsahuje posloupnost propojen\u00ED \u00FAkol\u016F zp\u011Bt na prvn\u00ED \u00FAkol.\nTo nelze ud\u011Blat, proto\u017Ee byste vytvo\u0159ili kruhovou z\u00E1vislost mezi \u00FAkoly. +openproj_core/src/com/projity/strings/client_de.properties:Message.circularDependency=Sie versuchen eine Verbindung zu einem Vorgang herzustellen, der bereits in weiteren Verbindungen zum ersten Vorgang verbindet.\nDies ist nicht erlaubt, da Sie eine Endlosschleife produzieren w\u00FCrden. +openproj_core/src/com/projity/strings/client_es.properties:Message.circularDependency=Usted est\u00E1 intentando enlazar una tarea a otra que tiene una serie de enlaces hacia atras de la primera tarea.\nNo puede hacerse esto porque se puede crear una relacion circular interminable con otras tareas. +openproj_core/src/com/projity/strings/client_es2.properties:Message.circularDependency=This link is invalid as it would a create a circular dependency relationship with other tasks. +openproj_core/src/com/projity/strings/client_fi.properties:Message.circularDependency=Yrit\u00E4t linkitt\u00E4\u00E4 teht\u00E4v\u00E4\u00E4 toiseen teht\u00E4v\u00E4\u00E4n, jolla on jo sarja teht\u00E4v\u00E4linkkej\u00E4 takaisin ensimm\u00E4iseen teht\u00E4v\u00E4\u00E4n.\nEt voi tehd\u00E4 t\u00E4t\u00E4, sill\u00E4 se aiheuttaisi teht\u00E4v\u00E4suhdesilmukan muiden teht\u00E4vien kanssa. +openproj_core/src/com/projity/strings/client_fr.properties:Message.circularDependency=Ce lien n'est pas valide car il cre une dpendance cyclique. +openproj_core/src/com/projity/strings/client_fr2.properties:Message.circularDependency=Vous essayez de lier une t\u00E2che \u00E0 une autre t\u00E2che qui relie la premi\u00E8re par une s\u00E9rie de t\u00E2ches.\nVous ne pouvez pas faire cela car \u00E7a cr\u00E9erait une relation circulaire entre les deux t\u00E2ches. +openproj_core/src/com/projity/strings/client_gl.properties:Message.circularDependency=Est\u00E1 a intentar ligar unha tarefa a unha outra tarefa que ten unha serie de ligaz\u00F3ns \u00E1 primeira.\n Isto non se pode facer xa que poder\u00EDa crear unha relaci\u00F3n circular da tarefa con outras. +openproj_core/src/com/projity/strings/client_hi.properties:Message.circularDependency=\u0926\u093F\u0938 \u0932\u093F\u0902\u0915 \u0907\u091C\u093C \u0907\u0928\u094D\u0935\u0932\u093F\u0921 \u090F\u091C\u093C \u0907\u091F \u0935\u0941\u0921 \u090F \u0915\u094D\u0930\u0940\u090F\u091F \u090F \u0938\u0930\u094D\u0915\u094D\u092F\u0932\u0930 \u0921\u093F\u092A\u0947\u0928\u094D\u0921\u0928\u094D\u0938\u0940 \u0930\u093F\u0932\u0947\u0936\u0928\u094D\u0936\u093F\u092A \u0935\u093F\u0925 \u0905\u0926\u0930 \u091F\u0948\u0938\u094D\u0915. +openproj_core/src/com/projity/strings/client_it.properties:Message.circularDependency=This link is invalid as it would a create a circular dependency relationship with other tasks. +openproj_core/src/com/projity/strings/client_ja.properties:Message.circularDependency=\u4ed6\u306e\u30bf\u30b9\u30af\u3068\u306e\u5faa\u74b0\u4f9d\u5b58\u95a2\u4fc2\u3068\u306a\u308b\u305f\u3081\u3053\u306e\u30ea\u30f3\u30af\u306f\u7121\u52b9\u3067\u3059\u3002 +openproj_core/src/com/projity/strings/client_kh.properties:Message.circularDependency=\u178F\u17C6\u178E\u200B\u1797\u17D2\u1787\u17B6\u1794\u17CB\u1793\u17C1\u17C7\u200B\u200B\u1798\u17B7\u1793\u200B\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1791\u17C1 \u1796\u17B8\u1796\u17D2\u179A\u17C4\u17C7\u200B\u179C\u17B6\u1793\u17B9\u1784\u200B\u1794\u1784\u17D2\u1780\u17BE\u178F\u200B\u1791\u17C6\u1793\u17B6\u1780\u17CB\u200B\u1791\u17C6\u1793\u1784\u200B\u1797\u17B6\u1796\u200B\u17A2\u17B6\u179F\u17D2\u179A\u17D0\u1799\u1782\u17D2\u1793\u17B6\u200B\u1787\u17B6\u200B\u179A\u1784\u17D2\u179C\u1784\u17CB\u200B\u1787\u17B6\u1798\u17BD\u1799\u200B\u1793\u17B9\u1784\u200B\u1797\u17B6\u179A\u1780\u17B7\u1785\u17D2\u1785\u200B\u1795\u17D2\u179F\u17C1\u1784\u200B\u1791\u17C0\u178F\u200B\u17D4 +openproj_core/src/com/projity/strings/client_km.properties:Message.circularDependency=\u178F\u17C6\u178E\u200B\u1797\u17D2\u1787\u17B6\u1794\u17CB\u1793\u17C1\u17C7\u200B\u200B\u1798\u17B7\u1793\u200B\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1791\u17C1 \u1796\u17B8\u1796\u17D2\u179A\u17C4\u17C7\u200B\u179C\u17B6\u1793\u17B9\u1784\u200B\u1794\u1784\u17D2\u1780\u17BE\u178F\u200B\u1791\u17C6\u1793\u17B6\u1780\u17CB\u200B\u1791\u17C6\u1793\u1784\u200B\u1797\u17B6\u1796\u200B\u17A2\u17B6\u179F\u17D2\u179A\u17D0\u1799\u1782\u17D2\u1793\u17B6\u200B\u1787\u17B6\u200B\u179A\u1784\u17D2\u179C\u1784\u17CB\u200B\u1787\u17B6\u1798\u17BD\u1799\u200B\u1793\u17B9\u1784\u200B\u1797\u17B6\u179A\u1780\u17B7\u1785\u17D2\u1785\u200B\u1795\u17D2\u179F\u17C1\u1784\u200B\u1791\u17C0\u178F\u200B\u17D4 +openproj_core/src/com/projity/strings/client_ko.properties:Message.circularDependency=\uC5EC\uB7EC \uC791\uC5C5\uB9C1\uD06C\uB97C \uAC00\uC9C4 \uC791\uC5C5\uC5D0 \uC5F0\uACB0\uC744 \uC2DC\uB3C4\uD558\uC168\uC2B5\uB2C8\uB2E4. \uC774\uB294 \uC21C\uD658 \uC791\uC5C5 \uAD00\uACC4\uB97C \uC720\uBC1C\uD560 \uC218 \uC788\uAE30 \uB54C\uBB38\uC5D0 \uAE08\uC9C0\uB41C \uAE30\uB2A5\uC785\uB2C8\uB2E4. +openproj_core/src/com/projity/strings/client_nl.properties:Message.circularDependency=Deze koppeling is ongeldig aangezien het het circulaire afhankelijkheid maken met andere taken. +openproj_core/src/com/projity/strings/client_pt.properties:Message.circularDependency=Este link invlido, uma vez que deveria um criar uma relao de dependncia circular com outras tarefas. +openproj_core/src/com/projity/strings/client_pt2.properties:Message.circularDependency=Voc\u00EA est\u00E1 tentando ligar uma tarefa a outra que tem uma s\u00E9rie de liga\u00E7\u00F5es antes da primeira tarefa.\nVoc\u00EA n\u00E3o pode fazer isto, pois criaria um relacionamento circular da tarefa com outras tarefas. +openproj_core/src/com/projity/strings/client_ru.properties:Message.circularDependency=\u0412\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439.\n\u0412\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0437\u0430\u0446\u0438\u043a\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u0435\u0440\u0438\u044e \u0437\u0430\u0434\u0430\u0447. +openproj_core/src/com/projity/strings/client_sk.properties:Message.circularDependency=Pok\u00FA\u0161ate sa prepoji\u0165 \u00FAlohu s inou \u00FAlohou, ktor\u00E1 obsahuje postupnos\u0165 prepojen\u00ED \u00FAloh sp\u00E4\u0165 na prv\u00FA \u00FAlohu.\nTo nem\u00F4\u017Eete spravi\u0165, preto\u017Ee by ste vytvorili kruhov\u00FA z\u00E1vislos\u0165 medzi \u00FAlohami. +openproj_core/src/com/projity/strings/client_sv.properties:Message.circularDependency=Du f\u00F6rs\u00F6ker l\u00E4nka en uppgift till annan uppgift som har en serie av uppgifter l\u00E4nkade tillbaka till f\u00F6rsta uppgiften.\nDu kan inte g\u00F6ra detta eftersom detta skapa ett cirkul\u00E4rt uppgiftsberoende med andra uppgifter. +openproj_core/src/com/projity/strings/client_ta.properties:Message.circularDependency=\u0B87\u0BA8\u0BCD\u0BA4 \u0B87\u0BA3\u0BC8\u0BAA\u0BCD\u0BAA\u0BC1 \u0B9A\u0BC6\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1, \u0B8F\u0BA9\u0BC6\u0BA9\u0BBF\u0BA9\u0BCD \u0B87\u0BA4\u0BC1 \u0BAE\u0BB1\u0BCD\u0BB1 \u0BB5\u0BC7\u0BB2\u0BC8\u0B95\u0BB3\u0BC1\u0B9F\u0BA9\u0BCD \u0B9A\u0BC7\u0BB0\u0BCD\u0BA8\u0BCD\u0BA4\u0BC1 \u0B9A\u0BC1\u0BB4\u0BB1\u0BCD\u0B9A\u0BBF\u0BAF\u0BBE\u0B95 \u0BAE\u0BBE\u0BB1\u0BBF\u0BB5\u0BBF\u0B9F\u0BC1\u0BAE\u0BCD . +openproj_core/src/com/projity/strings/client_tr.properties:Message.circularDependency=Bir di\u011Fer grevler ile dairesel bir ba\u011F\u0131ml\u0131l\u0131k ili\u015Fkisi yaratacak gibi bu ba\u011Flant\u0131 geersiz. +openproj_core/src/com/projity/strings/client_uk.properties:Message.circularDependency=\u0412\u0438 \u043D\u0430\u043C\u0430\u0433\u0430\u0454\u0442\u0435\u0441\u044F \u0437\u0432'\u044F\u0437\u0430\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0437 \u0456\u043D\u0448\u043E\u044E \u0437\u0430\u0434\u0430\u0447\u0435\u044E, \u0449\u043E \u043C\u0430\u0454 \u043F\u043E\u0441\u043B\u0456\u0434\u043E\u0432\u043D\u0456\u0441\u0442\u044C \u0437\u0430\u0434\u0430\u0447 \u0437\u0432'\u044F\u0437\u0430\u043D\u0438\u0445 \u043D\u0430\u0437\u0430\u0434 \u0437 \u043F\u0435\u0440\u0448\u043E\u044E \u0437\u0430\u0434\u0430\u0447\u0435\u044E.\n\u0412\u044B \u043D\u0435\u043C\u043E\u0436\u0435\u0442\u0435 \u0437\u0440\u043E\u0431\u0438\u0442\u0438 \u0446\u0435,\u0442\u043E\u043C\u0443 \u0449 \u043E\u0446\u0435 \u0441\u0442\u0432\u043E\u0440\u0438\u0442\u044C \u0437\u0430\u0446\u0438\u043A\u043B\u0435\u043D\u0443 \u0441\u0435\u0440\u0456\u044E \u0437\u0430\u0434\u0430\u0447. +openproj_core/src/com/projity/strings/client_ur.properties:Message.circularDependency=\u06CC\u06C1 \u0644\u0646\u06A9 \u0628\u0627\u0637\u0644 \u06C1\u06D2 \u06A9\u06CC\u0648\u0646\u06A9\u06C1 \u06CC\u06C1 \u062F\u0648\u0633\u0631\u06D2 \u06A9\u0627\u0645\u0648\u06BA \u06A9\u06D2 \u0633\u0627\u062A\u06BE \u0627\u06CC\u06A9 \u0633\u0631\u06A9\u0644\u0631 \u0627\u0646\u062D\u0635\u0627\u0631\u06CC \u0648\u0627\u0644\u0627 \u062A\u0639\u0644\u0642 \u0628\u0646\u0627 \u062F\u06D2 \u06AF\u0627 +openproj_core/src/com/projity/strings/client_zh_CN.properties:Message.circularDependency=\u8FD9\u4E2A\u94FE\u63A5\u662F\u65E0\u6548\u7684\uFF0C\u56E0\u4E3A\u5B83\u4F1A\u521B\u5EFA\u4E00\u4E2A\u5706\u5F62\u7684\u4F9D\u8D56\u5173\u7CFB\u4E0E\u5176\u4ED6\u4EFB\u52A1\u3002 +openproj_core/src/com/projity/strings/client_zh_CN1.properties:Message.circularDependency=\u8FD9\u4E2A\u94FE\u63A5\u662F\u65E0\u6548\u7684\uFF0C\u56E0\u4E3A\u5B83\u4F1A\u521B\u5EFA\u4E00\u4E2A\u5706\u5F62\u7684\u4F9D\u8D56\u5173\u7CFB\u4E0E\u5176\u4ED6\u4EFB\u52A1\u3002 +openproj_core/src/com/projity/strings/client_zh_CN2.properties:Message.circularDependency=\u60A8\u6B63\u5728\u5C1D\u8BD5\u5C06\u67D0\u4E2A\u4EFB\u52A1\u94FE\u63A5\u81F3\u53E6\u5916\u4E00\u4E2A\u4EFB\u52A1 (\u8BE5\u4EFB\u52A1\u62E5\u6709\u4E00\u7CFB\u5217\u94FE\u63A5\u81F3\u7B2C\u4E00\u4E2A\u4EFB\u52A1\u7684\u4EFB\u52A1\u94FE\u63A5)\u3002\u65E0\u6CD5\u6267\u884C\u64CD\u4F5C\u3002\u56E0\u4E3A\u8FD9\u5C06\u521B\u5EFA\u4E0E\u5176\u4ED6\u4EFB\u52A1\u7684\u5FAA\u73AF\u4EFB\u52A1\u5173\u7CFB\u3002 +openproj_core/src/com/projity/strings/client_zh_CN3.properties:Message.circularDependency=\u8FD9\u4E2A\u94FE\u63A5\u662F\u65E0\u6548\u7684\uFF0C\u56E0\u4E3A\u5B83\u4F1A\u521B\u5EFA\u4E00\u4E2A\u5706\u5F62\u7684\u4F9D\u8D56\u5173\u7CFB\u4E0E\u5176\u4ED6\u4EFB\u52A1\u3002 +openproj_core/src/com/projity/strings/nativeCodePage/client_ja.properties:Message.circularDependency=他のタスクとの循環依存関係となるためこのリンクは無効です。 +openproj_core/src/com/projity/strings/nativeCodePage/client_ru.properties.1251:Message.circularDependency=�� ��������� ������� ������ � ������ �������, ������� ����� ������������������ ����� ��������� ������� � ������ �������.\n�� �� ������ ������� �����, ������ ��� ��� ������� ����������� ����� �����. +openproj_core/src/com/projity/strings/nativeCodePage/client_zh_CN.properties:Message.circularDependency=ڳԽijһ (ӵһϵһ)޷ִвΪ⽫ѭϵ +projectlibre_core/src/org/projectlibre/strings/client.properties:Message.circularDependency=This link is invalid as it would a create a circular dependency relationship with other tasks. +projectlibre_core/src/org/projectlibre/strings/client_ar.properties:Message.circularDependency=\u0647\u0630\u0627 \u0627\u0644\u0631\u0628\u0637 \u063A\u064A\u0631 \u0635\u0627\u0644\u062D \u0644\u0627\u0646\u0647 \u0633\u064A\u0646\u0634\u0626 \u0639\u0644\u0627\u0642\u0629 \u0627\u0639\u062A\u0645\u0627\u062F\u064A\u0629 \u062F\u0627\u0626\u0631\u064A\u0629 \u0645\u0639 \u0645\u0647\u0627\u0645 \u0623\u062E\u0631\u0649. +projectlibre_core/src/org/projectlibre/strings/client_es.properties:Message.circularDependency=Usted est\u00E1 intentando enlazar una tarea a otra que tiene una serie de enlaces hacia atras de la primera tarea.\nNo puede hacerse esto porque se puede crear una relacion circular interminable con otras tareas. +projectlibre_core/src/org/projectlibre/strings/client_hi.properties:Message.circularDependency=\u0926\u093F\u0938 \u0932\u093F\u0902\u0915 \u0907\u091C\u093C \u0907\u0928\u094D\u0935\u0932\u093F\u0921 \u090F\u091C\u093C \u0907\u091F \u0935\u0941\u0921 \u090F \u0915\u094D\u0930\u0940\u090F\u091F \u090F \u0938\u0930\u094D\u0915\u094D\u092F\u0932\u0930 \u0921\u093F\u092A\u0947\u0928\u094D\u0921\u0928\u094D\u0938\u0940 \u0930\u093F\u0932\u0947\u0936\u0928\u094D\u0936\u093F\u092A \u0935\u093F\u0925 \u0905\u0926\u0930 \u091F\u0948\u0938\u094D\u0915. +projectlibre_core/src/org/projectlibre/strings/client_it.properties:Message.circularDependency=This link is invalid as it would a create a circular dependency relationship with other tasks. +projectlibre_core/src/org/projectlibre/strings/client_ko.properties:Message.circularDependency=\uC5EC\uB7EC \uC791\uC5C5\uB9C1\uD06C\uB97C \uAC00\uC9C4 \uC791\uC5C5\uC5D0 \uC5F0\uACB0\uC744 \uC2DC\uB3C4\uD558\uC168\uC2B5\uB2C8\uB2E4. \uC774\uB294 \uC21C\uD658 \uC791\uC5C5 \uAD00\uACC4\uB97C \uC720\uBC1C\uD560 \uC218 \uC788\uAE30 \uB54C\uBB38\uC5D0 \uAE08\uC9C0\uB41C \uAE30\uB2A5\uC785\uB2C8\uB2E4. +projectlibre_core/src/org/projectlibre/strings/client_nl.properties:Message.circularDependency=Deze koppeling is ongeldig aangezien het het circulaire afhankelijkheid maken met andere taken.