private Plugin mkPlugin(String name) { return new Plugin(name, PluginType.PERSPECTIVE, null); }
private Plugin mkPlugin(String name) { return new Plugin(name, PluginType.PERSPECTIVE, null); }
@OnStartup public void onStartup(final ObservablePath path, final PlaceRequest place) { init(path, place, resourceType, true, false, SAVE, COPY, RENAME, DELETE); // This is only used to define the "name" used by @WorkbenchPartTitle which is called by Uberfire after @OnStartup // but before the async call in "loadContent()" has returned. When the *real* plugin is loaded this is overwritten this.plugin = new Plugin(place.getParameter("name", ""), PluginType.DYNAMIC_MENU, path); }
@OnStartup public void onStartup(final ObservablePath path, final PlaceRequest place) { init(path, place, resourceType, true, false, SAVE, COPY, RENAME, DELETE); // This is only used to define the "name" used by @WorkbenchPartTitle which is called by Uberfire after @OnStartup // but before the async call in "loadContent()" has returned. When the *real* plugin is loaded this is overwritten this.plugin = new Plugin(place.getParameter("name", ""), PluginType.DYNAMIC_MENU, path); }
private Set<Plugin> getPlugins() { Set<Plugin> plugins = new HashSet<Plugin>(); plugins.add(new Plugin("existingPerspectiveLayout", PluginType.PERSPECTIVE_LAYOUT, PathFactory.newPath("test1", "/tmp/test1"))); plugins.add(new Plugin("existingScreen", PluginType.SCREEN, PathFactory.newPath("test2", "/tmp/test2"))); plugins.add(new Plugin("existingEditor", PluginType.EDITOR, PathFactory.newPath("test3", "/tmp/test3"))); plugins.add(new Plugin("existingSplashScreen", PluginType.SPLASH, PathFactory.newPath("test4", "/tmp/test4"))); plugins.add(new Plugin("existingDynamicMenu", PluginType.DYNAMIC_MENU, PathFactory.newPath("test5", "/tmp/test5"))); return plugins; } }
@Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { try { checkNotNull("file", file); checkNotNull("attrs", attrs); if (file.getFileName().toString().endsWith(".plugin") && attrs.isRegularFile()) { final org.uberfire.backend.vfs.Path path = convert(file); result.add(new Plugin(file.getParent().getFileName().toString(), TypeConverterUtil.fromPath(path), path)); } } catch (final Exception ex) { return FileVisitResult.TERMINATE; } return FileVisitResult.CONTINUE; } });
private Set<Plugin> getPlugins() { Set<Plugin> plugins = new HashSet<Plugin>(); plugins.add(new Plugin("existingPerspectiveLayout", PluginType.PERSPECTIVE_LAYOUT, PathFactory.newPath("test1", "/tmp/test1"))); plugins.add(new Plugin("existingScreen", PluginType.SCREEN, PathFactory.newPath("test2", "/tmp/test2"))); plugins.add(new Plugin("existingEditor", PluginType.EDITOR, PathFactory.newPath("test3", "/tmp/test3"))); plugins.add(new Plugin("existingSplashScreen", PluginType.SPLASH, PathFactory.newPath("test4", "/tmp/test4"))); plugins.add(new Plugin("existingDynamicMenu", PluginType.DYNAMIC_MENU, PathFactory.newPath("test5", "/tmp/test5"))); return plugins; } }
protected void afterLoad() { setOriginalHash(getCurrentModelHash()); plugin = new Plugin(layoutEditorPlugin.getLayout().getName(), PluginType.PERSPECTIVE_LAYOUT, versionRecordManager.getCurrentPath()); }
protected void afterLoad() { setOriginalHash(getCurrentModelHash()); plugin = new Plugin(layoutEditorPlugin.getLayout().getName(), PluginType.PERSPECTIVE_LAYOUT, versionRecordManager.getCurrentPath()); }
@Test public void testList() { Plugin layoutPlugin = new Plugin("layout", PluginType.PERSPECTIVE_LAYOUT, path2); when(pluginServices.listPlugins()).thenReturn(Collections.singletonList(layoutPlugin)); Collection<LayoutTemplate> layouts = perspectiveServices.listLayoutTemplates(); assertEquals(layouts.size(), 1); LayoutTemplate layoutTemplate = layouts.iterator().next(); assertEquals(layoutTemplate.getName(), "layout"); }
protected void onPlugInRenamed(@Observes final PluginRenamed pluginRenamed) { if (pluginRenamed.getOldPluginName().equals(plugin.getName()) && pluginRenamed.getPlugin().getType().equals(plugin.getType())) { plugin = new Plugin(pluginRenamed.getPlugin().getName(), PluginType.DYNAMIC_MENU, pluginRenamed.getPlugin().getPath()); changeTitleNotification.fire(new ChangeTitleWidgetEvent(place, getTitleText(), getTitle())); } }
@Test public void testList() { Plugin layoutPlugin = new Plugin("layout", PluginType.PERSPECTIVE_LAYOUT, path2); when(pluginServices.listPlugins()).thenReturn(Collections.singletonList(layoutPlugin)); Collection<LayoutTemplate> layouts = perspectiveServices.listLayoutTemplates(); assertEquals(layouts.size(), 1); LayoutTemplate layoutTemplate = layouts.iterator().next(); assertEquals(layoutTemplate.getName(), "layout"); }
protected void onPlugInRenamed(@Observes final PluginRenamed pluginRenamed) { if (pluginRenamed.getOldPluginName().equals(plugin.getName()) && pluginRenamed.getPlugin().getType().equals(plugin.getType())) { plugin = new Plugin(pluginRenamed.getPlugin().getName(), PluginType.DYNAMIC_MENU, pluginRenamed.getPlugin().getPath()); changeTitleNotification.fire(new ChangeTitleWidgetEvent(place, getTitleText(), getTitle())); } }
protected void onPlugInRenamed(@Observes final PluginRenamed pluginRenamed) { if (pluginRenamed.getOldPluginName().equals(plugin.getName()) && pluginRenamed.getPlugin().getType().equals(plugin.getType())) { this.plugin = new Plugin(pluginRenamed.getPlugin().getName(), getPluginType(), pluginRenamed.getPlugin().getPath()); changeTitleNotification.fire(new ChangeTitleWidgetEvent(place, getTitleText(), getTitle())); } }
protected void onPlugInRenamed(@Observes final PluginRenamed pluginRenamed) { if (pluginRenamed.getOldPluginName().equals(plugin.getName()) && pluginRenamed.getPlugin().getType().equals(plugin.getType())) { this.plugin = new Plugin(pluginRenamed.getPlugin().getName(), getPluginType(), pluginRenamed.getPlugin().getPath()); changeTitleNotification.fire(new ChangeTitleWidgetEvent(place, getTitleText(), getTitle())); } }
@OnStartup public void onStartup(final ObservablePath path, final PlaceRequest place) { init(path, place, getResourceType(), true, false, SAVE, COPY, RENAME, DELETE); // This is only used to define the "name" used by @WorkbenchPartTitle which is called by Uberfire after @OnStartup // but before the async call in "loadContent()" has returned. When the *real* plugin is loaded this is overwritten this.plugin = new Plugin(place.getParameter("name", ""), getPluginType(), path); this.place = place; }
@OnStartup public void onStartup(final ObservablePath path, final PlaceRequest place) { init(path, place, getResourceType(), true, false, SAVE, COPY, RENAME, DELETE); // This is only used to define the "name" used by @WorkbenchPartTitle which is called by Uberfire after @OnStartup // but before the async call in "loadContent()" has returned. When the *real* plugin is loaded this is overwritten this.plugin = new Plugin(place.getParameter("name", ""), getPluginType(), path); this.place = place; }
@Before public void setUp() { when(clientTypeRegistry.resolve(any())).thenReturn(new PerspectiveLayoutPluginResourceType(new Others())); perspectivePlugin = new Plugin(PERSPECTIVE_ID, PluginType.PERSPECTIVE_LAYOUT, null); perspectiveRenamedPlugin = new Plugin("newName", PluginType.PERSPECTIVE_LAYOUT, null); pluginAddedEvent = new PluginAdded(perspectivePlugin, null); pluginSavedEvent = new PluginSaved(perspectivePlugin, null); pluginRenamedEvent = new PluginRenamed(PERSPECTIVE_ID, perspectiveRenamedPlugin, null); pluginDeletedEvent = new PluginDeleted(perspectivePlugin, null); when(pluginServices.listPlugins()).thenReturn(Collections.emptyList()); testedPluginManager = new PerspectivePluginManager(clientTypeRegistry, null, navigationManager, new CallerMock<>(pluginServices), perspectiveChangedEvent); testedPluginManager.getPerspectivePlugins(plugins -> {}); }
@Before public void setUp() { when(clientTypeRegistry.resolve(any())).thenReturn(new PerspectiveLayoutPluginResourceType(new Others())); perspectivePlugin = new Plugin(PERSPECTIVE_ID, PluginType.PERSPECTIVE_LAYOUT, null); perspectiveRenamedPlugin = new Plugin("newName", PluginType.PERSPECTIVE_LAYOUT, null); pluginAddedEvent = new PluginAdded(perspectivePlugin, null); pluginSavedEvent = new PluginSaved(perspectivePlugin, null); pluginRenamedEvent = new PluginRenamed(PERSPECTIVE_ID, perspectiveRenamedPlugin, null); pluginDeletedEvent = new PluginDeleted(perspectivePlugin, null); when(pluginServices.listPlugins()).thenReturn(Collections.emptyList()); testedPluginManager = new PerspectivePluginManager(clientTypeRegistry, null, navigationManager, new CallerMock<>(pluginServices), perspectiveChangedEvent); testedPluginManager.getPerspectivePlugins(plugins -> {}); }
@Override public Plugin createNewPlugin(final String pluginName, final PluginType type) { checkNotEmpty("pluginName", pluginName); checkCondition("valid plugin name", defaultFileNameValidator.isValid(pluginName)); final Path pluginRoot = getPluginPath(pluginName); if (getIoService().exists(pluginRoot)) { throw new PluginAlreadyExists(); } final Path pluginPath = pluginRoot.resolve(type.toString().toLowerCase() + ".plugin"); final Plugin plugin = new Plugin(pluginName, type, convert(pluginPath)); updatePlugin(pluginPath, plugin, true); return plugin; }