Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
niklauslee committed Apr 23, 2016
1 parent 8d4f4cc commit 824cf63
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
Thumbs.db

# ignore node_modules created by grunt, but not more deeply-nested node_modules
/node_modules
/npm-debug.log

#OSX .DS_Store files
.DS_Store
20 changes: 20 additions & 0 deletions icon_arrange-specializations.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 81 additions & 0 deletions main.js
@@ -0,0 +1,81 @@
/*
* Copyright (c) 2014 MKLab. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */
/*global define, $, _, window, app, type, appshell, document */

define(function (require, exports, module) {
"use strict";

var ExtensionUtils = app.getModule("utils/ExtensionUtils"),
CommandManager = app.getModule("command/CommandManager"),
Commands = app.getModule("command/Commands"),
MenuManager = app.getModule("menu/MenuManager"),
Repository = app.getModule("core/Repository"),
DiagramManager = app.getModule("diagrams/DiagramManager"),
SelectionManager = app.getModule("engine/SelectionManager");

// Command ID
var CMD_ARRANGE_SPECIALIZATIONS = "tools.arrange-specializations";

// Toolbar Button
var $button = $("<a id='toolbar-arrange-specializations' href='#' title='Arrange Specializations'></a>");


/**
* Arrange Specializations
*/
function arrangeSpecializations() {
var views = SelectionManager.getSelectedViews();
var dgm = DiagramManager.getCurrentDiagram();

var edges = Repository.getEdgeViewsOf(views[0]);

console.log(edges);
}

/**
* Initialize Extension
*/
function init() {
// Load our stylesheet
ExtensionUtils.loadStyleSheet(module, "styles.less");

// Toolbar Button
$("#toolbar .buttons").append($button);
$button.click(function () {
CommandManager.execute(CMD_ARRANGE_SPECIALIZATIONS);
});

// Register Commands
CommandManager.register("Arrange Specializations", CMD_ARRANGE_SPECIALIZATIONS, arrangeSpecializations);

// Setup Menus (Add in Tools)
var menu = MenuManager.getMenu(Commands.TOOLS);
menu.addMenuItem(CMD_ARRANGE_SPECIALIZATIONS, ["Ctrl-Alt-G"]);

}

init();

});
17 changes: 17 additions & 0 deletions package.json
@@ -0,0 +1,17 @@
{
"name": "staruml.arrange-specializations",
"title": "Arrange Specializations",
"description": "Quickly arrange specializations",
"homepage": "https://github.com/niklauslee/staruml-arrange-specializations",
"issues": "https://github.com/niklauslee/staruml-arrange-specializations/issues",
"version": "0.9.0",
"author": {
"name": "Minkyu Lee",
"email": "niklaus.lee@gmail.com",
"url": "https://github.com/niklauslee"
},
"license": "MIT",
"engines": {
"staruml": ">=2.0.0"
}
}
7 changes: 7 additions & 0 deletions styles.less
@@ -0,0 +1,7 @@
#toolbar-arrange-generalizations {
background-color: transparent;
background-image: url("icon_arrange-generalizations.svg");
background-position: 0 0;
background-repeat: no-repeat;
background-clip: content-box;
}

0 comments on commit 824cf63

Please sign in to comment.